30#ifndef DUMUX_SHALLOWWATER_BOUNDARYFLUXES_HH
31#define DUMUX_SHALLOWWATER_BOUNDARYFLUXES_HH
37namespace ShallowWater {
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;
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 > 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