OpenFOAMUserGuide A4
OpenFOAMUserGuide A4
User Guide
version 10
https://openfoam.org
U-2
Typeset in LATEX.
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CRE-
ATIVE COMMONS PUBLIC LICENSE (“CCPL” OR “LICENSE”). THE WORK IS PRO-
TECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE
WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW
IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND
AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS
LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU
THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF
SUCH TERMS AND CONDITIONS.
1. Definitions
a. “Adaptation” means a work based upon the Work, or upon the Work and other pre-
existing works, such as a translation, adaptation, derivative work, arrangement of music
or other alterations of a literary or artistic work, or phonogram or performance and
includes cinematographic adaptations or any other form in which the Work may be recast,
transformed, or adapted including in any form recognizably derived from the original,
except that a work that constitutes a Collection will not be considered an Adaptation for
the purpose of this License. For the avoidance of doubt, where the Work is a musical
work, performance or phonogram, the synchronization of the Work in timed-relation with
a moving image (“synching”) will be considered an Adaptation for the purpose of this
License.
c. “Distribute” means to make available to the public the original and copies of the Work
through sale or other transfer of ownership.
d. “Licensor” means the individual, individuals, entity or entities that offer(s) the Work
under the terms of this License.
e. “Original Author” means, in the case of a literary or artistic work, the individual, individ-
uals, entity or entities who created the Work or if no individual or entity can be identified,
OpenFOAM-10
U-3
the publisher; and in addition (i) in the case of a performance the actors, singers, mu-
sicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or
otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of
a phonogram the producer being the person or legal entity who first fixes the sounds of
a performance or other sounds; and, (iii) in the case of broadcasts, the organization that
transmits the broadcast.
f. “Work” means the literary and/or artistic work offered under the terms of this License
including without limitation any production in the literary, scientific and artistic domain,
whatever may be the mode or form of its expression including digital form, such as a
book, pamphlet and other writing; a lecture, address, sermon or other work of the same
nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in
dumb show; a musical composition with or without words; a cinematographic work to
which are assimilated works expressed by a process analogous to cinematography; a work
of drawing, painting, architecture, sculpture, engraving or lithography; a photographic
work to which are assimilated works expressed by a process analogous to photography; a
work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to
geography, topography, architecture or science; a performance; a broadcast; a phonogram;
a compilation of data to the extent it is protected as a copyrightable work; or a work
performed by a variety or circus performer to the extent it is not otherwise considered a
literary or artistic work.
g. “You” means an individual or entity exercising rights under this License who has not
previously violated the terms of this License with respect to the Work, or who has re-
ceived express permission from the Licensor to exercise rights under this License despite
a previous violation.
h. “Publicly Perform” means to perform public recitations of the Work and to communicate
to the public those public recitations, by any means or process, including by wire or
wireless means or public digital performances; to make available to the public Works in
such a way that members of the public may access these Works from a place and at a place
individually chosen by them; to perform the Work to the public by any means or process
and the communication to the public of the performances of the Work, including by public
digital performance; to broadcast and rebroadcast the Work by any means including signs,
sounds or images.
i. “Reproduce” means to make copies of the Work by any means including without limitation
by sound or visual recordings and the right of fixation and reproducing fixations of the
Work, including storage of a protected performance or phonogram in digital form or other
electronic medium.
3. License Grant.
Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide,
royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to
exercise the rights in the Work as stated below:
a. to Reproduce the Work, to incorporate the Work into one or more Collections, and to
Reproduce the Work as incorporated in the Collections;
OpenFOAM-10
U-4
b. and, to Distribute and Publicly Perform the Work including as incorporated in Collections.
The above rights may be exercised in all media and formats whether now known or hereafter
devised. The above rights include the right to make such modifications as are technically neces-
sary to exercise the rights in other media and formats, but otherwise you have no rights to make
Adaptations. Subject to 8(f), all rights not expressly granted by Licensor are hereby reserved,
including but not limited to the rights set forth in Section 4(d).
4. Restrictions.
The license granted in Section 3 above is expressly made subject to and limited by the following
restrictions:
a. You may Distribute or Publicly Perform the Work only under the terms of this License.
You must include a copy of, or the Uniform Resource Identifier (URI) for, this License
with every copy of the Work You Distribute or Publicly Perform. You may not offer or
impose any terms on the Work that restrict the terms of this License or the ability of the
recipient of the Work to exercise the rights granted to that recipient under the terms of
the License. You may not sublicense the Work. You must keep intact all notices that
refer to this License and to the disclaimer of warranties with every copy of the Work
You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work,
You may not impose any effective technological measures on the Work that restrict the
ability of a recipient of the Work from You to exercise the rights granted to that recipient
under the terms of the License. This Section 4(a) applies to the Work as incorporated
in a Collection, but this does not require the Collection apart from the Work itself to be
made subject to the terms of this License. If You create a Collection, upon notice from
any Licensor You must, to the extent practicable, remove from the Collection any credit
as required by Section 4(c), as requested.
b. You may not exercise any of the rights granted to You in Section 3 above in any manner
that is primarily intended for or directed toward commercial advantage or private mon-
etary compensation. The exchange of the Work for other copyrighted works by means
of digital file-sharing or otherwise shall not be considered to be intended for or directed
toward commercial advantage or private monetary compensation, provided there is no
payment of any monetary compensation in connection with the exchange of copyrighted
works.
c. If You Distribute, or Publicly Perform the Work or Collections, You must, unless a request
has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and
provide, reasonable to the medium or means You are utilizing: (i) the name of the Original
Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or
Licensor designate another party or parties (e.g., a sponsor institute, publishing entity,
journal) for attribution (“Attribution Parties”) in Licensor’s copyright notice, terms of
service or by other reasonable means, the name of such party or parties; (ii) the title
of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that
Licensor specifies to be associated with the Work, unless such URI does not refer to the
copyright notice or licensing information for the Work. The credit required by this Section
4(c) may be implemented in any reasonable manner; provided, however, that in the case
of a Collection, at a minimum such credit will appear, if a credit for all contributing
authors of Collection appears, then as part of these credits and in a manner at least as
prominent as the credits for the other contributing authors. For the avoidance of doubt,
You may only use the credit required by this Section for the purpose of attribution in
the manner set out above and, by exercising Your rights under this License, You may not
implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by
OpenFOAM-10
U-5
the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your
use of the Work, without the separate, express prior written permission of the Original
Author, Licensor and/or Attribution Parties.
6. Limitation on Liability.
EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL
LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCI-
DENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT
OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN AD-
VISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
a. This License and the rights granted hereunder will terminate automatically upon any
breach by You of the terms of this License. Individuals or entities who have received
Collections from You under this License, however, will not have their licenses terminated
OpenFOAM-10
U-6
provided such individuals or entities remain in full compliance with those licenses. Sections
1, 2, 5, 6, 7, and 8 will survive any termination of this License.
b. Subject to the above terms and conditions, the license granted here is perpetual (for the
duration of the applicable copyright in the Work). Notwithstanding the above, Licensor
reserves the right to release the Work under different license terms or to stop distributing
the Work at any time; provided, however that any such election will not serve to withdraw
this License (or any other license that has been, or is required to be, granted under
the terms of this License), and this License will continue in full force and effect unless
terminated as stated above.
8. Miscellaneous
a. Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor
offers to the recipient a license to the Work on the same terms and conditions as the
license granted to You under this License.
b. If any provision of this License is invalid or unenforceable under applicable law, it shall
not affect the validity or enforceability of the remainder of the terms of this License, and
without further action by the parties to this agreement, such provision shall be reformed
to the minimum extent necessary to make such provision valid and enforceable.
c. No term or provision of this License shall be deemed waived and no breach consented to
unless such waiver or consent shall be in writing and signed by the party to be charged
with such waiver or consent.
d. This License constitutes the entire agreement between the parties with respect to the
Work licensed here. There are no understandings, agreements or representations with
respect to the Work not specified here. Licensor shall not be bound by any additional
provisions that may appear in any communication from You.
e. This License may not be modified without the mutual written agreement of the Licensor
and You. The rights granted under, and the subject matter referenced, in this License were
drafted utilizing the terminology of the Berne Convention for the Protection of Literary
and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961,
the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of
1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights
and subject matter take effect in the relevant jurisdiction in which the License terms are
sought to be enforced according to the corresponding provisions of the implementation
of those treaty provisions in the applicable national law. If the standard suite of rights
granted under applicable copyright law includes additional rights not granted under this
License, such additional rights are deemed to be included in the License; this License is
not intended to restrict the license of any rights under applicable law.
OpenFOAM-10
U-7
Trademarks
OpenFOAM-10
U-8
OpenFOAM-10
Contents
Trademarks U-7
Contents U-9
1 Introduction U-17
2 Tutorials U-19
2.1 Lid-driven cavity flow . . . . . . . . . . . . . . . . . . . . . . . . . . . U-19
2.1.1 Pre-processing . . . . . . . . . . . . . . . . . . . . . . . . . . . U-20
2.1.1.1 Mesh generation . . . . . . . . . . . . . . . . . . . . U-20
2.1.1.2 Boundary and initial conditions . . . . . . . . . . . . U-22
2.1.1.3 Physical properties . . . . . . . . . . . . . . . . . . . U-23
2.1.1.4 Control . . . . . . . . . . . . . . . . . . . . . . . . . U-24
2.1.1.5 Discretisation and linear-solver settings . . . . . . . . U-25
2.1.2 Viewing the mesh . . . . . . . . . . . . . . . . . . . . . . . . . U-25
2.1.3 Running an application . . . . . . . . . . . . . . . . . . . . . . U-26
2.1.4 Post-processing . . . . . . . . . . . . . . . . . . . . . . . . . . U-29
2.1.4.1 Colouring surfaces . . . . . . . . . . . . . . . . . . . U-29
2.1.4.2 Cutting plane (slice) . . . . . . . . . . . . . . . . . . U-30
2.1.4.3 Contours . . . . . . . . . . . . . . . . . . . . . . . . U-31
2.1.4.4 Vector plots . . . . . . . . . . . . . . . . . . . . . . . U-31
2.1.4.5 Streamline plots . . . . . . . . . . . . . . . . . . . . U-31
2.1.5 Increasing the mesh resolution . . . . . . . . . . . . . . . . . . U-34
2.1.5.1 Creating a new case using an existing case . . . . . . U-34
2.1.5.2 Creating the finer mesh . . . . . . . . . . . . . . . . U-34
2.1.5.3 Mapping the coarse mesh results onto the fine mesh . U-35
2.1.5.4 Control adjustments . . . . . . . . . . . . . . . . . . U-35
2.1.5.5 Running the code as a background process . . . . . . U-36
2.1.5.6 Vector plot with the refined mesh . . . . . . . . . . . U-36
2.1.5.7 Plotting graphs . . . . . . . . . . . . . . . . . . . . . U-36
2.1.6 Introducing mesh grading . . . . . . . . . . . . . . . . . . . . U-38
2.1.6.1 Creating the graded mesh . . . . . . . . . . . . . . . U-39
2.1.6.2 Changing time and time step . . . . . . . . . . . . . U-41
2.1.6.3 Mapping fields . . . . . . . . . . . . . . . . . . . . . U-41
2.1.7 Increasing the Reynolds number . . . . . . . . . . . . . . . . . U-41
2.1.7.1 Pre-processing . . . . . . . . . . . . . . . . . . . . . U-42
2.1.7.2 Running the code . . . . . . . . . . . . . . . . . . . . U-42
2.1.8 High Reynolds number flow . . . . . . . . . . . . . . . . . . . U-43
U-10 Contents
OpenFOAM-10
Contents U-11
OpenFOAM-10
U-12 Contents
OpenFOAM-10
Contents U-13
OpenFOAM-10
U-14 Contents
6 Post-processing U-177
6.1 ParaView/paraFoam graphical user interface (GUI) . . . . . . . . . . . U-177
6.1.1 Overview of ParaView/paraFoam . . . . . . . . . . . . . . . . . U-177
6.1.2 The Parameters panel . . . . . . . . . . . . . . . . . . . . . . . U-179
6.1.3 The Display panel . . . . . . . . . . . . . . . . . . . . . . . . . U-179
6.1.4 The button toolbars . . . . . . . . . . . . . . . . . . . . . . . U-181
6.1.5 Manipulating the view . . . . . . . . . . . . . . . . . . . . . . U-181
6.1.5.1 View settings . . . . . . . . . . . . . . . . . . . . . . U-181
6.1.5.2 General settings . . . . . . . . . . . . . . . . . . . . U-182
6.1.6 Contour plots . . . . . . . . . . . . . . . . . . . . . . . . . . . U-182
6.1.6.1 Introducing a cutting plane . . . . . . . . . . . . . . U-182
6.1.7 Vector plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . U-182
6.1.7.1 Plotting at cell centres . . . . . . . . . . . . . . . . . U-182
6.1.8 Streamlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . U-183
6.1.9 Image output . . . . . . . . . . . . . . . . . . . . . . . . . . . U-183
6.1.10 Animation output . . . . . . . . . . . . . . . . . . . . . . . . . U-183
6.2 Post-processing command line interface (CLI) . . . . . . . . . . . . . U-184
6.2.1 Post-processing functionality . . . . . . . . . . . . . . . . . . . U-184
6.2.1.1 Field calculation . . . . . . . . . . . . . . . . . . . . U-184
6.2.1.2 Field operations . . . . . . . . . . . . . . . . . . . . U-186
6.2.1.3 Forces and force coefficients . . . . . . . . . . . . . . U-186
6.2.1.4 Sampling for graph plotting . . . . . . . . . . . . . . U-186
6.2.1.5 Lagrangian data . . . . . . . . . . . . . . . . . . . . U-187
6.2.1.6 Monitoring minima and maxima . . . . . . . . . . . U-187
6.2.1.7 Numerical data . . . . . . . . . . . . . . . . . . . . . U-187
6.2.1.8 Control . . . . . . . . . . . . . . . . . . . . . . . . . U-187
6.2.1.9 Pressure tools . . . . . . . . . . . . . . . . . . . . . . U-187
6.2.1.10 Combustion . . . . . . . . . . . . . . . . . . . . . . . U-188
6.2.1.11 Multiphase . . . . . . . . . . . . . . . . . . . . . . . U-188
6.2.1.12 Probes . . . . . . . . . . . . . . . . . . . . . . . . . . U-188
6.2.1.13 Surface region . . . . . . . . . . . . . . . . . . . . . . U-188
6.2.1.14 ‘Pluggable’ solvers . . . . . . . . . . . . . . . . . . . U-189
6.2.1.15 Visualisation tools . . . . . . . . . . . . . . . . . . . U-189
6.2.2 Run-time data processing . . . . . . . . . . . . . . . . . . . . U-189
6.2.3 The postProcess utility . . . . . . . . . . . . . . . . . . . . . . U-190
6.2.4 Solver post-processing . . . . . . . . . . . . . . . . . . . . . . U-192
6.3 Sampling and monitoring data . . . . . . . . . . . . . . . . . . . . . . U-192
6.3.1 Probing data . . . . . . . . . . . . . . . . . . . . . . . . . . . U-192
6.3.2 Sampling for graphs . . . . . . . . . . . . . . . . . . . . . . . U-193
6.3.3 Sampling for visualisation . . . . . . . . . . . . . . . . . . . . U-195
6.3.4 Live monitoring of data . . . . . . . . . . . . . . . . . . . . . U-196
6.4 Third-Party post-processing . . . . . . . . . . . . . . . . . . . . . . . U-197
6.4.1 Post-processing with Ensight . . . . . . . . . . . . . . . . . . . U-198
6.4.1.1 Converting data to Ensight format . . . . . . . . . . U-198
6.4.1.2 The ensightFoamReader reader module . . . . . . . . U-198
OpenFOAM-10
Contents U-15
Index U-219
OpenFOAM-10
U-16 Contents
OpenFOAM-10
Chapter 1
Introduction
This guide accompanies the release of version 10 of the Open Source Field Operation
and Manipulation (OpenFOAM) C++ libraries. It provides a description of the basic
operation of OpenFOAM, first through a set of tutorial exercises in chapter 2 and later
by a more detailed description of the individual components that make up OpenFOAM.
OpenFOAM is a framework for developing application executables that use pack-
aged functionality contained within a collection of over 100 C++ libraries. OpenFOAM
is shipped with approximately 200 pre-built applications that fall into two categories:
solvers, that are each designed to solve a specific problem in fluid (or continuum) me-
chanics; and utilities, that are designed to perform tasks that involve data manipulation.
The solvers in OpenFOAM cover a wide range of problems in fluid dynamics, as described
in chapter 3.
Users can extend the collection of solvers, utilities and libraries in OpenFOAM, us-
ing some pre-requisite knowledge of the underlying method, physics and programming
techniques involved.
OpenFOAM is supplied with pre- and post-processing environments. The interface
to the pre- and post-processing are themselves OpenFOAM utilities, thereby ensuring
consistent data handling across all environments. The overall structure of OpenFOAM is
shown in Figure 1.1. The pre-processing and running of OpenFOAM cases is described
in chapter 4. In chapter 5, we cover both the generation of meshes using the mesh
generator supplied with OpenFOAM and conversion of mesh data generated by third-
party products. Post-processing is described in chapter 6 and some aspects of physical
modelling, e.g. transport and thermophysical modelling, are described in in chapter 7.
U-18 Introduction
OpenFOAM-10
Chapter 2
Tutorials
In this chapter we shall describe in detail the process of setup, simulation and post-
processing for some OpenFOAM test cases, with the principal aim of introducing a user
to the basic procedures of running OpenFOAM. The $FOAM_TUTORIALS directory con-
tains many more cases that demonstrate the use of all the solvers and many utilities
supplied with OpenFOAM.
Before attempting to run the tutorials, the user must first make sure that OpenFOAM
is installed correctly. Cases in the tutorials will be copied into the so-called run direc-
tory, an OpenFOAM project directory in the user’s file system at $HOME/OpenFOAM/-
<USER>-10/run where <USER> is the account login name and “10” is the OpenFOAM
version number. The run directory is represented by the $FOAM_RUN environment vari-
able enabling the user to check its existence conveniently by typing
ls $FOAM_RUN
If a message is returned saying no such directory exists, the user should create the directory
by typing
mkdir -p $FOAM_RUN
The tutorial cases describe the use of the meshing and pre-processing utilities, case
setup and running OpenFOAM solvers and post-processing using ParaView.
Copies of all tutorials are available from the tutorials directory of the OpenFOAM
installation. The tutorials are organised into a set of directories according to the type
of flow and then subdirectories according to solver. For example, all the simpleFoam
cases are stored within a subdirectory incompressible/simpleFoam, where incompressible
indicates the type of flow. The user can copy cases from the tutorials directory into their
local run directory as needed. For example to run the pitzDaily tutorial case for the
simpleFoam solver, the user can copy it to the run directory by typing:
cd $FOAM_RUN
cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
shown in Figure 2.1 in which all the boundaries of the square are walls. The top wall
moves in the x-direction at a speed of 1 m/s while the other 3 are stationary. Initially,
the flow will be assumed laminar and will be solved on a uniform mesh using the icoFoam
solver for laminar, isothermal, incompressible flow. During the course of the tutorial, the
effect of increased mesh resolution and mesh grading towards the walls will be investigated.
Finally, the flow Reynolds number will be increased and the pisoFoam solver will be used
for turbulent, isothermal, incompressible flow.
Ux = 1 m/s
d = 0.1 m
2.1.1 Pre-processing
Cases are setup in OpenFOAM by editing case files. Users should select an editor of
choice with which to do this, such as emacs, vi, gedit, nedit, etc. Editing files is possible
in OpenFOAM because the I/O uses a dictionary format with keywords that convey
sufficient meaning to be understood by the users.
A case being simulated involves data for mesh, fields, properties, control parameters,
etc. As described in section 4.1, in OpenFOAM this data is stored in a set of files within
a case directory rather than in a single case file, as in many other CFD packages. The
case directory is given a suitably descriptive name. This tutorial consists of a set of
cases located in $FOAM_TUTORIALS/incompressible/icoFoam/cavity, the first of which is
simply named cavity. As a first step, the user should copy the cavity case directory to
their run directory.
cd $FOAM_RUN
cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity .
cd cavity
OpenFOAM-10
2.1 Lid-driven cavity flow U-21
The cavity domain consists of a square of side length d = 0.1 m in the x-y plane. A
uniform mesh of 20 by 20 cells will be used initially. The block structure is shown in
Figure 2.2. The mesh generator supplied with OpenFOAM, blockMesh, generates meshes
3 2
7 6
y
x 1
0
z
4 5
Figure 2.2: Block structure of the mesh for the cavity.
OpenFOAM-10
U-22 Tutorials
47 type wall;
48 faces
49 (
50 (0 4 7 3)
51 (2 6 5 1)
52 (1 5 4 0)
53 );
54 }
55 frontAndBack
56 {
57 type empty;
58 faces
59 (
60 (0 3 2 1)
61 (4 5 6 7)
62 );
63 }
64 );
65
66
67 // ************************************************************************* //
The file first contains header information in the form of a banner (lines 1-7), then file
information contained in a FoamFile sub-dictionary, delimited by curly braces ({...}).
blockMesh
The running status of blockMesh is reported in the terminal window. Any mistakes in the
blockMeshDict file are picked up by blockMesh and the resulting error message directs the
user to the line in the file where the problem occurred.
OpenFOAM-10
2.1 Lid-driven cavity flow U-23
31
32 frontAndBack
33 {
34 type empty;
35 }
36 }
37
38 // ************************************************************************* //
There are 3 principal entries in field data files:
dimensions specifies the dimensions of the field, here kinematic pressure, i.e. m2 s−2 (see
section 4.2.6 for more information);
internalField the internal field data which can be uniform, described by a single value;
or nonuniform, where all the values of the field must be specified (see section 4.2.8
for more information);
boundaryField the boundary field data that includes boundary conditions and data for
all the boundary patches (see section 4.2.8 for more information).
For this case cavity, the boundary consists of walls only, split into 2 patches named: (1)
fixedWalls for the fixed sides and base of the cavity; (2) movingWall for the moving top
of the cavity. As walls, both are given a zeroGradient boundary condition for p, meaning
“the normal gradient of pressure is zero”. The frontAndBack patch represents the front
and back planes of the 2D case and therefore must be set as empty.
In this case, as in most we encounter, the initial fields are set to be uniform. Here the
pressure is kinematic, and as an incompressible case, its absolute value is not relevant, so
is set to uniform 0 for convenience.
The user can similarly examine the velocity field in the 0/U file. The dimensions are
those expected for velocity, the internal field is initialised as uniform zero, which in the
case of velocity must be expressed by 3 vector components, i.e. uniform (0 0 0) (see
section 4.2.5 for more information).
The boundary field for velocity requires the same boundary condition for the front-
AndBack patch. The other patches are walls: a no-slip condition is assumed on the
fixedWalls, hence a noSlip condition. The top surface moves at a speed of 1 m/s in the
x-direction so requires a fixedValue condition with value of uniform (1 0 0).
OpenFOAM-10
U-24 Tutorials
2.1.1.4 Control
Input data relating to the control of time and reading and writing of the solution data are
read in from the controlDict dictionary. The user should view this file; as a case control
file, it is located in the system directory.
The start/stop times and the time step for the run must be set. OpenFOAM offers
great flexibility with time control which is described in full in section 4.4. In this tutorial
we wish to start the run at time t = 0 which means that OpenFOAM needs to read field
data from a directory named 0 — see section 4.1 for more information of the case file
structure. Therefore we set the startFrom keyword to startTime and then specify the
startTime keyword to be 0.
For the end time, we wish to reach the steady state solution where the flow is circu-
lating around the cavity. As a general rule, the fluid should pass through the domain 10
times to reach steady state in laminar flow. In this case the flow does not pass through
this domain as there is no inlet or outlet, so instead the end time can be set to the time
taken for the lid to travel ten times across the cavity, i.e. 1 s; in fact, with hindsight, we
discover that 0.5 s is sufficient so we shall adopt this value. To specify this end time, we
must specify the stopAt keyword as endTime and then set the endTime keyword to 0.5.
Now we need to set the time step, represented by the keyword deltaT. To achieve
temporal accuracy and numerical stability when running icoFoam, a Courant number of
less than 1 is required. The Courant number is defined for one cell as:
δt|U|
Co = (2.2)
δx
where δt is the time step, |U| is the magnitude of the velocity through that cell and δx
is the cell size in the direction of the velocity. The flow velocity varies across the domain
and we must ensure Co < 1 everywhere. We therefore choose δt based on the worst case:
the maximum Co corresponding to the combined effect of a large flow velocity and small
cell size. Here, the cell size is fixed across the domain so the maximum Co will occur next
to the lid where the velocity approaches 1 m s−1 . The cell size is:
d 0.1
δx = = = 0.005 m (2.3)
n 20
Therefore to achieve a Courant number less than or equal to 1 throughout the domain
the time step deltaT must be set to less than or equal to:
Co δx 1 × 0.005
δt = = = 0.005 s (2.4)
|U| 1
As the simulation progresses we wish to write results at certain intervals of time that
we can later view with a post-processing package. The writeControl keyword presents
several options for setting the time at which the results are written; here we select the
timeStep option which specifies that results are written every nth time step where the
value n is specified under the writeInterval keyword. Let us decide that we wish to
write our results at times 0.1, 0.2,. . . , 0.5 s. With a time step of 0.005 s, we therefore
need to output results at every 20th time time step and so we set writeInterval to 20.
OpenFOAM creates a new directory named after the current time, e.g. 0.1 s, on each
occasion that it writes a set of data, as discussed in full in section 4.1. In the icoFoam
solver, it writes out the results for each field, U and p, into the time directories. For this
case, the entries in the controlDict are shown below:
OpenFOAM-10
2.1 Lid-driven cavity flow U-25
16
17 application icoFoam;
18
19 startFrom startTime;
20
21 startTime 0;
22
23 stopAt endTime;
24
25 endTime 0.5;
26
27 deltaT 0.005;
28
29 writeControl timeStep;
30
31 writeInterval 20;
32
33 purgeWrite 0;
34
35 writeFormat ascii;
36
37 writePrecision 6;
38
39 writeCompression off;
40
41 timeFormat general;
42
43 timePrecision 6;
44
45 runTimeModifiable true;
46
47
48 // ************************************************************************* //
paraFoam &
OpenFOAM-10
U-26 Tutorials
This launches the ParaView window as shown in Figure 6.1. In the Pipeline Browser,
the user can see that ParaView has opened cavity.OpenFOAM, the module for the cavity
case. Before clicking the Apply button, the user needs to select some geometry from the
Mesh Parts panel. Because the case is small, it is easiest to select all the data by checking
the box adjacent to the Mesh Parts panel title, which automatically checks all individual
components within the respective panel. The user should then click the Apply button to
load the geometry into ParaView.
The user should then scroll down to the Display panel that controls the visual represen-
tation of the selected module. Within the Display panel the user should do the following
as shown in Figure 2.3:
2. click Edit (in Coloring) and select an appropriate colour e.g. black (for a white
background);
3. select Wireframe from the Representation menu. The background colour can be
set in the View (Render View) panel at the bottom of the Properties window.
Especially the first time the user starts ParaView, it is recommended that they manip-
ulate the view as described in section 6.1.5. In particular, since this is a 2D case, it is
recommended that Camera Parallel Projection is selected at the bottom of the View (Render
View) panel.
Furthermore, many parameters in the Properties window are only available by clicking
the Advanced Properties gearwheel button at the top of the Properties window, next to
the search box.
icoFoam
at the command prompt, or with the optional -case argument giving the case directory,
e.g.
The progress of the job is written to the terminal window. It tells the user the current
time, maximum Courant number, initial and final residuals for all fields.
OpenFOAM-10
2.1 Lid-driven cavity flow U-27
OpenFOAM-10
U-28 Tutorials
OpenFOAM-10
2.1 Lid-driven cavity flow U-29
2.1.4 Post-processing
As soon as results are written to time directories, they can be viewed using paraFoam.
Return to the paraFoam window and select the Properties panel for the cavity.OpenFOAM
case module. If the correct window panels for the case module do not seem to be present
at any time, please ensure that: cavity.OpenFOAM is highlighted in blue; eye button
alongside it is switched on to show the graphics are enabled;
To prepare paraFoam to display the data of interest, we must first load the data at the
required run time of 0.5 s. If the case was run while ParaView was open, the output data
in time directories will not be automatically loaded within ParaView. To load the data
the user should uncheck Cache Mesh and click Refresh Times at the top Properties window
(scroll up the panel if necessary). When The time data will be loaded into ParaView.
In order to view the solution at t = 0.5 s, the user can use the VCR Controls or
Current Time Controls to change the current time to 0.5. These are located in the
toolbars at the top of the ParaView window, as shown in Figure 6.4.
2. select in Coloring
3. click the Rescale button to set the colour scale to the data range, if necessary.
The pressure field should appear as shown in Figure 2.5, with a region of low pressure at
the top left of the cavity and one of high pressure at the top right of the cavity.
With the point icon ( ) the pressure field is interpolated across each cell to give a
continuous appearance. Instead if the user selects the cell icon, , from the Coloring
menu, a single value for pressure will be attributed to each cell so that each cell will be
denoted by a single colour with no grading.
A colour legend can be added by either by clicking the Toggle Color Legend Visibility
button in the Active Variable Controls toolbar or the Show button in the Coloring
section of the Display panel. The legend can be located in the image window by drag
and drop with the mouse. The Edit button, either in the Active Variable Controls
toolbar or in the Coloring panel of the Display panel, opens the Color Map Editor window,
as shown in Figure 2.6, where the user can set a range of attributes of the colour scale
and the color bar.
In particular, ParaView defaults to using a colour scale of blue to white to red rather
than the more common blue to green to red (rainbow). Therefore the first time that the
user executes ParaView, they may wish to change the colour scale. This can be done by
selecting the Choose Preset button (with the heart icon) in the Color Scale Editor. The
conventional color scale for CFD is Blue to Red Rainbow which is only listed if the user
types the name in the Search bar or checks the gearwheel to the right of that bar.
After selecting Blue to Red Rainbow and clicking Apply and Close, the user can click
the Save as Default button at the absolute bottom of the panel (file save symbol) so that
ParaView will always adopt this type of colour bar.
OpenFOAM-10
U-30 Tutorials
Choose preset
Configure Color Bar
Save as Default
Figure 2.6: Color Map Editor.
The user can also edit the color legend properties, such as text size, font selection and
numbering format for the scale, by clicking the Edit Color Legend Properties to the far
right of the search bar, as shown in Figure 2.6.
OpenFOAM-10
2.1 Lid-driven cavity flow U-31
plane should be centred at (0.05, 0.05, 0.005) and its normal should be set to (0, 0, 1) (click
the Z Normal button).
2.1.4.3 Contours
Having generated the cutting plane, contours can be created using by applying the
Contour filter. With the Slice module highlighted in the Pipeline Browser, the user
should select the Contour filter. In the Properties panel, the user should select pressure
from the Contour By menu. Under Isosurfaces, the user could delete the default value
with the minus button, then add a range of 10 values. The contours can be displayed
with a Wireframe representation if the Coloring is solid or by a field, e.g. pressure.
OpenFOAM-10
U-32 Tutorials
OpenFOAM-10
2.1 Lid-driven cavity flow U-33
OpenFOAM-10
U-34 Tutorials
and then click Apply. The Properties window panel should appear as shown in Figure 2.9.
The Seed points should be specified along a High Resolution Line Source running
vertically through the centre of the geometry, i.e. from (0.05, 0, 0.005) to (0.05, 0.1, 0.005).
For the image in this guide we used: a point Resolution of 21; Maximum Step Length of
0.5; Initial Step Length of 0.2; and, Integration Direction BOTH. The Runge-Kutta 4/5
IntegratorType was used with default parameters.
On clicking Apply the tracer is generated. The user should then select Tube from the
Filter menu to produce high quality streamline images. For the image in this report, we
used: Num. sides 6; Radius 0.0003; and, Radius factor 10. The streamtubes are coloured
by velocity magnitude. On clicking Apply the image in Figure 2.10 should be produced.
cd $FOAM_RUN
Note that there is also a convenient alias, named run, that reproduces the command
above to change directory to $FOAM_RUN, simply by typing run.
The cavityFine case can be created by making a new case directory and copying the
relevant directories from the cavity case.
mkdir cavityFine
cp -r cavity/constant cavityFine
cp -r cavity/system cavityFine
The user can then prepare to run the new case by changing into the case directory.
cd cavityFine
OpenFOAM-10
2.1 Lid-driven cavity flow U-35
2.1.5.3 Mapping the coarse mesh results onto the fine mesh
The mapFields utility maps one or more fields relating to a given geometry onto the cor-
responding fields for another geometry. In our example, the fields are deemed ‘consistent’
because the geometry and the boundary types, or conditions, of both source and tar-
get fields are identical. We use the -consistent command line option when executing
mapFields in this example.
The field data that mapFields maps is read from the time directory specified by
startFrom and startTime in the controlDict of the target case, i.e. those into which
the results are being mapped. In this example, we wish to map the final results of the
coarser mesh from case cavity onto the finer mesh of case cavityFine. Therefore, since these
results are stored in the 0.5 directory of cavity, the startTime should be set to 0.5 s in
the controlDict dictionary and startFrom should be set to startTime.
The case is ready to run mapFields. Typing mapFields -help quickly shows that map-
Fields requires the source case directory as an argument. We are using the -consistent
option, so the utility is executed from within the cavityFine directory by
To maintain a Courant number of less that 1, as discussed in section 2.1.1.4, the time step
must now be halved since the size of all cells has halved. Therefore deltaT should be set
to 0.0025 s in the controlDict dictionary. Field data is currently written out at an interval
of a fixed number of time steps. Here we demonstrate how to specify data output at fixed
intervals of time. Under the writeControl keyword in controlDict, instead of requesting
output by a fixed number of time steps with the timeStep entry, a fixed amount of run
time can be specified between the writing of results using the runTime entry. In this
case the user should specify output every 0.1 and therefore should set writeInterval
to 0.1 and writeControl to runTime. Finally, since the case is starting with a solution
obtained on the coarse mesh we only need to run it for a short period to achieve reasonable
convergence to steady-state. Therefore the endTime should be set to 0.7 s. Make sure
these settings are correct and then save the file.
OpenFOAM-10
U-36 Tutorials
paraFoam -touch
Now the cavityFine case can be loaded into ParaView by selecting Open from the File
menu, and having navigated to the cavityFine directory, opening cavityFine.OpenFOAM.
The user can now make a vector plot of the results from the refined mesh in ParaView.
The plot can be compared with the cavity case by enabling glyph images for both case
simultaneously.
postProcess -list
The components and mag functions provide useful scalar measures of velocity. When the
components function is executed on a case, e.g. cavity, it reads in the velocity vector field
from each time directory and, in the corresponding time directories, writes scalar fields
Ux, Uy and Uz representing the x, y and z components of velocity.
The user can run postProcess with the components function on both cavity and cavi-
tyFine cases. For example, for the cavity case the user should go into the cavity directory
and execute postProcess as follows:
OpenFOAM-10
2.1 Lid-driven cavity flow U-37
cd $FOAM_RUN/cavity
postProcess -func "components(U)"
OpenFOAM-10
U-38 Tutorials
OpenFOAM-10
2.1 Lid-driven cavity flow U-39
15 16 17
2 3
3 4 5
12 13 14
0 1
y
x 1 2
0
z 11
9 10
Figure 2.13: Block structure of the graded mesh for the cavity (block numbers encircled).
A mesh of 20×20 cells with grading towards the walls will be created for the lid-driven
cavity problem and the results from the finer mesh of section 2.1.5.2 will then be mapped
onto the graded mesh to use as an initial condition. The results from the graded mesh will
be compared with those from the previous meshes. Since the changes to the blockMeshDict
dictionary are fairly substantial, the case used for this part of the tutorial, cavityGrade, is
supplied in the $FOAM_TUTORIALS/incompressible/icoFoam/cavity directory. The user
should copy the cavityGrade case into the run directory, then follow the steps below.
OpenFOAM-10
U-40 Tutorials
20 (0 0 0)
21 (0.5 0 0)
22 (1 0 0)
23 (0 0.5 0)
24 (0.5 0.5 0)
25 (1 0.5 0)
26 (0 1 0)
27 (0.5 1 0)
28 (1 1 0)
29 (0 0 0.1)
30 (0.5 0 0.1)
31 (1 0 0.1)
32 (0 0.5 0.1)
33 (0.5 0.5 0.1)
34 (1 0.5 0.1)
35 (0 1 0.1)
36 (0.5 1 0.1)
37 (1 1 0.1)
38 );
39
40 blocks
41 (
42 hex (0 1 4 3 9 10 13 12) (10 10 1) simpleGrading (2 2 1)
43 hex (1 2 5 4 10 11 14 13) (10 10 1) simpleGrading (0.5 2 1)
44 hex (3 4 7 6 12 13 16 15) (10 10 1) simpleGrading (2 0.5 1)
45 hex (4 5 8 7 13 14 17 16) (10 10 1) simpleGrading (0.5 0.5 1)
46 );
47
48 boundary
49 (
50 movingWall
51 {
52 type wall;
53 faces
54 (
55 (6 15 16 7)
56 (7 16 17 8)
57 );
58 }
59 fixedWalls
60 {
61 type wall;
62 faces
63 (
64 (3 12 15 6)
65 (0 9 12 3)
66 (0 1 10 9)
67 (1 2 11 10)
68 (2 5 14 11)
69 (5 8 17 14)
70 );
71 }
72 frontAndBack
73 {
74 type empty;
75 faces
76 (
77 (0 3 4 1)
78 (1 4 5 2)
79 (3 6 7 4)
80 (4 7 8 5)
81 (9 10 13 12)
82 (10 11 14 13)
83 (12 13 16 15)
84 (13 14 17 16)
85 );
86 }
87 );
88
89
90 // ************************************************************************* //
Once familiar with the blockMeshDict file for this case, the user can execute blockMesh
from the command line. The graded mesh can be viewed as before using paraFoam as
described in section 2.1.2.
OpenFOAM-10
2.1 Lid-driven cavity flow U-41
and
R for R > 1,
α= (2.7)
1 − r −n
+r −1
for R < 1.
For the cavityGrade case the number of cells in each direction in a block is 10, the ratio
between largest and smallest cells is 2 and the block height and width is 0.05 m. Therefore
the smallest cell length is 3.45 mm. From Equation 2.2, the time step should be less than
3.45 ms to maintain a Courant of less than 1. To ensure that results are written out
at convenient time intervals, the time step deltaT should be reduced to 2.5 ms and the
writeInterval set to 40 so that results are written out every 0.1 s. These settings can
be viewed in the cavityGrade/system/controlDict file.
The startTime needs to be set to that of the final conditions of the case cavityFine,
i.e. 0.7. Since cavity and cavityFine converged well within the prescribed run time, we
can set the run time for case cavityGrade to 0.1 s, i.e. the endTime should be 0.8.
Now run icoFoam from the case directory and monitor the run time information. View
the converged results for this case and compare with other results using post-processing
tools described previously in section 2.1.5.6 and section 2.1.5.7.
OpenFOAM-10
U-42 Tutorials
than copying individual directories (system, constant, etc.) as described previously, the
foamCloneCase can be used, which copies the relevant directories in one step. By default
the 0 time directory is copied, but here the user can use the -latestTime option to copy
the latest time directory, 0.5, which can be used as the initial field data for our simulation.
The example also uses the run alias as a quick way to change to the run directory.
run
foamCloneCase -latestTime cavity cavityHighRe
cd cavityHighRe
2.1.7.1 Pre-processing
Go into the cavityHighRe case and edit the physicalProperties dictionary in the constant
directory. Since the Reynolds number is required to be increased by a factor of 10, decrease
the kinematic viscosity by a factor of 10, i.e. to 1 × 10−3 m2 s−1 . We now run this case
by restarting from the solution at the end of the cavity case run. To do this we can use
the option of setting the startFrom keyword to latestTime so that icoFoam takes as its
initial data the values stored in the directory corresponding to the most recent time, i.e.
0.5. The endTime should be set to 2 s.
nohup enables a command to keep running after the user who issues the command has
logged out;
nice changes the priority of the job in the kernel’s scheduler; a “niceness” of -20 is the
highest priority and 19 is the lowest priority.
This is useful, for example, if a user wishes to set a case running on a remote machine
and does not wish to monitor it heavily, in which case they may wish to give it low
priority on the machine. In that case the nohup command allows the user to log out of a
remote machine he/she is running on and the job continues running, while nice can set
the priority to 19. For our case of interest, we can execute the command in this manner
as follows:
In previous runs you may have noticed that icoFoam stops solving for velocity U quite
quickly but continues solving for pressure p for a lot longer or until the end of the run.
In practice, once icoFoam stops solving for U and the initial residual of p is less than
the tolerance set in the fvSolution dictionary (typically 10−6 ), the run has effectively
converged and can be stopped once the field data has been written out to a time directory.
For example, at convergence a sample of the log file from the run on the cavityHighRe
case appears as follows in which the velocity has already converged after 1.395 s and
initial pressure residuals are small; No Iterations 0 indicates that the solution of U has
stopped:
OpenFOAM-10
2.1 Lid-driven cavity flow U-43
Time = 1.43
Courant Number mean: 0.221921 max: 0.839902
smoothSolver: Solving for Ux, Initial residual = 8.733e-06, Final residual = 8.733e-06, No Iterations 0
smoothSolver: Solving for Uy, Initial residual = 9.896e-06, Final residual = 9.896e-06, No Iterations 0
DICPCG: Solving for p, Initial residual = 3.675e-06, Final residual = 8.629e-07, No Iterations 4
time step continuity errors : sum local = 6.579e-09, global = -6.667e-19, cumulative = -6.2539e-18
DICPCG: Solving for p, Initial residual = 2.608e-06, Final residual = 7.925e-07, No Iterations 3
time step continuity errors : sum local = 6.261e-09, global = -1.029e-18, cumulative = -7.28374e-18
ExecutionTime = 0.37 s ClockTime = 0 s
Time = 1.435
Courant Number mean: 0.221923 max: 0.839903
smoothSolver: Solving for Ux, Initial residual = 8.539e-06, Final residual = 8.539e-06, No Iterations 0
smoothSolver: Solving for Uy, Initial residual = 9.714e-06, Final residual = 9.714e-06, No Iterations 0
DICPCG: Solving for p, Initial residual = 4.022e-06, Final residual = 9.896e-07, No Iterations 3
time step continuity errors : sum local = 8.151e-09, global = 5.336e-19, cumulative = -6.75012e-18
DICPCG: Solving for p, Initial residual = 2.388e-06, Final residual = 8.445e-07, No Iterations 3
time step continuity errors : sum local = 7.487e-09, global = -4.427e-19, cumulative = -7.19283e-18
ExecutionTime = 0.37 s ClockTime = 0 s
2.1.8.1 Pre-processing
Go back to the run directory and copy the cavity case in the $FOAM_RUN/tutorials/-
incompressible/pisoFoam/RAS directory (N.B: the pisoFoam/RAS directory), renaming
it cavityRAS to avoid a clash with the existing cavity tutorial. Go into the new case
directory.
run
cp -r $FOAM_TUTORIALS/incompressible/pisoFoam/RAS/cavity cavityRAS
cd cavityRAS
Generate the mesh by running blockMesh as before. Mesh grading towards the wall is not
necessary when using the standard k − ε model with wall functions since the flow in the
near wall cell is modelled, rather than having to be resolved.
A range of wall function models is available in OpenFOAM that are applied as bound-
ary conditions on individual patches. This enables different wall function models to be
applied to different wall regions. The choice of wall function models are specified through
the turbulent viscosity field, νt in the 0/nut file:
OpenFOAM-10
U-44 Tutorials
16
17 dimensions [0 2 -1 0 0 0 0];
18
19 internalField uniform 0;
20
21 boundaryField
22 {
23 movingWall
24 {
25 type nutkWallFunction;
26 value uniform 0;
27 }
28 fixedWalls
29 {
30 type nutkWallFunction;
31 value uniform 0;
32 }
33 frontAndBack
34 {
35 type empty;
36 }
37 }
38
39
40 // ************************************************************************* //
This case uses standard wall functions, specified by the nutWallFunction type on the
movingWall and fixedWalls patches. Other wall function models include the rough wall
functions, specified through the nutRoughWallFunction keyword.
The user should now open the field files for k and ε (0/k and 0/epsilon) and examine
their boundary conditions. For a wall boundary condition, ε is assigned a epsilonWall-
Function boundary condition and a kqRwallFunction boundary condition is assigned to k.
The latter is a generic boundary condition that can be applied to any field that are of a
turbulent kinetic energy type, e.g. k, q or Reynolds Stress R. The initial values for k and
ε are set using an estimated fluctuating component of velocity U′ and a turbulent length
scale, l. k and ε are defined in terms of these parameters as follows:
1
k = U′ • U′ (2.8)
2
Cµ0.75 k 1.5
ε= (2.9)
l
where Cµ is a constant of the k − ε model equal to 0.09. For a Cartesian coordinate
system, k is given by:
1
k = (Ux′ 2 + Uy′ 2 + Uz′ 2 ) (2.10)
2
where Ux′ 2 , Uy′ 2 and Uz′ 2 are the fluctuating components of velocity in the x, y and z
directions respectively. Let us assume the initial turbulence is isotropic, i.e. Ux′ 2 = Uy′ 2 =
Uz′ 2 , and equal to 5% of the lid velocity and that l, is equal to 5% of the box width, 0.1
m, then k and ε are given by:
5
Ux′ = Uy′ = Uz′ = 1 m s−1 (2.11)
100
( )
3 5 2 2 −2
⇒k= m s = 3.75 × 10−3 m2 s−2 (2.12)
2 100
Cµ0.75 k 1.5
ε= ≈ 7.54 × 10−3 m2 s−3 (2.13)
l
These form the initial conditions for k and ε. The initial conditions for U and p are
(0, 0, 0) and 0 respectively as before.
OpenFOAM-10
2.1 Lid-driven cavity flow U-45
The options for simulationType are laminar, RAS and LES. With RAS selected in this
case, the choice of RAS modelling is specified in a RAS subdictionary. The turbulence
model is selected by the model entry from a long list of available models that are listed
in Section 7.2.1.1. The kEpsilon model should be selected which is the standard k − ε
model; the user should also ensure that turbulence calculation is switched on.
The coefficients for each turbulence model are stored within the respective code with
a set of default values. Setting the optional switch called printCoeffs to on will make
the default values be printed to standard output, i.e. the terminal, when the model is
called at run time. The coefficients are printed out as a sub-dictionary whose name is
that of the model name with the word Coeffs appended, e.g. kEpsilonCoeffs in the case
of the kEpsilon model. The coefficients of the model, e.g. kEpsilon, can be modified
by optionally including (copying and pasting) that sub-dictionary within the RAS sub-
dictionary and adjusting values accordingly.
The user should next set the laminar kinematic viscosity in the physicalProperties
dictionary. To achieve a Reynolds number of 104 , a kinematic viscosity of 10−5 m is
required based on the Reynolds number definition given in Equation 2.1.
Finally the user should set the startTime, stopTime, deltaT and the writeInterval
in the controlDict. Set deltaT to 0.005 s to satisfy the Courant number restriction and
the endTime to 10 s.
OpenFOAM-10
U-46 Tutorials
state. In the latter case, convergence may never occur but this does not mean the results
are inaccurate.
run
cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavityClipped .
cd cavityClipped
The case consists of the standard cavity geometry but with a square of length 0.04 m
removed from the bottom right of the cavity, according to the blockMeshDict below:
16 convertToMeters 0.1;
17
18 vertices
19 (
20 (0 0 0)
21 (0.6 0 0)
22 (0 0.4 0)
23 (0.6 0.4 0)
24 (1 0.4 0)
25 (0 1 0)
26 (0.6 1 0)
27 (1 1 0)
28
29 (0 0 0.1)
30 (0.6 0 0.1)
31 (0 0.4 0.1)
32 (0.6 0.4 0.1)
33 (1 0.4 0.1)
34 (0 1 0.1)
35 (0.6 1 0.1)
36 (1 1 0.1)
37
38 );
39
40 blocks
41 (
42 hex (0 1 3 2 8 9 11 10) (12 8 1) simpleGrading (1 1 1)
43 hex (2 3 6 5 10 11 14 13) (12 12 1) simpleGrading (1 1 1)
44 hex (3 4 7 6 11 12 15 14) (8 12 1) simpleGrading (1 1 1)
45 );
46
47 boundary
48 (
49 lid
50 {
51 type wall;
52 faces
53 (
54 (5 13 14 6)
55 (6 14 15 7)
56 );
57 }
58 fixedWalls
59 {
60 type wall;
61 faces
62 (
63 (0 8 10 2)
64 (2 10 13 5)
65 (7 15 12 4)
66 (4 12 11 3)
OpenFOAM-10
2.1 Lid-driven cavity flow U-47
67 (3 11 9 1)
68 (1 9 8 0)
69 );
70 }
71 frontAndBack
72 {
73 type empty;
74 faces
75 (
76 (0 2 3 1)
77 (2 5 6 3)
78 (3 6 7 4)
79 (8 9 11 10)
80 (10 11 14 13)
81 (11 12 15 14)
82 );
83 }
84 );
85
86
87 // ************************************************************************* //
Generate the mesh with blockMesh. The patches are set accordingly as in previous cavity
cases. For the sake of clarity in describing the field mapping process, the upper wall patch
is renamed lid, previously the movingWall patch of the original cavity.
In an inconsistent mapping, there is no guarantee that all the field data can be mapped
from the source case. The remaining data must come from field files in the target case
itself. Therefore field data must exist in the time directory of the target case before
mapping takes place. In the cavityClipped case the mapping is set to occur at time 0.5 s,
since the startTime is set to 0.5 s in the controlDict. Therefore the user needs to copy
initial field data to that directory, e.g. from time 0:
cp -r 0 0.5
Before mapping the data, the user should view the geometry and fields at 0.5 s.
Now we wish to map the velocity and pressure fields from cavity onto the new fields
of cavityClipped. Since the mapping is inconsistent, we need to edit the mapFieldsDict
dictionary, located in the system directory. The dictionary contains 2 keyword entries:
patchMap and cuttingPatches. The patchMap list contains a mapping of patches from
the source fields to the target fields. It is used if the user wishes a patch in the target
field to inherit values from a corresponding patch in the source field. In cavityClipped, we
wish to inherit the boundary values on the lid patch from movingWall in cavity so we
must set the patchMap as:
patchMap
(
lid movingWall
);
The cuttingPatches list contains names of target patches whose values are to be
mapped from the source internal field through which the target patch cuts. In this case,
the fixedWalls patch is a noSlip condition so the internal values cannot be interpolated
to the patch. Therefore the cuttingPatches list can simply be empty:
cuttingPatches
(
);
OpenFOAM-10
U-48 Tutorials
If the user does wish to interpolate internal values from the source case to the fixedWalls
patch in the target case, a fixedValue boundary condition needs to be specified on the
patch, whose value can then be overridden during the mapping process; the fixedWalls
patch then needs to be included in the cuttingPatches list.
The user should run mapFields, from within the cavityClipped directory:
mapFields ../cavity
The user can view the mapped field as shown in Figure 2.14. The fixedWalls patch has
not inherited values from the source case as we expected. The user can then run the case
with icoFoam.
OpenFOAM-10
2.2 Stress analysis of a plate with a hole U-49
y
σ = 10 kPa σ = 10 kPa
symmetry plane x
R = 0.5 m
symmetry plane
4.0 m
Figure 2.16: Geometry of the plate with a hole.
The problem can be approximated as 2-dimensional since the load is applied in the
plane of the plate. In a Cartesian coordinate system there are two possible assumptions
to take in regard to the behaviour of the structure in the third dimension: (1) the plane
stress condition, in which the stress components acting out of the 2D plane are assumed
to be negligible; (2) the plane strain condition, in which the strain components out of
the 2D plane are assumed negligible. The plane stress condition is appropriate for solids
whose third dimension is thin as in this case; the plane strain condition is applicable for
solids where the third dimension is thick.
An analytical solution exists for loading of an infinitely large, thin plate with a circular
OpenFOAM-10
U-50 Tutorials
hole. The solution for the stress normal to the vertical plane of symmetry is
( )
R2 3R4
σ 1+ 2 + 4 for |y| ≥ R
(σxx )x=0 = 2y 2y (2.14)
0 for |y| < R
Results from the simulation will be compared with this solution. At the end of the
tutorial, the user can: investigate the sensitivity of the solution to mesh resolution and
mesh grading; and, increase the size of the plate in comparison to the hole to try to
estimate the error in comparing the analytical solution for an infinite plate to the solution
of this problem of a finite plate.
8 up 7 up 6
left
4 3 right
x2
9
x1 x2
left 0 4 x1 3
10 x2
x1 right
2
5 1
hole
y x2 x2
x 0 x1 1 x1 down 2
down
Figure 2.17: Block structure of the mesh for the plate with a hole.
The user should change to the run directory and copy the plateHole case into it from the
$FOAM_TUTORIALS/stressAnalysis/solidDisplacementFoam directory. The user should
OpenFOAM-10
2.2 Stress analysis of a plate with a hole U-51
then go into the plateHole directory and open the blockMeshDict file in an editor, as
listed below
16 convertToMeters 1;
17
18 vertices
19 (
20 (0.5 0 0)
21 (1 0 0)
22 (2 0 0)
23 (2 0.707107 0)
24 (0.707107 0.707107 0)
25 (0.353553 0.353553 0)
26 (2 2 0)
27 (0.707107 2 0)
28 (0 2 0)
29 (0 1 0)
30 (0 0.5 0)
31 (0.5 0 0.5)
32 (1 0 0.5)
33 (2 0 0.5)
34 (2 0.707107 0.5)
35 (0.707107 0.707107 0.5)
36 (0.353553 0.353553 0.5)
37 (2 2 0.5)
38 (0.707107 2 0.5)
39 (0 2 0.5)
40 (0 1 0.5)
41 (0 0.5 0.5)
42 );
43
44 blocks
45 (
46 hex (5 4 9 10 16 15 20 21) (10 10 1) simpleGrading (1 1 1)
47 hex (0 1 4 5 11 12 15 16) (10 10 1) simpleGrading (1 1 1)
48 hex (1 2 3 4 12 13 14 15) (20 10 1) simpleGrading (1 1 1)
49 hex (4 3 6 7 15 14 17 18) (20 20 1) simpleGrading (1 1 1)
50 hex (9 4 7 8 20 15 18 19) (10 20 1) simpleGrading (1 1 1)
51 );
52
53 edges
54 (
55 arc 0 5 (0.469846 0.17101 0)
56 arc 5 10 (0.17101 0.469846 0)
57 arc 1 4 (0.939693 0.34202 0)
58 arc 4 9 (0.34202 0.939693 0)
59 arc 11 16 (0.469846 0.17101 0.5)
60 arc 16 21 (0.17101 0.469846 0.5)
61 arc 12 15 (0.939693 0.34202 0.5)
62 arc 15 20 (0.34202 0.939693 0.5)
63 );
64
65 boundary
66 (
67 left
68 {
69 type symmetryPlane;
70 faces
71 (
72 (8 9 20 19)
73 (9 10 21 20)
74 );
75 }
76 right
77 {
78 type patch;
79 faces
80 (
81 (2 3 14 13)
82 (3 6 17 14)
83 );
84 }
85 down
86 {
87 type symmetryPlane;
88 faces
89 (
90 (0 1 12 11)
91 (1 2 13 12)
92 );
93 }
94 up
OpenFOAM-10
U-52 Tutorials
95 {
96 type patch;
97 faces
98 (
99 (7 8 19 18)
100 (6 7 18 17)
101 );
102 }
103 hole
104 {
105 type patch;
106 faces
107 (
108 (10 5 16 21)
109 (5 0 11 16)
110 );
111 }
112 frontAndBack
113 {
114 type empty;
115 faces
116 (
117 (10 9 4 5)
118 (5 4 1 0)
119 (1 4 3 2)
120 (4 7 6 3)
121 (4 9 8 7)
122 (21 16 15 20)
123 (16 11 12 15)
124 (12 13 14 15)
125 (15 14 17 18)
126 (15 18 19 20)
127 );
128 }
129 );
130
131
132 // ************************************************************************* //
Until now, we have only specified straight edges in the geometries of previous tutorials but
here we need to specify curved edges. These are specified under the edges keyword entry
which is a list of non-straight edges. The syntax of each list entry begins with the type of
curve, including arc, simpleSpline, polyLine etc., described further in section 5.3.1. In
this example, all the edges are circular and so can be specified by the arc keyword entry.
The following entries are the labels of the start and end vertices of the arc and a point
vector through which the circular arc passes.
The blocks in this blockMeshDict do not all have the same orientation. As can be seen
in Figure 2.17 the x2 direction of block 0 is equivalent to the −x1 direction for block 4.
This means care must be taken when defining the number and distribution of cells in each
block so that the cells match up at the block faces.
6 patches are defined: one for each side of the plate, one for the hole and one for the
front and back planes. The left and down patches are both a symmetry plane. Since this
is a geometric constraint, it is included in the definition of the mesh, rather than being
purely a specification on the boundary condition of the fields. Therefore they are defined
as such using a special symmetryPlane type as shown in the blockMeshDict.
The frontAndBack patch represents the plane which is ignored in a 2D case. Again
this is a geometric constraint so is defined within the mesh, using the empty type as shown
in the blockMeshDict. For further details of boundary types and geometric constraints,
the user should refer to section 5.2.
The remaining patches are of the regular patch type. The mesh should be generated
using blockMesh and can be viewed in paraFoam as described in section 2.1.2. It should
appear as in Figure 2.18.
OpenFOAM-10
2.2 Stress analysis of a plate with a hole U-53
Firstly, it can be seen that the displacement initial conditions are set to (0, 0, 0) m. The
OpenFOAM-10
U-54 Tutorials
left and down patches must be both of symmetryPlane type since they are specified
as such in the mesh description in the constant/polyMesh/boundary file. Similarly the
frontAndBack patch is declared empty.
The other patches are traction boundary conditions, set by a specialist traction bound-
ary type. The traction boundary conditions are specified by a linear combination of: (1)
a boundary traction vector under keyword traction; (2) a pressure that produces a trac-
tion normal to the boundary surface that is defined as negative when pointing out of
the surface, under keyword pressure. The up and hole patches are zero traction so the
boundary traction and pressure are set to zero. For the right patch the traction should
be (1e4, 0, 0) Pa and the pressure should be 0 Pa.
The planeStress switch is set to yes to adopt the plane stress assumption in this 2D
case. The solidDisplacementFoam solver may optionally solve a thermal equation that is
OpenFOAM-10
2.2 Stress analysis of a plate with a hole U-55
coupled with the momentum equation through the thermal stresses that are generated.
The user specifies at run time whether OpenFOAM should solve the thermal equation by
the thermalStress switch (currently set to no). The thermal properties are also specified
for steel for this case, i.e.:
• Specific heat capacity Cp = 434 Jkg−1 K−1
• Thermal conductivity kappa = 60.5 Wm−1 K−1
• Thermal expansion coefficient alphav = 1.1 × 10−5 K−1
For thermal calculations, the temperature field variable T is present in the 0 directory.
2.2.1.3 Control
As before, the information relating to the control of the solution procedure are read in
from the controlDict dictionary. For this case, the startTime is 0 s. The time step is
not important since this is a steady state case; in this situation it is best to set the time
step deltaT to 1 so it simply acts as an iteration counter for the steady-state case. The
endTime, set to 100, then acts as a limit on the number of iterations. The writeInterval
can be set to 20.
The controlDict entries are as follows:
16
17 application solidDisplacementFoam;
18
19 startFrom startTime;
20
21 startTime 0;
22
23 stopAt endTime;
24
25 endTime 100;
26
27 deltaT 1;
28
29 writeControl timeStep;
30
31 writeInterval 20;
32
33 purgeWrite 0;
34
35 writeFormat ascii;
36
37 writePrecision 6;
38
39 writeCompression off;
40
41 timeFormat general;
42
43 timePrecision 6;
44
45 graphFormat raw;
46
47 runTimeModifiable true;
48
49
50 // ************************************************************************* //
OpenFOAM-10
U-56 Tutorials
The momentum equation in linear-elastic stress analysis includes several explicit terms
containing the gradient of displacement. The calculations benefit from accurate and
smooth evaluation of the gradient. Normally, in the finite volume method the discreti-
sation is based on Gauss’s theorem. The Gauss method is sufficiently accurate for most
purposes but, in this case, the least squares method will be used. The user should there-
fore open the fvSchemes dictionary in the system directory and ensure the leastSquares
method is selected for the grad(U) gradient discretisation scheme in the gradSchemes
sub-dictionary:
16
17 d2dt2Schemes
18 {
19 default steadyState;
20 }
21
22 ddtSchemes
23 {
24 default Euler;
25 }
26
27 gradSchemes
28 {
29 default leastSquares;
30 grad(D) leastSquares;
31 grad(T) leastSquares;
32 }
33
34 divSchemes
35 {
36 default none;
37 div(sigmaD) Gauss linear;
38 }
39
40 laplacianSchemes
41 {
42 default none;
43 laplacian(DD,D) Gauss linear corrected;
44 laplacian(kappa,T) Gauss linear corrected;
45 }
46
47 interpolationSchemes
48 {
49 default linear;
50 }
51
52 snGradSchemes
53 {
54 default none;
55 }
56
57 // ************************************************************************* //
The fvSolution dictionary in the system directory controls the linear equation solvers and
algorithms used in the solution. The user should first look at the solvers sub-dictionary
and notice that the choice of solver for D is GAMG. The solver tolerance should be set to
10−6 for this problem. The solver relative tolerance, denoted by relTol, sets the required
reduction in the residuals within each iteration. It is uneconomical to set a tight (low)
relative tolerance within each iteration since a lot of terms in each equation are explicit
and are updated as part of the segregated iterative procedure. Therefore a reasonable
value for the relative tolerance is 0.01, or possibly even higher, say 0.1, or in some cases
even 0.9 (as in this case).
16
17 solvers
18 {
19 "(D|T)"
20 {
21 solver GAMG;
22 tolerance 1e-06;
23 relTol 0.9;
24 smoother GaussSeidel;
OpenFOAM-10
2.2 Stress analysis of a plate with a hole U-57
25 nCellsInCoarsestLevel 20;
26 }
27 }
28
29 stressAnalysis
30 {
31 compactNormalStress yes;
32 nCorrectors 1;
33 D 1e-06;
34 }
35
36
37 // ************************************************************************* //
The fvSolution dictionary contains a sub-dictionary, stressAnalysis that contains some con-
trol parameters specific to the application solver. Firstly there is nCorrectors which
specifies the number of outer loops around the complete system of equations, including
traction boundary conditions within each time step. Since this problem is steady-state,
we are performing a set of iterations towards a converged solution with the ‘time step’
acting as an iteration counter. We can therefore set nCorrectors to 1.
The D keyword specifies a convergence tolerance for the outer iteration loop, i.e. sets
a level of initial residual below which solving will cease. It should be set to the desired
solver tolerance specified earlier, 10−6 for this problem.
The user should check the convergence information by viewing the generated log file which
shows the number of iterations and the initial and final residuals of the displacement in
each direction being solved. The final residual should always be less than 0.9 times the
initial residual as this iteration tolerance set. Once both initial residuals have dropped
below the convergence tolerance of 10−6 the run has converged and can be stopped by
killing the batch job.
2.2.3 Post-processing
Post processing can be performed as in section 2.1.4. The solidDisplacementFoam solver
outputs the stress field σ as a symmetric tensor field sigma. This is consistent with the
way variables are usually represented in OpenFOAM solvers by the mathematical symbol
by which they are represented; in the case of Greek symbols, the variable is named
phonetically.
For post-processing individual scalar field components, σxx , σxy etc., can be generated
by running the postProcess utility as before in section 2.1.5.7, this time on sigma:
Components named sigmaxx, sigmaxy etc. are written to time directories of the case.
The σxx stresses can be viewed in paraFoam as shown in Figure 2.19.
We would like to compare the analytical solution of Equation 2.14 to our solution.
We therefore must output a set of data of σxx along the left edge symmetry plane of our
domain. The user may generate the required graph data using the postProcess utility
OpenFOAM-10
U-58 Tutorials
30
25
σxx (kPa)
20
15
10
with the graphUniform function. Unlike earlier examples of postProcess where no config-
uration is required, this example includes a graphUniform file pre-configured in the system
directory. The sample line is set between (0.0, 0.5, 0.25) and (0.0, 2.0, 0.25), and the fields
are specified in the fields list:
9 Writes graph data for specified fields along a line, specified by start and
10 end points. A specified number of graph points are used, distributed
11 uniformly along the line.
12
13 \*---------------------------------------------------------------------------*/
14
15 start (0 0.5 0.25);
16 end (0 2 0.25);
17 nPoints 100;
18
19 fields (sigmaxx);
20
21 axis y;
22
23 #includeEtc "caseDicts/postProcessing/graphs/graphUniform.cfg"
24
25 // ************************************************************************* //
Data is written in raw 2 column format into files within time subdirectories of a post-
Processing/graphUniform directory, e.g. the data at t = 100 s is found within the file
graphUniform/100/line.xy. If the user has GnuPlot installed they launch it (by typing
gnuplot) and then plot both the numerical data and analytical solution as follows:
2.2.4 Exercises
The user may wish to experiment with solidDisplacementFoam by trying the following
exercises:
OpenFOAM-10
2.3 Breaking of a dam U-59
35
30
OpenFOAM-10
U-60 Tutorials
fraction can have any value between 0 and 1, the interface is never sharply defined, but
occupies a volume around the region where a sharp interface should exist.
The test setup consists of a column of water at rest located behind a membrane on
the left side of a tank. At time t = 0 s, the membrane is removed and the column of
water collapses. During the collapse, the water impacts an obstacle at the bottom of the
tank and creates a complicated flow structure, including several captured pockets of air.
The geometry and the initial setup is shown in Figure 2.21.
0.584 m
water column
0.584 m
0.292 m
0.048 m
run
cp -r $FOAM_TUTORIALS/multiphase/interFoam/laminar/damBreak/damBreak .
Go into the damBreak case directory and generate the mesh running blockMesh as de-
scribed previously. The damBreak mesh consist of 5 blocks; the blockMeshDict entries are
given below.
16 convertToMeters 0.146;
17
18 vertices
19 (
20 (0 0 0)
21 (2 0 0)
22 (2.16438 0 0)
23 (4 0 0)
24 (0 0.32876 0)
25 (2 0.32876 0)
26 (2.16438 0.32876 0)
27 (4 0.32876 0)
28 (0 4 0)
OpenFOAM-10
2.3 Breaking of a dam U-61
29 (2 4 0)
30 (2.16438 4 0)
31 (4 4 0)
32 (0 0 0.1)
33 (2 0 0.1)
34 (2.16438 0 0.1)
35 (4 0 0.1)
36 (0 0.32876 0.1)
37 (2 0.32876 0.1)
38 (2.16438 0.32876 0.1)
39 (4 0.32876 0.1)
40 (0 4 0.1)
41 (2 4 0.1)
42 (2.16438 4 0.1)
43 (4 4 0.1)
44 );
45
46 blocks
47 (
48 hex (0 1 5 4 12 13 17 16) (23 8 1) simpleGrading (1 1 1)
49 hex (2 3 7 6 14 15 19 18) (19 8 1) simpleGrading (1 1 1)
50 hex (4 5 9 8 16 17 21 20) (23 42 1) simpleGrading (1 1 1)
51 hex (5 6 10 9 17 18 22 21) (4 42 1) simpleGrading (1 1 1)
52 hex (6 7 11 10 18 19 23 22) (19 42 1) simpleGrading (1 1 1)
53 );
54
55 defaultPatch
56 {
57 type empty;
58 }
59
60 boundary
61 (
62 leftWall
63 {
64 type wall;
65 faces
66 (
67 (0 12 16 4)
68 (4 16 20 8)
69 );
70 }
71 rightWall
72 {
73 type wall;
74 faces
75 (
76 (7 19 15 3)
77 (11 23 19 7)
78 );
79 }
80 lowerWall
81 {
82 type wall;
83 faces
84 (
85 (0 1 13 12)
86 (1 5 17 13)
87 (5 6 18 17)
88 (2 14 18 6)
89 (2 3 15 14)
90 );
91 }
92 atmosphere
93 {
94 type patch;
95 faces
96 (
97 (8 20 21 9)
98 (9 21 22 10)
99 (10 22 23 11)
100 );
101 }
102 );
103
104
105 // ************************************************************************* //
OpenFOAM-10
U-62 Tutorials
• inletOutlet applied to other fields, which is a zeroGradient condition when flow out-
wards, fixedValue when flow is inwards.
At all wall boundaries, the fixedFluxPressure boundary condition is applied to the pressure
field, which adjusts the pressure gradient so that the boundary flux matches the veloc-
ity boundary condition for solvers that include body forces such as gravity and surface
tension.
The defaultFaces patch representing the front and back planes of the 2D problem,
is, as usual, an empty type.
2.3.3 Phases
The fluid phases are specified in the phaseProperties file in the constant directory as follows:
OpenFOAM-10
2.3 Breaking of a dam U-63
16
17 phases (water air);
18
19 sigma 0.07;
20
21
22 // ************************************************************************* //
It lists two phases, water and air. Equations for phase fraction are solved for the phases
in the list, except the last phase listed, i.e. air in this case. Since there are only two
phases, only one phase fraction equation is solved in this case, for the water phase fraction
αwater , specified in the file alpha.water in the 0 directory.
The phaseProperties file also contains an entry for the surface tension between the two
phases, specified by the keyword sigma in units N m−1 .
This will be done by running the setFields utility. It requires a setFieldsDict dictionary,
located in the system directory, whose entries for this case are shown below.
16
17 defaultFieldValues
18 (
19 volScalarFieldValue alpha.water 0
20 );
21
22 regions
23 (
24 boxToCell
25 {
26 box (0 0 -1) (0.1461 0.292 1);
27 fieldValues
28 (
29 volScalarFieldValue alpha.water 1
30 );
31 }
32 );
33
34
35 // ************************************************************************* //
The defaultFieldValues sets the default value of the fields, i.e. the value the field
takes unless specified otherwise in the regions sub-dictionary. That sub-dictionary con-
tains a list of subdictionaries containing fieldValues that override the defaults in a
specified region. The region creates a set of points, cells or faces based on some topo-
logical constraint. Here, boxToCell creates a bounding box within a vector minimum
and maximum to define the set of cells of the water region. The phase fraction αwater is
defined as 1 in this region.
The setFields utility reads fields from file and, after re-calculating those fields, will write
them back to file. In the damBreak tutorial, the alpha.water field is initially stored as
a backup named alpha.water.orig. A field file with the .orig extension is read in
when the actual file does not exist, so setFields will read alpha.water.orig but write
the resulting output to alpha.water (or alpha.water.gz if compression is switched on).
This way the original file is not overwritten, so can be reused.
The user should therefore execute setFields like any other utility by:
OpenFOAM-10
U-64 Tutorials
setFields
Using paraFoam, check that the initial alpha.water field corresponds to the desired dis-
tribution as in Figure 2.22.
Phase fraction, α1
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.0
Gravitational acceleration is uniform across the domain and is specified in a file named
g in the constant directory. Unlike a normal field file, e.g. U and p, g is a uniformDimen-
sionedVectorField and so simply contains a set of dimensions and a value that represents
(0, 9.81, 0) m s−2 for this tutorial:
16
17 dimensions [0 1 -2 0 0 0 0];
18 value (0 -9.81 0);
19
20
21 // ************************************************************************* //
OpenFOAM-10
2.3 Breaking of a dam U-65
OpenFOAM-10
U-66 Tutorials
42
43 timePrecision 6;
44
45 runTimeModifiable yes;
46
47 adjustTimeStep yes;
48
49 maxCo 1;
50 maxAlphaCo 1;
51
52 maxDeltaT 1;
53
54
55 // ************************************************************************* //
16
17 ddtSchemes
18 {
19 default Euler;
20 }
21
22 gradSchemes
23 {
24 default Gauss linear;
25 }
26
27 divSchemes
28 {
29 div(rhoPhi,U) Gauss linearUpwind grad(U);
30 div(phi,alpha) Gauss interfaceCompression vanLeer 1;
31 div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
32 }
33
34 laplacianSchemes
35 {
36 default Gauss linear corrected;
37 }
38
39 interpolationSchemes
40 {
41 default linear;
42 }
43
44 snGradSchemes
45 {
46 default corrected;
47 }
48
49
50 // ************************************************************************* //
OpenFOAM-10
2.3 Breaking of a dam U-67
cd $FOAM_RUN/damBreak
interFoam | tee log
The code will now be run interactively, with a copy of output stored in the log file.
2.3.11 Post-processing
Post-processing of the results can now be done in the usual way. The user can monitor
the development of the phase fraction alpha.water in time, e.g. see Figure 2.23.
run
foamCloneCase damBreak damBreakFine
Enter the new case directory and change the blocks description in the blockMeshDict
dictionary to
blocks
(
hex (0 1 5 4 12 13 17 16) (46 10 1) simpleGrading (1 1 1)
hex (2 3 7 6 14 15 19 18) (40 10 1) simpleGrading (1 1 1)
hex (4 5 9 8 16 17 21 20) (46 76 1) simpleGrading (1 2 1)
hex (5 6 10 9 17 18 22 21) (4 76 1) simpleGrading (1 2 1)
hex (6 7 11 10 18 19 23 22) (40 76 1) simpleGrading (1 2 1)
);
Here, the entry is presented as printed from the blockMeshDict file; in short the user must
change the mesh densities, e.g. the 46 10 1 entry, and some of the mesh grading entries
to 1 2 1. Once the dictionary is correct, generate the mesh by running blockMesh.
OpenFOAM-10
U-68 Tutorials
Phase fraction, α1
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.0
(a) At t = 0.25 s.
Phase fraction, α1
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.0
(b) At t = 0.50 s.
OpenFOAM-10
2.3 Breaking of a dam U-69
As the mesh has now changed from the damBreak example, the user must re-initialise
the phase field alpha.water in the 0 time directory since it contains a number of elements
that is inconsistent with the new mesh. Note that there is no need to change the U and
p_rgh fields since they are specified as uniform which is independent of the number of
elements in the field. We wish to initialise the field with a sharp interface, i.e. it elements
would have α = 1 or α = 0. Updating the field with mapFields may produce interpolated
values 0 < α < 1 at the interface, so it is better to rerun the setFields utility.
The mesh size is now inconsistent with the number of elements in the alpha.water file
in the 0 directory, so the user must delete that file so that the original alpha.water.orig file
is used instead.
rm 0/alpha.water
setFields
foamGet decomposeParDict
The first entry is numberOfSubdomains which specifies the number of subdomains into
which the case will be decomposed, usually corresponding to the number of processors
available for the case.
In this tutorial, the method of decomposition should be simple and the corresponding
simpleCoeffs should be edited according to the following criteria. The domain is split
into pieces, or subdomains, in the x, y and z directions, the number of subdomains in
each direction being given by the vector n. As this geometry is 2 dimensional, the 3rd
direction, z, cannot be split, hence nz must equal 1. The nx and ny components of n
split the domain in the x and y directions and must be specified so that the number
of subdomains specified by nx and ny equals the specified numberOfSubdomains, i.e.
nx ny = numberOfSubdomains. It is beneficial to keep the number of cell faces adjoining
the subdomains to a minimum so, for a square geometry, it is best to keep the split
between the x and y directions should be fairly even.
For example, let us assume we wish to run on 4 processors. We would set numberOf-
Subdomains to 4 and n = (2, 2, 1). The user should run decomposePar with:
decomposePar
The terminal output shows that the decomposition is distributed fairly even between the
processors.
The user should consult section 3.4 for details of how to run a case in parallel; in
this tutorial we merely present an example of running in parallel. We use the openMPI
implementation of the standard message-passing interface (MPI). As a test here, the user
can run in parallel on a single node, the local host only, by typing:
OpenFOAM-10
U-70 Tutorials
The user may run on more nodes over a network by creating a file that lists the host
names of the machines on which the case is to be run as described in section 3.4.3. The
case should run in the background and the user can follow its progress by monitoring the
log file as usual.
then processor1 will appear as a case module in ParaView. Figure 2.24 shows the mesh
from processor 1 following the decomposition of the domain using the simple method.
OpenFOAM-10
2.3 Breaking of a dam U-71
Phase fraction, α1
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.0
(a) At t = 0.25 s.
Phase fraction, α1
1.0
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.0
(b) At t = 0.50 s.
OpenFOAM-10
U-72 Tutorials
OpenFOAM-10
Chapter 3
We should reiterate from the outset that OpenFOAM is a C++ library used primarily to
create executables, known as applications. OpenFOAM is distributed with a large set of
precompiled applications but users also have the freedom to create their own or modify
existing ones. Applications are split into two main categories:
solvers that are each designed to solve a specific problem in computational continuum
mechanics;
utilities that perform simple pre-and post-processing tasks, mainly involving data ma-
nipulation and algebraic calculations.
OpenFOAM is divided into a set of precompiled libraries that are dynamically linked
during compilation of the solvers and utilities. Libraries such as those for physical models
are supplied as source code so that users may conveniently add their own models to the
libraries. This chapter gives an overview of solvers, utilities and libraries, their creation,
modification, compilation and execution.
are usually presented first in verbal language, then as partial differential equations in 3
dimensions of space and time. The equations contain the following concepts: scalars,
vectors, tensors, and fields thereof; tensor algebra; tensor calculus; dimensional units.
The solution to these equations involves discretisation procedures, matrices, solvers, and
solution algorithms.
∂ρU
+ ∇ • ϕU − ∇ • µ∇U = −∇p
∂t
is represented by the code
solve
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
- fvm::laplacian(mu, U)
==
- fvc::grad(p)
);
This and other requirements demand that the principal programming language of Open-
FOAM has object-oriented features such as inheritance, template classes, virtual functions
and operator overloading. These features are not available in many languages that purport
to be object-orientated but actually have very limited object-orientated capability, such
OpenFOAM-10
3.2 Compiling applications and libraries U-75
as FORTRAN-90. C++, however, possesses all these features while having the additional
advantage that it is widely used with a standard specification so that reliable compilers
are available that produce efficient executables. It is therefore the primary language of
OpenFOAM.
OpenFOAM-10
U-76 Applications and libraries
Compiled Compiled
newApp Linked nc.so
Executable -l option Library
files for all the classes on which the top level .C code ultimately depends; these .H files are
known as the dependencies. With a dependency list, a compiler can check whether the
source files have been updated since their last compilation and selectively compile only
those that need to be.
Header files are included in the code using the # include directive, e.g.
# include "otherHeader.H";
This causes the compiler to suspend reading from the current file, to read the included file.
This mechanism allows any self-contained piece of code to be put into a header file and
included at the relevant location in the main code in order to improve code readability.
For example, in most OpenFOAM applications the code for creating fields and reading
field input data is included in a file createFields.H which is called at the beginning of the
code. In this way, header files are not solely used as class declarations.
It is wmake that performs the task of maintaining file dependency lists amongst other
functions listed below.
• Automatic generation and maintenance of file dependency lists, i.e. lists of files
which are included in the source files and hence on which they depend.
• Multi-option compilation and linkage, e.g. debug, optimised, parallel and profiling.
• Support for source code generation programs, e.g. lex, yacc, IDL, MOC.
OpenFOAM-10
3.2 Compiling applications and libraries U-77
newApp
newApp.C
otherHeader.H
Make
files
options
Figure 3.2: Directory structure for an application
directory must contain a Make subdirectory containing 2 files, options and files, that are
described in the following sections.
EXE_INC = \
-I<directoryPath1> \
-I<directoryPath2> \
... \
-I<directoryPathN>
Notice first that the directory names are preceeded by the -I flag and that the syntax
uses the \ to continue the EXE_INC across several lines, with no \ after the final entry.
OpenFOAM-10
U-78 Applications and libraries
EXE_LIBS = \
-L<libraryPath> \
-l<library1> \
-l<library2> \
... \
-l<libraryN>
To summarise: the directory paths are preceeded by the -L flag, the library names are
preceeded by the -l flag.
OpenFOAM-10
3.2 Compiling applications and libraries U-79
newApp.C
EXE = $(FOAM_USER_APPBIN)/newApp
wmake <optionalDirectory>
The <optionalDirectory> is the directory path of the application that is being compiled.
Typically, wmake is executed from within the directory of the application being compiled,
in which case <optionalDirectory> can be omitted.
The environment variable settings for the compilation with wmake are listed below:
• $WM_COMPILER: compiler being used, e.g. Gcc = gcc, Clang = LLVM Clang
OpenFOAM-10
U-80 Applications and libraries
wclean <optionalDirectory>
• in the files file, EXE = is replaced by LIB = and the target directory for the compiled
entity changes from $FOAM_APPBIN to $FOAM_LIBBIN (and an equivalent $FOAM_-
USER_LIBBIN directory);
When wmake is executed it additionally creates a directory named lnInclude that contains
soft links to all the files in the library. The lnInclude directory is deleted by the wclean
script when cleaning library source code.
OpenFOAM-10
3.2 Compiling applications and libraries U-81
1 /*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration | Website: https://openfoam.org
5 \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
6 \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9 This file is part of OpenFOAM.
10
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
15
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24 Application
25 pisoFoam
26
27 Description
28 Transient solver for incompressible, turbulent flow, using the PISO
29 algorithm.
30
31 Sub-models include:
32 - turbulence modelling, i.e. laminar, RAS or LES
33 - run-time selectable MRF and finite volume options, e.g. explicit porosity
34
35 \*---------------------------------------------------------------------------*/
36
37 #include "fvCFD.H"
38 #include "viscosityModel.H"
39 #include "incompressibleMomentumTransportModels.H"
40 #include "pisoControl.H"
41 #include "pressureReference.H"
42 #include "fvModels.H"
43 #include "fvConstraints.H"
44
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47 int main(int argc, char *argv[])
48 {
49 #include "postProcess.H"
50
51 #include "setRootCaseLists.H"
52 #include "createTime.H"
53 #include "createMesh.H"
54 #include "createControl.H"
55 #include "createFields.H"
56 #include "initContinuityErrs.H"
57
58 turbulence->validate();
59
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61
62 Info<< "\nStarting time loop\n" << endl;
63
64 while (runTime.loop())
65 {
66 Info<< "Time = " << runTime.userTimeName() << nl << endl;
67
68 #include "CourantNo.H"
69
70 // Pressure-velocity PISO corrector
71 {
72 fvModels.correct();
73
74 #include "UEqn.H"
75
76 // --- PISO loop
77 while (piso.correct())
78 {
79 #include "pEqn.H"
80 }
81 }
82
OpenFOAM-10
U-82 Applications and libraries
83 viscosity->correct();
84 turbulence->correct();
85
86 runTime.write();
87
88 Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
89 << " ClockTime = " << runTime.elapsedClockTime() << " s"
90 << nl << endl;
91 }
92
93 Info<< "End\n" << endl;
94
95 return 0;
96 }
97
98
99 // ************************************************************************* //
The code begins with a brief description of the application contained within comments
over 1 line (//) and multiple lines (/*...*/). Following that, the code contains several #
include statements, e.g. # include "fvCFD.H", which causes the compiler to suspend
reading from the current file, pisoFoam.C to read the fvCFD.H.
pisoFoam resources the turbulence and transport model libraries and therefore requires
the necessary header files, specified by the EXE_INC = -I... option, and links to the
libraries with the EXE_LIBS = -l... option. The Make/options therefore contains the
following:
1 EXE_INC = \
2 -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
3 -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \
4 -I$(LIB_SRC)/physicalProperties/lnInclude \
5 -I$(LIB_SRC)/finiteVolume/lnInclude \
6 -I$(LIB_SRC)/meshTools/lnInclude \
7 -I$(LIB_SRC)/sampling/lnInclude
8
9 EXE_LIBS = \
10 -lmomentumTransportModels \
11 -lincompressibleMomentumTransportModels \
12 -lphysicalProperties \
13 -lfiniteVolume \
14 -lmeshTools \
15 -lfvModels \
16 -lfvConstraints \
17 -lsampling
pisoFoam contains only the pisoFoam.C source and the executable is written to the $FOAM_-
APPBIN directory as all standard applications are. The Make/files therefore contains:
1 pisoFoam.C
2
3 EXE = $(FOAM_APPBIN)/pisoFoam
Following the recommendations of section 3.2.2.3, the user can compile a separate version
of pisoFoam into their local $FOAM_USER_DIR directory by the following:
cd $FOAM_RUN
cp -r $FOAM_SOLVERS/incompressible/pisoFoam .
cd pisoFoam
• editing the Make/files file as follows;
1 pisoFoam.C
2
3 EXE = $(FOAM_USER_APPBIN)/pisoFoam
• executing wmake.
OpenFOAM-10
3.2 Compiling applications and libraries U-83
wmake
The code should compile and produce a message similar to the following
The user can now try recompiling and will receive a message similar to the following to
say that the executable is up to date and compiling is not necessary:
The user can compile the application from scratch by removing the dependency list with
wclean
• fileModificationSkew: a time in seconds that should be set higher than the max-
imum delay in NFS updates and clock difference for running OpenFOAM over a
NFS.
OpenFOAM-10
U-84 Applications and libraries
• nProcsSimpleSum: optimises the global sum for parallel processing, by setting the
number of processors above which a hierarchical sum is performed rather than a
linear sum.
libs
(
"libnew1.so"
"libnew2.so"
);
blockMesh -help
OpenFOAM-10
3.4 Running applications in parallel U-85
-fileHandler <handler>
override the fileHandler
-libs <(lib1 .. libN)>
pre-load libraries
-noClean keep the existing files in the polyMesh
-noFunctionObjects
do not execute functionObjects
-region <name> specify alternative mesh region
-srcDoc display source code in browser
-doc display application documentation in browser
-help print the usage
If the application is executed from within a case directory, it will operate on that case.
Alternatively, the -case <caseDir> option allows the case to be specified directly so
that the application can be executed from anywhere in the filing system.
Like any UNIX/Linux executable, applications can be run as a background process,
i.e. one which does not have to be completed before the user can give the shell additional
commands. If the user wished to run the blockMesh example as a background process
and output the case progress to a log file, they could enter:
OpenFOAM-10
U-86 Applications and libraries
26 hierarchicalCoeffs
27 {
28 n (1 1 1);
29 order xyz;
30 }
31
32 manualCoeffs
33 {
34 dataFile "";
35 }
36
37 distributed no;
38
39 roots ( );
40
41
42 // ************************************************************************* //
The user has a choice of four methods of decomposition, specified by the method keyword
as described below.
simple Simple geometric decomposition in which the domain is split into pieces by di-
rection, e.g. 2 pieces in the x direction, 1 in y etc.
hierarchical Hierarchical geometric decomposition which is the same as simple except
the user specifies the order in which the directional split is done, e.g. first in the
y-direction, then the x-direction etc.
scotch Scotch decomposition which requires no geometric input from the user and at-
tempts to minimise the number of processor boundaries. The user can specify a
weighting for the decomposition between processors, through an optional process-
orWeights keyword which can be useful on machines with differing performance
between processors. There is also an optional keyword entry strategy that con-
trols the decomposition strategy through a complex string supplied to Scotch. For
more information, see the source code file: $FOAM_SRC/parallel/decompose/scotch-
Decomp/scotchDecomp.C
manual Manual decomposition, where the user directly specifies the allocation of each
cell to a particular processor.
For each method there are a set of coefficients specified in a sub-dictionary of decom-
positionDict, named <method>Coeffs as shown in the dictionary listing. The full set of
keyword entries in the decomposeParDict dictionary are explained below:
• numberOfSubdomains: total number of subdomains N .
• method: method of decomposition, simple, hierarchical, scotch, manual.
• n: for simple and hierarchical, number of subdomains in x, y, z (nx ny nz )
• order: order of hierarchical decomposition, xyz/xzy/yxz. . .
• processorWeights option for scotch: list of weighting factors (<wt1>...<wtN>)
for allocation of cells to processors; <wt1> is the weighting factor for processor 1,
etc.; weights are normalised so can take any range of values.
• dataFile: for manual decomposition, name of file containing data of allocation of
cells to processors.
• distributed: yes/no switch indicating whether data is distributed across several
disks.
OpenFOAM-10
3.4 Running applications in parallel U-87
• roots: list of root paths to case directories (<rt1>...<rtN>), where <rt1> is the
root path for node 1, etc.
decomposePar
OpenFOAM-10
U-88 Applications and libraries
When using the collated file handling, memory is allocated for the data in the thread.
maxThreadFileBufferSize sets the maximum size of memory that is allocated in bytes.
If the data exceeds this size, the write does not use threading.
Note: if threading is not enabled in the MPI, it must be disabled for collated file
handling by setting in the global etc/controlDict file:
maxThreadFileBufferSize 0;
OpenFOAM-10
3.4 Running applications in parallel U-89
aaa
bbb cpu=2
ccc
distributed yes;
and the roots entry is a list of root paths, <root0>, <root1>, . . . , for each node
roots
<nRoots>
(
"<root0>"
"<root1>"
...
);
OpenFOAM-10
U-90 Applications and libraries
reconstructPar
When the data is distributed across several disks, it must be first copied to the local case
directory for reconstruction.
potentialFoam Potential flow solver which solves for the velocity potential, to calculate
the flux-field, from which the velocity field is obtained by reconstructing the flux.
scalarTransportFoam Solves the steady or transient transport equation for a passive scalar.
pimpleFoam Transient solver for incompressible, turbulent flow of Newtonian fluids, with
optional mesh motion and mesh topology changes.
OpenFOAM-10
3.5 Standard solvers U-91
pisoFoam Transient solver for incompressible, turbulent flow, using the PISO algorithm.
simpleFoam Steady-state solver for incompressible, turbulent flow, using the SIMPLE
algorithm.
rhoPimpleFoam Transient solver for turbulent flow of compressible fluids for HVAC and
similar applications, with optional mesh motion and mesh topology changes.
driftFluxFoam Solver for 2 incompressible fluids using the mixture approach with the
drift-flux approximation for relative motion of the phases.
interFoam Solver for 2 incompressible, isothermal immiscible fluids using a VOF (volume
of fluid) phase-fraction based interface capturing approach, with optional mesh mo-
tion and mesh topology changes including adaptive re-meshing.
interMixingFoam Solver for 3 incompressible fluids, two of which are miscible, using a VOF
method to capture the interface, with optional mesh motion and mesh topology
changes including adaptive re-meshing.
OpenFOAM-10
U-92 Applications and libraries
multiphaseEulerFoam Solver for a system of any number of compressible fluid phases with
a common pressure, but otherwise separate properties. The type of phase model
is run time selectable and can optionally represent multiple species and in-phase
reactions. The phase system is also run time selectable and can optionally represent
different types of momentun, heat and mass transfer.
multiphaseInterFoam Solver for n incompressible fluids which captures the interfaces and
includes surface-tension and contact-angle effects for each phase, with optional mesh
motion and mesh topology changes.
3.5.6 Combustion
buoyantReactingFoam Solver for combustion with chemical reactions using a density based
thermodynamics package with enhanced buoyancy treatment.
chemFoam Solver for chemistry problems, designed for use on single cell cases to provide
comparison against other chemistry solvers, that uses a single cell mesh, and fields
created from the initial conditions.
chtMultiRegionFoam Solver for steady or transient fluid flow and solid heat conduction,
with conjugate heat transfer between regions, buoyancy effects, turbulence, reac-
tions and radiation modelling.
thermoFoam Solver for energy transport and thermodynamics on a frozen flow field.
OpenFOAM-10
3.6 Standard utilities U-93
particleFoam Transient solver for the passive transport of a single kinematic particle cloud,
with optional mesh motion and mesh topology changes.
3.5.10 Electromagnetics
electrostaticFoam Solver for electrostatics.
3.5.12 Finance
financialFoam Solves the Black-Scholes equation to price commodities.
OpenFOAM-10
U-94 Applications and libraries
3.6.1 Pre-processing
applyBoundaryLayer Apply a simplified boundary-layer model to the velocity and turbu-
lence fields based on the 1/7th power-law.
boxTurb Makes a box of turbulence which conforms to a given energy spectrum and is
divergence free.
changeDictionary Utility to change dictionary entries, e.g. can be used to change the
patch type in the field and polyMesh/boundary files.
dsmcInitialise Initialise a case for dsmcFoam by reading the initialisation dictionary system/-
dsmcInitialise.
foamSetupCHT Sets up a multi-region case using template files for material properties,
field and system files.
mapFields Maps volume fields from one mesh to another, reading and interpolating all
fields present in the time directory of both cases.
mapFieldsPar Maps volume fields from one mesh to another, reading and interpolating all
fields present in the time directory of both cases. Parallel and non-parallel cases are
handled without the need to reconstruct them first.
setWaves Applies wave models to the entire domain for case initialisation using level sets
for second-order accuracy.
viewFactorsGen View factors are calculated based on a face agglomeration array (finalAgglom
generated by faceAgglomerate utility).
extrudeMesh Extrude mesh from existing patch (by default outwards facing normals; op-
tional flips faces) or from patch read from file.
extrude2DMesh Takes 2D mesh (all faces 2 points only, no front and back faces) and
creates a 3D mesh by extruding with specified thickness.
OpenFOAM-10
3.6 Standard utilities U-95
OpenFOAM-10
U-96 Applications and libraries
autoPatch Divides external faces into patches based on (user supplied) feature angle.
createBaffles Makes internal faces into boundary faces. Does not duplicate points, unlike
mergeOrSplitBaffles.
createPatch Utility to create patches out of selected boundary faces. Faces come either
from existing patches or from a faceSet.
insideCells Picks up cells with cell centre ’inside’ of surface. Requires surface to be closed
and singly connected.
mergeBaffles Detects faces that share points (baffles) and merges them into internal faces.
objToVTK Read obj line (not surface!) file and convert into vtk.
polyDualMesh Calculates the dual of a polyMesh. Adheres to all the feature and patch
edges.
renumberMesh Renumbers the cell list in order to reduce the bandwidth, reading and
renumbering all fields from all the time directories.
rotateMesh Rotates the mesh and fields from the direction n1 to direction n2.
setsToZones Add pointZones, faceZones or cellZones to the mesh from similar named
pointSets, faceSets or cellSets.
singleCellMesh Reads all fields and maps them to a mesh with all internal faces removed
(singleCellFvMesh) which gets written to region singleCell.
splitBaffles Detects faces that share points (baffles) and duplicates the points to separate
them.
OpenFOAM-10
3.6 Standard utilities U-97
transformPoints Transforms the mesh points in the polyMesh directory according to the
translate, rotate and scale options.
zipUpMesh Reads in a mesh with hanging vertices and zips up the cells to guarantee that
all polyhedral cells of valid shape are closed.
collapseEdges Collapses short edges and combines edges that are in line.
combinePatchFaces Checks for multiple patch faces on same cell and combines them.
Multiple patch faces can result from e.g. removal of refined neighbouring cells,
leaving 4 exposed faces with same owner.
PDRMesh Mesh and field preparation utility for PDR type simulations.
refinementLevel Tries to figure out what the refinement level is on refined Cartesian
meshes. Run BEFORE snapping.
3.6.6 Post-processing
engineCompRatio Calculate the geometric compression ratio. Note that if you have valves
and/or extra volumes it will not work, since it calculates the volume at BDC and
TCD.
noise Utility to perform noise analysis of pressure data using the noiseFFT library.
particleTracks Generates a VTK file of particle tracks for cases that were computed using
a tracked-parcel-type cloud.
OpenFOAM-10
U-98 Applications and libraries
steadyParticleTracks Generates a VTK file of particle tracks for cases that were computed
using a steady-state cloud NOTE: case must be re-constructed (if running in paral-
lel) before use
smapToFoam Translates a STAR-CD SMAP data file into OpenFOAM field format.
surfaceClean Removes baffles - collapses small edges, removing triangles. - converts sliver
triangles into split edges by projecting point onto base of triangle.
surfaceFeatures Identifies features in a surface geometry and writes them to file, based on
control parameters specified by the user.
surfaceHookUp Find close open edges and stitches the surface along them
OpenFOAM-10
3.6 Standard utilities U-99
surfaceInertia Calculates the inertia tensor, principal axes and moments of a command
line specified triSurface. Inertia can either be of the solid body or of a thin shell.
surfaceMeshConvertTesting Converts from one surface mesh format to another, but pri-
marily used for testing functionality.
surfaceMeshImport Import from various third-party surface formats into surfMesh with
optional scaling or transformations (rotate/translate) on a coordinateSystem.
surfaceOrient Set normal consistent with respect to a user provided ‘outside’ point. If the
-inside option is used the point is considered inside.
surfacePointMerge Merges points on surface if they are within absolute distance. Since
absolute distance use with care!
surfaceSplitByTopology Strips any baffle parts of a surface. A baffle region is one which
is reached by walking from an open edge, and stopping when a multiply connected
edge is reached.
surfaceSubset A surface analysis tool which sub-sets the triSurface to choose only a
part of interest. Based on subsetMesh.
surfaceToPatch Reads surface and applies surface regioning to a mesh. Uses boundaryMesh
to do the hard work.
OpenFOAM-10
U-100 Applications and libraries
redistributePar Redistributes existing decomposed mesh and fields according to the current
settings in the decomposeParDict file.
equilibriumFlameT Calculates the equilibrium flame temperature for a given fuel and pres-
sure for a range of unburnt gas temperatures and equivalence ratios; the effects of
dissociation on O2, H2O and CO2 are included.
foamFormatConvert Converts all IOobjects associated with a case into the format specified
in the controlDict.
patchSummary Writes fields and boundary condition info for each patch at each requested
time instance.
OpenFOAM-10
Chapter 4
OpenFOAM cases
This chapter deals with the file structure and organisation of OpenFOAM cases. Normally,
a user would assign a name to a case, e.g. the tutorial case of flow in a cavity is simply
named cavity. This name becomes the name of a directory in which all the case files and
subdirectories are stored. The case directories themselves can be located anywhere but we
recommend they are within a run subdirectory of the user’s project directory, i.e.$HOME/-
OpenFOAM/${USER}-10 as described at the beginning of chapter 2. One advantage of this
is that the $FOAM_RUN environment variable is set to $HOME/OpenFOAM/${USER}-
10/run by default; the user can quickly move to that directory by executing a preset alias,
run, at the command line.
The tutorial cases that accompany the OpenFOAM distribution provide useful exam-
ples of the case directory structures. The tutorials are located in the $FOAM_TUTORIALS
directory, reached quickly by executing the tut alias at the command line. Users can view
tutorial examples at their leisure while reading this chapter.
A constant directory that contains a full description of the case mesh in a subdirectory
polyMesh and files specifying physical properties for the application concerned, e.g.
physicalProperties.
A system directory for setting parameters associated with the solution procedure itself.
It contains at least the following 3 files: controlDict where run control parameters are
set including start/end time, time step and parameters for data output; fvSchemes
where discretisation schemes used in the solution may be selected at run-time; and,
fvSolution where the equation solvers, tolerances and other algorithm controls are
set for the run.
The ‘time’ directories containing individual files of data for particular fields, e.g. velocity
and pressure. The data can be: either, initial values and boundary conditions
that the user must specify to define the problem; or, results written to file by
OpenFOAM. Note that the OpenFOAM fields must always be initialised, even when
the solution does not strictly require it, as in steady-state problems. The name of
each time directory is based on the simulated time at which the data is written and
is described fully in section 4.4. It is sufficient to say now that since we usually start
U-102 OpenFOAM cases
<case>
system
controlDict see section 4.4
fvSchemes see section 4.5
fvSolution see section 4.6
constant
. . . Properties see chapter 7
polyMesh see section 5.1.2
points
faces
owner
neighbour
boundary
time directories see section 4.2.8
Figure 4.1: Case directory structure
our simulations at time t = 0, the initial conditions are usually stored in a directory
named 0 or 0.000000e+00, depending on the name format specified. For example,
in the cavity tutorial, the velocity field U and pressure field p are initialised from
files 0/U and 0/p respectively.
• Files have free form, with no particular meaning assigned to any column and no
need to indicate continuation across lines.
• A comment over multiple lines is done by enclosing the text between /* and */
delimiters.
OpenFOAM-10
4.2 Basic input/output file format U-103
4.2.2 Dictionaries
OpenFOAM uses dictionaries as the most common means of specifying data. A dictionary
is an entity that contains data entries that can be retrieved by the I/O by means of
keywords. The keyword entries follow the general format
<keyword> <dataEntry>;
Most OpenFOAM data files are themselves dictionaries containing a set of keyword en-
tries. Dictionaries provide the means for organising entries into logical categories and can
be specified hierarchically so that any dictionary can itself contain one or more dictionary
entries. The format for a dictionary is to specify the dictionary name followed by keyword
entries enclosed in curly braces {} as follows.
<dictionaryName>
{
... keyword entries ...
}
• class: class relating to the data, either dictionary or a field, e.g. volVectorField
OpenFOAM-10
U-104 OpenFOAM cases
30 relTol 0;
31 }
32
33 U
34 {
35 solver smoothSolver;
36 smoother symGaussSeidel;
37 tolerance 1e-05;
38 relTol 0;
39 }
40 }
41
42 PISO
43 {
44 nCorrectors 2;
45 nNonOrthogonalCorrectors 0;
46 pRefCell 0;
47 pRefValue 0;
48 }
49
50
51 // ************************************************************************* //
4.2.4 Lists
OpenFOAM applications contain lists, e.g. a list of vertex coordinates for a mesh descrip-
tion. Lists are commonly found in I/O and have a format of their own in which the entries
are contained within round braces ( ). There is also a choice of format preceeding the
round braces:
<listName>
(
... entries ...
);
• the keyword is followed by the number of elements <n> in the list
<listName>
<n>
(
... entries ...
);
• the keyword is followed by a class name identifier Label<Type> where <Type> states
what the list contains, e.g. for a list of scalar elements is
<listName>
List<scalar>
<n> // optional
(
... entries ...
);
Note that <scalar> in List<scalar> is not a generic name but the actual text that
should be entered.
The simple format is a convenient way of writing a list. The other formats allow
the code to read the data faster since the size of the list can be allocated to memory
in advance of reading the data. The simple format is therefore preferred for short lists,
where read time is minimal, and the other formats are preferred for long lists.
OpenFOAM-10
4.2 Basic input/output file format U-105
(
1 0 0
0 1 0
0 0 1
)
This example demonstrates the way in which OpenFOAM ignores the line return is so
that the entry can be written over multiple lines. It is treated no differently to listing the
numbers on a single line:
( 1 0 0 0 1 0 0 0 1 )
[0 2 -1 0 0 0 0]
where each of the values corresponds to the power of each of the base units of measure-
ment listed in Table 4.1. The table gives the base units for the Système International
OpenFOAM-10
U-106 OpenFOAM cases
(SI) and the United States Customary System (USCS) but OpenFOAM can be used
with any system of units. All that is required is that the input data is correct for the
chosen set of units. It is particularly important to recognise that OpenFOAM requires
some dimensioned physical constants, e.g. the Universal Gas Constant R, for certain cal-
culations, e.g. thermophysical modelling. These dimensioned constants are specified in
a DimensionedConstant sub-dictionary of main controlDict file of the OpenFOAM instal-
lation ($WM_PROJECT_DIR/etc/controlDict). By default these constants are set in SI
units. Those wishing to use the USCS or any other system of units should modify these
constants to their chosen set of units accordingly.
nu nu [0 2 -1 0 0 0 0] 1;
The first nu is the keyword; the second nu is the word name stored in class word, usually
chosen to be the same as the keyword; the next entry is the dimensionSet and the final
entry is the scalar value.
The majority of dimensioned keyword lookups set a default for the word name which
can therefore be omitted from the entry, so the more common syntax is:
nu [0 2 -1 0 0 0 0] 1;
4.2.8 Fields
Much of the I/O data in OpenFOAM are tensor fields, e.g. velocity, pressure data, that
are read from and written into the time directories. OpenFOAM writes field data using
keyword entries as described in Table 4.2.
The data begins with an entry for its dimensions. Following that, is the internalField,
described in one of the following ways.
• Uniform field a single value is assigned to all elements within the field, taking the
form:
internalField uniform <entry>;
• Nonuniform field each field element is assigned a unique value from a list, taking
the following form where the token identifier form of list is recommended:
internalField nonuniform <List>;
OpenFOAM-10
4.2 Basic input/output file format U-107
a 10;
b $a;
subdict
{
a 10;
}
b $subdict/a;
• to traverse up one level of sub-dictionary, use the ‘..’ (double-dot) prefix, see below;
OpenFOAM-10
U-108 OpenFOAM cases
• to traverse to the top level dictionary use the ‘:’ (colon) prefix (most useful), see
below;
• for multiple levels of macro substitution, each specified with the ‘$’ dollar syntax,
‘{}’ brackets are required to protect the expansion, see below.
a 10;
b a;
c ${${b}}; // returns 10, since $b returns "a", and $a returns 10
subdict
{
b $..a; // double-dot takes scope up 1 level, then "a" is available
subsubdict
{
c $:a; // colon takes scope to top level, then "a" is available
}
}
pressure 1e+05;
In order to use this pressure for both the internal and initial boundary fields, the
user would simply include the initialConditions file using the #include directive, then use
macro expansions for the pressure keyword, as follows.
#include "initialConditions"
internalField uniform $pressure;
boundaryField
{
patch1
{
type fixedValue;
value $internalField;
}
}
OpenFOAM-10
4.2 Basic input/output file format U-109
#include "$FOAM_RUN/pitzDaily/0/U"
In addition to environment variables like $FOAM_RUN, set within the operating sys-
tem, OpenFOAM recognises a number of “internal” environment variables, including the
following.
• $FOAM_CASE: the path and directory of the running case.
• $FOAM_CASENAME: the directory name of the running case.
• $FOAM_APPLICATION: the name of the running application.
OpenFOAM-10
U-110 OpenFOAM cases
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0.05;
}
pFinal
{
$p;
relTol 0;
}
Where a data lookup matches both a keyword and a regular expression, the keyword
match takes precedence irrespective of the order of the entries.
The file contains several calculations that calculate vertex ordinates, e.g. y, z, etc., from
geometry dimensions, e.g. radius. Calculations include standard C++ functions includ-
ing unit conversions, e.g. degToRad, and trigonometric functions, e.g. sin.
The #codeStream directive takes C++ code which is compiled and executed to deliver
the dictionary entry. The code and compilation instructions are specified through the
following keywords.
• code: specifies the code, called with arguments OStream& os and const dictionary&
dict which the user can use in the code, e.g. to lookup keyword entries from within
the current case dictionary (file).
OpenFOAM-10
4.3 Global controls U-111
4.2.15 Conditionals
Input files support two conditional directives: #if. . . #else. . . #endif; and, #ifEq. . .
#else. . . #endif. The #if conditional reads a switch that can be generated by a #calc
directive, e.g.:
angle 65;
laplacianSchemes
{
#if #calc "${angle} < 75"
default Gauss linear corrected;
#else
default Gauss linear limited corrected 0.5;
#endif
}
The #ifEq compares a word or string, and executes based on a match, e.g.:
ddtSchemes
{
#ifeq ${FOAM_APPLICATION} simpleFoam
default steadyState;
#else
default Euler;
#endif
}
OpenFOAM-10
U-112 OpenFOAM cases
DimensionedConstants
{
unitSet SI; // USCS
}
While a user could modify this setting in the etc/controlDict file in the installation,
it is better practice to use a file in their user directory. OpenFOAM provides a set of
directory locations, where global configuration files can be included, which it looks up in
an order of precedence. To list the locations, simply run the following command.
foamEtcFile -list
The listed locations include a local $HOME/.OpenFOAM directory and follow a descending
order of precedence, i.e. the last location listed (etc) is lowest precedence.
If a user therefore wished to work permanently in USCS units, they could maintain a
controlDict file in their $HOME/.OpenFOAM directory that includes the following entry.
DimensionedConstants
{
unitSet USCS;
}
OpenFOAM would read the unitSet entry from this file, but read all other controlDict
keyword entries from the global controlDict file.
Alternatively, if a user wished to work on a single case in USCS units, they could add
the same entry into the controlDict file in the system directory for their case. This file is
discussed in the next section.
OpenFOAM-10
4.4 Time and data input/output control U-113
OpenFOAM-10
U-114 OpenFOAM cases
endTime End time for the simulation when stopAt endTime; is specified.
deltaT Time step of the simulation.
OpenFOAM-10
4.5 Numerical schemes U-115
• gradSchemes: gradient ∇
• divSchemes: divergence ∇ •
• laplacianSchemes: Laplacian ∇2
Each keyword in represents the name of a sub-dictionary which contains terms of a par-
ticular type, e.g.gradSchemes contains all the gradient derivative terms such as grad(p)
(which represents ∇p). Further examples can be seen in the extract from an fvSchemes
dictionary below:
OpenFOAM-10
U-116 OpenFOAM cases
16
17 ddtSchemes
18 {
19 default Euler;
20 }
21
22 gradSchemes
23 {
24 default Gauss linear;
25 }
26
27 divSchemes
28 {
29 default none;
30
31 div(phi,U) Gauss linearUpwind grad(U);
32 div(phi,k) Gauss upwind;
33 div(phi,epsilon) Gauss upwind;
34 div(phi,R) Gauss upwind;
35 div(R) Gauss linear;
36 div(phi,nuTilda) Gauss upwind;
37
38 div((nuEff*dev2(T(grad(U))))) Gauss linear;
39 }
40
41 laplacianSchemes
42 {
43 default Gauss linear corrected;
44 }
45
46 interpolationSchemes
47 {
48 default linear;
49 }
50
51 snGradSchemes
52 {
53 default corrected;
54 }
55
56
57 // ************************************************************************* //
The example shows that the fvSchemes dictionary contains 6 . . . Schemes subdictionaries
containing keyword entries for each term specified within including: a default entry;
other entries whose names correspond to a word identifier for the particular term spec-
ified, e.g.grad(p) for ∇p If a default scheme is specified in a particular . . . Schemes
sub-dictionary, it is assigned to all of the terms to which the sub-dictionary refers, e.g.
specifying a default in gradSchemes sets the scheme for all gradient terms in the appli-
cation, e.g. ∇p, ∇U. When a default is specified, it is not necessary to specify each
specific term itself in that sub-dictionary, i.e. the entries for grad(p), grad(U) in this
example. However, if any of these terms are included, the specified scheme overrides the
default scheme for that term.
Alternatively the user can specify that no default scheme by the none entry, as in the
divSchemes in the example above. In this instance the user is obliged to specify all terms
in that sub-dictionary individually. Setting default to none may appear superfluous
since default can be overridden. However, specifying none forces the user to specify
all terms individually which can be useful to remind the user which terms are actually
present in the application.
OpenFOAM includes a vast number of discretisation schemes, from which only a
few are typically recommended for real-world, engineering applications. The user can
get help with scheme selection by interrogating the tutorial cases for example scheme
settings. They should look at the schemes used in relevant cases, e.g. for running a large-
eddy simulation (LES), look at schemes used in tutorials running LES. Additionally,
foamSearch provides a useful tool to get a quick list of schemes used in all the tutorials.
For example, to print all the default entries for ddtSchemes for cases in the $FOAM_-
OpenFOAM-10
4.5 Numerical schemes U-117
which prints:
default backward;
default CrankNicolson 0.9;
default Euler;
default localEuler;
default none;
default steadyState;
The schemes listed using foamSearch are described in the following sections.
Solvers are generally configured to simulate either transient or steady-state. Changing the
time scheme from one which is steady-state to transient, or visa versa, does not affect the
fundamental nature of the solver and so fails to achieve its purpose, yielding a nonsensical
solution.
Any second time derivative (∂ 2 /∂t2 ) terms are specified in the d2dt2Schemes sub-
dictionary. Only the Euler scheme is available for d2dt2Schemes.
OpenFOAM-10
U-118 OpenFOAM cases
The Gauss entry specifies the standard finite volume discretisation of Gaussian integra-
tion which requires the interpolation of values from cell centres to face centres. The
interpolation scheme is then given by the linear entry, meaning linear interpolation or
central differencing.
In some tutorials cases, particular involving poorer quality meshes, the discretisation
of specific gradient terms is overridden to improve boundedness and stability. The terms
that are overridden in those cases are the velocity gradient
They use the cellLimited scheme which limits the gradient such that when cell values
are extrapolated to faces using the calculated gradient, the face values do not fall outside
the bounds of values in surrounding cells. A limiting coefficient is specified after the
underlying scheme for which 1 guarantees boundedness and 0 applies no limiting; 1 is
invariably used.
Other schemes that are rarely used are as follows.
The treatment of advective terms is one of the major challenges in CFD numerics and
so the options are more extensive. The keyword identifier for the advective terms are
usually of the form div(phi,...), where phi generally denotes the (volumetric) flux of
velocity on the cell faces for constant-density flows and the mass flux for compressible
flows, e.g. div(phi,U) for the advection of velocity, div(phi,e) for the advection of
internal energy, div(phi,k) for turbulent kinetic energy, etc. For advection of velocity, the
user can run the foamSearch script to extract the div(phi,U) keyword from all tutorials.
OpenFOAM-10
4.5 Numerical schemes U-119
The schemes are all based on Gauss integration, using the flux phi and the advected
field being interpolated to the cell faces by one of a selection of schemes, e.g. linear,
linearUpwind, etc. There is a bounded variant of the discretisation, discussed later.
Ignoring ‘V’-schemes (with keywords ending “V”), and rarely-used schemes such as
Gauss cubic and vanLeerV, the interpolation schemes used in the tutorials are as follows.
• linear: second order, unbounded.
• linearUpwind: second order, upwind-biased, unbounded (but much less so than
linear), that requires discretisation of the velocity gradient to be specified.
• LUST: blended 75% linear/ 25%linearUpwind scheme, that requires discretisation
of the velocity gradient to be specified.
• limitedLinear: linear scheme that limits towards upwind in regions of rapidly
changing gradient; requires a coefficient, where 1 is strongest limiting, tending to-
wards linear as the coefficient tends to 0.
• upwind: first-order bounded, generally too inaccurate to be recommended.
Example syntax for these schemes is as follows.
‘V’-schemes are specialised versions of schemes designed for vector fields. They differ
from conventional schemes by calculating a single limiter which is applied to all compo-
nents of the vectors, rather than calculating separate limiters for each component of the
vector. The ‘V’-schemes’ single limiter is calculated based on the direction of most rapidly
changing gradient, resulting in the strongest limiter being calculated which is most stable
but arguably less accurate. Example syntax is as follows.
The bounded variants of schemes relate to the treatment of the material time derivative
which can be expressed in terms of a spatial time derivative and convection, e.g. for field
e in incompressible flow
De ∂e ∂e
= + U • ∇e = + ∇ • (Ue) − (∇ • U)e (4.1)
Dt ∂t ∂t
For numerical solution of incompressible flows, ∇ • U = 0 at convergence, at which point
the third term on the right hand side is zero. Before convergence is reached, however,
∇ • U ̸= 0 and in some circumstances, particularly steady-state simulations, it is better to
include the third term within a numerical solution because it helps maintain boundedness
of the solution variable and promotes better convergence. The bounded variant of the
Gauss scheme provides this, automatically including the discretisation of the third-term
with the advection term. Example syntax is as follows, as seen in fvSchemes files for
steady-state cases, e.g. for the simpleFoam tutorials
OpenFOAM-10
U-120 OpenFOAM cases
The schemes used for advection of scalar fields are similar to those for advection
of velocity, although in general there is greater emphasis placed on boundedness than
accuracy when selecting the schemes. For example, a search for schemes for advection of
internal energy (e) reveals the following.
In comparison with advection of velocity, there are no cases set up to use linear or
linearUpwind. Instead the limitedLinear and upwind schemes are commonly used,
with the additional appearance of vanLeer, another limited scheme, with less strong
limiting than limitedLinear.
There are specialised versions of the limited schemes for scalar fields that are commonly
bounded between 0 and 1, e.g. the laminar flame speed regress variable b. A search for
the discretisation used for advection in the laminar flame transport equation yields:
OpenFOAM-10
4.5 Numerical schemes U-121
default corrected;
default limited corrected 0.33;
default limited corrected 0.5;
default orthogonal;
default uncorrected;
The basis of the gradient calculation at a face is to subtract the value at the cell
centre on one side of the face from the value in the centre on the other side and divide
by the distance. The calculation is second-order accurate for the gradient normal to the
face if the vector connecting the cell centres is orthogonal to the face, i.e. they are at
right-angles. This is the orthogonal scheme.
Orthogonality requires a regular mesh, typically aligned with the Cartesian co-ordinate
system, which does not normally occur in meshes for real world, engineering geometries.
Therefore, to maintain second-order accuracy, an explicit non-orthogonal correction can
be added to the orthogonal component, known as the corrected scheme. The correction
increases in size as the non-orthogonality, the angle α between the cell-cell vector and
face normal vector, increases.
As α tends towards 90◦ , e.g. beyond 70◦ , the explicit correction can be so large to
cause a solution to go unstable. The solution can be stabilised by applying the limited
scheme to the correction which requires a coefficient ψ, 0 ≤ ψ ≤ 1 where
0 corresponds to uncorrected,
0.333 non-orthogonal correction ≤ 0.5 × orthogonal part,
ψ= (4.2)
0.5 non-orthogonal correction ≤ orthogonal part,
1 corresponds to corrected.
Typically, psi is chosen to be 0.33 or 0.5, where 0.33 offers greater stability and 0.5 greater
accuracy.
The corrected scheme applies under-relaxation in which the implicit orthogonal cal-
culation is increased by cos−1 α, with an equivalent boost within the non-orthogonal cor-
rection. The uncorrected scheme is equivalent to the corrected scheme, without the
non-orthogonal correction, so includes is like orthogonal but with the cos−1 α under-
relaxation.
Generally the uncorrected and orthogonal schemes are only recommended for meshes
with very low non-orthogonality (e.g. maximum 5◦ ). The corrected scheme is generally
recommended, but for maximum non-orthogonality above 70◦ , limited may be required.
At non-orthogonality above 80◦ , convergence is generally hard to achieve.
OpenFOAM-10
U-122 OpenFOAM cases
The user can search for the default scheme for laplacianSchemes in all the cases in the
$FOAM_TUTORIALS directory.
In all cases, the linear interpolation scheme is used for interpolation of the diffusivity.
The cases uses the same array of snGradSchemes based on level on non-orthogonality, as
described in section 4.5.4.
OpenFOAM-10
4.6 Solution and algorithm control U-123
33 U
34 {
35 solver smoothSolver;
36 smoother symGaussSeidel;
37 tolerance 1e-05;
38 relTol 0;
39 }
40 }
41
42 PISO
43 {
44 nCorrectors 2;
45 nNonOrthogonalCorrectors 0;
46 pRefCell 0;
47 pRefValue 0;
48 }
49
50
51 // ************************************************************************* //
fvSolution contains a set of subdictionaries, described in the remainder of this section that
includes: solvers; relaxationFactors; and, PISO, SIMPLE or PIMPLE.
The solvers distinguish between symmetric matrices and asymmetric matrices. The sym-
metry of the matrix depends on the terms of the equation being solved, e.g. time deriva-
tives and Laplacian terms form coefficients of a symmetric matrix, whereas an advective
derivative introduces asymmetry. If the user specifies a symmetric solver for an asymmet-
ric matrix, or vice versa, an error message will be written to advise the user accordingly,
e.g.
OpenFOAM-10
U-124 OpenFOAM cases
3
(
PBiCG
smoothSolver
GAMG
)
• the ratio of current to initial residuals falls below the solver relative tolerance,
relTol;
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0.05;
}
pFinal
{
OpenFOAM-10
4.6 Solution and algorithm control U-125
$p;
relTol 0;
}
If the case is specified to solve pressure 4 times within one time step, then the first 3
solutions would use the settings for p with relTol of 0.05, so that the cost of solving each
equation is relatively low. Only when the equation is solved the final (4th) time, it solves
to a residual level specified by tolerance (since relTol is 0, effectively deactivating it)
for greater accuracy, but at greater cost.
There are a range of options for preconditioning of matrices in the conjugate gradient
solvers, represented by the preconditioner keyword in the solver dictionary, listed be-
low. Note that the DIC/DILU preconditioners are exclusively specified in the tutorials in
OpenFOAM.
• none: no preconditioning.
The solvers that use a smoother require the choice of smoother to be specified. The
smoother options are listed below. The symGaussSeidel and GaussSeidel smoothers
are preferred in the tutorials.
• GaussSeidel: Gauss-Seidel.
When using the smooth solvers, the user can optionally specify the number of sweeps, by
the nSweeps keyword, before the residual is recalculated. Without setting it, it reverts to
a default value of 1.
OpenFOAM-10
U-126 OpenFOAM cases
The generalised method of geometric-algebraic multi-grid (GAMG) uses the principle of:
generating a quick solution on a mesh with a small number of cells; mapping this solution
onto a finer mesh; using it as an initial guess to obtain an accurate solution on the fine
mesh. GAMG is faster than standard methods when the increase in speed by solving first
on coarser meshes outweighs the additional costs of mesh refinement and mapping of field
data. In practice, GAMG starts with the mesh specified by the user and coarsens/refines
the mesh in stages. The user is only required to specify an approximate mesh size at the
most coarse level in terms of the number of cells
The agglomeration of cells is performed by the method specified by the agglomerator
keyword. The tutorials all use the default faceAreaPair method. The agglomeration can
be controlled using the following optional entries, most of which default in the tutorials.
OpenFOAM-10
4.6 Solution and algorithm control U-127
• No specified α: no under-relaxation.
An optimum choice of α is one that is small enough to ensure stable computation but
large enough to move the iterative process forward quickly; values of α as high as 0.9
can ensure stability in some cases and anything much below, say, 0.2 are prohibitively
restrictive in slowing the iterative process.
Relaxation factors for under-relaxation of fields are specified within a field sub-dictionary;
relaxation factors for equation under-relaxation are within a equations sub-dictionary. An
example is shown below from tutorial example of simpleFoam, showing typical settings for
an incompressible steady-state solver. The factors are specified for pressure p, pressure
U, and turbulent fields grouped using a regular expression.
54 relaxationFactors
55 {
56 fields
57 {
58 p 0.3;
59 }
60 equations
61 {
62 U 0.7;
63 "(k|omega|epsilon).*" 0.7;
64 }
65 }
66
67 // ************************************************************************* //
Another example for pimpleFoam, a transient incompressible solver, just uses under-
relaxation to ensure matrix diagonal equality, typical of transient simulations.
60 relaxationFactors
61 {
62 equations
63 {
64 ".*" 1;
65 }
66 }
67
68
69 // ************************************************************************* //
OpenFOAM-10
U-128 OpenFOAM cases
for coupling equations for momentum and mass conservation, PISO and PIMPLE being
used for transient problems and SIMPLE for steady-state.
Within in time, or solution, step, both algorithms solve a pressure equation, to enforce
mass conservation, with an explicit correction to velocity to satisfy momentum conserva-
tion. They optionally begin each step by solving the momentum equation — the so-called
momentum predictor.
While all the algorithms solve the same governing equations (albeit in different forms),
the algorithms principally differ in how they loop over the equations. The looping is
controlled by input parameters that are listed below. They are set in a dictionary named
after the algorithm, i.e. SIMPLE, PISO or PIMPLE.
• nCorrectors: used by PISO, and PIMPLE, sets the number of times the algorithm
solves the pressure equation and momentum corrector in each step; typically set to
2 or 3.
OpenFOAM-10
4.7 Case management tools U-129
foamDictionary system/fvSchemes
Without options, the utility lists all the keyword entries in the file, e.g. as follows for the
fvSchemes file in the pitzDaily tutorial case for simpleFoam.
{
FoamFile
{
version 2;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
ddtSchemes
{
default steadyState;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) bounded Gauss linearUpwind grad(U);
div(phi,k) bounded Gauss limitedLinear 1;
div(phi,epsilon) bounded Gauss limitedLinear 1;
div(phi,omega) bounded Gauss limitedLinear 1;
div(phi,v2) bounded Gauss limitedLinear 1;
div((nuEff*dev2(T(grad(U))))) Gauss linear;
div(nonlinearStress) Gauss linear;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
OpenFOAM-10
U-130 OpenFOAM cases
}
wallDist
{
method meshWave;
}
}
The -entry option allows the user to print the entry for a particular keyword, e.g.
divSchemes in the example below
The “/” syntax allows access to keywords with levels of sub-dictionary. For example,
the div(phi,U) keyword can be accessed within the divSchemes sub-dictionary by the
following command.
The example removes the keyword and terminating semicolon, leaving just the data.
bounded Gauss linearUpwind grad(U)
The example removes the keyword and terminating semicolon, leaving just the data.
OpenFOAM-10
4.7 Case management tools U-131
An alternative “=” syntax can be used with the -set option which is particularly useful
when modifying multiple entries:
foamDictionary can add entries with the -add option. If the user wishes to add an
entry named turbulence to divSchemes with the upwind scheme, they can enter the
following.
The search shows GAMG to be the most common choice in all the tutorials.
59 solver GAMG;
3 solver PBiCG;
18 solver PCG;
5 solver smoothSolver;
run
cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
cd pitzDaily
The mesh is generated for the case by going into the case directory and running blockMesh:
cd pitzDaily
blockMesh
OpenFOAM-10
U-132 OpenFOAM cases
The user might decide before running the simulation to configure some automatic post-
processing as described in Section 6.2. For example, the user can list the pre-configured
function objects by the following command:
postProcess -list
From the output, the user could select the patchFlowRate function to monitor the flow
rate at the outlet patch. The patchFlowRate configuration file can be copied into the
system directory using foamGet:
foamGet patchFlowRate
In order to monitor the flow through the outlet patch, the patch entry in patchFlowRate
file should be set as follows:
patch outlet;
The patchFlowRate configuration is then included in the case by adding to the functions
sub-dictionary in the controlDict file:
functions
{
...
#includeFunc writeObjects(kEpsilon:G) // existing entry
#includeFunc patchFlowRate
}
foamInfo simpleFoam
foamInfo flowRateInletVelocity
The output includes: the location of the source code header file for this boundary condi-
tion; the description and usage details from the header file; and, a list of example cases
that use the boundary condition.
The example usage for volumetric flow rate can be copied to replace the inlet boundary
condition in the pitzDaily example from Section 4.7.3. The volumetric flow rate, equivalent
to a uniform flow speed of 10 m/s, is 2.54 × 10−4 m3 /s so the modified inlet patch entry
in the U file in the 0 directory should be:
OpenFOAM-10
4.7 Case management tools U-133
inlet
{
type flowRateInletVelocity;
volumetricFlowRate 2.54e-4;
extrapolateProfile yes;
value uniform (0 0 0);
}
The simpleFoam solver can then be run. The solution at convergence (around 280 steps),
visualised in ParaView, shows a nonuniform velocity profile at the inlet, due to the extr-
apolateProfile being switched on. The flow rate at the outlet, from the function ob-
ject set up in Section 4.7.3, is written to a surfaceFieldValue.dat file in the postProcess-
ing/patchFlowRate/0 directory. The value converges towards the inlet flow rate.
OpenFOAM-10
U-134 OpenFOAM cases
OpenFOAM-10
Chapter 5
This chapter describes all topics relating to the creation of meshes in OpenFOAM: sec-
tion 5.1 gives an overview of the ways a mesh may be described in OpenFOAM; section 5.3
covers the blockMesh utility for generating simple meshes of blocks of hexahedral cells;
section 5.4 covers the snappyHexMesh utility for generating complex meshes of hexahedral
and split-hexahedral cells automatically from triangulated surface geometries; section 5.5
describes the options available for conversion of a mesh that has been generated by a
third-party product into a format that OpenFOAM can read.
5.1.1.1 Points
A point is a location in 3-D space, defined by a vector in units of metres (m). The points
are compiled into a list and each point is referred to by a label, which represents its
position in the list, starting from zero. The point list cannot contain any point that is not
part at least one face.
U-136 Mesh generation and conversion
5.1.1.2 Faces
A face is an ordered list of points, where a point is referred to by its label. The ordering
of point labels in a face is such that each two neighbouring points are connected by an
edge, i.e. you follow points as you travel around the circumference of the face. Faces are
compiled into a list and each face is referred to by its label, representing its position in
the list. The direction of the face normal vector is defined by the right-hand rule, i.e.
looking towards a face, if the numbering of the points follows an anti-clockwise path, the
normal vector points towards you, as shown in Figure 5.1.
2
3
Sf
4
0
Figure 5.1: Face area vector from point numbering on the face
• Internal faces, which connect two cells (and it can never be more than two). For
each internal face, the ordering of the point labels is such that the face normal points
into the cell with the larger label, i.e. for cells 2 and 5, the normal points into 5.
• Boundary faces, which belong to one cell since they coincide with the boundary
of the domain. A boundary face is therefore addressed by one cell(only) and a
boundary patch. The ordering of the point labels is such that the face normal
points outside of the computational domain.
Note that faces can be warped, i.e. the points of the face may not necessarily lie on a
plane.
5.1.1.3 Cells
A cell is a list of faces in arbitrary order. Cells must have the properties listed below.
• The cells must be contiguous,i.e. completely cover the computational domain and
must not overlap one another.
• Every cell must be closed geometrically, such that when all face area vectors are
oriented to point outwards of the cell, their sum should equal the zero vector to
machine accuracy;
• Every cell must be closed topologically such that all the edges in a cell are used by
exactly two faces of the cell in question.
OpenFOAM-10
5.1 Mesh description U-137
5.1.1.4 Boundary
A boundary is a list of patches, each of which is associated with a boundary condition.
A patch is a list of face labels which clearly must contain only boundary faces and no
internal faces. The boundary is required to be closed, i.e. the sum all boundary face area
vectors equates to zero to machine tolerance.
OpenFOAM-10
U-138 Mesh generation and conversion
7 6
1 2 4 5
3 2
3 2 4
3 1
Pyramid pyr 0 1 0 0
3
5
2
1 0 3
2 2 1
3 4
Tetrahedron tet 0 1 0
4 3
3
6
5
2 4
3
2 1 2
1
Tet-wedge tetWedge 0 1 0 0
OpenFOAM-10
5.2 Boundaries U-139
(
(0 0 0)
(1 0 0)
(1 1 0)
(0 1 0)
(0 0 0.5)
(1 0 0.5)
(1 1 0.5)
(0 1 0.5)
)
This forms the basis for the input syntax for the blockMesh mesh generator, described in
section 5.3.
5.2 Boundaries
In this section we discuss the way in which boundaries are treated in OpenFOAM. The
subject of boundaries is quite complex because their role in modelling is not simply that
of a geometric entity but an integral part of the solution and numerics through boundary
conditions or inter-boundary ‘connections’. A discussion of boundaries sits uncomfortably
between a discussion on meshes, fields, discretisation, computational processing etc.
We first need to consider that, for the purpose of applying boundary conditions, a
boundary is generally broken up into a set of patches. One patch may include one or
more enclosed areas of the boundary surface which do not necessarily need to be physically
connected. A type is assigned to every patch as part of the mesh description, as part
of the boundary file described in section 5.1.2. It describes the type of patch in terms of
geometry or a data ‘communication link’. An example boundary file is shown below for
a rhoPimpleFoam case. A type entry is clearly included for every patch (inlet, outlet,
etc.), with types assigned that include patch, symmetryPlane and empty.
16 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
17
18 6
19 (
20 inlet
21 {
22 type patch;
23 nFaces 50;
24 startFace 10325;
25 }
OpenFOAM-10
U-140 Mesh generation and conversion
26 outlet
27 {
28 type patch;
29 nFaces 40;
30 startFace 10375;
31 }
32 bottom
33 {
34 type symmetryPlane;
35 inGroups 1(symmetryPlane);
36 nFaces 25;
37 startFace 10415;
38 }
39 top
40 {
41 type symmetryPlane;
42 inGroups 1(symmetryPlane);
43 nFaces 125;
44 startFace 10440;
45 }
46 obstacle
47 {
48 type patch;
49 nFaces 110;
50 startFace 10565;
51 }
52 defaultFaces
53 {
54 type empty;
55 inGroups 1(empty);
56 nFaces 10500;
57 startFace 10675;
58 }
59 )
60
61 // ************************************************************************* //
The user can scan the tutorials for mesh generation configuration files, e.g. blockMeshDict
for blockMesh (see section 5.3) and snappyHexMeshDict for snappyHexMesh (see section 5.4,
for examples of different types being used. The following example provides documentation
and lists cases that use the symmetryPlane condition.
foamInfo -a symmetryPlane
The next example searches for snappyHexMeshDict files that specify the wall condition.
• wall: for patch that coincides with a solid wall, required for some physical modelling,
e.g. wall functions in turbulence modelling.
• symmetry: for any (non-planar) patch which uses the symmetry plane (slip) condi-
tion.
OpenFOAM-10
5.2 Boundaries U-141
wedge patch 2
wedge patch 1
• empty: for solutions in in 2 (or 1) dimensions (2D/1D), the type used on each patch
whose plane is normal to the 3rd (and 2nd) dimension for which no solution is
required.
• wedge: for 2 dimensional axi-symmetric cases, e.g. a cylinder, the geometry is speci-
fied as a wedge of small angle (e.g. 1◦ ) and 1 cell thick, running along the centre line,
straddling one of the coordinate planes, as shown in Figure 5.2; the axi-symmetric
wedge planes must be specified as separate patches of wedge type.
• cyclic: enables two patches to be treated as if they are physically connected; used for
repeated geometries; one cyclic patch is linked to another through a neighbourPatch
keyword in the boundary file; each pair of connecting faces must have similar area
to within a tolerance given by the matchTolerance keyword in the boundary file.
• cyclicAMI: like cyclic, but for 2 patches whose faces are non matching; used for sliding
interface in rotating geometry cases.
• processor: the type that describes inter-processor boundaries for meshes decomposed
for parallel running.
OpenFOAM-10
U-142 Mesh generation and conversion
28 outlet
29 {
30 type waveTransmissive;
31 field p;
32 psi thermo:psi;
33 gamma 1.4;
34 fieldInf 1;
35 lInf 3;
36 value uniform 1;
37 }
38
39 bottom
40 {
41 type symmetryPlane;
42 }
43
44 top
45 {
46 type symmetryPlane;
47 }
48
49 obstacle
50 {
51 type zeroGradient;
52 }
53
54 defaultFaces
55 {
56 type empty;
57 }
58 }
59
60 // ************************************************************************* //
Every patch includes a type entry that specifies the type of boundary condition. They
range from a basic fixedValue condition applied to the inlet, to a complex waveTransmissive
condition applied to the outlet. The patches with non-generic types, e.g. symmetryPlane,
defined in boundary, use consistent boundary condition types in the p file.
The main basic boundary condition types available in OpenFOAM are summarised
below using a patch field named Q. This is not a complete list; for all types see
$FOAM_SRC/finiteVolume/fields/fvPatchFields/basic.
OpenFOAM-10
5.2 Boundaries U-143
calculated by a function of other patch fields, time, geometric information, etc. Some other
conditions derived from mixed/directionMixed switch between fixedValue and fixedGradient
(usually zeroGradient).
There are a number of ways the user can list the available boundary conditions in
OpenFOAM, with the -listScalarBCs and -listVectorBCs utility being the quickest. The
boundary conditions for scalar fields and vector fields, respectively, can be listed for a
given solver, e.g. simpleFoam, as follows.
These produce long lists which the user can scan through. If the user wants more in-
formation of a particular condition, they can run the foamInfo script which provides a
description of the boundary condition and lists example cases where it is used. For ex-
ample, for the totalPressure boundary condition, run the following.
foamInfo totalPressure
In the following sections we will highlight some particular important, commonly used
boundary conditions.
OpenFOAM-10
U-144 Mesh generation and conversion
where the user specifies p0 through the p0 keyword. Solver applications which include
buoyancy effects, though a gravitational force ρg (per unit volume) source term, tend to
solve for a pressure field pρgh = p−ρ|g|∆h, where the hydrostatic component is subtracted
based on a height ∆h above some reference. For such solvers, e.g. interFoam, an equivalent
prghTotalPressure condition is applied which specifies:
p for outflow
0
pρgh = (5.3)
p0 − ρ|g|∆h − 2 ρ|U | for inflow (dynamic pressure, subsonic)
1 2
OpenFOAM-10
5.2 Boundaries U-145
45
46
47 // ************************************************************************* //
16 dimensions [1 -1 -2 0 0 0 0];
17
18 internalField uniform 0;
19
20 boundaryField
21 {
22 leftWall
23 {
24 type fixedFluxPressure;
25 value uniform 0;
26 }
27
28 rightWall
29 {
30 type fixedFluxPressure;
31 value uniform 0;
32 }
33
34 lowerWall
35 {
36 type fixedFluxPressure;
37 value uniform 0;
38 }
39
40 atmosphere
41 {
42 type prghTotalPressure;
43 p0 uniform 0;
44 }
45
46 defaultFaces
47 {
48 type empty;
49 }
50 }
51
52 // ************************************************************************* //
• table: inline list of (time value) pairs; interpolates values linearly between times.
OpenFOAM-10
U-146 Mesh generation and conversion
• scale: scales a given value function by a scalar scale function; both entries can be
themselves Function1; scale function is often a ramp function (below), with value
controlling the ramp value.
OpenFOAM-10
5.2 Boundaries U-147
amplitude 1;
scale 2; // Scale factor for wave
level 1; // Offset
}
}
inlet
{
type uniformFixedValue;
uniformValue
{
type sine;
frequency 10;
amplitude 1;
scale 2; // Scale factor for wave
level 1; // Offset
}
}
input // ramp from 0 -> 2, from t = 0 -> 0.4
{
type uniformFixedValue;
uniformValue
{
type scale;
scale linearRamp;
start 0;
duration 0.4;
value 2;
}
}
input // ramp from 2 -> 0, from t = 0 -> 0.4
{
type uniformFixedValue;
uniformValue
{
type scale;
scale reverseRamp;
ramp linearRamp;
start 0;
duration 0.4;
value 2;
}
}
inlet // pulse with value 2, from t = 0 -> 0.4
{
type uniformFixedValue;
uniformValue
{
type scale;
scale squarePulse
start 0;
duration 0.4;
value 2;
}
}
inlet
{
type uniformFixedValue;
uniformValue coded;
name pulse;
codeInclude
#{
#include "mathematicalConstants.H"
#};
code
#{
return scalar
(
0.5*(1 - cos(constant::mathematical::twoPi*min(x/0.3, 1)))
OpenFOAM-10
U-148 Mesh generation and conversion
);
#};
}
• vertices 5,6 and 7 are similarly found by moving in the x3 direction from vertices
1,2 and 3 respectively.
OpenFOAM-10
5.3 Mesh generation with the blockMesh utility U-149
7 2 6
6
7
5
4 3
10
11
9
8
3 1
2
x3 4 5
x2
0 x1 0 1
convertToMeters 0.001;
means that all coordinates are multiplied by 0.001, i.e. the values quoted in the blockMesh-
Dict file are in mm.
OpenFOAM-10
U-150 Mesh generation and conversion
vertices
(
( 0 0 0 ) // vertex number 0
( 1 0 0.1) // vertex number 1
( 1.1 1 0.1) // vertex number 2
( 0 1 0.1) // vertex number 3
(-0.1 -0.1 1 ) // vertex number 4
( 1.3 0 1.2) // vertex number 5
( 1.4 1.1 1.3) // vertex number 6
( 0 1 1.1) // vertex number 7
);
• arc: a circular arc with a single interpolation point or angle + axis (see below).
The keyword is then followed by the labels of the 2 vertices that the edge connects.
Following that, interpolation points must be specified through which the edge passes. For
an arc, either of the following is required: a single interpolation point, which the circular
arc will intersect; or an angle and rotation axis for the arc. For spline, polyLine and
BSpline, a list of interpolation points is required. For our example block in Figure 5.3
we specify an arc edge connecting vertices 1 and 5 as follows through the interpolation
point (1.1, 0.0, 0.5):
edges
(
arc 1 5 (1.1 0.0 0.5)
);
For the angle and axis specification of an arc, the syntax is of the form:
edges
(
arc 1 5 25 (0 1 0) // 25 degrees, y-normal
);
OpenFOAM-10
5.3 Mesh generation with the blockMesh utility U-151
blocks
(
hex (0 1 2 3 4 5 6 7) // vertex numbers
(10 10 10) // numbers of cells in each direction
simpleGrading (1 2 3) // cell expansion ratios
);
The definition of each block is as follows. The first entry is the shape identifier of the
block, as defined in the $FOAM_ETC/cellModels file. The shape is always hex since
the blocks are always hexahedra. There follows a list of vertex numbers, ordered in the
manner described on page U-148.
The second entry gives the number of cells in each of the x1 x2 and x3 directions for
that block. The third entry gives the cell expansion ratios for each direction in the block.
The expansion ratio enables the mesh to be graded, or refined, in specified directions. The
ratio is that of the width of the end cell δe along one edge of a block to the width of the
start cell δs along that edge, as shown in Figure 5.4.
Each of the following keywords specify one of two types of grading specification avail-
able in blockMesh.
• edgeGrading: The full cell expansion description gives a ratio for each edge of the
block, numbered according to the scheme shown in Figure 5.3 with the arrows rep-
resenting the direction from first cell. . . to last cell e.g.
edgeGrading (1 1 1 1 2 2 2 2 3 3 3 3)
This means the ratio of cell widths along edges 0-3 is 1, along edges 4-7 is 2 and along
8-11 is 3 and is directly equivalent to the simpleGrading example given above.
δe
δs Expansion ratio = δe
δs
Expansion direction
Figure 5.4: Mesh grading along a block edge
OpenFOAM-10
U-152 Mesh generation and conversion
grading within separate divisions of a single block, rather than have to define several
blocks with one grading per block. For example, to mesh a channel with two opposing
walls and grade the mesh towards the walls requires three regions: two with grading to
the wall with one in the middle without grading.
OpenFOAM v2.4+ includes multi-grading functionality that can divide a block in an
given direction and apply different grading within each division. This multi-grading is
specified by replacing any single value expansion ratio in the grading specification of the
block, e.g. “1”, “2”, “3” in
blocks
(
hex (0 1 2 3 4 5 6 7) (100 300 100)
simpleGrading (1 2 3);
);
• include 30% of the total cells in the y-direction (300) in each divisions 1 and 3 and
the remaining 40% in division 2;
blocks
(
hex (0 1 2 3 4 5 6 7) (100 300 100)
simpleGrading
(
1 // x-direction expansion ratio
(
(0.2 0.3 4) // 20% y-dir, 30% cells, expansion = 4
(0.6 0.4 1) // 60% y-dir, 40% cells, expansion = 1
(0.2 0.3 0.25) // 20% y-dir, 30% cells, expansion = 0.25 (1/4)
)
3 // z-direction expansion ratio
)
);
Both the fraction of the block and the fraction of the cells are normalized automatically.
They can be specified as percentages, fractions, absolute lengths, etc. and do not need to
sum to 100, 1, etc. The example above can be specified using percentages, e.g.
blocks
(
hex (0 1 2 3 4 5 6 7) (100 300 100)
simpleGrading
OpenFOAM-10
5.3 Mesh generation with the blockMesh utility U-153
(
1
(
(20 30 4) // 20%, 30%...
(60 40 1)
(20 30 0.25)
)
3
)
);
• type: the patch type, either a generic patch on which some boundary conditions
are applied or a particular geometric condition, as listed in section 5.2.1;
• faces: a list of block faces that make up the patch and whose name is the choice of
the user, although we recommend something that conveniently identifies the patch,
e.g.inlet; the name is used as an identifier for setting boundary conditions in the
field data files.
blockMesh collects faces from any boundary patch that is omitted from the boundary
list and assigns them to a default patch named defaultFaces of type empty. This means
that for a 2 dimensional geometry, the user has the option to omit block faces lying in
the 2D plane, knowing that they will be collected into an empty patch as required.
Returning to the example block in Figure 5.3, if it has an inlet on the left face, an
output on the right face and the four other faces are walls then the patches could be
defined as follows:
boundary // keyword
(
inlet // patch name
{
type patch; // patch type for patch 0
faces
(
(0 4 7 3) // block face in this patch
);
} // end of 0th patch definition
OpenFOAM-10
U-154 Mesh generation and conversion
(
(1 2 6 5)
);
}
walls
{
type wall;
faces
(
(0 1 5 4)
(0 3 2 1)
(3 7 6 2)
(4 5 6 7)
);
}
);
Each block face is defined by a list of 4 vertex numbers. The order in which the vertices
are given must be such that, looking from inside the block and starting with any vertex,
the face must be traversed in a clockwise direction to define the other vertices.
When specifying a cyclic patch in blockMesh, the user must specify the name of the
related cyclic patch through the neighbourPatch keyword. For example, a pair of cyclic
patches might be specified as follows:
left
{
type cyclic;
neighbourPatch right;
faces ((0 4 7 3));
}
right
{
type cyclic;
neighbourPatch left;
faces ((1 5 6 2));
}
OpenFOAM-10
5.3 Mesh generation with the blockMesh utility U-155
mergePatchPairs
(
( <masterPatch> <slavePatch> ) // merge patch pair 0
( <masterPatch> <slavePatch> ) // merge patch pair 1
...
)
• the faces of the slave patch are projected onto the master patch where there is some
separation between slave and master patch;
• the location of any vertex of a slave face might be adjusted by blockMesh to eliminate
any face edge that is shorter than a minimum tolerance;
• if patches overlap as shown in Figure 5.5, each face that does not merge remains as
an external face of the original patch, on which boundary conditions must then be
applied;
• if all the faces of a patch are merged, then the patch itself will contain no faces and
is removed.
patch 1
patch 2
The consequence is that the original geometry of the slave patch will not necessarily be
completely preserved during merging. Therefore in a case, say, where a cylindrical block
is being connected to a larger block, it would be wise to the assign the master patch to the
cylinder, so that its cylindrical shape is correctly preserved. There are some additional
recommendations to ensure successful merge procedures:
OpenFOAM-10
U-156 Mesh generation and conversion
• in 2 dimensional geometries, the size of the cells in the third dimension, i.e. out of
the 2D plane, should be similar to the width/height of cells in the 2D plane;
• where a patch to be merged shares a common edge with another patch to be merged,
both should be declared as a master patch.
The user can then project vertices, edges and/or faces onto the cylinder surface with the
project keyword using example syntax shown below:
vertices
(
project (-1 -0.1 -1) (cylinder)
project ( 1 -0.1 -1) (cylinder)
...
);
edges
(
project 0 1 (cylinder)
...
);
faces
(
project (0 4 7 3) cylinder
...
);
The use of this functionality is demonstrated in tutorials which can be located by searching
for the project keyword in all the blockMeshDict files by:
OpenFOAM-10
5.3 Mesh generation with the blockMesh utility U-157
vertices
(
name v0 project (-1 -0.1 -1) (cylinder)
name v1 project ( 1 -0.1 -1) (cylinder)
...
);
edges
(
project v0 v1 (cylinder)
...
);
When a name is provided for a given entity, it can be used to replace the index. In the
example about, rather than specify the edge using vertex indices 0 and 1, the names v0
and v1 are used.
hex (0 1 2 3 4 5 5 4)
7 6
4 5
3
2
0 1
Figure 5.6: Creating a wedge shaped block with 6 vertices
The same applies to the patches with the main consideration that the block face
containing the collapsed vertices, previously (4 5 6 7) now becomes (4 5 5 4). This is
a block face of zero area which creates a patch with no faces in the polyMesh, as the user
can see in a boundary file for such a case. The patch should be specified as empty in the
blockMeshDict and the boundary condition for any fields should consequently be empty
also.
OpenFOAM-10
U-158 Mesh generation and conversion
The blockMeshDict file must exist in the system (or constant/polyMesh) directory.
STL surface
OpenFOAM-10
5.4 Mesh generation with the snappyHexMesh utility U-159
The snappyHexMeshDict dictionary includes: switches at the top level that control the
various stages of the meshing process; and, individual sub-directories for each process.
The entries are listed below.
geometry
{
sphere1 // User defined region name
{
type triSurfaceMesh;
file "sphere1.obj"; // surface geometry OBJ file
regions
{
secondSolid // Named region in the OBJ file
{
name mySecondPatch; // User-defined patch name
} // otherwise given sphere1_secondSolid
}
}
box1x1x1 // User defined region name
{
type searchableBox; // region defined by bounding box
min (1.5 1 -0.5);
max (3.5 2 0.5);
}
sphere2 // User defined region name
{
type searchableSphere; // region defined by bounding sphere
centre (1.5 1.5 1.5);
radius 1.03;
}
};
OpenFOAM-10
U-160 Mesh generation and conversion
OpenFOAM-10
5.4 Mesh generation with the snappyHexMesh utility U-161
• insidePoint: location vector inside the region to be meshed; vector must not
coincide with a cell face either before or during refinement.
The splitting process begins with cells being selected according to specified edge fea-
tures first within the domain as illustrated in Figure 5.9. The features list in the
castellatedMeshControls sub-dictionary permits dictionary entries containing a name of an
edgeMesh file and the level of refinement, e.g.:
features
(
{
file "features.eMesh"; // file containing edge mesh
level 2; // level of refinement
}
);
The edgeMesh containing the features can be extracted from the tri-surface file using the
surfaceFeatures utility which specifies the tri-surface and controls such as included angle
through a surfaceFeaturesDict configuration file, examples of which can be found in several
tutorials and at $FOAM_ETC/caseDicts/surface/surfaceFeaturesDict. The utility is simply
run by executing the following in a terminal
surfaceFeatures
Following feature refinement, cells are selected for splitting in the locality of specified
surfaces as illustrated in Figure 5.10. The refinementSurfaces dictionary in castel-
latedMeshControls requires dictionary entries for each STL surface and a default level
specification of the minimum and maximum refinement in the form (<min> <max>).
The minimum level is applied generally across the surface; the maximum level is ap-
plied to cells that can see intersections that form an angle in excess of that specified by
resolveFeatureAngle.
The refinement can optionally be overridden on one or more specific region of an STL
surface. The region entries are collected in a regions sub-dictionary. The keyword for
each region entry is the name of the region itself and the refinement level is contained
within a further sub-dictionary. An example is given below:
OpenFOAM-10
U-162 Mesh generation and conversion
refinementSurfaces
{
sphere1
{
level (2 2); // default (min max) refinement for whole surface
regions
{
secondSolid
{
level (3 3); // optional refinement for secondSolid region
}
}
}
}
OpenFOAM-10
5.4 Mesh generation with the snappyHexMesh utility U-163
the <distance> is not required so is ignored (but it must be specified). Examples are
shown below:
refinementRegions
{
box1x1x1
{
mode inside;
levels ((1.0 4)); // refinement level 4 (1.0 entry ignored)
}
sphere1
{ // refinement level 5 within 1.0 m
mode distance; // refinement level 3 within 2.0 m
levels ((1.0 5) (2.0 3)); // levels must be ordered nearest first
}
}
OpenFOAM-10
U-164 Mesh generation and conversion
{
mode insideSpan;
levels ((1000 2));
cellsAcrossSpan 40;
}
}
The example shows a refinement region inside the pipeWall surface in which a maximum
2 levels of refinement is guaranteed within a specified distance of 1000 from the wall. The
span-based refinement, specified by the insideSpan mode, enables the user to guarantee
at least 40 cellsAcrossSpan, i.e. across the pipe diameter.
1. displace the vertices in the castellated boundary onto the STL surface;
2. solve for relaxation of the internal mesh with the latest displaced boundary vertices;
4. reduce the displacement of those vertices from their initial value (at 1) and repeat
from 2 until mesh quality is satisfied.
An example is illustrated in the schematic in Figure 5.13 (albeit with mesh motion that
looks slightly unrealistic).
1. the mesh is projected back from the surface by a specified thickness in the direction
normal to the surface;
2. solve for relaxation of the internal mesh with the latest projected boundary vertices;
OpenFOAM-10
5.4 Mesh generation with the snappyHexMesh utility U-165
OpenFOAM-10
U-166 Mesh generation and conversion
3. check if validation criteria are satisfied otherwise reduce the projected thickness and
return to 2; if validation cannot be satisfied for any thickness, do not insert layers;
5. the mesh is checked again; if the checks fail, layers are removed and we return to 2.
The layer addition procedure uses the settings in the addLayersControls sub-dictionary
in snappyHexMeshDict; entries are listed below. The user has the option of 4 different
layer thickness parameters — expansionRatio, finalLayerThickness, firstLayer-
Thickness, thickness — from which they must specify 2 only; more than 2, and the
problem is over-specified.
• relativeSizes: switch that sets whether the specified layer thicknesses are relative
to undistorted cell size outside layer or absolute.
• expansionRatio: expansion factor for layer mesh, increase in size from one layer
to the next.
• thickness: total thickness of all layers of cells, usually in combination with absolute
sizes according to the
• relativeSizes entry.
• nGrow: number of layers of connected faces that are not grown if points do not get
extruded; helps convergence of layer addition close to features.
OpenFOAM-10
5.4 Mesh generation with the snappyHexMesh utility U-167
• nRelaxedIter: max number of iterations after which the controls in the relaxed sub
dictionary of meshQuality are used (typically 20).
The layers sub-dictionary contains entries for each patch on which the layers are to be
applied and the number of surface layers required. The patch name is used because the
layers addition relates to the existing mesh, not the surface geometry; hence applied to a
patch, not a surface region. An example layers entry is as follows:
layers
{
sphere1_firstSolid
{
nSurfaceLayers 1;
}
maxY
{
nSurfaceLayers 1;
}
}
• minVol: minimum cell pyramid volume (typically 1e-13, large negative number
disables).
OpenFOAM-10
U-168 Mesh generation and conversion
• relaxed: sub-dictionary that can include modified values for the above keyword
entries to be used when nRelaxedIter is exceeded in the layer addition process.
fluentMeshToFoam reads a Fluent.msh mesh file, working for both 2-D and 3-D cases;
5.5.1 fluentMeshToFoam
Fluent writes mesh data to a single file with a .msh extension. The file must be written
in ASCII format, which is not the default option in Fluent. It is possible to convert
single-stream Fluent meshes, including the 2 dimensional geometries. In OpenFOAM, 2
dimensional geometries are currently treated by defining a mesh in 3 dimensions, where
the front and back plane are defined as the empty boundary patch type. When reading
a 2 dimensional Fluent mesh, the converter automatically extrudes the mesh in the third
direction and adds the empty patch, naming it frontAndBackPlanes.
The following features should also be observed.
• The OpenFOAM converter will attempt to capture the Fluent boundary condition
definition as much as possible; however, since there is no clear, direct correspondence
between the OpenFOAM and Fluent boundary conditions, the user should check the
boundary conditions before running a case.
• Multiple material meshes are not permitted. If multiple fluid materials exist, they
will be converted into a single OpenFOAM mesh; if a solid region is detected, the
converter will attempt to filter it out.
• Fluent allows the user to define a patch which is internal to the mesh, i.e. consists
of the faces with cells on both sides. Such patches are not allowed in OpenFOAM
and the converter will attempt to filter them out.
OpenFOAM-10
5.5 Mesh conversion U-169
The procedure of converting a Fluent.msh file is first to create a new OpenFOAM case
by creating the necessary directories/files: the case directory containing a controlDict file
in a system subdirectory. Then at a command prompt the user should execute:
fluentMeshToFoam <meshFile>
where <meshFile> is the name of the .msh file, including the full or relative path.
5.5.2 starToFoam
This section describes how to convert a mesh generated on the STAR-CD code into a form
that can be read by OpenFOAM mesh classes. The mesh can be generated by any of the
packages supplied with STAR-CD, i.e.PROSTAR, SAMM, ProAM and their derivatives.
The converter accepts any single-stream mesh including integral and arbitrary couple
matching and all cell types are supported. The features that the converter does not
support are:
• sliding interfaces.
For multi-stream meshes, mesh conversion can be achieved by writing each individual
stream as a separate mesh and reassemble them in OpenFOAM.
OpenFOAM adopts a policy of only accepting input meshes that conform to the
fairly stringent validity criteria specified in section 5.1. It will simply not run using
invalid meshes and cannot convert a mesh that is itself invalid. The following sections
describe steps that must be taken when generating a mesh using a mesh generating
package supplied with STAR-CD to ensure that it can be converted to OpenFOAM format.
To avoid repetition in the remainder of the section, the mesh generation tools supplied
with STAR-CD will be referred to by the collective name STAR-CD.
OpenFOAM-10
U-170 Mesh generation and conversion
The CSET should be empty. If this is not the case, examine the cells in CSET and adjust
the model. If the cells are genuinely not desired, they can be removed using the PROSTAR
command:
CDEL CSET
Before discarding these unwanted vertices, the unwanted boundary faces have to be col-
lected before purging:
If the BSET is not empty, the unwanted boundary faces can be deleted using:
BDEL BSET
At this time, the model should contain only the fluid cells and the supporting vertices,
as well as the defined boundary faces. All boundary faces should be fully supported by the
vertices of the cells, if this is not the case, carry on cleaning the geometry until everything
is clean.
OpenFOAM-10
5.5 Mesh conversion U-171
2. Define an extra boundary region with the same parameters as the default region
0 and add all visible faces into the new region, say 10, by selecting a zone option
in the boundary tool and drawing a polygon around the entire screen draw of the
model. This can be done by issuing the following commands in PROSTAR:
RDEF 10 WALL
BZON 10 ALL
3. We shall remove all previously defined boundary types from the set. Go through
the boundary regions:
CHECK ALL
GEOM
Internal PROSTAR checking is performed by the last two commands, which may reveal
some other unforeseeable error(s). Also, take note of the scaling factor because PROSTAR
only applies the factor for STAR-CD and not the geometry. If the factor is not 1, use the
scalePoints utility in OpenFOAM.
OpenFOAM-10
U-172 Mesh generation and conversion
The components of the computational grid must then be written to their own files. This
is done using PROSTAR for boundaries by issuing the command
BWRITE
by default, this writes to a .23 file (versions prior to 3.0) or a .bnd file (versions 3.0 and
higher). For cells, the command
CWRITE
outputs the cells to a .14 or .cel file and for vertices, the command
VWRITE
outputs to file a .15 or .vrt file. The current default setting writes the files in ASCII
format. If couples are present, an additional couple file with the extension .cpl needs to
be written out by typing:
CPWRITE
After outputting to the three files, exit PROSTAR or close the files. Look through
the panels and take note of all STAR-CD sub-models, material and fluid properties used
– the material properties and mathematical model will need to be set up by creating and
editing OpenFOAM dictionary files.
The procedure of converting the PROSTAR files is first to create a new OpenFOAM
case by creating the necessary directories. The PROSTAR files must be stored within the
same directory and the user must change the file extensions: from .23, .14 and .15 (below
STAR-CD version 3.0), or .pcs, .cls and .vtx (STAR-CD version 3.0 and above); to .bnd,
.cel and .vrt respectively.
If the ordinates are written in scientific notation and are negative, there may be no space
between values, e.g.:
OpenFOAM-10
5.5 Mesh conversion U-173
The starToFoam converter reads the data using spaces to delimit the ordinate values and
will therefore object when reading the previous example. Therefore, OpenFOAM includes
a simple script, foamCorrectVrt to insert a space between values where necessary, i.e. it
would convert the previous example to:
The foamCorrectVrt script should therefore be executed if necessary before running the
starToFoam converter, by typing:
foamCorrectVrt <file>.vrt
starToFoam <meshFilePrefix>
where <meshFilePrefix> is the name of the prefix of the mesh files, including the full or
relative path. After the utility has finished running, OpenFOAM boundary types should
be specified by editing the boundary file by hand.
5.5.3 gambitToFoam
GAMBIT writes mesh data to a single file with a .neu extension. The procedure of con-
verting a GAMBIT.neu file is first to create a new OpenFOAM case, then at a command
prompt, the user should execute:
gambitToFoam <meshFile>
where <meshFile> is the name of the .neu file, including the full or relative path.
The GAMBIT file format does not provide information about type of the boundary
patch, e.g. wall, symmetry plane, cyclic. Therefore all the patches have been created as
type patch. Please reset after mesh conversion as necessary.
5.5.4 ideasToFoam
OpenFOAM can convert a mesh generated by I-DEAS but written out in ANSYS format
as a .ans file. The procedure of converting the .ans file is first to create a new OpenFOAM
case, then at a command prompt, the user should execute:
ideasToFoam <meshFile>
where <meshFile> is the name of the .ans file, including the full or relative path.
OpenFOAM-10
U-174 Mesh generation and conversion
5.5.5 cfx4ToFoam
CFX writes mesh data to a single file with a .geo extension. The mesh format in CFX is
block-structured, i.e. the mesh is specified as a set of blocks with glueing information and
the vertex locations. OpenFOAM will convert the mesh and capture the CFX boundary
condition as best as possible. The 3 dimensional ‘patch’ definition in CFX, containing
information about the porous, solid regions etc. is ignored with all regions being converted
into a single OpenFOAM mesh. CFX supports the concept of a ‘default’ patch, where
each external face without a defined boundary condition is treated as a wall. These faces
are collected by the converter and put into a defaultFaces patch in the OpenFOAM
mesh and given the type wall; of course, the patch type can be subsequently changed.
Like, OpenFOAM 2 dimensional geometries in CFX are created as 3 dimensional
meshes of 1 cell thickness. If a user wishes to run a 2 dimensional case on a mesh created
by CFX, the boundary condition on the front and back planes should be set to empty;
the user should ensure that the boundary conditions on all other faces in the plane of the
calculation are set correctly. Currently there is no facility for creating an axi-symmetric
geometry from a 2 dimensional CFX mesh.
The procedure of converting a CFX.geo file is first to create a new OpenFOAM case,
then at a command prompt, the user should execute:
cfx4ToFoam <meshFile>
where <meshFile> is the name of the .geo file, including the full or relative path.
OpenFOAM-10
5.6 Mapping fields between different geometries U-175
Coincident patches:
can be mapped using patchMap
OpenFOAM-10
U-176 Mesh generation and conversion
OpenFOAM-10
Chapter 6
Post-processing
This chapter describes options for post-processing with OpenFOAM. OpenFOAM is sup-
plied with a post-processing utility paraFoam that uses ParaView, an open source visuali-
sation application described in section 6.1.
Other methods of post-processing using third party products are offered, including
EnSight, Fieldview and the post-processing supplied with Fluent.
ParaView is launched and opens the window shown in Figure 6.1. The case is controlled
from the left panel, which contains the following:
U-178 Post-processing
• The Pipeline Browser lists the modules opened in ParaView, where the selected
modules are highlighted in blue and the graphics for the given module can be en-
abled/disabled by clicking the eye button alongside;
• The Properties panel contains the input selections for the case, such as times, regions
and fields; it includes the Display panel that controls the visual representation of
the selected module, e.g. colours;
• Other panels can be selected from the View menu, including the Information panel
which gives case statistics such as mesh geometry and size.
ParaView operates a tree-based structure in which data can be filtered from the top-
level case module to create sets of sub-modules. For example, a contour plot of, say,
pressure could be a sub-module of the case module which contains all the pressure data.
The strength of ParaView is that the user can create a number of sub-modules and display
whichever ones they feel to create the desired image or animation. For example, they
may add some solid geometry, mesh and velocity vectors, to a contour plot of pressure,
switching any of the items on and off as necessary.
The general operation of the system is based on the user making a selection and then
clicking the green Apply button in the Properties panel. The additional buttons are: the
Reset button which can be used to reset the GUI if necessary; and, the Delete button that
will delete the active module.
OpenFOAM-10
6.1 ParaView/paraFoam graphical user interface (GUI) U-179
user can select mesh and field data which is loaded for all time directories into ParaView.
The buttons in the Current Time Controls and VCR Controls toolbars then select the
time data to be displayed, as shown is section 6.1.4.
As with any operation in paraFoam, the user must click Apply after making any changes
to any selections. The Apply button is highlighted in green to alert the user if changes have
been made but not accepted. This method of operation has the advantage of allowing the
user to make a number of selections before accepting them, which is particularly useful
in large cases where data processing is best kept to a minimum.
If new data is written to time directories while the user is running ParaView, the user
must load the additional time directories by checking the Refresh Times button. Where
there are occasions when the case data changes on file and ParaView needs to load the
changes, the user can also check the Update GUI button in the Parameters panel and apply
the changes.
OpenFOAM-10
U-180 Post-processing
• the data range may not be automatically updated to the max/min limits of a field,
so the user should take care to select Rescale at appropriate intervals, in particular
after loading the initial case module;
• clicking the Edit Color Map button, brings up a window in which there are two
panels:
1. The Color Scale panel in which the colours within the scale can be chosen. The
standard blue to red colour scale for CFD can be selected by clicking Choose
Preset and selecting Blue to Red Rainbox HSV.
2. The Color Legend panel has a toggle switch for a colour bar legend and contains
settings for the layout of the legend, e.g. font.
OpenFOAM-10
6.1 ParaView/paraFoam graphical user interface (GUI) U-181
• the geometry, e.g. a mesh (if Wireframe is selected), can be visualised as a single
colour by selecting Solid Color from the Color By menu and specifying the colour
in the Set Ambient Color window;
• the image can be made translucent by editing the value in the Opacity text box (1
= solid, 0 = invisible) in the Style panel.
OpenFOAM-10
U-182 Post-processing
OpenFOAM-10
6.1 ParaView/paraFoam graphical user interface (GUI) U-183
then applying the Glyph filter to the resulting cell centre data.
6.1.8 Streamlines
Streamlines are created by first creating tracer lines using the Stream Tracer filter. The
tracer Seed panel specifies a distribution of tracer points over a Line Source or Point
Cloud. The user can view the tracer source, e.g. the line, but it is displayed in white, so
they may need to change the background colour in order to see it.
The distance the tracer travels and the length of steps the tracer takes are specified in
the text boxes in the main Stream Tracer panel. The process of achieving desired tracer
lines is largely one of trial and error in which the tracer lines obviously appear smoother
as the step length is reduced but with the penalty of a longer calculation time.
Once the tracer lines have been created, the Tubes filter can be applied to the Tracer
module to produce high quality images. The tubes follow each tracer line and are not
strictly cylindrical but have a fixed number of sides and given radius. When the number
of sides is set above, say, 10, the tubes do however appear cylindrical, but again this adds
a computational cost.
OpenFOAM-10
U-184 Post-processing
Both approaches have advantages. Conventional post-processing allows the user to choose
how to analyse data after the results are obtained. Run-time processing offers greater
flexibility because it has access to all the data in the database of the run at all times,
rather than just the data written during the simulation. It also allows the user to monitor
processed data during a simulation and provides a greater level of convenience because
the processed results can be available immediately to the user when the simulation ends.
There are 3 methods of post-processing that cover the options described above
• Every solver can be run with the -postProcess option, which only executes post-
processing, but with additional access to data available on the database for the
particular solver.
simpleFoam -listFunctionObjects
The list represents the underlying post-processing functionality. Almost all the function-
ality is packaged into a set of configured tools that are conveniently integrated within the
post-processing CLI. Those tools are located in $FOAM_ETC/caseDicts/postProcessing
and are listed by running postProcess with the -list option.
postProcess -list
This produces a list of tools that are described in the following sections.
components Writes the component scalar fields (e.g. Ux, Uy, Uz) of a field (e.g. U).
OpenFOAM-10
6.2 Post-processing command line interface (CLI) U-185
CourantNo Calculates the Courant Number field from the flux field.
fieldAverage Calculates and writes the time averages of a given list of fields.
flowType Calculates and writes the flowType of velocity field where: -1 = rotational flow;
0 = simple shear flow; +1 = planar extensional flow.
Lambda2 Calculates and writes the second largest eigenvalue of the sum of the square of
the symmetrical and anti-symmetrical parts of the velocity gradient tensor.
MachNo Calculates the Mach Number field from the velocity field.
PecletNo Calculates the Peclet Number field from the flux field.
vorticity Calculates the vorticity field, i.e. the curl of the velocity field.
wallHeatFlux Calculates the heat flux at wall patches, outputting the data as a volVec-
torField.
OpenFOAM-10
U-186 Post-processing
wallShearStress Calculates the shear stress at wall patches, outputting the data as a vol-
VectorField.
writeCellCentres Writes the cell-centres volVectorField and the three component fields as
volScalarFields; useful for post-processing thresholding.
writeVTK Writes out specified objects in VTK format, e.g. fields, stored on the case
database.
yPlus Calculates the turbulence y+, outputting the data as a yPlus field.
divide From the first field, divide the remaining fields in the list.
subtract From the first field, subtracts the remaining fields in the list.
forcesCompressible Calculates pressure and viscous forces over specified patches for a case
where the solver is compressible (pressure is in units M/(LTˆ2), e.g. Pa).
forcesIncompressible Calculates pressure and viscous forces over specified patches for a
case where the solver is incompressible (pressure is kinematic, e.g. mˆ2/sˆ2).
graphUniform Writes graph data for specified fields along a line, specified by start and end
points. A specified number of graph points are used, distributed uniformly along
the line.
graphCellFace Writes graph data for specified fields along a line, specified by start and
end points. One graph point is generated on each face and in each cell that the line
intersects.
OpenFOAM-10
6.2 Post-processing command line interface (CLI) U-187
graphFace Writes graph data for specified fields along a line, specified by start and end
points. One graph point is generated on each face that the line intersects.
graphLayerAverage Generates plots of fields averaged over the layers in the mesh
cellMaxMag Writes out the maximum cell value magnitude for one or more fields.
cellMin Writes out the minimum cell value for one or more fields.
cellMinMag Writes out the maximum cell value magnitude for one or more fields.
6.2.1.8 Control
stopAtClockTime Stops the run when the specified clock time in second has been reached
and optionally write results before stopping.
stopAtFile Stops the run when the file stop is created in the case directory.
time Writes run time, CPU time and clock time and optionally the CPU and clock times
per time step.
writeObjects Writes out specified objects, e.g. fields, stored on the case database.
totalPressureCompressible Calculates the total pressure field in normal units, i.e. Pa in SI,
for a case where the solver is compressible.
totalPressureIncompressible Calculates the total pressure field for a case where the solver
is incompressible, in kinematic units, i.e. m2 /s2 in SI.
OpenFOAM-10
U-188 Post-processing
6.2.1.10 Combustion
Qdot Calculates and outputs the heat release rate for the current combustion model.
XiReactionRate Writes the turbulent flame-speed and reaction-rate volScalarFields for
the Xi-based combustion models.
6.2.1.11 Multiphase
populationBalanceMoments Calculates and writes out integral (integer moments) or mean
properties (mean, variance, standard deviation) of a size distribution computed with
multiphaseEulerFoam. Requires solver post-processing.
phaseForces Calculates the blended interfacial forces acting on a given phase, i.e. drag,
virtual mass, lift, wall-lubrication and turbulent dispersion. Note that it works only
in solver post-processing mode and in combination with multiphaseEulerFoam. For
a simulation involving more than two phases, the accumulated force is calculated
by looping over all phasePairs the phase is a part of.
phaseMap Writes the phase-fraction map field alpha.map with incremental value ranges
for each phase e.g., with values 0 for water, 1 for air, 2 for oil, etc.
populationBalanceSizeDistribution Writes out the size distribution computed with multiphase-
EulerFoam for the entire domain or a volume region. Requires solver post-processing.
6.2.1.12 Probes
boundaryProbes Writes out values of fields at a cloud of points, interpolated to specified
boundary patches.
interfaceHeight Reports the height of the interface above a set of locations. For each
location, it writes the vertical distance of the interface above both the location and
the lowest boundary. It also writes the point on the interface from which these
heights are computed.
internalProbes Writes out values of fields interpolated to a specified cloud of points.
probes Writes out values of fields from cells nearest to specified locations.
OpenFOAM-10
6.2 Post-processing command line interface (CLI) U-189
triSurfaceDifference Calculates the difference between the average values of fields on two
specified triangulated surfaces.
phaseScalarTransport Solves a transport equation for a scalar field within one phase of a
multiphase simulation.
isoSurface Writes out iso-surface files with interpolated field data in VTK format.
patchSurface Writes out patch surface files with interpolated field data in VTK format.
streamlinesLine Writes out files of stream lines with interpolated field data in VTK format,
with initial points uniformly distributed along a line.
streamlinesPatch Writes out files of stream lines with interpolated field data in VTK
format, with initial points randomly selected within a patch.
streamlinesPoints Writes out files of stream lines with interpolated field data in VTK
format, with specified initial points.
streamlinesSphere Writes out files of stream lines with interpolated field data in VTK
format, with initial points randomly selected within a sphere.
functions
{
#includeFunc flowRatePatch
... other function objects here ...
}
OpenFOAM-10
U-190 Post-processing
That will include the functionality in the flowRatePatch configuration file, located in the
directory hierarchy beginning with $FOAM_ETC/caseDicts/postProcessing.
The configuration of flowRatePatch requires the name of the patch to be supplied.
Option 1 for doing this is that the user copies the flowRatePatch file into their case system
directory. The foamGet script copies the file conveniently, e.g.
foamGet flowRatePatch
The patch name can be edited in the copied file to be outlet. When the solver is run,
it will pick up an included function in the local case system directory, in precedence
over $FOAM_ETC/caseDicts/postProcessing. The flow rate through the patch will be
calculated and written out into a file within a directory named postProcessing.
Option 2 for specifying the patch name is to provide the name as an argument to the
flowRatePatch in the #includeFunc directive, using the syntax keyword=entry.
functions
{
#includeFunc flowRatePatch(patch=outlet)
... other function objects here ...
}
In the case where the keyword is field or fields, only the entry is needed when
specifying an argument to a function. For example, if the user wanted to calculate and
write out the magnitude of velocity into time directories during a simulation they could
simply add the following to the functions sub-dictionary in controlDict.
functions
{
#includeFunc mag(U)
... other function objects here ...
}
This works because the function’s argument U is represented by the keyword field, see
$FOAM_ETC/caseDicts/postProcessing/fields/mag.
Some functions require the setting of many parameters, e.g. to calculate forces and
generate elements for visualisation, etc. For those functions, it is more reliable and con-
venient to copy and configure the function using option 1 (above) rather than through
arguments.
run
cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
OpenFOAM-10
6.2 Post-processing command line interface (CLI) U-191
cd pitzDaily
blockMesh
simpleFoam
Now the user can run execute post-processing functions with postProcess. The -help
option provides a summary of its use.
postProcess -help
Simple functions like mag can be executed using the -func option; text on the command
line generally needs to be quoted (". . . ") if it contains punctuation characters.
This operation calculates and writes the field of magnitude of velocity into a file named
mag(U) in each time directory. Similarly, the flowRatePatch example can be executed
using postProcess.
Let us say the user now wants to calculate total pressure = p + |U |2 /2 for incompressible
flow with kinematic pressure, p. The function is available, named totalPressureIncompress-
ible, which the user could attempt first to run as follows.
The error message is telling the user that the pressure field p is not loaded; the same is
true of the velocity field U. For the function to work, both fields can be loaded as comma
separated arguments.
Alternatively the user can load a space separated list of fields using the -fields option,
which the function can access.
Both options work effectively because the pressure and velocity data is available directly
from the files, p and U.
OpenFOAM-10
U-192 Post-processing
Even loading relevant fields, the post-processing fails with the following message.
The message is telling us that the postProcess utility has not constructed the necessary
models that the solver, simpleFoam, used when running the simulation, i.e. a turbulence
model. This is a situation where we need to post-process (as opposed to run-time process)
using the solver with the -postProcess option so that the modelling will be available
that the post-processing function needs. Help for this operation can be printed with the
following command.
It can be seen that the options for a solver with -postProcess are the same as when
running postProcess utility. This means that the -func option can be used to execute the
wallShearStress function effectively.
Note that no fields need to be supplied, either by function arguments "(p,U)" or us-
ing "-fields (p U)", because simpleFoam itself constructs and stores the required fields.
Functions can also be selected by the #includeFunc directive in functions in the con-
trolDict file, instead of the -func option.
• probes identifies the nearest cells to the probe locations and writes out the cell
values; data is written into a single file in time-value format, suitable for plotting a
graph.
OpenFOAM-10
6.3 Sampling and monitoring data U-193
• boundaryProbes and internalProbes interpolate field data to the probe locations, with
the locations being snapped onto boundaries for boundaryProbes; data sets are writ-
ten to separate files at scheduled write times (like fields). data.
Generally probes is more suitable for monitoring values at smaller numbers of locations,
whereas the other functions are typically for sampling at large numbers of locations.
As an example, the user could use the pitzDaily case set up in section 6.2.3. The probes
function is best configured by copying the file to the local system directory using foamGet.
foamGet probes
The user can modify the probeLocations in the probes file as follows.
12
13 #includeEtc "caseDicts/postProcessing/probes/probes.cfg"
14
15 fields (p U);
16 probeLocations
17 (
18 (0.01 0 0)
19 );
20
21 // ************************************************************************* //
functions
{
#includeFunc probes
... other function objects here ...
}
When simpleFoam is run, time-value data is written into p and U files in postProcess-
ing/probes/0.
foamGet graphUniform
The start and end points of the line, along which data is sampled, should be edited; the
entries below provide a vertical line across the full height of the geometry 0.01 m beyond
the back step.
13
14 start (0.01 0.025 0);
15 end (0.01 -0.025 0);
16 nPoints 100;
17
18 fields (U p);
19
20 axis distance; // The independent variable of the graph. Can be "x",
21 // "y", "z", "xyz" (all coordinates written out), or
22 // "distance" (from the start point).
23
24 #includeEtc "caseDicts/postProcessing/graphs/graphUniform.cfg"
25
26 // ************************************************************************* //
OpenFOAM-10
U-194 Post-processing
functions
{
#includeFunc graphUniform
... other function objects here ...
}
simpleFoam can be then run; try running simply with the -postProcess option. Distance-
value data is written into files in time directories within postProcessing/graphUniform. The
user can quickly display the data for x-component of velocity, Ux in the last time 296, by
running gnuplot and plotting values.
gnuplot
gnuplot> set style data linespoints
gnuplot> plot "postProcessing/graphUniform/296/line_U.xy" u 2:1
This produces the graph shown in Figure 6.5. The formatting of the graph is specified
It shows that the sampling type is lineUniform, meaning the sampling uses a uniform
distribution of points along a line. The other parameters are included by macro expansion
OpenFOAM-10
6.3 Sampling and monitoring data U-195
from the main file and specify the line start and end, the number of points and the distance
parameter specified on the horizontal axis of the graph.
An alternative graph function object, graphCell, samples the data at locations nearest
to the cell centres. The user can copy that function object file and configure it as shown
below.
13
14 start (0.01 -0.025 0);
15 end (0.01 0.025 0);
16 fields (U p);
17
18 axis distance; // The independent variable of the graph. Can be "x",
19 // "y", "z", "xyz" (all coordinates written out), or
20 // "distance" (from the start point).
21
22 #includeEtc "caseDicts/postProcessing/graphs/graphCell.cfg"
23
24 // ************************************************************************* //
foamGet cutPlaneSurface
The file is configured by setting the origin and normal of the plane and the field data to
be sampled. We can edit the file to produce a cutting plane along the pitzDaily geometry,
normal to the z-direction.
16
17 fields (p U);
18
19 interpolate true; // If false, write cell data to the surface triangles.
20 // If true, write interpolated data at the surface points.
21
22 #includeEtc "caseDicts/postProcessing/surface/cutPlaneSurface.cfg"
23
24 // ************************************************************************* //
OpenFOAM-10
U-196 Post-processing
The function can be included as normal by adding the #includeFunc directive to functions
in the controlDict file. Alternatively, the user could test running the function using the
solver post-processing by the following command.
This produces VTK format files of the cutting plane with pressure and velocity data in
time directories in the postProcessing/cutPlaneSurface directory. The user can display
the cutting plane by opening ParaView (type paraview), then doing File->Open and
selecting one of the files, e.g. postProcessing/cutPlaneSurface/296/U_zNormal.vtk as shown
in Figure 6.7.
functions
{
#includeFunc residuals
... other function objects here ...
}
The default fields whose residuals are captured are p and U. Should the user wish to
configure other fields, they should make copy the residuals file in their system and edit
the fields entry accordingly. All functions files are within the $FOAM_ETC/caseDicts
directory. The residuals file can be located using foamInfo:
foamInfo residuals
It can then be copied into the system directory conveniently using foamGet:
foamGet residuals
OpenFOAM-10
6.4 Third-Party post-processing U-197
The user should then run foamMonitor using the -l option for a log scale y-axis on the
residuals file as follows. If the command is executed before the simulation is complete,
they can see the graph being updated live.
foamMonitor -l postProcessing/residuals/0/residuals.dat
It produces the graph of residuals for pressure and velocity in Figure 6.8.
OpenFOAM-10
U-198 Post-processing
• converting the OpenFOAM data to EnSight format with the foamToEnsight utility;
• reading the OpenFOAM data directly into EnSight using the ensight74FoamExec
module.
1. from the EnSight GUI, the user should select Data (Reader) from the File menu;
3. the Format selector should be set to Case, the EnSight default setting;
1. from the EnSight GUI, the user should select Data (Reader) from the File menu;
2. The user should now be able to select the OpenFOAM from the Format menu; if not,
there is a problem with the configuration described above.
OpenFOAM-10
6.4 Third-Party post-processing U-199
Environment variable
Description and options
$CEI_HOME Path where EnSight is installed, eg /usr/local/ensight, added
to the system path by default
$CEI_ARCH Machine architecture, from a choice of names cor-
responding to the machine directory names in
$CEI_HOME/ensight74/machines; default settings include
linux_2.4 and sgi_6.5_n32
$ENSIGHT7_READER Path that EnSight searches for the user defined libuserd-foam
reader library, set by default to $FOAM_LIBBIN
$ENSIGHT7_INPUT Set by default to dummy
3. The user should find their case directory from the File Selection window, highlight
one of top 2 entries in the Directories box ending in /. or /.. and click (Set)
Geometry.
4. The path field should now contain an entry for the case. The (Set) Geometry text
box should contain a ‘/’.
5. The user may now click Okay and EnSight will begin reading the data.
6. When the data is read, a new Data Part Loader window will appear, asking which
part(s) are to be read. The user should select Load all.
7. When the mesh is displayed in the EnSight window the user should close the Data
Part Loader window, since some features of EnSight will not work with this window
open.
OpenFOAM-10
U-200 Post-processing
OpenFOAM-10
Chapter 7
OpenFOAM includes a large range of solvers, each designed for a specific class of flow,
as described in section 3.5. Each solver uses a particular set of models which calculate
physical properties and simulate phenomena like transport, turbulence, thermal radiation,
etc.
From OpenFOAM v10 onwards, a distinction is made between material properties
and models for phenomena such as those mentioned above. Properties are specified
in physicalProperties file in the constant directory. In the case of fluids, properties in
physicalProperties relate to a fluid at rest. They are the properties you might look up
from a table in a book, so can be dependent on temperature T , based on some function.
Properties described in physicalProperties do not include any dependency on the flow
itself. For example, turbulence, visco-elasticity and the variation of viscosity ν with
strain-rate, are all specified in a momentumTransport file in the constant directory. This
chapter includes a description of models for viscosity which are dependent on strain-rate
in section 7.3 and turbulence models in section 7.2. Thermophysical models, which are
specified in the physicalProperties file (since they represent temperature dependency of
properties) are described in section 7.1.
thermoType
{
type hePsiThermo;
U-202 Models and physical properties
mixture pureMixture;
transport const;
thermo hConst;
equationOfState perfectGas;
specie specie;
energy sensibleEnthalpy;
}
The keyword entries specify the choice of thermophysical models, e.g. transport
constant (constant viscosity, thermal diffusion), equationOfState perfectGas , etc. In
addition there is a keyword entry named energy that allows the user to specify the form
of energy to be used in the solution and thermodynamics. The following sections explains
the entries and options in the thermoType package.
psiThermo Thermophysical model for gases only, with fixed composition, used by rhoCen-
tralFoam.
OpenFOAM-10
7.1 Thermophysical models U-203
For mixtures with variable composition, required by thermophysical models with re-
actions, the multicomponentMixture option is used. Species and reactions are listed in a
chemistry file, specified by the foamChemistryFile keyword. The multicomponentMixture
model then requires the thermophysical models coefficients to be specified for each specie
within sub-dictionaries named after each specie, e.g. O2, N2.
For combustion based on laminar flame speed and regress variables, constituents are
a set of mixtures, such as fuel, oxidant and burntProducts. The available mixture
models for this combustion modelling are homogeneousMixture, inhomogeneousMixture
and veryInhomogeneousMixture.
Other models for variable composition are egrMixture, singleComponentMixture.
logPolynomial calculates ln(µ) and ln(κ) as a function of ln(T ) from a polynomial of any
order N ; from which µ, κ are calculated by taking the exponential, e.g.:
∑
N −1
ln(µ) = ai [ln(T )]i . (7.3)
i=0
OpenFOAM-10
U-204 Models and physical properties
OpenFOAM-10
7.1 Thermophysical models U-205
ρ = ρ0 [1 − β (T − T0 )] (7.12)
icoTabulated Tabulated data for an incompressible fluid using (T, ρ) value pairs, e.g.
rho ( (200 1010) (400 980) );
OpenFOAM-10
U-206 Models and physical properties
where ci and hif are the molar fraction and heat of formation, respectively, of specie
i. In most cases, we use the sensible form of energy, for which it is easier to account
for energy change due to reactions. Keyword entries for energy therefore include e.g.
sensibleEnthalpy, sensibleInternalEnergy and absoluteEnthalpy.
OpenFOAM-10
7.1 Thermophysical models U-207
specie containing i.e. number of moles, nMoles, of the specie, and molecular weight,
molWeight in units of g/mol;
thermodynamics containing coefficients for the chosen thermodynamic model (see below);
transport containing coefficients for the chosen tranpsort model (see below).
The following is an example entry for a specie named fuel modelled using sutherland
transport and janaf thermodynamics:
fuel
{
specie
{
nMoles 1;
molWeight 16.0428;
}
thermodynamics
{
Tlow 200;
Thigh 6000;
Tcommon 1000;
highCpCoeffs (1.63543 0.0100844 -3.36924e-06 5.34973e-10
-3.15528e-14 -10005.6 9.9937);
lowCpCoeffs (5.14988 -0.013671 4.91801e-05 -4.84744e-08
1.66694e-11 -10246.6 -4.64132);
}
transport
{
As 1.67212e-06;
Ts 170.672;
}
}
The following is an example entry for a specie named air modelled using const transport
and hConst thermodynamics:
air
{
specie
{
nMoles 1;
molWeight 28.96;
}
thermodynamics
OpenFOAM-10
U-208 Models and physical properties
{
Cp 1004.5;
Hf 2.544e+06;
}
transport
{
mu 1.8e-05;
Pr 0.7;
}
}
simpleFoam -listMomentumTransportModels
With simpleFoam, the incompressible models are listed. The compressible models are
listed for a compressible solver, e.g. rhoSimpleFoam.
The RAS models used in the tutorials can be listed using foamSearch with the following
command. The lists of available models are given in the following sections.
Users can locate tutorials using a particular model, e.g. buoyantKEpsilon, using foamInfo.
foamInfo buoyantKEpsilon
OpenFOAM-10
7.2 Turbulence models U-209
LRR Launder, Reece and Rodi Reynolds-stress turbulence model for incompressible flows.
LaunderSharmaKE Launder and Sharma low-Reynolds k-epsilon turbulence model for in-
compressible flows.
LienCubicKE Lien cubic non-linear low-Reynolds k-epsilon turbulence models for incom-
pressible flows.
LienLeschziner Lien and Leschziner low-Reynolds number k-epsilon turbulence model for
incompressible flows.
SSG Speziale, Sarkar and Gatski Reynolds-stress turbulence model for incompressible
flows.
kOmega2006 Standard (2006) high Reynolds-number k-omega turbulence model for in-
compressible flows.
qZeta Gibson and Dafa’Alla’s q-zeta two-equation low-Re turbulence model for incom-
pressible flows
v2f Lien and Kalitzin’s v2-f turbulence model for incompressible flows, with a limit im-
posed on the turbulent viscosity given by Davidson et al.
OpenFOAM-10
U-210 Models and physical properties
OpenFOAM-10
7.2 Turbulence models U-211
OpenFOAM-10
U-212 Models and physical properties
There are a number of wall function models available in the release, e.g. nutWallFunction,
nutRoughWallFunction, nutUSpaldingWallFunction, nutkWallFunction and nutkAtm-
WallFunction. The user can get the full list of wall function models using foamInfo:
foamInfo wallFunction
Within each wall function boundary condition the user can over-ride default settings for
E, κ and Cµ through optional E, kappa and Cmu keyword entries.
Having selected the particular wall functions on various patches in the nut/mut file,
the user should select epsilonWallFunction on corresponding patches in the epsilon field
and kqRwallFunction on corresponding patches in the turbulent fields k, q and R.
viscosityModel constant;
nu 1.5e-05;
This viscosity is a single value which is constant in time and uniform over the solution
domain. Non-Newtonian models can be specified in the momentumTransport file, includ-
ing:
• a family of generalisedNewtonian
√ models for a non-uniform viscosity which is a func-
tion of strain rate γ̇ = 2| symm(∇U)|, described in sections 7.3.1, 7.3.2, 7.3.3,
7.3.4, 7.3.5 and 7.3.6;
OpenFOAM-10
7.3 Transport/rheology models U-213
• a set of visco-elastic models, including Maxwell, Giesekus and PTT (Phan-Thien &
Tanner), described in sections 7.3.7, 7.3.8 and 7.3.9, respectively;
• the lambdaThixotropic model, described in section 7.3.10.
nuInf 1e-05;
k 1;
n 0.5;
The constant, uniform viscosity at zero strain-rate, ν0 , is specified in the physicalProperties
file.
nuInf 1e-05;
m 1;
n 0.5;
The constant, uniform viscosity at zero strain-rate, ν0 , is specified in the physicalProperties
file.
nuMax 1e-03;
nuMin 1e-05;
k 1e-05;
n 0.5;
OpenFOAM-10
U-214 Models and physical properties
viscosityModel HerschelBulkley;
tau0 0.01;
k 0.001;
n 0.5;
viscosityModel Casson;
m 3.934986e-6;
tau0 2.9032e-6;
nuMax 13.3333e-6;
nuMin 3.9047e-6;
viscosityModel strainRateFunction;
OpenFOAM-10
7.3 Transport/rheology models U-215
simulationType laminar;
laminar
{
model Maxwell;
MaxwellCoeffs
{
nuM 0.002;
lambda 0.03;
}
}
simulationType laminar;
laminar
{
model Giesekus;
GiesekusCoeffs
{
nuM 0.002;
lambda 0.03;
alphaG 0.1;
}
}
OpenFOAM-10
U-216 Models and physical properties
The Giesekus model includes a multi-mode option where τ is a sum of stresses, each with
an associated relaxation time λ and mobility coefficient αG .
simulationType laminar;
laminar
{
model PTT;
PTTCoeffs
{
nuM 0.002;
lambda 0.03;
epsilon 0.25;
}
}
The PTT model includes a multi-mode option where τ is a sum of stresses, each with an
associated relaxation time λ and extensibility coefficient ε.
∂λ
+ ∇ • (Uλ) = a(1 − λ)b − cγ̇ d λ (7.30)
∂t
with model coefficients a, b, c and d. The viscosity ν is then calculated according to:
ν∞
ν= (7.31)
1 − Kλ2
√
where the parameter K = ν∞ /ν0 . The viscosities ν0 and ν∞ are limiting values corre-
sponding to λ = 1 and λ = 0.
An example specification of the model in momentumTransport is:
simulationType laminar;
OpenFOAM-10
7.3 Transport/rheology models U-217
laminar
{
model lambdaThixotropic;
lambdaThixotropicCoeffs
{
a 1;
b 2;
c 1e-3;
d 3;
nu0 0.1;
nuInf 1e-4;
}
}
OpenFOAM-10
U-218 Models and physical properties
OpenFOAM-10
Index U-219
Index
Symbols Numbers A B C D E F G H I J K L M N O P Q R S T U V W X Z
OpenFOAM-10
U-220 Index
OpenFOAM-10
Index U-221
OpenFOAM-10
U-222 Index
OpenFOAM-10
Index U-223
OpenFOAM-10
U-224 Index
OpenFOAM-10
Index U-225
OpenFOAM-10
U-226 Index
OpenFOAM-10
Index U-227
OpenFOAM-10
U-228 Index
OpenFOAM-10
Index U-229
OpenFOAM-10
U-230 Index
OpenFOAM-10
Index U-231
OpenFOAM-10
U-232 Index
OpenFOAM-10
Index U-233
OpenFOAM-10
U-234 Index
OpenFOAM-10
Index U-235
OpenFOAM-10
U-236 Index
OpenFOAM-10
Index U-237
OpenFOAM-10
U-238 Index
OpenFOAM-10
Index U-239
OpenFOAM-10