Skip to main content

OpenFOAM

Loading OpenFOAM

OpenFOAM Is available through the lib-engine/modules/all library. But because lib-engine library is dependable on lib-edda it is required to load ````lib-eddaprior 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 on how to run OpenFOAM with 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 # 48 cores per node (96 in total)
#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 # loading 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 &