OPENFoam

The program is available in modules, in several development branches and versions

The solids4foam extension is also available to foam-extend both versions.

The contents of the input script for sbatch for a job running on a single core:

#!/bin/bash
#SBATCH --job-name=foam_test
#SBATCH --output=test.%j.output
#SBATCH --error=test.%j.error

#SBATCH --nodes=1
#SBATCH --ntasks=1

module load <module>

srun <program> <prepinace>

After <module> insert e.g. openfoam-org/6-10.3.0, <program> e.g. snappyHexmesh

Script for a parallel job on 4 cores:

#!/bin/bash
#SBATCH --job-name=foam_test
#SBATCH --output=test.%j.output
#SBATCH --error=test.%j.error

#SBATCH --nodes=1
#SBATCH --ntasks=4

module load openfoam-org/6-10.3.0

#decomposePar decomposes the task over specified number of cores
#keep value of numberOfSubdomains in system/decomposeParDict the same as ntasks specified above!
decomposePar -force

srun myLusgsFoam -parallel
Compilation of custom/additional code

Custom/add-on code can be compiled to OpenFOAM. We will show the procedure using the code available from github

mkdir test_folder
cd test_folder
git clone https://github.com/furstj/myFoam.git

For example, select the implementation for OpenFOAM-org 6 by selecting the appropriate git branch

git checkout OF6

Now we load the module for OpenFOAM-org 6

ml openfoam-org/6-10.3.0 

This loaded the variables normally used by OpenFOAM programs ($WM_PROJECT_DIR, etc. ) into the environment. The correct compiler (here gcc/10.3.0) was also loaded with the module. It remains to perform the compilation itself, for the downloaded code is sufficient:

cd myFoam
./Allwmake 
cd ../mySolvers/
./Allwmake

In this case, the compilation result is placed in the usual OpenFOAM paths, e.g. ~/OpenFOAM/username-6/platforms/linux64GccDPInt32-spack/