0% found this document useful (0 votes)
76 views3 pages

HW3 2023

This document provides guidelines and tasks for Homework 3 on discretisation errors. It includes: 1) Guidelines for submitting homework, including using a single PDF file, including plots and comments, and group work policies. 2) Task 1 involves analyzing a first-order finite difference scheme for derivatives on a grid, including deriving a modified wavenumber and comparing numerical and analytical derivatives of a Fourier mode. 3) Task 2 examines dissipative and dispersion errors in first-order and second-order numerical schemes for the advection equation, including von Neumann analysis and defining error terms based on amplification factors.

Uploaded by

BlooD LOVER
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)
76 views3 pages

HW3 2023

This document provides guidelines and tasks for Homework 3 on discretisation errors. It includes: 1) Guidelines for submitting homework, including using a single PDF file, including plots and comments, and group work policies. 2) Task 1 involves analyzing a first-order finite difference scheme for derivatives on a grid, including deriving a modified wavenumber and comparing numerical and analytical derivatives of a Fourier mode. 3) Task 2 examines dissipative and dispersion errors in first-order and second-order numerical schemes for the advection equation, including von Neumann analysis and defining error terms based on amplification factors.

Uploaded by

BlooD LOVER
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/ 3

Computational Fluid Dynamics, SG2212 / SG3114, Spring 2023 1

Homework 3
Discretisation errors
due February 8, 23:59

Guidelines:

• Use only a single pdf. Preferably scan your homework, if you take a photo, make sure it is sharp
and bright;
• Include all plots in the pdf in the right place;
• Do not present plots without commenting them: always write a (short) description of what the
plot tells you and what you can conclude from it;
• You can work in groups up to 3;
• If you work in groups:
– write the names of all group members at the beginning of the report;
– you can work and discuss together but each group member is required to submit an individual
report written with his/her own words; copy-paste reports will not be accepted
• Please use the following naming convention: “surname hwX.pdf ” and include all Matlab files
as a single separate archive: “surname hwX.zip”. X is the number of the homework.

Task 1: Modified wavenumber

On an equidistant grid, the finite-difference derivative of a Fourier mode eikx can be found by multiplying
the function value on each node with the so-called modified wavenumber k̃(k).
To better understand this concept, we compare the matrix representation and the modified wavenumber
representation of a finite-difference scheme. Let’s consider a periodic function

f (x + pm) = f (x), m ∈ Z.

where p is the period length. Let the vector f be the discrete representation of f (x) on the equidistant
grid where xj := j∆x, ∆x := p/N , j = 0, 1, . . . , N − 1,

f := [f0 , f1 , . . . , fN −1 ]> , f0 = fN , where fj := f (xj ).

For this task consider p = 2π and N = 20.

a) A first-order finite-difference discretisation of the derivative f 0 (x) can be written as

f 0num := [δf0 , δf1 , . . . , δfN −1 ]> = D f ,

where
fj+1 − fj
.δfj :=
∆x
Use MATLAB to assemble the system matrix D (remember that f0 = fN ). Include D in the
written report.
b) Consider f (x) = eikx and derive the expression for the modified wavenumber k̃ for the finite-
difference scheme. Non-dimensionalise the wavenumber with the grid spacing, i.e. derive the
expression for k̃∆x.
Computational Fluid Dynamics, SG2212 / SG3114, Spring 2023 2

c) From now on assume that k = 3 (i.e. consider a specific Fourier mode). Compute the derivative
in a discrete (δfj ) and analytical (f 0 (x)|x=xj ) manner at every grid point. Use the previously
defined D for the discrete derivative. Plot the real part for both the numerical and the analytical
derivative as a function of x, then comment on their differences. (Hint: use a higher value of N to
obtain smoother curves)
d) Compute the vector µ with the elements
δfj
µj :=
fj
and compare it with the complex number ik̃, where k̃ is the modified wavenumber for the right-
sided finite differences as derived in b). Does this result confirm that the finite-difference derivative
of a Fourier mode eikx can be found by multiplying the function by the modified wavenumber, i.e.
does ik̃f = D f hold?

Task 2: Dissipative and dispersion error

In this task we will examine the dissipative and dispersion error introduced by a first-order and a second-
order numerical scheme. Let us consider the advection equation,
∂u ∂u
+c =0. (1)
∂t ∂x
Question 1: Discretise the advection equation employing the following schemes:

• first-order forward in time and backward in space (upwind scheme, FTBS);


• second-order central difference for both time and space (leapfrog scheme):
un+1
j − un−1
j unj+1 − unj−1
+c =0 (2)
2∆t 2∆x
Perform for both the von Neumann analysis and write the real and imaginary part of the amplification
factor per wavenumber, Ĝk .
(Hint: to compute Ĝk for the leapfrog scheme, note that: ûn+1 /ûn = ûn /ûn−1 )
Question 2: We will employ the von Neumann analysis to investigate the relation between amplitude
(or dissipative) and phase (or dispersion) error. For both the numerical and the exact solution,
ˆ it is possible to write
denoted ũ,
ûn = Ĝûn−1 = Ĝ2 ûn−2 = · · · = Ĝn û0 (3)
ˆn = G̃
ũ ˆ ũ ˆ 2 ũ
ˆn−1 = G̃ ˆ n ũ
ˆn−2 = · · · = G̃ ˆ0 . (4)
Thus, it is possible to define an amplitude and a phase error as ratio between, respectively, the amplitude
difference and the phase difference for each wave number k for the discretised and the exact differential
equation
|Ĝk | Φ
amplitude error: εA = phase error: εP = , (5)
ˆ
|G̃k | Φ̃
q
where |Ĝk | is the module of the amplification factor (|Ĝk | = =(Ĝk )2 + <(Ĝk )2 ) and tan Φ = −=(Ĝk )/<(Ĝk ).
Show that the exact amplification factor for the advection equation is
ˆ = e−iσφ
G̃ where φ = k∆x and σ = c∆t/∆x . (6)
k

(Hint: What is the analytic solution for a generic initial condition? Use it for each Fourier mode).
Then, compute εA and εP for the upwind and the leapfrog scheme and use this result to discuss quali-
tatively how a single sinusoidal wave will be affected by the two discretisation schemes.
You can compare the behaviour of the amplitude and phase error for the first-order scheme and the
phase error for the second-order scheme with the solution given in Figure 1.
Computational Fluid Dynamics, SG2212 / SG3114, Spring 2023 3

Figure 1: (Left) Dissipative and (centre) dispersive error for the first-order scheme and (right) dispersive
error for the second-order scheme, as function of φ = k∆x for different values of σ = c∆t/∆x.

You might also like