eos.h file
Local equations of state.
Two scalars in, pressure and sound speed out.
Each call returns ok = false on non-positive density or on a negative $c^2$. No clamping. f64 is the contract; f32 uses the same formula. The _n forms are strided batches: item i reads rho[i * rho_stride] and writes p[i], c[i]. A failure leaves that item and the rest unwritten.
Classes
- struct vm_eos_state
- Pressure and sound speed from an equation of state.
- struct vm_ideal_gas
- Ideal gas:
$p = (\gamma - 1)\rho e$,$c = \sqrt{\gamma p / \rho}$. - struct vm_stiff_gas
- Stiffened gas:
$p = (\gamma - 1)\rho e - \gamma p_\infty$. - struct vm_mie
- Mie–Grüneisen on a linear Hugoniot
$U_s = c_0 + s U_p$. - struct vm_jwl
- Jones–Wilkins–Lee.
Functions
-
auto vm_eos_ideal(vm_
eos_ state* out, const vm_ ideal_ gas* eos, vm_ float_ t rho, vm_ float_ t e) -> bool - Ideal-gas pressure and sound speed.
-
auto vm_eos_stiffened(vm_
eos_ state* out, const vm_ stiff_ gas* eos, vm_ float_ t rho, vm_ float_ t e) -> bool - Stiffened-gas pressure and sound speed.
-
auto vm_eos_mie(vm_
eos_ state* out, const vm_ mie* eos, vm_ float_ t rho, vm_ float_ t e) -> bool - Mie–Grüneisen pressure and sound speed on a linear Hugoniot.
-
auto vm_eos_jwl(vm_
eos_ state* out, const vm_ jwl* eos, vm_ float_ t rho, vm_ float_ t e) -> bool - Jones–Wilkins–Lee pressure and sound speed.
-
auto vm_eos_ideal_n(vm_
float_ t* p, vm_ float_ t* c, const vm_ ideal_ gas* eos, const vm_ float_ t* rho, int rho_stride, const vm_ float_ t* e, int e_stride, int n) -> bool - Batched ideal gas.
-
auto vm_eos_stiffened_n(vm_
float_ t* p, vm_ float_ t* c, const vm_ stiff_ gas* eos, const vm_ float_ t* rho, int rho_stride, const vm_ float_ t* e, int e_stride, int n) -> bool - Batched stiffened gas.
-
auto vm_eos_mie_n(vm_
float_ t* p, vm_ float_ t* c, const vm_ mie* eos, const vm_ float_ t* rho, int rho_stride, const vm_ float_ t* e, int e_stride, int n) -> bool - Batched Mie–Grüneisen.
-
auto vm_eos_jwl_n(vm_
float_ t* p, vm_ float_ t* c, const vm_ jwl* eos, const vm_ float_ t* rho, int rho_stride, const vm_ float_ t* e, int e_stride, int n) -> bool - Batched Jones–Wilkins–Lee.
Function documentation
bool vm_eos_ideal(vm_ eos_ state* out,
const vm_ ideal_ gas* eos,
vm_ float_ t rho,
vm_ float_ t e)
Ideal-gas pressure and sound speed.
| Returns | false if density is non-positive, gamma is not > 1, or $c^2 < 0$. |
|---|
bool vm_eos_stiffened(vm_ eos_ state* out,
const vm_ stiff_ gas* eos,
vm_ float_ t rho,
vm_ float_ t e)
Stiffened-gas pressure and sound speed.
| Returns | false if density is non-positive, gamma is not > 1, or $c^2 < 0$. |
|---|
bool vm_eos_mie(vm_ eos_ state* out,
const vm_ mie* eos,
vm_ float_ t rho,
vm_ float_ t e)
Mie–Grüneisen pressure and sound speed on a linear Hugoniot.
| Returns | false if density or reference density is non-positive, or $c^2 < 0$. |
|---|
bool vm_eos_jwl(vm_ eos_ state* out,
const vm_ jwl* eos,
vm_ float_ t rho,
vm_ float_ t e)
Jones–Wilkins–Lee pressure and sound speed.
| Returns | false if density or reference density is non-positive, or $c^2 < 0$. |
|---|
bool vm_eos_ideal_n(vm_ float_ t* p,
vm_ float_ t* c,
const vm_ ideal_ gas* eos,
const vm_ float_ t* rho,
int rho_stride,
const vm_ float_ t* e,
int e_stride,
int n)
Batched ideal gas.
| Returns | false if n is non-positive, gamma is not > 1, or any item fails. |
|---|
bool vm_eos_stiffened_n(vm_ float_ t* p,
vm_ float_ t* c,
const vm_ stiff_ gas* eos,
const vm_ float_ t* rho,
int rho_stride,
const vm_ float_ t* e,
int e_stride,
int n)
Batched stiffened gas.
| Returns | false if n is non-positive, gamma is not > 1, or any item fails. |
|---|
bool vm_eos_mie_n(vm_ float_ t* p,
vm_ float_ t* c,
const vm_ mie* eos,
const vm_ float_ t* rho,
int rho_stride,
const vm_ float_ t* e,
int e_stride,
int n)
Batched Mie–Grüneisen.
| Returns | false if n is non-positive or any item fails. |
|---|
Scalar; the per-item branch stays.
bool vm_eos_jwl_n(vm_ float_ t* p,
vm_ float_ t* c,
const vm_ jwl* eos,
const vm_ float_ t* rho,
int rho_stride,
const vm_ float_ t* e,
int e_stride,
int n)
Batched Jones–Wilkins–Lee.
| Returns | false if n is non-positive or any item fails. |
|---|
Scalar.