Skip to content

OpenFOAM

OpenFOAM

OpenFOAM is a free, open source CFD software package.

OpenFOAM has an extensive range of features to solve anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to solid dynamics and electromagnetics.

Usage

OpenFOAM Module

OpenFOAM has to be loaded using Lmod prior to running it.

$ module load OpenFOAM/v1912-foss-2019b

Once the module has been loaded you will need to set some enviroment variables:

$ source $FOAM_BASH

You can also list all available versions using Lmod's spider command:

$ module spider OpenFOAM

How to run OpenFOAM

Submission scripts should contain the following lines to run OpenFOAM:

Batch script for a parallel job
#!/bin/bash
#SBATCH --qos=regular
#SBATCH --job-name=OpenFOAM_JOB
#SBATCH --mem=200gb
#SBATCH --cpus-per-task=8
#SBATCH --nodes=8
#SBATCH --ntasks-per-node=6
#SBATCH --output=%x-%j.out
#SBATCH --error=%x-%j.err

module load OpenFOAM/v1912-foss-2019b
source $FOAM_BASH

srun pisoFoam -parallel > log.pisoFoam

Or if you intend to submit a serial job:

Batch script for a serial job
#!/bin/bash
#SBATCH --partition=serial
#SBATCH --job-name=OpenFOAM_JOB
#SBATCH --mem=200gb
#SBATCH --cpus-per-task=1
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --output=%x-%j.out
#SBATCH --error=%x-%j.err

module load OpenFOAM/v1912-foss-2019b
source $FOAM_BASH

blockMesh >& log.blockMesh
icoFoam  >& log.icoFoam