grokkingstuff Home Blog Projects Wiki Calculators About

OpenFOAM Specialized Solvers - Non-Standard and Niche CFD Applications

date2026-07-28tags:openfoam: :training: :supplements: :solvers:

Introduction

Beyond the mainstream incompressible and compressible solvers, OpenFOAM contains (or has contained) a collection of specialized solvers for niche physical phenomena. Some are maintained in the main repository; others exist in community extensions. For PhD researchers, knowing what these solvers do — and what they do not — is as important as knowing when to reach for something else entirely.

DNS: dnsFoam (Direct Numerical Simulation)

dnsFoam is a simplified DNS solver for incompressible flow. It solves the Navier-Stokes equations without any turbulence model — all scales of turbulence are resolved directly. This requires a mesh fine enough to capture the Kolmogorov length scale:

$$\eta = \left(\frac{\nu^3}{\varepsilon}\right)^{1/4}$$

where $\nu$ is kinematic viscosity and $\varepsilon$ is the dissipation rate. The corresponding Reynolds number based on grid spacing must satisfy $\Delta x < \eta$. For a channel flow at Re_τ = 590, this requires on the order of 10⁸–10⁹ cells.

Typical boundary conditions for DNS:

BoundaryBC TypeVelocity BCPressure BC
InletfixedValueU = U_inlet (turbulent inflow)fixedGradient (p = 0)
OutletzeroGradientzeroGradientfixedValue (p = 0)
WallnoSlipU = 0fixedGradient (p = 0)
Periodicperiodicperiodicperiodic

The canonical test case is periodic turbulent channel flow. The flow is driven by a constant pressure gradient, and statistics are collected in the streamwise and spanwise homogeneous directions. dnsFoam requires small deltaT to satisfy the CFL condition at the smallest grid scale:

controlDict
{
    deltaT          1e-7;        // Adjust for Re based on delta
    maxCo           0.49;       // Strict CFL limit for DNS
    adjustTimeStep  yes;
}

dnsFoam is useful for validating turbulence models at low to moderate Reynolds numbers. At Re > 10⁴, it becomes computationally intractable. At those Reynolds numbers, you are not doing DNS; you are doing very expensive turbulence-generating CFD that nobody will believe.

DSMC: dsmcFoam (Molecular Regime Flow)

dsmcFoam implements the Direct Simulation Monte Carlo method for rarefied gas dynamics. When the Knudsen number exceeds 0.1, the continuum assumption breaks down:

$$Kn = \frac{\lambda}{L}$$

where $\lambda$ is the molecular mean free path and $L$ is the characteristic length scale. In the DSMC regime (Kn > 0.1), the Boltzmann equation must be solved probabilistically rather than the Navier-Stokes equations deterministically.

RegimeKn RangeGoverning EquationSolver Approach
ContinuumKn < 0.001Navier-StokesrhoCentralFoam, etc.
Slip flow0.001 < Kn < 0.1NS + slip BCsStandard FOAM
Transition0.1 < Kn < 10BoltzmanndsmcFoam
Free molecularKn > 10Collisionless BoltzmanndsmcFoam

The DSMC method divides the flow field into cells and tracks representative particles within each cell. Collisions are sampled probabilistically using the Variable Hard Sphere (VHS) model. The simulation advances in time steps that must resolve the mean collision time:

$$\Delta t < \min\left(\frac{1}{\nu_{max}}, \frac{L_{cell}}{c_{max}}\right)$$

where $\nu_{max}$ is the maximum collision frequency and $c_{max}$ is the maximum molecular speed.

dsmcFoam is primarily applicable to high-altitude aerodynamics, micro-electromechanical systems (MEMS), and vapor deposition processes. It is not applicable to standard aerodynamic applications — running DSMC for subsonic flow over a road car would be like using an electron microscope to check oil levels in your engine.

LBM: latticeBoltzmannFoam

Lattice Boltzmann methods solve a discretized form of the Boltzmann equation on a lattice with discrete velocity directions. The method has gained popularity for its excellent parallel scaling and natural handling of complex boundaries.

latticeBoltzmannFoam was available in some OpenFOAM distributions but is not part of core FOAM extensions v14. Community implementations exist (e.g., PALABOS, OpenLB) that can be interfaced with OpenFOAM. LBM is particularly effective for:

The lattice Boltzmann method trades kinetic theory elegance for computational simplicity: on a GPU, lattice Boltzmann can outperform Navier-Stokes solvers by a factor of 5-10 for certain problem classes. But if you need accurate turbulence modeling, LBM currently trails behind RANS/LES approaches based on finite volume discretization.

Electrostatics: electrostaticFoam

electrostaticFoam solves the Poisson equation for electric potential:

$$-\nabla \cdot (\epsilon \nabla \phi) = \rho_e$$

where $\epsilon$ is the electric permittivity and $\rho_e$ is the charge density. The electric field is then:

$$\mathbf{E} = -\nabla \phi$$

and the electrostatic force density is:

$$\mathbf{f}_e = \rho_e \mathbf{E} - \frac{1}{2} E^2 \nabla \epsilon + \nabla \left(\frac{1}{2} \rho_e T \frac{\partial \epsilon}{\partial T}\right)$$

The last term is the electrostrictive contribution (usually negligible).

electrostaticFoam is useful for:

Configuration example:

// constant/epsilon
epsilon
{
    type            uniform;
    value           8.854e-12;   // vacuum permittivity (F/m)
}

// 0/phi (electric potential)
boundaryField
{
    electrode
    {
        type            fixedValue;
        value           uniform 100;   // 100 V
    }
    ground
    {
        type            fixedValue;
        value           uniform 0;
    }
    default           zeroGradient;
}

See Incompressible Flow for context on coupling electrostatic forces into fluid solvers via source terms.

MHD: mhdFoam (Magnetohydrodynamics)

mhdFoam solves the coupled Navier-Stokes and Maxwell's equations for conducting fluids in magnetic fields. The governing equations add the Lorentz force and induced electric field:

$$\mathbf{f}_L = \mathbf{J} \times \mathbf{B}$$

where $\mathbf{J}$ is the current density and $\mathbf{B}$ is the magnetic field. The induction equation (magnetic Reynolds number regime dependent):

$$\frac{\partial \mathbf{B}}{\partial t} = \nabla \times (\mathbf{u} \times \mathbf{B}) + \frac{1}{\mu_0 \sigma} \nabla^2 \mathbf{B}$$

where $\sigma$ is electrical conductivity and $\mu_0$ is permeability of free space.

mhdFoam is applicable to:

The Hartmann number determines the importance of Lorentz forcing:

$$Ha = B L \sqrt{\frac{\sigma}{\mu}}$$

When Ha >> 1, the flow becomes highly anisotropic (Hartmann layers form along field lines, parabolic profiles in cross-field direction). Resolving Hartmann layers is the primary mesh challenge — boundary layers of thickness O(1/Ha) require extreme near-wall resolution.

DPMFoam: Lagrangian Discrete Phase Modeling

DPMFoam solves Eulerian fluid flow with Lagrangian particle tracking. The fluid phase is solved with a standard solver (e.g., simpleFoam or pimpleFoam), and particles are tracked through the velocity field:

$$\frac{d\mathbf{u}_p}{dt} = \mathbf{F}_D(\mathbf{u} - \mathbf{u}_p) + \frac{\mathbf{g}(\rho_p - \rho_f)}{\rho_p} + \mathbf{F}_{other}$$

where $\mathbf{F}_D$ is the drag force per unit acceleration, $\mathbf{g}$ is gravity, and $\mathbf{F}_{other}$ includes lift, Saffman force, Basset history, and virtual mass effects.

FeatureDPMFoam Capability

+-----------------------+------------------------------+

Particle-particle interactionNeglected (dilute)
Particle-wall collisionSpecular/Damnian reflection
Evaporation/CombustionNo (not in standard DPMFoam)
Breakup/CollisionNo
Multi-size distributionsYes (via parcels)
2-way couplingYes
4-way couplingNo

DPMFoam is appropriate for spray combustion droplet tracking (when uncoupled from chemistry), dust transport, and particle-laden flows where the volume fraction of particles is < ~10⁻⁴. For higher volume fractions, Eulerian-Eulerian multiphase solvers are more appropriate.

See Multiphase Flows for comparison with Eulerian multiphase approaches.

Radiation Models

OpenFOAM provides multiple radiation models for participating media:

ModelMethodApplicability

+----------------------------+---------------------+----------------------------+

viewFactor (radiationVIEW)View factor-basedEnclosures, participating media (gray)
DO (Diffusion Approximation)Diffusion modelOptically thick media (τ >> 1)
P1Order-1 spherical harmonicsSemi-transparent media
Discrete Ordinates (S^n)Angular discretizationGeneral purpose (moderate cost)
RosselandDiffusion approx.Very optically thick (τ → ∞)

The viewFactor model computes angle factors between surfaces and is the most accurate for non-participating (non-scattering) enclosures. The DO model solves the radiative transfer equation (RTE) with angular discretization — it is the most general but also the most expensive.

ANSYS Comparison: Specialized Modules

OpenFOAM SolverANSYS EquivalentStar-CCM+ Equivalent

+-----------------------+-------------------------------------+----------------------------|

dsmcFoamANSYS Fluent DSMC (limited availability)ANSYS SpaceClaim (mesher only)
electrostaticFoamANSYS Maxwell (electromagnetics)SIMPOLE (electrostatic only)
mhdFoamANSYS Mechanical + Maxwell (coupled)User-Defined Function (MHD)
DPMFoamANSYS Fluent DPM (comprehensive)Discrete Phase Model
dnsFoamNot available (custom code needed)LES/DNS modes
latticeBoltzmannFoamNot available (no native LBM)No native LBM
viewFactor radiationANSYS Radiation (S²S, DTRM)Radiation Model (same)

ANSYS provides specialized modules (ANSYS Maxwell for electromagnetics, Fluent UDF/Macro for custom physics) that are broadly more capable for niche applications. Star-CCM+ has a more unified multi-physics platform with user-defined functions in Java/C++. OpenFOAM's specialized solvers require more custom code to extend, but offer full source-level transparency.

The tradeoff: ANSYS provides polished, well-documented modules that work out of the box for most niche applications. OpenFOAM provides solvers that work well if you understand their derivations and will require significant code modification to extend beyond their original scope. One approach is not objectively better; the question is whether you are the type of researcher who reads source code for fun or for compliance.

Workflow Recommendations

Physical PhenomenonPrimary OpenFOAM SolverAlternative Consideration

+----------------------------------+----------------------------+------------------------------------+

DNS turbulence (low Re)dnsFoamOpenFOAM + PALABOS LBM
Rarefied gasdsmcFoamMONACO, PiMCC (community)
Particle tracking (dilute)DPMFoamANSYS Fluent DPM
ElectrostaticselectrostaticFoamANSYS Maxwell (industrial)
MHD (liquid metal)mhdFoamCOMSOL, ANSYS Maxwell-Mechanical
Radiation (enclosure)radiationVIEW + solverANSYS S²S model
Radiation (general RTE)DO model + solverANSYS DTRM, Star-CCM+ S²S
LBM (porous/microfluidics)PALABOS/OpenLB (external)ANSYS (limited LBM via UDF)

References