Overview
The compressible Euler solver implements inviscid compressible-flow schemes in 1D and 2D with finite-volume (FV), plus a 1D discontinuous Galerkin (DG) path.
- FV single-phase (3 equations): Mass, momentum, and energy conservation for a single fluid.
- FV two-phase (5 equations): Allaire–Clerc–Kokh / Kapila et al. model with pressure equilibrium, tracking partial densities, mixture momentum/energy, and volume fraction.
- FV two-phase 2D RTI: Directionally split 2D extension of the 5-equation model with modular x/y boundary conditions and optional gravity source term.
- DG single-phase (3 equations): Element-local polynomial solution (P1/P2/P3) with interface Riemann fluxes and positivity-preserving controls.
All variants use the stiffened gas equation of state. FV supports AUSM+UP and HLLC (with two-phase vriem form), while DG currently uses HLLE. FV supports optional MUSCL reconstruction with Barth–Jespersen limiting. DG supports polynomial orders P1/P2/P3 and SSP-RK3 time stepping.
PDE System
Single-phase (3 equations)
Conservation of mass, momentum, and energy:
Conserved variables: \(\mathbf{U} = (\rho,\, \rho u,\, E)\).
Total energy per unit volume: \(E = \rho e + \tfrac{1}{2}\rho u^2\), where \(e\) is specific internal energy.
Two-phase 5-equation model
Allaire–Clerc–Kokh / Kapila et al. model with pressure equilibrium (\(p_1 = p_2 = p\)):
Conserved variables: \((\alpha_1\rho_1,\, \alpha_2\rho_2,\, \rho u,\, E,\, \alpha_1)\).
Mixture density: \(\rho = \alpha_1\rho_1 + \alpha_2\rho_2\), with \(\alpha_2 = 1 - \alpha_1\).
Equation of State (Stiffened Gas)
Both phases use the stiffened gas EOS:
Specific internal energy:
Sound speed:
Total energy from primitives:
Specific total enthalpy: \(H = (E + p) / \rho\).
Typical parameters:
- Ideal gas (air): \(\gamma = 1.4\), \(p_\infty = 0\).
- Water: \(\gamma \approx 4.4\), \(p_\infty \approx 6\times 10^8\) Pa.
Decoding (Conserved → Primitive)
Single-phase
From \(\mathbf{U} = (\rho,\, \rho u,\, E)\):
Enthalpy for flux: \(H = (E + p) / \rho\).
Two-phase (5-eq)
From \((\alpha_1\rho_1,\, \alpha_2\rho_2,\, \rho u,\, E,\, \alpha_1)\):
Pressure from mixture internal energy (pressure equilibrium):
Solve for \(p\): \(E_{\text{int}} = p\,A + B\) with
Hence \(p = (E_{\text{int}} - B) / A\).
Mixture sound speed (Wood's formula):
Pure phases: \(c \to c_1\) when \(\alpha_1 \approx 1\), \(c \to c_2\) when \(\alpha_1 \approx 0\).
Flux Calculation (AUSM+UP / HLLC / HLLE)
The FV solver provides modular interface fluxes. AUSM+UP (below) is the default all-speed split form for single-phase and two-phase FV; HLLC is also available for robust shock/contact capturing in FV; DG uses HLLE in the current 1D implementation.
1. Interface sound speed
2. Mach number splitting (M₄±)
\(M_L = u_L/a_{1/2}\), \(M_R = u_R/a_{1/2}\). Fourth-order polynomials:
where \(M_2^+ = \tfrac{1}{4}(M+1)^2\), \(M_2^- = -\tfrac{1}{4}(M-1)^2\), \(\beta = 1/8\).
Pressure diffusion (low-speed):
3. Pressure splitting (P₅±)
\(\alpha = 3/16\).
Velocity diffusion:
Default: \(K_p = 0.25\), \(K_u = 0.75\).
4. Mass and convective fluxes
\(H = (E + p)/\rho\).
HLLC/HLLE note: HLL-family methods estimate left/right wave speeds and construct a conservative face flux from wave-fan states. HLLC restores the contact wave (sharper contacts); HLLE is more dissipative but robust and is used by the current DG module.
DG Formulation (P1/P2/P3)
The 1D DG solver evolves element-local polynomial coefficients for the single-phase Euler equations using interface Riemann fluxes and SSP-RK3 time integration. For polynomial order \(p\), each conserved variable has \(p+1\) local degrees of freedom.
P1, P2, and P3 are supported via YAML configuration. Positivity safeguards are applied to keep \(\rho>0\) and \(p>0\) in shock-dominated regions.
Slope Limiter (MUSCL + Barth–Jespersen)
Optional second-order reconstruction. Cell-centered \(q_i\) with ghost cells.
Centered gradient
Barth–Jespersen limiter
Compute \(\phi_i \in [0, 1]\) such that \(q_i \pm \tfrac{1}{2}\phi_i\,\Delta q_i\) stays within \([q_{\min},\, q_{\max}]\) of cell \(i\) and its neighbors.
For each face \(q_{\text{face}} = q_i \pm \tfrac{1}{2}\Delta q_i\): if \(q_{\text{face}}\) exceeds bounds, reduce \(\phi\) so the extrapolated value lies within bounds. Take the minimum over both faces.
Reconstructed interface states
Positivity enforced for \(\rho\), \(p\), \(c\). First-order: \(q_L = q_i\), \(q_R = q_{i+1}\).
Time Integration
FV path: uses configured timestepper (euler or rk4) with explicit conservative update, e.g. Forward Euler:
DG path: uses an internal SSP-RK3 integrator in euler_dg_1d.py (see ssp_rk3).
CFL condition: \(\text{CFL} = \max(|u| + c)\,\Delta t/\Delta x < 1\) (DG typically requires tighter effective limits with increasing order).
Boundary Conditions
- Transmissive: Zero-gradient (copy edge values to ghost cells).
- Reflective: Mirror state with reversed velocity (\(u \to -u\)).
- Periodic: Wrap around (left ghost = right interior, right ghost = left interior).
In 2D two-phase runs, set boundary conditions per direction with physics.euler_bc_x and physics.euler_bc_y.
Two-Phase Extensions
1. Wood's formula at interfaces
Interface sound speeds \(c_L\), \(c_R\) use Wood's formula with phase densities \(\rho_1\), \(\rho_2\) and phase sound speeds \(c_1\), \(c_2\) from stiffened gas.
2. Flux vector splitting (v_riem)
Interface velocity from mass flux: \(v_{\text{riem}} = \dot{m}/\rho_{\text{upwind}}\).
Partial density fluxes:
Ensures \(F_{\alpha_1\rho_1} + F_{\alpha_2\rho_2} = F_\rho\).
3. Volume fraction flux
Non-conservative \(\alpha\) advection: \(F_{\alpha_1} = \alpha_{1,\text{upwind}}\,v_{\text{riem}}\).
Corrective term (dissipative, for stability at interfaces):
4. Post-step α normalization
After each step: \(\alpha_1 \leftarrow (\alpha_1\rho_1) / \rho\) to enforce consistency with partial densities and \(\alpha_1 + \alpha_2 = 1\).
In 2D RTI mode, optional constant gravity is applied as an explicit source after split flux updates:
Analytical Convergence Mode
The Sod setup supports analytical-reference convergence studies through dedicated YAML configuration. The workflow runs multiple resolutions and compares numerical density against the exact Riemann solution, reporting and plotting \(L_1\) errors on log-log axes for FV and DG variants (e.g., FV, DG-P1, DG-P2, DG-P3).
Implementation & File Locations
| Component | File | Function / Class |
|---|---|---|
| Single-phase 1D solver | intsharp/solvers/euler_1d.py | euler_step_1d, EulerState1D |
| Single-phase 1D DG solver | intsharp/solvers/euler_dg_1d.py | euler_dg_step_1d, DG reconstruction/evolution utilities |
| 5-equation two-phase 1D solver | intsharp/solvers/euler_5eq_1d.py | euler_step_5eq_1d, FiveEqState1D |
| 5-equation two-phase 2D solver | intsharp/solvers/euler_5eq_2d.py | euler_step_5eq_2d, FiveEqState2D, create_initial_state_rti_5eq_2d |
| AUSM+UP flux | intsharp/flux_ausm.py | ausm_plus_up_flux_1d, ausm_plus_up_flux_1d_with_v_riem |
| HLLC/HLLE flux | intsharp/flux_hllc.py | hllc_flux_1d, hlle_flux_1d |
| Stiffened gas EOS | intsharp/eos.py | sound_speed, pressure_from_energy, enthalpy |
| Exact Sod reference | intsharp/exact_riemann_1d.py | Exact 1D Riemann solution helpers for convergence/plot overlays |
| Wood's mixture sound speed | intsharp/eos.py | mixture_sound_speed_wood |
| MUSCL + Barth–Jespersen | intsharp/limiters.py | muscl_reconstruct_1d, barth_jespersen_1d |
References
- Liou, M.S. (2006). A sequel to AUSM, Part II: AUSM+-up for all speeds. J. Comput. Phys. 214, 137–170.
- Toro, E.F. (2009). Riemann Solvers and Numerical Methods for Fluid Dynamics. Springer.
- Allaire, G., Clerc, S., Kokh, S. (2002). A five-equation model for the simulation of interfaces between compressible fluids. J. Comput. Phys. 181, 577–616.
- Kapila et al. (2001). Two-phase modeling of deflagration-to-detonation transition in granular materials.
Validation: sod_shock_tube_1d, water_air_shock_tube_1d, rayleigh_taylor_2d.