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§
- Euler
State - Conservative variable vector for the Euler equations: [rho, rhou, rhov, rho*w, E].
- Flux
Grid3D - A 3-D scalar field stored in row-major order on a uniform Cartesian grid.
- Vector
Flux Grid3D - Three-component 3-D velocity / flux field.
Functions§
- advect_
upwind_ 3d - Apply first-order upwind advection to a
FluxGrid3Dfor 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
phiby 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
iandi+1. - mc_
limiter - MC (Monotonised Central) limiter.
- minmod
- Minmod slope limiter: smallest slope among
aandbwith 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
phiusing the TVD Runge-Kutta 2 (Heun) scheme. - upwind_
flux_ 1d - First-order upwind advection flux for a scalar
phitransported by uniform velocityvelin 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|).