Skip to main content

Module flux_compute

Module flux_compute 

Source
Expand description

CPU-side parallel flux and advection compute kernels.

Provides scalar and vector flux computation on structured 3-D Cartesian grids: upwind advection, central-difference divergence, Lax-Friedrichs flux splitting, Godunov interface reconstruction, limiter functions (minmod, superbee, van Leer), and a simple finite-volume time-stepping helper. All kernels use Rayon for data-parallel execution.

Structs§

EulerState
Conservative variable vector for the Euler equations: [rho, rhou, rhov, rho*w, E].
FluxGrid3D
A 3-D scalar field stored in row-major order on a uniform Cartesian grid.
VectorFluxGrid3D
Three-component 3-D velocity / flux field.

Functions§

advect_upwind_3d
Apply first-order upwind advection to a FluxGrid3D for one time step.
cfl_dt
Compute the CFL-limited maximum stable time step.
characteristic_decompose_2wave
Project a vector of conservative variables onto the characteristic variables for a simple 2-component advection system.
characteristic_limited_reconstruct
Apply a characteristic-based limiter to 1-D reconstruction.
characteristic_recompose_2wave
Reconstruct conservative variables from characteristic variables.
divergence_3d
Compute the divergence of a vector field at every interior cell.
euler_step_advect
Advance phi by one Euler time step using explicit upwind advection.
godunov_flux_advection
Godunov flux for a scalar advection equation u_t + a * u_x = 0.
godunov_flux_burgers
Godunov-type flux for Burgers’ equation u_t + (u²/2)_x = 0.
gradient_3d
Compute the gradient of a scalar field at every cell.
hll_flux
HLL (Harten-Lax-van Leer) numerical flux for a scalar conservation law.
hll_flux_euler_1d
HLL flux for 1-D Euler equations.
hll_wave_speeds
Estimate HLL wave speeds for the 1-D Euler equations.
hllc_flux_euler_1d
HLLC (Harten-Lax-van Leer-Contact) flux for 1-D Euler equations.
lax_friedrichs_advect_1d
Lax-Friedrichs advection update for a 1-D scalar array.
lax_friedrichs_flux
Lax-Friedrichs numerical flux at the interface between cells i and i+1.
mc_limiter
MC (Monotonised Central) limiter.
minmod
Minmod slope limiter: smallest slope among a and b with same sign.
minmod_ratio
Compute the minmod limiter in ratio form: phi(r) = max(0, min(1, r)).
muscl_reconstruct
Reconstruct left and right interface values from cell-centred values using the MUSCL scheme with a given limiter.
muscl_reconstruct_all
Apply MUSCL reconstruction across all interfaces in a 1-D array.
roe_flux_euler_1d
Roe flux for 1-D Euler equations (x-direction).
roe_flux_scalar
Roe-averaged scalar flux for a 1-D scalar conservation law.
superbee
Superbee limiter: most compressive TVD limiter.
superbee_ratio
Superbee limiter in ratio form: phi(r) = max(0, max(min(2r,1), min(r,2))).
tvd_rk2_advect
Advance phi using the TVD Runge-Kutta 2 (Heun) scheme.
upwind_flux_1d
First-order upwind advection flux for a scalar phi transported by uniform velocity vel in one dimension.
van_albada
Van Albada slope limiter: smooth TVD limiter with quadratic shape.
van_leer
Van Leer limiter: smooth TVD limiter.
van_leer_ratio
Van Leer limiter in ratio form: phi(r) = (r + |r|) / (1 + |r|).