OpenFOAM (Open Field Operation and Manipulation) CFD Toolbox is a free, open source CFD software package produced by OpenCFD Ltd. It has a large user base across most areas of engineering and science, from both commercial and academic organisations. OpenFOAM has an extensive range of features to solve anything from complex fluid flows involving chemical reactions, turbulence and heat transfer, to solid dynamics and electromagnetics. It includes tools for meshing, notably snappyHexMesh, a parallelised mesher for complex CAD geometries, and for pre- and post-processing. Almost everything (including meshing, and pre- and post-processing) runs in parallel as standard, enabling users to take full advantage of computer hardware at their disposal.
OpenFOAM offers users complete freedom to customise and extend its existing functionality, either by themselves or through support from OpenCFD. It follows a highly modular code design in which collections of functionality (e.g. numerical methods, meshing, physical models, …) are each compiled into their own shared library. Executable applications are then created that are simply linked to the library functionality. OpenFOAM includes over 80 solver applications that simulate specific problems in engineering mechanics and over 170 utility applications that perform pre- and post-processing tasks, e.g. meshing, data visualisation, etc.
The solver capabilities include:
• Incompressible flows
• Multiphase flows
• Combustion
• Buoyancy-driven flows
• Conjugate heat transfer
• Compressible flows
• Particle methods (DEM, DSMC, MD)
• Other (Solid dynamics, electromagnetics)
The Library Functionalities include:
• Turbulence models
• Transport/rheology models
• Thermophysical models
• Lagrangian particle tracking
• Reaction kinetics / chemistry
The webpage of OpenFOAM is at http://www.openfoam.com/. OpenFOAM documentation is provided online with various tutorials.
OpenFOAM is compiled and installed on HPC clusters. To run the individual version OpenFOAM solver, please run the initialization command after logging into HPC cluster first.
# source opemfoam 2.4 (for version 2.4) # source openfoam 3.0.1 (for version 3.0.1)
After this, you can start run various OpenFOAM solvers and commands. For example, blockMesh, icoFoam, simpleFoam, etc.
To run OpenFOAM solver in batch mode to execute your computational intensive analysis, you can submit the simulation to PBS batch queue “parallel” or “short” (limited to 24 hours running time). For example, to run “icoFoam” of version 3.0.1 in parallel with 12 cores and process case cavity, you can prepare the job submission script “script_cavity.txt” with following content,
#!/bin/bash #PBS -q parallel12 #PBS -l select=1:ncpus=12:mpiprocs=12:mem=10GB #PBS -j oe #PBS -N myjob_ofm cd $PBS_O_WORKDIR np=#(cat ${PBS_NODEFILE}|wc -l ); ## Exec OF Solver source openfoam 3.0.1 mpirun -hostfile ${PBS_NODEFILE} icoFoam –parallel -case ./cavity
and then submit the job from the OpenFOAM case directory holding “cavity” as:
# qsub script_cavity.txt
Use the above job submission script as a template and change the version number, solver name, CPU number and case name etc to suit your need.
For more details about batch job submission, monitor and termination, please check How to Run Batch Jobs.