OpenFOAM Compressible Fluid Module
Overview of the Compressible Fluid Module
The compressible fluid module in OpenFOAM v14 provides solvers for flows where density variations are significant and must be determined from the equation of state rather than assumed constant. This module is activated for Mach numbers exceeding roughly 0.3, where pressure-driven density changes begin to influence the flow field measurably. The compressible solvers solve the full set of governing equations: continuity, momentum, energy, and an equation of state, forming a tightly coupled four-equation system.
The equation of state is typically the ideal gas law:
$$ p = \rho R T $$
where $R$ is the specific gas constant ($R = R_u/M_w$, with $R_u$ the universal gas constant and $M_w$ the molar mass). For air at standard conditions, $R \approx 287\,\text{J}\,(\text{kg}\cdot\text{K})^{-1}$. At pressures exceeding several atmospheres or temperatures near the critical point, real-gas equations of state (van der Waals, Redlich-Kwong) may be necessary, though these require custom thermodynamic packages.
**Compressible Flow :: The mathematical structure of compressible Euler and Navier-Stokes equations, characteristic wave speeds, and the distinction between subsonic, transonic, and supersonic flow regimes.
**Shock-capturing Solvers :: Density-based solvers for high-speed flows with shock waves, including rhoCentralFoam and upwind Riemann solvers.
Steady Solvers: rhoSimpleFoam
rhoSimpleFoam solves the steady-state, compressible, turbulent Navier-Stokes equations using a pressure-based formulation. It is appropriate for subsonic and mildly supersonic flows (Mach < 0.8) where weak shock wave structures may be present but the overall flow is dominated by pressure-driven dynamics. The algorithmic structure mirrors simpleFoam but adds the energy equation and a thermodynamic update step:
1. Solve momentum equation with mixture density from current temperature. 2. Solve pressure equation (Poisson-type, derived from continuity). 3. Correct pressure and velocity. 4. Solve energy equation for specific enthalpy $h$. 5. Update density via equation of state. 6. Solve turbulence transport equations. 7. Iterate until convergence with under-relaxation.
The pressure equation in rhoSimpleFoam is derived from the continuity equation combined with the equation of state, yielding a density-corrected Poisson equation. This is weaker than the fully coupled density-based approach but remains robust for flows where acoustic effects are not the dominant physics.
**rhoSimpleFoam is particularly useful for:**
- Gas turbine compressor stages (moderate compression ratios).
- Compressed air network modeling.
- HVAC duct systems with moderate temperature gradients.
Transient Solvers: rhoPimpleFoam
rhoPimpleFoam extends the pressure-based approach to transient, compressible, turbulent flows. It uses the PIMPLE algorithm (as described in Incompressible Fluid Module) combined with the compressible energy equation. The energy equation solved is:
$$ \frac{\partial}{\partial t}(\rho h) + \nabla\cdot(\rho \mathbf{U} h) = \frac{\partial p}{\partial t} + \nabla\cdot(k\nabla T) + \Phi $$
where $\Phi = \tau:\nabla\mathbf{U}$ is the viscous dissipation function (often negligible except in high-speed flows), $k$ is the thermal conductivity, and $h$ is the specific enthalpy. The term $\partial p/\partial t$ represents the thermodynamic compression work and is crucial for accurate transient pressure wave propagation.
Buoyant flows are handled through body-force terms in the momentum equation coupled with temperature-dependent density through the equation of state or the Boussinesq approximation. rhoPimpleFoam is the default choice for natural convection in enclosures, buoyant plumes, and combustion-preliminary calculations.
Boussinesq Solvers: buoyantBoussinesqSimpleFoam
buoyantBoussinesqSimpleFoam simplifies the compressible formulation by applying the Boussinesq approximation: density is treated as constant everywhere except in the buoyancy term, where it varies linearly with temperature:
$$ \rho = \rho_0(1 - \beta(T - T_0)) $$
This is valid for $\beta\Delta T \ll 1$, typically $\Delta T < 30\text{-}40\text{K}$ in air. Despite the simplicity, this solver captures the essential physics of natural convection (Rayleigh-Bénard cells, chimney effect, cavity ventilation) at minimal computational cost. It solves the steady momentum, continuity, and energy equations without the coupling complexity of full compressibility.
Thermo Packages
OpenFOAM's thermodynamic library provides multiple temperature-dependent thermo packages that link temperature to thermodynamic properties:
**hPolynomialThermo:** The standard choice for engineering gases. Specific heat at constant pressure is modeled as a temperature-dependent polynomial:
$$ c_p(T) = R\left(a_1 + a_2 T + a_3 T^2 + a_4 T^3 + a_5 T^4\right) $$
Enthalpy is integrated analytically:
$$ h(T) = \int_{T_{ref}}^{T} c_p(T')\,dT' $$
The coefficients $a_1$ through $a_5$ are specified per species in the thermodynamic database (thermophysicalProperties). For air modeled as a single perfect gas, a 5-coefficient polynomial captures $c_p$ variation accurately from 200 K to 1000 K.
**psiThermo:** A lighter thermo package that uses a pre-integrated compressibility factor $\psi = 1/(\partial p/\partial \rho)_T$, suitable for constant $\gamma$ (specific heat ratio) flows. Less flexible than hPolynomialThermo but computationally cheaper.
**sensibleEnthalpy:** This package stores the "sensible" part of enthalpy ($h_{sensible} = \int c_p dT$) separately from chemical formation enthalpy. It is used when combustion chemistry is modeled separately, preventing double-counting of chemical energy in the total enthalpy balance.
| Thermo package | $c_p$ model | Best for | Performance |
| ---------------- | ------------- | ---------- | ------------ |
| hPolynomialThermo | Polynomial (5 coeff.) | General compressible | Standard |
| psiThermo | Constant $\gamma$ | Perfect gas, low accuracy needed | Fastest |
| sensibleEnthalpy | Polynomial + formation energy | Reacting flows | Standard+ |
Mach Number Regimes and Solver Selection
| Regime | Mach range | Compressibility | Recommended solver |
| -------- | ----------- | ----------------- | ------------------- |
| Incompressible | $Ma < 0.3$ | Negligible | simpleFoam, pimpleFoam |
| Subsonic compressible | 0.3 < $Ma$ < 0.8 | Moderate | rhoSimpleFoam, rhoPimpleFoam |
| Transonic | 0.8 < $Ma$ < 1.2 | Strong | rhoCentralFoam (if shocks) |
| Supersonic | $Ma$ > 1.2 | Strong | rhoCentralFoam |
| Hypersonic | $Ma$ > 5.0 | Strong | Custom (not natively supported) |
Below $Ma \approx 0.3$, density changes are less than 5% and pressure-based formulation is orders of magnitude more stable. Above this threshold, the pressure-based solvers begin to struggle with convergence due to the loss of separation between acoustic and convective time scales. For $Ma > 0.8$, density-based solvers (see Shock-capturing Solvers) are strongly preferred.
Comparison with ANSYS Fluent
| Feature | OpenFOAM | ANSYS Fluent |
| --------- | ---------- | ------------- |
| Pressure-based steady | rhoSimpleFoam | Density-based / Pressure-based options |
| Pressure-based transient | rhoPimpleFoam | Transient pressure-based |
| Density-based | rhoCentralFoam | Density-based segmented / coupled |
| Equation of state | Ideal gas + custom | Ideal gas, real gas, InCOMP, User-defined |
| Thermo model | Polynomial, psi, sensible | Perfect gas, thermo-polynomial, species transport |
| Boussinesq | buoyantBoussinesqSimpleFoam | Enabled via material properties |
| Natural convection | All compressible solvers | All solvers with gravity enabled |
Fluent's density-based coupled solver offers superior shock-capturing for transonic and supersonic external aerodynamics, with additional turbulence-chemistry interaction models useful for high-speed combustion. OpenFOAM's compressible solvers provide equivalent physical fidelity with complete source transparency and the ability to register custom thermodynamic models at compile time.
References
- Anderson, J.D. (2010). Computational Fluid Dynamics: The Basics with Applications. McGraw-Hill. Chapters 14-16 cover compressible flow solvers.
- Anderson, J.D. (1990). Computational Aerodynamics: An Introduction through Programming. AIAA Education Series.
- OpenFOAM Foundation. (2023). OpenFOAM v2212/v14 User Guide, Chapter on rhoSimpleFoam and rhoPimpleFoam.
- Versteeg, H. & Malalasekera, W. (2007). An Introduction to Computational Fluid Dynamics: The Finite Volume Method (2nd ed.). Pearson.
- Hirsch, C. (1988). Numerical Computation of Internal and External Flows, Vol. 1-2. Wiley.