Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shammath::FluidStateBarotropic< VecType > Class Template Reference

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

Detailed Description

template<class VecType>
class shammath::FluidStateBarotropic< VecType >

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.

Member Typedef Documentation

◆ Tcons

template<class VecType>
using shammath::FluidStateBarotropic< VecType >::Tcons = ConsState<Tvec>

Definition at line 639 of file riemann_common.hpp.

◆ Tprim

template<class VecType>
using shammath::FluidStateBarotropic< VecType >::Tprim = PrimState<Tvec>

Definition at line 638 of file riemann_common.hpp.

◆ Tscal

template<class VecType>
using shammath::FluidStateBarotropic< VecType >::Tscal = shambase::VecComponent<Tvec>

Definition at line 637 of file riemann_common.hpp.

◆ Tvec

template<class VecType>
using shammath::FluidStateBarotropic< VecType >::Tvec = VecType

Definition at line 636 of file riemann_common.hpp.

Constructor & Destructor Documentation

◆ FluidStateBarotropic()

template<class VecType>
shammath::FluidStateBarotropic< VecType >::FluidStateBarotropic ( Tscal rho_crit,
Tscal cs0,
Tscal gamma )
inlineconstexpr
Parameters
rho_critthreshold density \( \rho_c \) of the isothermal to adiabatic switch
cs0isothermal sound speed \( c_{s,0} \) of the low density regime
gammaadiabatic index \( \gamma \) of the high density regime

Definition at line 646 of file riemann_common.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ cons_to_prim()

template<class VecType>
Tprim shammath::FluidStateBarotropic< VecType >::cons_to_prim ( Tcons c) const
inline

Definition at line 669 of file riemann_common.hpp.

◆ cs0()

template<class VecType>
Tscal shammath::FluidStateBarotropic< VecType >::cs0 ( ) const
inline

Isothermal sound speed \( c_{s,0} \) of the low density regime.

Definition at line 652 of file riemann_common.hpp.

◆ flux() [1/2]

template<class VecType>
Tcons shammath::FluidStateBarotropic< VecType >::flux ( Tprim p,
Tvec n ) const
inline

Definition at line 681 of file riemann_common.hpp.

◆ flux() [2/2]

template<class VecType>
Tcons shammath::FluidStateBarotropic< VecType >::flux ( Tprim p,
Tvec n,
Tscal vn ) const
inline

Definition at line 678 of file riemann_common.hpp.

◆ gamma()

template<class VecType>
Tscal shammath::FluidStateBarotropic< VecType >::gamma ( Tprim p) const
inline

Local effective adiabatic index \( d \ln P / d \ln \rho \).

Definition at line 664 of file riemann_common.hpp.

◆ gamma_adiab()

template<class VecType>
Tscal shammath::FluidStateBarotropic< VecType >::gamma_adiab ( ) const
inline

Adiabatic index \( \gamma \) of the high density regime.

Definition at line 654 of file riemann_common.hpp.

◆ pressure()

template<class VecType>
Tscal shammath::FluidStateBarotropic< VecType >::pressure ( Tscal rho) const
inline

Barotropic pressure \( P(\rho) \).

Definition at line 657 of file riemann_common.hpp.

◆ prim_to_cons()

template<class VecType>
Tcons shammath::FluidStateBarotropic< VecType >::prim_to_cons ( Tprim p) const
inline

Definition at line 676 of file riemann_common.hpp.

◆ rho_crit()

template<class VecType>
Tscal shammath::FluidStateBarotropic< VecType >::rho_crit ( ) const
inline

Threshold density \( \rho_c \) of the isothermal to adiabatic switch.

Definition at line 650 of file riemann_common.hpp.

◆ sound_speed()

template<class VecType>
Tscal shammath::FluidStateBarotropic< VecType >::sound_speed ( Tprim p) const
inline

Definition at line 659 of file riemann_common.hpp.

◆ vn()

template<class VecType>
Tscal shammath::FluidStateBarotropic< VecType >::vn ( Tprim p,
Tvec n ) const
inline

Definition at line 677 of file riemann_common.hpp.


The documentation for this class was generated from the following file: