Skip to content

OpenFOAM

OpenFOAM is an open-source CFD toolbox for simulating fluid flows, turbulence, heat transfer, chemical reactions, solid dynamics, and electromagnetics.

Loading the module

module load OpenFOAM/v2306-foss-2023a
source $FOAM_BASH

Always source $FOAM_BASH

After loading the module, you must run source $FOAM_BASH to set OpenFOAM's internal environment variables. Without this step, most OpenFOAM commands will fail.

To see all installed versions across clusters, check the software catalog or run module spider OpenFOAM.

Expand to see all available modules on each cluster
OpenFOAM/13-foss-2023a OpenFOAM/v2306-foss-2022b
OpenFOAM/7-foss-2019b OpenFOAM/8-foss-2020b OpenFOAM/v1912-intel-2019b
OpenFOAM/v2306-foss-2022b
OpenFOAM/v1906-foss-2019b OpenFOAM/v1912-foss-2019b

Batch job examples

openfoam.slurm
#!/bin/bash
#SBATCH --qos=regular
#SBATCH --job-name=openfoam
#SBATCH --nodes=4
#SBATCH --ntasks-per-node=48
#SBATCH --cpus-per-task=1
#SBATCH --mem=200G
#SBATCH --time=24:00:00
#SBATCH --output=%x.%j.out
#SBATCH --error=%x.%j.err

module load OpenFOAM/v2306-foss-2023a
source $FOAM_BASH

srun pisoFoam -parallel

Tip

Decompose your case with decomposePar before submitting. The number of subdomains in system/decomposeParDict must match the total number of MPI tasks (nodes × ntasks-per-node).

openfoam.slurm
#!/bin/bash
#SBATCH --qos=regular
#SBATCH --job-name=openfoam
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=16G
#SBATCH --time=04:00:00
#SBATCH --output=%x.%j.out
#SBATCH --error=%x.%j.err

module load OpenFOAM/v2306-foss-2023a
source $FOAM_BASH

blockMesh > log.blockMesh 2>&1
icoFoam  > log.icoFoam  2>&1

See also