You are on page 1of 15

Brunel University London

Department of Mechanical and Aerospace Engineering


College of Engineering, Design and Physical Sciences

The development of an advanced finite element solver in MATLAB

By

Valentin Borisavljevic

Student ID: 2140173

MSc Advanced mechanical engineering

Presented in partial fulfilment of the assessment requirements for the above


Award

Project undertaken during: Academic Year 2021/22

Academic Supervisor: E. Smith


Declaration

I declare that the work in this dissertation was carried out in accordance with the

requirements of the University’s Regulations and Code of Practice for Taught

Programmes and that it has not been submitted for any other academic award.

Except where indicated by specific reference in the text, this work is my own work.

Work done in collaboration with, or with the assistance of others, is indicated as

such. I have identified all material in this dissertation that is not my own work

through appropriate referencing and acknowledgement. Where I have quoted or

otherwise incorporated material, which is the work of others, I have included the

source in the references. Any views expressed in the dissertation, other than

referenced material, are those of the author.

SIGNED: ......................VB....................... DATE: .............September 13th, 2022


The development of an advanced finite element solver in MATLAB

V. Borisavljevic
Department of Mechanical and Aerospace Engineering, College of Engineering, Design
and Physical Sciences, Brunel University London, UB8 3PH, United Kingdom

Abstract
This project considers the two-dimensional, incompressible air flow over a solid structure
with an aerofoil-shaped cross section, more specifically the flow within the boundary layer
between the surface of the structure and the flow. The goal is to develop a computer
algorithm that finds a solution for the velocity field, using the finite element method (FEM)
and making a few assumptions. The algorithm, or code, is written in MATLAB and its
correctness is then checked in two ways: by verifying its progress when run, and by using
its results to validate it.

Keywords
Aerofoil, velocity field, CFD, FEM, MATLAB

1. INTRODUCTION There are three governing equations for a


two-dimensional fluid flow. Two equations
1.1 Case
to describe the motion of a Newtonian two-
Description of fluid flow dimensional flow, which are called Navier-
Nakayama and Boucher (1999) define fluid Stokes equations. For an incompressible
flow as ‘the movement of a fluid, the fluid being flow, and a reference frame with the y-axis
a gas or liquid’. They also mention that a flow parallel to the direction of the gravitational
is characterized by its velocity, which has three force (Houghton et al., 2017):
𝝏𝒖 𝝏 𝝏 𝟏 𝒅 𝝁 𝝏𝟐 𝝏𝟐
components for a three-dimensional case +𝒖 𝒖+𝒗 𝒖= − 𝒑 + ( 𝟐 𝒖 + 𝟐 𝒖) (1)
𝝏𝒕 𝝏𝒙 𝝏𝒚 𝝆 𝒅𝒙 𝝆 𝝏𝒙 𝝏𝒚
(reference frame with axes x, y and z). u, v and 𝝏𝒗 𝝏 𝝏 𝟏 𝒅 𝝁 𝝏𝟐 𝝏𝟐
w respectively are the x, y -and z-components. +𝒖 𝒗+𝒗 𝒗=− 𝒑𝒈 + ( 𝒗+ 𝒗) (2)
𝝏𝒕 𝝏𝒙 𝝏𝒚 𝝆 𝒅𝒚 𝝆 𝝏𝒙𝟐 𝝏𝒚𝟐
In general, these are functions of the position
and the time. Using the terminology of Fox et A third equation is needed, because there are
al. (2016), they define the so-called velocity three unknowns: velocity components u(x,y)
field, which refers to the situation of a varying and v(x,y), and the pressure p(x,y). The
velocity as a function of the position within the continuity equation for an incompressible, two-
spatial domain. In a fluid flow over a solid dimensional flow is (Houghton et al, 2017):
𝝏 𝝏
structure, there is narrow zone near the 𝒖 + 𝝏𝒚 𝒗 = 𝟎 (3)
𝝏𝒙
surface where the viscosity is never negligible
(Fox et al., 2016). Appendix A gives further
Houghton et al. (2017) state that the
information about the boundary layer. 𝜕2 𝜕2
Houghton et al. (2017) provide a figure of this, convection term ( 𝑢 + 𝑢 ) of the
𝜕𝑥 2 𝑖 𝜕𝑦 2 𝑖
for a solid structure shaped as an aerofoil. equation is challenging to solve. This will be
further explained in the Literature review.

Description of aerofoils
The air flow over solid structures with an
aerofoil as a cross section is a typical case of
aerodynamics (Karacaa, Özen and
Kasnakoğlu, 2016), which is a branch of fluid
mechanics for situations with air as the fluid.
Figure 1: fluid flow over an aerofoil.
Abbott and von Doenhoff (1959) emphasise
that the aerofoil cross section is typically used
for aircraft wings.
Houghton et al. (2017) provide a general on a collection of lines (straight or not) and,
definition for it: it is a cross section defined by unlike with unstructured grids, the points can
two points, with the thickness gradually only be located at intersections between lines.
increasing and then decreasing from the one Another difference with unstructured grids is
point to the other. Appendix A provides more that the shapes connecting the points are
information about aerofoils. simultaneously defined as the points
themselves, because the grid lines connect the
1.2 Finite element method (FEM) in the points. The third step is the application of a
context of CFD so-called ‘numerical scheme’, which
implements the discretization of the
CFD or ‘computational fluid dynamics’ is
equations. It defines scalar equations between
defined by Hirsch (2007) as: ‘Computational
mesh points. A first possible numerical
Fluid Dynamics, known today as CFD, is
scheme is the finite element method (FEM),
defined as the set of methodologies that
which will be explained in section 3.2. The
enable the computer to provide us with a
finite difference method (FDM) and finite
numerical simulation of fluid flows. We use the
volume method (FVM) are two other possible
word ‘simulation’ to indicate that we use the
numerical schemes. They will be explained in
computer to solve numerically the laws that
Appendix A. Each numerical scheme has
govern the movement of fluid.’ Explanations
certain properties of accuracy and stability for a
about the importance of CFD to study fluid
certain application. Taking these properties into
dynamics are given in Appendix A.
account allows to select a numerical scheme
Three steps form a CFD simulation: the
that minimize the numerical errors for the
choice of a mathematical model, the
considered application. This is briefly
discretization of the spatial domain and of the
discussed in the Literature review.
equations (Hirsch, 2007). Xia (2021) mentions
that the first step is optional: ‘CFD eventually
1.3 Goal
involves modelling of the flow, beside the use
of a numerical solving technique‘. A CFD This works looks into the case of an air flow
simulation that doesn’t use a mathematical around an aerofoil-shaped structure. Only the
model is called ‘DNS’ (direct numeric flow within the boundary layer around the
simulation). Hirsch (2007) provides a aerofoil is considered, in other words the
description of the three steps. As mentioned spatial domain is restricted to the boundary
above, the goal of a CFD simulation is to layer. The goal is to find the velocity field
numerically solve the governing laws of fluid using the finite element method,
flow, which are expressed as three differential implemented by a MATLAB code.
equations. The first step of the simulation is Several assumptions are made about the
their simplification via the chosen mathematical flow. The flow is incompressible and two-
model. Each model has its ensemble of dimensional, but not steady. Gravity forces are
assumptions that allow the simplification of the considered, although Hirsch (2007) mentions
equation(s). The main types of models are that their influence on flows is often limited.
explained in Appendix A. The second step Also, the pressure is assumed to be only a
comprises the discretization of the spatial linear function of x. As a result, it is only
domain. The creation of a so-called ‘grid’ or required to solve the Navier-Stokes equations,
‘mesh’ implements this. A mesh is a because the velocity components (u and v) are
collection of a finite number of positions, which the only two unknowns.
replace that continuous spatial domain (infinite Four codes are produced: two of them find
number of possible positions). The mesh points a solution for a uniform grid of triangles,
are called ‘nodes’ (Smith, 2021). The unknown and two of them for an unstructured grid of
variables in the governing equations have a triangles. In each pair of codes, the one code
certain value at each mesh point; the goal of finds a solution for equations being further
CFD is to compute them. Two types of grids simplified for a steady situation, and the other
can be distinguished: structured and without that extra assumption. The codes
unstructured grids. The latter consist of points consider a rectangular spatial domain and
with an arbitrary distribution within the domain. do not solve the convection term of the
Various 2D or 3D shapes then connect the Navier-Stokes equations.
points with each other, with a high number of
possibilities for that (which shapes and how
they are organized). A structured grid is based

2
2. LITERATURE REVIEW Another type of structured mesh is non-uniform
Cartesian. There are two variants: one with a
2.1 CFD
variable spacing of the Cartesian lines, and
Choice of numerical scheme one with a local subdivision within the space
The FDM is the oldest numerical scheme for between Cartesian lines. This is shown in
CFD (Hirsch, 2007 and Zienkiewicz, Nithiarasu Figure 2 (Hirsch, 2007, p.253).
and Taylor, 2013). However, it is in practice
only applicable to CFD computations using a
structured grid, and unstructured grid are
required for complex geometries (so that a
good accuracy is achieved), as mentioned in
the further section about the types of grids
(Hirsch, 2007). For this reason, the FVM is the
most used numerical scheme nowadays: it is
easily applicable to structured and unstructured
grids (Hirsch, 2007). As mentioned before, the
FVM is derived from the FDM (Zienkiewicz,
Nithiarasu and Taylor, 2013), so it leads to
similar discretization of the equations as the
FDM when applied to structured grids.
A third possible numerical scheme for CFD is
the FEM. As mentioned before, the FEM is
based on a different principle than the FDM
and FVM. Furthermore, fluid mechanics require
to approximate the substance as a continuum,
while solid mechanics don’t (Zienkiewicz, Figure 2: (a) non-uniform Cartesian grid (b)
Nithiarasu, and Taylor, 2013). On the one non-uniform Cartesian grid with subdivisions
hand, the view on a substance as a non-
continuum allows an easy application of FEM. Another variant uses curved lines instead of
On the other hand, FDM/FVM are more easily straight lines: ‘When curved solid surfaces are
applied to continuums. It is therefore no present, they cannot be part of the Cartesian
surprise that FDM and FVM are much more mesh lines and we have two options: either we
common for fluid mechanics applications, and keep the Cartesian structure of the grids or we
that FEM is mostly used for solid mechanics move away from the ideal and introduce
applications. curvilinear grids in order to fit the grid lines to
. the solid surfaces. We call these types of grids
‘body fitted’.’ Hirsch (2007, p.255) provides a
Types of grids figure for it.
As mentioned before, there are two types of
grids: unstructured and structured. This section
gives more information about the varieties of
grids.
Hirsch (2007, p.261) compares structured with
unstructured grids, in terms of accuracy: ‘on a
same regular distribution of points, an
unstructured grid (…) will tend to have a lower
accuracy than the corresponding structured
grid.’ Also, according to him, the ideal mesh is
as follows (p.251): ‘The ideal mesh is a Figure 3: curvilinear grid
Cartesian distribution (Cartesian = grid points
on straight perpendicular lines) where all the
points are equidistant and where all the cells
are perfect cubes with x = y = z. This grid will
be associated with the highest possible
accuracy of the discretized formulas, where the
finite volume method leads to the same
formulas as finite differences.’

3
Another variant is called ‘multi-block’, and is This differs from how Hirsch (2007, p.250)
ideal for complex geometries. Hirsch (2007, evaluates it: ‘Despite the numerous available
p.257) provides a figure for it. software codes to support the task of grid
generation, it still can be a very time-
consuming exercise, particularly when dealing
with complex geometries’. Both Chung (2010)
and Hirsch (2007) consider that it has an
enormous contribution towards what CFD can
achieve. This is why unstructured grids have
become much more popular than structured
grids, as it is only possible to implement
Figure 4: structured multi-block grid automatic grid generation of multi-block grids
for unstructured grids on complex geometries
There are different types of unstructured grids (Hirsch, 2007).
(Hirsch, 2007, p.262): ‘Since any polygonal Typical grids
structure with rectilinear or curved sides can For the case of the fluid flow around an
finally be reduced to triangular and aerofoil, Winslow et al. (2018, p.1052) use
quadrilateral elements, they form the basis for following grid: ‘A C-mesh was used as the grid
the most current space subdivision in 2D type around the airfoil with an outer boundary
space: triangle/tetrahedra, hybrid, at 15 chord lengths away from the airfoil
quadrilaterals and hexahedra.’ Other shapes surface. Mesh sizes typically contained 267
exist; which are called ‘arbitrary’. The grids can grid points in the surface-wrap direction and
be hybrid, meaning that multiple element types 123 grid points in the wall-normal direction.
are present. Figures 5 and 6 respectively show Grid spacing within the boundary layerin the
unstructured grids with triangular and hybrid normal direction was 0.001% ofthe chord
elements (Hirsch, 2007, p.262 and 264). length.’ Karacaa, Özen, and Kasnakoğlu
(2016, p.31) use a mesh of triangles, with a
rapidly increasing density of nodes towards the
surface of the solid structure, as shown in
Figure 7.

Figure 5: unstructured triangular grid

Figure 7: mesh of triangles with increasing


density of nodes towards the surface.

Subramanian et al. (2019, p. 3013) use an


unstructured tetragonal grid for their CFD
computation, as shown in Figure 8.

Figure 6: unstructured hybrid grid

Nowadays there are algorithms for grid


generation; generation by such algorithms is
called ‘automatic grid generation’ (Chung,
2010). This has become an easy task even for
complex geometries, according to Chung
(2010, p.541): ‘Automatic grid generation in
complicated geometries such as those of a
complete aircraft is now considered a routine
exercise’. Figure 8: unstructured tetragonal grid
4
Typical results – Couette
Mory (2011) describes the Couette flow as
following two-dimensional situation: the fluid is
between two plates, one of them lies still and
one of them translates with a velocity U. The
solution of this flow is a linear increase of u
from 0 to U when the pressure gradient is zero,
as shown in the Figure 9 (Mory, 2011, p.18).
When the pressure gradient is not zero, a
component from the solution of Poiseuille flow
Figure 12 : Couette-Poiseuille flow, Schlichting
is added, which is shown in Figure 10 (Mory,
and Gersten (2017)
2011, p.10). In a Poiseuille flow, the fluid
surrounded by a solid surface (pipe: cross
section at its middle point, over its length axis Typical results – aerofoil
gives of view of two solid surfaces at y= -H and Raffel, Kompenhans and Wernet (1995) found
y=H) lying still. The velocity is generated by the results via PIV, for a flow with Re=400 000. At
pressure gradient. a moderate angle of attack and for a Re of
magnitude order ~ 500 000, there is a flow
separation close to the leading edge, as shown
in Figure 13.

Figure 9: Couette flow

Figure 13: results from Raffel, Kompenhans


and Wernet (1995, p.106)

Ling et al. (2013) find results for the time-


averaged velocity field by magnetic resonance
technique, more specifically MRV. It is possible
to see the shape of the velocity field, as shown
Figure 10: Poiseuille flow. in Figure 14: there is a progressive rise from 0
to free-stream velocity, and this rise spreads
Fox et al. (2016) and Schlichting and Gersten itself over a longer distance when moving away
(2017) confirm Mory’s statement, both showing from leading edge.
a figure of a Couette flow with a Poiseuille
component (Figures 11 and 12).

Figure 14: results from Ling et al. (2013, p.4)


Figure 11: Couette-Poiseuille flow, Fox et al. Li et al. (2019) find results for the velocity field
(2016) within the boundary layer for Re ~ 105, using
Laser doppler velocimetry (LDV). Figure 15
shows the velocity within the boundary layer.

5
There is a strong deceleration towards the solution: ‘many scholars developed various
surface. Furthermore, Li et al. (2019) pressure stabilized finite element formulations
emphasize the difficulty of the measurement and then obtain the positive definite system
because of the pressure gradient. (…), such as the streamline upwind/Petrov-
Galerkin (SUPG) method, the Galerkin least-
square technique, and the characteristic-based
time splitting (CBS) Galerkin method. Now, the
system is always positive definite and therefore
leads to a non-singular solution for any
interpolation functions chosen.’ Lewis,
Nithiarasu and Seetharamu (2004) also
mention the SUPG and CBS finite element
methods as ways to get a non-singular
solution. The family of finite element methods
that allow this is called ‘upwinding schemes’.

Figure 15: results from Ling et al. (2013, p.354) 2.3 CFD codes
General
2.2 FEM for convective term of aerofoil
As mentioned before, Hirsch (2007) defines
General CFD as a numerical solving method using a
As mentioned above, (Houghton et al., 2017) computer. This means that it is based on a
the first main difficulty for solving is formed by certain computer algorithm, or code. According
the convection term of the equation. to Lewis, Nithiarasu and Seetharamu (2004,
Zienkiewicz (2014, p.1) states the same, by pp.299-300), there are three main parts of a
comparing the use of FEM for solid mechanics CFD computer code: ‘In general, all the
and for fluid mechanics: ‘Up to this point the numerical programs contain three parts, that is,
equations governing fluid flow and solid preprocessing, the main processing unit and
mechanics appear to be similar (…). However, postprocessing. The preprocessing part
there is one further difference. Even when the includes mesh generation, data structure and
flow has a constant velocity (steady-state), most of the element-related data, which are
convective acceleration effects add terms (…). constant for an element. The main processing
Therefore, in most cases, unless the velocities unit is responsible for the computational effort
are very small so that the convective and often most of the computing (CPU) time
acceleration is negligible, the treatment has to during a calculation. (…) The final part of a
be somewhat different from that of solid finite element code is the postprocessing unit.
mechanics.’ This unit can either be a coupled
postprocessor, which directly gives the solution
Solution of the convective term in graphical form or may be linked to an
external postprocessor via an interface.’
As stated by Liao, Zhang and Chen (2019), the
convection term of the Navier-stokes equations
leads to the singularity of their solution if the CFD codes – non-FEM
standard Galerkin finite element method is Subramanian et al. (2019) mention that
used. This is because the matrix equation ANSYS Fluent is a typical software for CFD
formed by the element equations is then not computations.
positively definite. Lewis, Nithiarasu and
Seetharamu (2004, p.323) describe the Existing FEM codes
singularity of the solution as the solution being Johansen and Sorensen (2004) use the
marked with ‘spurious oscillations’. EllipSys3D code for their CFD computation. It
Zienkiewicz, Nithiarasu and Taylor (2014) is applicable with a multi-block grid, and is
express this in terms of the quality of the based on the FVM as numerical scheme.
approximation of the exact solution by the Winslow et al. (2018, p.1052) use another:
numerical method: the standard Galerkin ‘The CFD solver used in this study to
method doesn’t give a minimal error. investigate low-Reynolds number
Furthermore, Liao, Zhang and Chen (2019, aerodynamics is the Transonic Unsteady Rotor
p.324) explain that other formulations of the Navier–Stokes 2D (TURNS2D) fluid dynamics
finite element method allow a non-singular solver developed in-house.
6
TURNS2D has been widely used in the past for 3.2 FEM
flows past airfoil and rotor blades at high The FEM to solve the equations ((4) and (5)) is
Reynolds numbers with confidence.’ Karacaa, described in this section. Appendix B provides
Özen and Kasnakoğlu (2016, p.31) also use a full explanation. Firstly, for the time-
another one: ‘The Navier–Stokes PDEs are independent part of the differential
solved using Navier2d, a CFD tool for equation, it is all about producing a global
MATLAB.’ matrix equation and the application of the
boundary conditions on it. The global
3. FEM - MATHEMATICS equation is:
3.1 Equations to solve [𝑲]𝑼⃗⃗ = ⃗𝑭 (6)
As mentioned in the Introduction, FEM is one
of the three possible types of numerical Its production is based on the principle that, for
scheme for the CFD simulation. This section each element, certain terms are put added to a
describes its application on the described certain spot in [K] and 𝐹 , depending on the
problem, in a mathematical way. Firstly, as node numbers of the element. Thereafter, the
mentioned in the Introduction, the convection boundary conditions lead to some changes in
term is not considered, so it is not included in [K] and 𝐹 . Two types of boundary conditions
the equations. Secondly, the pressure is are considered: specified values of the
assumed known, so only the two Navier- unknown function (Dirichlet), or specified
Stokes equations must be solved. Assuming values of the flux (Neumann). The Dirichlet
that the pressure is a linear function of x, more boundary conditions lead to the deleting of
specifically shown on Figure 16: some rows and columns in [K] and 𝐹 and to the
addition of some terms to 𝐹 . The Neumann
boundary conditions create so-called ‘surface
terms’ (if flux(es) is/are non-zero), which are
then added to 𝐹 . The solution of the final global
matrix equation, which produces a result for all
unknown nodal values. At this point, all
elements are fully defined, and so is the
approximation of the unknown function from
the partial differential equation.
Figure 16: assumed pressure distribution. Secondly, for a time-dependent differential
equation, following principle can be used to
This is because, as described in Appendix A take the time-dependent part of the
(General considerations about fluid flows and equation into account. The time is divided
aerofoils - fluid flow on a solid structure), the into discrete time steps. After each time step,
pressure at the front of a solid structure (first new boundary conditions are produced based
contact with the flow) is the highest and it on the calculated solution. The global equation
decreases a lot towards the rear of the rear. can then be solved for the next time step with
Both simplifications (convection term and the new boundary conditions.
pressure) lead to the following simplified
equations to solve (compared to the three 4. FEM, MATLAB CODES
equations (1), (2) and (3) from the 4.1 General
Introduction): The application of finite element method to
𝝏𝒖 𝒌 𝝁 𝝏𝟐 𝝏𝟐
𝝏𝒕
= 𝝆 + 𝝆 (𝝏𝒙𝟐 𝒖 + 𝝏𝒚𝟐 𝒖) (4) solve the equations was described in previous
𝝏𝒗 𝝁 𝝏𝟐 𝝏𝟐 section (3.2), and as mentioned in the
𝝏𝒕
= 𝒈 + 𝝆 (𝝏𝒙𝟐 𝒗 + 𝝏𝒚𝟐 𝒗) (5) Introduction, the codes have to implement it.
There are four codes: codes 1 and 2
k=0 means that there is no pressure difference respectively solve the equations in their steady
between the front and the back of the aerofoil, and their time dependent form, using a uniform
in other words that there is no pressure grid of triangles. Codes 3 and 4 respectively
gradient. A high k means a high pressure solve the equations in their steady and their
difference. time dependent form, using an unstructured
grid of triangles. The next two subsections
describe the functioning and the use of the
codes.
7
4.2 Description The first section included the definition of the
Appendix C provides a full description of the boundary conditions at the start of the time
codes, and Appendix D contains the codes interval, and the solution of the equation (array
themselves (.m files) with descripting text as ‘u’) at each time step defines a new set of
comments (%) in the codes. This section briefly boundary conditions for the next time step.
explains how the codes function.
4.3 Use
As explained in previous subsection, codes 1 The use of the codes is very straightforward. A
and 3 only solve the steady form of the few values have to be filled in the code,
equations. Their first section (section 0) purely before running it in MATLAB. Appendix E
is the definition of the user preferences and provides a complete but short manual of use.
parameters of the FEM. The second section is Two types of values must be filled: the user
where the grid is created from two arrays of preferences and the FEM parameters.
coordinates defining the grid points, using a The FEM parameters are: the dimensions of
built-in commando to form a grid of triangles the domain (lengths of the sides of the
(‘delaunay’). The arrays of coordinates are rectangle), the number of nodes for the grid,
created according to the nature of the grid: only boundary nodes at the domain corners or
systematically for code 1, and randomly for not (for codes 3 and 4), the dimensions of the
code 3 (‘rand’ commando). ‘delaunay’ domain, the properties of air (µ and ρ), the
produces a matrix, linking element numbers to constant defining the pressure (k, from p(x))
node numbers. The code then plots the grid. and the boundary conditions. Also, for the
The third section produces the global equation codes 2 and 4, the discretization of time must
([K] and 𝐹 matrices) via an iteration over the be chosen. The user preferences are the
elements. As explained in Appendix B, there following: which of the two equations to solve
respectively are 9 and 3 terms to place in [K] (x or y; because the code only solve one
and 𝐹 per element. Their position in [K] equation at a time), are the air properties to be
depends on the node numbers of the element, considered constant or not (if not: a random
so the iteration is based on the ‘delaunay’ - variation from a standard value is defined by
matrix. The terms are functions of the a -and b- the user), and do the flux boundary conditions
coefficients of the elements, so they must be have to be recalculated at each time step
calculated at each iteration. The boundary (codes 2 and 4).
conditions are applied in the fourth section. As
mentioned in in the section about the 5. VERIFICATION OF CODES,
application of the FEM and in Appendix B, this RESULTS, DISCUSSION
leads to some changes to [K] and 𝐹 . Deleting 5.1 Verification
terms of [K] and 𝐹 is implemented by setting The verifications consist of checking the
their value as zero. However, for the value progress of the codes. Putting breakpoints in
boundary conditions, the diagonal elements in the Matlab interface, running the code between
[K] must be set as 1 in the code, otherwise the them and controlling the Workspace allows to
solution will not contain the value boundary verify if the progress happens as expected.
conditions at the corresponding nodes. Also, The principles of the verifications are explained
the code sets 𝐹 -terms at the indexes of the below, with many more details in Appendix F.
boundary node numbers as the value of the A first set of verification is done for codes 1
boundary conditions at these nodes. The fifth and 3 only, because codes 2 and 4
and last part includes finds a solution for the respectively use codes 1 and 3 for the
global equation and plots it as a contourplot. operations that are verified by this first set. A
last verification concerns the operations of
Codes 2 and 4 respectively use codes 1 and codes 2 and 4 regarding the time dependence
3 as functions, and invoke them at each of the equations.
time step, except their first two sections Codes 1 and 3
(definition of the parameters and grid creation)
which are obviously only done once. The use The first verification concerns the generation of
of codes 1 or 3 as functions produces a element equations. It concerns the calculation
solution of the equation at each time step. of the a -and b-coefficients of each element. As
mentioned in Appendix B, the terms forming
the global equation (equation (6) in this
document) are functions of those coefficients.
8
The calculated coefficients (visible in the Code 1: influence of the Dirichlet Boundary
Workspace) are checked for some elements by conditions
filling the coordinates of the nodes in the In Figure 17, the left boundary value of velocity
formula for the coefficients (see Appendix B, (x-component u) = 10 m/s, top = 10 and bottom
equations (1) ). This is only done for code 3, =0. In Figure 18, top and bottom values are
because the uniformity of the grid of code 1 switched.
allows to directly fill the values of the
coefficients in the code. The second
verification has the same subject, but checks
the terms to fill in [𝐾] by looking if the a -and b-
coefficients are assigned to the right node
number. It also checks if the terms are put at
the right spot in [𝐾] (as mentioned in Appendix
B, for each element, the spots to fill in [𝐾]
depend on the node number). The third and
fourth verifications verify the application of the Figure 17: velocity component u for a Dirichlet
boundary conditions by checking if [𝐾] and 𝐹 boundary condition at the top (10), left side
change as expected. (10) and bottom (0)
Codes 2 and 4
This last verification checks if the boundary
conditions for the next time step are correctly
calculated from the solution of the current time
step. For the Dirichlet boundary conditions, it is
merely about checking if the solution value at a
boundary node is correctly put as a value
boundary condition for the next time step. It is
more complicated for the Neumann boundary
conditions. As mentioned in Appendix C, a Figure 18: velocity component u for a Dirichlet
specific formula permits the calculation of the boundary condition at the top (0), left side (10)
flux boundary conditions, so its correct and bottom (10)
implementation must be checked.
Code 1: influence of the Neumann Boundary
5.2 Results conditions
Appendix G contains a broad collection of The same boundary conditions as above apply,
results from the codes, some of them are in addition to a new flux boundary condition on
shown and described in this section. These the right side. Figures 19 and 20 respectively
aspects are then discussed in the next section show a little distortion (compared to Figure 18)
(5.3). A first set of results is shown for code 1. of the velocity field when flux value = 10% of
They allow to see the influence of the Dirichlet max value BC, and a strong local distortion on
and Neumann boundary conditions, the the right when flux = 50% of max value BC .
influence of the grid resolution (number of
nodes) and the influence of the pressure
gradient (defined by k, as explained in section
3.1). Thereafter, one result for code 3 is shown
in order to see if there is convergence between
the results from a structured and from an
unstructured mesh. Finally, results of codes 2
and 4 show trends regarding the evolution in
time of the velocity field. It is important to
mention that codes 2, 3 and 4 produce similar
Figure 19: velocity component u for a Dirichlet
results as code 1, so validating code 1 means
boundary condition at the top (10), left side
validating codes 2, 3 and 4.
(10) and bottom (0), and a Neumann boundary
condition (flux=1/s) at the right side

9
Code 3: comparison with code 1
Figure 24 shows the velocity component u as
calculated by code 3. Comparison with Figure
17 shows a convergence between the results
with structured (code 1) and unstructured grid
(code 3).

Figure 20: velocity component u for a Dirichlet


boundary condition at the top (10), left side
(10) and bottom (0), and a Neumann boundary
condition (flux=5/s) at the right side

Code 1: influence of the grid resolution


Figure 21 shows the velocity for a low number
of elements (low resolution of the grid), Figure Figure 24: velocity component u as calculated
22 for a high number. The velocity field by code 3
becomes ‘smoother’ with an increasing mesh
resolution. Codes 2 and 4: influence of flux boundary
conditions regarding the evolution in time
There is a clear influence of flux boundary
conditions, if they are renewed at each time
step (Figure 26). The difference with the case
without those boundary conditions (Figure 25)
is clear: in the latter case there is no time
evolution, while with the other boundary
conditions there is a strong evolution. This is
Figure 21: velocity component u for a low
only shown for code 4, but code 2 gives the
number of elements
same results.

Figure 22: velocity component u for a high


number of elements

Code 1: influence of the pressure gradient


Figure 23 shows the velocity field with the
same boundary conditions as above, but with a
non-zero pressure gradient. It is clear that the
shape of the velocity field changes completely.

Figure 24: velocity component u at different


time-steps as calculated by code 4, for a case
without flux boundary conditions.

Figure 23: velocity component u with non-zero


pressure gradient.
10
Comparison of the results with literature
The general shape of the results (Figures 17
tot 22) without pressure gradient (k=0) seems
to make sense, when comparing with the
Couette flow (Figure 9) from the Literature
review. Both flows show an incremental
increase of velocity from the side(s) with high
boundary value to the side(s) with low
boundary value. Furthermore, the shape of the
result with pressure gradient (Figure 23)
corresponds to the Poiseuille flow from the
Literature review (Figure 10). These two
comparisons validate the codes.

Reflection about accuracy


Four thoughts allow to state that the accuracy
of the codes is surely not comparable to that of
Figure 25: velocity component u as calculated
more advanced CFD codes. Firstly, looking at
by code 4 at different time-steps, for a case
the many possibilities for CFD mentioned in the
with new flux boundary conditions at each step.
Literature review, it is clear that there are other
options of grid and numerical schemes
5.3 Discussion allowing more accurate results. Secondly, the
Code 1: influence of the Dirichlet Boundary assumptions about the incompressibility of the
conditions fluid and the pressure gradient in the flow
surely result in a loss of accuracy. Air is a gas
There is a clear influence of the Dirichlet
boundary conditions, which is as expected. (except at extreme temperatures), so it is
Figure 17 shows an incremental decrease of inaccurate to neglect its compressibility.
the velocity from the sides with high boundary Thirdly, the codes do not consider the
values (left and top) to the sides with low or convection term of the equations, which surely
results in another loss of accuracy. Lastly, the
undefined boundary values (bottom and right).
For a switch between a side of high boundary codes use a rectangular domain, which is not a
value with a side with low boundary value, the good representation of the boundary-layer over
velocity field reacts as expected (Figure 18): the curved surface of an aerofoil. It would be
the incremental decrease starts from the new better to solve a succession of rectangles,
which would be more representative for a
‘high value’ side.
curved surface. This is shown in Figure 26: the
boundary layer is shown in yellow ( (a) ), and
Code 1: influence of the Neumann Boundary the rectangles approximating it in red ( (b) ).
conditions
There is a clear influence of the Neumann
boundary conditions.

Code 1: influence of the grid resolution


It seems logical that exact solution of a velocity
field is smooth/continuous, and a grid with
higher resolution produces a result that is
closer to the exact solution (Hirsch, 2007). This
validates code 1, because the result with a
finer grid (Figure 22) is smoother than the one
with less resolution (Figure 21).

Code 3: comparison with code 1


The convergence between the results from the Figure 26: (a) boundary layer (b) approximation
codes with structured and unstructured grids
of boundary layer as a series of rectangles.
probably demonstrate the correctness of the
codes.
11
6. MANAGEMENT OF THE PROJECT Abbott, I. H. and von Doenhoff, A. E. (1959)
The proposal for this project is included as Theory of wing sections: including a summary
Appendix H. of airfoil data. 1st edition. New York: Dover
The project included the creation of a computer publications.
algorithm. This resulted in unexpected losses
of time, as an algorithm can be prevented from Hirsch, C. (2007) Numerical computation of
working by small mistakes. internal and external flows: the fundamentals of
Furthermore, some objectives of the project computational fluid dynamics. 2nd edition.
were not met. This work did not present any Amsterdam: Butterworth-Heinemann.
concrete solution for the convection term of the
equations, and there is no comparison of the Xia, J. (2021) ME5535 Lecture notes for
results with results from other FEM codes or Advanced thermofluids. Brunel University,
commercial packages (like ANSYS Fluent). London (United Kingdom).

Smith, E. (2021) ME5314 Lecture notes for


7. CONCLUSION
Advanced modelling and design - modelling.
This work looked into a quite common case of Brunel University, London (United Kingdom).
fluid flow and presented possible FEM
algorithms to determine the velocity field. The Winslow, J., Otsuka, H., Govindarajan, B. and
codes were based on two assumptions about Chopra, I. (2018) Basic Understanding of Airfoil
the flow situation: the neglection of the Characteristics at Low Reynolds Numbers
convection term and the approximation of the (104–105). Journal of aircraft. 55(3), pp.1050-
pressure gradient as a known linear function. 1052
As mentioned in sections 5.2 and 5.3, the
results of the codes validate them. However, Zienkiewicz, O. C., Nithiarasu, P., Taylor, R. L.
their accuracy for precise simulations surely (2013) The Finite Element Method for Fluid
isn’t fine-tuned when you look at the many Dynamics. 7th edition. Amsterdam: Butterworth-
possibilities for CFD mentioned in the Heinemann.
Literature review: other types of grids or
numerical schemes may be better suited. Also, Chung, T. J. (2010) Computational fluid
the mentioned assumptions about the flow dynamics. 2nd edition. Cambridge: Cambridge
(incompressibility of the fluid and simplified University Press.
pressure gradient) surely result in a loss of
accuracy. Moreover, neglecting the convection Subramanian, V., Rakesh Vimal, M., Devi, B.,
term adds more inaccuracy. Lastly, the use of Gunasekar, P. and Venkatesan, S. P. (2019)
a rectangular domain surely isn’t ideal for the International Journal of Ambient Energy. 43(1),
flow over for the curved surface of an aerofoil. p.3013.

8. REFERENCES Mory, M. (2011) Fluid mechanics for chemical


engineering. 1st edition. New York: Wiley.
Nakayama, Y. and Boucher, R. F. (1999)
Introduction to fluid mechanics. 1st edition. Raffel, M., Kompenhans, J. and Wernert, P.
Oxford: Butterworth-Heinemann. (1995) Investigation of the unsteady flow
velocity field above an airfoil pitching under
Fox, R. W., McDonald, A. T., Pritchard P. J. deep dynamic stall conditions. Experiments in
and Mitchell, J. W. (2016) Fluid mechanics. 9th fluids. 19, pp.103 and 106.
edition. Hoboken: Wiley.
Ling, J., Yapa, S. D., Benson, M. J., Elkins, C.
Houghton, E. L., Carpenter, P. W., Collicott, S.
J., Eaton, J. K. (2013) Three-Dimensional
H. and Valentine, D. T. (2017) Aerodynamics
Velocity and Scalar Field Measurements of an
for engineering students. 7th edition.
Airfoil Trailing Edge With Slot Film Cooling:
Amsterdam: Butterworth-Heinemann.
The Effect of an Internal Structure in the Slot.
Journal of turbomachinery. 135(3), pp. 2 and 4.
Karacaa, H. D., Özen, G.D. and Kasnakoğlu,
C. (2016) Nonlinear modelling and control of
the flow over aerofoils using CFD simulations.
Simulation modelling practice and theory. 67,
pp. 29-31.

12
Li, Q., Xu, J., Maeda, T., Kamada, Y.,
Nishimura, S., Wu, G. and Cai, C. (2019) Laser
Doppler Velocimetry (LDV) measurements of
airfoil surface flow on a Horizontal Axis Wind
Turbine in boundary layer. Energy (Oxford).
183, pp.341, 353 and 354.

Liao, S., Zhang, Y. and Chen, D. (2019) A


Galerkin finite element algorithm based on
third-order Runge-Kutta temporal discretization
along the uniform streamline for unsteady
incompressible flows. International journal for
numerical methods in fluids. 90, pp.323-324.

Lewis, R. W., Nithiarasu, P., Seetharamu, K. N.


(2004) Fundamentals of the finite element
method for heat and fluid flow. 1st edition. New
York: Wiley.

Johansen, J. and Sorensen, N. N. (2004)


Aerofoil Characteristics from 3D CFD Rotor
Computations. Wind energy. 7(4), p.286.

13

You might also like