src/features/hydro.c file

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$.