Examples 4

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

302.

044 UE Numerical Methods in Fluid Dynamics Exercise 4, WS 2022

Advection
Consider the one-dimensional advection equation
∂T ∂T
+u =0 (1)
∂t ∂x
with the advection speed u = 1 on the domain x ∈ h0, 1i with periodic boundaries

T (x = 0, t) = T (x = 1, t), ∂x T (x = 0, t) = ∂x T (x = 1, t). (2)

In this exercise, we will solve (1) numerically for t ∈ h0, 2i on a grid with uniform spacing ∆x = 0.02. Some of
the numerical schemes for the advection equation are listed below:

• First-order upwind ( 
u∆t n
Tjn − Tj−1
Tjn+1 = Tjn − n
 . (3)
|∆x
{z } Tj+1 − Tjn
C

• Backward-time centered-space
C n+1
Tjn+1 + (T n+1
− Tj−1 ) = Tjn (4)
2 j+1
• Lax–Friedrichs
1 n  C
Tjn+1 = n n n

Tj+1 + Tj−1 − Tj+1 − Tj−1 (5)
2 2
• Leapfrog
Tjn+1 = Tjn−1 − C Tj+1
n n

− Tj−1 (6)

• Lax–Wendroff
C  C2
Tjn+1 = Tjn − n n n
− 2Tjn + Tj−1
n

Tj+1 − Tj−1 + Tj+1 (7)
2 2
• Warming–Beam

C  C2
Tjn+1 = Tjn − 3Tjn − 4Tj−1
n n
Tjn − 2Tj−1
n n

+ Tj−2 + + Tj−2 (8)
2 2

Theoretical background
• What is the analytical solution of the advection equation for a given initial condition?
• What is the type of (1)? Do we need a boundary condition at both boundaries?

• For upwind schemes like (3) or (8), how does one select the direction of the one-sided finite difference in
space?
• How does one select a suitable time step ∆t for a given grid spacing ∆x and a given advection speed u?
• Try to guess: how would you select a suitable grid spacing ∆x for a given initial condition? (We did not
tell you yet.)
• What is the order of accuracy of (4) with respect to ∆x for a given value of C. Is the leading-order
numerical error diffusive or dispersive?
• How can one derive the Lax–Wendroff and Warming–Beam methods?

Inst. of Fluid Mechanics and Heat Transfer 1 TU Wien


302.044 UE Numerical Methods in Fluid Dynamics Exercise 4, WS 2022

Smooth initial condition


Consider a harmonic initial condition
T (x, t = 0) = sin (2πx/λ) (9)
with a wavelength λ = 0.5.

• Using each of the following values of the Courant number: C = {0.8, 1, 1.2}, compute the numerical
solution with the schemes (3) and (6) and compare it to the analytical solution. What happens for C = 1?

• Solve the problem again with C = 0.8 and a smaller wave number λ = 0.25 using (3) and (6).
• With C = 0.8, plot the dependence of the numerical error on ∆x ∈ h0.01, 0.05i for (4) and (7).
• For the scheme (5), plot the dependence of the numerical error on λ = {0.25, 0.5, 1}.
• Conclude your observations.

Discontinuous initial condition


Consider a step function (
0 for x < 0.5
T (x, t = 0) = (10)
1 for x ≥ 0.5
as an initial condition. Keep C = 0.8 and ∆x = 0.02 as before.

• Solve the problem with (3), (5), (7) and (6).


• Solve the problem with (8) with the following values of the Courant number: C = {0.5, 1, 1.5}.

Inst. of Fluid Mechanics and Heat Transfer 2 TU Wien

You might also like