version 3.8
riemannproblem.hh
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3//
4// SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
13#ifndef DUMUX_FLUX_SHALLOW_WATER_RIEMANN_PROBLEM_HH
14#define DUMUX_FLUX_SHALLOW_WATER_RIEMANN_PROBLEM_HH
15
19
20namespace Dumux {
21namespace ShallowWater {
22
58template<class Scalar, class GlobalPosition>
59std::array<Scalar,3> riemannProblem(const Scalar waterDepthLeft,
60 const Scalar waterDepthRight,
61 Scalar velocityXLeft,
62 Scalar velocityXRight,
63 Scalar velocityYLeft,
64 Scalar velocityYRight,
65 const Scalar bedSurfaceLeft,
66 const Scalar bedSurfaceRight,
67 const Scalar gravity,
68 const GlobalPosition& nxy)
69{
70 using std::max;
71
72 // hydrostatic reconstrucion after Audusse
73 const Scalar dzl = max(0.0, bedSurfaceRight - bedSurfaceLeft);
74 const Scalar waterDepthLeftReconstructed = max(0.0, waterDepthLeft - dzl);
75 const Scalar dzr = max(0.0, bedSurfaceLeft - bedSurfaceRight);
76 const Scalar waterDepthRightReconstructed = max(0.0, waterDepthRight - dzr);
77
78 // make rotation of the flux we compute an 1d flux
79 Scalar tempFlux = velocityXLeft;
80 velocityXLeft = nxy[0] * tempFlux + nxy[1] * velocityYLeft;
81 velocityYLeft = -nxy[1] * tempFlux + nxy[0] * velocityYLeft;
82
83 tempFlux = velocityXRight;
84 velocityXRight = nxy[0] * tempFlux + nxy[1] * velocityYRight;
85 velocityYRight = -nxy[1] * tempFlux + nxy[0] * velocityYRight;
86
87 auto riemannResult = ShallowWater::exactRiemann(waterDepthLeftReconstructed,
88 waterDepthRightReconstructed,
89 velocityXLeft,
90 velocityXRight,
91 velocityYLeft,
92 velocityYRight,
93 gravity);
94
95 //redo rotation
96 tempFlux = riemannResult.flux[1];
97 riemannResult.flux[1] = nxy[0] * tempFlux - nxy[1] * riemannResult.flux[2];
98 riemannResult.flux[2] = nxy[1] * tempFlux + nxy[0] * riemannResult.flux[2];
99
100 // Add reconstruction flux from Audusse reconstruction
101 const Scalar hgzl = 0.5 * (waterDepthLeftReconstructed + waterDepthLeft) * (waterDepthLeftReconstructed - waterDepthLeft);
102 const Scalar hdxzl = gravity * nxy[0] * hgzl;
103 const Scalar hdyzl = gravity * nxy[1] * hgzl;
104
105 /*Right side is computed from the other side otherwise the
106 following "non-symetric" fluxes are needed:
107
108 Scalar hgzr = 0.5 * (waterDepthRightReconstructed + waterDepthRight) * (waterDepthRightReconstructed - waterDepthRight);
109 Scalar hdxzr = gravity * nxy[0] * hgzr;
110 Scalar hdyzrhdyzr = gravity * nxy[1] * hgzr;
111 */
112
113 // compute the mobility of the flux with the fluxlimiter
114 static const Scalar upperWaterDepthFluxLimiting = getParam<Scalar>("FluxLimiterLET.UpperWaterDepth", 1e-3);
115 static const Scalar lowerWaterDepthFluxLimiting = getParam<Scalar>("FluxLimiterLET.LowerWaterDepth", 1e-5);
116 static const bool upwindWaterDepthFluxLimiting = getParam<bool>("FluxLimiterLET.UpwindFluxLimiting", false);
117
118 Scalar limitingDepth = (waterDepthLeftReconstructed + waterDepthRightReconstructed) * 0.5;
119
120 //Using the upwind water depth from the flux direction can improve stability.
121 if (upwindWaterDepthFluxLimiting)
122 {
123 if (riemannResult.flux[0] < 0)
124 {
125 limitingDepth = waterDepthRightReconstructed;
126 }else
127 {
128 limitingDepth = waterDepthLeftReconstructed;
129 }
130 }
131
132 const Scalar mobility = ShallowWater::fluxLimiterLET(limitingDepth,
133 limitingDepth,
134 upperWaterDepthFluxLimiting,
135 lowerWaterDepthFluxLimiting);
136 std::array<Scalar, 3> localFlux;
137 localFlux[0] = riemannResult.flux[0] * mobility;
138 localFlux[1] = (riemannResult.flux[1] - hdxzl);
139 localFlux[2] = (riemannResult.flux[2] - hdyzl);
140
141 return localFlux;
142}
143
144} // end namespace ShallowWater
145} // end namespace Dumux
146
147#endif
Function to compute the Riemann flux at the interface.
Function to limit the fluxes.
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
static Scalar fluxLimiterLET(const Scalar valueLeft, const Scalar valueRight, const Scalar upperH, const Scalar lowerH)
Flux limiter function to scale fluxes for small water depths.
Definition: fluxlimiterlet.hh:40
std::array< Scalar, 3 > riemannProblem(const Scalar waterDepthLeft, const Scalar waterDepthRight, Scalar velocityXLeft, Scalar velocityXRight, Scalar velocityYLeft, Scalar velocityYRight, const Scalar bedSurfaceLeft, const Scalar bedSurfaceRight, const Scalar gravity, const GlobalPosition &nxy)
Construct a Riemann problem and solve it.
Definition: riemannproblem.hh:59
std::string mobility(int phaseIdx) noexcept
I/O name of mobility for multiphase systems.
Definition: name.hh:89
Definition: adapt.hh:17
The infrastructure to retrieve run-time parameters from Dune::ParameterTrees.