Skip to content

OpenFOAM

OpenFOAM is an open-source CFD program with a large user base from various domains of engineering and science, commercial and academic organizations. It includes a large set of functionalities for solving fluid flows, which can also cover chemical reactions, turbulence, heat transfer, acoustics, solid mechanics, and more.

License

OpenFOAM is a free program released under the license GPL v3

Installation:

Different versions of OpenFOAM are available on the cluster as a module.

module avail OpenFOAM

Output:

-------------------------------------------------------------------------------------------------- /ceph/hpc/software/modulefiles --------------------------------------------------------------------------------------------------
   OpenFOAM/v2106

--------------------------------------------------------------------------------------------- /cvmfs/sling.si/modules/el7/modules/all ----------------------------------------------------------------------------------------------
   OpenFOAM/v2106-foss-2021a    OpenFOAM/v2206-foss-2022a    OpenFOAM/8-foss-2020a (D)

Slurm examples

Example of SBATCH script

Example of using the module, mpirun is used in parrallel examples/tutorials:

#!/bin/bash

#SBATCH --job-name=openfoam
#SBATCH --nodes=1
#SBATCH --ntasks=4
#SBATCH --partition=cpu
#SBATCH --output=%j.out
#SBATCH --error=%j.err
#SBATCH --time=00:30:00

module load OpenFOAM/v2206-foss-2022a

export EXAMPLE_PATH=<path_to_your_example>
srun --mpi=pmix_v3 $EXAMPLE_PATH/Allrun

Visualisation

Visualization of the obtained results is possible with the software ParaView, it is available on the cluster as a module.

module av ParaView

Output:

---------------------------------------------------------------------------------------------- /cvmfs/sling.si/modules/el7/modules/all -----------------------------------------------------------------------------------------------
   ParaView/5.4.1-foss-2018b-mpi    ParaView/5.8.0-foss-2020a-Python-3.8.2-mpi    ParaView/5.9.1-foss-2021a-mpi    ParaView/5.10.1-foss-2022a-mpi (D)

The obtained results are then converted into the appropriate format using the command foamToVTK, which can also be done by creating an empty file <name>.foam and run the below script inside the project directory.

#!/bin/bash

touch foam.foam
module load ParaView Qt5
module unload OpenSSL
paraview foam.foam

Documentation

Live demo