rhoSimpleFoam is the steady compressible solver: SIMPLE, with an energy equation and a density that follows the thermophysical model. It asks for a few things simpleFoam never asks for: a transonic switch, limits on the pressure, and extra divergence schemes for the energy equation. This page goes through them in the order the solver uses them, and says where the ESI and Foundation versions differ.
Read from rhoSimpleFoam.C, pEqn.H, EEqn.H and pressureControl.C in OpenFOAM v2506 (ESI, openfoam.com), from the same solver in OpenFOAM 9 (Foundation, openfoam.org), and from the squareBend tutorial of OpenFOAM 8, 9 and 10. No case was run for this page.
Each SIMPLE iteration runs in the same order in both forks:
UEqn.H).EEqn.H), for h or e depending on the thermophysical model, followed by thermo.correct(), which updates temperature and properties.pEqn.H), then the velocity correction, then the density from the thermophysical model.The ESI version has two pressure files: pEqn.H, and pcEqn.H when consistent yes; (SIMPLEC) is set. In OpenFOAM 9 one file handles both.
rhoSimpleFoam exists in the ESI version and in Foundation versions up to 10. Its source file is gone from OpenFOAM 11, where compressible flow runs through the solver modules.
// system/fvSolution
SIMPLE
{
nNonOrthogonalCorrectors 0;
transonic yes;
consistent yes;
}
Without transonic, the pressure equation is the usual one: a Laplacian of pressure balancing the divergence of the predicted mass flux. With transonic yes; the solver adds a convection term for pressure:
phid = ( interpolate(psi) / interpolate(rho) ) * phiHbyA
div(phiHbyA) + div(phid, p) - laplacian(rhorAUf, p) = sources
psi is the compressibility, the ratio of density to pressure for a perfect gas. The new term lets the equation see that density changes with pressure, which matters once the Mach number is high. Three things change with it:
div(phid,p) is required in fvSchemes. The squareBend tutorial uses Gauss upwind.pEqn.relax(), "to ensure diagonal-dominance" in the source). The factor is the one under equations for p.rho.relax() only runs when transonic is off.During the first iterations a compressible case can produce pressures far outside the physical range, and the density follows. Both forks let you bound the pressure. Where you write it depends on the version.
| Version | Where | Entries |
|---|---|---|
| ESI (v2506), Foundation 8 | SIMPLE dictionary of fvSolution | pMinFactor, pMaxFactor, or pMin, pMax |
| Foundation 9 and 10 | system/fvConstraints | type limitPressure; with minFactor, maxFactor |
// ESI and Foundation 8: system/fvSolution
SIMPLE
{
pMinFactor 0.1;
pMaxFactor 2;
}
// Foundation 9 and 10: system/fvConstraints
limitp
{
type limitPressure;
minFactor 0.1;
maxFactor 2;
}
The values 0.1 and 2 are those of the squareBend tutorial. In the ESI code the factors multiply a reference taken from the boundary conditions: the lowest and the highest pressure found on the patches where the pressure value is fixed.
'pMaxFactor' specified rather than 'pMax' but the corresponding reference pressure cannot be evaluated from the boundary conditions. Give absolute pMin and pMax instead.min and max for absolute values and the matching message 'minFactor' specified rather than 'min'.pressureControl: p max or pressureControl: p min followed by the value it found before clipping.rhoMin and rhoMax still run in the ESI version. The code converts them to pressure limits and warns that pMin or pMinFactor are more reliable.Stuck on this in your own case?
CFDpilot is an AI agent for OpenFOAM that runs in your terminal. It reads the case files and the solver log on your machine, and shows every change as a diff before it edits a file.
Diagnose my case →Start free · 200 credits · nothing charged
The energy equation is written for the variable of the thermophysical model, and it carries the kinetic energy with it:
// energy variable e (internal energy)
div(phi, e) + div(phi, Ekp) + heat flux = sources Ekp = 0.5*|U|^2 + p/rho
// energy variable h (enthalpy)
div(phi, h) + div(phi, K) + heat flux = sources K = 0.5*|U|^2
So the list of divergence schemes depends on your thermoType. With default none; the solver stops on the first missing entry and names it. The squareBend tutorial of OpenFOAM 9, which uses internal energy and transonic, has:
divSchemes
{
default none;
div(phi,U) bounded Gauss upwind;
div(phi,e) bounded Gauss upwind;
div(phi,Ekp) bounded Gauss upwind;
div(phi,k) bounded Gauss upwind;
div(phi,epsilon) bounded Gauss upwind;
div(phid,p) Gauss upwind;
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
}
With enthalpy, replace the e and Ekp lines by div(phi,h) and div(phi,K). Upwind everywhere is a starting point to get a case running. It is not a setting for final results.
// squareBend tutorial, OpenFOAM 9: transonic and consistent both on
relaxationFactors
{
fields
{
p 1;
}
equations
{
p 1;
U 0.9;
e 0.8;
k 0.9;
epsilon 0.9;
}
}
These values go with consistent yes;. SIMPLEC tolerates factors close to 1. Without it, expect to need lower values.
Three relaxation entries matter, and the source shows when each one is used:
p as a field is relaxed after every pressure solve, before the velocity correction.p as an equation is relaxed only when transonic is on.rho as a field is relaxed only when transonic is off. A rho entry under fields has no effect on a transonic run.pressureControl: p max at every iteration, long after the start, means the limiter is holding the solution in place. The run may look stable and still be far from a converged flow.div(phi,K) or div(phi,Ekp) tells you which energy variable the case uses.totalPressure, count. A case where every pressure patch is zeroGradient or a flux condition needs absolute limits.CFDpilot is an AI agent for OpenFOAM that runs in your terminal. It reads the case files and the solver log on your machine, and shows every change as a diff before it edits a file.
Diagnose my case →Start free · 200 credits · nothing charged
It adds a convection term for pressure to the pressure equation, written div(phid,p), so that the equation accounts for the change of density with pressure. It is meant for flows that reach high subsonic or supersonic Mach numbers. With transonic on, the pressure equation is relaxed and the density is not, and fvSchemes needs an entry for div(phid,p).
In the ESI version and in Foundation 8, put pMinFactor and pMaxFactor, or absolute pMin and pMax, in the SIMPLE dictionary of fvSolution. In Foundation 9 and 10, use a limitPressure constraint with minFactor and maxFactor in system/fvConstraints. The factors multiply the lowest and highest pressure found on the patches where pressure is fixed.
The factor needs a reference pressure, which the ESI code takes from the patches where the pressure value is fixed. If no patch fixes the pressure, there is no reference and the solver stops with a message asking for pMax instead of pMaxFactor. Give absolute values with pMin and pMax.
div(phi,U) for momentum, div(phi,e) with div(phi,Ekp) when the energy variable is internal energy, or div(phi,h) with div(phi,K) when it is enthalpy, the schemes of the turbulence fields, and the viscous term div(((rho*nuEff)*dev2(T(grad(U))))). With transonic on, div(phid,p) is required as well.
Not in the Foundation version. rhoSimpleFoam.C is in OpenFOAM 8, 9 and 10 and is absent from the OpenFOAM 11 source, where compressible flow is run through the solver modules. The ESI version still ships rhoSimpleFoam.