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
realGasthermophysical 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
- Forked OpenFOAM-v2112 and traced the
rhoCentralFoamsolver chain:createFields→UEqn→EEqn→pEqn - Replaced the flux framework: implemented
ausmPlusFluxSchemeinheriting fromsurfaceInterpolationScheme, hooking intofvc::divat the matrix level - Extended
basicThermo: addedrealGastemplate withautoPtr<equationOfState>for runtime selectable EOS - Coupled Cantera: wrapped
Cantera::IdealGasMixin a customreactionRateclass, feeding source terms intoYEqnandEEqn - 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
TVDCoeffordeltaneeded—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
realGasboundary conditions
What we learned
- OpenFOAM's three-layer architecture (
finiteVolume→transportModels→thermophysicalModels) is powerful but requires strict adherence toautoPtr/tmpmemory rules - Implicit solvers in FVM: the
lduMatrixstructure 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 > 0guards in Newton iterations - Open-source contribution: upstreaming requires
wmakecompliance,Allwmakescripts, and Doxygen documentation—plan for this from day one
What's next for of-compressible
- ML-accelerated turbulence: embed $\nu$-SPS neural network as
turbulenceModelsubclass, 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-compressiblemodule withspackinstall and 10-tutorial suite
Log in or sign up for Devpost to join the conversation.