Skip to content

OpenFOAM

OpenFOAM (Open-source Field Operation And Manipulation) is a toolbox for the development of customised numerical solvers, and pre/post-processing utilities for the solution of continuum mechanics problems, most prominently including computational fluid dynamics (CFD).

OpenFOAM is available as a module, which wraps an Apptainer container on Apocrita.

Usage

To run the default version of OpenFOAM, simply load the openfoam module:

module load openfoam
openfoam [command]

The command must be a valid OpenFOAM command. A few examples are listed below:

openfoam foamExec
openfoam blockMesh
openfoam pisoFoam

Add the -help parameter after any OpenFOAM command for usage information and examples.

Example jobs

In both examples below, substitute FOAM_PROJECT with your actual OpenFOAM project directory.

Serial job

Here is an example job running on 1 core and 5GB of memory:

#!/bin/bash
#$ -cwd
#$ -j y
#$ -pe smp 1
#$ -l h_vmem=5G

module load openfoam

cd FOAM_PROJECT
openfoam blockMesh
openfoam pisoFoam

Parallel job

Here is an example job running on 96 cores across 2 ddy nodes with MPI:

#!/bin/bash
#$ -cwd
#$ -j y
#$ -pe parallel 96
#$ -l infiniband=ddy-i
#$ -l h_rt=240:0:0

module load openfoam

cd FOAM_PROJECT
openfoam blockMesh
mpirun -np $NSLOTS openfoam interFoam

References