Hyperbolic 2
Hyperbolic 2
Page 1
3 Hyperbolic PDEs
3.1 Introduction
Hyperbolic PDEs describe wave propagation problems, for example waves in water, gas, plas-
mas, traffic flow, etc. In a number of simple cases the wave moves along with unchanged
form
1 1
0.8 0.8
0.6 0.6
u(x)
0.4 0.4
0.2 0.2
0 0
0 2 4 6 8 10 0 2 4 6 8 10
t=t t=t +T
0 0
In this case the wave moves from left to right, with a certain wave speed, and the wave form is
not damped in time. The simplest hyperbolic equation exhibiting solutions of this sort is the
first order advection equation for u(x, t)
∂u ∂u
+a = 0, a const. (3.1)
∂t ∂x
with IC: u(x, 0) = F (x) (3.2)
This equation is particularly simple but it is of interest since it displays much of the phenomena
which is specific to hyperbolic PDEs. Hence it is a useful test for schemes for solving hyperbolic
PDEs (analogous to the study of y ′ = λy in the numerical study of ODEs). Furthermore (3.1)
is easily generalised to more complicated examples such as
Return to (3.1) and consider the pure initial value problem, i.e. assume (3.1) holds for all x.
Then the exact solution is
u(x, t) = F (x − at)
Exercise: check this!
For example with a pulse-like initial condition, if a > 0, we have something like the figure below
1.5
aT
1 t=0 t=T
u(x)
speed a
0.5
0
0 1 2 3 4 5 6 7 8 9 10
x
For example, if a > 0, from the initial condition u(x, 0) = F (x) and the left-hand boundary
condition u(0, t) = g(t) we have the exact solution
g(t − x/a), x < at)
u(x, t) =
F (x − at), x > at
The solution is constant along each characteristic line with slope dx/dt = a.
1
t
0.9
0.8
0.7
0.6
at
x=
u=g(t)
0.5
0.4
0.3
0.2
0.1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
u=F(x)
CSM421-NSPDE-SK
Page 3
We see that the wave direction (i.e. sign(a)) is important for the analytic solution of the
advection equation. We need to consider how this “feeds” into our numerical finite difference
schemes. In particular
• Is there a preferred direction in our numerical scheme, in particular is there better sta-
bility/convergence if we include some of the underlying “physics of the problem” in our
solution?
• In addition to stability we want our scheme to propagate the wave at approximately the
correct speed – how do we analyse this in the numerical scheme?
∆x
t
4
t
3
t2
t1
∆t
t0
x x x x x x x
0 1 2 3 4 J−1 J
We first consider a backwards difference approximation for ux , which will lead to a FTBS
scheme. We approximate ut + aux = 0 by
t t
t t
n+1 n+1
tn tn
x x x x x x
j−1 j j j+1
FTBS scheme, info “travels” to FTFS scheme, info “travels” to
right (like PDE with a > 0?). left (like PDE with a < 0?).
The figures suggest that the applicability of the schemes will depend on sign(a). We will try
to analyse this by studying the LTE and the stability of the schemes
so the main component of the LTE is the second term which shows the FTBS scheme is in
general 1st order accurate in time and space.
Note: ut + aux = 0 ⇒ utt = −auxt = −a(ut )x = a2 uxx
1 1 1
so ∆t utt − a∆x uxx = a[a∆t − ∆x]uxx
2 2 2
= 0 iff p = 1 (p = a∆t/∆x).
But if p = 1 then (3.3) is wjn+1 = wj−1 n
, which is exact (recall that the exact solution is
u(x, t) = φ(x − at) for some function φ). This is reflected in the LTE in that if p = 1, the LTE
= 0.
Exercise: We have shown that only the first order terms in the LTE vanish if p = 1 – show
that this happens for the higher order terms also.
Exercise: Show that (3.4) is also 1st order accurate, unless p = −1 (∆x = −a∆t ⇒ a < 0),
in which case it is exact.
Hence the LTE of both schemes → 0 as ∆x, ∆t → 0, so they are both consistent. The Lax
equivalence theorem, Consistency + Stability ⇔ Convergence, also holds in the hyperbolic case,
so we need to determine whether these schemes are stable to prove convergence.
Stability of (3.3)
t
n+1
t
n+1
a<0
∆t ∆t
a∆t |a|∆t
tn tn
x
x
j−1 ∆x x
j
x
j ∆x x
j+1
t a>0
tn+1
FTCS scheme
What happens if we use a central difference for ux ? We might expect that the central difference
will give higher order accuracy, but does the “prefered direction” in hyperbolic problems impose
greater restrictions? It is easily checked that the FTCS scheme gives
1
wjn+1 = wjn − p(wj+1
n n
− wj−1 ).
2
If we carry out a stability analysis in the usual way we get
1
ξ = 1 − p(eiω − e−iω ) = 1 − ip sin(ω).
2
Hence
|ξ|2 = 1 + p2 sin2 (ω)
> 1 for all ω 6= 0, ±π for any p 6= 0,
so the scheme is completely unstable, no matter what value of a and p are used - equally bad
for a > 0 and a < 0.
Summary
If a > 0 we can use the FTBS scheme (3.3) and if a < 0 we can use the FTFS scheme (3.4).
Both these schemes require |p| ≤ 1 for stability and are first order in space and time. They are
CSM421-NSPDE-SK
Page 7
called upwind schemes - information in the scheme flows in the same direction as that for the
PDE (a downwind scheme seeks information in the wrong direction).
Why do we get complex values for ξ in these problems? Return to our Fourier approach, and
assume we have a Fourier mode exp(iαx) as initial conditions at time t = 0. Then at time t
the wave will have travelled a distance x/a (we assume a > 0 here), so the solution is
u(xj , tn ) = unj = exp (iα(j∆x − an∆t)) = exp (−iαan∆t) exp (iαj∆x) = ξ n eiωj
where ω = α∆x and ξ = exp (−iαa∆t). Hence we should see a complex phase shift of
exp (−iαa∆t) in one time step. Ideally we want |ξ| = 1.
We can write ξ = |ξ|eiargξ = |ξ|eiφ say. For stability we require |ξ| ≤ 1, and to get the wave
travelling at the correct speed we require φ ≈ −αa∆t = −ωa∆t/∆x = −ωp, as ∆x, ∆t → 0.
Lets see how this works for the FTBS scheme (3.3). We have ξ = (1 − p + p cos ω) + i(−p sin ω).
So
−1 −p sin ω
φ = tan
1 − p + p cos ω
−1 p sin ω
= − tan
1 − p + p cos ω
1 2
≈ −pω 1 − (1 − p)(1 − 2p)ω + . . .
6
where we have used the expansions sin x = x − x3 /3! + . . . , cos x = 1 − x2 /2! + . . . , and
tan−1 x = x − x3 /3 + . . . .
Exercise: Check the details of this result.
Note in expanding for small ω, we are taking into account that large frequencies cannot be
represented accurately on the finite difference mesh.
The ratio between the exact value φ = −pω and the value given above is gives us the relative
phase error. More precisely, the relative phase error is obtained by subtracting the exact result
1 from the term multiplying −pω, so in the example above the relative phase error is
1
− (1 − p)(1 − 2p)ω 2 + . . . ,
6
and hence of order O(ω 2). When p = 1 or p = 21 the error disappears at this order, otherwise
the sign will depend on the size of p. When p = 1 we would expect the error to vanish since
the scheme is exact at this value of p.
CSM421-NSPDE-SK
Page 8
We now examine the result of applying the FTBS scheme (3.3) to two test problems, the
advection equation (3.1) with two different sets of initial conditions. Matlab programs for
these examples can be written.
(1) The first test problem (the upper plot in the figures) uses a Gaussian pulse as initial
condition:
u(x, 0) = exp −400(x − 0.15)2 .
The figures show the initial “spike” u(x, 0) on the left (solid line), and the exact solu-
tion u(x, t) of the PDE (3.1) when t = 0.5 (r.h.spike, solid line). The solution of the
approximation scheme at time t = 0.5 is shown as a dashed line.
(2) The second test problem (the lower plot in the figure) uses a step function as initial
condition:
1 for 0 ≤ x ≤ 0.15
u(x, 0) =
0 for 0.15 < x ≤ 1.
For this problem the figures show the exact solution u(x, t) of (3.1) when t = 0.5 as a
solid line, and the solution of the approximation scheme at time t = 0.5 as a dashed line.
Note: the closer the dashed and solid lines are together, the better the scheme is.
Numerical details: In all cases J = 100 and p = 0.8, so ∆x = 0.01 and ∆t = 0.008 (recall
that we are using a = 1).
1.2
0.8
u(x,t)
0.6
0.4
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
1.2
0.8
u(x,t)
0.6
0.4
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
CSM421-NSPDE-SK
Page 9
We see that the spike solution loses amplitude and spreads out, but its position looks accurate.
The step also smears out but appears to be in the correct position. An analysis of the LTE
explains the spreading. Using utt = a2 uxx we have
a
L∆ = ut + aux + (p − 1)∆x uxx +O(∆t2 , ∆x2 ),
| {z } 2
PDE | {z }
LTE leading term
Another way of looking at this is that we are using the scheme to model the equation
ut + aux − αuxx = 0,
where α = a2 (1 − p)dx. In this case the O(∆t2 , ∆x2 ) would be its local truncation error. The
extra term is a diffusion term and historically this is called artificial viscosity. A small amount
of artificial viscosity is usually necessary for a scheme, but too much smears the solution out.
Alternatively we see from the stability analysis that
wjn+1 − wjn−1 n
wj+1 n
− wj−1
+a =0
2∆t 2∆x
⇒ wjn+1 = wjn−1 − p(wj+1
n n
− wj−1 ), (3.5)
where p = a∆t/∆x as usual. This scheme is also explicit but involves three time levels and
so it needs two time levels to start. The IC gives w0 and we need to obtain w1 using another
scheme, such as the (unstable) FTCS scheme.
Exercise: Show that the LTE of the leapfrog scheme (3.5) is
1 2
LTE = ∆t uttt + a∆x2 uxxx + O(∆t4 , ∆x4 )
6
a
= (1 − p2 )uxxx ∆x2 + O(∆t4 , ∆x4 ), using uttt = −a3 uxxx ,
6
i.e. (3.5) is 2nd order accurate.
Now consider stability. Set wjn = ξ n eiωj as usual to get after some simplification
ξ 2 = 1 − pξ eiω − e−iω
or ξ 2 + 2ipξ sin ω − 1 = 0.
p
Wehneed |ξ± | ≤ 1i for stability. If |p| > 1 then when ω = π2 , we have ξ± = −ip ± i p2 − 1 =
p
−i p ∓ p2 − 1 and so one of the roots is > 1 in modulus, i.e. unstable if |p| > 1.
p
If |p| ≤ 1 then 1 − p2 sin2 ω is real for all ω and so
i.e. (3.5) is stable for all |p| ≤ 1 (−1 ≤ p ≤ 1) and it works equally well for a > 0 and a < 0.
There is no damping in this case since |ξ± |2 = 1. What about the phase error? There are two
roots in this case and we need to consider each in turn.
p sinω
1
π
2 2 1/2
(1−p sin ω)
φ φ
− +
ξ+ : φ+ = − sin−1 (p sin ω)
= − sin−1 (pω − pω 3/3! + . . . )
1
= −pω(1 − (1 − p2 )ω 2 + . . . )
6
(using sin−1 (x) = x + x3 /6 + . . . )
This part is similar to upwind schemes, although note now the phase error is always of one
sign. This seems fine, now consider the other root
ξ− : φ− = π + sin−1 (p sin ω)
1
= pω + π − pω 3(1 − p2 ) + . . .
6
This is a mode oscillating from time step to time step and travelling in the wrong direction, a
mode absent in the exact solution of the equation. Suppressing this mode is necessary, some
form of “filtering” will be required if this scheme is to be useful in practice.
CSM421-NSPDE-SK
Page 11
0.8
u(x,t)
0.6
0.4
0.2
The spike is handles pretty well by the scheme, but note some small amplitude oscillations to
the left of the pulse (the amplitude of these increases if ∆x, ∆t are made bigger).
1.2
0.8
u(x,t)
0.6
0.4
0.2
The step front is reproduced quite well (steeper than in the upwind case, which is good), but
there are large oscillations (bad). The step function excites all Fourier modes and stimulates
the backwards travelling wave. Since |ξ| = 1 in the scheme, there is no damping so spurious
oscillations persist for long periods. The leading term of the LTE is dispersive (uxxx ) and not
diffusive (uxx ). What we need is a scheme that has a little artificial viscosity (but not too
much) in order to damp out the oscillations. We would also like to have a 2nd order accurate
method. The Lax-Wendroff scheme has these properties.