Versions Installed

Kay: 6


OpenFOAM is an open source package for finite-volume based solution of problems in continuum mechanics, primarily Computational Fluid Dynamics (CFD). OpenFOAM is supplied with several standard solvers for different classes of flow problems, including multiphase flow and combustion. The object-oriented C++ implementation of OpenFOAM facilitates the development of custom flow solvers.


OpenFOAM is available under the terms of the GNU General Public License.



Job Submission Example

Like other jobs on ICHEC systems, OpenFOAM jobs must be submitted using a Slurm submission script. The following is an example Slurm submission script for allocating 1 node of Kay (40 cores) for 30 minutes, then running the channel395 tutorial in parallel over 4 cores within that allocation. Note that OpenFOAM employs domain decomposition for parallel runs which is defined geometrically by decomposeParDict in the system directory. Each processor must be assigned a portion of the mesh on which to operate. For the case below, the corresponding decomposeParDict, the default shipped with the source, defines 4 regions. The solvers can therefore only be run over 4 cores. To vary this, the decomposeParDict must be edited accordingly (both numberOfSubdomains, and the (nx ny nz) "n" coeffs). More detailed information on running OpenFOAM in parallel can be found here.

Load the desired version of openfoam using the environment module

module load openfoam/$version
source $OPENFOAM_ROOT/etc/bashrc

Copy the tutorial

cp -r $FOAM_TUTORIALS/incompressible/pimpleFoam/LES/channel395 ./
cd ./channel395

Create the submission script (and name it for the SLURM Workload Manager and modify it with your parameters

# All the information about queues can be obtained using 'sinfo'
# DevQ         up    1:00:00
# ProdQ*       up 3-00:00:00
# LongQ        up 6-00:00:00
# ShmemQ       up 3-00:00:00
# PhiQ         up 1-00:00:00
# GpuQ         up 2-00:00:00

# Slurm flags
#SBATCH -p ProdQ
#SBATCH -t 00:30:00
#SBATCH --job-name=myjobname

# Charge job to myproject
#SBATCH -A myproject

# Write stdout+stderr to file
#SBATCH -o output.txt

# Mail me on job start & end
#SBATCH --mail-type=BEGIN,END


# Load the module for the specific version
module load openfoam/$version
source $OPENFOAM_ROOT/etc/bashrc

# Generate mesh
# Decompose mesh
# Run simulation in parallel
srun -n 4 pimpleFoam -parallel
# Reconstruct solution
# Postprocess

Submit the job with the following command


Setting Environment Variables

Frequent OpenFOAM users will know that the custom linux environment is set by sourcing the bashrc contained within the source code. Since the bashrc file is sourced manually, unloading the module doesn't revert back to the original environment state


On Kay, OpenFOAM usually is not compiled with the included Paraview package due to performance considerations. We advise users to simply create the reader module using

paraFoam -touch

and then, to transfer their case data to their local machine for further post-processing.


Additional Notes

Further information can be obtained from the OpenFOAM Foundation Website

Supported By

File Browser Reference
Department FHERIS
NUI Galway
HEA Logo