![]() |
Shamrock 2025.10.0
Astrophysical Code
|
FluidStateSpec implementation for a barotropic equation of state that is isothermal below a threshold density \( \rho_c \) and adiabatic above it (e.g. the optically thin to thick transition in protostellar collapse). More...
#include <shammath/include/shammath/riemann_common.hpp>
Public Types | |
| using | Tvec = VecType |
| using | Tscal = shambase::VecComponent<Tvec> |
| using | Tprim = PrimState<Tvec> |
| using | Tcons = ConsState<Tvec> |
Public Member Functions | |
| constexpr | FluidStateBarotropic (Tscal rho_crit, Tscal cs0, Tscal gamma) |
| Tscal | rho_crit () const |
| Threshold density \( \rho_c \) of the isothermal to adiabatic switch. | |
| Tscal | cs0 () const |
| Isothermal sound speed \( c_{s,0} \) of the low density regime. | |
| Tscal | gamma_adiab () const |
| Adiabatic index \( \gamma \) of the high density regime. | |
| Tscal | pressure (Tscal rho) const |
| Barotropic pressure \( P(\rho) \). | |
| Tscal | sound_speed (Tprim p) const |
| Tscal | gamma (Tprim p) const |
| Local effective adiabatic index \( d \ln P / d \ln \rho \). | |
| Tprim | cons_to_prim (Tcons c) const |
| Tcons | prim_to_cons (Tprim p) const |
| Tscal | vn (Tprim p, Tvec n) const |
| Tcons | flux (Tprim p, Tvec n, Tscal vn) const |
| Tcons | flux (Tprim p, Tvec n) const |
FluidStateSpec implementation for a barotropic equation of state that is isothermal below a threshold density \( \rho_c \) and adiabatic above it (e.g. the optically thin to thick transition in protostellar collapse).
Pressure: \( P(\rho) = c_{s,0}^2 \rho \left(1 + (\rho/\rho_c)^{\gamma - 1}\right) \)
Sound speed: \( c_s^2 = \frac{dP}{d\rho} = c_{s,0}^2 \left(1 + \gamma (\rho/\rho_c)^{\gamma - 1}\right) \)
The pressure is a function of \( \rho \) only, so cons_to_prim() ignores rhoe. prim_to_cons() and flux() still carry a total energy, with the internal part set to \( P/(\gamma - 1) \), so that this spec plugs into the existing conservative (rho, rhovel, rhoe) solvers unchanged; that energy is passive and never read back.
The primitive states given to sound_speed()/flux()/gamma(prim) are expected to satisfy press == pressure(rho), which cons_to_prim() guarantees.
gamma(prim) returns the local effective index \( \Gamma = \frac{d \ln P}{d \ln \rho} = \rho c_s^2 / P \), which goes from 1 (isothermal) to \( \gamma \) (adiabatic) across \( \rho_c \), so HLLC uses the right shock-speed estimate on either side. There is deliberately no state-independent gamma() (see get_adiabatic_index_lr()); the high density index is exposed as gamma_adiab().
The constructor does not validate its inputs, as the spec is meant to be built inside kernels; it expects \( \rho_c > 0 \), \( c_{s,0} > 0 \) and \( \gamma > 1 \).
Definition at line 634 of file riemann_common.hpp.
| using shammath::FluidStateBarotropic< VecType >::Tcons = ConsState<Tvec> |
Definition at line 639 of file riemann_common.hpp.
| using shammath::FluidStateBarotropic< VecType >::Tprim = PrimState<Tvec> |
Definition at line 638 of file riemann_common.hpp.
| using shammath::FluidStateBarotropic< VecType >::Tscal = shambase::VecComponent<Tvec> |
Definition at line 637 of file riemann_common.hpp.
| using shammath::FluidStateBarotropic< VecType >::Tvec = VecType |
Definition at line 636 of file riemann_common.hpp.
|
inlineconstexpr |
| rho_crit | threshold density \( \rho_c \) of the isothermal to adiabatic switch |
| cs0 | isothermal sound speed \( c_{s,0} \) of the low density regime |
| gamma | adiabatic index \( \gamma \) of the high density regime |
Definition at line 646 of file riemann_common.hpp.
|
inline |
Definition at line 669 of file riemann_common.hpp.
|
inline |
Isothermal sound speed \( c_{s,0} \) of the low density regime.
Definition at line 652 of file riemann_common.hpp.
|
inline |
Definition at line 681 of file riemann_common.hpp.
|
inline |
Definition at line 678 of file riemann_common.hpp.
|
inline |
Local effective adiabatic index \( d \ln P / d \ln \rho \).
Definition at line 664 of file riemann_common.hpp.
|
inline |
Adiabatic index \( \gamma \) of the high density regime.
Definition at line 654 of file riemann_common.hpp.
|
inline |
Barotropic pressure \( P(\rho) \).
Definition at line 657 of file riemann_common.hpp.
|
inline |
Definition at line 676 of file riemann_common.hpp.
|
inline |
Threshold density \( \rho_c \) of the isothermal to adiabatic switch.
Definition at line 650 of file riemann_common.hpp.
|
inline |
Definition at line 659 of file riemann_common.hpp.
|
inline |
Definition at line 677 of file riemann_common.hpp.