Professional Documents
Culture Documents
Examples 4
Examples 4
Examples 4
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
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?
• 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.