30#ifndef DUMUX_SHALLOWWATER_BOUNDARYFLUXES_HH
31#define DUMUX_SHALLOWWATER_BOUNDARYFLUXES_HH
51template<
class Scalar,
class GlobalPosition>
53 const Scalar waterDepthInside,
54 const Scalar velocityXInside,
55 const Scalar velocityYInside,
57 const GlobalPosition& nxy)
60 std::array<Scalar, 3> cellStateOutside;
61 cellStateOutside[0] = waterDepthBoundary;
64 const auto uboundIn = nxy[0] * velocityXInside + nxy[1] * velocityYInside;
65 const auto uboundQut = uboundIn + 2.0 * sqrt(gravity * waterDepthInside) - 2.0 * sqrt(gravity * cellStateOutside[0]);
67 cellStateOutside[1] = (nxy[0] * uboundQut);
68 cellStateOutside[2] = (nxy[1] * uboundQut);
70 return cellStateOutside;
85template<
class Scalar,
class GlobalPosition>
87 const Scalar waterDepthInside,
88 const Scalar velocityXInside,
89 const Scalar velocityYInside,
91 const GlobalPosition& nxy)
93 std::array<Scalar, 3> cellStateOutside;
99 if (abs(dischargeBoundary) > 1.0e-9)
101 const auto uboundIn = nxy[0]*velocityXInside + nxy[1]*velocityYInside;
102 const auto alphal = uboundIn + 2.0*sqrt(gravity * waterDepthInside);
105 constexpr Scalar tol_hstar = 1.0E-12;
106 constexpr Scalar ink_hstar = 1.0E-9;
107 constexpr int maxstep_hstar = 30;
110 for (
int i = 0; i < maxstep_hstar; ++i)
112 Scalar f_hstar = alphal - dischargeBoundary/hstar - 2 * sqrt(gravity * hstar);
113 Scalar df_hstar = (f_hstar -(alphal - dischargeBoundary/(hstar + ink_hstar) - 2 * sqrt(gravity * (hstar+ink_hstar))))/ink_hstar;
114 Scalar dx_hstar = -f_hstar/df_hstar;
115 hstar = max(hstar - dx_hstar,0.001);
117 if (dx_hstar*dx_hstar < tol_hstar)
121 const auto qinner = (nxy[0] * waterDepthInside * velocityYInside) - (nxy[1] * waterDepthInside * velocityXInside);
122 cellStateOutside[0] = hstar;
123 cellStateOutside[1] = (nxy[0] * dischargeBoundary - nxy[1] * qinner)/hstar;
124 cellStateOutside[2] = (nxy[1] * dischargeBoundary + nxy[0] * qinner)/hstar;
127 return cellStateOutside;
139template<
class PrimaryVariables,
class Scalar,
class GlobalPosition>
141 const Scalar turbulentViscosity,
142 const PrimaryVariables& state,
143 const GlobalPosition& cellCenterToBoundaryFaceCenter,
148 if (abs(alphaWall) <= 1.0e-9)
151 const auto waterDepth = state[0];
154 if (waterDepth <= 0.001)
157 const auto xVelocity = state[1];
158 const auto yVelocity = state[2];
159 const auto distance = cellCenterToBoundaryFaceCenter.two_norm();
164 const auto gradU = -alphaWall * xVelocity/
distance;
165 const auto gradV = -alphaWall * yVelocity/
distance;
173 -turbulentViscosity*waterDepth*gradU*direction,
174 -turbulentViscosity*waterDepth*gradV*direction
186template<
class PrimaryVariables,
class Scalar,
class GlobalPosition>
188 const PrimaryVariables& state,
189 const GlobalPosition& cellCenterToBoundaryFaceCenter,
194 if (abs(ksWall) <= 1.0e-9)
198 const Scalar xVelocity = state[1];
199 const Scalar yVelocity = state[2];
200 const Scalar velocityMagnitude = hypot(xVelocity, yVelocity);
201 const Scalar
distance = cellCenterToBoundaryFaceCenter.two_norm();
202 const Scalar y0w = ksWall/30.0;
203 constexpr Scalar kappa2 = 0.41*0.41;
206 using std::log;
using std::max;
207 const auto logYPlus = log(
distance/y0w+1.0);
208 const auto fac = kappa2*velocityMagnitude / max(1.0e-3,logYPlus*logYPlus);
214 const auto tauWx = direction*fac*xVelocity;
215 const auto tauWy = direction*fac*yVelocity;
218 const auto waterDepth = state[0];
219 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:292
Vector unitNormal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: normal.hh:68
Definition: exactriemann.hh:31
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:86
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:187
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:140
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:52