12#ifndef DUMUX_FLUX_SHALLOW_WATER_EXACT_RIEMANN_HH
13#define DUMUX_FLUX_SHALLOW_WATER_EXACT_RIEMANN_HH
19namespace ShallowWater{
21template<
typename Scalar>
68 constexpr int maxsteps = 200;
69 constexpr Scalar tol = 1.0E-12;
77 const auto cl = sqrt(grav * max(dl, 0.0));
78 const auto cr = sqrt(grav * max(dr, 0.0));
79 const auto dcrit = (ur - ul) - 2.0*(cl + cr);
82 if ((dl <= 0) || (dr <= 0) || (dcrit >= 0))
87 const auto shr = ur + cr;
100 const auto str = ur - 2.0*cr;
103 sol.
velocityX = (ur - 2.0 *cr + 2.0*s)/3.0;
104 const auto c = (-ur + 2.0*cr +s )/3.0;
124 const auto shl = ul-cl;
135 const auto stl = ul + 2.0 *cl;
139 sol.
velocityX = (ul + 2.0 *cl + 2.0*s)/3.0;
140 const auto c = (ul + 2.0*cl - s)/3.0;
157 const auto shl = ul - cl;
158 const auto shr = ur + cr;
159 const auto ssl = ul + 2.0 * cl;
160 const auto ssr = ur - 2.0 * cr;
169 if((s > shl) && (s <= ssl))
171 sol.
velocityX = (ul + 2.0 * cl + 2.0*s)/3.0;
172 const auto c = (ul + 2.0*cl - s)/3.0;
177 if((s > ssl) && (s <= ssr))
184 if ((s > ssr ) && (s <= shr))
186 sol.
velocityX = (ur - 2.0*cr + 2.0*s)/3.0;
187 const auto c = (-ur + 2.0*cr + s)/3.0;
206 const auto tmp = 0.5 * (cl + cr) - 0.25 * (ul - ur);
207 auto ds = (1.0/grav) * tmp * tmp;
210 const auto dmin = min(dl, dr);
215 const auto gel = sqrt(0.5*grav * (ds+dl)/(ds*dl));
216 const auto ger = sqrt(0.5*grav * (ds+dr)/(ds*dr));
217 ds = (gel * dl + ger * dr - (ur-ul))/(gel + ger);
225 Scalar fl = 0.0, fr = 0.0, fld = 0.0, frd = 0.0;
227 for (
int i=0; i <= maxsteps; ++i)
234 const auto c = sqrt(grav * ds);
241 const auto ges = sqrt(0.5 * grav * (ds+dl)/(ds*dl));
242 fl = (ds - dl) * ges;
243 fld = ges - 0.25 * grav * (ds - dl)/(ges * ds * ds);
249 const auto c = sqrt(grav * ds);
256 const auto ges = sqrt(0.5 * grav * (ds+dr)/(ds*dr));
257 fr = (ds - dr) * ges;
258 frd = ges - 0.25 * grav * (ds - dr)/(ges * ds * ds);
261 ds -= (fl + fr + ur - ul)/(fld + frd);
262 const auto cha = abs(ds - d0)/(0.5*(ds + d0));
280 const auto c = sqrt(grav * ds);
286 const auto ges = sqrt(0.5*grav*(ds + dl)/(ds*dl));
287 fl = (ds - dl) * ges;
292 const auto c = sqrt(grav * ds);
298 const auto ges = sqrt(0.5*grav*(ds + dr)/(ds*dr));
299 fr = (ds - dr) * ges;
302 const auto us = 0.5*(ul + ur) + 0.5*(fr - fl);
303 const auto cs = sqrt(grav*ds);
314 const auto ql = sqrt((ds + dl)*ds/(2.0*dl*dl));
315 const auto sl = ul - cl*ql;
335 const auto shl = ul-cl;
346 const auto stl = us -cs;
351 sol.
velocityX = (ul + 2.0*cl + 2.0 * s)/3.0;
352 const auto c = (ul + 2.0* cl - s)/3.0;
374 const auto qr = sqrt((ds + dr)*ds /(2.0*dr*dr));
375 const auto sr = ur + cr*qr;
396 const auto shr = ur + cr;
407 const auto str = us + cs;
412 sol.
velocityX = (ur - 2.0*cr + 2.0*s)/3.0;
413 const auto c = (-ur + 2.0*cr + s)/3.0;
RiemannSolution< Scalar > exactRiemann(const Scalar dl, const Scalar dr, const Scalar ul, const Scalar ur, const Scalar vl, const Scalar vr, const Scalar grav, const Scalar s=0.0)
Exact Riemann solver for the shallow water equations.
Definition: exactriemann.hh:54
Definition: exactriemann.hh:22
Scalar waterDepth
Definition: exactriemann.hh:24
std::array< Scalar, 3 > flux
Definition: exactriemann.hh:23
Scalar velocityY
Definition: exactriemann.hh:26
Scalar velocityX
Definition: exactriemann.hh:25