Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
exact.hpp File Reference

Exact Riemann solver for GSPH (Toro 2009). More...

Include dependency graph for exact.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  shammodels::gsph::riemann::ExactState< Tscal >
 Left/right primitive state for the exact solver (velocity along pair axis). More...

Namespaces

namespace  shammodels
 namespace for models

Functions

template<class Tscal>
Tscal shammodels::gsph::riemann::exact_v_xc_shock (Tscal LR, Tscal p2, Tscal p1, Tscal r1, Tscal gamma)
 Relative velocity jump across a shock wave (Rankine-Hugoniot).
template<class Tscal>
Tscal shammodels::gsph::riemann::exact_v_xc_rarefaction (Tscal LR, Tscal p2, Tscal p1, Tscal r1, Tscal gamma)
 Relative velocity jump across a rarefaction wave (isentropic relation).
template<class Tscal>
Tscal shammodels::gsph::riemann::exact_v_lr_ss (Tscal pS, ExactState< Tscal > left, ExactState< Tscal > right, Tscal gamma)
template<class Tscal>
Tscal shammodels::gsph::riemann::exact_v_lr_rs (Tscal pS, ExactState< Tscal > left, ExactState< Tscal > right, Tscal gamma)
template<class Tscal>
Tscal shammodels::gsph::riemann::exact_v_lr_sr (Tscal pS, ExactState< Tscal > left, ExactState< Tscal > right, Tscal gamma)
template<class Tscal>
Tscal shammodels::gsph::riemann::exact_v_lr_rr (Tscal pS, ExactState< Tscal > left, ExactState< Tscal > right, Tscal gamma)
template<class Tscal>
i32 shammodels::gsph::riemann::exact_judge_wave_pattern (ExactState< Tscal > left, ExactState< Tscal > right, Tscal gamma)
 Wave pattern codes: 11=shock/shock, 21=rarefaction/shock, 12=shock/rarefaction, 22=rarefaction/rarefaction.
template<class Tscal, class ResidualFn>
Tscal shammodels::gsph::riemann::exact_bisection_generic (Tscal posi, Tscal nega, Tscal v_lr_0, Tscal tol, u32 max_iter, ResidualFn residual)
 Shared bisection loop for a single wave-pattern's residual function.
template<class Tscal>
Tscal shammodels::gsph::riemann::exact_bisection_ss (ExactState< Tscal > left, ExactState< Tscal > right, Tscal gamma, Tscal tol, u32 max_iter)
 Bisection solve for the shock/shock (11) wave pattern.
template<class Tscal>
Tscal shammodels::gsph::riemann::exact_bisection_rs (ExactState< Tscal > left, ExactState< Tscal > right, Tscal gamma, Tscal tol, u32 max_iter)
 Bisection solve for the rarefaction/shock (21) wave pattern.
template<class Tscal>
Tscal shammodels::gsph::riemann::exact_bisection_sr (ExactState< Tscal > left, ExactState< Tscal > right, Tscal gamma, Tscal tol, u32 max_iter)
 Bisection solve for the shock/rarefaction (12) wave pattern.
template<class Tscal>
Tscal shammodels::gsph::riemann::exact_bisection_rr (ExactState< Tscal > left, ExactState< Tscal > right, Tscal gamma, Tscal tol, u32 max_iter)
 Bisection solve for the rarefaction/rarefaction (22) wave pattern.
template<class Tscal>
RiemannResult< Tscal > shammodels::gsph::riemann::exact_solver (Tscal u_L, Tscal rho_L, Tscal p_L, Tscal u_R, Tscal rho_R, Tscal p_R, Tscal gamma, Tscal tol=Tscal{1.0e-8}, u32 max_iter=100)
 Exact Riemann solver for the 1D Euler equations (ideal gas).

Detailed Description

Exact Riemann solver for GSPH (Toro 2009).

Author
Guo Yansong (guo.y.nosp@m.anso.nosp@m.ng.ng.nosp@m.y@gm.nosp@m.ail.c.nosp@m.om)
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)
Yona Lapeyre (yona..nosp@m.lape.nosp@m.yre@e.nosp@m.ns-l.nosp@m.yon.f.nosp@m.r)

Implements the exact solution of the 1D Riemann problem for an ideal gas: the wave pattern (shock/rarefaction on each side) is classified first from the initial states, then the matching closed-form shock (Rankine-Hugoniot) or rarefaction (isentropic) relation is solved to convergence via bisection.

References:

  • Toro, E.F. (2009) "Riemann Solvers and Numerical Methods for Fluid Dynamics"

Definition in file exact.hpp.

Function Documentation

◆ exact_bisection_generic()

template<class Tscal, class ResidualFn>
Tscal shammodels::gsph::riemann::exact_bisection_generic ( Tscal posi,
Tscal nega,
Tscal v_lr_0,
Tscal tol,
u32 max_iter,
ResidualFn residual )
inline

Shared bisection loop for a single wave-pattern's residual function.

Parameters
posiInitial bracket endpoint with positive residual
negaInitial bracket endpoint with non-positive residual
v_lr_0Target value (left.v - right.v) the residual must reach
residualWave-pattern-specific v_lr_XX(p, left, right, gamma) function

Definition at line 144 of file exact.hpp.

◆ exact_bisection_rr()

template<class Tscal>
Tscal shammodels::gsph::riemann::exact_bisection_rr ( ExactState< Tscal > left,
ExactState< Tscal > right,
Tscal gamma,
Tscal tol,
u32 max_iter )
inline

Bisection solve for the rarefaction/rarefaction (22) wave pattern.

Definition at line 244 of file exact.hpp.

◆ exact_bisection_rs()

template<class Tscal>
Tscal shammodels::gsph::riemann::exact_bisection_rs ( ExactState< Tscal > left,
ExactState< Tscal > right,
Tscal gamma,
Tscal tol,
u32 max_iter )
inline

Bisection solve for the rarefaction/shock (21) wave pattern.

Definition at line 208 of file exact.hpp.

◆ exact_bisection_sr()

template<class Tscal>
Tscal shammodels::gsph::riemann::exact_bisection_sr ( ExactState< Tscal > left,
ExactState< Tscal > right,
Tscal gamma,
Tscal tol,
u32 max_iter )
inline

Bisection solve for the shock/rarefaction (12) wave pattern.

Definition at line 226 of file exact.hpp.

◆ exact_bisection_ss()

template<class Tscal>
Tscal shammodels::gsph::riemann::exact_bisection_ss ( ExactState< Tscal > left,
ExactState< Tscal > right,
Tscal gamma,
Tscal tol,
u32 max_iter )
inline

Bisection solve for the shock/shock (11) wave pattern.

Definition at line 174 of file exact.hpp.

◆ exact_judge_wave_pattern()

template<class Tscal>
i32 shammodels::gsph::riemann::exact_judge_wave_pattern ( ExactState< Tscal > left,
ExactState< Tscal > right,
Tscal gamma )
inline

Wave pattern codes: 11=shock/shock, 21=rarefaction/shock, 12=shock/rarefaction, 22=rarefaction/rarefaction.

Definition at line 113 of file exact.hpp.

◆ exact_solver()

template<class Tscal>
RiemannResult< Tscal > shammodels::gsph::riemann::exact_solver ( Tscal u_L,
Tscal rho_L,
Tscal p_L,
Tscal u_R,
Tscal rho_R,
Tscal p_R,
Tscal gamma,
Tscal tol = Tscal{1.0e-8},
u32 max_iter = 100 )
inline

Exact Riemann solver for the 1D Euler equations (ideal gas).

Classifies the wave pattern from the initial states, then solves the matching shock/rarefaction relation to convergence via bisection.

The left/right convention matches iterative_solver()/hllc_solver():

  • Left state (L): particle on the "minus" side of the interface
  • Right state (R): particle on the "plus" side of the interface
  • Positive velocity points from L to R
Template Parameters
TscalScalar type (f32 or f64)
Parameters
u_LLeft state velocity (normal component)
rho_LLeft state density
p_LLeft state pressure
u_RRight state velocity (normal component)
rho_RRight state density
p_RRight state pressure
gammaAdiabatic index
tolBisection convergence tolerance (default: 1e-8)
max_iterMaximum bisection iterations (default: 100)
Returns
RiemannResult with p_star and v_star

Definition at line 281 of file exact.hpp.

◆ exact_v_lr_rr()

template<class Tscal>
Tscal shammodels::gsph::riemann::exact_v_lr_rr ( Tscal pS,
ExactState< Tscal > left,
ExactState< Tscal > right,
Tscal gamma )
inline

Definition at line 102 of file exact.hpp.

◆ exact_v_lr_rs()

template<class Tscal>
Tscal shammodels::gsph::riemann::exact_v_lr_rs ( Tscal pS,
ExactState< Tscal > left,
ExactState< Tscal > right,
Tscal gamma )
inline

Definition at line 88 of file exact.hpp.

◆ exact_v_lr_sr()

template<class Tscal>
Tscal shammodels::gsph::riemann::exact_v_lr_sr ( Tscal pS,
ExactState< Tscal > left,
ExactState< Tscal > right,
Tscal gamma )
inline

Definition at line 95 of file exact.hpp.

◆ exact_v_lr_ss()

template<class Tscal>
Tscal shammodels::gsph::riemann::exact_v_lr_ss ( Tscal pS,
ExactState< Tscal > left,
ExactState< Tscal > right,
Tscal gamma )
inline

Definition at line 81 of file exact.hpp.

◆ exact_v_xc_rarefaction()

template<class Tscal>
Tscal shammodels::gsph::riemann::exact_v_xc_rarefaction ( Tscal LR,
Tscal p2,
Tscal p1,
Tscal r1,
Tscal gamma )
inline

Relative velocity jump across a rarefaction wave (isentropic relation).

Parameters
LR-1 for the left wave, +1 for the right wave
p2Trial star-region pressure
p1Pressure of the state ahead of the wave
r1Density of the state ahead of the wave
gammaAdiabatic index

Definition at line 74 of file exact.hpp.

◆ exact_v_xc_shock()

template<class Tscal>
Tscal shammodels::gsph::riemann::exact_v_xc_shock ( Tscal LR,
Tscal p2,
Tscal p1,
Tscal r1,
Tscal gamma )
inline

Relative velocity jump across a shock wave (Rankine-Hugoniot).

Parameters
LR-1 for the left wave, +1 for the right wave
p2Trial star-region pressure
p1Pressure of the state ahead of the wave
r1Density of the state ahead of the wave
gammaAdiabatic index

Definition at line 56 of file exact.hpp.