Inspiration

OpenFOAM's native compressible solvers (rhoCentralFoam, sonicFoam, rhoPimpleFoam) struggle with high-Mach-number strong shocks, stiff reacting flows, and non-ideal thermodynamics. Existing workarounds rely on ad-hoc fixes or external coupling, fragmenting the workflow. We were inspired to build a unified, extensible compressible solver framework that handles these challenges natively within OpenFOAM.

What it does

  • Robust shock capturing via AUSM+ family flux schemes with low numerical dissipation
  • Real gas support (Peng-Robinson, SAFT) through a templated realGas thermophysical model
  • Multi-species reacting flow coupling with Cantera chemistry
  • Implicit time marching (LU-SGS) for stiff problems at CFL >> 1
  • 3–5× speedup on high-resolution supersonic cases compared to native solvers

How we built it

  1. Forked OpenFOAM-v2112 and traced the rhoCentralFoam solver chain: createFieldsUEqnEEqnpEqn
  2. Replaced the flux framework: implemented ausmPlusFluxScheme inheriting from surfaceInterpolationScheme, hooking into fvc::div at the matrix level
  3. Extended basicThermo: added realGas template with autoPtr<equationOfState> for runtime selectable EOS
  4. Coupled Cantera: wrapped Cantera::IdealGasMix in a custom reactionRate class, feeding source terms into YEqn and EEqn
  5. Matrix-free LU-SGS: replaced diagonal solver with an in-place forward/backward sweep using lduMatrix::lower/upper/diag

Challenges we ran into

Challenge Impact Fix
AUSM+ mass flux inconsistency with fvc::surfaceIntegrate Spurious pressure drift in closed domains Rewrote phi construction to enforce sum(rho*Uf & Sf) = 0 at each face
Real-gas derivatives $\partial p/\partial \rho\ _T$ too expensive 80% of total CPU time in thermo.correct()
Cantera IdealGasMix not thread-safe Segfaults in parallel Wrapped with Foam::Mutex and cloned thread-local Solution objects
LU-SGS memory blowup on 10M+ cells Exceeded 256GB node limit Matrix-free implementation: recalculate dLower/Upper on-the-fly; 60% memory cut

Accomplishments that we're proud of

  • Zero-parameter shock capturing: no user-tuned TVDCoeff or delta needed—AUSM+ handles Mach 0.3 to 15 seamlessly
  • First Cantera-OpenFOAM compressible coupling with conserved total energy (including formation enthalpy)
  • Validated against 5 benchmark cases: Sod, Shu-Osher, double Mach reflection, 2D Riemann, and T4 scramjet experiment
  • Submitted 2 patches to OpenFOAM dev repository for realGas boundary conditions

What we learned

  • OpenFOAM's three-layer architecture (finiteVolumetransportModelsthermophysicalModels) is powerful but requires strict adherence to autoPtr/tmp memory rules
  • Implicit solvers in FVM: the lduMatrix structure is sparse but not trivially parallelizable; matrix-free approaches trade flops for memory bandwidth
  • Real-gas CFD: cubic EOS introduce thermodynamic instability near critical points—need dp/drho > 0 guards in Newton iterations
  • Open-source contribution: upstreaming requires wmake compliance, Allwmake scripts, and Doxygen documentation—plan for this from day one

What's next for of-compressible

  • ML-accelerated turbulence: embed $\nu$-SPS neural network as turbulenceModel subclass, training on high-fidelity DNS data
  • GPU offloading: port LU-SGS sweeps to Kokkos (OpenFOAM-v2406+ branch) for 10× throughput on H100
  • Adjoint solver: derive discrete adjoint of AUSM+ for compressible shape optimization
  • Community release: package as of-compressible module with spack install and 10-tutorial suite

Built With

Share this project:

Updates