Skip to content

Thermally Compressible Flow ​

Overview ​

The standard LBM BGK solver is designed for isothermal incompressible flow. For applications where the fluid density varies due to temperature or pressure changes — such as natural convection, gas-phase combustion, or packed-bed reactor flow — a thermally compressible extension is available.

Enable it with Do_ThermalComp = true in the input file. The thermal compressible (TC) variant uses an additional set of methods in FlowSolverLBM and requires coupling to the Temperature and Composition modules.


Thermodynamic pressure ​

The key concept in the TC extension is the separation of pressure into a thermodynamic and hydrodynamic part:

(1)ptotal=pth+phydro
  • pth — spatially uniform thermodynamic pressure (set globally)
  • phydro — local hydrodynamic pressure fluctuation solved by LBM

For an ideal gas mixture:

(2)pth=ρRMwT

where R is the universal gas constant, Mw the molar mass, and T the temperature.

The thermodynamic pressure is stored and updated globally:

cpp
double Pth;       ///< Current thermodynamic pressure [Pa]
double PthOld;    ///< Previous time step value [Pa]
double Pth0;      ///< Initial thermodynamic pressure [Pa]
double Poutlet;   ///< Outlet hydrodynamic pressure [Pa]

Density from ideal gas law ​

In the TC variant, the lattice density is not a conserved quantity but is recomputed each timestep from the ideal gas law:

cpp
void CalculateDensityTC(Temperature& Tx, Composition& Cx,
                         const BoundaryConditions& BC);
double CalculateIdealGasDensity(double p, double Rm, double Temp);

(3)ρ=pthMwRT

This replaces the density moment of the populations in the incompressible case.


Density gradient ​

The gradient of density is needed for the compressible collision operator:

cpp
void CalculateDensityGradient(PhaseField& Phase, Velocities& Vel);

This gradient is stored in:

cpp
Storage3D<dVector3, 1> GradRho;

Three gradient schemes are supported:

FlagScheme
GradRho_CentralSecond-order central differences
GradRho_UpwindFirst-order upwind
GradRho_VanLeerVan Leer flux limiter (recommended)

Thermally compressible equilibrium distribution ​

The TC variant uses a modified equilibrium distribution that accounts for the variable density and velocity divergence:

cpp
D3Q27 EquilibriumDistributionTC(dVector3 lbvel, double lbph, double lbnut,
                                  double lbDivVel, dVector3 lbFb,
                                  const double weights[3][3][3],
                                  double lbrho, dVector3 lbGradRho,
                                  size_t n);

The divergence of velocity ∇⋅u enters because density is no longer conserved:

(4)∂ρ∂t+∇⋅(ρu)=0⇒∇⋅u=−1ρDρDt

The divergence is stored in:

cpp
Storage3D<double, 1> DivVel;

Compressible collision step ​

The TC collision operator differs from the standard BGK by including:

  • Variable kinematic viscosity (Sutherland's law)
  • Non-zero velocity divergence
  • Density gradient correction
cpp
void CollisionTC(Velocities& Vel);

Sutherland viscosity ​

The kinematic viscosity of a gas depends on temperature. Sutherland's law is used:

cpp
double CalculateSutherlandViscosity(double p, double mw, double Temp);

(5)μ(T)=μref(TTref)3/2Tref+ST+S

where S is Sutherland's constant. The local viscosity is stored in:

cpp
Storage3D<double, 1> nut;       ///< Kinematic viscosity [lattice units]

Hydrodynamic pressure ​

The local hydrodynamic pressure is maintained separately from the thermodynamic pressure:

cpp
Storage3D<double, 1> HydroPressure;
cpp
void CalculateHydrodynamicPressureAndMomentum(Velocities& Vel);

This pressure drives the velocity field through the standard LBM mechanism while pth captures the global compressibility effect.


Initialization for TC flow ​

TC simulations require a special initialization of populations that accounts for the non-constant density field:

cpp
void SetInitialPopulationsTC(BoundaryConditions& BC, Velocities& Vel);

This should be called instead of the standard FinalizeInitialization() when Do_ThermalComp = true.


ExampleDescription
examples/ThermalCompressibleFlow/CouetteFlowShear flow with variable density
examples/ThermalCompressibleFlow/PoiseuilleFlowChannel flow with thermal effects
examples/ThermalCompressibleFlow/CylinderFlowFlow around a heated cylinder
examples/ThermalCompressibleFlow/PackedBed2D2D packed bed with compressibility
examples/ThermalCompressibleFlow/PackedBed3D3D packed bed with compressibility

Numerical considerations ​

  • The Mach number must remain low (Ma<0.3) for the low-Mach approximation to hold.
  • Choosing GradRho_VanLeer is strongly recommended; central differences can introduce oscillations near steep density gradients.
  • The update order matters: CalculateDensityTC must be called before CollisionTC.
  • Thermodynamic pressure updates should be applied globally and consistently across MPI ranks to avoid non-physical pressure jumps.

Released under the GNU GPLv3 License.