Professional Documents
Culture Documents
at
Hence the extrema of the solution do not change with time. Also the L2 -norm
of the solution does not change with time. If E(t) is the solution operator
u(x, t) = E(t)f (x) =⇒ kE(t)uk = kuk
in both sup-norm and L2 -norm.
2 / 50
Method of characteristics
Backward characteristic through (x, t)
How does the solution vary along the
hits initial time t = 0 at
space-time curve x = x(t) with
d x0 = x − at
x(t) = a
dt t (x, t)
Variation of u along this curve
d
u(x(t), t)
dt
dx
∂u d ∂u dt
=a
= (x(t), t) + x(t) · (x(t), t)
∂t dt ∂x
= ut + aux
= 0
x0 x
Solution is constant along the
characteristic curve. u(x, t) = u(x0 , 0) = f (x − at)
3 / 50
Discontinuous solutions
u = ul u = ur
dx
ur dt
=a
x x
4 / 50
Finite difference scheme
Forward time, backward space (FTBS)
un+1
j − unj unj − unj−1
+a =0 ⇒ un+1
j = (1 − aλ)unj + aλunj−1
∆t h
Forward time, central space (FTCS)
un+1
j − unj unj+1 − unj−1 aλ n
+a =0 ⇒ un+1 = unj + (u − unj+1 )
∆t 2h j
2 j−1
Forward time, forward space (FTFS)
un+1
j − unj unj+1 − unj
+a =0 ⇒ un+1
j = (1 + aλ)unj − aλunj+1
∆t h
∆t
λ=
h
5 / 50
Maximum principle
6 / 50
Numerical example
• PDE
ut + aux = 0, x ∈ (0, 1)
• with initial condition
u(x, 0) = sin(2πx)
• and periodic boundary conditions.
• Use a = 1. Try backward and forward difference scheme with CFL=0.5.
The scheme is implemented in the matlab program
lin hyp 1d periodic.m
• Backward difference: lin hyp 1d periodic(100, 0.5, ’bd’)
• Forward difference: lin hyp 1d periodic(100, 0.5, ’fd’)
7 / 50
Lax-Friedrichs (LF) scheme
un+1
j − unj unj+1 − unj−1
+a =0
∆t 2h
is not stable in maximum norm. We can modify it in following way.
• LF scheme
un+1
j − 12 (unj−1 + unj+1 ) unj+1 − unj−1
+a =0
∆t 2h
⇓
1 1
un+1
j = (1 + aλ)unj−1 + (1 − aλ)unj+1
2 2
Stable in maximum norm if |a|λ ≤ 1.
8 / 50
Lax-Wendroff (LW) scheme
Taylor’s formula
1
u(xj , tn+1 ) = u(xj , tn ) + ∆tut (xj , tn ) + ∆t2 utt (xj , tn ) + O ∆t3
2
Use the PDE
ut = −aux utt = a2 uxx
to get
1
u(xj , tn+1 ) = u(xj , tn ) − a∆tux (xj , tn ) + a2 ∆t2 uxx (xj , tn ) + O ∆t3
2
Approximate ux and uxx by central differences
unj+1 − unj−1 1 unj−1 − 2unj + unj+1
un+1 = unj − a∆t + a2 ∆t2 + O ∆t3
j
2h 2 h2
LW scheme
1 1
un+1
j = unj − aλ(unj+1 − unj−1 ) + a2 λ2 (unj−1 − 2unj + unj+1 )
2 2
This scheme is not bounded in maximum norm but is stable in L2 norm.
9 / 50
More schemes
un+1
j − un−1
j unj+1 − unj−1
+a =0
2∆t 2h
Not self-starting, need different scheme for first time step.
• Backward time, central space, BTCS (Backward Euler implicit scheme)
un+1
j − unj un+1 n+1
j+1 − uj−1
+a =0
∆t 2h
10 / 50
Schemes via method of characteristics, CFL condition
Exact solution is
u(xj , tn+1 ) = u(xf , tn )
Assume a > 0 and aλ ≤ 1, i.e., a∆t ≤ ∆x
t h
j−1 j j+1
x
xj − xf xf − xj−1
un+1
j = uj−1 + uj =⇒ un+1
j = aλunj−1 + (1 − aλ)unj
h h
which is the FTBS (upwind) scheme.
11 / 50
Schemes via method of characteristics, CFL condition
• Quadratic interpolation between xj−1 , xj , xj+1 leads to the Lax-Wendroff
scheme. Valid procedure for a > 0 and a < 0.
If aλ > 1, then foot of backward characteristic xf intersects t = tn outside the
interval (xj−1 , xj+1 ).
t h
tn+1
∆t
tn
f
j−1 j j+1
x
Interpolation using the values uj−1 , uj , uj+1 would be wrong in this case. CFL
condition ensures correct domain of dependance
12 / 50
Consistency and accuracy
Local truncation error : e.g. FTCS scheme
Consistency
The numerical scheme is consistent if
τ (∆t, h) → 0 as ∆t, h → 0
Accuracy
The numerical scheme is accurate of order p in time and to the order q in
space, if for a sufficiently regular solution of the exact problem, we have
τ (∆t, h) = O (∆tp + hq )
13 / 50
Consistency and accuracy
Scheme τ (∆t, h)
FTCS O ∆t + h2
Upwind O (∆t
+ h)
h2
Lax-Friedrichs O ∆t + ∆t + h2
Lax-Wendroff O ∆t + h2 + h2 ∆t
2
Remark: We will also consider weaker norms such as k·k1,h and k·k2,h
1
X X
kuk1,h = h |uj |, kuk2,h = (h |uj |2 ) 2
j j
14 / 50
Stability
kun k ≤ CT
u0
for each n such that n∆t ≤ T , and for each initial condition u0 . The constant
CT cannot depend on h.
15 / 50
Stability
kun k ≤
un−1
i.e., if CT = 1.
16 / 50
Stability in k·k1,h (Upwind, LF and LW schemes)
If the CFL condition |a|λ ≤ 1 is satisfied, then the upwind, Lax-Friedrichs and
Lax-Wendroff schemes are strongly stable in the norm k·k1,h .
un+1
j = (1 − aλ)unj + aλunj−1
Then
n+1
X X
u
≤h
1,h
|(1 − aλ)unj | + h |aλunj−1 |
j j
1 1
un+1
j = (1 + aλ)unj−1 + (1 − aλ)unj+1
2 2
17 / 50
with (1 ± aλ) ≥ 0 due to CFL condition, so that
n+1
1 X 1 X
u
1,h
≤ h |(1 + aλ)unj−1 | + h |(1 − aλ)unj+1 |
2 j 2 j
1 X 1 X
= h (1 + aλ)|unj−1 | + h (1 − aλ)|unj+1 |
2 j 2 j
= kun k1,h
18 / 50
Stability in k·k2,h (BTCS, FTCS)
(1) The BTCS scheme is strongly stable in the norm k·k2,h with no restriction
on ∆t. (2) The FTCS is never strongly stable. However, it is stable with
constant CT = eT /2 provided we assume that ∆t satisfies the following
condition (which is more restrictive than the CFL condition)
2
h
∆t ≤
a
(un+1
j )2 + (un+1
j − unj )2 = (unj )2 − aλ(un+1 n+1 n+1
j+1 − uj−1 )uj
19 / 50
Summing up over all the cells, the last term vanishes (telescopic collapse) to
yield
n+1
2 X
u
= kun k2 − h (un+1
2
− unj )2 ≤ kun k2,h
2,h 2,h j
j
so that
n+1
2 X
u
= kun k2 + h (un+1
2
− unj )2 ≥ kun k2,h
2,h 2,h j
j
and the FTCS scheme is not strongly stable. However if we write the scheme
aλ n
un+1 − unj = − (u − unj−1 )
j
2 j+1
20 / 50
and use it in above equation, we get
2
aλ
(un+1
j ) 2
= (un 2
j ) + (unj+1 − unj−1 )2 − aλ(unj+1 − unj−1 )unj
2
This yields
2
2
2
kun k2,h ≤ (1 + ∆t)n
u0
2,h ≤ eT
u0
2,h ∀n s.t. n∆t ≤ T
which shows stability of FTCS scheme since kun k2,h ≤ eT /2
u0
2,h .
21 / 50
Remark: The proof in the last theorem requires the following algebraic
identities: for any A, B ∈ R
22 / 50
Discrete Fourier transform
Periodic initial condition
f : [0, 2π] → R
Let N be an even integer. Consider a grid of N + 1 points with grid point
coordinates
2π
xj = jh, j = 0, 1, . . . , N with h=
N
We can approximate f (x) on the grid by the discrete Fourier series
N
−1
2
f˜(x) =
X
αk eikx
k=− N
2
24 / 50
Parseval relation
We want to relate l2 norm of a grid function with the l2 norm of its Fourier
coefficients.
N
2 −1
X
∗
2
fj = fj fj = αk∗ e−ikjh fj
k=− N
2
25 / 50
Von Neumann stability analysis
Let us approximate the initial condition by the discrete Fourier series and
apply any of the numerical schemes studied till now to this approximate initial
condition. Then the solution at any time tn can be written as
N
2−1
X
unj = αk (γk )n eikjh
k=− N
2
aλ 0
u1j = u0j + (u − u0j+1 )
2 j−1
N
2 −1
X 1
= αk eikjh 1 + aλ(e−ikh − eikh )
2
k=− N
2 | {z }
γk
26 / 50
Von Neumann stability analysis
But
1
γk = 1 − iaλ sin(kh), |γk | = [1 + a2 λ2 sin2 (kh)] 2 ≥ 1
and hence the FTCS scheme is not strongly unstable.
Scheme γk
FTCS 1 − iaλ sin(kh)
BTCS (imp. Euler) [1 + iaλ sin(kh)]−1
Upwind 1 − |a|λ(1 − e−ikh )
Lax-Friedrichs cos(kh) − iaλ sin(kh)
Lax-Wendroff 1 − iaλ sin(kh) − a2 λ2 [1 − cos(kh)]
27 / 50