Assignment CFD
Assignment CFD
1 Requirements
To receive credits for the CFD course all exercises given during the lectures should be completed
as well as one of the final assignments specified below. There are a few assignments related to
the hyperbolic part of the course as well as a few related to the elliptic part. Not all assignments
are of the same level. There are 2 assignments with a higher level. These are for those who
really wish to challenge themselves, and indicated by a *. Correctly solving one of these will
lead to a higher score.
The assignment can be made individually or in collaboration with a fellow student. A short
report should be written and handed in. The report should be well structured starting with
an introduction describing the problem, a description of the discretization chosen, the expected
accuracy, the numerical solution method used, demonstration of performance, and relevant
supporting theoretical results. Numerical results should be presented showing convergence of
the numerical solution process (if relevant), and convergence of the solution with decreasing
mesh size (and time step), and the influence of problem parameters. The observed performance
should be explained.
When the assignment is completed the report can be handed in. The exercise reports handed
in as well as the report of the final assignment will be checked by the teachers. When found
acceptable an appointment can be made for the oral grading exam. In this exam we evaluate
your knowledge of the material you presented in the exercise reports, as well as your knowledge
of the general theory discussed in the course material and the course lectures.
To pass the exam it is paramount that you understand your own work and at the exam you
have to show understanding of the theory that you used. This implies that you have to prepare
for the exam! Just having handed in correct exercises is not enough to pass!
For further information about the assignments: C.H. Venner Horst-N 246, c.h.venner@utwente.nl
and E.T.A. van der Weide Horst-N 225, e.t.a.vanderweide@utwente.nl.
1
2 Hyperbolic Problems
2.1 2D Inviscid Burgers’ Equation
Consider the following 2D extension of the inviscid Burgers’ equation in conservative form
∂u 1 ∂u2 ∂u
+ + = 0. (1)
∂t 2 ∂x ∂y
Two steady solutions of this equation are sought on the unit square, 0 ≤ x ≤ 1, 0 ≤ y ≤ 1. The
first solution is obtained using the boundary conditions
u(x, 0) = 1 − 43 x
u(0, y) = 1 (2)
u(1, y) = − 13
while for the second solution the following boundary conditions are used
h 3 i
u(x, 0) = 12 12 − 3 x − 21 + 4 x − 12
3 (3)
u(0, y) = 4
u(1, y) = − 14
Use the following combinations for the spatial discretization:
- Accuracy: First order upwind scheme and second order upwind scheme in combination
with the MC and Van Albada limiter. When the MUSCL reconstruction cannot be used
for the left or right state, use a second order central approximation.
Recommended reading
Charles Hirsch,
Numerical Computation of Internal and External Flows, Volume 2, page 467.
(When not available in the library copies of relevant pages can be made from E.T.A. van
der Weide or C.H. Venner)
2
where the state vector U and the flux vector F are given by
ρ ρu
U = ρu , F = ρu2 + p . (5)
ρE (ρE + p)u
The system is closed by assuming a calorically perfect gas, which relates the pressure to the
density, velocity and energy according to
1 2
p = (γ − 1) ρE − ρu . (6)
2
Here γ is the specific heat ratio, which is 1.4 for air.
Sod’s shock tube problem is a Riemann problem with the following initial conditions:
ρL = 1.0 ρR = 0.125
pL = 1.0 pR = 0.1 (7)
uL = 0.0 uR = 0.0
At t = 0 the interface between the two states is removed and the flow develops.
Integrate the Euler equations in time until t = 0.15 using the classical fourth order Runge-Kutta
method. Use the second order MUSCL scheme in combination with the MC limiter and Roe’s
approximate Riemann solver for the spatial discretization. The spatial domain can be taken as
− 12 ≤ x ≤ 32 . Use appropriate values for both the spatial and temporal resolution and carry out
a grid refinement study.
Recommended reading:
Charles Hirsch,
Numerical Computation of Internal and External Flows, Volume 2, page 462 - 469.
(When not available in the library copies of relevant pages can be made from E.T.A. van
der Weide or C.H. Venner).
Gary Sod,
A Survey of Several Finite Difference Methods for Systems of Nonlinear Hyperbolic Con-
servation Laws,
Journal of Computational Physics, Vol. 27, Iss. 1, pp. 1-31, 1978
Available from http://www.sciencedirect.com
3
boundary oblique to the mesh is avoided. The non-dimensional conditions in front of the moving
shock wave are
ρ = γ, u = 0, v = 0, p = 1 (8)
and the conditions after the moving shock are
√
ρ = 8.0, u = 4.125 3, v = −4.125, p = 116.5 (9)
20
Here γ = 1.4 is the specific heat ratio. The shock itself moves with a velocity of √ 3
to the
right. These conditions exactly obey the Rankine Hugoniot shock relations for Mach = 10 (in
the frame of the moving shock) for γ = 1.4.
The governing equations are the 2D unsteady Euler equations in conservative form
∂U ∂F ∂G
+ + = 0, (10)
∂t ∂x ∂y
where the state vector U and the flux vectors F and G are given by
ρ ρu ρv
ρu ρu2 + p ρuv
U = ρv , F =
, G =
ρv 2 + p
. (11)
ρuv
ρE (ρE + p)u (ρE + p)v
The system is closed by assuming a calorically perfect gas, which relates the pressure to the
density, velocity and energy according to
1 2 2
p = (γ − 1) ρE − ρ u + v . (12)
2
Integrate the 2D Euler equations in time from t = 0.0 to t = 0.2 using the 3-stage Strongly
Stability Preserving Runge-Kutta method (SSP-RK3). Use the second order MUSCL scheme
in combination with the MC limiter and Roe’s approximate Riemann solver for the spatial
discretization. Apply the limiter to the variables (p, u, v, s), where s = ln ρpγ . This set of
variables mimics the characteristic variables as closely as possible, while maintaining stability
for the very strong shock. The spatial domain can be taken as 0 ≤ x ≤ 4, 0 ≤ y ≤ 1. Use a
uniform grid resolution for simplicity and use an appropriate grid spacing. It is recommended,
but not required, to use the cell centered variant of the Finite Volume method, because this
is easier for implementing the inviscid wall boundary conditions. Note that very fine grids are
necessary and it is highly recommended to use C, C++ or Fortran as programming language.
Matlab and Python are too slow when a sufficient resolution is used.
An impression of the flow field at t = 0.2 is given in the figures (1) and (2). For a movie, see
e.g. https://www.youtube.com/watch?v=xecIZylotSE
Recommended reading:
Charles Hirsch,
Numerical Computation of Internal and External Flows, Volume 2, page 462 - 469.
(When not available in the library copies of relevant pages can be made from E.T.A. van
der Weide or C.H. Venner).
4
Figure 1: Density isolines of the full flow
field at t = 0.2.
Figure 2: Density isolines in the interaction
region at t = 0.2.
3 Elliptic Problems
3.1 Full Multigrid Solver for the 2D Poisson problem
The objective is to built a numerical solver for the 2D Poisson problem using Multigrid Tech-
niques. The problem is defined by:
∂2u ∂2u
+ 2 = f (x, y) (13)
∂x2 ∂y
on the domain (x, y) ∈ [0, 1] × [0, 1]. The boundary condition is u = 0 on the boundary of the
domain. For educational purposes the right hand side f (x, y) should be chosen such that an
analytical solution exists. For example using
gives the analytic solution u(x, y) = sin(2πx) sin(2πy) which satisfies the boundary condition.
This analytic solution can be used to illustrate convergence with decreasing mesh size.
• The first step is formed by programming a Gauss-Seidel relaxation for the problem. This
has already been done as one of the exercises giving during the course.
5
• The next steps involve making a working course grid correction cycle that indeed gives the
convergence rates predicted by the local mode analysis, first for the case of two gridlevels,
and then for the case of multiple levels. Demonstrate a grid independent convergence rate.
• Implement the Full Approximation scheme as if the problem were non-linear and demon-
strate that its performance is exactly the same as for the linear case
• Implement the FMG algorithm and use the approximate error norm (see notes, chapter 3)
that the FMG process with one or two V (2, 1) cycles per refinement is sufficient to yield
a solution with an error that is small compared to the discretization error.
• Advanced, optional Investigate the use of τ extrapolation. This is a very trivial modification
to the MG algorithm that enables increasing the order of accuracy from second to fourth
order. Details can be found in A. Brandt, ”Guide to Multigrid Techniqes,” available from
C.H. Venner.
All relevant information for this assignment can be found in the chapters 2 and 3 of the book
”Multilevel Methods in Lubrication” which are available as pdf files on Canvas.
The student has the option to program the entire solver him/her self. Alternatively use can
be made of a framework program ”poisson2d-s.c”. This is a c program that has a special
datastructure for easy multigrid programming.
• The equations should be discretized with second order accuracy using a staggered grid
arrangement. A description of the approach to be taken can be found in A. Brandt’s
”Guide to Multigrid Techniques” of which the relevant pages can be copied from C.H.
Venner.
6
• Solve the discrete equations using an iterative solver can be developed or a direct matrix
solver can be used. For iterative solution Distributive Gauss-Seidel as described by Brandt
is an option. Alternative is a collective relaxation scheme. This is up to the student to
choose. Show convergence of the relaxation process using graphs of the residual as function
of the number of sweeps
• Demonstrate convergence of the solution with decreasing mesh size, by comparing solutions
obtained on grids with different mesh sizes.
• Advanced optional Include the non-linear advection terms and show there effect on the
solution.
• Advanced optional Extend the solver to a coarse grid cycle solver (or even FMG)
Additional instruction and information in writing (handouts) about this problem can be obtained
from C.H.venner.
• Develop an iterative procedure, for example Gauss-Seidel relaxation for each equation
separately, or collective Gauss-Seidel relaxation can be used.
• Show that the relaxation converges and that, with decreasing mesh size, the solution
converges to the prescribed analytic solution. Use grids with nx = 4, 8, 16, 32, 64, etc.
points in each direction to show this.
7
When the displacements are known the stresses can be computed from:
∂u ∂u ∂v
σxx = 2µ +λ + (21)
∂x ∂x ∂y
∂v ∂u ∂v
σyy = 2µ +λ + (22)
∂y ∂x ∂y
1 ∂u ∂v
σxy = 2µ + (23)
2 ∂y ∂x
• Derive second order accurate approximations for these equations in the interior points,
and show that the computed stress field also converges to the analytical solution of the
stress field.
Next, consider a realistic problem with f (x, y) = g(x, y) = 0. Assume the displacements u and
v are zero everywhere on the boundary, except for the boundary y = 1, 0 < x < 1. Assume a
compressive stress is prescribed σyy = −Ps (x), and σxx = σxy = 0. Take Ps (x) = x ∗ (1 − x).
• Discretize the boundary condition and solve the problem on a sufficiently accurate grid.
Show graphs of the displacement and stress fields and discuss the results.
• Possible extension: vary the value of λ, i.e. 1 ≤ λ ≤ 1.5 and comment upon the effect on
the solution.
These integral transforms appear in many scientific problems, e.g. in fluid mechanics, structural
mechanics, acoustics, potential field theory, etc. often the ”kernel function” G(x, y) is a potential
function, i.e. G = 1/|x − y|. The evaluation of the integral transform may be a task by itself, or
appear as sub-task in solving an integral equation (Fredholm). When discretized the transform
yields a discrete multi-summation of the form:
X
v( xi ) = Ḡ(xi , yj )ū(yj ) (25)
j
where xi are the discrete points in Ωd where the integral transform needs to be known. ū is a
summation quantity directly related to ū its specific form depending on the type of discrezation,
and will be given in the points and yj . Ḡ(xi , yj ) is a function that also ”inherits” its properties
from the ”kernel function” G(x, y) with the details depending on the discretization. When there
are n points xi and n̄ points yj the evaluation of (25) requires O(nn̄ operations. This discrete
transform also appears as the evaluation of a matrix vector multiplication for the case of a dense
matrix, and in the case of particle problems determining the force exerted on one particle by all
8
others (coulombic molecular interaction). Multigrid/Multilevel methods can also be used for the
fast evaluation of discrete integral transforms. Study and actually building a working algorithm
for a model problem of this type is also one of the possibilities as final assignment for the course.
In this case contact C.H. Venner for more details.
The flow to be investigated is the classical test case for the RAE-2822 airfoil, namely Mach
number is 0.729, Reynolds number is 6.5 · 106 and angle of attack is 2.31o . For these conditions
the flow is assumed to be fully turbulent and a shock wave is present on the suction side of the
airfoil, see figure (3).
Figure 3: Mach number isolines for the transonic flow over the RAE-2822 airfoil using the SST
turbulence model. The visualization is carried out with paraview.
Generate a set of suitable grids to carry out the grid refinement study. For this case you
can either use fully structured grids or an unstructured grid in combination with an inflation
layer to capture the turbulent boundary layer. For the later case it is recommended to use
quadrilateral cells in the boundary layer. Make sure that the farfield is at least 100 chords away
from the airfoil and the y + resolution is appropriate. Keep in mind that SU2 does not have the
option of wall functions yet (work in progress), hence the viscous sublayer needs to be resolved.
Investigate several discretization options as well as the Spalart-Allmaras and SST turbulence
9
models. Your report should contain the skin friction coefficient and pressure distribution on the
surface of the airfoil. Comparison with experimental data is appreciated. The numerical solution
can be visualized with the open source software paraview, see https://www.paraview.org.
For more details as well as the geometry definition of the RAE-2822 contact E.T.A. van der
Weide.
10