56 template <
class Model>
58 const Aux& AL,
const typename Model::State& UR,
59 const Aux& AR,
int dir)
const {
60 const auto FL = m.flux(UL, AL, dir);
61 const auto FR = m.flux(UR, AR, dir);
62 const Real sL = m.max_wave_speed(UL, AL, dir);
63 const Real sR = m.max_wave_speed(UR, AR, dir);
64 const Real alpha = sL > sR ? sL : sR;
65 typename Model::State F;
66 for (
int c = 0; c < Model::n_vars; ++c)
67 F[c] =
Real(0.5) * (FL[c] + FR[c]) -
Real(0.5) * alpha * (UR[c] - UL[c]);
79 const typename Model::State& UR,
const Aux& AR,
int dir,
Real& sL,
82 m.wave_speeds(UL, AL, dir, lL, hL);
83 m.wave_speeds(UR, AR, dir, lR, hR);
84 sL = lL < lR ? lL : lR;
85 sR = hL > hR ? hL : hR;
97 const typename Model::State& UL,
99 const typename Model::State& UR,
101 const auto FL = m.flux(UL, AL, dir);
102 const auto FR = m.flux(UR, AR, dir);
107 typename Model::State F;
108 const Real inv =
Real(1) / (sR - sL);
109 for (
int c = 0; c < Model::n_vars; ++c)
110 F[c] = (sR * FL[c] - sL * FR[c] + sL * sR * (UR[c] - UL[c])) * inv;
120 template <
class Model>
122 const Aux& AL,
const typename Model::State& UR,
123 const Aux& AR,
int dir)
const {
143 requires(
const M m,
const typename M::State u,
const typename M::State v,
const Aux a,
Real p,
145 { m.pressure(u) } -> std::convertible_to<Real>;
146 m.wave_speeds(u, a, dir, sl, sr);
147 { m.contact_speed(u, v, p, q, sl, sr, dir) } -> std::convertible_to<Real>;
148 { m.hllc_star_state(u, p, sl, ss, dir) } -> std::same_as<typename M::State>;
157 const typename M::State ur,
const Aux ar,
int dir) {
158 { m.roe_dissipation(ul, al, ur, ar, dir) } -> std::same_as<typename M::State>;
170 template <
class Model>
172 const Aux& AL,
const typename Model::State& UR,
173 const Aux& AR,
int dir)
const {
180 const auto FL = m.flux(UL, AL, dir);
181 const auto FR = m.flux(UR, AR, dir);
186 const Real pL = m.pressure(UL), pR = m.pressure(UR);
187 const Real sStar = m.contact_speed(UL, UR, pL, pR, sL, sR, dir);
188 typename Model::State F;
190 const typename Model::State Us = m.hllc_star_state(UL, pL, sL, sStar, dir);
191 for (
int c = 0; c < Model::n_vars; ++c)
192 F[c] = FL[c] + sL * (Us[c] - UL[c]);
194 const typename Model::State Us = m.hllc_star_state(UR, pR, sR, sStar, dir);
195 for (
int c = 0; c < Model::n_vars; ++c)
196 F[c] = FR[c] + sR * (Us[c] - UR[c]);
200 const int in = (dir == 0) ? 1 : 2;
201 const int it = (dir == 0) ? 2 : 1;
202 const Real rL = UL[0], rR = UR[0];
203 const Real unL = UL[in] / rL, unR = UR[in] / rR;
204 const Real pL = m.pressure(UL), pR = m.pressure(UR);
207 const auto FL = m.flux(UL, AL, dir);
208 const auto FR = m.flux(UR, AR, dir);
215 const Real sStar = (pR - pL + rL * unL * (sL - unL) - rR * unR * (sR - unR)) /
216 (rL * (sL - unL) - rR * (sR - unR));
217 typename Model::State F;
219 const Real fac = rL * (sL - unL) / (sL - sStar);
220 typename Model::State Us;
222 Us[in] = fac * sStar;
223 Us[it] = fac * (UL[it] / rL);
224 Us[3] = fac * (UL[3] / rL + (sStar - unL) * (sStar + pL / (rL * (sL - unL))));
225 for (
int c = 0; c < 4; ++c)
226 F[c] = FL[c] + sL * (Us[c] - UL[c]);
228 const Real fac = rR * (sR - unR) / (sR - sStar);
229 typename Model::State Us;
231 Us[in] = fac * sStar;
232 Us[it] = fac * (UR[it] / rR);
233 Us[3] = fac * (UR[3] / rR + (sStar - unR) * (sStar + pR / (rR * (sR - unR))));
234 for (
int c = 0; c < 4; ++c)
235 F[c] = FR[c] + sR * (Us[c] - UR[c]);
258 template <
class Model>
260 const Aux& AL,
const typename Model::State& UR,
261 const Aux& AR,
int dir)
const {
266 const auto FL = m.flux(UL, AL, dir);
267 const auto FR = m.flux(UR, AR, dir);
268 const typename Model::State d = m.roe_dissipation(UL, AL, UR, AR, dir);
269 typename Model::State F;
270 for (
int c = 0; c < Model::n_vars; ++c)
271 F[c] =
Real(0.5) * (FL[c] + FR[c]) -
Real(0.5) * d[c];
274 const int in = (dir == 0) ? 1 : 2;
275 const int it = (dir == 0) ? 2 : 1;
276 const Real rL = UL[0], rR = UR[0];
277 const Real unL = UL[in] / rL, unR = UR[in] / rR;
278 const Real utL = UL[it] / rL, utR = UR[it] / rR;
279 const Real pL = m.pressure(UL), pR = m.pressure(UR);
280 const Real HL = (UL[3] + pL) / rL, HR = (UR[3] + pR) / rR;
283 const Real sqL = std::sqrt(rL), sqR = std::sqrt(rR), den = sqL + sqR;
284 const Real un = (sqL * unL + sqR * unR) / den;
285 const Real ut = (sqL * utL + sqR * utR) / den;
286 const Real H = (sqL * HL + sqR * HR) / den;
287 const Real rho = sqL * sqR;
288 const Real q2 = un * un + ut * ut;
290 const Real gm1 = pL / (UL[3] -
Real(0.5) * rL * (unL * unL + utL * utL));
291 const Real c2 = gm1 * (H -
Real(0.5) * q2);
292 const Real c = std::sqrt(c2);
295 const Real dr = rR - rL, dp = pR - pL, dun = unR - unL, dut = utR - utL;
296 const Real a1 = (dp - rho * c * dun) / (
Real(2) * c2);
297 const Real a2 = dr - dp / c2;
298 const Real a3 = rho * dut;
299 const Real a5 = (dp + rho * c * dun) / (
Real(2) * c2);
307 auto absfix = [eps](
Real l) {
308 const Real al = l < 0 ? -l : l;
309 return al < eps ?
Real(0.5) * (l * l / eps + eps) : al;
311 const Real al1 = absfix(un - c), al2 = (un < 0 ? -un : un), al5 = absfix(un + c);
314 const Real d_rho = al1 * a1 + al2 * a2 + al5 * a5;
315 const Real d_mn = al1 * a1 * (un - c) + al2 * a2 * un + al5 * a5 * (un + c);
316 const Real d_mt = al1 * a1 * ut + al2 * (a2 * ut + a3) + al5 * a5 * ut;
318 al1 * a1 * (H - un * c) + al2 * (a2 *
Real(0.5) * q2 + a3 * ut) + al5 * a5 * (H + un * c);
320 const auto FL = m.flux(UL, AL, dir);
321 const auto FR = m.flux(UR, AR, dir);
322 typename Model::State F;
323 F[0] =
Real(0.5) * (FL[0] + FR[0]) -
Real(0.5) * d_rho;
324 F[in] =
Real(0.5) * (FL[in] + FR[in]) -
Real(0.5) * d_mn;
325 F[it] =
Real(0.5) * (FL[it] + FR[it]) -
Real(0.5) * d_mt;
326 F[3] =
Real(0.5) * (FL[3] + FR[3]) -
Real(0.5) * d_E;
HLLC capability: the model provides the CONTACT wave speed and the STAR STATE on side k.
Definition numerical_flux.hpp:142
Roe capability: the model provides its FULL Roe dissipation d = |A_roe(UL, UR)| (UR - UL) – Roe avera...
Definition numerical_flux.hpp:156
Definition amr_hierarchy.hpp:29
double Real
Definition types.hpp:30
POPS_HD void hll_speeds(const Model &m, const typename Model::State &UL, const Aux &AL, const typename Model::State &UR, const Aux &AR, int dir, Real &sL, Real &sR)
hll_speeds: Davis estimates for the signal speeds of the HLL/HLLC solvers.
Definition numerical_flux.hpp:78
POPS_HD Model::State hll_flux_with_speeds(const Model &m, const typename Model::State &UL, const Aux &AL, const typename Model::State &UR, const Aux &AR, int dir, Real sL, Real sR)
hll_flux_with_speeds: HLL flux from ALREADY estimated signal speeds (sL, sR).
Definition numerical_flux.hpp:96
constexpr Real kRoeEntropyFixFraction
Width of the RoeFlux Harten entropy-fix smoothing, as a fraction of the Roe sound speed (eps = kRoeEn...
Definition numerical_flux.hpp:245
Pointwise types of the physics layer: StateVec<N> (conserved state) and Aux (auxiliary fields from th...
POINTWISE auxiliary fields shared with the physics: single coupling channel.
Definition state.hpp:123
HLLCFlux (HLL + Contact wave, Toro): 3 waves, resolves the contact discontinuity.
Definition numerical_flux.hpp:169
POPS_HD Model::State operator()(const Model &m, const typename Model::State &UL, const Aux &AL, const typename Model::State &UR, const Aux &AR, int dir) const
Definition numerical_flux.hpp:171
HLLFlux (Harten-Lax-van Leer): 2 signal speeds, less diffusive than Rusanov.
Definition numerical_flux.hpp:119
POPS_HD Model::State operator()(const Model &m, const typename Model::State &UL, const Aux &AL, const typename Model::State &UR, const Aux &AR, int dir) const
Definition numerical_flux.hpp:121
RoeFlux: Roe linearization + Harten entropy fix (acoustic waves).
Definition numerical_flux.hpp:257
POPS_HD Model::State operator()(const Model &m, const typename Model::State &UL, const Aux &AL, const typename Model::State &UR, const Aux &AR, int dir) const
Definition numerical_flux.hpp:259
RusanovFlux (local Lax-Friedrichs): robust flux, compatible with any minimal PhysicalModel.
Definition numerical_flux.hpp:55
POPS_HD Model::State operator()(const Model &m, const typename Model::State &UL, const Aux &AL, const typename Model::State &UR, const Aux &AR, int dir) const
Definition numerical_flux.hpp:57
Base scalar types and the POPS_HD macro (host+device portability).
#define POPS_HD
Definition types.hpp:25