| name | openfoam-21-environment-setup |
| description | Sub-skill of openfoam: 2.1 Environment Setup (+6). |
| version | 1.0.0 |
| category | engineering |
| type | reference |
| scripts_exempt | true |
2.1 Environment Setup (+6)
2.1 Environment Setup
source /usr/lib/openfoam/openfoam2312/etc/bashrc
2.2 Serial Workflow
blockMesh
checkMesh
checkMesh -allTopology -allGeometry
potentialFoam -writephi
simpleFoam > log.simpleFoam 2>&1
pimpleFoam > log.pimpleFoam 2>&1
interFoam > log.interFoam 2>&1
icoFoam > log.icoFoam 2>&1
simpleFoam -postProcess -func yPlus -latestTime
foamToVTK -latestTime
foamLog log.simpleFoam
2.3 Parallel Workflow
decomposePar
mpirun -np 4 simpleFoam -parallel > log.simpleFoam 2>&1
reconstructPar -latestTime
reconstructPar
rm -rf processor*
2.4 Complex Geometry Workflow (snappyHexMesh)
surfaceFeatureExtract
blockMesh
decomposePar
mpirun -np 6 snappyHexMesh -overwrite -parallel
mpirun -np 6 potentialFoam -writephi -parallel
mpirun -np 6 simpleFoam -parallel > log.simpleFoam 2>&1
reconstructPar -latestTime
2.5 Multiphase Workflow (interFoam)
blockMesh
setFields
interFoam > log.interFoam 2>&1
2.6 Solver Selection Guide
| Scenario | Solver | Algorithm |
|---|
| Steady incompressible RANS | simpleFoam | SIMPLE |
| Transient incompressible | pimpleFoam | PIMPLE |
| Transient laminar | icoFoam | PISO |
| VOF multiphase | interFoam | PIMPLE |
| Potential flow init | potentialFoam | — |
| Compressible | rhoSimpleFoam | SIMPLE |
| Buoyant convection | buoyantSimpleFoam | SIMPLE |
2.7 Key CLI Flags
| Flag | Purpose |
|---|
-case <dir> | Specify case directory |
-parallel | Run in parallel (after decomposePar) |
-postProcess | Execute function objects only |
-latestTime | Process latest time directory only |
-overwrite | Overwrite existing mesh (snappyHexMesh) |
-writephi | Write flux field (potentialFoam) |
-dry-run | Check setup without running |