Computational Fluid Dynamics

115 views 10:41 am 0 Comments May 9, 2023

Module Code
COM00174M
Computational Fluid Dynamics
Fluid dynamics is the subdiscipline of fluid mechanics that is concerned with the flow of fluids –
both liquids and gases. It has a wide range of applications across the science and engineering
disciplines, from describing the flow of liquids through pipes, to the description of airflow around
vehicles and other structures.
Computational fluid dynamics (or CFD) is the application of computational and numerical methods to solve problems that involve fluid flows. High Performance
Computing (or Supercomputing) is widely applied to CFD problems to improve the accuracy of
solutions and to accelerate the time-to-solution.
Perhaps the most famous equations in CFD are the
Navier-Stokes equations, used to treat
laminar flows of viscous, incompressible fluids
1. The equations can be presented in numerous
forms beside the derivation below, and are named after French engineer and physicist ClaudeLouis Navier and Anglo-Irish physicist and mathematician George Gabriel Stokes. The flow is
described by a system of partial differential equations whose dimensionless form is given by:
¶ ¶t

~u + (~u · r)~u + rp =
r · ~u = 0
D~u +~g

1
Re(momentum equation) (1)
(continuity equation) (2)
where
~u is flow velocity, t is time, p is pressure, Re is the dimensionless Reynolds number and ~g
denotes body forces such as gravity2.
For this assignment, you are provided with a simple solver for the Navier-Stokes equations. The
solver operates according to the computational scheme described in Chapter 3 of the book by
Griebel et al. [1]. In this assignment, we discretise our space in two dimensions, and we solve
the equations using a finite-differencing scheme. We use a
staggered grid, where the horizontal
velocity
u is stored on the vertical cell edges, the vertical velocity v is stored on the horizontal
cell edges, and the pressure
p is stored in the cell centres.
u
i,j+1
u
i+1,j
u
i,j-1
u
i-1,j
v
i,j vi+1,j
v
i,j-1
v
i+1,j+1
u
i,j
pi,j pi+1,j
Figure 1: A staggered grid
1Fear not, you do not need to understand these equations. An implementation is provided.
2r and D represent operations from vector calculus. You can read more about them in books such as “div, grad,
curl and all that”, or from Wikipedia. Though again, understanding these equations is not required to solve this
assessment.
Page 2 of 6
Module Code
COM00174M
Beginning at time
t = 0, with given initial values for the u and v vector fields, we increment time
by
dt each step until tend is reached. At any time step n, the values of all variables are known,
and those at time
tn+1 are to be computed.
We start by providing the discretisation of the momentum equation (Eq. (1)):
u(n+1) = u(n) + dt Re 1 ¶¶2xu2 + ¶¶2yu2  (ux2) (uv y ) + gx ¶¶xp
v(n+1) = v(n) + dt Re 1 ¶¶2xv2 + ¶ ¶2yv2  (uv x ) (vy2) + gy ¶¶yp (3)
We then introduce the abbreviations,
F and G:
F := u(n) + dt Re 1 ¶¶2xu2 + ¶¶2yu2  (ux2) (uv y ) + gx
G := v(n) + dt Re 1 ¶¶2xv2 + ¶ ¶2yv2  (uv x ) (vy2) + gy (4)
Substituting (4) into (3), we obtain the form:
u(n+1) = F(n) dtp(n+1)
x
v
(n+1) = G(n) dtp(n+1)
y
(5)
This manner of discretisation may be characterised as being
explicit in the velocities and implicit
in the pressure, i.e., the velocity field at time step tn+1 can be computed once the corresponding
pressure is known.
We can then evaluate the continuity equation, Eq. (2), at time
tn+1. We substitute Eq. (5) in for
the velocity field and obtain:
0 = u(n+1)
x +
v(n+1)
y =
F(n)
x dt2p(xn2+1) + Gy(n) dt2p(yn2+1) (6)
We can rearrange this to become a
Poisson equation for the pressure p(n+1) at time tn+1:
2p(n+1)
x2 +
2p(n+1)
y2 =
1 dt
F(n)
x +
F(n)
y ! (7)
The computation for the velocity field at the
n + 1th time step therefore consists of the following
parts:
1. Compute the tentative velocities,
F(n), G(n), using the velocity fields u(n), v(n).
2. Compute the right hand side of the Poisson Equation, Eq. 7.
3. Solve the Poisson equation for the pressure
p(n+1).
4. Compute the new velocity field (
u(n+1), v(n+1)) with the pressure value p(n+1).
Page 3 of 6

Module Code
COM00174M
The Problem
For this assignment you are provided with a simple CFD application, implemented according to
the computational scheme by Griebel et al. [1]. It is set up to solve a problem often studied using
CFD, known as a Kármán vortex street.
Named after the engineer and fluid dynamicist Theodore von Kármán, a vortex street is a
repeating pattern of swirling vortices, caused by a process known as vortex shedding. A vortex
street will only form at a certain range of flow velocities, specified by a range of Reynolds numbers,
and they can be found when atmospheric air flows over obstacles such as buildings or even
islands and isolated mountains. Figure 2 shows one such example.
Figure 2: Kármán vortex street caused by wind flowing around the Juan Fernández Islands
These turbulent flows, caused by a Kármán street, have even been known to damage the
structure of tall buildings, and thus it is important for engineers to account for the effects of vortex
shedding when designing structures. One particularly notable example is the Ferrybridge Power
Station C cooling towers. In 1965, during high winds, three of the cooling towers collapsed, due
to the vibrations caused by Kármán turbulence.
The application provided,
vortex, sets up a problem where there is a circular object to the left
of the domain, and the initial fluid velocity is such that it is flowing from left to right. Figure 3
shows the starting state of the simulation, while Figure 4 shows the state after approximately 5
seconds of simulation time.
Figure 3: Starting state of the
u velocity field in the vortex application.
Page 4 of 6

Module Code
COM00174M
Figure 4: A visualisation of the
u velocity field after 4.98s of simulation time.
The
vortex application can be downloaded from the VLE, and built and run using:
$ make
$ ./vortex
At the end of execution, a VTK file will be written that can be loaded into a visualisation application
such as VisIt
3. The output file will contain information about the geometry of the problem, the
values of the
u and v velocity fields and the values of the pressure field p. The final simulation
state will be based upon the default configuration options, but you can customise the parameters
by changing the runtime arguments passed to the application.
$ ./vortex –help
The vortex application consists of 6 C files and 5 associated header files.
args.c contains functionality to handle the command line options, and can override some
simulation parameters based on these options.
boundary.c contains logic to enforce the boundary conditions at the edge of the domain.
data.c contains the definitions for the shared storage and simulation parameters that are
used in the application, and also a function to allocate addressable, contiguous 2D arrays.
setup.c has functionality to set up a simulation based on the inputs provided, and assigns
and allocates the required variables and storage.
vtk.c handles the file input and output for the application.
vortex.c contains the main method, and the methods required to progress the simulation.
References
[1] Michael Griebel, Thomas Dornseifer, Tilman Neunhoeffer, “Numerical Simulation in Fluid
Dynamics”, SIAM, 1998. https://people.math.sc.edu/Burkardt/cpp_src/nast2d/nast2d.html
3https://visit-dav.github.io/visit-website/
Page 5 of 6
Module Code
COM00174M
Assignment
The vortex application is currently a simple single-threaded implementation of the NavierStokes equations as described above. Your task is to produce three parallelisations of the
vortex application and complete a report detailing the parallelisation process, the performance
of your three parallelisations, and a comparative study of these parallelisations.
You are expected to produce parallelisations using
OpenMP, MPI and CUDA.
Your parallelisations should produce the same result (within some small tolerance due to floating
point arithmetic) as the original single-threaded application for equivalent starting parameters.
You are expected to fully evaluate your applications using the HPC hardware that is available
within the University (e.g. CUDA-capable workstations within the Department, the Viking cluster,
etc.), and that is appropriate for each particular programming model.
Submission
Your submission should be a .zip file that will contain your three application “ports” and a
completed report document (as a
.pdf). The report document should be formatted according to
the provided template, and word counts should be strictly observed. Failure to observe a word
count will result in a mark of 0 for the section in question. Your report will cover:
Parallelisation Approach [30%]
The approach taken to parallelise the application for each programming model.
Validation [15%]
The validation process used to verify the correctness of your applications.
Experimental Setup [15%]
A summary of the systems used for performance evaluation and an account of the
process of collecting results.
Performance Evaluation [20%]
Results demonstrating the performance and scaling behaviour of your applications.
Comparative Analysis [20%]
A comparative analysis of your three applications.
You may use figures when necessary, and text in figures and captions will not be considered in
the word count. References may be listed at the end of your report.
End of examination paper
Page 6 of 6