Chapter 3 Applications and libraries

The examples in Chapter 2 show that OpenFOAM provides a range of software ‘tools’ that are run from a terminal command line. The tools include applications which are executable programs written in C++, the base programming language of OpenFOAM. Applications obtain most of the functionality from OpenFOAM’s vast store of pre-compiled libraries, also written in C++. Since OpenFOAM is open source software, users have the freedom to create their own applications and libraries. Applications are generally split into two categories:

  • solvers, e.g. foamRun, that perform CFD calculations involving fluid dynamics, energy, etc.;

  • utilities, e.g. blockMesh and foamPostProcess, that perform other tasks in CFD like meshing and post-processing.

Prior to version 11 of OpenFOAM, there were many solvers, since separate ones were written for various different types of flow, e.g. simpleFoam, pimpleFoam, etc. However, most flow solvers are now written as modules, e.g. incompressibleFluid, incompressibleVoF and e.g.solid which are loaded by the general foamRun (or foamMultiRun) solvers. Rather than existing as an application, each solver module is compiled into a library of its own.

In addition to applications, the tools in OpenFOAM also include shell scripts, e.g. paraFoam, foamInfo and foamGet. Many of the scripts help with the configuration of cases.

This chapter gives an overview of applications and libraries, including their creation, modification, compilation and execution.

 3.1 The programming language of OpenFOAM
 3.2 Compiling applications and libraries
  3.2.1 Header .H files
  3.2.2 Compiling with wmake
  3.2.3 Including headers
  3.2.4 Linking to libraries
  3.2.5 Source files to be compiled
  3.2.6 Running wmake
  3.2.7 wmake environment variables
  3.2.8 Removing dependency lists: wclean
  3.2.9 Compiling libraries
  3.2.10 Compilation example: the foamRun application
  3.2.11 Debug messaging and optimisation switches
  3.2.12 Dynamic linking at run-time
 3.3 Running applications
 3.4 Running applications in parallel
  3.4.1 Decomposition of mesh and initial field data
  3.4.2 File input/output in parallel
  3.4.3 Running a decomposed case
  3.4.4 Distributing data across several disks
  3.4.5 Post-processing parallel processed cases
 3.5 Solver modules
  3.5.1 Single-phase modules
  3.5.2 Multiphase/VoF flow modules
  3.5.3 Solid modules
  3.5.4 Film modules
  3.5.5 Utility modules
  3.5.6 Base classes for solver modules
 3.6 Standard solvers
  3.6.1 Main solver applications
  3.6.2 Legacy solver applications
 3.7 Standard utilities
  3.7.1 Pre-processing
  3.7.2 Mesh generation
  3.7.3 Mesh conversion
  3.7.4 Mesh manipulation
  3.7.5 Other mesh tools
  3.7.6 Post-processing
  3.7.7 Post-processing data converters
  3.7.8 Surface mesh (e.g. OBJ/STL) tools
  3.7.9 Parallel processing
  3.7.10 Thermophysical-related utilities
  3.7.11 Miscellaneous utilities
OpenFOAM v12 User Guide - Chapter 3 Applications and libraries