Beruflich Dokumente
Kultur Dokumente
Master Thesis
Author(s):
Wthrich, Benjamin
Publication Date:
2007
Permanent Link:
https://doi.org/10.3929/ethz-a-005575219
Rights / License:
In Copyright - Non-Commercial Use Permitted
This page was generated automatically upon download from the ETH Zurich Research Collection. For more
information please consult the Terms of use.
ETH Library
Institute of Fluid Dynamics
Benjamin Wuthrich
Master Thesis SS 07
Written at
ABB Corporate Research
Baden-Dattwil
iii
Contents
Notation ix
1 Introduction 1
1.1 Self-blast circuit breakers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Challenges in simulating the switching procedure . . . . . . . . . . . . . . 2
1.3 Objective of this thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Conventions and structure of this report . . . . . . . . . . . . . . . . . . . 3
1.4.1 Typesetting conventions . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4.2 Structure of this report . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4.3 The difference between verification and validation . . . . . . . . . . 4
3 Verification cases 13
3.1 The shock tube problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.1.1 Description and relevance . . . . . . . . . . . . . . . . . . . . . . . 14
3.1.2 Analytical solution . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.1.3 Solver quality evaluation . . . . . . . . . . . . . . . . . . . . . . . . 22
3.1.4 Temporal convergence . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.1.5 Spatial convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.1.6 Algorithm analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.1.7 Comparison to CFD-ACE+ . . . . . . . . . . . . . . . . . . . . . . 32
3.1.8 Insights gained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.2 The supersonic wedge problem . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.2.1 Description and relevance . . . . . . . . . . . . . . . . . . . . . . . 34
3.2.2 Analytical solution . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.2.3 Solver quality evaluation . . . . . . . . . . . . . . . . . . . . . . . . 41
3.2.4 Spatial convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.2.5 Comparison to CFD-ACE+ . . . . . . . . . . . . . . . . . . . . . . 46
3.2.6 Insights gained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
v
Validation of OpenFOAM for nozzle flows Contents
4 Validation cases 49
4.1 The backward facing step problem . . . . . . . . . . . . . . . . . . . . . . . 49
4.1.1 Description and relevance . . . . . . . . . . . . . . . . . . . . . . . 49
4.1.2 Solver quality evaluation . . . . . . . . . . . . . . . . . . . . . . . . 51
4.1.3 Insights gained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.2 The transonic diffuser problem . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.2.1 Description and relevance . . . . . . . . . . . . . . . . . . . . . . . 55
4.2.2 Solver quality evaluation . . . . . . . . . . . . . . . . . . . . . . . . 59
4.2.3 Insights gained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Acknowledgements 77
References 80
A Contents of the CD 81
C Additional results 87
C.1 Shock tube plots from the solver quality evaluation . . . . . . . . . . . . . 87
C.2 Supersonic wedge plots from the solver quality evaluation . . . . . . . . . . 89
vi
List of Figures
1.1 Gas insulated switchgear . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Self-blast circuit breaker . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3.1 Example of a shock tube . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.2 Shock tube initial conditions, pressure along the tube . . . . . . . . . . . . 15
3.3 Shock tube after the diaphragm is broken . . . . . . . . . . . . . . . . . . . 16
3.4 Setup for OpenFOAM solver evaluations at time t = 0 . . . . . . . . . . . 16
3.5 Characteristics for an expansion wave centred at 0 . . . . . . . . . . . . . . 19
3.6 1D mesh for the shock tube problem . . . . . . . . . . . . . . . . . . . . . 23
3.7 2D mesh for the shock tube problem . . . . . . . . . . . . . . . . . . . . . 23
3.8 Axi-symmetric mesh for the shock tube problem . . . . . . . . . . . . . . . 24
3.9 3D mesh for the shock tube problem . . . . . . . . . . . . . . . . . . . . . 24
3.10 Pressure comparison of OpenFOAM solvers . . . . . . . . . . . . . . . . . 26
3.11 Pressure distribution at t = 2.5 104 s for the rhoSonicFoam solver . . . . . 27
3.12 Temporal convergence/CPU time requirements for laminar solvers . . . . . 28
3.13 Temporal convergence/CPU time requirements for turbulent solvers . . . . 29
3.14 Spatial convergence/CPU time requirements for laminar solvers . . . . . . 30
3.15 Spatial convergence/CPU time requirements for turbulent solvers . . . . . 30
3.16 CFD-ACE+ computations compared to analytical solution . . . . . . . . . 33
3.17 Supersonic wedge flows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.18 Setup for OpenFOAM evaluations of the supersonic wedge problem . . . . 36
3.19 Oblique shock wave . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.20 --Ma relation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.21 The mesh for the supersonic wedge problem . . . . . . . . . . . . . . . . . 41
3.22 Analytical Mach number for the wedge problem . . . . . . . . . . . . . . . 42
3.23 OpenFOAM Mach number results, laminar . . . . . . . . . . . . . . . . . . 42
3.24 Comparison of laminar solver parallel samples to analytical solution . . . . 43
3.25 OpenFOAM Mach number results, turbulent . . . . . . . . . . . . . . . . . 44
3.26 Comparison of turbulent solver samples to analytical solution . . . . . . . . 44
3.27 Mesh convergence for the wedge case . . . . . . . . . . . . . . . . . . . . . 46
3.28 New sample locations for the wedge case . . . . . . . . . . . . . . . . . . . 47
3.29 Mesh convergence for the wedge case (downstream of shock) . . . . . . . . 48
3.30 CFD-ACE+ solution for the wedge case . . . . . . . . . . . . . . . . . . . 48
4.1 The backward facing step problem . . . . . . . . . . . . . . . . . . . . . . . 50
4.2 The mesh for the backward facing step case . . . . . . . . . . . . . . . . . 50
4.3 Velocity field in the neighbourhood of the step . . . . . . . . . . . . . . . . 51
4.4 Backward step solution obtained with the finer mesh . . . . . . . . . . . . 53
4.5 Pressure field for the steady-state solution . . . . . . . . . . . . . . . . . . 54
4.6 Pressure sample comparison for the backward facing step . . . . . . . . . . 55
4.7 The transonic diffuser setup . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.8 The geometry of the transonic diffuser . . . . . . . . . . . . . . . . . . . . 57
4.9 Mesh for the transonic diffuser . . . . . . . . . . . . . . . . . . . . . . . . . 57
4.10 Steady-state diffuser velocity field for R = 0.13 . . . . . . . . . . . . . . . . 58
4.11 Weak shock solution for the diffuser . . . . . . . . . . . . . . . . . . . . . . 58
vii
Validation of OpenFOAM for nozzle flows List of Figures
viii
Notation
Roman symbols
ix
Validation of OpenFOAM for nozzle flows Notation
continued
Greek symbols
x
(a) (b)
Figure 1.1: Gas insulated switchgear, type ABB ELK-3 (voltage up to 550 kV): (a) pho-
tography; (b) schematic drawing. (Source: http://www.abb.com/)
1 Introduction
Switch components are a key element in the journey of electrical energy from the generator
to the consumer; the reliability of our energy supply depends heavily on their proper
functioning. Switchgear enables the actual distribution of electricity and the combination
of load as necessary: almost every major branch is connected to a hub by means of a
switching device.
Circuit breakers are an integral part of switchgear: they take care of protecting their
respective circuit from faults such as overload or short circuit by actuallyas their name
suggestsbreaking the circuit. This is effected by mechanically opening a contact, much
like pulling the plug of a household appliance; the difference is that circuit breakers do
so automatically at the right time and that for higher voltages, some issues arise when
pulling the plug.
A switching device for high voltage (up to 500 kV) is shown in Fig. 1.1; our principal
interest lies in the part labelled 1, the circuit breaker. The device seen here is so called
gas insulated switchgear (GIS): the contacts are insulated by pressurised SF6 , a gas with
excellent insulating properties.
Switching high voltages gives rise to the phenomenon of the light arc: the gas between
the contacts is ionised and becomes a conductor. To definitely break the circuit, this arc
has to be quenched. One of the methods to do so is the motivation for this thesis.
In Section 1.1, a type of circuit breakers that use the energy of the arc to have it
extinguish itself is presented. Section 1.2 outlines the difficulties in simulating this process;
in Section 1.3, the ultimate goal of this thesis is described. Section 1.4 finally explains
the typesetting conventions of this document and gives an overview of the content of the
other chapters.
1
Validation of OpenFOAM for nozzle flows 1 Introduction
Figure 1.2: Functioning principle of a self-blast circuit breaker: the heat of the arc is used
to build up pressure, which induces a flow back to the arc, finally extinguishing it (source:
http://en.wikipedia.org).
2
1.3 Objective of this thesis Validation of OpenFOAM for nozzle flows
shocks), fluid-structure interaction and the physics of the transient burning arc, circuit
breaker development would profit immensely. Understandably, this has not been achieved
yet but is a declared long-term goal. However, already coupling computational electro-
magnetics (CEM) and computational fluid dynamics (CFD) to computational magneto-
hydrodynamics (CMHD) for compressible fluids is a very challenging task.
Various attempts at solving or simulating at least partial aspects of the above problem
have been undertaken:
Kim et al. (2003) describes how to optimise the shape design of gas circuit breakers
by means of an evolutionary algorithm. For evaluation of the objective function, an
Euler finite volume solver is used.
Wolter (1997) examines CFD codes with respect to their suitability for gas flow
simulations in high voltage circuit breakers, quite similar to the topic of the present
thesis.
Mantilla Florez (2007) creates a robust reference experiment after which simulations
could be assessed and compares CFD-ACE+ predictions to the measured values.
3
Validation of OpenFOAM for nozzle flows 1 Introduction
4
2 OpenFOAM: A first glance
OpenFOAM stands for Open Source Field Operation and Manipulation; it is the soft-
ware being evaluated in the course of this thesis. This chapter is intended to give the
reader who is unfamiliar with it an idea of OpenFOAM; it is by no means an attempt at
a complete documentation. More complete information can be obtained from OpenCFD
(2007a) and OpenCFD (2007b); even though partially outdated and not complete either,
these documents are probably the best starting points for OpenFOAM beginners.
In Subsection 2.1, a short outline of the history of OpenFOAM is given; Subsection
2.2 describes its features, and Subsection 2.3 gives an idea of what has to be done to run
a case like the ones carried out in the later chapters.
2.1 History
OpenFOAM started as FOAM around 1993 at Imperial College, London, as a collabo-
ration of Henry Weller and Hrvoje Jasak, who started working on his PhD thesis, Jasak
(1996), at that time. The motivation to develop CFD software from scratch was mainly
dissatisfaction with legacy codes in Fortran and the goal to create something reusable by
others.
For a few years, FOAM was developed as a closed-source commercial software, before
becoming open source in December 2004 with the announcement of OpenFOAM 1.0.
Since then, four major releases were launched; the latest version is OpenFOAM 1.4.1,
released in August 2007. OpenFOAM is, according to their website1 , used by R&D teams
in large companies such as Audi, Bayer, Mitsubishi, Shell and Volkswagen, as well as by
more than 200 academic institutions, among them Imperial College London, Chalmers
University and the Tokyo Institute of Technology.
Main sources for information about OpenFOAM are, apart from the website and the
users and programmers guide mentioned above, the OpenFOAM message board2 and the
OpenFOAM Wiki3 .
2.2 Features
OpenFOAM is on the one hand a C++ library, on the other hand a collection of appli-
cations (created using these libraries). The applications can be divided into two different
categories: solvers and utilities, of which the former perform the actual calculations and
the latter provide a range of functionalities for pre- and post-processing.
2.2.1 Solvers
OpenFOAM covers an impressive range of applications with solvers ranging from a simple
potential flow solver (potentialFoam) over incompressible steady-state (simpleFoam), tran-
sient laminar (icoFoam) turbulent (turbFoam) or dynamic mesh (icoDyMFoam) solvers,
1
http://www.opencfd.co.uk/
2
http://openfoam.cfd-online.com/cgi-bin/forum/discus.cgi
3
http://openfoamwiki.net/index.php/Main_Page
5
Validation of OpenFOAM for nozzle flows 2 OpenFOAM: A first glance
2.2.2 Utilities
The utilities can basically be divided into supporting pre- and post-processing tasks.
There is also a tool called FoamX, which is actually just a GUI to effect changes in the
different dictionary files and execute other utilities, instead of calling them directly from
the command line. It works only with solvers for which a FoamX configuration file exists,
and even its creators recommend switching to editing the files directly as soon as possible.
Utilities are usually called using
< utility > < root > < case > [ - optionalParameters ]
where <utility> is the name of the utility (e. g., blockMesh), <root> is the path to the
root directory, and <case> is the path of the actual case, relative to the root directory.
More about the directory structure can be found in Section 2.3. As an example, to
calculate the Mach number for the latest time step in a case called ABBnozzle, one has to
issue
Mach . ABBnozzle - latestTime
Pre-processing utilities Of the many pre-processing utilities that come with Open-
FOAM4 , the following are used most often in the course of the test cases executed for this
thesis:
mapFields maps volume fields from one mesh to another; this is useful for mesh
refinement studies to map results from a coarse mesh to a finer one without starting
all over.
checkMesh checks the mesh for validity, skewness and the like and gives information
about its size.
setFields is used to set initial conditions for the different volume fields, especially for
cases where they are not uniform.
6
2.3 Running a case Validation of OpenFOAM for nozzle flows
Post-processing utilities The following post-processing utilities are the ones that offer
functionality required for this thesis:
Mach calculates the local Mach number and writes it at each time in a database.
foamLog extracts data such as initial residuals, iterations and Courant number from
a log file for plotting and observing trends over longer periods of time.
2.2.3 Extensibility
One of the key advantages of OpenFOAM is its extensibility: the source code is accessible,
and the architecture of OpenFOAM should make it easy to write for example a new solver
or adapt existing ones. The creators take pride in the high level of abstraction, which is
supposed to make the source code of a solver its own documentation. An equation such
as
u
+ u u = p (2.1)
t
is represented by the code
solve
(
fvm :: ddt ( rho , U )
+ fvm :: div ( phi , U )
- fvm :: laplacian ( mu , U )
==
- fvc : grad ( p )
);
In this way, the understanding of the actual algorithm, the implemented models and
equations are supposed to be much more important than a deep knowledge of object
orientation and C++ programming. This author disagrees with this statement, see the
critique in Subsection 3.1.6.
system
controlDict
fvSchemes
5
http://www.paraview.org/
7
Validation of OpenFOAM for nozzle flows 2 OpenFOAM: A first glance
fvSolution
Dictionaries for utilities like setFields or sample
constant
. . . Properties
polyMesh
points
cells
faces
boundary
Time directories (0, . . . )
This section outlines the various steps to be undertaken when setting up a simulation
in OpenFOAM: boundary conditions have to be set (Subsection 2.3.1), fluid properties
selected (Subsection 2.3.2), numerical schemes and algorithms for the solution of systems
of equations must be chosen (Subsection 2.3.3), and finally general simulations settings
must be fixed (Subsection 2.3.4).
bottom
{
type symmetryPlane ;
nFaces 25;
startFace 10375;
}
obstacle
{
type patch ;
physicalType adiabaticWall ;
nFaces 110;
startFace 10400;
}
defaultFaces
{
type empty ;
nFaces 10500;
startFace 10510;
}
8
2.3 Running a case Validation of OpenFOAM for nozzle flows
where our focus lies on the lines with type in them. patch is a generic type, while
symmetryPlane is for symmetry boundary conditions, and empty is to reduce the dimen-
sionality of a problem6 .
When the mesh is created using blockMesh, the boundary types in boundary are already
set as they should. If the mesh is imported however, boundary conditions are usually reset
and must be edited again.
Apart from the boundary dictionary, every volume field dictionary has to be edited to
set the right boundary conditions. The volume fields are contained in the time directories,
whose name is the corresponding time level. Suppose we want to start a simulation from
time zero, the field files in 0 have to be edited accordingly.
The part in the pressure file p where a fixed value of p = 15 kPa for the inlet is to be
prescribed could look like
inlet
{
type fixedValue ;
value uniform 15 e3 ;
}
The fixed velocity inlet (150 m/s in x-direction) and no-slip wall conditions in the velocity
file U could be
inlet
{
type fixedValue ;
value uniform (150 0 0);
}
bottom
{
type fixedValue ;
value uniform (0 0 0);
}
In this manner, every field has to be edited, until all the boundary conditions are
set. Depending on the type of solver, there might be only p, T and U dictionaries; for
turbulent solvers, there are also k and epsilon. Details about boundaries can be found in
OpenCFD (2007b, Section 6.2).
mixture // keyword
air 1 28.9 // name of specie , number of moles , molecular weigh t ( kg / kmol )
1000 2.544 e6 // thermodynamic coefficients : cp and heat of f usion
1.8 e -5 0.7 // transport coefficients : mu and Prandtl number
6
OpenFOAM handles only 3D meshes, so to work on a 2D case, a mesh with a depth of one volume
has to be created and empty boundary conditions specified along the dimension one wants to drop.
9
Validation of OpenFOAM for nozzle flows 2 OpenFOAM: A first glance
The fvSolution dictionary in the system directory controls solvers, tolerances and algo-
rithms for the systems of equations solved to obtain every variable. Part of this dictionary
might look like
solvers
{
p ICCG 1e -06 0.01;
U BICCG 1e -05 0.1;
T BICCG 1e -05 0.1;
}
PISO
{
nCorrectors 2;
n N o n O r t h o g o n a l C o r r e c t o r s 0;
}
This means: when solving for pressure, use the Incomplete-Cholesky preconditioned con-
jugate gradient solver ICCG with a tolerance of 106 and a relative tolerance of 0.01.
For velocity and temperature, use the Incomplete-Cholesky preconditioned biconjugate
gradient solver BICCG with a tolerance of 105 and a relative tolerance of 0.1.
The PISO subdictionary specifies settings for the pressure-implicit split-operator meth-
od used for transient solvers: the number of corrections ncorrector, the number of correc-
tions to account for mesh non-orthogonality nNonOrthogonalCorrectors, and sometimes
more. The possible settings for the fvSolution dictionary are listed in OpenCFD (2007b,
Section 4.5).
The fvSchemes dictionary on the other hand determines the numerical schemes for
terms appearing in the constituent equations: time schemes, divergence, Laplacian terms
and more. For every type of term, the user can choose from a comprehensive list of
schemes. The first few lines of fvSchemes with second order implicit time stepping and a
second order unbounded scheme for the (uu) divergence terms would look like
ddtSchemes
{
default implicit ;
}
divSchemes
{
default none ;
div ( phi , U ) Gauss linear ;
}
10
2.3 Running a case Validation of OpenFOAM for nozzle flows
provided that the current working directory is the root directory of the ABBnozzle case
directory.
11
3 Verification cases
This chapter comprises two verification cases, i. e., problems for which an exact analytical
solution is known (see Subsection 1.4.3). The intention is to identify the OpenFOAM
solvers best suited for the kind of problem in question and, once this goal is reached, try
to understand why they outperform the other solvers.
The documentation of OpenFOAM for users is not very detailed; the description of
a solver in the User Guide, OpenCFD (2007b), is just a single phrase per solver. When
looking for the optimal solver, we keep the projected application in mind: a supersonic
flow of a compressible gas, possibly turbulent. The approach to select that optimal solver
is then as follows:
Compilation of a shortlist based on the requirements and the short descriptions in
OpenCFD (2007b)
The two verification cases selected are the shock tube problem (Section 3.1) and the
supersonic wedge problem (Section 3.2).
13
Validation of OpenFOAM for nozzle flows 3 Verification cases
14
3.1 The shock tube problem Validation of OpenFOAM for nozzle flows
Diaphragm
p4
Pressure
p1
Distance
Figure 3.2: Shock tube initial conditions, pressure along the tube.
Setup used for testing For the actual testing, we utilise the configuration described in
Slater (2005). The shock tube has a length of 3.048 101 m and a radius of 3.048 102 m.
The diaphragm is placed in the exact middle at x = 1.524 102 m.
Both compartments are filled with air, so = 1.4, but at different pressures and
temperatures (see Table 3.2)2 .
The tube is closed at both ends, but reflected waves are of no particular interest for
our purposes, so solutions at a time after the first wave reaches a wall are disregarded.
The tube walls are assumed to be slip walls and air is treated as a calorically perfect gas.
The situation at time zero is depicted in Fig. 3.4.
15
Validation of OpenFOAM for nozzle flows 3 Verification cases
up W
4
3
2
1
p4
Pressure
p3 = p2
p1
Distance
Diaphragm
3.048 cm
p4 = 6.897 104 Pa
4
1
p1 = 6.897 103 Pa
0 cm
T4 = 288.89 K T1 = 231.11 K
Driver Driven
0 cm 15.42 cm 30.48 cm
The moving shock wave We start from the continuity, momentum and energy equations
for a stationary normal shock wave:
1 u 1 = 2 u2 (3.1)
p1 + 1 u21 = p2 + 2 u22 (3.2)
u2 h2
h1 + 1 = h2 + 2 (3.3)
2 2
where the index 1 refers to gas upstream of the wave, index 2 to gas downstream of the
wave. The important point is that u1 and u2 are interpreted as velocities relative to the
wave; because it is stationary, they are in this case also relative to the laboratory. For
the moving wave as seen in Fig. 3.3, the velocities relative to the wave are W (for the gas
ahead) and W up (for the gas behind). After replacing u1 and u2 , Eqs. (3.1) to (3.3)
16
3.1 The shock tube problem Validation of OpenFOAM for nozzle flows
become
1 W = 2 (W up ) (3.4)
p1 + 1 W 2 = p2 + 2 (W up )2 (3.5)
W2 (W up )2
h1 + = h2 + (3.6)
2 2
Equations (3.4) to (3.6) are the normal-shock equations for a shock moving with
velocity W into a stagnant gas. They can be rearranged and substituted, using h = e+p/,
to obtain
p1 + p2
e2 e1 = (v1 v2 ) (3.7)
2
Equation (3.7) is the Hugoniot equation, which is also valid for a stationary shock. Because
we assume air to be calorically perfect, e = cv T and v = RT /p; Eq. (3.7) becomes
+1 p2
!
T2 p2 1
+ p1
= +1 p2 (3.8)
T1 p1 1+ 1 p1
or
+1 p2
2 1 + 1 p
= +1 p21 (3.9)
1 1
+p 1
Equations (3.8) and (3.9) give the temperature and density ratios across the shock wave
as functions of the pressure ratio.
We define the moving shock Mach number as
W
Mas =
a1
By taking the calorically perfect gas relations and Eqs. (3.4) to (3.6) into account, we can
derive
p2 2
=1+ (Ma2s 1)
p1 +1
or, solved for Mas , s
+1 p2
Mas = 1 +1 (3.10)
2 p1
Since Mas = W/a1 , Eq. (3.10) leads to
s
+1 p2
W = a1 1 +1 (3.11)
2 p1
Equation (3.11) relates the velocity of the moving shock wave to the pressure ratio across
the wave and the local speed of sound of the gas ahead of the shock wave.
17
Validation of OpenFOAM for nozzle flows 3 Verification cases
The last quantity we are interested in is the velocity up of the mass motion induced
by the shock wave. Equation (3.4) can be rewritten
1
up = W 1 (3.12)
2
After substitution of Eqs. (3.9) and (3.11) into Eq. (3.12), we obtain
2
!1/2
a1 p2 +1
up = 1 p2 1 (3.13)
p1 p1
+ +1
With what we have derived so far, we can obtain for a given pressure ratio p2 /p1 and
speed of sound a1 the corresponding values of 2 /1 , T2 /T1 , W and up from Eqs. (3.8),
(3.9), (3.11) and (3.13).
The next paragraph deals with the counterpart of the moving shock wave, namely the
expansion wave.
The incident expansion wave While the last paragraph has been dealing with the
relations between the regions 1 and 2 of Fig. 3.3, this paragraph examines the regions
3 and 4, i. e., the expansion wave between them. The formulas relate to a left-running
expansions wave; they would be similar for a right-running one, except some changes of
the signs in the equations.
To examine the expansion wave problem on its own, we use the fact that the gas in
region 4 feels as if a piston was pulled to the right with velocity u3 . In fact, u3 is the
mass-motion velocity of the gas behind the expansion wave.
It can be shown (see e. g. Anderson (2003, Section 7.6)) that any part of a left-running
finite wave moves with local velocity u a. In region 4, the gas is at rest (u4 = 0), so the
head of the expansion wave moves with a velocity u4 a4 = a4 . This means that in the
xt plane, the path of the head is a straight line (see Fig. 3.5).
Inside the wave, a mass motion with velocity u is induced, directed toward right.
Temperature T and subsequently the local speed of sound a are reduced; because of this,
the head of the wave propagates faster into region 4 than other parts of the wave, so the
wave is spreading out while running down the tube.
The tail of the wave moves at velocity dx/dt = u3 a3 . Note that if u3 > a3 , i. e., u3 is
supersonic, the tail of the wave propagates to the right although the wave is left-running.
It can be shown that the characteristics of the expansion wave are straight lines and thus
the values of u, a (and consequently also p, , T etc.) are constant along them. Such
a wave is called a simple wave; a nonsimple waves where the characteristics are curved
comes up for example when the expansion wave is reflected.
To obtain a closed analytical form for the expansion wave, we use that
2a
u+ = const through the wave (3.14)
1
(without derivation). Evaluation of Eq. (3.14) in region 4 gives
2a4 2a4
u4 + =0+ = const (3.15)
1 1
18
3.1 The shock tube problem Validation of OpenFOAM for nozzle flows
Ta
1
il
u3 a3
3
1
ua
He
ad
1
a4
u = u4 = 0
a = a4
4
x
Because we assume the flow to be isentropic, p/p4 = (/4 ) = (T /T4 )2/(1) , so from
Eq. (3.17) we also find
2/(1)
p 1 u
= 1 (3.18)
p4 2 a4
and
2/(1)
1 u
= 1 (3.19)
4 2 a4
Equations (3.16) to (3.19) give all the properties within the simple expansion wave as a
function of the local gas velocity u.
To get them as a function of x and t, we look at any of the straight characteristics in
Fig. 3.5:
dx
=ua
dt
19
Validation of OpenFOAM for nozzle flows 3 Verification cases
or, because the wave is centred, i. e., the characteristics are straight lines through the
origin,
x = (u a)t (3.20)
Inserting Eq. (3.20) into Eq. (3.16) gives
1
x = u a4 + u t
2
or, solved for u,
2 x
u= a4 + (3.21)
+1 t
With this, the properties within the expansion wave, a4 x/t u3 a3 , are determined.
Shock tube relations Finally, we combine the findings from the last two paragraphs
for a closed analytical solution to the shock tube problem. To this end, we recall that
u3 = u2 = up and p2 = p3 across the contact surface; up was obtained
21
!1/2
a1 p2 1 +1
up = u2 = 1 p2 1 1 (3.13)
1 p1 p1
+ 1 +1
Equation (3.26) gives the incident shock strength p2 /p1 as an implicit function of the
diaphragm pressure ratio p4 /p1 . We can now unfold a recipe for the solution of the shock
tube problem, which consists of all the boxed equations:
20
3.1 The shock tube problem Validation of OpenFOAM for nozzle flows
1. Calculate p2 /p1 from Eq. (3.26) to get the strength of the shock wave3 .
2. Calculate all other shock properties from Eqs. (3.8), (3.9), (3.11) and (3.13).
3. Calculate p3 /p4 = (p3 /p1 )/(p4 /p1 ) = (p2 /p1 )/(p4 /p1 ) to get the strength of the
expansion wave.
4. All other properties behind the expansion wave can be found using
/(1)
p3 3 T3
= =
p4 4 T4
5. The properties inside the expansion wave can be found from Eqs. (3.16) to (3.19)
and (3.21).
The following subsection describes the implementation of this in Matlab.
Implementation in MATLAB The complete source code of the function described here
can be found in Section B.1. The function offers an interface
function [ x_mesh ,u ,a , rho ,T , p ] = shocktube ( time , p1 , p4 , T1 , T4 )
where x_mesh is a vector containing the x-positions where the solution is evaluated; u,
a, rho, T and p are vectors of the size of x_mesh containing the local velocity, speed of
sound, density, temperature and pressure at the corresponding positions.
time specifies at what time the solution is to be evaluated; p1, p4, T1 and T4 are the
initial settings for pressure and temperature in the two compartments. The indices 1 and
4 refer to the scheme depicted in Fig. 3.3. If only time is given, the other variables are
set to the values defined in Tab. 3.2.
After parsing the input and optionally setting the default values, some constants are
specified4 : the heat capacity ratio gamma (to 1.4), the specific gas constant of air R (to
287.05) and the position of the diaphragm L1 (to 0.1524). Instead of centring the tube at
zero, it was chosen to have its left end at zero (see Fig. 3.4).
Next, the local speeds of sound and the densities for compartments 1 and 4 are com-
puted from the quantities known so far. To get the wave velocity W of the moving shock,
we have to solve Eq. (3.26) for p2 /p1 , i. e., we have to find a p2 /p1 satisfying
24 /(4 1)
p2 (4 1)(a1 /a4 )(p2 /p1 1) p4
1 q =0 (3.27)
p1 21 21 + (1 + 1)(p2 /p1 1)
p1
Equation (3.27) is solved using the Matlab function fzero, which employs a combination
of bisection, secant, and inverse quadratic interpolation methods to find a zero. As an
initial guess, (p4 /p1 )/2 is taken. From this, the pressure in region 2, p2, is obtained. With
the pressure ratio p2 /p1 at hand, all other shock properties can be calculated: temperature
3
As this is an implicit equation, it has to be dealt with accordingly. Details can be found in every
calculus textbook, e. g., Blatter (1996).
4
All variables use SI units; the dimensions are given in the commentary of the source code.
21
Validation of OpenFOAM for nozzle flows 3 Verification cases
T2, density rho2, local speed of sound a2, wave velocity W and the velocity of the mass
motion behind the wave, u_p.
Since pressure and velocity are constant across the contact surface between regions
2 and 3, we know p3, u2 and u3; using these, the other quantities in region 3 can be
determined.
Now, the mesh x_mesh is initialised, usually to a size of 1 100, but the number of
points could also be changed to some other value if desired. Before iterating through all
the solution vectors, the boundaries of the regions are determined using the knowledge
about the velocities of head and tail of the expansion wave, the induced mass motion
behind the shock wave and the velocity of the shock itself:
% Calculate boundaries of different zones .
% Boundary between leftmost driver gas and expansion wave .
x4_exp = L1 - time * a4 ;
% Boundary between expansion wave and lower pressure driver gas .
exp_x3 = L1 + time *( u3 - a3 );
% Boundary between driver gas and driven gas .
x3_x2 = L1 + time * u_p ;
% Location of the shock wave .
x2_x1 = L1 + time * W ;
Now, the function iterates over all the points, checks what region the point belongs
to and sets the corresponding value in the solution vectors u, a, rho, T and p. For points
that are in the expansion wave, the nested function
function [ u_exp , a_exp , rho_exp , T_exp , p_exp ] = expansion_wave ( x )
is called to calculate the properties using Eqs. (3.16) to (3.19) and (3.21).
Three Matlab scripts on the accompanying CD generate movies, which visualise the
pressure, density and Mach number progression calculated using shocktube.m; Tab. 3.3
lists their names and the name of the generated video file. See Appendix A for details on
the CD.
Table 3.3: Scripts for video files visualising the analytical solution.
The different meshes used Calculations are basically performed using four different
meshes: one-dimensional, two-dimensional, axi-symmetric and three-dimensional. All
meshes are structuredconsist of hexahedral cellsand have a resolution of 100 cells in
x-direction, so x = 3.048 104 m. Grading is uniform along all axes.
22
3.1 The shock tube problem Validation of OpenFOAM for nozzle flows
Figure 3.6: 1D mesh for the shock tube problem. The x-axis is from left to right, the y-axis
is perpendicular to it in the paper plane, and the z-axis is perpendicular to the paper plane.
Figure 3.7: 2D mesh for the shock tube problem. The axes are oriented as in the 1D mesh
(Fig. 3.6).
1D mesh Because OpenFOAM handles only 3D meshes, meshes for problems with
a lower dimensionality still have to be at least one cell deep in every dimension. By spec-
ifying empty type patches at the corresponding boundaries, OpenFOAM is instructed to
treat this dimension of the mesh as infinite, effectively reducing the number of dimensions.
For the 1D mesh, this means having 100 cells in total with empty boundaries in y- and
z-directions. The result is shown in Fig. 3.6.
2D mesh The 2D mesh has empty boundary conditions only on patches perpen-
dicular to the y-axis. It has the same dimensions as the 1D mesh but has 10 cells in
y-direction, leading to a cell count of 1000. The mesh is shown in Fig. 3.7.
3D mesh The full 3D mesh finally is created using five blocks, resulting in an O-grid
type mesh. The yz cross section in Fig. 3.9a shows the central block having 10 10 cells
and the other blocks having 5 cells in radial and 10 cells in azimuthal direction; the total
23
Validation of OpenFOAM for nozzle flows 3 Verification cases
Figure 3.8: Axi-symmetric mesh for the shock tube problem. The wedge is aligned along
the xy-plane.
(a) (b)
Figure 3.9: 3D mesh for the shock tube problem: (a) yz cross section; (b) perspective view.
24
3.1 The shock tube problem Validation of OpenFOAM for nozzle flows
pared to the analytical solution. Following Slater (2005), also density and Mach number
distributions are compared to their exact counterparts, but because pressure alone seems
to be sufficient to judge the quality of the solvers, these plots are not shown here, but
only in Appendix C.1. They basically show the same behaviour as the pressure plots,
thus reinforcing the findings based on these.
Setting the initial conditions according to Fig. 3.4 is done by means of the setFields
tool. The velocity field u is set to zero everywhere; the pressure p and the temperature T
are set to the values given in Table 3.2. For the turbulent solvers, which are both using
the k turbulence model6 , the turbulent kinetic energy k and the turbulent dissipation
rate have to be initialised as well.
k is given by
1
k = (u2 + v 2 + w2 ) (3.28)
2
where u2 , v 2 and w2 are the fluctuating components of velocity in x, y and z direction.
Following OpenCFD (2007b), we assume initially isotropic turbulence, i. e., u2 = v 2 =
w2 , and that the fluctuations are equal to 5% of the expected velocity up :
5 5
u = v = w = up 267 m/s (3.29)
100 100
Substituting Eq. (3.29) into Eq. (3.28) results in
2 2
m2
3 5 m
k= 267 267.3
2 100 s2 s2
which is too large by far. As a remedy, the fluctuations are scaled by a factor l, which
corresponds to the tube diameter times 0.07:
2 2 2
3 5 m 4 m
k= l 267 7.789 10 (3.30)
2 100 s2 s2
Equation (3.30) gives a result in the expected order of magnitude. For the dissipation
rate , we have
C0.75 k 1.5
= (3.31)
l
where C is a constant of the k model7 , C = 0.09. Substituting this and Eq. (3.30)
into Eq. (3.31) gives
25
Validation of OpenFOAM for nozzle flows 3 Verification cases
4
x 10 x 10
4
7 7
rhopSonicFoam rhopSonicFoam
rhoSonicFoam rhoSonicFoam
sonicFoam sonicFoam
rhoTurbFoam rhoTurbFoam
sonicTurbFoam sonicTurbFoam
6 6
Analytical Analytical
5 5
4 4
Pressure [Pa]
Pressure [Pa]
3 3
2 2
1 1
0 0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35
xcoordinate of tube [m] xcoordinate of tube [m]
5 5
4 4
Pressure [Pa]
Pressure [Pa]
3 3
2 2
1 1
0 0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35
xcoordinate of tube [m] xcoordinate of tube [m]
For rhoTurbFoam and sonicTurbFoam, k and are set to the values obtained in Eqs. (3.30)
and (3.32).
With all the necessary values set, we can start evaluating the solver quality. Fig. 3.10
shows the obtained pressure distributions for all four meshes. 100 samples are taken
along the x-axis for y = z = 0 using the sample utility. The interpolation scheme is
set to cellPointFace, i. e., the cells are decomposed into tetrahedra, one of the tetra-
hedra vertices coinciding with a face centre, which inherits field values by conventional
interpolation schemes using values at the centres of cells that the face intersects.
1D case (Fig. 3.10a) The first observation is that rhopSonicFoam performs best of
all solvers: it does not exhibit any overshoots and only little numerical dissipation8 .
8
Numerical dissipation (or artificial viscosity) is the diffusive behaviour of a numerical solution that
is purely numerical in origin; it is usually caused by even-order derivatives ( 2 u/x2 , 4 u/x4 , etc.) as
the leading term of the truncation error and could be described as smearing out the solution.
26
3.1 The shock tube problem Validation of OpenFOAM for nozzle flows
Figure 3.11: Pressure distribution at t = 2.5 104 s for the rhoSonicFoam solver. Instead
of the expected constant pressure in y-direction (vertical axis in the picture), seemingly
random variations occur.
sonicFoam has no overshoots either, but clearly the most numerical dissipation of the
three laminar solvers. rhoSonicFoam lies in between in that respect but seems to be a
victim of numerical dispersion9 , as the wiggles in the neighbourhood of large gradients
indicate.
Of the turbulent solvers, rhoTurbFoam has the largest deviations in the expansion
wave on the one hand and the largest overshoot at the shock wave on the other hand.
rhoSonicFoam finally exhibits some numerical dissipation, but less so than other solvers.
2D case (Fig. 3.10b) Because the solution should not show variations of any variable
in y-direction, no big differences to the 1D case are to be expected. In fact, upon closer
inspection, the behaviour is qualitatively the same for all solvers, not yielding any new
insights.
Axi-symmetric case (Fig. 3.10c) Also here, rhopSonicFoam performs best and son-
icFoam shows some numerical dissipation. The two turbulent solvers perform exactly
identically, smearing out the solution in the expansion wave and showing a small over-
shoot at the shock wave. rhoSonicFoam however deviates significantly from the analytical
solution, exposing very large oscillations between expansion and shock wave. A look at
the pressure distribution over the whole wedge in Fig. 3.11 shows that pressure varies in
radial direction, which should not be the case.
It is decided at this point to exclude rhoSonicFoam from further investigations and
focus on the better performing rhopSonicFoam and sonicFoam, as far as laminar solvers
are concerned.
3D case (Fig. 3.10d) The final test on the 3D mesh shown in Fig. 3.9 confirms the
findings so far. rhopSonicFoam is still the best in class, and only rhoTurbFoam shows some
numerical dispersion. Artificial viscosity is more or less pronounced, but very similar for
the three solvers other than rhopSonicFoam.
As a last remark, it can be stated that sonicTurbFoam calculates the pressure between
expansions and shock wave to a value that is too little, but not by much; also density and
Mach number plots in Section C.1 show these inaccurracies.
9
Numerical dispersion on the other hand is caused by odd-order leading terms ( 3 u/x3 , etc.); dis-
tortion of the propagation of different phases of a wave shows up as wiggles in front of and behind the
wave. For details, see Anderson (1995, Section 6.6).
27
Validation of OpenFOAM for nozzle flows 3 Verification cases
4000 0.09
rhopSonicFoam
sonicFoam
3500 0.08
3000
0.07
2500
CPU time [s]
0.06
rms
2000
0.05
1500
0.04
1000
0.03
500
rhopSonicFoam
sonicFoam
0 0.02
7 6 5
0 0.2 0.4 0.6 0.8 1 1.2 10 10 10
t [s] x 10
6 t [s]
Figure 3.12: Temporal convergence and CPU time requirements for the laminar solvers.
{p1 , p2 , . . . , p100 } = {(p1 pex,1 )/pref , (p2 pex,2 )/pref , . . . , (p100 pex,100 )/pref }
In addition, the CPU times required are recorded and compared in consideration of a
possible trade-off between accuracy and CPU time required.
Because with some of the time steps used, no intermediate result is available for
t = 2.5104 s, the comparisons are made for t = 3104 s. Also, we confine ourselves to the
3D mesh from now on, as it is the most interesting regarding more realistic applications.
Laminar solvers The results for the laminar solvers are shown in Fig. 3.12. First of
all, it can be said that the good performance of rhopSonicFoam comes with a price tag:
Fig. 3.12a shows that it constantly takes more time than sonicFoam, up to 80% more for
the smallest time step of t = 107 s. Also, the CPU time of nearly one hour for this
relatively simple problem on a moderately large mesh seems quite long.
On the other hand, the relative error of rhopSonicFoam as seen in Fig. 3.12b is twice
as small as the one of sonicFoam. An interesting observation is that for rhopSonicFoam,
28
3.1 The shock tube problem Validation of OpenFOAM for nozzle flows
14000 0.5
rhoTurbFoam
sonicTurbFoam 0.45
12000
0.4
10000 0.35
0.3
CPU time [s]
8000
rms
0.25
6000
0.2
4000 0.15
0.1
2000
0.05 rhoTurbFoam
sonicTurbFoam
0 0
8 7 6 5
0 1 2 3 4 5 6 10 10 10 10
t [s] 7
x 10 t [s]
Figure 3.13: Temporal convergence and CPU time requirements for the turbulent solvers.
the error has a minimum for t = 0.5 106 s; for smaller values of t, the error increases
again. A possible explanation for this phenomenon could be that although it is imperative
to have a Courant number equal to or less than unity for stability, Co 1, the accuracy
can suffer if the time step is chosen very small, t tCo=1 , where tCo=1 is the time
step for which exactly Co = 1. Details can be found in Anderson (1995, Section 4.5).
Turbulent solvers Figure 3.13 shows the corresponding results for the turbulent solvers.
Again, one of the solvers (sonicTurbFoam) requires clearly more CPU time than the other,
but not as pronounced as with the laminar solvers. In general, the turbulent solvers
require a much smaller time step to produce a meaningful solution at all, so the different t
investigated lead to rather time-consuming runs: around three hours for t = 0.25107 s,
the smallest time step shown in Fig. 3.13a.
The necessity of setting t to a very small value is also reflected in the error plot,
Fig. 3.13b: for runs where > 107 s, the relative error is 15% or more. It is increased
to around 45% for t = 0.25 105 s, while the laminar solvers have errors of only 7% and
3.5% for this time step size.
A second observation is that sonicTurbFoam performs constantly better, but only by
very little. It is to expect that this will be more pronounced for cases where actual
supersonic flows occur, see for example, Subsection 3.2.3.
Laminar solvers For the laminar solvers, this small time step is t = 0.5 106 s (the
time step for which the error is minimal for rhopSonicFoam). Figure 3.14a confirms the
29
Validation of OpenFOAM for nozzle flows 3 Verification cases
1800 0
10
rhopSonicFoam rhopSonicFoam
sonicFoam sonicFoam
1600
1st order convergence
rhopSonicFoam (larger t)
1400
1200
CPU time [s]
1000
rms
1
10
800
600
400
200
2
0 10
1 2 3
25 50 75 100 200 10 10 10
Number of cells in xdirection N Number of cells in xdirection N
x x
Figure 3.14: Spatial convergence and CPU time requirements for the laminar solvers.
8000 0
10
rhoTurbFoam rhoTurbFoam
sonicTurbFoam sonicTurbFoam
7000
6000
5000
CPU time [s]
rms
1
4000 10
3000
2000
1000
2
0 10
1 2 3
25 50 75 100 200 10 10 10
Number of cells in xdirection N Number of cells in xdirection N
x x
Figure 3.15: Spatial convergence and CPU time requirements for the turbulent solvers.
findings of the previous subsection: rhopSonicFoam takes roughly twice as much time as
sonicFoam and CPU time requirements grow approximately proportional to the mesh size.
In turn, the mesh convergence rate of rhopSonicFoam as seen in Fig. 3.14b is much better
(roughly first order convergence).
In addition to the mesh convergence tests with t = 0.5 106 s, we carry out an
additional run with rhopSonicFoam, using 200 cells in x-direction, but a larger time step,
namely 106 s. The result is indicated by the star in the plot. It shows that rhopSonicFoam,
although using a time step twice as large as sonicFoam, still performs much better; and
this with a CPU time of only 870 seconds, thus roughly the same as sonicFoam required
for the finest grid.
30
3.1 The shock tube problem Validation of OpenFOAM for nozzle flows
Turbulent solvers For the turbulent solvers, t is set to 107 s. As before, computations
for the turbulent solvers require more time (see Fig. 3.15a). The accuracy decreases with
an increasing number of cells from 50 cells on again such that the result for 200 cells is
as bad as for 25 cells (Fig. 3.15b).
Starting from an initial guess p , u and v , some steps of the SIMPLE algorithm
are performed, namely
Once the corrections are smaller than a certain threshold, the results are taken as
the initial guess of the next time step. Otherwise, the procedure is repeated on the
same time level.
10
http://openfoamwiki.net/index.php/IcoFoam
11
Starting from a guessed pressure field p , a correction p is defined as the difference to the correct
pressure field p; similarly, velocity corrections are defined. The correct velocity field satisfies the continuity
equation, the guessed field does not. In an iterative procedure, pressure and velocity fields are updated,
until the continuity equation is satisfied.
31
Validation of OpenFOAM for nozzle flows 3 Verification cases
SIMPLE, PISO and variations of these algorithms suited for particular applications
are for example described in Versteeg & Malalasekera (1995).
OpenFOAM allows to specify even more corrector steps and also corrections for non-
orthogonality of the mesh, see Subsection 2.3.3.
Getting to really understand what exactly is implemented in the OpenFOAM solvers
would be an effort so large that it is decided to shelve this plan and focus on the perfor-
mance of OpenFOAM in the more challenging and time-consuming test cases.
32
3.1 The shock tube problem Validation of OpenFOAM for nozzle flows
4
x 10
7
Axisymmetric 1st order
Axisymmetric 2nd order
6 3D 1st order
3D 2nd order
Analytical (t = 0.3 ms)
5 Analytical (t = 0.12 ms)
Pressure [Pa]
0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35
xcoordinate of tube [m]
All the solvers we looked at are capable of capturing the main features of the shock
tube problem.
rhopSonicFoam has the highest accuracy of all solvers for this problem.
rhoSonicFoam struggles with the axi-symmetric problem and is excluded from further
investigation.
The turbulent solvers require significantly smaller time steps than the laminar
solvers to get the error down to a reasonable value; the reason for this is proba-
bly that the initial flow configuration has extreme space gradients at the border.
The better performing solver per category (rhopSonicFoam and sonicTurbFoam) re-
quires more CPU time than the worse one under otherwise identical conditions.
33
Validation of OpenFOAM for nozzle flows 3 Verification cases
The differences between the laminar solvers are larger than between the turbulent
solvers. However, when t of rhopSonicFoam is increased such that it is as fast as
sonicFoam, its precision is still much better.
OpenFOAM, or at least its best performing solver for this case, rhopSonicFoam,
compares favourably to the commercial software CFD-ACE+, outperforming it by
a factor of almost 3.
As the differences between the two turbulent solvers are only small so far, it is decided
to carry them both along to see whether they differ more clearly when applied to other
flows (e. g., supersonic ones).
34
3.2 The supersonic wedge problem Validation of OpenFOAM for nozzle flows
k
shoc
11111111111
00000000000
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
111111111
000000000
ched
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111 k
000000000
111111111
Deta
000000000
111111111
00000000000
11111111111
00000000000
11111111111 oc
111111111111
000000000000
sh
00000000000
11111111111
00000000000
11111111111 > max
000000000
111111111
d
00000000000
11111111111
00000000000
11111111111
he
000000000000
111111111111
tac
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
At
000000000000
111111111111
00000000000
11111111111
00000000000
11111111111 000000000
111111111
11111
00000
00000000000 < max
00000000000
11111111111
11111111111
000000000000
111111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
1111111111111
0000000000000 000000000
111111111
000000000
111111111
000000000000
111111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
11111
00000 11111111111
00000000000
000000000
111111111
000000000000
111111111111
Ma1 > 1
00000000000
11111111111
00000000000
11111111111
000000000
111111111
Ma1 > 1
00000000000
11111111111
00000000000
11111111111
000000000000
111111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111 000000000
111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
000000000
111111111
000000000
111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111
00000000000
11111111111 000000000
111111111
00000000000
11111111111
00000000000
11111111111
000000000
111111111
(a) (b)
Figure 3.17: Supersonic wedge flows: (a) attached shock; (b) detached shock.
Setup used for testing The test cases are again modelled after Slater (2005); the setup
is depicted in Fig. 3.18. Because of the symmetry of the problem, only the upper half of
the wedge is being looked at.
The free stream Mach number is Ma = 2.5, the temperature at the inlet is Ti =
288.9 K and the pressure at the inlet is pi = 101.35 kPa. The fluid is treated as a perfect
gas with =1.4 (dry air). Using the definition of the Mach number, Ma = u/a, and
because a = RT (with the specific gas constant for dry air, R = 287.05 J/(kg K))
we obtain the inlet velocity ui = 851.84 m/s. Again, these values look less random when
converted to U. S. customary units, since 288.9 K = 520.0 R and 101.35 kPa = 14.7 psi.
The deflection angle is set to 15 .
Oblique shock relations Let the index 1 refer to quantities upstream of the shock and
index 2 to those behind the shock. u1 is the upstream (horizontal) velocity with its com-
ponents u1 (parallel to the shock) and w1 (perpendicular to the shock); the corresponding
Mach number is Ma1 . The oblique shock makes an angle with respect to u1 , and the
flow is deflected by the angle . Behind the shock, the velocity is u2 with the parallel and
perpendicular components u2 and w2 ; the Mach number is Ma2 .
35
Validation of OpenFOAM for nozzle flows 3 Verification cases
000
111
111
000
pi = 101.35 kPa
111
000
Ti = 288.9 K
00
11
1111111
0000000
00
11
0000000
1111111
= 15
111
000 00
11
0000000
1111111
Ma = 2.5
ui = 851.84 m/s
Figure 3.18: Setup for OpenFOAM evaluations of the supersonic wedge problem.
The normal and tangential Mach numbers corresponding to the parallel and perpen-
dicular velocity components are called Man1 and Mat1 ahead of the shock and Man2 and
Mat2 behind the shock. Figure 3.19 illustrates the nomenclature.
Applying the integral forms of the conservation equations to a control volume across
the shock (see top of Fig. 3.19) yields, for the continuity equation, 1 u1 A1 + 2 u2 A2 = 0
where A1 = A2 are the areas of the faces a and d, respectively. The other faces are
parallel to the velocity and contribute nothing to the surface integral, so the oblique
shock continuity equation is
1 u 1 = 2 u2 (3.33)
The oblique shock momentum equation is split into tangential and normal components.
For the tangential component, the faces a and d contribute nothing, and the components
on b and f as well as c and e cancel each other out, so we get
w1 = w 2
or, in words: the tangential velocity component is preserved across an oblique shock wave.
For the normal component, we get
or
p1 + 1 u21 = p2 + 2 u22 (3.35)
For the energy equation applied to the control volume in Fig. 3.19, we get
u21 u22
(p1 u1 + p2 u2 ) = 1 e1 + u1 + 2 e 2 + u2
2 2
36
11111111111111
00000000000000
3.2 The supersonic wedge problem Validation of OpenFOAM for nozzle flows
00000000000000
11111111111111
PSfrag
00000000000000
11111111111111 c
00000000000000
11111111111111
b
u1 d u2
00000000000000
11111111111111
a
e
00000000000000
11111111111111
f
00000000000000
11111111111111
1
2
00000000000000
11111111111111
00000000000000
11111111111111
u1
,M
an
00000000000000
11111111111111
u1
1
2
at
at
1
,M
M
M
a2
an
1,
2,
u 2, M
00000000000000
11111111111111
w
w
1
00000000000000
11111111111111
u1 , Ma1
00000000000000
11111111111111
00000000000000
11111111111111
00000000000000
11111111111111 Figure 3.19: Oblique shock wave.
or
u2 u2
h1 + 1 1 u1 = h2 + 2 2 u2 (3.36)
2 2
u21 u2
h1 + = h2 + 2 (3.37)
2 2
The Eqs. (3.33), (3.35) and (3.38) are exactly the normal shock wave relations, see
Eqs. (3.1) to (3.3) on page 16. Consequently, the shock relations can be expressed as
functions of the normal component of the upstream Mach number Man1 where
37
Validation of OpenFOAM for nozzle flows 3 Verification cases
2 ( + 1)Ma2n1
= (3.40)
1 ( 1)Ma2n1 + 2
p2 2
=1+ (Ma2n1 1) (3.41)
p1 +1
Ma2n1 + 2/( 1)
2
Man2 = (3.42)
2/( 1) Ma2n1 1
and
T2 p 2 1
= (3.43)
T1 p 1 2
The Mach number behind the shock, Ma2 , is
Man2
Ma2 = (3.44)
sin( )
For = /2, the Eqs. (3.40) to (3.43) become the normal shock relations, which thus are
just a special case of the oblique shock relations.
The --Ma relation All the oblique shock relations are functions of Ma1 and the
shock angle . To find Ma2 as given in Eq. (3.44) however, the flow deflection angle is
required. is also a unique function of Ma1 and :
u1
tan = (3.45)
w1
and
u2
tan( ) = (3.46)
w2
(3.47)
Ma21 sin2 1
tan = 2 cot (3.50)
Ma21 ( + cos 2) + 2
38
3.2 The supersonic wedge problem Validation of OpenFOAM for nozzle flows
90
80
60
50
40
= 2
Ma 1
30
=3
Ma 1
20
=5
Ma 1
10 =
Ma 1
0
0 10 20 30 40 50
Deflection angle , degrees
Figure 3.20: --Ma relation: deflection angle as a unique function of Mach number and
shock wave angle.
Equation (3.50) is called the --Ma relation: it specifies uniquely as a function of Ma1
and . A plot showing some Mach isolines is given in Fig. 3.20.
The two possible cases now correspond to the weak/strong and detached shock cases
mentioned in Subsection 3.2.1; max is, for a given Mach number, the value that corre-
sponds to the rightmost point of the Mach isoline. For values of smaller than max , two
angles are possible, the smaller being the weak shock case, the larger the strong shock
case. If is larger than max , the shock is detached.
An alternative form of the --Ma relation Often, one is interested in the weak shock
angle for a given deflection angle and upstream Mach number Ma1 . One method is
to consult a large and precise diagram of the kind shown in Fig. 3.20, for example in
Anderson (2003), which is of course very unhandy for automated lookup. Alternatively,
Eq. (3.50) can be solved implicitly for with the associated disadvantages of doing so.
The solution to the problem is to rewrite Eq. (3.50) as a cubic in tan :
1 2 3 2 2 +1 2
1+ Ma1 tan tan (Ma1 1) tan + 1 + Ma1 tan tan + 1 = 0
2 2
(3.51)
Equation (3.51) has three different real roots for an attached shock with given Ma1 and
, of which one is negative. The positive roots correspond to the weak and strong shock
39
Validation of OpenFOAM for nozzle flows 3 Verification cases
where for = 0, we get the strong shock solution and for = 1, we get the weak shock
solution. and are
1/2
2 2 1 2 +1 2 2
= (Ma1 1) 3 1 + Ma1 1+ Ma1 tan (3.53)
2 2
and
1 1 +1
(Ma21 1)3 9 1 + Ma21 Ma21 Ma41 tan2
2
1+ 2
+ 4
= (3.54)
3
With Eqs. (3.53) and (3.54) plugged into (3.52), we have an exact explicit formula for
when and Ma1 are given.
where x and y are the coordinates of the point in space for which Mach number Ma,
pressure p, temperature T and density rho are to be computed. If none of the other input
parameters are specified, they are set to the values given in Subsection 3.2.1. Alternatively,
everything but the deflection angle theta can be specified, which sets theta to 15 degrees.
After checking the input, some constants are set and the density upstream of the shock
is computed using the perfect gas relation, 1 = p1 /(R T1 ). Also, the value of theta is
made sure to be positive, because expansion waves cannot be treated by this function.
The core part of the function is the implementation of Eq. (3.52):
% Calculate and check shock wave angle using the beta - theta - Mach relation .
lambda = sqrt (( Ma1 ^2 - 1)^2 - 3*(1 + ( gamma -1)/2* Ma1 ^2)*...
(1 + ( gamma +1)/2* Ma1 ^2)* tan ( theta )^2);
chi = (( Ma1 ^2 - 1)^3 - 9*(1 + ( gamma -1)/2* Ma1 ^2)*...
(1 + ( gamma -1)/2* Ma1 ^2 + ( gamma +1)/4* Ma1 ^4)* tan ( theta )^2) / lambda ^3;
beta = atan (( Ma1 ^2 - 1 + 2* lambda * cos ((4* pi + acos ( chi ))/3)) /...
(3*(1 + ( gamma -1)/2* Ma1 ^2)* tan ( theta )));
if ( beta < 0 || ~ isreal ( beta ))
error ( The shock is detached , choose a smaller theta or a larger Ma1 . )
end
By setting from Eq. (3.52) to = 1, we ensure to obtain the weak shock solution,
unless is negative or imaginary, which would mean that the shock is detached. The if
statement at the end of the above code block makes sure that this is not the case.
Now that the shock angle is known, all that is left to be done is finding out where
the coordinates in question are located: upstream of the shock, downstream of it, or in a
position that makes no sense, i. e., in the wedge or in the lower half plane. The upstream
case is trivialthe input values are returned as the result, the downstream case returns
the values obtained from Eqs. (3.39) to (3.44), and the last case throws an error.
40
3.2 The supersonic wedge problem Validation of OpenFOAM for nozzle flows
Figure 3.21: The 75 50 mesh used for solver quality evaluation with the supersonic wedge
problem.
The wedge mesh For quality evaluation, a mesh of the size 75 50 is used (Fig. 3.21),
where the rectangular part is of the size 25 50 volumes and the part above the wedge
is 50 50. The spacing on the corresponding edges is uniform. As seen before, to solve a
two-dimensional problem, a three-dimensional mesh has to provided, where the depth in
z-direction is one volume only.
Solver setup For the four solvers under consideration, rhopSonicFoam, sonicFoam, rho-
TurbFoam and sonicTurbFoam, the following settings are applied:
The upper boundary and the horizontal part of the lower boundary are set to the
symmetry type.
The part of the lower boundary representing the wedge is set to the slip type13 .
The outlet boundary has zeroGradient type for all quantities.
The inlet boundary is of zeroGradient type for epsilon and k; for p, T and U, it is
of fixedValue type with the values given in Subsection 3.2.1.
13
I. e., zero gradient condition for scalars and a zero normal component for vectors.
41
Validation of OpenFOAM for nozzle flows 3 Verification cases
Figure 3.22: Analytical Mach number for the wedge problem, sampling locations.
(a) (b)
Figure 3.23: OpenFOAM Mach number results: (a) rhopSonicFoam at t = 1.5 ms; (b)
sonicFoam at t = 3 ms.
For later analysis, the locations for samples are determined: 100 samples are taken
parallel to the lower boundary, 100 perpendicular to the wedge, as shown in Fig. 3.22,
which also shows the Mach number field obtained using the Matlab function described
above.
Results In this paragraph, the Mach number fields for the laminar and turbulent solvers
are evaluated.
Laminar solvers Figure 3.23 shows the Mach number fields for the two laminar
solvers after convergence. rhopSonicFoam takes a bit longer to converge, but computation
times are in the order of magnitude of a few minutes for both. The shock position and
angle is captured well in both cases; rhopSonicFoam (Fig. 3.23a) however features some
42
3.2 The supersonic wedge problem Validation of OpenFOAM for nozzle flows
2.6 2.6
rhopSonicFoam
sonicFoam
2.5 Analytical 2.5
2.4 2.4
2.3 2.3
Mach number
Mach number
2.2 2.2
2.1 2.1
2 2
(a) (b)
Figure 3.24: Comparison of laminar solver parallel samples to analytical solution: (a) 1st
order spatial discretisation; (b) 2nd order spatial discretisation.
slight oscillations in the region downstream of the shock, whereas sonicFoam (Fig. 3.23b)
seems to be smooth, just like theory predicts.
A closer look at the actual Mach values reveals thatalthough smootherthe sonic-
Foam solutions Mach numbers behind the shock are systematically too high. In Fig. 3.24a,
it can be seen that both solvers smear out the solution a little around the shock, but
while rhopSonicFoam oscillates around the correct value with a fading amplitude behind
the shock, sonicFoam stays above the value predicted by theory.
This behaviour is confirmed by the samples taken perpendicularly to the wedge. The
corresponding plots do not add much information, but for reasons of completeness, they
are included in Section C.2 (Fig. C.5a).
To improve the behaviour of the solution in the neighbourhood of the shock, the
selection of a more adequate spatial discretisation scheme can help. In OpenFOAM,
these schemes are specified in the fvSchemes dictionary. Every type of terms has its own
subdictionary, e. g., gradSchemes for gradient terms or divSchemes for divergence terms.
Since almost all terms are, by default, set to some higher order scheme, we only change
the divergence terms with 1st order methods to be treated with the MUSCL14 approach,
a method for the generation of second order upwind schemes via variable extrapolation;
refer to Hirsch (1990, Section 21.1) for details.
However, this does not improve the results: the rhopSonicFoam solution is still oscilla-
tory downstream of the shock, and the sonicFoam solution still predicts the Mach numbers
too large behind the shock plus oscillates now also. In addition, the Mach number pre-
diction upstream of the shock has worsened considerably. Figure C.5b in the appendix
confirms these findings: it seems that the default settings are the better choice.
Turbulent solvers The two turbulent solvers, rhoTurbFoam and sonicTurbFoam, are
designed for viscous flows, and the viscosity cannot simply be set to zero, so it is being
14
Monotone Upstream-centred Scheme for Conservation Laws
43
Validation of OpenFOAM for nozzle flows 3 Verification cases
(a) (b)
Figure 3.25: OpenFOAM Mach number results: (a) rhoTurbFoam at t = 2 ms; (b) sonic-
TurbFoam at t = 2 ms.
2.6 0.25
rhoTurbFoam
sonicTurbFoam
2.5 sonicTurbFoam 2nd order
Analytical
0.2
2.4
Distance from wedge [m]
2.3
0.15
Mach number
2.2
0.1
2.1
2
0.05
rhoTurbFoam
1.9 sonicTurbFoam
sonicTurbFoam 2nd order
Analytical
1.8 0
0.15 0.1 0.05 0 0.05 0.1 0.15 0.2 0.25 0.3 1.8 1.9 2 2.1 2.2 2.3 2.4 2.5 2.6
xcoordinate of domain [m] Mach number
(a) (b)
Figure 3.26: Comparison of turbulent solver samples to analytical solution: (a) parallel
samples; (b) perpendicular samples.
44
3.2 The supersonic wedge problem Validation of OpenFOAM for nozzle flows
strongly with an amplitude of roughly 20% of the shock height and comes at rest at a
value slightly above the exact value. sonicTurbFoam oscillates as well, but reaches faster
a constant value.
Overall, the turbulent solvers capture the shock more sharply than the laminar solvers,
but oscillate and have a Mach number larger than predicted by theory behind the shock.
An attempt at using exclusively second and higher order schemes with sonicTurbFoam
(MUSCL leads to errors when used with rhoTurbFoam), shown by red squares in Fig. 3.26,
results in only marginal improvement and is dropped as a remedy.
where Ma1 , . . . , Ma100 are the relative errors of the parallel samples and Ma101 , . . . , Ma200
the ones of the perpendicular samples. The relative errors are defined
Mai Maex,i
Mai =
Maref
where Maex,i are the exact solutions and Maref = 2.5, the inflow Mach number.
The resulting error behaviour is shown in Fig. 3.27. While for sonicFoam the mesh
refinement does not effect any significant improvementit seems we have reached grid
independence, rhopSonicFoam exhibits error convergence with an order of 0.5 (see be-
low). For the turbulent solvers, increasing the mesh resolution does improve the error,
but no convergence order can be seen. A look at the y-axis tick marks reveals that the
improvements are almost negligible (in the order of magnitude of a few percent between
the coarsest and the finest meshes).
45
Validation of OpenFOAM for nozzle flows 3 Verification cases
1
10
1.5
10
rms
rms
2
10
1.6
10
rhopSonicFoam
sonicFoam rhoTurbFoam
Convergence of order 0.5 sonicTurbFoam
3
10
1 2 3 1 2 3
10 10 10 10 10 10
Number of cells in xdirection N Number of cells in xdirection N
x x
(a) (b)
Figure 3.27: Mesh convergence for the wedge case: (a) laminar solvers; (b) turbulent solvers.
But why is the error convergence of rhopSonicFoam only 0.5? After the results in
Subsection 3.1.5 and according to the settings in the fvSchemes dictionary, one would
have expected it to be 1. A possible explanation is that the shock prevents the expected
behaviour and that looking at this few points is too much of an arbitrary selection; in
Slater (2005), only the values behind the shock are taken into account. We adapt the
corresponding Matlab scripts accordingly to only use values downstream and away from
the shock: the samples shown in Fig. 3.28 are now chosen such that they cover more or
less uniformly the region behind the shock.
In Fig. 3.29, the error plots for this new configuration are shown. On the one hand,
rhopSonicFoam now exhibits 1st order convergence behaviour before reaching grid inde-
pendence, as expected. On the other hand, only now it becomes obvious that the results
are quite accurate: for rhopSonicFoam, the RMS error becomes smaller than 0.73%. son-
icFoam seems to have reached grid independence for the coarsest configuration already.
The turbulent solvers seem to behave erratically, but the differences between the largest
and smallest RMS error are even smaller than before: 0.9% for rhoTurbFoam and 0.83%
for sonicTurbFoam, so also here, speaking of grid independence seems to be appropriate.
46
3.2 The supersonic wedge problem Validation of OpenFOAM for nozzle flows
None of the four solvers struggles fundamentally: all solutions converge to a steady
state and the shock geometry is captured correctly.
rhopSonicFoam is confirmed as the most accurate of the four solvers with a RMS
error of less than one percent for the finer meshes.
sonicFoam, although featuring a very smooth Mach number field behind the shock,
deviates systematically from the analytical solution behind the shock.
rhoTurbFoam, not designed for transonic or supersonic flows, exhibits the strongest
oscillations of all solvers behind the shock.
The turbulent solvers incorporate viscosity effects, whereas the analytical solution
is based on the inviscid Euler equations, which probably accounts for the overall
worse results of rhoTurbFoam and sonicTurbFoam.
Because of its less than optimal behaviour behind the shock, rhoTurbFoam is considered
as unsuitable for this kind of flows and will not be included in the validation cases.
47
Validation of OpenFOAM for nozzle flows 3 Verification cases
1
10
6.04% 5.23%
4.99%
1.3
10
rms
rms
2
10
1.4
10
rhopSonicFoam 3.34%
sonicFoam rhoTurbFoam
Convergence of order 1 sonicTurbFoam
3
10
1 2 3 1 2 3
10 10 10 10 10 10
Number of cells in xdirection N Number of cells in xdirection N
x x
(a) (b)
Figure 3.29: Mesh convergence for the wedge case, only samples downstream of the shock:
(a) laminar solvers; (b) turbulent solvers.
2.6
2.5
2.4
2.3
Mach number
2.2
2.1
Figure 3.30: Parallel samples of three CFD-ACE+ runs for the supersonic wedge problem.
48
4 Validation cases
As opposed to verification, where comparison to an analytical solution is possible, the
validation cases cannot be solved analytically. Simulation results have to be compared to
experimentally obtained values (see Subsection 1.4.3).
The end of the recirculation area is marked by a weak oblique reattachment shock
Setup used for testing In Smith (1967), three different geometries are used, differing
by the step height. We only look at the configuration with the medium step height,
h = 11.25 mm. The other relevant dimensions1 of the mesh shown in Fig. 4.2 are: distance
from inlet to step Li = 0.1016 m, distance from step to outlet Lo = 0.3048 m, and distance
from step to upper boundary Lu = 0.1475 m.
The block above the step has 30 40 volumes, the block to the right of it 60 40
volumes, and the block behind the step has 60 39 volumes, resulting in 5940 volumes
in total.
1
Again, these are round lots when using feet, e. g., the distance between inlet and step corresponds to
exactly 4 ft.
49
Validation of OpenFOAM for nozzle flows 4 Validation cases
n
8h fa
n
io
ns
pa
Ex
u
ck
sho
Recirculation region ent
tachm
t
Rea
h
Figure 4.1: The backward facing step problem and its main flow features: expansion fan,
separation/recirculation, reattachment shock.
The inflow Mach number is 2.5 Ma, which for the given static inflow pressure of pi =
15.35 kPa equals a velocity of ui = 651.9 m/s. The temperature to the left of the step is
initialised to 169.2 K, to the right of the step to 153 K; the velocity to the left of the step
is set to the inflow velocity, to the right of and above the step to 619.9 m/s (results in
continuous Mach number across the step) and behind the step to zero. The idea of setting
the velocity to zero behind the step is to ensure proper development of the recirculation
region.
The boundary conditions are as follows:
Figure 4.2: The mesh for the backward facing step case (5940 volumes).
50
4.1 The backward facing step problem Validation of OpenFOAM for nozzle flows
(a) (b)
Figure 4.3: Velocity field in the neighbourhood of the step: (a) solution at t = 1.5 ms (good
agreement with experiment); (b) steady-state solution at t = 3.5 ms (poor agreement with
experiment).
Fixed value p = pi = 15.35 kPa at the inlet, zero gradient everywhere else for
pressure
Fixed value T = Ti = 169.2 K at the inlet, zero gradient everywhere else for tem-
perature
Fixed value u = ui = 651.9 m/s at the inlet, no-slip walls at the lower boundary,
slip wall at the upper boundary and zero gradient at the outlet for velocity
The numerical schemes in the fvSchemes dictionary and the equation solvers, toler-
ances and algorithms in the fvSolution dictionary all remain at their default settings.
For the assessment of a first result, we focus on a basic aspect of the resulting flow field: the
location of the reattachment shock, i. e., the length of the recirculation zone. According
to the measurements in Smith (1967), this should take place at 2.4h once steady-state
is reached. Since turbulence plays a vital role, the laminar solvers rhopSonicFoam and
sonicFoam are not used for this case.
51
Validation of OpenFOAM for nozzle flows 4 Validation cases
First results The results after some time, shown in Fig. 4.3a, are very promising, the
recirculation zone ends pretty exactly at 2.4h. However, in the steady-state solution in
Fig. 4.3b, it has shrunken to 0.56h, which agrees very poorly with measured data and is
much worse than results achieved by NASA using their WIND code, as reported in Slater
(2005). Also, the separation takes place slightly under the edge, which is unphysical.
Efforts towards improvement To improve this rather unsatisfactory result, various mea-
sures are taken:
For turbulence, the RNG2 k model is chosen. While computationally only slightly
more expensive than the standard k model, its creators report very good predic-
tions of the flow over a backward facing step, according to Versteeg & Malalasekera
(1995). The idea, in brief, is to remove small scales of motion from the governing
equations by expressing their effects in terms of larger scale motions and a modified
viscosity; for details, refer to the original publication, Yakhot & Orszag (1986).
where As = 1.452 106 kg/(m s K1/2 ) and Ts = 120 K. Information about Suther-
lands formula can be found in Anderson et al. (1984, Section 5-1.4) or Hirsch (1988,
Section 2.1).
However, these measures do not improve the result perceivably. As a last resort, the mesh
is refined, even though in Slater (2005), very good results are achieved with our current
mesh. The new mesh is twice as fine as the old one in every direction and consists of
23760 volumes; computation time until steady-state is reached is increased from around
4.5 hours for the old mesh to now around 43 hours, due to the smaller time step necessary.
The resulting velocity field around the step can be seen in Fig. 4.4a. With the reat-
tachment at h, this is an improvement indeed, but still far away from the experimental
value. On the other hand, when looking at the stream lines around the recirculation area
in Fig. 4.4b, it can be stated that the recirculation as such is handled well.
Even though there is obviously much room for improvementwe suspect that further
mesh refinement, especially next to the boundaries, would give better results, the so-
lution is accepted for reasons of time limitations and the interesting cases in Section 4.2
and Chapter 5 still to be treated.
Pressure comparison Figure 4.5 shows the steady-state pressure field obtained using the
refined mesh introduced in the last paragraph. The major features are easily recognised:
the expansion fan at the step, the compression wave starting after the recirculation region,
and the low pressure region behind the step.
2
RNG stands for Renormalization-Group.
52
4.1 The backward facing step problem Validation of OpenFOAM for nozzle flows
(a) (b)
Figure 4.4: Solution obtained with the finer mesh: (a) velocity field; (b) streamlines,
coloured by velocity.
Along the white line in Fig. 4.5, we take pressure samples and compare them to the
experimental values given in Smith (1967) and results from CFD-ACE+ simulations, as
shown in Fig. 4.6. The x-axes denote the distance from the step in inches3 , the y-axes
stand for the pressure relative to the inflow static pressure, p = 15.35 kPa.
All curves feature low relative pressures directly after the step; the compression wave
is crossed a bit after two inches, and the values approach the inflow pressure after it.
However, upon closer inspection, many discrepancies become visible: the OpenFOAM
simulation predicts values in the expansion fan of around 0.2, whereas measurements
are around 0.4, and the actual compression wave crosses the two inch mark, while the
simulation predicts it to be clearly further away. The CFD-ACE+ solutions are a little
more accurate in the low pressure region (but still too low), smear out the shock and
feature higher pressures further downstream. The shock is even further downstream than
in the OpenFOAM prediction, so overall, it can be said that CFD-ACE+ performs a little
better than OpenFOAM for this case, even though the difference between OpenFOAM
and CFD-ACE+ is smaller than the one between CFD-ACE+ and the experiment.
53
Validation of OpenFOAM for nozzle flows 4 Validation cases
Figure 4.5: Pressure field for the steady-state solution with the refined mesh. The white
line indicates the sample locations for the comparison to the experiment.
Refining the mesh leads to a closer match to the experimental values, but implies
also a massive increase in computational costs. Even further refinement or a more
elaborate mesh based on more blocks4 is suspected to improve the results again. A
possible explanation is the reduction of numerical viscosity when refining a mesh,
leading to a larger and more accurate recirculation region.
The backward facing step seems not to be a simple problem, so difficulties do not come
completely unexpected: Fruth (2007) compared the performance of OpenFOAM and
ANSYS CFX for the incompressible backward facing step case described in OpenCFD
(2007a, Section 3.2) and reports reports troublesome convergence behaviour, even when
using a simpler steady-state solver.
The lesson learned from this case is the fact that recirculation needs special care and
fine meshes; satisfactory agreement to experimental values requires a lot of tweaking.
4
The mesh generation tool blockMesh does not allow for bigeometric refinement, so to emulate that
blocks have to be split.
54
4.2 The transonic diffuser problem Validation of OpenFOAM for nozzle flows
0.8
0.6
p/p
0.4
0.2
sonicTurbFoam
CFDACE+ coarse
CFDACE+ fine
0
0 1 2 3 4 5 6 7 8
Distance from step [inches]
(a) (b)
Figure 4.6: Pressure sample comparison for the backward facing step: (a) experimental
values from Smith (1967); (b) simulation results using the finer mesh in OpenFOAM and
two different meshes in CFD-ACE+.
55
Validation of OpenFOAM for nozzle flows 4 Validation cases
Subsonic
Flow separation
y/h
inflow
h(x) Shock
h
wave
x/h
Figure 4.7: The transonic diffuser setup: subsonic inflow is accelerated to supersonic speed,
a normal shock appears in the diverging part as well as flow separation.
Geometry and computational mesh The geometry of the diffuser is shown in Slater
(2005), but defined more clearly in Bogar et al. (1983): the channel has a flat bottom and
the top wall height h(x) is given by
cosh
h(x) = (4.1)
( 1) + cosh
where values with a tilde are made dimensionless by division by the throat height h =
44 mm, e. g., h = h/h . in Eq. (4.1) is given by
C
C1 (x/) 1 + C2 (x/) 3
= (4.2)
(1 x/)C4
The values for the different constants in Eqs. (4.1) and (4.2) in the convergent and di-
vergent part are given in Tab. 4.1. C3 is not given for the diverging part because C2 = 0
C
there and thus 1 + C2 (x/) 3 = 1C3 = 1.
Inlet and exit are defined to be at xi = 4.04 and xe = 8.65, respectively. A plot of
the resulting shape is shown in Fig. 4.8 (with dimensionalised values). When calculating
the geometry, attention has to be paid that the formulas are only to be used in the
non-constant cross-section region 2.598 x 7.216. For the constant regions, h(x <
2.598) = 1.4114 and h(x > 7.216) = 1.5 are valid.
To create a mesh that enables enough flexibility from this data using blockMesh, 10
blocks are defined: five for the upper half and five for the lower half to emulate bigeometric
refinement at the walls. In axial direction, block boundaries are set conveniently to ensure
a fine mesh where it is required, i. e., in the region where the normal shock is expected.
The block edges that are curved are approximated by polygonal lines with a sufficient
number of nodes. The mesh has 81 51 volumes, just like the coarse one described in
Georgiadis et al. (1994); it is shown in Fig. 4.9.
56
4.2 The transonic diffuser problem Validation of OpenFOAM for nozzle flows
0.06
0.04
0.02
0.15 0.1 0.05 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35
Figure 4.8: The geometry of the transonic diffuser, as calculated from Eqs. (4.1) and (4.2).
Axes are labelled in metres.
Figure 4.9: The 81 51 mesh for the transonic diffuser (axes labelled in metres).
Specific task description Two cases are being looked at, a so called strong shock and a
weak shock case. They differ by the ratio R of exit static to inflow total pressure: for the
strong shock it is R = 0.72, for the weak shock R = 0.82. The flow conditions are shown
in Tab. 4.2.
Inflow Outflow
Total pressure [kPa] 134.4 Static pressure, weak shock [kPa] 110.7
Total temperature [K] 277.8 Static pressure, strong shock [kPa] 97.2
Mach number 0.9
To specify these values in a more convenient way, the total inflow values are converted
to static values, using the perfect gas relations
T0 1 2
=1+ Ma (4.3)
T 2
/(1) /(1)
p0 T0 1 2
= = 1+ Ma (4.4)
p T 2
where the index 0 stands for the total values and is set to 1.4 for air. This results in
the inflow values Ti = 266.6 K and pi = 116.8 kPa; the velocity, based on Mach number
and inflow temperature, is ui = 150.6 m/s.
Solver setup and computation strategy The boundary conditions are set as follows:
57
Validation of OpenFOAM for nozzle flows 4 Validation cases
(a)
(b)
Figure 4.11: Weak shock solution for the diffuser: (a) pressure field; (b) velocity field with
Ma = 1 isoline. The vertical bars indicate the locations of the four velocity samples taken.
To start with, R is set to a small value, R = 0.13, which corresponds to an exit static
pressure of pe = 17.24 kPa, and the turbulence model is set to laminar; the idea is to
end up with an initial flow field where no shock occurs. Starting from this smooth field,
the weak and strong shock cases are obtained by setting the corresponding exit pressure
conditions. The initial fields are set as follows:
58
4.2 The transonic diffuser problem Validation of OpenFOAM for nozzle flows
The initial approach, switching to the RNG k turbulence model and setting the
pressure ratio to the weak shock configuration, results in a shock wave moving towards
the inlet, where pressure oscillations with unphysically high peak values occur, blowing
up the simulation in the end.
Instead, a different method leads to more stable results: the exit pressure is increased
in small steps, each time kept fixed until a steady-state flow field is reached, and then
increased again. This way, the strong shock results are obtained first, and the weak shock
results afterwards.
The transport model is, as in the backward facing step case, set to Sutherland trans-
port.
The weak shock case Figure 4.11 shows pressure and velocity fields for the weak shock
solution, with an isoline for Ma = 1 in black, matching the pressure jump. Flow separation
is not strongly developed, the low speed boundary layers after the shock are quite thin.
In Fig. 4.12, the pressure along the bottom and the top wall is shown. While the
location of the shock is captured well, its minimum is estimated too high by sonicTurb-
Foam; the shock prediction, especially at the bottom (Fig. 4.12a), is also less sharp than
the measurements. Agreement before and after the shock, however, is satisfactory. CFD-
ACE+ captures the shock better and sharper, but predicts a minimum pressure value
lower than the actual one, just like in the region immediately behind the shock, i. e., it
predicts the shock a bit too far to the right.
Figure 4.13 shows velocity profiles (only the x-component of the velocity) at four
different locations downstream of the throat (the vertical bars in Fig. 4.11b). Both son-
icTurbFoam and CFD-ACE+ systematically underestimate velocities; the CFD-ACE+
results are more accurate, though. Even the highly optimised WIND and NPARC results
in Slater (2005) underestimate velocity; the reason for the boundary layers being too large
for sonicTurbFoam might again be numerical viscosity, caused by a mesh that is too coarse.
In an endeavour to improve these results, especially concerning the shock sharpness,
a simulation with a mesh refined in x-direction (114 51 volumes) around the shock
location is set up; however, because of stability issues and quite large demands on CPU
time, it is decided to not follow the mesh refinement study approach any further.
The strong shock case The strong shock case (R = 0.72) pressure and velocity fields
are shown in Fig. 4.14. The shock now appears further downstream than in the weak
shock case, and the area where Ma > 1 is correspondingly larger. Figure 4.14b shows
59
Validation of OpenFOAM for nozzle flows 4 Validation cases
0.9 1
sonicTurbFoam
0.85 CFDACE+
0.9 Sajben experiment
0.8
0.75 0.8
0.7
0.7
0,in
t,in
0.65
p/p
p/p
0.6
0.6
0.55 0.5
0.5
sonicTurbFoam 0.4
0.45 CFDACE+
Sajben experiment
0.4
5 0 5 10 5 0 5 10
x/h x/h
(a) (b)
Figure 4.12: Pressure distribution for the weak shock case, comparison to CFD-ACE+
solution and experimental values: (a) bottom wall; (b) top wall
that the first velocity sample is taken right where the shock occurs, so prediction of the
shock at the wrong place leads to very large deviation in the velocity sample.
Figure 4.14b features a low speed region after the shock which is much larger than for
the weak shock case (see Fig. 4.11b); as can be seen in Fig. 4.15, this is the recirculation
pocket for this case. There is a second recirculatory area near the bottom wall, as indicated
by the small bump in the lowest streamline. We show the streamlines only for the strong
shock case because the features are the same as for the weak shock case, but they are
more developed and thus better visible in the strong shock case.
The pressure distribution shown in Fig. 4.16 shows very good agreement between son-
icTurbFoam and the measurements. The shock is predicted a little too far downstream,
but the minimum values agree very well. For the bottom wall (Fig. 4.16a), the CFD-
ACE+ resultagainfeatures the shock even further downstream than sonicTurbFoam,
and again with a minimum value that is too small. We will see later that this slight dif-
ference has a quite strong effect on the velocities measured. For the top wall (Fig. 4.16b),
the simulation results are almost identical, the CFD-ACE+ shock being only marginally
downstream of the sonicTurbFoam one. Differences of this order of magnitude could easily
be caused be slight differences in meshingthe two simulations do not use the same mesh.
Figure 4.17 shows the strong shock velocity profiles. In the sample right at the shock
(Fig. 4.17a), sonicTurbFoam overpredicts the velocity everywhere except in the upper core
flow region, where the values agree with the measurements. CFD-ACE+ however, as
mentioned before, suffers from predicting the shock too far downstream: the profile shows
no recirculation and velocity overpredictions of up to 100 m/s.
The agreement of CFD-ACE+ with the measurements is much better further down-
stream, even though the shape of the core flow is not quite captured in the two downstream
samples (Figs. 4.17c and 4.17d). While for both solvers, the upstream velocity predictions
at the top wall are too high, they agree excellently in the third sample and are even un-
derpredicted in the last sample. sonicTurbFoam underpredicts core flow velocities in the
60
4.2 The transonic diffuser problem Validation of OpenFOAM for nozzle flows
1 1
0.9 0.9
0.8 0.8
0.7 0.7
Vertical position, y/h
0.3 0.3
0.2 0.2
0.1 0.1
0 0
60 80 100 120 140 160 180 200 220 240 260 40 60 80 100 120 140 160 180 200 220
Velocity, U [m/s] Velocity, U [m/s]
0.9 0.9
0.8 0.8
0.7 0.7
Vertical position, y/h
0.6 0.6
sonicTurbFoam sonicTurbFoam
0.5 CFDACE+ 0.5 CFDACE+
Sajben experiment Sajben experiment
0.4 0.4
0.3 0.3
0.2 0.2
0.1 0.1
0 0
50 100 150 200 20 40 60 80 100 120 140 160 180 200
Velocity, U [m/s] Velocity, U [m/s]
Figure 4.13: Weak shock velocity profiles at different x-locations, comparison to CFD-
ACE+ and experimental values.
61
Validation of OpenFOAM for nozzle flows 4 Validation cases
(a)
(b)
Figure 4.14: Strong shock solution for the diffuser: (a) pressure field; (b) velocity field with
Ma = 1 isoline. The vertical bars indicate the locations of the four velocity samples taken.
62
4.2 The transonic diffuser problem Validation of OpenFOAM for nozzle flows
Figure 4.15: Detail of the strong shock velocity field with streamlines, showing separation
and the recirculation pocket.
With the confidence that sonicTurbFoam is able to handle diffuser flows with shocks,
separation and recirculation, the final case with a real world application, the cold gas flow
in a circuit breaker nozzle geometry, is tackled in Chapter 5.
63
Validation of OpenFOAM for nozzle flows 4 Validation cases
1 1
sonicTurbFoam
CFDACE+
0.9 0.9 Sajben experiment
0.8 0.8
0.7 0.7
0,in
t,in
p/p
p/p
0.6 0.6
0.5 0.5
5 0 5 10 5 0 5 10
x/h x/h
(a) (b)
Figure 4.16: Pressure distribution for the strong shock case, comparison to CFD-ACE+
solution and experimental values: (a) bottom wall; (b) top wall
64
4.2 The transonic diffuser problem Validation of OpenFOAM for nozzle flows
1 1
0.9 0.9
0.8 0.8
0.7 0.7
Vertical position, y/h
0.3 0.3
0.2 0.2
0.1 0.1
0 0
100 0 100 200 300 400 500 100 50 0 50 100 150 200 250 300
Velocity, U [m/s] Velocity, U [m/s]
0.9 0.9
0.8 0.8
0.7 0.7
Vertical position, y/h
0.6 0.6
sonicTurbFoam sonicTurbFoam
0.5 CFDACE+ 0.5 CFDACE+
Sajben experiment Sajben experiment
0.4 0.4
0.3 0.3
0.2 0.2
0.1 0.1
0 0
0 50 100 150 200 250 0 50 100 150 200 250
Velocity, U [m/s] Velocity, U [m/s]
Figure 4.17: Strong shock velocity profiles at different x-locations, comparison to CFD-
ACE+ and experimental values.
65
2
2 1
1
3 3
- -
(a) (b)
Figure 5.1: ABB breaker geometries (cross-sections): the high pressure reservoirs (inlets)
are to the left, the constant pressure reservoirs (outlets) to the right. The red dots mark
the sensor positions. (a) plug at 37 mm; (b) plug at 112 mm.
67
Validation of OpenFOAM for nozzle flows 5 Cold gas flow in a circuit breaker
Figure 5.2: Mesh for the 57 mm circuit breaker case (80740 volumes).
The approximate sensor placement is marked in Fig. 5.1 with numbered dots; sensors 1
and 2 are fixed on the diffuser, sensor 3 is being moved with the plug. In total, there are 10
measurements for each of the 14 plug positions, generating three values per measurement.
The exact placement of the sensors is shown in Tab. 5.1.
Table 5.1: Location of the control points for the ABB circuit breaker case. xc is the plug
location, e. g., 37 mm in for the 37 mm case.
68
5.3 Progression and computational costs Validation of OpenFOAM for nozzle flows
The outer walls, the tulip and the plug surfaces are assigned the wall type with no-
slip for the velocity field and zero gradient for every other field. The outlet patch is of
fixedValue type for pressure (p = 1 bar) and zeroGradient for the other fields.
The large surface patches that constitute the cut surfaces are assigned the symme-
tryPlane type. While OpenFOAM would allow for wedge-shaped volumes, CFD-GEOM
does not, so the axis of symmetry is actually a very narrow surface, which is also set to
the symmetryPlane type.
The first idea for the inlet patch is to have it as a fixed pressure inlet and run one
simulation for every pressure/plug position combination until steady-state is reached, thus
requiring 140 simulation runs. However, first tests show that it takes very long until the
residuals are acceptably small, so a different approach is chosen.
The inlet is assigned the timeVaryingUniformFixedValue type, which is not mentioned
in the documentation, but does exactly what we are looking for: a series of points in
time with corresponding pressure values can be specified, and OpenFOAM interpolates
linearly between them, so we can exactly copy the experimental setup in Mantilla Florez
(2007) (and also the CFD-ACE+ settings therein).
The experiments are conducted with N2 , so the thermodynamicProperties dictionary
is adapted accordingly. Because temperature effects are expected to be negligible, the
transport model is set to constant transport. For turbulence, RNG k is chosen.
The solver of choice is, based on the encouraging experience in Section 4.2, sonicTurb-
Foam. The initial time step is set to t = 5 107 s, and as the time scheme, backward is
chosen, a second order implicit scheme. Intermediate volume fields are written out every
0.625 ms.
69
Validation of OpenFOAM for nozzle flows 5 Cold gas flow in a circuit breaker
6
10
37 mm
Latest result 37 mm
72 mm
Latest result 72 mm
102 mm
Latest result 102 mm
t [s]
7
10
8
10
0 0.002 0.004 0.006 0.008 0.01
Time [s]
Figure 5.3: Necessary reduction of t with increasing inlet pressure, shown for three dif-
ferent geometries.
only around one third of all the measurement values are simulated; however, this should
be enough to make a well-grounded statement about the performance of OpenFOAM for
this case.
The discontinuities in the time step size are also reflected in the residual plots. As
an example, we look at the initial residuals of the 87 mm case, shown in Fig. 5.4a: with
the increasing pressure, the Courant number becomes larger and larger, until at 2.5 ms,
the time step has to be reduced for the first time, because the simulation diverges shortly
afterwards otherwise. The reduction is to 5 108 s, because the first try with 107 s does
not work out; this causes the sharp drop visible at 2.5 ms.
From then on, the residuals seem to behave pretty wildly, but a look at the magnifi-
cation of just 1 ms (Fig. 5.4b) reveals that the spikes are just occasional and the residual
behaviour is smooth otherwise. Also, only initial residuals are shown, which makes the
plot seem more discontinuous than how the actual quantities really behave.
A weak expansion fan occurs in front of the tulip at x 0.01 m (consult Fig. 5.1
for the axis labels).
70
5.5 Comparison to measurements Validation of OpenFOAM for nozzle flows
0 0
10 10
1
10 1
10
2 Co
10 0
2 h
10 0
p0
3
10 Ux0
3 Uy0
10
4
10 Co0
h
0
4
5
p0 10
10
Ux
0
Uy
0
6 5
10 10
0 1 2 3 4 5 6 7 4.8 5 5.2 5.4 5.6 5.8 6
Time [s] 3
x 10 Time [s] 3
x 10
(a) (b)
Figure 5.4: Initial residuals for the 87 mm case: maximum Courant number Co0 , entrophy
h0 , pressure p0 , x- and y-components of velocity Ux,0 and Uy,0 : (a) 07 ms; (b) 56 ms.
Directly in front of the tulip, there is a stagnation point (not well visible with the
colour scheme used).
In the diffuser, the flow is accelerated to supersonic speeds until a normal shock
occurs, visible in both the pressure and the Mach number field.
After the shock, separation occurs and a recirculatory area around the plug is
formed.
Sensor 1, nozzle (Fig. 5.6) For the lower pressure cases in Fig. 5.6a, the pressure dip
for the 57 mm configuration is the most obvious deviation. The reason is a normal shock
being predicted a little too far downstream, i. e., behind the sensor. In Fig. 5.6b with the
higher pressures, there are only few simulation results. The value at 77 mm lies exactly
in a small flow separation area behind a shock; the values at 102 and 112 mm are, again,
slightly upstream of a shock, behind which the pressure corresponds to the measurement.
71
Validation of OpenFOAM for nozzle flows 5 Cold gas flow in a circuit breaker
Figure 5.5: Pressure and Mach number field for the 62 mm case at t = 10 ms, i. e., inflow
pressure at 1.8 bar.
Sensor 2, diffuser (Fig. 5.7) In Fig. 5.7a, the off point is at 72 mm for the 1.6 bar
case; the reason is again a normal shock being estimated too far downstream. It is to
suspect that inaccurate shock locations are also the reason for the wiggles in the 1.4 bar
series. The few higher pressure values in Fig. 5.7b are all satisfactory or even almost
perfect.
Sensor 3, plug (Fig. 5.8) Apart from the systematic underestimation of pressure for
cases up to 57 mmthis happened also to the CFD-ACE+ simulation in Mantilla Florez
(2007), the spikes at 82 mm are the most striking feature of Fig. 5.8a. Again, there is
a shock next to the sensors for these configurations, but this time, it is estimated too far
upstream, leading to increased pressure.
The non-adaptivity of the time step is quite a nuisance: once reduced to a small value
like 108 s, cases with meshes containing tens of thousands of volumes require a huge
amount of computing time. On the other hand, nobody precludes the development
of such an adaptive scheme.
72
5.6 Summary for circuit breaker case Validation of OpenFOAM for nozzle flows
0.9 0.9
OpenFOAM 1.8 bar
Experiment 1.8 bar
0.8 OpenFOAM 2.0 bar
0.8
Experiment 2.0 bar
OpenFOAM 2.2 bar
0.7 Experiment 2.2 bar
0.7
0.6
0.6
in
in
p/p
p/p
0.5
0.5
0.4
0.4
0.3 OpenFOAM 1.2 bar
Experiment 1.2 bar
OpenFOAM 1.4 bar
Experiment 1.4 bar 0.3
0.2
OpenFOAM 1.6 bar
Experiment 1.6 bar
0.1 0.2
30 40 50 60 70 80 90 100 110 120 30 40 50 60 70 80 90 100 110 120
Plug position [mm] Plug position [mm]
(a) (b)
Figure 5.6: Comparison of simulation predictions and measured values for pressure values
at sensor 1 (nozzle). Crosses stand for simulation values, circles for measured values; lines
in the same colour are for the same pressure. (a) 1.2 bar1.6 bar; (b) 1.8 bar2.2 bar.
73
Validation of OpenFOAM for nozzle flows 5 Cold gas flow in a circuit breaker
0.9 0.55
0.8
0.5
0.7
0.6
0.45
in
in
p/p
p/p
0.5
0.4
0.4
(a) (b)
Figure 5.7: Comparison of simulation predictions and measured values for pressure values
at sensor 2 (diffuser): (a) 1.2 bar1.6 bar; (b) 1.8 bar2.2 bar.
1 0.9
OpenFOAM 1.2 bar OpenFOAM 1.8 bar
Experiment 1.2 bar Experiment 1.8 bar
0.9 OpenFOAM 1.4 bar OpenFOAM 2.0 bar
0.8
Experiment 1.4 bar Experiment 2.0 bar
OpenFOAM 1.6 bar OpenFOAM 2.2 bar
0.8 Experiment 2.2 bar
Experiment 1.6 bar 0.7
0.7
0.6
in
in
p/p
p/p
0.6
0.5
0.5
0.4
0.4
0.3
0.3
0.2 0.2
30 40 50 60 70 80 90 100 110 120 30 40 50 60 70 80 90 100 110 120
Plug position [mm] Plug position [mm]
(a) (b)
Figure 5.8: Comparison of simulation predictions and measured values for pressure values
at sensor 3 (plug): (a) 1.2 bar1.6 bar; (b) 1.8 bar2.2 bar.
74
6 Summary and outlook
This chapter summarises the findings of the thesis (Section 6.1) and gives an outline for
suggested future research in the subject area (Section 6.2).
All in all, OpenFOAM is able to deal with every case it is presented with: the
outcomes are between excellent (less than 1% deviation for a fine grid using rhop-
SonicFoam in the supersonic wedge case, less than 2% in the shock tube case), good
(transonic diffuser results) and barely satisfactory (recirculation in the backward
step case).
The outcome of the application to the ABB nozzle problem is satisfactory, even
though time step limitations gets in the way of obtaining more than a third of all
the measured values within feasible time. Large differences in the results can almost
all be explained by false shock position estimations.
The results are in some cases better than results obtained using CFD-ACE+, in some
cases a little worse. Overall, OpenFOAM does not have to fear the comparison to
commercial codes.
For inviscid cases, we recommend using rhopSonicFoam, for viscous cases sonicTurb-
Foam.
The extensibility comes with a price: pre- and post-processing are not very con-
venient. Importing a huge mesh and editing all the boundaries, which are only
distinguishable by their name, can be very tedious; importing and exporting from
and to third party tools is also cumbersome.
As the two major weaknesses, the absence of an adaptive time step for the transient
sonicTurbFoam and false estimations for shock locations in the more complicated
flows are identified. However, thanks to the flexibility and extensibility of Open-
FOAM, both points could be improved.
However, it should be kept in mind that the correct prediction of shock locations is
crucial for meaningful results; a type of compressible flow solver that is especially well
75
Validation of OpenFOAM for nozzle flows 6 Summary and outlook
suited for this is the Riemann solver 1 . It could not just be added as another solver to
OpenFOAM but would require changing and extending the core libraries, resulting in an
immense work investment.
6.2 Outlook
Starting from the results achieved in this thesis, several directions for future research are
thinkable, ranging from small projects to very challenging tasks:
The simulations for the ABB nozzle case are still running, so within a few weeks
these results will be complete.
Improved shock handling could be implemented, see the remarks about Riemann
solvers above.
A starting point for a more complete simulation could be a setting with a dynamic
mesh, i. e., an actually moving plug.
Efforts to strongly couple the NavierStokes equations with the Maxwell equations
are already under way.
Thanks to the active and growing user base of OpenFOAM, it is to expect that the
software will improve further towards a real multi-physics tool, while maintaining all the
advantages of being open source.
1
See for example Anderson (1995) for an introduction to Riemann solvers.
76
Acknowledgements
I would like to thank the following people (in alphabetical order):
Yong-Joong Lee and Henrik Nordborg for extensive on-site support and guidance.
Carolyn Wardle-Davies for proofreading key parts of this report. Remaining flaws
are of course an oversight on my part.
77
References
Anderson, Dale A., Tannehill, John C., & Pletcher, Richard H. 1984. Com-
putational Fluid Mechanics and Heat Transfer. New York: McGraw-Hill.
Anderson, Jr, John D. 1995. Computational Fluid Dynamics: The Basics with Ap-
plications. Singapore: McGraw-Hill.
Anderson, Jr, John D. 2003. Modern Compressible Flow: With Historical Perspective.
Third edn. New York: McGraw-Hill.
Fruth, Florian. 2007. Benchmark of OpenFOAM and CFX. Seminar thesis, ETH
Zurich.
Gremmel, Hennig, & Kopatsch, Gerald (eds). 2007. ABB Switchgear Manual. 11
edn. Berlin: Cornelsen.
Hirsch, Charles. 1990. Computational Methods for Inviscid and Viscous Flows. Nu-
merical Computation of Internal and External Flows, vol. 2. New York: Wiley.
Hsieh, T., Wardlaw, Jr, A. B., Collins, P., & Coakley, T. 1987. Numerical
Investigation of Unsteady Inlet Flowfields. AIAA Journal, 25(1), 7581.
Jasak, Hrvoje. 1996 (June). Error Analysis and Estimation for the Finite Volume
Method with Applications to Fluid Flows. Ph.D. thesis, Imperial College London.
Kundu, Pijush K., & Cohen, Ira M. 2004. Fluid Mechanics. Third edn. San Diego:
Elsevier Academic Press.
79
Validation of OpenFOAM for nozzle flows References
Mantilla Florez, Javier Dario. 2007 (Mar.). Measurements and Simulations of Cold
Gas Flows in Basic Gas Circuit Breaker Geometries. Master thesis, RWTH Aachen.
OpenCFD. 2007a (Apr.). OpenFOAM: The Open Source CFD Toolbox. Programmers
Guide Version 1.4. OpenCFD Limited, Reading UK.
OpenCFD. 2007b (Apr.). OpenFOAM: The Open Source CFD Toolbox. User Guide
Version 1.4. OpenCFD Limited, Reading UK.
Pope, Stephen B. 2000. Turbulent Flows. Cambridge UK: Cambridge University Press.
Richardson, Lewis F. 1927. The Deferred Approach to the Limit Part I. Single Lattice.
Philosophical Transactions of the Royal Society of London, Series A, 226, 299361.
Salmon, J. T., Bogar, T. J., & Sajben, M. 1983. Laser Doppler Velocimeter Mea-
surements in Unsteady, Separated, Transonic Diffuser Flows. AIAA Journal, 21(12),
16901697.
Slater, John W. 2005 (Sept.). CFD Verification & Validation: NPARC Alliance.
http://www.grc.nasa.gov/WWW/wind/valid/. Accessed 12th June 2007.
Smith, Howard E. 1967 (Mar.). The Flow Field and Heat Transfer Downstream of a
Rearward Facing Step in Supersonic Flow. Technical report ARL 67-0056. Aerospace
Research Laboratories, Ohio.
Wolter, Frank. 1997 (Oct.). Untersuchung von CFD-Codes auf ihre Anwendbarkeit zur
Gasstromungssimulation in Hochspannungs-Leistungsschaltern. Diploma thesis, RWTH
Aachen.
80
A Contents of the CD
The enclosed CD contains the data created during working on this thesis. The following
list describes briefly the contents of the various directories.
81
Validation of OpenFOAM for nozzle flows A Contents of the CD
references: all the references (except text books) from this thesis: journal articles,
technical reports, PhD, Master and Seminar theses, scripts and manuals
report: the .tex source files of the report and the PDF versions: screen.pdf with
coloured hyperlinks for reading on a computer, print.pdf with all text in black for
printing
img : all the .eps pictures for the report as well as pictures in other formats,
as exported from OpenFOAM or required for presentations
source: Matlab source code for inclusion in the report
varia: the ABB nozzle case management spreadsheet for progress monitoring and
an early draft of a mile stone plan
82
B MATLAB source code
B.1 The shock tube function
1 function [ x_mesh ,u ,a , rho ,T , p ] = shocktube ( time , p1 , p4 , T1 , T4 )
2 % SHOCKTUBE Analytical solution for unsteady wave motion in a shock tube .
3 % [ X_MESH ,U ,A , RHO ,T , P ] = SHOCKTUBE ( TIME , P1 , P4 , T1 , T4 ) so lves the shock
4 % tube problem analytically . The diaphragm is placed at 15.2 4 cm ,
5 % pressure and temperature to the left of it are P4 and T4 , to the right
6 % of it P1 and T1 ( at time zero ). The function returns X_MESH (1 000
7 % equally spaced points between 0 and 30.48 cm ) and the mass ve locity U ,
8 % the local speed of sound A , the density RHO , the temperature T and the
9 % pressure P at time TIME for further analysis .
10 %
11 % If only one argument is given ( TIME ) , P1 , P4 , T1 and T4 are set to
12 % default values .
13 %
14 % SHOCKTUBE only treats right running shock waves and left ru nning
15 % expansion waves .
16 %
17 % The gas in the tube is air with corresponding R and gamma ; it is
18 % treated as inviscid .
19
20 % *************************************************************************
21 % This m - file is part of the Master Thesis
22 %
23 % " Simulation and validation of compressible flow in nozzle geometries and
24 % validation of OpenFOAM for this application "
25 %
26 % by Benjamin Wuethrich , MSc student of Computational Scien ce and
27 % Engineering at ETH Zurich .
28 %
29 % Work carried out at ABB Corporate Research in Baden - Daettw il from
30 % 15/04/07 until 14/09/07.
31 %
32 % Contact : benjamin . wuethrich@alumni . ethz . ch
33 % *************************************************************************
34
35 % Parse arguments .
36 if nargin ==1
37 % Set defaults .
38 p1 = 6.897 e3 ; % Lower pressure ( right chamber ) in [ Pa ].
39 p4 = 6.897 e4 ; % Higher pressure ( left chamber ) in [ Pa ].
40 T1 = 231.11; % Lower temperature ( right chamber ) in [ K ].
41 T4 = 288.89; % Higher temperature ( left chamber ) in [ K ].
42 elseif ( nargin ==5) && ( p1 > p4 )
43 error ( This would be a left - running shock wave , which is not suppor ted . )
44 elseif nargin ==5
45 % Everything fine .
46 else
47 error ( Wrong number of arguments specified . )
48 end
49
50 % Set constants .
51 gamma = 1.4; % Heat capacity ratio of air .
52 R = 287.05; % Specific gas constant of air in [ J /( kg * K )].
53 L1 = 0.1524; % Initial position of the diaphragm in [ m ]. $
54
55 % Calculate speeds of sound and densities .
56 a1 = sqrt ( gamma * R * T1 );
57 a4 = sqrt ( gamma * R * T4 );
58 rho1 = p1 /( R * T1 );
59 rho4 = p4 /( R * T4 );
60
61 % Calculate p2 / p1 , get p2 .
62 p2p1 = fzero ( @ ( p2p1 ) p2p1 * (1 - (( gamma -1)*( a1 / a4 )*( p2p1 -1)) / ...
63 sqrt (2* gamma *(2* gamma + ( gamma +1)*( p2p1 -1))) )^( -2* gamma /( gamma -1))...
83
Validation of OpenFOAM for nozzle flows B MATLAB source code
64 - p4 / p1 ,( p4 / p1 )/2);
65 p2 = p2p1 * p1 ;
66
67 % Calculate incident shock properties .
68 T2 = T1 * p2 / p1 * ((( gamma +1)/( gamma -1) + p2 / p1 ) /...
69 (1 + ( gamma +1)/( gamma -1)* p2 / p1 ));
70 rho2 = rho1 * (1 + ( gamma +1)/( gamma -1)* p2 / p1 ) /...
71 (( gamma +1)/( gamma -1) + p2 / p1 );
72 a2 = sqrt ( gamma * R * T2 );
73 % Wave velocity of moving shock .
74 W = a1 * sqrt (( gamma +1)/(2* gamma ) * ( p2 / p1 - 1) + 1);
75 % Mass motion behind the wave .
76 u_p = a1 / gamma * ( p2 / p1 - 1) * sqrt ((2* gamma /( gamma +1)) /...
77 ( p2 / p1 + ( gamma -1)/( gamma +1)));
78
79 % Pressure and velocity to the right of the expansion wave ( co nstant
80 % across the contact surface ).
81 p3 = p2 ;
82 u2 = u_p ;
83 u3 = u_p ;
84
85 % Other properties behind the expansion wave .
86 rho3 = rho4 * ( p3 / p4 )^(1/ gamma );
87 T3 = T4 * ( p3 / p4 )^(( gamma -1)/ gamma );
88 a3 = sqrt ( gamma * R * T3 );
89
90 % Define mesh .
91 x_mesh = linspace (0 ,2* L1 ,100);
92
93 % Initialise vectors for all the quantities .
94 u = zeros ( size ( x_mesh ));
95 a = zeros ( size ( x_mesh ));
96 rho = zeros ( size ( x_mesh ));
97 T = zeros ( size ( x_mesh ));
98 p = zeros ( size ( x_mesh ));
99
100 % Calculate boundaries of different zones .
101 % Boundary between leftmost driver gas and expansion wave .
102 x4_exp = L1 - time * a4 ;
103 % Boundary between expansion wave and lower pressure driver gas .
104 exp_x3 = L1 + time *( u3 - a3 );
105 % Boundary between driver gas and driven gas .
106 x3_x2 = L1 + time * u_p ;
107 % Location of the shock wave .
108 x2_x1 = L1 + time * W ;
109
110 % Iterate through x_mesh and fill in all the quantities .
111 for i = 1: length ( x_mesh )
112 if x_mesh ( i ) < x4_exp
113 % We are in region 4.
114 u ( i ) = 0;
115 a ( i ) = a4 ;
116 rho ( i ) = rho4 ;
117 T ( i ) = T4 ;
118 p ( i ) = p4 ;
119 elseif x_mesh ( i ) < exp_x3
120 % We are in the expansion wave .
121 [ u ( i ) , a ( i ) , rho ( i ) , T ( i ) , p ( i )] = expansion_wave ( x_mesh ( i ) - L1 );
122 elseif x_mesh ( i ) < x3_x2
123 % We are in region 3.
124 u ( i ) = u3 ;
125 a ( i ) = a3 ;
126 rho ( i ) = rho3 ;
127 T ( i ) = T3 ;
128 p ( i ) = p3 ;
129 elseif x_mesh ( i ) < x2_x1
130 % We are in region 2.
131 u ( i ) = u2 ;
84
B.2 The oblique shock function Validation of OpenFOAM for nozzle flows
132 a(i) = a2 ;
133 rho ( i ) = rho2 ;
134 T(i) = T2 ;
135 p(i) = p2 ;
136 else
137 % We are in region 1.
138 u ( i ) = 0;
139 a ( i ) = a1 ;
140 rho ( i ) = rho1 ;
141 T ( i ) = T1 ;
142 p ( i ) = p1 ;
143 end
144 end
145
146 function [ u_exp , a_exp , rho_exp , T_exp , p_exp ] = expansion_wave ( x )
147 % Calculate properties within expansion wave . The expressi ons here
148 % are valid for - a4 <= x / time <= u3 - a3 .
149 % Calculate mass velocity .
150 u_exp = 2/( gamma +1) * ( a4 + x / time );
151 % Calculate speed of sound .
152 a_exp = a4 * (1 - ( gamma -1)/2 * u_exp / a4 );
153 % Calculate temperature .
154 T_exp = T4 * (1 - ( gamma -1)/2 * u_exp / a4 )^2;
155 % Calculate pressure .
156 p_exp = p4 * (1 - ( gamma -1)/2 * u_exp / a4 )^(2* gamma /( gamma -1 ));
157 % Calculate density .
158 rho_exp = rho4 * (1 - ( gamma -1)/2 * u_exp / a4 )^(2/( gamma -1)) ;
159 end
160 end
85
Validation of OpenFOAM for nozzle flows B MATLAB source code
37 case 2
38 % Set defaults .
39 Ma1 = 2.5; % Freestream Mach number .
40 p1 = 101.35 e3 ; % Pressure upstream of shock in [ Pa ].
41 T1 = 288.9; % Temperature upstream of shock in [ K ].
42 theta = 15/180* pi ; % Deflection angle .
43 case 5
44 theta = 15/180* pi ; % Deflection angle .
45 case 6
46 % Everything fine .
47 otherwise
48 error ( Wrong number of arguments specified . )
49 end
50
51 % Set constants for air .
52 R = 287.05; % Specific gas constant of air in [ J /( kg * K )].
53 gamma = 1.4; % Heat capacity ratio of air .
54
55 % Compute rho1 from perfect gas relation .
56 rho1 = p1 /( R * T1 );
57
58 % Check deflection angle ( is it compression or expansion ?)
59 if theta < 0
60 error ( This would result in an expansion wave ( theta is negative ). )
61 elseif theta >= pi /2
62 error ( theta cannot be equal or larger than pi /2. )
63 end
64
65 % Calculate and check shock wave angle using the beta - theta - Mach relation .
66 lambda = sqrt (( Ma1 ^2 - 1)^2 - 3*(1 + ( gamma -1)/2* Ma1 ^2)*...
67 (1 + ( gamma +1)/2* Ma1 ^2)* tan ( theta )^2);
68 chi = (( Ma1 ^2 - 1)^3 - 9*(1 + ( gamma -1)/2* Ma1 ^2)*...
69 (1 + ( gamma -1)/2* Ma1 ^2 + ( gamma +1)/4* Ma1 ^4)* tan ( theta )^2) / lambda ^3;
70 beta = atan (( Ma1 ^2 - 1 + 2* lambda * cos ((4* pi + acos ( chi ))/3)) /...
71 (3*(1 + ( gamma -1)/2* Ma1 ^2)* tan ( theta )));
72 if ( beta < 0 || ~ isreal ( beta ))
73 error ( The shock is detached , choose a smaller theta or a larger Ma1 . )
74 end
75
76 % Check if the given point is upstream or downstream of the sho ck wave ( or
77 % in a nonsensical position ).
78 [ phi , r ] = cart2pol (x , y + eps );
79 if ( phi < theta && r > 0)
80 % The point lies IN the wedge or in the lower half - plane .
81 error ([ The specified coordinates belong to a point IN the wedge ,...
82 or in the lower half - plane . ])
83 elseif ( phi < beta && r > 0)
84 % The point is downstream of the shock wave .
85 Ma_n1 = Ma1 * sin ( beta ); % Normal component of upstream Ma number .
86 rho = rho1 * ( gamma + 1) * Ma_n1 ^2 / (( gamma - 1)* Ma_n1 ^2 + 2);
87 p = p1 + p1 *2* gamma / ( gamma + 1) * ( Ma_n1 ^2 - 1);
88 Ma_n2 = sqrt (( Ma_n1 ^2 + 2/( gamma -1)) / (2* gamma / ( gamma -1) * Ma_n1 ^2 - 1));
89 T = T1 * p / p1 * rho1 / rho ;
90 Ma = Ma_n2 / sin ( beta - theta );
91 else
92 % The point is upstream of the shock wave or at the origin .
93 Ma = Ma1 ;
94 rho = rho1 ;
95 p = p1 ;
96 T = T1 ;
97 end
86
C Additional results
C.1 Shock tube plots from the solver quality evaluation
0.9 1.4
rhopSonicFoam rhopSonicFoam
rhoSonicFoam rhoSonicFoam
sonicFoam sonicFoam
rhoTurbFoam rhoTurbFoam
0.8 sonicTurbFoam sonicTurbFoam
Analytical 1.2 Analytical
0.7
1
0.6
0.8
Density [kg/m3]
Mach number
0.5
0.6
0.4
0.4
0.3
0.2
0.2
0.1 0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35
xcoordinate of tube [m] xcoordinate of tube [m]
Figure C.1: Density and Mach number distribution at t = 2.5 104 s: comparison of
OpenFOAM solvers for the 1D case.
0.9 1.4
rhopSonicFoam rhopSonicFoam
rhoSonicFoam rhoSonicFoam
sonicFoam sonicFoam
rhoTurbFoam rhoTurbFoam
0.8 sonicTurbFoam sonicTurbFoam
1.2 Analytical
Analytical
0.7
1
0.6
0.8
Density [kg/m ]
Mach number
3
0.5
0.6
0.4
0.4
0.3
0.2
0.2
0.1 0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35
xcoordinate of tube [m] xcoordinate of tube [m]
Figure C.2: Density and Mach number distribution at t = 2.5 104 s: comparison of
OpenFOAM solvers for the 2D case.
87
Validation of OpenFOAM for nozzle flows C Additional results
0.9 1
rhopSonicFoam rhopSonicFoam
rhoSonicFoam rhoSonicFoam
sonicFoam sonicFoam
rhoTurbFoam 0.9 rhoTurbFoam
0.8 sonicTurbFoam sonicTurbFoam
Analytical Analytical
0.8
0.7
0.7
0.6
0.6
Density [kg/m3]
Mach number
0.5 0.5
0.4
0.4
0.3
0.3
0.2
0.2
0.1
0.1 0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35
xcoordinate of tube [m] xcoordinate of tube [m]
Figure C.3: Density and Mach number distribution at t = 2.5 104 s: comparison of
OpenFOAM solvers for the axi-symmetric case.
0.9 1
rhopSonicFoam rhopSonicFoam
sonicFoam sonicFoam
rhoTurbFoam rhoTurbFoam
sonicTurbFoam 0.9 sonicTurbFoam
0.8 Analytical Analytical
0.8
0.7
0.7
0.6
0.6
Density [kg/m ]
Mach number
3
0.5 0.5
0.4
0.4
0.3
0.3
0.2
0.2
0.1
0.1 0
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35
xcoordinate of tube [m] xcoordinate of tube [m]
Figure C.4: Density and Mach number distribution at t = 2.5 104 s: comparison of
OpenFOAM solvers for the 3D case.
88
C.2 Supersonic wedge plots from the solver quality evaluation Validation of OpenFOAM for nozzle flows
0.25 0.25
rhopSonicFoam rhopSonicFoam 2nd order
sonicFoam sonicFoam 2nd order
Analytical Analytical
0.2 0.2
Distance from wedge [m]
0.1 0.1
0.05 0.05
0 0
1.8 1.9 2 2.1 2.2 2.3 2.4 2.5 2.6 1.8 1.9 2 2.1 2.2 2.3 2.4 2.5 2.6
Mach number Mach number
(a) (b)
Figure C.5: Comparison of laminar solver perpendicular samples to analytical solution: (a)
1st order spatial discretisation; (b) 2nd order spatial discretisation
89