Skip to content

OpenFOAM

An open-source software for computational fluid dynamics (CFD).


OpenFOAM requires an environment module

In order to use OpenFOAM, you must first load the appropriate environment module:

module load gnu openmpi openfoam

OpenFOAM (Open Field Operation and Manipulation) is a powerful, open-source software toolkit for computational fluid dynamics (CFD) and related fields. It offers a range of solvers for simulating fluid flow, heat transfer, turbulence, and chemical reactions.

Using OpenFOAM on RCC Resources#

OpenFOAM is available on the HPC login nodes and can be loaded along with the GNU and OpenMPI modules. To use OpenFOAM, you need to load the appropriate modules and set up the environment variables. The following instructions will guide you through the process of loading OpenFOAM on the RCC.

  1. Open a terminal window and run the following command to load the OpenFOAM module:

    $ module load gnu openmpi openfoam
    

  2. To verify that the module has been loaded, run:

    $ module list
    
    You should see openfoam/2412 listed among the loaded modules.

  3. Run the below source command to load the OpenFOAM environment variables:

    $ source ${FOAM_BASHRC}
    

Example OpenFOAM Job Submission Script#

The following is an example of a Slurm job submission script for running OpenFOAM.

#!/bin/bash
#SBATCH -J "FOAMJob"
#SBATCH -A genacc_q
#SBATCH -t 4-00:00:00
#SBATCH -n 64

module load gnu openmpi openfoam
## This line can also be:
## module load gnu/8.5.0 openmpi/4.1.0 openfoam/2412

source ${FOAM_BASHRC}

## Create the necessary processor directories
for i in $(seq 0 $((SLURM_NTASKS - 1)))
do
   mkdir processor${i}
done

## Run
srun simpleFoam -parallel

For detailed instructions on job submission, refer to our job submission tutorial.

For more information on how to use OpenFOAM, refer to the official documentation page.