Skip to content

OpenFOAM

OpenFOAM 8 from the 2022r2 software stack

To use OpenFOAM 8:

module load 2022r2 openmpi/4.1.1 openfoam-org/8
source /apps/arch/2022r2/software/linux-rhel8-skylake_avx512/gcc-8.5.0/openfoam-org-8-vfsuxrtfzyrg5wxeifjch6p5pnfbl7gp/etc/bashrc

OpenFOAM 2106 from the 2022r2 software stack

1. Load necessary modules:

module load 2022r2
module load openmpi
module load openfoam

2. Source the necessary configuration files:

source /apps/arch/2022r2/software/linux-rhel8-skylake_avx512/gcc-8.5.0/openfoam-2106-6iqyrrzl6jyb3mpzcy4cqohas5dqmgwc/etc/bashrc

3. OpenFOAM is ready to go:

[<NetID>@login01 ~]$ chemFoam -help

Usage: chemFoam [OPTIONS]
Options:
  -case <dir>       Specify case directory to use (instead of cwd)
  -postProcess      Execute functionObjects only
  -doc              Display documentation in browser
  -help             Display short help and exit
  -help-full        Display full help and exit

Solver for chemistry problems, designed for use on single cell cases to provide
comparison against other chemistry solvers

Using: OpenFOAM-v2106 (2106) - visit www.openfoam.com
Build: _c15bfde3cb-20210624
Arch:  LSB;label=32;scalar=64

4. To submit a job:

Submission script:

#SBATCH --job-name="openfoam"
#SBATCH --time=01:00:00
#SBATCH --partition=compute
#SBATCH --ntasks=4
#SBATCH --cpus-per-task=1
#SBATCH --mem-per-cpu=1G
#SBATCH --account=research-<faculty>-<department>

module load 2022r2
module load openmpi
module load openfoam

source /apps/arch/2022r2/software/linux-rhel8-skylake_avx512/gcc-8.5.0/openfoam-2106-6iqyrrzl6jyb3mpzcy4cqohas5dqmgwc/etc/bashrc

srun --cpu-bind=none interFoam -parallel

Pay attention to the following:

  1. I am running with srun, not mpiexec or mpirun. srun does not need a -n or -np parameter, as it sources all necessary information itself from the submission script.

  2. I have to give srun a flag --cpu-bind=none, otherwise binning of processes to CPUs can be wrong, and the program will "stall".