Skip to content

OpenFOAM

OpenFOAM is an open-source C++ library for solving partial differential equations. It is mainly used for computational fluid dynamics, for which there are many implemented solvers and different kinds of utilities. For further info see the OpenFOAM homepage.

We install OpenFOAM as a complete package, i.e. the module OpenFOAM/2406 contains the OpenFOAM version and all the packages needed to use this OpenFOAM version rather than installing them separately and creating multiple modules.

Submitting OpenFOAM jobs

In order to submit OpenFOAM jobs, you can structure your bash script along the following lines:

#!/usr/bin/env bash
#SBATCH -A PROJECT_NUMBER -p vera
#SBATCH -n 32 -c 2  # Uses 64 cores in total
#SBATCH -t 24:00:00
ml OpenFOAM/v2406
source $FOAM_BASH
export FOAM_FILEHANDLER=collated
...
# Set up other configurations here
...
srun interFoam -parallel

Adjust the number of tasks -n and cores per task -c according to what gives the best performance for your workload. The optimal settings can vary depending on the hardware used as well as the workload.