Overview¶
This chapter gives an overview of solvers, utilities and libraries, their creation, modification, compilation and execution.
Running Applications¶
As a reminder, OpenFOAM is a C++ library used primarily to create executables, applications. OpenFOAM is distributed with a set of precompiled applications, but we also have the freedom to create our own or modify existing ones.
Applications are split into two main categories;
Are each designed to solve a specific problem in computational continuum mechanics.
Perform simple pre- and post-processing tasks, mainly data manipulation and algebraic calculations.
Command Line Options¶
Each application is designed to be executed from a terminal command line, typically reading and writing a set of data files realted to a particular case.
The data files for a case are stored in a directory named after a case, see FOAMCases.
For ease or writing, the directory name with the full PATH will be given the generic name <caseDir>.
For any application, the form of the command line entry can be found by entering the application name followed by the -help option;
This returns the usage;
Usage: blockMesh [OPTIONS]
options:
-blockTopology write block edges and centres as .obj files
-case <dir> specify alternate case directory, default is the cwd
-dict <file> specify alternative dictionary for the blockMesh description
-fileHandler <handler>
override the file handler type
-noClean keep the existing files in the polyMesh
-noFunctionObjects
do not execute function objects
-region <name> specify alternative mesh region
-sets write cellZones as cellSets too (for processing purposes)
-doc display application documentation in browser
-doc-source display source code in browser
-help print usage information and exit
-help-full print full usage information and exit
Block description
For a given block, the correspondence between the ordering of
vertex labels and face labels is shown below.
For vertex numbering in the sequence 0 to 7 (block, centre):
faces 0 (f0) and 1 are left and right, respectively;
faces 2 and 3 are bottom and top;
and faces 4 and 5 are front the back:
7 ---- 6
f5 |\ |\ f3
| | 4 ---- 5 \
| 3 |--- 2 | \
| \| \| f2
f4 0 ---- 1
Z f0 ----- f1
| Y
| /
O --- X
Using: OpenFOAM-vXXXX (see www.OpenFOAM.com)
Build: vXXXX
Arch: "LSB;label=32;scalar=64"
Certain terminal codeblocks will not render correctly, it is advised to run these yourself. Eg. The mess of lines under block description is meant to be a cube. Alternatively, check the GitHub
The arguments in square brackets, [], are optional flags. If the application is executed from within a case directory, it will operate on that case.
The -case <caseDir> option allows the case to be specified directly so that applications can be executed from anywhere on the file system.
The -help-full option offers additional application options. Eg. the simpleFoam solver offers the following extra options;
-listFunctionObjects
List functionObjects
-listFvOptions List fvOptions
-listRegisteredSwitches
List switches registered for run-time modification
-listScalarBCs List scalar field boundary conditions (fvPatchField<scalar>)
-listSwitches List switches declared in libraries but not set in
etc/controlDict
-listTurbulenceModels
List turbulenceModels
-listUnsetSwitches
List switches declared in libraries but not set in
etc/controlDict
-listVectorBCs List vector field boundary conditions (fvPatchField<vector>)
Command-line Completion¶
The set of command line options can be obtained by command-line completion, pressing the <TAB> key after typing an application name will promt the list of options;
This is available for all solvers and utilities.
Running in the Background¶
Like any executable, applications can be run as background processes.
A background process is one which does not have to be completed before the user can give the shell additional commands.
If we wanted to run blockMesh as a background process and output the case progress to a log file;
Running Applications in Parallel¶
The method of parallel computing used by OpenFOAM is known as domain decomposition, in which the geometry and associated fields are broken into pieces and allocated to separate processors for solutions. The process of parallel computation involves: decomposition of mesh and fields; running the application in parallel; and, post-processing the decomposed case.
The parallel running uses the public domain openMPI implementation of the standard message passing interface (MPI).
Decomposition of Mesh and Initial Field Data¶
The mesh and fields are decomposed using the decomposePar utility. The underlying aim is to break up the domain with minimal effort but in such a way to guarantee a fairly economic solution. The geometry and fields are broken up according to a set of parameters specified in a dictionary named decomposeParDict that must be located in the system directory of the case of interest.
An example decomposeParDict dictionary can be copied from the interFoam/damBreak/damBreak tutorial if needed; the dictionary entries within it are below:
There is a choice of four methods of decomposition, specified by the method keyword;
Simple geometric decomposition in which the domain is split into pieces by direction, eg. 2 pieces in the \(x\) direction, 1 in \(y\) etc.
Hierarchical geometric decomposition which is the same as simple except we can specify the order in which the directional split is done, eg. first in the \(y\)-direction, then the \(x\)-direction etc.
Scotch decomposition which requires no geometric input and attempts to minimise the number of processor boundaries. We can specify a weighting for the decomposition between processors, through an optional processorWeights keyword which can be useful on machines with differing performance between processors. There is also an optional keyword entry strategy that controls the decomposition strategy through a complex string supplied to Scotch. For more information, see the source code file: $FOAM_SRC/parallel/decompose/scotchDecomp/scotchDecomp.C