Skip to main content

OpenFOAM

Loading OpenFOAM

OpenFOAM is available through the lib-engine/modules/all library. Because the lib-engine library depends on lib-edda, it is required to load lib-edda prior to loading OpenFOAM from the lib-engine library.

Example of loading required libraries

$ ml use /hpcapps/lib-edda/modules/all/Core
$ ml use /hpcapps/lib-engine/modules/all
$ ml load OpenFOAM/10-OpenMPI-4.1.5

Run OpenFOAM with SBATCH | Example compressibleInterFoam

Here is an example of how to run OpenFOAM with an SBATCH script:

#!/bin/bash

#SBATCH --mail-type=ALL
#SBATCH --mail-user=uname@hi.is # for example uname@hi.is
#SBATCH --partition=any_partition # request node from a specific partition
#SBATCH --nodes=1 # number of nodes
#SBATCH --ntasks-per-node=4 # 4 cores per node
#SBATCH --mem-per-cpu=2300 # MB RAM per cpu core
#SBATCH --time=0-04:00:00 # run for 4 hours maximum (DD-HH:MM:SS)
#SBATCH --hint=nomultithread # Suppress multithread
#SBATCH --output=myjob-%j.out
#SBATCH --error=myjob-%j.err


ml use /hpcapps/lib-edda/modules/all/Core # load lib-edda library
ml use /hpcapps/lib-engine/modules/all # load lib-engine library

# loading OpenFOAM
ml load OpenFOAM/10-OpenMPI-4.1.5

source $FOAM_BASH

# run decomposition
blockMesh
setFields
decomposePar

# run openfoam simulation
mpiexec -np 4 compressibleInterFoam -parallel > log.compress &