24#ifndef DUMUX_FLUX_SHALLOW_WATER_EXACT_RIEMANN_HH
25#define DUMUX_FLUX_SHALLOW_WATER_EXACT_RIEMANN_HH
31namespace ShallowWater{
33template<
typename Scalar>
75 constexpr int maxsteps = 200;
76 constexpr Scalar tol = 1.0E-12;
84 const auto cl = sqrt(grav * max(dl, 0.0));
85 const auto cr = sqrt(grav * max(dr, 0.0));
86 const auto dcrit = (ur - ul) - 2.0*(cl + cr);
89 if ((dl <= 0) || (dr <= 0) || (dcrit >= 0))
94 const auto shr = ur + cr;
107 const auto str = ur - 2.0*cr;
110 sol.
velocityX = (ur - 2.0 *cr + 2.0*s)/3.0;
111 const auto c = (-ur + 2.0*cr +s )/3.0;
131 const auto shl = ul-cl;
142 const auto stl = ul + 2.0 *cl;
146 sol.
velocityX = (ul + 2.0 *cl + 2.0*s)/3.0;
147 const auto c = (ul + 2.0*cl - s)/3.0;
164 const auto shl = ul - cl;
165 const auto shr = ur + cr;
166 const auto ssl = ul + 2.0 * cl;
167 const auto ssr = ur - 2.0 * cr;
176 if((s > shl) && (s <= ssl))
178 sol.
velocityX = (ul + 2.0 * cl + 2.0*s)/3.0;
179 const auto c = (ul + 2.0*cl - s)/3.0;
184 if((s > ssl) && (s <= ssr))
191 if ((s > ssr ) && (s <= shr))
193 sol.
velocityX = (ur - 2.0*cr + 2.0*s)/3.0;
194 const auto c = (-ur + 2.0*cr + s)/3.0;
213 const auto tmp = 0.5 * (cl + cr) - 0.25 * (ul - ur);
214 auto ds = (1.0/grav) * tmp * tmp;
217 const auto dmin = min(dl, dr);
221 const auto gel = sqrt(0.5*grav * (ds+dl)/(ds*dl));
222 const auto ger = sqrt(0.5*grav * (ds+dr)/(ds*dr));
223 ds = (gel * dl + ger * dr - (ur-ul))/(gel + ger);
230 Scalar fl = 0.0, fr = 0.0, fld = 0.0, frd = 0.0;
232 for (
int i=0; i <= maxsteps; ++i)
239 const auto c = sqrt(grav * ds);
246 const auto ges = sqrt(0.5 * grav * (ds+dl)/(ds*dl));
247 fl = (ds - dl) * ges;
248 fld = ges - 0.25 * grav * (ds - dl)/(ges * ds * ds);
254 const auto c = sqrt(grav * ds);
261 const auto ges = sqrt(0.5 * grav * (ds+dr)/(ds*dr));
262 fr = (ds - dr) * ges;
263 frd = ges - 0.25 * grav * (ds - dr)/(ges * ds * ds);
266 ds -= (fl + fr + ur - ul)/(fld + frd);
267 const auto cha = abs(ds - d0)/(0.5*(ds + d0));
285 const auto c = sqrt(grav * ds);
291 const auto ges = sqrt(0.5*grav*(ds + dl)/(ds*dl));
292 fl = (ds - dl) * ges;
297 const auto c = sqrt(grav * ds);
303 const auto ges = sqrt(0.5*grav*(ds + dr)/(ds*dr));
304 fr = (ds - dr) * ges;
308 const auto us = 0.5*(ul + ur) + 0.5*(fr - fl);
309 const auto cs = sqrt(grav*ds);
319 const auto ql = sqrt((ds + dl)*ds/(2.0*dl*dl));
320 const auto sl = ul - cl*ql;
340 const auto shl = ul-cl;
351 const auto stl = us -cs;
356 sol.
velocityX = (ul + 2.0*cl + 2.0 * s)/3.0;
357 const auto c = (ul + 2.0* cl - s)/3.0;
379 const auto qr = sqrt((ds + dr)*ds /(2.0*dr*dr));
380 const auto sr = ur + cr*qr;
401 const auto shr = ur + cr;
412 const auto str = us + cs;
417 sol.
velocityX = (ur - 2.0*cr + 2.0*s)/3.0;
418 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 Shallow water equations.
Definition: exactriemann.hh:61
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Definition: exactriemann.hh:34
Scalar waterDepth
Definition: exactriemann.hh:36
std::array< Scalar, 3 > flux
Definition: exactriemann.hh:35
Scalar velocityY
Definition: exactriemann.hh:38
Scalar velocityX
Definition: exactriemann.hh:37