hydro.h file
One-cell hydro primitives.
No grid loop.
Viscous stress, von Neumann–Richtmyer artificial viscosity, a Rusanov face flux, and a cell CFL. Sound speed comes from the equation of state.
Classes
- struct vm_hydro_state
- Primitive state on one side of a face.
- struct vm_hydro_flux
- Conservative face flux
(mass, normal momentum, energy).
Functions
-
auto vm_hydro_viscous(const vm_
sym3* D, vm_ float_ t mu, vm_ float_ t lambda) -> vm_ sym3 - Newtonian viscous stress
$\sigma = 2\mu D + \lambda (\operatorname{tr} D)\,I$. -
auto vm_hydro_q(vm_
float_ t rho, vm_ float_ t delta_v, vm_ float_ t c0) -> vm_ float_ t - von Neumann–Richtmyer artificial viscosity.
-
auto vm_hydro_rusanov(vm_
hydro_ flux* flux, const vm_ hydro_ state* left, const vm_ hydro_ state* right) -> bool - Rusanov flux between two face states.
-
auto vm_hydro_cfl(vm_
float_ t h, vm_ float_ t v, vm_ float_ t c, vm_ float_ t kappa, vm_ float_ t nu) -> vm_ float_ t - Cell CFL time step.
Function documentation
vm_ sym3 vm_hydro_viscous(const vm_ sym3* D,
vm_ float_ t mu,
vm_ float_ t lambda)
Newtonian viscous stress $\sigma = 2\mu D + \lambda (\operatorname{tr} D)\,I$.
| Parameters | |
|---|---|
| D | Rate-of-deformation, Voigt-6. |
| mu | Dynamic viscosity. |
| lambda | Second viscosity. |
| Returns | Viscous stress as Voigt-6. |
A pure spin has $D = 0$, so the stress is zero.
vm_ float_ t vm_hydro_q(vm_ float_ t rho,
vm_ float_ t delta_v,
vm_ float_ t c0)
von Neumann–Richtmyer artificial viscosity.
| Parameters | |
|---|---|
| rho | Density. |
| delta_v | Velocity jump. Negative is compression. |
| c0 | Coefficient. |
| Returns | Artificial viscosity. Zero if expanding or density is non-positive. |
$q = c_0 \rho (\Delta v)^2$ in compression ( $\Delta v < 0$), zero in expansion. No clamping.
bool vm_hydro_rusanov(vm_ hydro_ flux* flux,
const vm_ hydro_ state* left,
const vm_ hydro_ state* right)
Rusanov flux between two face states.
| Parameters | |
|---|---|
| flux | Output flux. |
| left | Left state. |
| right | Right state. |
| Returns | false if any pointer is NULL. |
Spectral radius is $\max(|v_n| + c)$ of the two sides. A symmetric pair (equal density, pressure, sound speed, opposite normal velocity) has zero mass flux.
vm_ float_ t vm_hydro_cfl(vm_ float_ t h,
vm_ float_ t v,
vm_ float_ t c,
vm_ float_ t kappa,
vm_ float_ t nu)
Cell CFL time step.
| Parameters | |
|---|---|
| h | Cell size. |
| v | Velocity magnitude. |
| c | Sound speed. |
| kappa | CFL number. |
| nu | Kinematic viscosity. Non-positive skips the viscous clamp. |
| Returns | Time step, or 0 if the inputs cannot produce one. |
$\Delta t = \kappa h / (|v| + c)$, clamped by the viscous scale $h^2 / \nu$ when $\nu > 0$.