Skip to main content
Texas Tech University

OpenFOAM

Introduction

OpenFOAM® is a C++ toolbox for developing custom numerical solvers and pre- and post-processing utilities for continuum mechanics problems, including computational fluid dynamics (CFD). OpenFOAM is one of the leading CFD applications and is increasingly popular due to its extensive capabilities and open-source availability.

Running OpenFOAM in HPCC

OpenFOAM has two different releases that are managed by different organizations:

    • OpenFOAM.com
    • OpenFOAM.org

Multiple versions of OpenFOAM modules for each release are currently available on CPU partitions. Please visit the HPCC Software list page to find the specific version and module set for each version. The LMod modules for "OpenFOAM.org" releases have the -org extension. For example:

# OpenFOAM.com
module load gcc/14.2.0 openmpi/5.0.5 openfoam/2412
# OpenFOAM.org 
module load gcc/14.2.0 openmpi/5.0.5 openfoam-org/6

After selecting your preferred module set for a specific partition, create a job submission script with the following contents as a reference, customized for each partition:

#!/bin/bash 
#SBATCH --job-name=openfoam_nocona
#SBATCH --partition=nocona
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=128
#SBATCH --output=%N.%j.out
#SBATCH --error=%N.%j.err
#SBATCH --time=10:00:00 

module load aocc/4.2.0 openmpi/5.0.5 openfoam/2412

decomposePar -force > log.decomposePar

mpirun -np $SLURM_NTASKS --bind-to core --map-by l3cache \
       simpleFoam -parallel > log.simpleFoam
#!/bin/bash 
#SBATCH --job-name=openfoam_quanah
#SBATCH --partition=quanah
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=36
#SBATCH --output=%N.%j.out
#SBATCH --error=%N.%j.err
#SBATCH --time=10:00:00 

module load intel-oneapi/2024.2.1 oneapi-mpi/2021.13.1 openfoam/2312-mkl

decomposePar -force > log.decomposePar

mpirun -np $SLURM_NTASKS --bind-to core --map-by socket simpleFoam \
       -parallel > log.simpleFoam reconstructPar > log.reconstructPar

Then submit this job using the sbatch command. Please make sure to edit the following Slurm parameters as needed:

Number of nodes (--nodes): If you want to scale out your job to run across multiple worker nodes.

Number of MPI tasks (--ntasks-per-node): We recommend setting this parameter to the maximum number of available CPU cores per node on each partition.

Wall time (--time): If your job won’t take longer than 10 hours, leave it as it is. Adjust the wall time based on how long you estimate your job will take.


Please contact HPCC support at hpccsupport@ttu.edu if you have any questions.