You are on page 1of 26

Simplest hyperbolic PDE

Linear, scalar convection/advection equation (Initial value problem)


ut + aux =0 x ∈ R, t>0
(1)
u(x, 0) =f (x) x∈R
Exact solution
u(x, t) = f (x − at)
Initial condition is convected with speed a without change of form.
f (x)
u(x, t)

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

If the initial condition is discontinuous, then we can still talk of a solution,


even though the PDE is not satisfied everywhere. The MOC method is still
valid and gives the solution at any later time. The solution is again obtained
by translating the initial condition. The discontinuity propagates along the
characteristic curve.
Initial Condition f t
ul

u = ul u = ur
dx
ur dt
=a

x x

Such a discontinuity is called a contact discontinuity/wave. The


charactersitics on either side of the discontinuity curve are parallel to it.

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

• a > 0: FTBS scheme is stable in maximum norm if aλ ≤ 1, others are


unstable.
• a < 0: FTFS scheme is stable in maximum norm if |a|λ ≤ 1, others are
unstable.
• FTCS scheme is never stable in maximum norm.
• Upwind scheme: switch between backward and forward difference

ujn+1 − unj unj − unj−1 unj+1 − unj


+ a+ + a− =0
∆t h h
Stable in maximum norm for any a provided |a|λ ≤ 1 is satisfied.

Courant-Friedrichs-Levy (CFL) number, CFL condition


|a|∆t
CFL = |a|λ = , CFL ≤ 1, ∆t = O (h)
h

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

• Forward time, central space (FTCS)

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

• Leapfrog scheme (Three level scheme)

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

tn+1 xf − xj−1 = h − a∆t


∆t
tn xj − xf = a∆t
f

j−1 j j+1
x

• Linear interpolation between xj−1 and xj

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

Exact domain of dependance ⊂ Numerical domain of dependance

12 / 50
Consistency and accuracy
Local truncation error : e.g. FTCS scheme

u(xj , tn+1 ) − u(xj , tn ) u(xj+1 , tn ) − u(xj−1 , tn )


τjn = +a
∆t 2h
Truncation error
τ (∆t, h) = max |τjn |
j,n

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

Convergence in maximum norm


The scheme is convergent in the maximum norm if

lim max |u(xj , tn ) − unj | = 0


∆t,h→0 j,n

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

Definition: Stable scheme (finite time stability)


A numerical scheme is stable if for each time T , there exists a constant CT > 0
such that for each h > 0, there exists δ0 > 0 (possibly dependent on h) such
that for any 0 < ∆t < δ0 , we have

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.

Remark: An equivalent statement of the above condition is

kun k ≤ (1 + C∆t) un−1 ,



C≥0

where the constant C cannot depend on ∆t or h. Then

kun k ≤ (1 + C∆t)n u0 ≤ eCT u0


15 / 50
Stability

Strongly stable scheme


A numerical scheme is said to be strongly stable if

kun k ≤ un−1

i.e., if CT = 1.

Remark: For hyperbolic problems, one is often interested in solutions after a


long time (T  1). In such cases, it is desirable to have strong stability since
then the numerical solutions are guaranteed to be bounded for each value of T .

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 .

Proof: (1) Consider the upwind scheme with a > 0

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

and since aλ > 0 and (1 − aλ) > 0, we get


n+1 X X
n
u ≤h
1,h
(1 − aλ)|uj | + h aλ|unj−1 | = kun k1,h
j j

(2) For the Lax-Friedrichs scheme

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

(3) For the Lax-Wendroff scheme, the proof is analogous.


Remark: We have already shown the upwind and LF schemes to be stable in
maximum norm. The LW scheme is NOT bounded in maximum norm.
1 1
un+1
j = aλ(1 + aλ)unj−1 + (1 − a2 λ2 )unj + aλ(−1 + aλ)unj+1
2 2
However this does not mean that it is unstable in maximum norm.

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

Proof: (1) BTCS (implicit Euler scheme)


!
un+1
j − unj un+1 n+1
j+1 − uj−1
un+1
j +a =0
∆t 2h

which can re-arranged as

(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

(2) FTCS scheme


!
un+1
j − unj unj+1 − unj−1
unj +a =0
∆t 2h

which can be rearranged as

(ujn+1 )2 = (unj )2 + (un+1


j − unj )2 − aλ(unj+1 − unj−1 )unj

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

(un+1
j ) 2
= (un 2
j ) + (unj+1 − unj−1 )2 − aλ(unj+1 − unj−1 )unj
2

Summing up over all the equations


 2 X
n+1 2 2 aλ
u
2,h
= kun k2,h + h (unj+1 − unj−1 )2
2 j
 2 X
2 aλ
≤ kun k2,h + h 2 [(unj+1 )2 + (unj−1 )2 ]
2 j
2 2
= kun k2,h + a2 λ2 kun k2,h assume a2 λ2 ≤ ∆t
 2
2 h
≤ (1 + ∆t) kun k2,h if ∆t ≤
a

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

(B − A)B = (B − A)2 + (B − A)A


1 2
= [B − A2 + (B − A)2 ]
2
1
= [(B − A)2 + (B − A)(B + A)]
2
and
1 2
(B − A)A = [B − A2 − (B − A)2 ]
2
Remark: The above proofs were possible due to the algebraic structure of the
schemes. For other schemes, we may not be able to show stability in k·k2,h
using such algebraic techniques. In those cases, the Fourier or Von Neumann
stability analysis will be useful. However this approach is limited to linear
problems. Even for non-linear problems, Fourier stability is a necessary
condition; from a computational viewpoint, it keeps roundoff errors under
control.

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

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

Determine the coefficients αk by interpolation fj = f (xj ) = f˜(xj ), i.e.,


N
2−1
X
fj = αk eikjh , j = 0, 1, . . . , N − 1
k=− N
2

We ignore fN since fN = f0 by periodicity.


23 / 50
Discrete Fourier transform
To determine αk , multiply by e−iljh and sum
N N
N −1 N −1 −1
2 2−1 N −1
X X X X X
−iljh ikjh −iljh
fj e = αk e e = αk ei(k−l)jh
j=0 j=0 k=− N k=− N j=0
2 2

We can show that


N −1
X 2π N N
ei(k−l)jh = δkl , − ≤ k, l ≤ −1
j=0
h 2 2

which gives the Fourier coefficient


N −1
h X
αl = fj e−iljh
2π j=0

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

Summing up over all the grid points


N N
N −1 2−1 N −1 2 −1
X X X 2π X
fj2 = αk∗ fj e −ikjh
= αk∗ αk
j=0 j=0
h
k=− N
2
N
k=− 2

which gives the discrete Parseval relation


N
N −1 −1
2
2
X X
2
kf k2,h =h |fj | = 2π |αk |2
j=0 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

where γk ∈ C is called the amplification coefficient of the k-th frequency (or


harmonic). If |γk | > 1 then the numerical solution is likely to blow up with
time.
FTCS scheme: Consider first time step

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

You might also like