0% found this document useful (0 votes)
2 views

Lecture Notes

The document is a course outline for 'Fluid Mechanics 101: CFD for Professionals' by Dr. Aidan Wimshurst, focusing on verification and validation in computational fluid dynamics (CFD). It emphasizes the importance of verifying model setups and validating results against experimental data to ensure accuracy. The course includes exercises for practical understanding and is structured into chapters that cover validation methods and data presentation techniques.

Uploaded by

Tushar Hebbar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Lecture Notes

The document is a course outline for 'Fluid Mechanics 101: CFD for Professionals' by Dr. Aidan Wimshurst, focusing on verification and validation in computational fluid dynamics (CFD). It emphasizes the importance of verifying model setups and validating results against experimental data to ensure accuracy. The course includes exercises for practical understanding and is structured into chapters that cover validation methods and data presentation techniques.

Uploaded by

Tushar Hebbar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

Fluid Mechanics 101

CFD for Professionals

Dr Aidan Wimshurst
Table of Contents

Disclaimer 3
How To Use This Course 4
Chapter 1: Verification and Validation 5
Chapter 2: Presenting Data 35
011011001001101101000110101111001010101010101100101101001101100100110110
110110010011011010001101011110010101010101011001011010011011001001101101
110110010011011010001101011110010101010101011001011010011011001001101101
011011001001101101000110101111001010101010101100101101001101100100110110
110110010011011010001101011110010101010101011001011010011011001001101101

Disclaimer
011011001001101101000110101111001010101010101100101101001101100100110110
001101100100110110100011010111100101010101010110010110100110110010011011
011011001001101101000110101111001010101010101100101101001101100100110110
011011001001101101000110101111001010101010101100101101001101100100110110
001101100100110110100011010111100101010101010110010110100110110010011011
The exercises, software, code, figures, tables, explanations and equations in this
1 0 0 1 1 0 1 1 0 0 course
1 0 0 1 are
1 0 1for
1 0educational
1 0 0 0 1 1 0 and
1 0 1demonstrative
1 1 1 0 0 1 0 1 0purposes
1 0 1 0 1 only.
0 1 0 1They
1 0 0should
1 0 1 1 not
0 1 0be
0 1used
1011001001101
0 1 0 0 1 1 0 1 1 0 to
0 1analyse,
0 0 1 1 0 design,
1 1 0 1 0accredit
0 0 1 1 0or
1 0validate
1 1 1 1 0real
0 1 scientific
0 1 0 1 0 1/0 engineering
1010110/ 0 1mathematical
01101001101100100110
1 0 0 1 1 0 1 1 0 0 structures
1 0 0 1 1 0 1and
1 0 flow
1 0 0 systems.
0 1 1 0 1 0For
1 1 such
1 1 0 applications,
0 1 0 1 0 1 0 1 appropriate
0 1 0 1 0 1 1 0trained,
0 1 0 1 1qualified
0 1 0 0 1and
1011001001101
accredited (SQEP) engineers / scientists should be consulted along with the
100110110010011011010001101011110010101010101011001011010011011001001101
appropriate documentation and engineering standards. Fluid Mechanics 101 and
0 1 0 0 1 1 0 1 1 0 Dr.
0 1 0Aidan
0 1 1 0Wimshurst
1 1 0 1 0 0 0are
1 1not
0 1 accountable
0 1 1 1 1 0 0 1or0 1liable
0 1 0in
1 0any
1 0 form
1 0 1 for
1 0 0the
1 0use
1 1 of
0 1misuse
001101100100110
1 0 0 1 1 0 1 1 0 0 of
1 0the
0 1 information
1 0 1 1 0 1 0 0contained
0 1 1 0 1 0in1 this
1 1 1 course
0 0 1 0 beyond
1 0 1 0 1the
0 1 0specific
1 0 1 1 educational
0 0 1 0 1 1 0 1and
0011011001001101
0 1 0 0 1 1 0 1 1 0 demonstrative
0 1 0 0 1 1 0 1 1 purposes
0 1 0 0 0 1for
1 0which
1 0 1 1it1 was
1 0 0intended.
1010101010101100101101001101100100110
101001101100100110110100011010111100101010101010110010110100110110010011
010011011001001101101000110101111001010101010101100101101001101100100110
010011011001001101101000110101111001010101010101100101101001101100100110
101001101100100110110100011010111100101010101010110010110100110110010011
010011011001001101101000110101111001010101010101100101101001101100100110
010011011001001101101000110101111001010101010101100101101001101100100110
101001101100100110110100011010111100101010101010110010110100110110010011
010011011001001101101000110101111001010101010101100101101001101100100110
010011011001001101101000110101111001010101010101100101101001101100100110
101001101100100110110100011010111100101010101010110010110100110110010011
010011011001001101101000110101111001010101010101100101101001101100100110
001101100100110110100011010111100101010101010110010110100110110010011011
100110110010011011010001101011110010101010101011001011010011011001001101
001101100100110110100011010111100101010101010110010110100110110010011011
001101100100110110100011010111100101010101010110010110100110110010011011
100110110010011011010001101011110010101010101011001011010011011001001101
001101100100110110100011010111100101010101010110010110100110110010011011
100110110010011011010001101011110010101010101011001011010011011001001101
010011011001001101101000110101111001010101010101100101101001101100100110
100110110010011011010001101011110010101010101011001011010011011001001101
100110110010011011010001101011110010101010101011001011010011011001001101
010011011001001101101000110101111001010101010101100101101001101100100110
100110110010011011010001101011110010101010101011001011010011011001001101
100110110010011011010001101011110010101010101011001011010011011001001101
010011011001001101101000110101111001010101010101100101101001101100100110
100110110010011011010001101011110010101010101011001011010011011001001101
100110110010011011010001101011110010101010101011001011010011011001001101
010011011001001101101000110101111001010101010101100101101001101100100110
How To Use This Course

As you proceed through this course, a series of suggested exercises are provided.
These exercises are intended to improve your understanding of the course material
and should only take five to ten minutes to complete. You can either attempt the
exercises as you read through the course, or at the end of the chapter. The exercises
are not essental but are highly recommended to improve your understanding of the
course material. An example of a suggested exercise is provided below in the red box.

The answers to the exercises can be found in the other PDF document provided
with this course. In addition to the answers, you will find Excel spreadsheets and
python source code that can be used for some of the exercises. For the exercises
where calculation is required, you can use either the Excel spreadsheets or python
code to complete the exercises. The aim of the course is not to develop knowledge
of a specific CFD code or programming language but to learn and understand the
overall process. Therefore, you should use whichever approach is more appealing and
straightforward for you to use. You can even use the equations in the text to write
your own code or scripts if you prefer!

Suggested Exercise Example (1)

Calculate the area of a right-angled triangle with side lengths of 3m, 4m and 5m.

Hint: The area of a right-angled triangle is half the base length multipled by the
height.
Chapter 1
Verification and Validation
Chapter 1
Verification and Validation
Quantity of Interest ( )

Relative Error

Fine Medium Coarse

Fine Medium Coarse

Welcome to my CFD for Professionals course! The aim of this course is to provide you with
some new concepts and skills that you can apply to your CFD simulations to significantly improve
their quality. I anticipate that you may have come across some of the course content before, but
the majority of the content is likely to be new and will be incredibly useful for you. This course
does not cover how CFD codes work, or provide a tutorial for how to carry out specific actions in
a CFD code. It is assumed that you have access to a CFD code and are comfortable with running
CFD simulations with the code. The lessons provided in this course are general and can be applied
to any CFD code. It is left to you to implement the lessons in your own CFD code. If you have
difficulties with implementing the lessons in your CFD code, it is recommended that you either visit
the manual of your CFD code, or contact a representative from the code vendor (ANSYS or Siemens
for example). Now we are ready to begin the course!

Dr. Aidan Wimshurst, Fluid Mechanics 101 6


Verification and Validation
CFD studies must undergo a process of Verification and Validation, before the results can be accepted
and used with confidence. Verification and validation are separate processes and are required for
different reasons:

I Verification is the process of checking that the CFD model has been setup correctly, with the
correct boundary conditions, equations and parameter values.

I Validation is the process of assessing the accuracy of the results of the model and comparing
these with experimental measurements.

When using a commercial CFD code such as ANSYS Fluent, ANSYS CFX or Star CCM+, the
equations and solution algorithms will have been verified internally by the code vendor (ANSYS or
Siemens for example). Therefore, it can be assumed that the equations and solution algorithms have
been implemented correctly, as described in the user manual/s. Open source codes like OpenFOAM,
Fluidity, SU2 and Code Saturne are also subject to regular verification by the developers. These
verification tasks are published in the release notes and do not need to be repeated by the user.
While the majority of the verification tasks are carried out by the code vendor, the author still
has to carry out verification tasks when carrying out a CFD investigation. These verification tasks
include:

I Checking that the correct boundary conditions have been applied to the model.

I Checking that the correct physical models (turbulence, buoyancy, multi-phase treatment etc.)
have been selected.

I Checking that any additional user-defined functionality has been implemented correctly.

I Checking that the calculation has been run for enough iterations that the residuals have reduced
considerably and the solution has converged.

These verification checks can be carried out by the author themselves (self-checking) or by other
members of the engineering team / research group. The verification process is an essential part
of all CFD investigations, to ensure that the work is free from errors in the model setup. It is
strongly encouraged that the author follows the verification process and guidelines of their company
/ university / institution or industry to ensure that the analysis is free from errors. The verification
process is not the focus of this course and will not be considered further, as it is assumed that the
author has verified their work, following the guidelines of their company / university / institution or
industry.
In addition to verifying that the CFD model has been setup correctly, the CFD model must also
be validated to assess the accuracy of the model. The validation process often involves:

I Comparing the results of the CFD model with experimental measurements, to assess how well
the CFD model computes real quantities that can be measured.

I Comparing the results of the CFD model with the same CFD calculation carried out by different
authors in the literature.

I Running the same CFD model with different turbulence models and other numerical parameters,
to see which models give the closest representation of reality.

Dr. Aidan Wimshurst, Fluid Mechanics 101 7


CFD analyses that give an indication of the level of accuracy and error are more reliable than
analyses which do not give an indication of the level of accuracy and error. However, demonstrating
the level of accuracy in a CFD analysis is complicated, as there are many sources of error. Some
notable sources of error include:

I Meshes that are too coarse.

I Time steps that are too large.

I Simplifications to the geometry to facilitate meshing.

I Choosing a turbulence model which was not calibrated for the given application.

As there are many sources of error, it is not clear in what order and how the sources of error should
be considered. This course presents some simple methods that can be used for a first investigation
of the level of accuracy and how to demonstrate this to the reader. Of course, this course is limited
in scope and cannot consider all possible sources of error. Therefore, the methods presented here are
only intended to be used as a starting point and further studies may be required.
Before starting, it should be emphasised that for real life engineering applications the methods
presented in this course are not sufficient on their own to assess the safety and reliability of a system.
The reader should always consult appropriate documentation, engineering standards and
suitably qualified engineering personnel for guidance with real applications. The methods
presented in this course should never be used on their own and are only intended for teaching purposes.
This course is divided into two main chapters. The first chapter discusses methods which can be
used as part of a validation exercise to assess the level of accuracy in a CFD analysis. The second
chapter presents several data presentation techniques, which can be used to clearly present the results
of the CFD analysis to the reader.

Dr. Aidan Wimshurst, Fluid Mechanics 101 8


Validation of CFD Calculations
There are many sources of error in CFD calculations. Some notable source of error include:

I Meshes that are too coarse.

I Time steps that are too large.

I Simplifications to the geometry to facilitate meshing.

I Choosing a turbulence model which was not calibrated for the given application.

These sources of error (and others which are not mentioned) all affect the accuracy of the CFD
solution. If the error arising from each of these sources can be quantified, then the CFD results
can be used with greater confidence. However, it is not straightforward to assess the error in CFD
calculations, as the error from all the sources is combined together in the final CFD solution. The
most straightforward approach to assessing the different sources of error is to consider each of them
independently. This is the approach that will be adopted in this course. The error arising from
the mesh resolution will be considered first, as this source of error is most common. To finish the
chapter, the error arising from the choice of turbulence model and other numerical parameters will
be considered.

Mesh Refinement Studies


The ideal CFD mesh has an infinite number of cells. Of course, an infinitely fine mesh cannot be
generated and solved in practice, and a mesh with a finite number of cells has to be used instead.
Unfortunately, there is an error associated with using a mesh with a finite number of cells, because
the solution variables in the CFD code vary (at best) linearly across the cells. This error is called the
discretisation error. The discretisation error can be estimated using a mesh refinement study, where a
series of meshes with increasing levels of refinement are used to solve the same CFD problem. Once
the discretisation error has been estimated, a mesh can be chosen that has both an acceptable level
of accuracy and a reasonable compute time for future studies.

Background
Consider a flow quantity φ that is computed by the CFD code. φ could represent velocity, temperature,
pressure or any other variable that is computed by the CFD code. φ will vary in space and time,
throughout the CFD domain. As an example, Figure 1 shows an example of a real temperature profile
at a location in a CFD domain. The temperature profile in Figure 1 has a complicated shape and it
is not possible for the CFD code to compute this function exactly. In CFD codes, the flow variables
vary (at best) linearly across the cells in the mesh. Therefore, the CFD code computes a piecewise
linear approximation to the temperature profile.
Over a small distance x, the real temperature profile φ can be represented by a Taylor Series
expansion:
φ = c0 + c1 x + c2 x2 + c3 x2 + ... (1)
where c1 , c2 , c3 , ... are coefficients that are used to fit the polynomial to the real temperature profile
and x is the distance from the sampling point. A diagram of the Taylor Series expansion is shown in
Figure 2.

Dr. Aidan Wimshurst, Fluid Mechanics 101 9


Real Temperature Profile CFD Approximation

Figure 1: An example of a real temperature profile and the piecewise linear solution computed with
a CFD code.

Figure 2: A Taylor Series expansion over a small distance x can be used to represent the real
temperature profile.

The CFD domain is discretised by a mesh of cells. Within these cells, the flow profiles vary (at
best) linearly across the cells. Therefore, over a small distance x, the CFD solution (φCFD ) is:

φCFD = c0 + c1 x (2)

The discretisation error e is the difference between the CFD solution and the real flow profile.

e = φ − φCFD (3)

e = c2 x2 + c3 x3 + c4 x4 ... (4)
Notice that the error is proportional to the distance squared (x2 ). Hence, if the distance is reduced by
1/2, then the error is reduced by a factor proportional to 1/4 (at best). The distance over which the
linear approximation is made in CFD codes is the distance between cell centroids h. Therefore, as the
cell size is reduced, the error can reduce by (at best) a factor proportional to the distance between
cell centroids squared. Hence, ideal CFD solutions are often described as second-order accurate, even
though the variation across the cell is linear. This is equivalent to stating that the order of accuracy
p is equal to 2.
As an example of the discretisation error, Figure 3 shows the velocity profile computed with two
different CFD meshes. The error is the red shaded area between the CFD solution and the real profile.
As the mesh is refined, the error reduces and the CFD solution is a better approximation to the real
profile.

Dr. Aidan Wimshurst, Fluid Mechanics 101 10


Legend

Real
CFD
Error

Coarse Mesh Fine Mesh

Figure 3: As the mesh is refined, the discretisation error (shaded in red) reduces. If the variation
across the cell is linear, then the error reduces proportional to h2 where h is the distance between
cell centroids.

Reducing the Order of Accuracy


For the majority of the CFD mesh, the flow variables vary linearly across the cells. If the flow variables
vary linearly across all the cells, then the solution will be second-order accurate and the error will
reduce proportional to h2 as the mesh is refined. However, it is sometimes necessary to modify the
variation across the cell, in order to stop the CFD solution from diverging. Some notable methods
where the variation across the cell is modified include:

I Upwind differencing

I Gradient limiters

I Skewness error (for poor quality cells)

An example of how each of these modifications reduces the order of accuracy, will now be provided.
Figure 4 shows a comparison of upwind differencing and central differencing. Upwind differening
and central differencing are interpolation algorithms used by the CFD code to compute the value
at the face centre from the values at the cell centroids. With central differencing, the value at the
face centre is taken as the average of the upstream centroid and the downstream centroid. This
allows the flow variable to vary linearly between the cell centroids. With upwind differencing, the
value at the face centre is only taken from the upstream cell centroid, rather than the average of the
upstream and downstream cell centroids. This results in a variation across the cell which constant,
not linear. Hence, when the mesh is refined, the error no longer reduces proportional to h2 . This
why the majority of CFD codes recommend linear-upwind differencing instead of upwind differencing
for an accurate solution.
Figure 5 shows the variation of turbulent kinetic energy across cells in the mesh. Turbulent kinetic
energy cannot be negative (it is a bounded variable). Hence, even though the computed values at
the cell centroids are positive, the gradient must be limited to prevent a negative value on the cell
face. Gradient limiters reduce the order of accuracy of the solution, as the original linear variation
across the cell is modified.
Figure 6 shows a diagram to illustrate the source of the skewness error. The value at the face
centre is calculated by drawing a line between the cell centroids. By allowing the flow quantity φ to
vary linearly along this line, the value on the face can be interpolated from the cell centroid values

Dr. Aidan Wimshurst, Fluid Mechanics 101 11


Face Value Face Value Face Value
Face Value

Centroid Centroid

Flow Direction Flow Direction

Ist Order Upwind Differencing Central Differencing

Figure 4: A comparison of 1st order upwind differencing and central differencing. With upwind
differencing, face values are calculated from the values at the upstream centroid. As a result, the
flow variables are constant across the cell, which reduces the order of accuracy of the solution (p).
Turbulent Kinetic Energy

Turbulent Kinetic Energy

0 0

Original Solution Gradient Limiter

Figure 5: Gradient limiters reduce the local gradient to prevent solution variables (like turbulent
kinetic energy) from becoming unbounded.

on either side of the face. However, if the face is skewed, this line does not coincide exactly with
the face centre. Hence, interpolating along the line does not calculate the value at the face centre
exactly, and there is a small error. This source of error is called the skewness error. As the mesh is
refined, the overall error will not reduce proportional to h2 , as there is a small error in the calculated
value at the face centre.
Due to upwind differencing, gradient limiters and other sources of reduced accuracy, real CFD
solutions are less than second order accurate (p < 2). The actual order of accuracy will vary on a case-
by-case basis, as all CFD calculations use different meshes and are solved using different numerical
methods. It follows that because gradient limiters, upwind differencing and other numerical methods
affect the order of accuracy, the order of accuracy cannot be determined before the CFD calculations
are carried out. The order of accuracy can only be determined after the CFD calculations have been
carried out. The order of accuracy and the discretisation error are typically calculated as part of a
mesh refinement study. In the next section, the process of carrying out a mesh refinement study will
be described, along with the order of accuracy and discretisation error.

Dr. Aidan Wimshurst, Fluid Mechanics 101 12


Skewness Error

Face
Centre

Cell Centroid
Cell Centroid

Figure 6: The interpolation between cell centroids may not coincide with the face centre when the
mesh is highly skewed. This is called the skewness error and reduces the order of accuracy.

Square Mesh Rectangular Mesh Unstructured Mesh

Figure 7: A diagram to show the different methods for calculating the representative length for
different 2D meshes. N is the number of cells in the mesh and Ap is the area of the cell.

Representative Cell Length


The first stage in a mesh sensitivity study is to define a representative length for the cells in the mesh
so that the convergence of the solution can be tracked as the mesh is refined. It is more useful to
track the representative cell length h, rather than the number of cells N , as h −→ 0 for an infinitely
fine mesh while N −→ ∞. If the mesh is being refined locally, then h should be representative of the
size of the cells in the refinement region. On the other hand, if the mesh is being refined globally,
then the representative cell size should be representative of all the cells in the mesh.
Figure 7 shows some example 2D meshes and their representative lengths. For a general 2D cell,
the representative length can be taken as the square root of the face area. As all the cells in the
mesh have different shapes and sizes, average over all of the faces in the mesh (or refinement region)
to get a representative cell length:
1 X 1/2
h= Ap (5)
N Cells

where Ap is the area of the cell and N is the number of cells in the mesh. If the cells are uniform
(have the same shape and size), then this formula reduces to h = A1/2 p . Furthermore, if the cells are
1/2
all uniform squares, then this formula reduces to h = 1/N .
For 3D meshes, take the cube root of the cell volume to calculate the representative length instead

Dr. Aidan Wimshurst, Fluid Mechanics 101 13


1.26 0.82

Point Velocity [m/s]


Lift Coefficient [ - ]
Fine
1.24 0.80
Medium
Coarse
1.22 Coarse 0.76
Medium
Fine
1.20 0.74

1.18 0.72
0 0.004 0.008 0.012 0.016 0.020 0 0.004 0.008 0.012 0.016 0.020
Representative Cell Length (h) [m] Representative Cell Length (h) [m]

Figure 8: An example of mesh convergence plots for lift coefficient and point velocity. The solution
for an infinitely fine mesh (h = 0) is unknown and we do not know the error in the fine mesh.

of the square root of the face area.


1 X 1/3
h= Vp (6)
N Cells
where Vp is the volume of the cell. If the cells are uniform (have the same size and shape), then
this formula reduces to h = Vp1/3 . Furthermore, if the cells are all uniform cubes, then this formula
reduces to h = 1/N 1/3 .
Mesh refinement studies should be carried out with at least three different meshes that have
significantly different levels of refinement. Celik et al. (2008) recommends that the representative
cell lengths (h) should be at least 30% different between each mesh. You can check that your
representative cell lengths are sufficiently different by calculating the refinement ratio (r), which
should be greater than 1.3:
hCoarse Mesh hMedium Mesh
> 1.3
r= r= > 1.3 (7)
hMedium Mesh hFine Mesh
Once at least three different meshes have been generated, carry out a CFD calculation with each
mesh and record the results. Figure 8 shows an example of the CFD solution with three meshes,
plotted against their representative cell length h. In Figure 8, the lift coefficient and point velocity
are plotted as an example. Figure 8 shows that the lift coefficient tends towards a final solution as
the mesh is refined. However, the mesh refinement study is incomplete and there are a number of
questions still remaining:

I What is the solution on an infinitely fine mesh (h = 0)?

I How close is the fine mesh to the solution on an infinitely fine mesh (what is the error)?

I How fast are the results converging to the infinitely fine mesh value?

The most popular method of addressing these questions is based on an extrapolation method
proposed by Richardson (1910, 1927). This method is popular in the CFD community and is rec-
ommended by the Journal of Fluids Engineering, amongst others. In the next section, Richardson
Extrapolation will be explained and used to answer the three remaining questions in the list above.

Dr. Aidan Wimshurst, Fluid Mechanics 101 14


Richardson Extrapolation
Figure 8 shows that the solution variable φ (representing lift coefficient, point velocity, or any other
quantity that is being studied) varies as a function of the representative cell length h. The basic
idea of Richardson Extrapolation is to fit a function to this data. The function can then be used
to extrapolate and calculate the value of φ at h = 0 (the solution on an infinitely fine mesh). The
simplest function would be a general polynomial of h:

φ = φ0 + c1 h + c2 h2 + c3 h3 + ... (8)
Ideal CFD calculations are second order accurate and φ varies in proportion to h2 . Hence, we could
just use a second order polynomial:

φ = φ0 + c2 h2 (9)
However, real CFD calculations do not achieve second-order accuracy in practice, as discussed in the
previous section. Therefore, the fitting function needs to allow φ to vary at a rate that is lower than
h2 . Hence, it would be better to use a power-law function:

φ = φ0 + chp (10)
where p is a positive real number and c is a constant that is used to fit the function to the data. The
power-law function can be used for the ideal case where p = 2 and also real CFD cases where p is
less than 2. The parameter p is referred to as the order of convergence or the order of accuracy of
the mesh refinement study.
Once the power-law function has been fitted to the mesh refinement study, it can be used to
estimate the solution on an infinitely fine mesh (φ0 ) by extrapolation. However, in order to perform
the extrapolation, the order of convergence (p) must have been calculated. For now, assume that p
is known and we will return to this later on.
To determine φ0 , use the values of φ that have been calculated on the fine and medium meshes.
These values will be referred to as φ1 and φ2 , where the subscript 1 denotes the fine mesh and the
subscript 2 denotes the medium mesh. As φ1 and φ2 are known (they have been calculated in the
mesh refinement study), the power law can be used to write two equations with two unknowns (c
and φ0 ):

φ1 = φ0 + ch1 p φ2 = φ0 + ch2 p (11)


Combine the equations by eliminating c and rearrange for φ0 :
φ1 − φ0
c= (12)
h1 p
(h2 /h1 )p φ1 − φ2
φ0 = (13)
(h2 /h1 )p − 1
Simplify by introducing the refinement ratio r21 = h2 /h1 :
p
r21 φ1 − φ2
φ0 = p (14)
r21 −1
Some authors choose to rewrite this equation by adding +φ1 and −φ1 to the top of the fraction:
p
φ1 r21 − φ2 + φ1 − φ1
φ0 = p (15)
r21 −1

Dr. Aidan Wimshurst, Fluid Mechanics 101 15


1.26 0.82

Velocity at Point [m/s]


Lift Coefficient [ - ]

1.24 0.80

1.22 0.76

1.20 0.74

1.18 0.72
0 0.004 0.008 0.012 0.016 0.020 0 0.004 0.008 0.012 0.016 0.020
Representative Cell Length (h) [m] Representative Cell Length (h) [m]

Figure 9: An example of mesh convergence plots, with extrapolated values of φ0 added at h = 0


Quantity of Interest ( )

Legend

Ideal (p = 2)
Real CFD (p = 1.5)
Real CFD (p = 1.1)

0 0.004 0.008 0.012 0.016 0.02


Representative Cell Length (h)

Figure 10: A diagram to demonstrate how the order of convergence (p) affects the mesh
refinement plot.

p
φ1 (r21 − 1) φ1 − φ2
φ0 = p + p (16)
r21 − 1 r21 − 1

φ1 − φ2
φ0 = φ1 + p (17)
r21 −1
This equation allows the solution on an infinitely fine mesh (φ0 ) to be calculated from the solution
on the fine and medium meshes (φ1 and φ2 ). φ0 can then be added to the mesh convergence plots
to give a more complete picture of the convergence behaviour of the solution, as shown in Figure 9.
However, before we can do this, the order of convergence (p) needs to be calculated.

Order of Convergence
Before calculating the order of convergence (p), it is worth understanding the effect of the order of
convergence on the mesh refinement study. Figure 10 shows a comparison of three different mesh
refinement studies, each with a different order of convergence p. As the order of convergence increases
from 1 to 2, the gradient increases and the solution approach the infinitely fine value (φ0 ) faster.
Hence, for the same representative cell length h (the same mesh), the mesh with the higher order
of convergence will give a result that is closer to φ0 (it is more accurate). However, it should be

Dr. Aidan Wimshurst, Fluid Mechanics 101 16


Quantity of Interest ( ) Legend

Ideal (p = 2)
Real CFD (p = 1.5)
Real CFD (p = 1.1)

0 0.004 0.008 0.012 0.016 0.02


Representative Cell Length (h)

Figure 11: The shaded error indicates 5% error relative to φ0 . The points indicate the
representative cell length required to achieve an error of less than 5%. Notice that p = 1.1 requires
a much finer mesh to achieve the same accuracy as p = 2.

emphasised that a CFD study with a low order of convergence is not necessarily worse than a CFD
study with a high order of convergence. The most important thing is that the solution is close to
φ0 (the error is small). For a CFD solution with a low order of convergence, the same accuracy can
be achieved but a finer mesh is required. For example, Figure 11 shows the same mesh convergence
studies as Figure 10 but with a shaded region to indicate a 5% error relative to φ0 . The CFD solution
with the lower order of convergence is still able to be achieve a solution that is within 5% of φ0 , but
the representative cell length has to be smaller (the mesh has to be finer).
To determine the order of convergence, start with the general power law function for φ:

φ = φ0 + chp (18)
Take the base-10 logarithm of both sides of the equation:

log10 (φ − φ0 ) = p ∗ log10 (h) + log10 (c) (19)


| {z } | {z } | {z }
y mx c

This is the same form as the general equation of a straight line y = mx + C. Hence, we can
plot φ against h on a logarithmic axis and the gradient gives the order of convergence (p). Generally,
only two points are required to calculate the gradient. Hence, only two meshes (fine and medium)
are required to determine the order of convergence. However, this approach is only sufficient if the
convergence is monotonic. Some quantities may experience oscillatory convergence as the grid is
refined, rather than monotonic convergence. Figure 12 shows a schematic diagram to illustrate the
difference between monotonic and oscillatory convergence.
It is not possible to use the plotting method to determine the order of convergence when the
convergence is oscillatory. For this reason, Celik et al. (2008) propose a more general method to
determine the order of convergence which is applicable to both monotonic and oscillatory convergence.
First determine the difference in the solution between the fine mesh and the medium mesh (21 ) and
the difference in solution between the medium mesh and the coarse mesh (32 ):

21 = φ2 − φ1 32 = φ3 − φ2 (20)


Now calculate the ratio of 21 and 32 :
32
 
s = sign (21)
21

Dr. Aidan Wimshurst, Fluid Mechanics 101 17


Quantity of Interest ( )

Quantity of Interest ( )
Representative Cell Length (h) Representative Cell Length (h)

Monotonic Oscillatory

Figure 12: A comparison of monotonic and oscillatory convergence.

If the ratio is positive, then 21 and 32 have the same sign the convergence is monotonic. If the
ratio is negative, then 21 and 32 have opposite signs and the convergence is oscillatory. Regardless
of whether the convergence is monotonic or oscillatory, the order of convergence can be calculated
by solving the following two coupled equations proposed by Celik et al. (2008):

rp − s
!
1
p= |ln|32 /21 | + q| q = ln 21
p (22)
ln (r21 ) r32 −s
There are two equations and two unknowns (p and q). A simple method of solving the coupled
equations is to combine them and rearrange into the following form:

rp − s
!
1
ln|32 /21 | + ln 21
p −p=0 (23)
ln (r21 ) r32 −s
This is the general form of a non-linear equation that can be solved with a root finding algorithm
f (p) = 0. Some examples of root finding algorithms that can be used to solve the equation are the
bisection method, secant method and the Newton-Raphson method. The attached python script
and Excel spreadsheets contain a simple bisection method that you can use to solve the non-linear
equation for p. Once the order of convergence has been calculated, return to either equation 14 or 17,
so that the extrapolated value of φ0 can be calculated. Once φ0 and p have both been determined, the
error in the mesh refinement study can be calculated. The calculation of the error will be discussed
in the next section.

Quantifying the Error


The most common method of assessing the discretisation error is to compare the solution values on
the fine mesh (φ1 ) and the medium mesh (φ2 ):

φ2 − φ1
e21 = (24)
φ1
This metric is known as the relative error. It is not the most reliable metric for quantifying the
error because it does not account for how close the fine mesh solution is to the infinitely fine mesh
solution (φ0 ). However, as we have used Richardson Extrapolation, an estimate of φ0 is available.
This value can be used to give a better estimate of the error:

Dr. Aidan Wimshurst, Fluid Mechanics 101 18


Quantity of Interest ( )

Quantity of Interest ( )
Representative Cell Length (h) Representative Cell Length (h)

Relative Error Extrapolative Relative Error

Figure 13: A graphical comparison of the relative error and the extrapolated relative error.

φ1 − φ0
eextr
21 = (25)
φ0
This metric is known as the extrapolated relative error. It is more useful than the relative error,
as the error is expressed relative to the estimated solution on an infinitely fine mesh, rather than the
difference between meshes that we happened to have created. Figure 13 shows a graphical comparison
of the relative error and the extrapolated relative error, to illustrate the difference. From Figure 13
it is clear that the extrapolated relative error is a better metric to quantify the error in the mesh
refinement study.
In some instances, the author may have not have used Richardson Extrapolation to estimate φ0 .
For these cases, Roache (1994) proposed an alternative measure of the error known as the Grid
Convergence Index (GCI21 ). To derive the formula for GCI21 , start with the following definition for
the error:
φ0 − φ1
GCI21 = (26)
φ1
Eliminate φ0 from this equation by substituting in Equation 17.
!
φ1 − φ2 1
GCI21 = φ1 + p − φ1 (27)
r21 − 1 φ1
φ1 − φ2
GCI21 = p (28)
φ1 (r21 − 1)
We can substitute e21 = (φ1 − φ2 )/φ1 (the relative error) into the equation:
e21
GCI21 = p (29)
−1 r21
By writing the equation in this form, it is clear that GCI21 represents an improvement on the
p
relative error e21 . The relative error is scaled by a factor of 1/(r21 − 1). This scaling accounts for the
order of convergence of the solution, which the definition of the relative error does not. To complete
the definition of the GCI21 , Roache (1994) applies a factor of safety of 1.25:

1.25e21
GCI21 = (30)
rp − 1

Dr. Aidan Wimshurst, Fluid Mechanics 101 19


Mesh

Figure 14: A schematic diagram of 2D flow over a backwards facing step, showing the
reattachment length xr .

Mesh Number of Cells Reattachment Length (xr /H) [ - ]

Coarse 4500 5.863


Medium 8000 5.972
Fine 18000 6.063

Table 1: Dimensionless reattachment length for three different 2D meshes

The factor of safety is applied for the following reasons:

I Richardson Extrapolation is only able to estimate φ0 . The factor of safety accounts for φ0 only
being an estimate.

I To be useful for real engineering applications, the error estimate should be conservative and
over-predict the real error.

In this Section, three different error estimates have been presented: the relative error e21 , the
extrapolated relative error eextr
21 and the Grid Convergence Index GCI21 . As these metrics are all
estimates, most authors present all three metrics with their mesh sensitivity results along with a
reference to Celik et al. (2008), so that the reader can follow the method if required. In the next
Section, a complete worked example will be provided to demonstrate how the error estimates can be
calculated and presented.

Worked Example
Figure 14 shows a schematic diagram of flow over a backwards facing step. A mesh refinement study
has been carried out to determine the distance downstream of the step where the separation bubble
reattaches (xr ). Three different 2D meshes were used to calculate the reattachment length. All three
meshes are structured and use square elements throughout the entire domain. Table 1 shows the
computed values of the reattachment length and the number of cells in each mesh.
The first stage in the Richardson Extrapolation procedure is to calculate the representative cell
length h for each of the three meshes. As the cells are all 2D uniform squares:

1 1 1
h1 = √ = 0.0074m h2 = √ = 0.0112m h3 = √ = 0.0149m (31)
18000 8000 4500
The refinement ratios for the three meshes are:

Dr. Aidan Wimshurst, Fluid Mechanics 101 20


Mesh Cells xr /H [ - ]
e21 [%] eextr
21 [%] GCI21 [%] p [-] φ0 [-]
Coarse 4500 5.863
Medium 8000 5.972 1.50 1.71 2.17 1.53 6.1685
Fine 18000 6.063

Table 2: Results of the mesh sensitivity study for dimensionless reattachment length xr .

0.0112 0.0149
r21 = = 1.50 r32 = = 1.33 (32)
0.0074 0.0112
The refinement ratios are both greater than 1.3, indicating that the meshes are sufficiently different
for a good mesh sensitivity study. The flow quantity of interest (φ) is the dimensionless reattachment
length (xr /H). Hence φ1 , φ2 and φ3 are assigned to the fine mesh, the medium mesh and the coarse
mesh:

φ1 = 6.063 φ2 = 5.972 φ3 = 5.863 (33)


Now calculate the difference in the solution between the fine mesh and the medium mesh (21 )
and the difference in the solution between the medium mesh and the coarse mesh (32 ).

21 = φ2 − φ1 = −0.091 32 = φ3 − φ2 = −0.109 (34)


The parameter s shows whether the convergence is monotonic (s = 1) or oscillatory (s = −1):
32
 
s = sign =1 (35)
21
Now solve the non-linear equation with a root finding algorithm to determine the order of con-
vergence. The python code and Excel spreadsheet included with this course both use the bisection
method, with bracketing estimates of 0.1 and 2.0
p !
1 r21 −s
ln|32 /21 | + ln p −p=0 −→ p = 1.53 (36)
ln (r21 ) r32 − s
With the order of convergence calculated, the solution on an infinitely fine mesh (φ0 ) can be
determined:
φ1 − φ2
φ0 = φ1 + p = 6.1685 (37)
r21 −1
Now the relative error, extrapolated relative error and GCI can be calculated:

φ2 − φ1 φ1 − φ0 e21
e21 = = 1.50% eextr
21 = = 1.71% GCI21 = p = 2.17% (38)
φ1 φ0 r21 −1

The results of the mesh sensitivity study and Richardson Extrapolation procedure are shown in
Table 2 and Figure 15. The results in Table 2 show that the fine mesh is well converged in terms of
the relative error and the GCI21 . As an error of 2.17% is likely to be acceptable for most engineering
studies, the solution on an infinitely fine mesh can be used with confidence. Furthermore, the order
of convergence p is 1.53. While this is less than the ideal order of convergence of 2.0, the order of

Dr. Aidan Wimshurst, Fluid Mechanics 101 21


6.2

)
6.1

Reattachment Length (
6.0

5.9

5.8
0.000 0.005 0.010 0.015 0.020
Representative Cell Length (h) [m]

Figure 15: Results of the mesh sensitivity study for the dimensionless reattachment length xr .

convergence is greater than linear (1.0). Hence, any further mesh refinement is likely to give noticeable
improvements in accuracy and could be worthwhile if the computational cost is reasonable.

Suggested Exercise (1)

Calculate the order of convergence p, relative error e21 , relative extrapolated error eextr
21 and
grid convergence index GCI21 for the following mesh sensitivity study. The mesh is 3D and
uses uniform cube shaped elements.

Mesh Number of Cells Thrust Coefficient [-]

Coarse 1 Million 1.223


Medium 5 Million 1.284
Fine 12 Million 1.302

References
Celik I, Ghia U, Roache P and Freitas C, (2008) ’Procedure for Estimation and Reporting of Uncer-
tainty due to Discretisation in CFD Applications’, Journal of Fluids Engineering, 130(7), 078001.

Richardson L. F. (1910), ’The approximate arithmetical solution by finite differences of physical prob-
lems involving difference equations, with an application to stresses in a Masonary Dam’, Transactions
of the Royal Society of London, Ser. A. 210, pp. 307 - 357.

Richardson L. F. and Gaunt J. A (1927), ’The deferred approach to the limit’, Transactions of the
Royal Society of London Ser. A. 226, pp. 299 - 361.

Roache P. J. (1994), ’Perspective: A method for uniform reporting of grid refinement studies’, Journal
of Fluids Engineering, 116, pp. 405-413.

Dr. Aidan Wimshurst, Fluid Mechanics 101 22


Turbulence Modelling and Other Parameters
Now that a mesh refinement study has been completed, other sources of error can be assessed. Figure
16 gives an example of a mesh refinement study, with the experimental measurements included.
Even with an infinitely fine mesh (by Richardson Extrapolation), the CFD results do not match the
experimental measurements. There are several possible sources of this error including:

I The turbulence modelling approach.

I Uncertainty in material properties (like thermal conductivity, density and viscosity).

I Boundary conditions and geometry simplification.

There is no general consensus for how to assess the remaining source of error. Therefore, a pragmatic
approach will be presented that will be useful for most studies.

Choosing a Turbulence Model


Reynolds-averaged Navier-Stokes (RANS) and Large Eddy Simulation (LES) turbulence models con-
tain empirical coefficients. For example, the standard k −  turbulence model solves two additional
scalar transport equations, one for k (the turbulent kinetic energy) and the other for  (the turbulence
dissipation rate):

∂ (ρk) µt
  
+ ∇ · (ρU k) = ∇ · µ + ∇k + Pk + Pb − ρ + Sk (39)
∂t σk
∂ (ρ) µt  2
  
+ ∇ · (ρU ) = ∇ · µ + ∇ + C1 (Pk + C3 Pb ) − C2 ρ + S (40)
∂t σ k k
The empirical coefficients for the standard k −  model are shown in Table 3. These coefficients
were calibrated in the original papers to give good performance for a variety of test cases (Jones and
Launder (1972)). However, it is unlikely that your CFD case is the same as one of the test cases
that were used to originally calibrate the turbulence model. Hence, there will be some error in the
CFD calculations and different turbulence models will show better / worse agreement in different
situations.
Quantity of Interest ( )

Experiment

CFD

Representative Cell Length (h)

Figure 16: An example of a completed mesh refinement study. Even with an infinitely fine mesh,
the CFD results do not match the experimental measurements.

Dr. Aidan Wimshurst, Fluid Mechanics 101 23


σk σ C1 C2 Cµ

1.0 1.3 1.55 2.0 0.09

Table 3: Model coefficients for the standard k −  model (from Jones & Launder (1972).

Experiment
Quantity of Interest ( )

Legend

Experiments

Spalart Allmaras

Representative Cell Length (h)

Figure 17: An example of a completed mesh refinement study. The fine mesh has also been
computed with the k − ω SST and Spalart Allmaras turbulence models.

One approach to address the error would be to modify the model coefficients (such as those in
Table 3) so that the turbulence model gives better agreement with the experimental measurements
in your case. However, calibrating the model coefficients can have unintended consequences and is
not recommended for inexperienced users of CFD. Therefore, turbulence models are usually treated
as ’black boxes’ (a system where only the inputs and outputs are known) and the original coefficients
are not modified.
A simpler approach is to compare different turbulence models side-by-side, as complete units.
Figure 17 shows an example of a completed mesh sensitivity study, where the fine mesh has been
computed with a selection of different turbulence models. In Figure 17, the k − ω SST turbulence
model gives the closest agreement with the experimental measurements. Therefore, it would be
reasonable to select the k − ω SST turbulence model in this investigation.

References
Jones W. and Launder B. ’The prediction of Laminarization with a Two-Equation Turbulence Model’,
Int. J. Heat Mass Transfer, 1972, 15, pp. 301-314.

What Turbulence Models Should I Investigate?


As discussed in the previous section, the preferred method of choosing a turbulence model is to
compare your results with experimental measurements, and then select the turbulence model that
gives the closest agreement. However, which turbulence models should be investigated? In almost
all cases, the k −  and k − ω SST models are the best starting point, as these models are the most
popular in the CFD community and have proven success with a wide variety of flow scenarios. Even
if you do not end up choosing these models, it is useful to show them in your comparison, as the
reader will expect to see them! If k −  and k − ω SST are insufficient, then you can investigate
and compare other models. It is common in the CFD community to recommend investigating the
following models:

Dr. Aidan Wimshurst, Fluid Mechanics 101 24


I The Spalart Allmaras model for attached aerodynamic flows.

I Reynolds Stress Transport Models for flows which have high swirl and anisotropy.

I The k − kL − ω and γ − Reθ for flows with laminar and transitional flow regions.

I Large Eddy Simulation (LES) if the calculation is feasible with the available computing re-
sources.

However, these models may not necessarily give better performance than the k −  and k − ω SST
models! Make sure to compare the results to the experiments and make the judgement yourself.

Uncertainty in Model Parameters


The effect of turbulence model choice is relatively straightforward to investigate, as the turbulence
model can be treated as a complete unit in the analysis. By comparing a few different turbulence
models, the turbulence model that gives the best agreement with the experiments can then be
chosen for further analysis. However, uncertainty in model parameters and material properties are
significantly more challenging to investigate, as these variables are continuous. For example, the
density of the fluid may take a range of values and it is not clear which value of density should be
used in the analysis. How does the uncertainty in the density of the fluid, or any other material
property affect the CFD results?

Single Parameter Uncertainty


If there is a degree of uncertainty in a single parameter only, then it is straightforward to assess the
effect of uncertainty in the parameter:

1. Identify the minimum value of the parameter.

2. Identify the maximum value of the parameter.

3. Make an estimate of the most likely value of the parameter (best estimate).

4. Select a range of values between the maximum and minimum [Optional].

5. Carry out a CFD calculation with each of these values and record the results.

Figure 18 shows an example of how results can be displayed when there is a degree of uncertainty
in a single parameter. Figure 18 shows the heat transfer coefficient for a hot component for a range
of freestream flow rates. There is a degree of uncertainty in the thermal conductivity of the fluid. To
account for this uncertainty, additional calculations were carried out with the maximum and minimum
values of the thermal conductivity at a flow rate of 2.0 kg/s. The calculated values are shown as
error bars in Figure 18. As an alternative to error bars, the same information could be shown as a
separate plot. Figure 19 shows the results of the same investigation, but with the uncertainty shown
on a separate plot rather than with error bars. The advantage of this approach is that a greater range
of thermal conductivities can be shown on a separate plot. Error bars are limited to only showing
the maximum, minimum and best estimate values. This is not the case with a separate plot, as a
greater range of values can be investigated, if desired. While the majority of CFD authors tend to
prefer error bars, either method can be adopted and this is left to the authors preference.

Dr. Aidan Wimshurst, Fluid Mechanics 101 25


Pump / Fan Hot Component
Heat Transfer Coeff. [W/m2K]

Max Conductivity
18

17 Min Conductivity

16

15
1.4 1.6 1.8 2.0 2.2
Mass Flow Rate [kg/s]

Figure 18: An example of the heat transfer coefficient for a hot component in a flow driven by a
pump or fan. The uncertainty in the thermal conductivity is shown with error bars.
Heat Transfer Coeff. [W/m2K]

Heat Transfer Coeff. [W/m2K]

18 18

17 17

16 16

15 15
1.4 1.6 1.8 2.0 2.2 Min Best Guess Max
Mass Flow Rate [kg/s] Thermal Comductivity [W/mK]

Figure 19: An example of the heat transfer coefficient for a hot component in a flow driven by a
pump or fan. The uncertainty in the thermal conductivity is shown in a separate plot.

Multiple Parameter Uncertainty


When there is uncertainty in more than one parameter, it is considerably more complicated to calculate
the resulting uncertainty in the solution. For example, consider the same heat transfer example with
the hot component, but with additional uncertainty in the mass flow rate. For simple CFD cases,
it can often be deduced which combination of variables will produce the maximum and minimum
solutions. These are often referred to as the worst-case scenario (or the conservative case) and the
best-case scenarios (or the optimistic case) respectively. For this example, it is fairly straightforward
to deduce that the maximum flow rate and the maximum thermal conductivity will produce the
greatest heat transfer from the surface. However, for more complex CFD cases, it is sometimes not
clear which combination of variables will produce the maximum and minimum solution. For example,

Dr. Aidan Wimshurst, Fluid Mechanics 101 26


what if there is also uncertainty in the viscosity of the fluid (a third variable)?
For CFD calculations where it is not clear which combiantion of variables will yield the maximum
and minimum values, specialist software should be used. Dakota and OpenTURNS are two examples
of software that can be used to assess CFD cases with multiple parameter uncertainty. As the
algorithms and implementation require detailed knowledge of statistics, they will not be covered in
this course. If you have a CFD case with uncertainty in multiple parameters, you should consult
specialist software and expertise.

No Experimental Data Available


In an ideal scenario, every CFD analysis would be compared directly with experimental measurements.
However, experimental data is often not available because:

I Experiments can be expensive to set-up.

I The geometry may be too large / too small to be practical for an experiment to be possible.

I It may not be possible to create an experiment at the target Reynolds / Mach / Froude number.

I It may not be possible to take measurements at the points of interest in the flow field.

I The geometry may not have been built / fully designed yet.

If experimental measurements are not available, then it is not possible to directly assess the accuracy
of the CFD results. However, the author can still provide confidence in the CFD results by either
carrying out:

I Piecewise Validation (Unit Tests), or

I Similarity Validation

A brief overview of these types of validation will now be provided.

Piecewise Validation (Unit Tests)


With piecewise validation, the first stage is to break down the CFD analysis into components. A
separate CFD analysis can then be carried out on each of these components, in isolated domains.
These individual analyses can be used to estimate the likely accuracy of each area of the complete
CFD calculation.
As an example, consider the flow of water over a novel design of tidal turbine, as shown in
Figure 20. Tidal turbines are similar to wind turbines. They extract kinetic energy from the tidal
current, rather than the wind. In this example, assume that the design of tidal turbine has not
been finished and experimental measurements are not available. The author would like to use CFD
analysis to predict the energy extracted by the tidal turbine and thrust loading on the structure. To
gain confidence in the accuracy of the CFD analysis, a piecewise validation approach can be used.
The main components of the flow over the tidal turbine are:

1. Flow over the rotating blades

2. Flow around the cylindrical support shaft

3. Flow over the nacelle of the turbine

Dr. Aidan Wimshurst, Fluid Mechanics 101 27


Tidal Turbine

Aerofoil Cylinder Bluff Body

Figure 20: An example of piecewise validation for a novel tidal turbine design. The key
components of a tidal turbine are: the aerofoils, the vertical cylinder and the bluff body

Each of these components can be analysed with a separate CFD calculation, in isolated domains:

1. Flow over a 2D aerofoil (representing a section of the blade)

2. Flow around a vertical circular cylinder (representing the flow around the support shaft)

3. Flow over a bluff body (representing the nacelle)

These isolated CFD calculations can be compared with experimental measurements (particularly
the aerofoil and circular cylinder) to assess their accuracy, and determine an appropriate level of
mesh resolution. If experimental measurements are not available for the component, then a similar
geometry can be chosen where experimental measurements are available. For example, if experimental
measurements of the aerofoil shape that makes up the blade are not available, then the author could
choose to analyse a similar aerofoil, where experimental measurements are available. As an example
of this substitution, Figure 21 shows the drag coefficient for an aerofoil that is similar to the tidal
turbine blade. In this example, the CFD results over-predict the drag on the 2D aerofoil. It follows
that if the same meshing and turbulence modelling approach is used on the full tidal turbine, the
drag on the blades will also be over-predicted. This is a useful conclusion that can be used to provide
confidence in the CFD analysis of the full tidal turbine.
The key to carrying out a piecewise validation successfully is to be able to break down the CFD
analysis into its essential components. This is a skill which often requires practice and experience!
Figure 22 shows some common components that make up many CFD analyses. You may be surprised
to find that many cases can be broken down into the simple components in Figure 22!

Dr. Aidan Wimshurst, Fluid Mechanics 101 28


Drag

Drag Coefficient [ - ]

0.014
Legend
0.012
CFD
0.01 Experiment

0.008
0 2 4 6 8 10
o
Angle of Attack [ ]

Figure 21: Drag coefficient on an aerofoil section that is similar to the blade profile used in the
tidal turbine.

Similarity Validation
Similarity validation can be used when experimental measurements are not available for the case
of interest but are available for a case that has similar geometry, Reynolds number or operating
conditions. It is common to use similarity validation when:
I Making small design changes to an existing geometry.

I Experimental measurements have been carried out on a scale model of the real geometry.

I There is a well regarded validation case that many authors use for the given application.
Similarity validation is preferred to piecewise validation because:
I The interaction between different components in the CFD analysis is captured.

I Only a single set of calculations is required. You don’t have to carry out separate CFD calcu-
lations for the different parts of the geometry.
As an example, consider the same tidal turbine example that was used in the previous section. If
experimental measurements were available for a complete tidal turbine that was similar to the novel
tidal turbine, then a similarity validation approach could be used. The author could carry out a CFD
investigation of this tidal turbine and compare the results with the experimental measurements. The
results of this investigation would indicate the magnitude of the error (using Richardson Extrapolation)
and an appropriate level of mesh resolution to use for the CFD calculation of the novel tidal turbine.
This approach provides more confidence than the piecewise validation approach, as the interaction
of the swirling flow field around the blades and the vertical support arm is captured. The overall
number of calculations is also reduced as the author does not need separate calculations for the
aerofoil, vertical cylinder and bluff body.

Dr. Aidan Wimshurst, Fluid Mechanics 101 29


Aerofoil Cylinder / Sphere Diffuser

Symmetric Bump Backwards Step Forwards Step

Symmetric Nozzle Flat Plate Square Cylinder

Hot Horizontal Plate Hot Vertical Plate Hot Cylinder

Figure 22: Many CFD cases can be constructed from these key components. Compare your CFD
case against these components, and see if you can identify the key components.

Dr. Aidan Wimshurst, Fluid Mechanics 101 30


Suggested Exercise (2)

Consider wind flow approaching a tall building with a square cross-section. The wind flow
takes a sheared velocity profile. You are going to use CFD to calculate the drag force
on the building. However, before you do this you would like to do a validation exercise
to estimate the error in the drag and determine an appropriate level of mesh resolution.

Flow Around Tall Building

Component 1 Component 2

Explain how you would carry out:

a. Piecewise validation, assuming that you did not have access to experimental measure-
ments of a scale model. Figure 22 might be useful to help you choose the components
of the piecewise validation study.

b. Similarity validation, assuming that you had access to experimental measurements of a


scale model.

Suggested Exercise (3)

One of the components in your piecewise validation study is a circular cylinder. You would
like to carry out a CFD investigation of the flow over this cylinder at a Reynolds number of 1
Million (1e6), but you do not have any experimental measurements yourself.

a. How could you obtain some experimental measurements that could be used for validation?

Dr. Aidan Wimshurst, Fluid Mechanics 101 31


Sources of Experimental Data
It is often difficult to know where to look for experimental data, as experimental data is usually hidden
away in research papers. For example, where would you look if you wanted to find experimental data
for boundary layer separation near the trailing edge of an aerofoil? To help find these papers, the
scientific community has created several online libraries which contain links to common test cases. It
is usually quicker to browse through the libraries first and see if you can locate the test case you are
looking for, then follow the link to the research papers. Links to three useful libraries are provided
below.

1. NASA Turbulence Modelling Resource


https://turbmodels.larc.nasa.gov/
The National Aeronautics and Space Administration (NASA) CFD database contains many useful test
cases for external aerodynamics including: jets, mixing layers, aerofoil wakes, axisymmetric bumps
and flat plate boundary layers. The database is extensive and contains lots of experimental data, as
well as CFD solutions computed with different codes, meshes and turbulence models, which you can
use for comparison.

2. ERCOFTAC Knowledge Base Wiki


https://kbwiki.ercoftac.org/w/index.php?title=Main_Page
The European Research Community on Flow, Turbulence and Combustion (ERCOFTAC) was estab-
lished in 1988 as a research, knowledge and education centre for flow, turbulence and combustion.
They have an extensive library of test cases grouped into different application areas (combustion,
aerodynamics, turbomachinery etc.) and flow types (flow around bodies, internal flows, bounded
flows). While the website can be tricky to navigate at first, the level of information provided is
extensive. They also provide best practice advice which can be particularly useful if you are trying
one of the cases for yourself!

3. CFD Online Wiki


https://www.cfd-online.com/Wiki/Validation_and_test_cases
The CFD-Online forums are popular with CFD engineers for solving many CFD related problems. In
addition to forums, the website also has a useful library of cases that can be used for CFD validation.
While the library is less extensive than the NASA and ERCOFTAC libraries (and is incomplete in
places), many useful test cases can be found here.

Dr. Aidan Wimshurst, Fluid Mechanics 101 32


Chapter 2
Presenting Data
Chapter 2
Presenting Data

Time Velocity
0.0 2.1
1.0 2.2
2.0 2.3

There are a variety of methods that can be used to post-process and present CFD solution data.
Contour plots, line graphs and tables are the most popular and are sufficient for the majority of CFD
analyses. While the majority of authors are familiar with these techniques, there is little guidance for
how to use these techniques effectively. An effective post-processing technique:

1. Helps the reader understand the physical nature of the solution (what the flow is doing).

2. Enables the reader reproduce the analysis.

3. Demonstrates the accuracy of the analysis.

If the data is not presented clearly, it can be difficult for the reader to understand the physical nature
of the solution and assess its accuracy.

Dr. Aidan Wimshurst, Fluid Mechanics 101 34


It is usually expected that scientists, engineers and researchers develop good post-processing skills
throughout the career, with little formal training. This approach can leave CFD authors with limited
knowledge beyond their habitual post-processing tasks. The aim of this chapter is to introduce some
useful techniques that CFD authors may be unaware of, to enhance their post-processing ability. This
chapter is divided into sections that cover the most popular methods of presenting CFD solution
data:

I Contour plots

I Line plots

I Tables

In each section, some simple methods are covered that can be used to improve the clarity of the
presented data. The methods are general and can be applied to most CFD analyses. Of course, the
methods are not exhaustive and additional methods may be appropriate for different applications.

Dr. Aidan Wimshurst, Fluid Mechanics 101 35


Contour Plots
The most common method of presenting CFD results are contour plots. Contour plots are useful
because the spatial variation of a field variable (velocity, temperature, pressure etc.) can be shown
in two dimensions simultaneously. For example, the variation of temperature T can be viewed in the
x and y directions simultaneously, which is not possible with a line plot. By viewing two dimensions
simultaneously, it is easier for the reader to understand the flow field and to identify areas of interest.
However, contour plots have some limitations:

1. It can be difficult to assess the accuracy of the results from a contour plot.

2. It can be difficult to compare two or more results sets.

In this section, some simple techniques will be presented that improve the clarity of contour plots.
Before these techniques are presented, some brief background information will be provided.

Background
Computers use a variety of methods to display colours on screen. One popular method of displaying
colours is the RGB (red, green, blue) colour scheme. In the RGB colour scheme, a vector of 3 values
gives the amount of red, green and blue in a given pixel on the screen. For example, the vector (100,
120, 240) indicates that the pixel contains 100/256 red, 120/256 blue and 240/256 green. This will
be shown on screen as a soft shade of blue.

Suggested Exercise (4)

Open up either Microsoft Word, Excel, PowerPoint, Paint or another suitable program.
Change the colour of a line, text or object to an RGB value of (100, 120, 240), rather than
using the default colour picker.

Hint: You may need to search the internet or consult the software manual to find out
how to do this in some software programmes.

CFD post-processors use a colour map, which is a numerical function that converts the value of
a field variable (a pressure of 10 Pa for example) to a colour code (an RGB value of (100, 120, 240)
for example). The colour code is then used to colour the cell in the mesh that has a pressure of 10
Pa. Repeating this process for all cells in the mesh produces a colourful contour plot, which is shown
on screen.
Different colour maps will produce different colour codes. For example, one colour map may
convert a pressure of 10 Pa to a colour code of (100, 120, 240), which will colour the mesh a soft
shade of blue. Another colour map may convert a pressure of 10 Pa to a colour code of (210, 20,
60), which will colour the mesh a soft shade of red. A diagram to illustrate this process is shown in
Figure 23. The values of the computed pressure field are passed through a colour map and converted
to RGB colour values, which are used to colour the cells in the contour plot.

Technique 1: Discrete and Continuous Colour Bands


In most post-processors, there are several colour maps to choose from. Figure 24 shows some common
colour maps that are available in most post-processors. You may have used these colour maps at
some point in your own work! The choice of colour map can have a significant affect on the clarity of

Dr. Aidan Wimshurst, Fluid Mechanics 101 36


RGB (100,120,240)

Colour Map 1 Contour Plot 1


10 Pa

Field Value
RGB (210,30,60)

Colour Map 2 Contour Plot 2

Figure 23: A schematic diagram to illustrate how two different colour maps convert field values to
different RGB colour values. This results in contour plots with different colours.

Blue-Red

Rainbow / Jet

Black-Body Radiation

Viridis

Black and White

Figure 24: Some example colour maps that are available in most post-processors.

the contour plots in the document. When choosing a colour map, the first choice to make is whether
to adopt continuous (smooth) or discrete bands for the colour map. Figure 25 shows a comparison
of contours of static pressure around an aerofoil, with (a) continuous and (b) discrete colour bands.
In aerodynamics, an aerofoil generates lift through the action of negative pressure (suction) on
the top surface and positive pressure on the bottom surface of the aerofoil. Contour plots of static

Dr. Aidan Wimshurst, Fluid Mechanics 101 37


Pressure (Pa) Pressure (Pa)
-200 -100 0 100 200 -200 -100 0 100 200

Continuous Discrete Bands

Figure 25: A comparison of continuous and discrete contour bands. The 0 Pa pressure contour is
easy to pick out with discrete colour bands but difficult with continuous colour bands.

pressure are useful because they can be used to visually observe locations of positive and negative
pressure. In Figure 25, the blue contours indicate negative pressure (suction) and the orange and red
contours indicate positive pressure. The green contours are of particular importance, as they indicate
the transition between positive and negative pressure. With continuous contour bands (Figure 25
(a)), it is difficult to visually pick out the location where pressure transitions from positive to negative.
This is why discrete colour bands are always preferred. They allow the reader to visually pick out
discrete values of the field from the contour plot.

Technique 2: Choice of Colour Map


After choosing discrete colour bands, the choice of colour map must be made. Most post-processors
offer a variety of colour maps. However, the colour map that appears most often in publications is the
rainbow (or jet) colour map. Rainbow is the most common colour map because it is the default colour
map in many post-processing applications (like Fluent-Post and CFX-Post for example). However, it
is not necessarily the best choice of colour map for CFD results because the colours change slowly
in the green region, which occupies the majority of the centre of the colour map. This can make it
difficult for the reader to distinguish between contours at the centre of the colour map. For example,
it is difficult to determine the location of the 0 pressure contour in Figure 25 (a), as the green contours
are visually similar.
For variables that are distributed around a central value (like the static pressure distribution in
Figure 25), it is better to adopt a diverging colour map, rather than a rainbow colour map. A
popular example of a diverging colour map is the blue-red colour map. This is the default colour
map adopted by the post-processing software Paraview. The central value is white, while the extreme
values are red and blue. The central value is visually different to its neighbours, which makes it
easier for the reader to pick out the central values. Figure 26 shows a comparison of the rainbow
and blue-red colour maps for the static pressure distribution around an aerofoil.
Figure 26 shows that it is much easier to pick out the 0 Pa contour with the blue-red colour map,

Dr. Aidan Wimshurst, Fluid Mechanics 101 38


Pressure (Pa) Pressure (Pa)
-200 -100 0 100 200 -200 -100 0 100 200

Rainbow Blue - Red

Figure 26: A comparison of the static pressure field around an aerofoil using (a) Rainbow and (b)
Blue-Red colour maps. With the Blue-Red colour map, positive pressure is shown in red and
negative pressure (suction) in shown in blue. In this case, Blue-Red colour map is preferred as it is
easier to identify the 0 pressure contour.

as white is visually different to blue and red. Other variables that are centred around a central value
can also benefit from a diverging colour map. The components of the velocity field (Ux , Uy and Uz )
for example, are implicitly centred around 0 m/s. Positive velocity components indicate that the fluid
is moving in one direction, while negative velocity components indicate that the fluid is moving in
the other direction. As shown in Figure 27, a diverging red-blue colour map is an excellent choice for
velocity components, as red and blue immediately indicate the direction of the flow, while the colour
saturation (strength of the colour) indicates the strength of the velocity field.
Some variables in CFD are not distributed around a central value. Turbulent kinetic energy (k)
and temperature (T ) for example, are distributed continuously and do not have a central value. For
these variables, a diverging colour scheme (like blue-red) does not offer a significant advantage over
other colour maps like rainbow. The authors personal preference can be used for these variables,
as the choice of colour map does not detract significantly from the clarity of the contour plot. For
continuously distributed variables, some authors like to use sequential colour maps. In a sequential
colour map, the colours vary smoothly from one colour to another. These colour maps are useful
because they can be selected to physically represent the variable that is being plotted. For example,
there are many red and yellow based colour maps (heat maps) that are popular for plotting temper-
ature (T ). Inferno, Black Body Radiation and Autumn are three popular examples. Figure 28 shows
a comparison of Rainbow and Black Body Radiation colour maps for the temperature in an enclosed
cavity.
Black and white contour plots have limited use in modern science and engineering. However, some
journal papers and conference proceedings require images and contour plots to be printed in black
and white. For these limited applications, black and white contour plots should be used. Otherwise
there is little justification for black and white contour plots and a colour based contour plots are
always preferred.
Table 4 summarises some common CFD variables and their recommended colour maps.

Dr. Aidan Wimshurst, Fluid Mechanics 101 39


-2 m/s -1 m/s -0.5 m/s 0.5 m/s 1 m/s 2 m/s

Figure 27: A schematic diagram to demonstrate how a diverging colour map works for the velocity
field, which is centred around 0 m/s. Red contours indicate that the flow is moving left to right,
while blue contours indicate that the flow is moving right to left.

Temperature Temperature
100 150 200 250 300 100 150 200 250 300

Rainbow Black Body Radiation

Figure 28: A comparison of the temperature field in an enclosed cavity using (a) Rainbow and (b)
Black Body Radiation colour maps.

Technique 3: Contour Labels


After creating a contour plot, contour labels can be added to highlight the numerical values of the
contours. This makes the contour plot significantly easier for the reader to interpret and allows the
reader to read off values directly, without relying on the colour bar. As an example, Figure 29 shows
contours of static pressure around an aerofoil with added contour labels. The contours are graded in

Dr. Aidan Wimshurst, Fluid Mechanics 101 40


Colour Maps Class Variables

Blue - Red Diverging Pressure, Velocity, Volume Fraction


Yellow - Red Sequential Temperature, Enthalpy, Energy
Rainbow Misc. Turbulence, Concentration
Black and White Black and White None

Table 4: Recommended colour maps for different CFD variables.

levels of 20 Pa. Hence, the reader can count the contour levels in the Figure and establish the static
pressure at any point on the contour plot. Try it for yourself!

Suggested Exercise (5)

Locate the 60 Pa contour band in Figure 29 by counting the contour bands.

Hint: The 60 Pa contour band is below the aerofoil between the 80 Pa and 40 Pa
contour bands. Notice that it is easier to locate the 60 Pa contour band when the labels are
provided.

Some post-processors (like TecPlot 360 for example) can generate contour labels automatically.
If your post-processor does not have this functionality, then you can add the contour labels manually
in an image editing programme (like MS Paint, Inkscape or CorelDRAW) using text boxes.
When you add labels, ensure that the labels are not added on top of the main areas of interest, as
this can block the view. In Figure 29, the labels have been added far away from the aerofoil surface,
so the pressure distribution is still visible.

Technique 4: Comparing Contour plots


It is often necessary to compare multiple contour plots in the same Figure. For example it may be
necessary to compare the flow field:

I At different inlet flow velocities

I At different time steps in an unsteady solution

I At different boundary temperatures

I At different rotational speeds for turbomachinery

I With different turbulence models

When generating these Figures, it is essential that the range of the colour bars (the maximum and
minimum levels) are the same. If the colour bars do not use the same range, it can be difficult for
the reader to make a back-to-back comparison of different contour plots in the same Figure. As
an example, Figure 30 shows contours of static pressure on an aerofoil at angles of attack of (a)
0 degrees and (b) 8 degrees. The top set of contours have different ranges for the static pressure,
while the bottom contours have the same range. As the ranges of the top contours are different, the

Dr. Aidan Wimshurst, Fluid Mechanics 101 41


Pressure (Pa)
-200 -100 0 100 200

Original
Image

Pressure (Pa)
Add Labels
-200 -100 0 100 200
Manually
Read Into
Image Editor
0
-80 -80
-40 -40

0
+
0

Add Labels 40
80
Manually
40

Figure 29: An example of how contour labels can be added to a contour plot. You do not need to
label every contour. The contour labels should be sufficient for the reader to deduce others if
necessary.

individual contour levels are different. This makes a back-to-back comparison difficult. Try picking
out the 100 Pa contour for yourself. It is considerably easier in the bottom set of contours!
By default most post-processing software sets the contour range to the maximum and minimum
value of the CFD solution. Make sure to adjust the contour range when you are comparing multiple
contours plots, to ensure that the contours in the Figure have the same range.

Dr. Aidan Wimshurst, Fluid Mechanics 101 42


Pressure (Pa) Pressure (Pa)
-200 -100 0 100 200 -400 -200 0 200 400

(a) Angle of Attack = 0 degrees (b) Angle of Attack = 8 degrees

Different Contour Range

Pressure (Pa) Pressure (Pa)


-200 -100 0 100 200 -200 -100 0 100 200

(a) Angle of Attack = 0 degrees (b) Angle of Attack = 8 degrees

Same Contour Range

Figure 30: Contours of static pressure at angles of attack of (a) 0 degrees and (b) 8 degrees. The
top contours have different ranges, and are difficult to compare. The bottom contours have the
same range and are easier to compare.

Technique 5: Locations of Interest


Lines and boxes can be added to contour plots to highlight locations of interest in the flow. These
locations of interest may include measurement locations, recirculation regions, shock waves and
porous jumps. Figure 31 shows an example of turbulent flow over a backwards facing step. A dashed
line has been added to the Figure, to highlight the extent of the recirculation region. Grey circles
have also been added to indicate the location where experimental measurements were taken. To

Dr. Aidan Wimshurst, Fluid Mechanics 101 43


-0.3 Velocity (m/s) 1.0

Original
Image

Read Into Add lines and labels


-0.3 Velocity (m/s) 1.0
Image Editor

Add Labels
Recirculation Region
Manually
Measurement Location

Figure 31: Turbulent flow over a backwards facing step. A dashed line has been added to indicate
the recirculation region and grey circles have been added to indicate the location where
measurements were taken.

make these additions you will need to save the contour plot as an image (PNG, JPEG, EPS or PDF)
and open it in an image editing programme. In the image editing programme you can add the labels,
boxes and lines to the Figure and then save it as a new image file. Have a go at adding lines and
labels to your contour plots yourself using MS Paint, Inkscape, or CorelDRAW. They can significantly
improve the quality of Figures in your document.

Technique 6: Contour Plot and Line Plot


There are many flow scenarios where the flow variables change rapidly over a small distance. Some
examples of flow features with steep gradients are:
I Boundary Layers
I Shear Layers
I Shock Waves
I Free Surfaces
When visualised using contour plots, the steep gradients result in contour lines which are close
together. As the contour lines are close together, it can be difficult for the reader to observe the
changes in the flow variables from the contour plot alone.

Dr. Aidan Wimshurst, Fluid Mechanics 101 44


-0.3 1.0

1.0
0.8
0.6
0.4
0.2
0.0
0.0 0.4 0.8

Contour Plot + Line Plot

Figure 32: A contour plot of axial velocity (Ux ) over a backwards facing step. The velocity has
been normalised by the inlet velocity (Uin ) and the vertical coordinate (y) has been normalised by
the height of the channel.

As an example, Figure 32 shows contours of axial velocity (Ux ) over a backwards facing step.
The contour lines which separate the advancing flow from the recirculation region are close together,
as the velocity changes rapidly over a small distance. It can be difficult for the reader to assess the
changes in the velocity field in this region from the contour plot alone.
One approach that can be used to add clarity to the contour plot is to add a line plot through
the region of steep gradient. In Figure 32, a line plot has been added in the same Figure as the
contour plot. The line plot passes directly through the shear layer. This allows the velocity profile
to be observed more clearly than from the contour plot alone. In turn, the contour plot allows the
reader to see exactly where the line plot has been taken from and provides context for the overall
flow field. The combination of contour plots and line plots together is useful for presenting complex
CFD solution data.

Technique 7: Restricting the Contour Range


In a free surface or supersonic flow, it is useful to be able to show the reader the location of the free
surface / shock wave. With conventional contour plots, it can be difficult to see the free surface
/ shock wave, as the contour lines appear to visually blur the interface. As an example, Figure 33
shows the free surface flow of water over an obstacle. Notice that the free surface appears to be
smeared in Figure 33 (a) and it is difficult to visually determine the exact location of the free surface.
To calculate the location of the free surface, the CFD solver calculates the volume fraction of
water in every cell in the mesh. Cells with a volume fraction of 1 are filled entirely with water, whereas
cells with a volume fraction of 0 are filled entirely with air. Cells with a volume fraction between 0
and 1 contain some water and some air and are therefore likely to contain the free surface. While
the volume fraction shown in Figure 33 (a) is numerically correct, it can be difficult for the reader
to visually determine the location of the free surface. One technique that can be used to show the
location of the free surface more clearly is to limit the range of the contours, as shown in Figure 33
(b). With the limited contour range, the free surface can now be seen more clearly, at the expense
of hiding much of the remaining detail (the surface spray). An alternative to limiting the contour

Dr. Aidan Wimshurst, Fluid Mechanics 101 45


Volume Fraction of Water Volume Fraction of Water
0 0.25 0.5 0.75 1 0.49 0.5 0.51

Full Range Limited Range

Figure 33: Free surface flow of water over an obstacle. A volume fraction of 1 indicates that the
cell is filled with water. A volume fraction of 0 indicates that the cell is filled with air. The contour
range is limited in the plot on the right to highlight the location of the free surface.

Volume Fraction of Water


0 0.25 0.5 0.75 1

Volume Fraction of Water = 0.5

Contour Plot Extract Contour

Figure 34: Free surface flow of water over an obstacle. A volume fraction of 1 indicates that the
cell is filled with water. A volume fraction of 0 indicates that the cell is filled with air. The 0.5
contour has been extracted to highlight the location of the free surface.

range is to extract a single contour from the contour plot. Figure 34 shows an example of how the
0.5 contour can be extracted from the contour plot and plotted alongside the original to show the
location of the free surface.
It is important to remember that the location of the free surface can only ever be resolved to

Dr. Aidan Wimshurst, Fluid Mechanics 101 46


0.0 0.0 0.0
0.0 0.0 0.0 0.0
0.0

0.0 0.0 0.0


0.53 0.51
0.0 0.49
0.0
0.0 0.0 0.0
0.51 0.0
0.49
0.0
0.54 0.48 0.49

1.0 1.0
0.0 1.0
0.0
0.0 1.0 1.0
0.0 1.0
0.0
0.0

1.0 1.0
0.0 1.0
0.0
0.0 1.0 1.0
0.0 1.0
0.0
0.0

Original Mesh Refined Mesh

Figure 35: A diagram to show the mesh in the vicinity of the free surface. The location of the free
surface is indicated with an arrow. The free surface can only be resolved to within a cell.

within a cell in the CFD mesh, even if interface compression algorithms are adopted. Therefore to
produce a more accurate calculation of the free surface, the mesh should be refined in the vicinity of
the free surface. As an example, Figure 35 shows the volume fraction field computed on two meshes.
In Figure 35 (a), the free surface is predicted to reside in the second row of cells from the top. By
refining the second row of cells, Figure 35 (b) shows that the free surface actually resides slightly
lower down in the cell than predicted in Figure 35 (a). Hence, in addition to the method chosen to
present the free surface to the reader, care should be taken to ensure that the mesh is sufficiently
refined in the location of the free surface / shock wave.

Technique 8: Zoom Boxes


Zoom boxes can be used to highlight areas of interest in detailed models. While they are usually
applied to contour plots, they can also be applied to line plots, meshes and geometry visualisations.
Figure 36 shows an example of a zoom box, which has been generated to highlight the stagnation
point at the leading edge of an aerofoil. The zoom box allows the area of interest to be magnified,
so the reader can easily interrogate the stagnation point. To create zoom boxes:

1. Use your post-processor to create two separate images. The first image is the overall Figure
and the second image is the zoomed region.

2. Import both images into an image editor (MS Paint, Inkscape or CorelDRAW for example).

3. Rearrange the images so they are both visible and clear.

4. Add a rectangle to the main image to show where the zoom box is located.

5. Save the combined image as a new image.

Try experimenting with zoom boxes for yourself. They are particularly useful for highlighting areas
of detail in complex Figures and diagrams.

Dr. Aidan Wimshurst, Fluid Mechanics 101 47


Pressure (Pa)
-200 -100 0 100 200
Remove Colour Bar

Original
Images

Smaller Figure

Pressure (Pa)
-200 -100 0 100 200
Add box to show
where zoom box is

Combined
Images

Figure 36: Pressure distribution in the vicinity of an aerofoil. A zoom box is used to highlight the
stagnation point.

Suggested Exercise (6)

Use either the snipping tool / screen capture programme to save the two mesh im-
ages below. Import them into an image editor and create a Figure with a zoom box.

Hint: Remember to add a rectangle to show where the zoom box is located!

Dr. Aidan Wimshurst, Fluid Mechanics 101 48


Line Plots
Technique 1: Shaded areas
There are often critical values that limit the operating range of a system or a device. It is useful
to display these critical values on line plots as shaded areas. The shaded areas allow the reader to
visually assess how close the system or device is to its operating limit.
As an example, Figure 37 shows the thrust on a wind turbine as a function of wind speed. The
thrust increases at first, as the wind speed increases. The thrust then reduces at higher wind speeds,
as the blades are pitched into the wind. Suppose that the maximum permissible thrust on the wind
turbine is 30 kN. The reader can read off the maximum permissible wind speed directly from the
plot. However, it is much clearer to add a red shaded area to the plot. The red shaded area allows
the reader to easily identify wind speeds that exceed the maximum permissible value. From Figure
37, it is clear that the wind turbine exceeds the maximum permissible thrust at a wind speed of
approximately 12 m/s and should be shut down.
Shaded areas can sometimes be added in the plotting software itself (MATLAB and python for
example). If the option is not available, then the shaded area can be added by importing the plot
into an image editor (like MS Paint, Inkscape or Corel DRAW) and drawing a shaded rectangle over

40

30
Thrust [kN]

Original 20
Image
10

0
0 5 10 15 20 25
Wind Speed [m/s]

Import into 40 Add rectangle


Image Editor
30
Thrust [kN]

20
+
10

0
Add shaded 0 5 10 15 20 25
regions
Wind Speed [m/s]

Figure 37: Thrust on a wind turbine as a function of wind speed. A shaded region is added to
highlight the wind speeds where the thrust is greater than 30 kN.

Dr. Aidan Wimshurst, Fluid Mechanics 101 49


Medthod 1: Shaded Area 40
Legend
30

Thrust [kN] 20
Spalart Allmaras
10

0
0 5 10 15 20 25
Wind Speed [m/s]

40
Medthod 2: Dividiing Line

Legend
30
Thrust [kN]

20
Spalart Allmaras
10

0
0 5 10 15 20 25
Wind Speed [m/s]

Figure 38: Thrust on a wind turbine as a function of wind speed with three different RANS
turbulence models.

the area of interest. Make sure to give the rectangle some opacity (translucency), so that the reader
can see through the rectangle!
While shaded areas have limited use for single line plots, they are increasingly useful when multiple
lines are used on the same plot. Figure 38 shows the thrust on a wind turbine as a function of wind
speed with three different RANS turbulence models. With the red shaded area it is clear that the
maximum permissible wind speed is slightly higher with the Spalart Allmaras turbulence model than
with the k −  and k − ω SST turbulence models. The red shaded area makes it easier to compare
the intersection of different line plots with the maximum permissible thrust of 30 kN.
As an alternative to a shaded area, the maximum permissible thrust can be indicated with a
dividing line (Figure 38). However, with multiple lines on the same plot, it can be difficult for the
reader to determine the intersection point when using a dividing line. For this reason, shaded areas
are usually preferred to dividing lines when multiple lines are used on the same plot.

Technique 2: Zoom Boxes


In Figure 37 and 38, it is difficult to determine the wind speed where the thrust reaches 30 kN, even
with the shaded area. To make it easier for the reader, a zoom box can be added to the line plot.
Zoom boxes were introduced earlier in the course for contour plots, but they can also be used just
as effectively with line plots.

Dr. Aidan Wimshurst, Fluid Mechanics 101 50


34

Adjust Axis Range


32 Remove Legend
Additional Image

30
28
26
12.4 12.6 12.8 13.0 13.2 13.4

Remove Axis Labels

Legend

40
Combined Images

30 Spalart Allmaras
Thrust [kN]

20 34

10 32
30
0
0 5 10 15 20 25 28
Wind Speed [m/s] 26
12.4 12.6 12.8 13.0 13.2 13.4

Figure 39: Thrust on a wind turbine as a function of wind speed with three different RANS
turbulence models.

Figure 39 shows the same plot as Figure 37 and 38, but with a zoom box to highlight the region
where the red lines enter the shaded area. Notice that for this zoom box, the legend and axis labels
are not needed, so they have been removed. The axis range has also been adjusted to focus on
the area of interest. The zoom box shows that k − ω SST model enters the red shaded area at a
wind speed of 12.5 m/s, the k −  model at 12.8 m/s and the Spalart Allmaras turbulence model at
13.2 m/s. This is much clearer than the original plot and allows the reader to specify the maximum
permissible wind speed with greater accuracy.

Technique 3: Parameter Space Investigations


It is common to run a set of multiple simulations using the same CFD model by changing the value of
one or more parameters. These types of CFD studies are often called parameter space investigations.
Some common examples of parameter space investigations are:

I A set of different angles of attack for an aerofoil.

I A set of different rotational speeds for a wind turbine, compressor or pump.

Dr. Aidan Wimshurst, Fluid Mechanics 101 51


Lift

Figure 40: Lift coefficient on an aerofoil. Each of the data points was computed from a separate
CFD simulation using the same model. This is an example of a parameter space.

I A set of different vehicle velocities for an aircraft, automobile or ship.

As an example of a parameter space investigation, Figure 40 shows the lift coefficient on an


aerofoil, computed over a range of angles of attack. Each data point in Figure 40 was calculated
from a separate CFD simulation using the same model. For each simulation, the angle of attack
was changed and the model was re-run with all other input parameters kept the same. As each data
point was calculated from a separate simulation, it is important to show the individual data points
themselves on the line plot, and not just a continuous line. This allows the reader to pick out any
outliers in the parameter space.
When selecting the values of the input variables for a parameter space (in this example, angle of
attack) it is usually best to start out with a uniform distribution of values. For example, angles of
attack of 0, 2, 4, 6, 8, 10 and 12◦ would be a good initial distribution to use for the parameter space
in Figure 40. The uniform distribution gives a good indication of the overall solution and allows any
locations of interest, such as maxima and minima, to be identified. In Figure 40, the angles of attack
are equally spaced over a wide range of angles of attack. This allows the reader to quickly locate the
approximate location of the maximum lift coefficient, which occurs at an angle of attack of around
10◦ .
Now that the approximate location of the maximum has been located, additional CFD simulations
can be carried out to add more data points and increase the resolution of the parameter space. Figure
41 shows the same parameter space as Figure 40 but with additional CFD simulations carried out
around the maximum lift coefficient. These additional simulations give a more accurate indication of
the location of the maximum lift coefficient and its value. Figure 41 shows that the maximum lift

Dr. Aidan Wimshurst, Fluid Mechanics 101 52


1.4
Lift Coefficient [ - ] 1.2
1.0
0.8
Original
0.6 Additional CFD Simulations
Image
0.4
0.2
0
0 2 4 6 8 10 12
Angle of Attack

Figure 41: Lift coefficient on an aerofoil. Additional data points have been added around the
maximum lift coefficient.

coefficient actually occurs at an angle of attack of 9.5◦ , which is a more accurate calculation than
the original 10◦ .
When carrying out additional CFD simulations to increase the resolution of the parameter space,
it is not necessary to add additional data points at lower angles of attack, as these are far away from
the maximum lift coefficient (the point we are interested in). This allows us to limit the total number
of CFD simulations that are run. CFD simulations can be expensive and take a long time to run, so
it is important to choose the your simulations carefully!

Technique 4: Line Segments and Curve Fits


For the majority of CFD analyses, the data points should be connected by line segments and not
curve fits. Curve fits should not be used because they allow non-physical undershoots and overshoots
between the data points. As an example, Figure 42 shows five data points, connected by line segments
and curve fits. Due to the order of the polynomial, the curve fit overshoots and undershoots the
data. This variation may not be present in the real data and is likely to be non-physical.
However, in some CFD investigations a curve fit is specifically required. For example:

I Deriving loss coefficients for porous media models

I Deriving heat transfer correlations for heated components

I Deriving friction factors for internal flow geometries

As an example of an investigation where a curve fit is required, Figure 43 shows the pressure
drop across an orifice plate, as a function of the upstream velocity. An orifice plate is a circular
plate with a small hole in the centre. They are used in piping systems as control and measurement
devices. As the velocity upstream of the orifice plate increases, the pressure drop across the orifice
plate increases. To capture this behaviour, a CFD model can be constructed and used to calculate
the pressure drop across the orifice plate at a range of upstream velocities (U ). For each simulation,
the upstream velocity is changed and the CFD model is solved to calculate the pressure drop. The
calculated results are shown as data points in Figure 43.
In general, the pressure drop across an internal flow component can be described with the following
equation:

Dr. Aidan Wimshurst, Fluid Mechanics 101 53


Overshoot

Line Segments Curve Fit

Figure 42: For the majority of CFD analyses, line segments should be used to join data points in
parameter spaces.

1
∆p = K ∗ ρU 2 (41)
2
where ∆p is the pressure drop, ρ is the upstream density, U is the upstream velocity and K is an
inertial loss coefficient. We would like to derive an inertial loss coefficient (K) for the orifice plate,
using the data points computed with the CFD code. To extract this coefficient from the data, a
curve fit is required. Hence, instead of connecting the data points with line segments, a quadratic
curve (2nd order polynomial) is fit to the data in Figure 43 instead:

∆p = cU 2 (42)
The coefficient c from the curve fit can then be used to determine the loss coefficient (c = 1/2ρK).
Notice that the curve fit in Figure 43 has been included in the legend, so that the reader is aware that
a curve fit has been used, rather than line segments. The value of K is also provided in the caption,
so the reader is aware of the functional form of the curve fit and can reproduce it, if necessary. If
multiple curve fits are carried out, then it is often more convenient to record the values in a table,
rather than the Figure caption.

Technique 5: Comparing your results with other authors


Comparing your CFD results with other authors is a useful technique for improving confidence in your
CFD calculations. However, to make this comparison you need to be able to show your results and
the results of other authors, on the same plot. An example of this back-to-back comparison is shown
in Figure 44. The authors CFD calculations are shown in red and the data points from the literature
are shown in blue. At angles of attack below 8◦ , the CFD results give good agreement with Author
et al. (2020). However, at angles of attack of 10◦ and 12◦ , the CFD results predict a higher lift
coefficient than Author et al. (2020).
To be able to show the results of other authors alongside your CFD results on the same plot, you
need a method of extracting data from scientific papers. Once the data has been extracted, you can
include the extracted data alongside your data on the same plot. There are 3 methods of extracting
data from a scientific paper, which are shown in Figure 45:

Dr. Aidan Wimshurst, Fluid Mechanics 101 54


Orifice Plate

Flow

Legend

CFD Data Points


Pressure Drop

Curve Fit

Velocity

Figure 43: Pressure drop across an orifice plate as a function of velocity. The curve fit computed
using the CFD data points is shown as a dashed line. For the curve fit shown, K = 0.5.

1.4
Legend
Lift Coefficient [ - ]

1.2
1.0 CFD Data Points
0.8 Author et al. (2020)
Original
0.6
Image Extra Legend Entry
0.4
0.2
Data Points for Comparison
0
0 2 4 6 8 10 12
Angle of Attack

Figure 44: Lift coefficient computed on an aerofoil for a range of angles of attack. The blue data
points have been extracted from a journal paper and added to the plot.

1. Contact the author by email and ask for the data points, so that you can use them directly.
2. Print the document and measure the data points using a ruler.
3. Use software to extract the data points from the document for you.
Regardless of the method that you choose, you should always credit the author (by referencing their
work) to avoid claims of plagiarism, and so that others can find the data set and make comparisons
for themselves.

Dr. Aidan Wimshurst, Fluid Mechanics 101 55


1. Email the Author 2. Print and Ruler 3. Software

Figure 45: The 3 methods of extracting data from a paper in the literature

Figure 46: A diagram of flow of water in a channel with the free surface open to the atmosphere.
H is the height of the channel.

If you choose option 3, WebPlotDigitizer is an excellent online tool that can make data extraction
from scientific papers much easier. You can access the tool on any internet browser by searching for
WebPlotDigitizer in a search engine (like google). You can use the tool to extract individual data
points and even entire line plots for comparative studies! To extract data from a plot, you will need
to first extract the plot from the document as an image (you can use the snipping tool or screen
capture program to do this). You can then import the image into WebPlotDigitizer and extract the
data from the image. If you do not like / cannot get access to WebPlotDigitizer, then MATLAB and
python also contain functionality for extracting data points from images.

Technique 6: Normalising Data


Consider the flow of water in a channel that is open to atmosphere. As shown in Figure 46, the
velocity forms a sheared profile, with higher velocity at the free surface and lower velocity at the
bottom near the channel bed. The shape of the profile depends on the Reynolds number of the flow
and the roughness of the channel bed. A key part of an open channel flow analysis using CFD is to
present the velocity profile to the reader, so that the reader can observe the degree of shear in the
profile.
Figure 47 shows the velocity profile in the channel, computed with a CFD code. In the top plot,
the velocity is expressed in metres-per-second and the vertical distance is expressed in metres. The
height of the channel (H) is 3.0 m and the bulk (area-averaged) velocity (Ub ) is 2.4 m/s. Despite

Dr. Aidan Wimshurst, Fluid Mechanics 101 56


3.0
2.5
2.0
Regular Profile

1.5
Original
Image
1.0
0.5
0
0 0.5 1.0 1.5 2.0 2.5 3.0

1.0
Quantities
0.8
Dimensionless Profile

[-]

0.6
Original
0.4
Image
0.2

0
0 0.2 0.4 0.6 0.8 1.0 1.2
[-]

Figure 47: Velocity profile in a channel. z is the distance from the floor, H = 3.0 m is the height
of the channel and Ub = 2.4 m/s is the bulk velocity.

these dimensions being relatively simple, the top Figure can be difficult to interpret. For example:
I How much larger is the free surface velocity than the bulk velocity, as a percentage?
I What is the velocity at 60% of the channel depth?
I How would we compare the shape of the velocity profile with the profile at a higher flow rate?
The velocity profile is significantly easier to interpret when using dimensionless quantities. The
bottom plot in Figure 47 shows the same velocity profile but with the vertical coordinate normalised
by the height of the channel and the velocity normalised by the bulk velocity. With this plot it is
easier to see that the velocity at the free surface is ∼ 7% greater than the bulk velocity and the
velocity at 60% of the depth is ∼ 5% greater than the bulk velocity. With this approach it would
also be easier to add more velocity profiles to the same plot and to make direct comparisons.
In general, you should always attempt to normalise the data in your line plots and contour plots.
In addition to making the plots easier to interpret, it allows the reader to compare your results with
others in the literature. Table 5 shows some common methods of normalising variables in CFD.
Before attempting to normalise your data, you should first check how other researchers in the field
(journal papers, conference papers and theses) present their data. It is usually a good idea to adopt
the same normalisation that they do. Have a look at the papers and see what quantities other people
in your field use.

Dr. Aidan Wimshurst, Fluid Mechanics 101 57


Variable Symbol Normalised Variable

Coordinates x, y, z, r x/H, x/D, x/L, r/R


Velocity U U/Ub , U/Umax , U/Uin , U/U∞
p
Pressure p Cp =
1/2ρU 2
Temperature T T /Tmax , T /Tavg
Density ρ ρ/ρavg
Turbulent Kinetic Energy k k/Uin2
Eddy viscosity µt µt /µ

Table 5: Common methods for normalising variables in CFD.

Results Tables
Technique 1: Formatting
When presenting your results in a table, the majority of journals and scientific conferences recommend
the following:

I Do not use any vertical lines

I Do not use double horizontal lines

I Use increased line spacing so there is sufficient space between the rows

I Keep units (like m/s or N/m2 ) in the column headers rather than the table itself

I Do not omit the 0 before a decimal. For example, use 0.1 and not .1

These standards can be difficult to follow, especially as Microsoft Word and Excel insert vertical lines
into tables by default. Table 6 shows examples of good and bad table formatting. Notice that the
bottom Table in Table 6 is much easier to read than the top Table. It does not use any vertical lines,
the units (m/s and ◦ C) are in the column headers and the line spacing has been increased between
the rows.
If you read through journal papers, conference papers and textbooks in your field, you will find
that the majority of authors use these techniques to improve the clarity of their tables. Have a go for
yourself and see if you can recreate some of your existing tables without any vertical lines and other
bad formatting choices.

Dr. Aidan Wimshurst, Fluid Mechanics 101 58


U T
Average Max Average Max

Simulation 1 2.00 m/s 2.12 m/s 35.7 C 42.1◦ C
Simulation 2 1.98 m/s 2.11 m/s 35.8◦ C 43.4◦ C
Simulation 3 2.03 m/s 2.16 m/s 35.7◦ C 41.7◦ C

U [m/s] T [◦ C]

Average Max Average Max

Simulation 1 2.00 2.12 35.7 42.1


Simulation 2 1.98 2.11 35.8 43.4
Simulation 3 2.03 2.16 35.7 41.7

Table 6: Examples of badly formatted tables (top) and well formatted tables (bottom)

Suggested Exercise (7)

Recreate the table below with improved formatting.

Heat Transfer Coefficient


Min Max Average
k− 4.89 W/m2 K 5.12 W/m K 5.07 W/m2 K
2

k − ω SST 4.74 W/m2 K 5.07 W/m2 K 5.02 W/m2 K


LES 4.98 W/m2 K 5.21 W/m2 K 5.15 W/m2 K

Hint: You will need to remove the vertical lines and move the units into the column headers.

Technique 2: Percentage Differences


A common use of tables in CFD analyses is to present an integrated quantity that is computed by
the CFD code. Some common quantities that are often expressed in tables are:

I The lift / drag coefficient of a vehicle

I The torque / thrust on a turbine / rotor or compressor

I The heat transfer or skin friction coefficient on the surface of a body

I The static or total pressure drop across a component in an internal flow system

As an example, Table 7 shows the lift coefficient on an object computed with three different turbulence
models. It is clear from the table that the k − ω SST model shows the closest agreement with the
experimental measurements. However, it is not clear how close the models are to the experimental
measurements, or how close the models are to each other.

Dr. Aidan Wimshurst, Fluid Mechanics 101 59


Turbulence Model CL [ - ]

Experiment 1.23
k − ω SST 1.17
k− 1.06
Spalart Allmaras 1.34

Table 7: Lift coefficient for an object calculated with three different turbulence models

Turbulence Model CL [ - ] ∆CL [%]

Experiment 1.23
k − ω SST 1.17 -4.9
k− 1.06 -13.8
Spalart Allmaras 1.34 8.9

Table 8: Lift coefficient for an object calculated with three different turbulence models. An
additional column has been added to show the percentage difference with the experiments.

A simple addition to this table can make a significant improvement to its readability. Figure 8
shows the same table but with an additional column for the percentage difference between the CFD
results and the experimental measurements. With the additional column it is now much clearer that
the k − ω SST model shows the closest agreement with the experiments. Many readers will be more
comfortable with percentage differences than absolute values, particularly if the quantity is small.
For example, skin friction coefficients of 0.0021 and 0.0028 appear to be close together, but actually
have a percentage difference of 25%! The sign of the difference (positive or negative) also shows the
reader whether the model over-predicts or under-predicts the target value at a glance.
It may also be useful to include an extra table with the results of the mesh sensitivity study
(as described in the previous Chapter). This will give the reader an indication of how much of the
percentage difference is likely to be due to the mesh refinement and how much is due to the choice
of turbulence model.

Image File Formats and Resolution


Once a contour plot or line plot has been created, the plot needs to be saved as an image file so that
it can be included in a report or document. In general, images can be saved in vector and bitmap
file formats. Figure 48 shows a diagram to help demonstrate the different between vector and bitmap
images.
Vector images are made up of a series of mathematical line and curve objects. When the images
are re-sized, or the reader zooms in on the image, the resolution of the image is not affected. Bitmap
images on the other hand are constructed from a grid of coloured pixels. When the images are
re-sized, or the reader zooms in on the image, the resolution of the image can be reduced. This can
result in the image being printed with poor quality. Table 9 shows some common image file formats
that you may recognise and identifies them as either vector or bitmap image file formats.
For journal papers, conference papers and academic theses, it is important to create images with
a sufficient resolution and with the correct file format. It is usually recommended that:

Dr. Aidan Wimshurst, Fluid Mechanics 101 60


Vector Image (PDF, EPS, SVG) Bitmap Image (PNG, JPEG, BMP, TIF)

Figure 48: A comparison of a) vector and b) bitmap image file formats that can be exported from
post-processing software.

Vector Images (Line Plots) Bitmap Images (Contour Plots)

PDF, EPS, SVG PNG, JPEG, BMP, TIF

Table 9: Examples of different vector and bitmap image file formats

1. Line plots are created using a vector file format (PDF or EPS), as vector images preserve
resolution when zooming in on the image.

2. Contour plots are created using a bitmap file format (PNG, JPEG or TIFF), as vector contour
plots have a very large file size.

For bitmap images (Contour plots), all of the main publishers (Elsevier, Wiley, Taylor and Francis)
recommend that images are produced with a minimum resolution of 300 dpi. For vector images (line
plots), you do not need to specify a resolution for vector images, as the images are constructed from
a series of mathematical objects.

Suggested Exercise (8)

Try saving a graph as a bitmap image (PNG, JPEG, BMP or TIF) with resolutions of 72 dpi
and 300 dpi. Import the images into a document and compare the resolution.

Hint: You will notice that the 72 dpi image has noticeably worse resolution. It may
appear blurry and difficult to read.

Dr. Aidan Wimshurst, Fluid Mechanics 101 61


Suggested Exercise (9)

Try saving a graph as a bitmap image (PNG, JPEG, BMP or TIF) and as a vector image
(PDF, EPS or SVG). Import the images into a document and zoom in on the images.

Hint: You will notice that the bitamp image loses resolution as you zoom in on the
image. The vector image does not lose resolution.

But what about images with annotations? When annotations are added to an image in an image
editor, the annotations are created as vector objects on top of the original image (which could be
a vector or a bitmap image). It is recommended that the annotated image is saved as a vector
image (PDF, EPS or SVG). This will ensure that any annotations that were created are saved as
mathematical objects (vectors), while the original image that was imported into the image editor is
preserved in its original format.

Dr. Aidan Wimshurst, Fluid Mechanics 101 62


End of Course

You might also like