grokkingstuff Home Blog Projects Wiki Calculators About

OpenFOAM Overview

date2026-07-28tags:openfoam: :wiki:

Overview

OpenFOAM (OpenFOAM Foundation) is a free, open-source Computational Fluid Dynamics (CFD) toolbox written in C++. It implements the finite volume method (simpleFoam, pimpleFoam, etc.) on unstructured mesh grids. Unlike proprietary solvers that wrap everything in a graphical point-and-click environment, OpenFOAM demands you understand your discretization, boundary conditions, and mesh quality. This is a feature, not a bug: you get the equations exactly.

OpenFOAM is developed by two primary branches: ESI-OpenCFD (version 2306 and later, the actively maintained commercial-backed line) and foam-extend (the community fork with experimental features such as compressible interFoam variational formulation). In 2024, the Foundation release (v14) introduced a modular-solver architecture that decouples single-region and multi-region solvers into foamRun and foamMultiRun.

The philosophy, as stated by its founders, is "open source, open minds, open fluid" — which is CFD speak for "you are responsible for every line of every .I/O object."

Three-Stage Workflow

OpenFOAM's workflow consists of three stages: pre-processing, solving, and post-processing. Unlike ANSYS Workbench, which integrates all three into a single project tree, OpenFOAM treats each stage as a sequence of command-line utilities. This is not a deficiency; it is a feature that enables scripting and automation at scale, at the cost of requiring you to memorize blockMesh syntax.

Pre-processing

Pre-processing creates the geometry, mesh, initial conditions, and boundary conditions. Key utilities include:

Solving

The solver stage runs one of the .Foam executable binaries (icoFoam, simpleFoam, interFoam, rhoSimpleFoam, chtMultiRegionFoam, etc.). Each solver solves a specific combination of the governing equations. See OpenFOAM Solver Selection for detailed solver mapping. The solver reads:

Post-processing

Post-processing reconstructs, visualizes, and extracts data:

OpenFOAM Case Directory Structure

Every OpenFOAM case follows a strict directory convention. Deviating from it is a guaranteed path to errors that will require you to read IOobject.H to understand why.

DirectoryContents
---------------------
0/Initial conditions and boundary conditions for all fields (U, p, k, epsilon, alpha.water, etc.)
constant/Mesh data (polyMesh), physical property tables, turbulence models, thermophysical properties
system/fvSchemes, fvSolution, controlDict, decomposeParDict, blockMeshDict, snappyHexMeshDict
postProcessing/Generated data from sample, function objects, logs
processor*/Parallel decomposition subdirectories (created automatically by decomposePar)

The controlDict is the master control file: it specifies solver name, time step, writing interval, and the functions sub-dictionary for runtime function objects (forces, sampling, field averages).

Initial Conditions and Boundary Conditions

The 0/ directory contains field files. Each field file has the OpenFOAM dictionary format with a dimensions block (SI base units: [1 -3 0 0 0 0 0] for density), a internalField uniform or coded value, and a boundaryField sub-dictionary where every patch name in the mesh must have a corresponding condition.

Common boundary conditions include fixedValue, zeroGradient, inletOutlet, outflow, pressureInletOutletVelocity, totalPressure, totalTemperature, and wall functions (nutkWallFunction, nutUSpaldingWallFunction, epsilonWallFunction, omegaWallFunction). See Case Setup for the full reference.

OpenFOAM Variants and Ecosystem

ESI-OpenCFD (v2306+)

The primary development line, backed by ESI Group. Current versions (v2306, v2406) include significant performance improvements: shared-memory parallelism via Pstream threads, enhanced multiphase solvers, improved turbulence models, and a more consistent API. The foam-extend fork's most innovative features (like the VOF interface compression scheme with interface compression face fluxing) have been upstreamed into ESI-OpenCFD.

foam-extend

The community-driven fork maintained by Imperial College London and collaborators. Contains experimental features not yet in ESI-OpenCFD, including the Variational Formulation VOF (Vof), compressible interFoam, extended multiphase capability, and the Dumbbell viscoelastic model. Recommended for researchers needing cutting-edge physics not yet in the mainline.

Foundation v14 (Modular Solver)

The 2024 Foundation release restructured the solver architecture. Solvers are now modular: foamRun handles single-region simulations with a unified input file format, and foamMultiRun handles multi-region (fluid-structure interaction, conjugate heat transfer) cases. This is a significant step toward reducing the .Foam solver proliferation — instead of rhoSimpleFoam, interFoam, and chtMultiRegionFoam, you configure a single run file specifying physics modules and coupling strategy.

OpenFOAM vs ANSYS Workflow Comparison

OpenFOAM and ANSYS represent fundamentally different philosophies about how CFD software should be structured. Understanding this comparison helps practitioners transition between platforms.

AspectOpenFOAMANSYS
-------------------------
GeometryblockMesh / snappyHexMesh (scripted)DesignModeler / SpaceClaim (GUI)
MeshingUtility-driven (blockMesh, snappyHexMesh, cfMesh)Integrated Mesher (GUI + scripting)
SolverCommand-line executable per physicsFluent / CFX (single GUI with physics toggle)
Post-processingParaView (separate application)CFX-Post / Fluent Post (integrated)
ConfigurationText files (.dict, .H)TUI (TUI macros for automation) + GUI
ParallelizationBuilt-in domain decomposition (Pstream)MPI via Fluent/CFX parallel start
LicensingFree and open source (GPL)Commercial (ANSYS Commercial License)
Custom PhysicsEdit source code directly (~src/~/ ~applications~/)UDFs (User Defined Functions, C-based API)

ANSYS's workflow is: DesignModeler or SpaceClaim (geometry creation and cleanup) → ANSYS Meshing (mesh generation, inflation layers, sizing functions) → Fluent or CFX (solver setup, physics selection, solution) → CFX-Post or Fluent Post (post-processing). Three stages, four products. OpenFOAM achieves the same pipeline with blockMesh / snappyHexMesh, solver executables, and ParaView using 20 command-line utilities. The learning curve is steeper for OpenFOAM; the long-tail control is superior.

OpenFOAM Variants to ANSYS Product Line Mapping

For researchers evaluating which platform to invest in, the variant landscape maps roughly as follows:

OpenFOAM VariantANSYS EquivalentDescription
------------------------------------------------
ESI-OpenCFD v2406ANSYS Fluent (Commercial)Primary supported release, production-ready, commercial support available
foam-extend 4.1ANSYS R&D / Fluent UDF spaceExperimental features, custom physics, community-driven development
Foundation v14 (+ foamRun)ANSYS Academic (Student Edition)Modular, simplified solver interface designed for education and streamlined workflows
OpenFOAM Foundation (GPL)ANSYS StudentFree and open-source; student version of Fluent has mesh-size and feature limitations
Third-party solvers (compressibleInterFoam, etc.)ANSYS Academic UDF spaceCommunity-developed solvers for specialized physics not in the standard distribution

The key distinction is that ESI-OpenCFD is directly comparable to ANSYS Fluent in terms of support, stability, and industrial credibility. foam-extend occupies the space that ANSYS reserves for its R&D branch and UDF ecosystem. Foundation v14's modular approach is still maturing but represents the most significant architectural shift since the original OpenFOAM release.

Best Practices

Good Mesh

checkMesh is required. No exceptions. If checkMesh reports maximum non-orthogonality above 70 degrees or average skewness above 0.85, your turbulence model is about to turn your results into art. Start with a quality mesh (target non-orthogonality < 60°, aspect ratio < 1000 for most RANS simulations).

Start Robust, Finish Accurate

This is the golden rule. Begin with first-order upwind discretization, loose residuals (1e-3), and modest time steps. Once the solution has converged to a stable state, switch to second-order upwind or linearUpwind, tighten residuals (1e-6), and refine the mesh or time step. Jumping directly to second-order is the most common beginner error and produces the same results as jumping onto ice without testing its thickness.

Stability-Accuracy-Boundedness Triangle

Every divergence scheme you choose lives on this triangle. You cannot maximize all three simultaneously because numerical analysis (God forbid) says so. upwind is bounded and stable but inaccurate; linear is accurate but unbounded; linearUpwind is accurate with limited boundedness via TVD limiters. The choice depends on which axis of the triangle your simulation can afford to sacrifice. See Numerical Schemes and Numerical Schemes (OpenFOAM) for details.

Verify Before Validate

Verification answers: "Are we solving the equations correctly?" (grid convergence study, order-of-accuracy assessment, residual monitoring). Validation answers: "Are we solving the correct equations?" (comparison against experimental data, analytical solutions). Verify first, validate second, publish third. Reverse order is how spurious results become citations — a process that, frankly, the literature already has too many examples of.

Cross-Links

Related notes in this corpus: Finite Volume Method, Turbulence Models, Pressure-Velocity Coupling, OpenFOAM Solver Selection, Numerical Schemes, ANSYS Fluent Overview

Learning resources: OpenFOAM User Guide (openfoam.com), Holzmann CFD Books (holzmann-cfd.com), Wolf Dynamics courses (wolfdynamics.com), Chalmers OpenFOAM Courses (chalmers course page). The official documentation is comprehensive but assumes more familiarity than a first-time user possesses; the Holzmann books fill this gap by being pedagogically oriented.

References

-ANSYS Workbench User's Guide, ANSYS Inc.