18#ifndef DUMUX_SHALLOWWATER_BOUNDARYFLUXES_HH
19#define DUMUX_SHALLOWWATER_BOUNDARYFLUXES_HH
39template<
class Scalar,
class GlobalPosition>
41 const Scalar waterDepthInside,
42 const Scalar velocityXInside,
43 const Scalar velocityYInside,
45 const GlobalPosition& nxy)
48 std::array<Scalar, 3> cellStateOutside;
49 cellStateOutside[0] = waterDepthBoundary;
52 const auto uboundIn = nxy[0] * velocityXInside + nxy[1] * velocityYInside;
53 const auto uboundQut = uboundIn + 2.0 * sqrt(gravity * waterDepthInside) - 2.0 * sqrt(gravity * cellStateOutside[0]);
55 cellStateOutside[1] = (nxy[0] * uboundQut);
56 cellStateOutside[2] = (nxy[1] * uboundQut);
58 return cellStateOutside;
73template<
class Scalar,
class GlobalPosition>
75 const Scalar waterDepthInside,
76 const Scalar velocityXInside,
77 const Scalar velocityYInside,
79 const GlobalPosition& nxy)
81 std::array<Scalar, 3> cellStateOutside;
87 if (abs(dischargeBoundary) > 1.0e-9)
89 const auto uboundIn = nxy[0]*velocityXInside + nxy[1]*velocityYInside;
90 const auto alphal = uboundIn + 2.0*sqrt(gravity * waterDepthInside);
93 constexpr Scalar tol_hstar = 1.0E-12;
94 constexpr Scalar ink_hstar = 1.0E-9;
95 constexpr int maxstep_hstar = 30;
98 for (
int i = 0; i < maxstep_hstar; ++i)
100 Scalar f_hstar = alphal - dischargeBoundary/hstar - 2 * sqrt(gravity * hstar);
101 Scalar df_hstar = (f_hstar -(alphal - dischargeBoundary/(hstar + ink_hstar) - 2 * sqrt(gravity * (hstar+ink_hstar))))/ink_hstar;
102 Scalar dx_hstar = -f_hstar/df_hstar;
103 hstar = max(hstar - dx_hstar,0.001);
105 if (dx_hstar*dx_hstar < tol_hstar)
109 const auto qinner = (nxy[0] * waterDepthInside * velocityYInside) - (nxy[1] * waterDepthInside * velocityXInside);
110 cellStateOutside[0] = hstar;
111 cellStateOutside[1] = (nxy[0] * dischargeBoundary - nxy[1] * qinner)/hstar;
112 cellStateOutside[2] = (nxy[1] * dischargeBoundary + nxy[0] * qinner)/hstar;
115 return cellStateOutside;
127template<
class PrimaryVariables,
class Scalar,
class GlobalPosition>
129 const Scalar turbulentViscosity,
130 const PrimaryVariables& state,
131 const GlobalPosition& cellCenterToBoundaryFaceCenter,
136 if (abs(alphaWall) <= 1.0e-9)
139 const auto waterDepth = state[0];
142 if (waterDepth <= 0.001)
145 const auto xVelocity = state[1];
146 const auto yVelocity = state[2];
147 const auto distance = cellCenterToBoundaryFaceCenter.two_norm();
152 const auto gradU = -alphaWall * xVelocity/
distance;
153 const auto gradV = -alphaWall * yVelocity/
distance;
161 -turbulentViscosity*waterDepth*gradU*direction,
162 -turbulentViscosity*waterDepth*gradV*direction
174template<
class PrimaryVariables,
class Scalar,
class GlobalPosition>
176 const PrimaryVariables& state,
177 const GlobalPosition& cellCenterToBoundaryFaceCenter,
182 if (abs(ksWall) <= 1.0e-9)
186 const Scalar xVelocity = state[1];
187 const Scalar yVelocity = state[2];
188 const Scalar velocityMagnitude = hypot(xVelocity, yVelocity);
189 const Scalar
distance = cellCenterToBoundaryFaceCenter.two_norm();
190 const Scalar y0w = ksWall/30.0;
191 constexpr Scalar kappa2 = 0.41*0.41;
194 using std::log;
using std::max;
195 const auto logYPlus = log(
distance/y0w+1.0);
196 const auto fac = kappa2*velocityMagnitude / max(1.0e-3,logYPlus*logYPlus);
202 const auto tauWx = direction*fac*xVelocity;
203 const auto tauWy = direction*fac*yVelocity;
206 const auto waterDepth = state[0];
207 return {0.0, waterDepth*tauWx, waterDepth*tauWy};
static ctype distance(const Dune::FieldVector< ctype, dimWorld > &a, const Dune::FieldVector< ctype, dimWorld > &b)
Compute the shortest distance between two points.
Definition: distance.hh:282
Vector unitNormal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:58
Definition: exactriemann.hh:19
std::array< Scalar, 3 > fixedDischargeBoundary(const Scalar dischargeBoundary, const Scalar waterDepthInside, const Scalar velocityXInside, const Scalar velocityYInside, const Scalar gravity, const GlobalPosition &nxy)
Compute the outer cell state for a fixed discharge boundary.
Definition: boundaryfluxes.hh:74
std::array< Scalar, 3 > nikuradseWallBoundary(const Scalar ksWall, const PrimaryVariables &state, const GlobalPosition &cellCenterToBoundaryFaceCenter, const GlobalPosition &unitNormal)
Compute the viscosity/diffusive flux at a rough wall boundary using Nikuradse formulation.
Definition: boundaryfluxes.hh:175
std::array< Scalar, 3 > noslipWallBoundary(const Scalar alphaWall, const Scalar turbulentViscosity, const PrimaryVariables &state, const GlobalPosition &cellCenterToBoundaryFaceCenter, const GlobalPosition &unitNormal)
Compute the viscosity/diffusive flux at a rough wall boundary using no-slip formulation.
Definition: boundaryfluxes.hh:128
std::array< Scalar, 3 > fixedWaterDepthBoundary(const Scalar waterDepthBoundary, const Scalar waterDepthInside, const Scalar velocityXInside, const Scalar velocityYInside, const Scalar gravity, const GlobalPosition &nxy)
Compute the outer cell state for fixed water depth boundary.
Definition: boundaryfluxes.hh:40