OpenFOAM

OpenFOAM is leading software for computational fluid dynamics (CFD). It is licensed free and open source only under the GNU General Public Licence (GPL) by the OpenFOAM Foundation. Different versions of OpenFOAM supplied from different projects exist so choose your module carefully.

Usage

There are two OpenFOAM modules, choose one and load it with either:

module load OpenFOAM/8-foss-2020a
module load OpenFOAM/v2012-foss-2020a

OpenFOAM can be used in an interactive or batch job. Both OpenFOAM modules can be activated using the module file and sourcing the OpenFOAM environment script e.g.

module load OpenFOAM/8-foss-2020a
source $FOAM_BASH

Interactive Usage

The following is an example single core interactive session running the pitzDaily example model.

After connecting to Bessemer (see Establishing a SSH connection), you can start an interactive graphical session.

module load OpenFOAM/8-foss-2020a
source $FOAM_BASH
rm -r /fastdata/$USER/tests/openfoam/run/
mkdir -p /fastdata/$USER/tests/openfoam/run
cd /fastdata/$USER/tests/openfoam/run
cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
chmod 700 -R pitzDaily && cd pitzDaily
mpirun blockMesh
mpirun simpleFoam
mpirun paraFoam #To view the output.

Batch Usage

The following is an example batch job running the pitzDaily example model:

Important

You will need to supply a decomposeParDict in the system subdirectory of the case - check the installation script for an example using the EOF method to add it :

#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=4
#SBATCH --mem=8000
#SBATCH --job-name=name_OpenFOAM_smp_4
#SBATCH --output=output_OpenFOAM_smp_4
#SBATCH --time=01:00:00
#SBATCH --mail-user=a.person@sheffield.ac.uk
#SBATCH --mail-type=ALL
rm -r /fastdata/$USER/tests/openfoam/run/
mkdir -p /fastdata/$USER/tests/openfoam/run
cd /fastdata/$USER/tests/openfoam/run
module load OpenFOAM/8-foss-2020a
source $FOAM_BASH
cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
chmod 700 -R pitzDaily && cd pitzDaily
cp /home/$USER/openfoam/my_custom_decomposeParDict system/decomposeParDict #You must supply you own copy or see the example modified test script below.
srun --export=ALL blockMesh
srun --export=ALL decomposePar
srun --export=ALL simpleFoam -parallel

Installation note for Administrators:

OpenFOAM v2012

OpenFOAM v2012 has been installed using Easybuild with all third party modules (NCurses 6.2, METIS 5.1.0, SCOTCH 6.0.9, CGAL 4.14.3 and Paraview 5.8.0)

Installation was tested as follows as above with the example batch script modified to load OpenFOAM/v2012-foss-2020a (Getting Started example from https://openfoam.org/download/8-source/) with the below decomposeParDict:

OpenFOAM 8

OpenFOAM 8 has been installed using Easybuild with all third party modules (NCurses 6.2, METIS 5.1.0, SCOTCH 6.0.9, CGAL 4.14.3 and Paraview 5.8.0)

Installation was tested as follows as above with the example batch script modified (Getting Started example from https://openfoam.org/download/8-source/) with the below decomposeParDict:

https://openfoamwiki.net/index.php/DecomposePar

The module file is available below: