====== OPENFoam ====== The program is available in modules, in several development branches and versions * [[https://www.openfoam.com/news/main-news/openfoam-v20-12|OpenFOAM v2012]] * [[https://openfoam.org/|OpenFOAM-org]] ver. 6 and 8 * [[https://openfoamwiki.net/index.php/Main_Page|foam-extend]] versions 4.0 and 4.1 The [[https://bitbucket.org/philip_cardiff/solids4foam-release/src/master/| 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 srun After insert e.g. openfoam-org/6-10.3.0, 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/