Anda di halaman 1dari 8

# Mat1062: Computational Methods for PDE

Mary Pugh
February 26, 2008
1 Modied equations
The modied equation or eective equation is a way to understand qualita-
tively the eect of discretization errors on the behaviour of the solution. The
idea is that we look at the leading-order truncation errors, write them in
terms of derivatives of the solution, and then write the PDE that the scheme
more closely approximates than the original one. This modied equation will
have coecients containing factors of h or h
2
, so as the mesh is rened they
go to zero. But for any nite h, the extra terms give us insight into the
behavior of the discrete solutions.
As an example, lets consider the explicit upwind scheme. We already
know that if u(x, t) is the solution of u
t
+ au
x
= 0 and u
n
j
= u(x
j
, t
n
) then
the truncation error

n
j
= u
n+1
j
u
n
j
+ (u
n
j
u
n
j1
)
satises

n
j
k [u
t
(x
j
, t
n
) + au
x
(x
j
, t
n
)]

= O(k
2
, hk).
On the other hand, if v(x, t) is the solution of v
t
+av
x
+k/2 v
tt
ah/2 v
xx
= 0
and v
n
j
= v(x
j
, t
n
) then the truncation error

n
j
= v
n+1
j
v
n
j
+ (v
n
j
v
n
j1
)
satises

n
j
k
_
v
t
(x
j
, t
n
) + av
x
(x
j
, t
n
) +
k
2
v
tt
(x
j
, t
n
)
ah
2
v
xx
(x
j
, t
n
)
_

= O(k
3
, h
2
k).
This means that the discrete solution generated by explicit upwinding is
actually closer to the solution of v
t
+av
x
+k/2 v
tt
ah/2 v
xx
= 0 than it is
1
2 Mary Pugh Mat1062 Feb. 26, 2008
to the solution of u
t
+ au
x
= 0. And so to understand the properties of the
discrete solution we would be better o studying properties of the solution
of the v equation. In fact, were going to nd an even better equation to
study. The v equation is
v
t
= av
x

k
2
v
tt
+
ah
2
v
xx
(1)
This means that v
t
= av
x
+O(h, k) and hence v
tt
= a
2
v
xx
+O(h, k). As a
result, if we replace the v
tt
in equation (1) with a
2
v
xx
we will get an equation
which is close to to it. And so we introduce
w
t
+ aw
x
=
k
2
a
2
w
xx
+
ah
2
w
xx
=
ah
2
_
1
ak
h
_
w
xx
(2)
If w(x, t) is the solution of (2) and w
n
j
= w(x
j
, t
n
) then the truncation error

n
j
= w
n+1
j
w
n
j
+ (w
n
j
w
n
j1
)
satises

n
j
k
_
w
t
(x
j
, t
n
) + wv
x
(x
j
, t
n
)
ah
2
_
1
ak
h
_
w
xx
(x
j
, t
n
)
_

= O(k
3
, h
2
k).
In this way, we nd that the discrete solution generated by explicit up-
winding is closer to the solution of equation (2) than to the solution of
u
t
+ au
x
= 0: see Figure 1. We call equation (2) the modied equation for
the explicit upwinding scheme.
In a similar manner, we nd that the modied equation for the Lax-
Friedrichs scheme is
u
t
+ au
x
=
h
2
2k
_
1
_
ak
h
_
2
_
u
xx
, (3)
the modied equation for the Lax-Wendro scheme is
u
t
+ au
x
=
h
2
a
6
_
a
2
k
2
h
2
1
_
u
xxx
, (4)
and the modied equation for the Beam-Warming scheme is
u
t
+ au
x
=
h
2
a
6
_
ak
h
1
__
ak
h
2
_
u
xxx
(5)
Mat1062 Feb. 26, 2008 Mary Pugh 3
0 1 2 3 4 5 6
0
0.2
0.4
0.6
0.8
1
0 1 2 3 4 5 6
0.5
0.4
0.3
0.2
0.1
0
0.1
0.2
0.3
0.4
0.5
Figure 1: The parameters are as in Figures 1 and 2 of the February 14 notes.
Left: The solution of the explicit upwind scheme is shown with a solid line.
The exact solution of u
t
+ au
x
= 0 is shown with a dashed line. The
exact solution of the modied equation (2) for the explicit upwind scheme is
shown with (barely visible) open circles. Right: the discrete solution minus
the exact travelling wave solution is shown with a solid line. The discrete
solution minus the exact solution of the modied equation is shown with a
dashed line. Note that the discrete solution is much closer to the solution
of the modied equation.
1.1 First-order schemes and diusion
Both the explicit upwind scheme and the Lax-Friedrichs scheme have mod-
ied equations that are advection diusion equations:
u
t
+ au
x
= Du
xx
.
One can explicitly solve this equation by going into moving coordinates
v(y, t) = u(x+at, t) and then solving the resulting heat equation v
t
= Dv
yy
.
For example, for initial data
u
0
(x) =
_
1 for x < 0
0 otherwise
= u(x, t) = 1 erf
_
x at

4Dt
_
(6)
where
erf(x) =
1

_
x

e
t
2
dt.
This is a dierent error function than whats built in to matlab and maple.
I chose this one for analytical convenience: it tends to zero as x tends to
4 Mary Pugh Mat1062 Feb. 26, 2008
and it tends to one as x tends to +. The error function built in to
maple and matlab has limit 1 at x = and +1 at x = +.
The diusion constants depend on h and k:
D
EU
= h
a
2
_
1
ak
h
_
= h
a
2
(1 ) (explicit upwind) (7)
D
LF
=
h
2
2k
_
1
_
ak
h
_
2
_
= h
a
2
_
1
2
_
(Lax-Friedrichs) (8)
If one is considering the usual renement path in which one chooses a
xed value of within the stability region and then renes h and k so that
remains unchanged then one sees that as h 0 both diusion coecients
D
EU
and D
LF
tend to zero. In this way, we see that for a xed value of h
and k the modied equation is a smoothed version of u
t
+ au
x
= 0 and as
h 0 this smoothing vanishes.
Those of you who have some familiarity with PDE see how this could
lead to an existence result: 1) prove existence for the regularized equation
and understand the properties of its (unique) solution and 2) take the reg-
ularization to zero and use a compactness argument to prove that theres a
sequence of solutions of the regularized equation that converge to a solution
of the hyperbolic equation. Of course, this is all irrelevant in this particular
case because the hyperbolic equation in question u
t
+ au
x
= 0 not only has
explicit solutions but theyre unique. However, in general proving existence
and/or uniqueness for hyperbolic problems is much Much MUCH harder
than for parabolic or elliptic problems. The very rst proof for a fairly
simple nonlinear hyperbolic problem was actually done by proving that a
particular numerical method converged. (Glimm, Communications in Pure
and Applied Mathematics 18(1965)697-715.)
Finally, note that for 1 < < 1
D
EU
+
h
2
2k
(1 ) = D
LF
= D
EU
< D
LF
.
Thus the diusivity is greater in the modied equation for Lax-Friedrichs
than for the modied equation for the explicit upwinding scheme. This
explains what you observed in Figure 1 of the February 14 notes: the shock
was smoothed out more by the Lax-Friedrichs scheme than by the explicit
upwind scheme.
Mat1062 Feb. 26, 2008 Mary Pugh 5
1.2 Convergence rate for the explicit upwind and Lax-Friedrichs
schemes
Here I will try to make a suggestive argument as to why the convergence
rate for the shock wave solution is O(

## k). If we have the discrete solution

computed up to a xed time T and the exact solution u
0
(x aT), we want
to see that the L
1
norm of their dierence goes to zero as h and k go to zero
along a xed renement path ( xed).
We know that the explicit upwind scheme and the Lax-Friedrichs scheme
result in discrete solutions which are very close to the solution (6) of the
t
+ au
x
= Du
xx
. And so rather than trying
to control the L
1
norm of the discrete solution minus the travelling wave
solution of u
t
+ au
x
= 0, Ill try to control the L
1
norm of the solution (6)
minus the travelling wave solution. In short, I want to understand
||u(, T) v(, T)||
L
1
(R)
=
_

## |u(x, T) v(x, T)| dx

where
u(x, T) = 1 erf
_
x aT

4DT
_
, v(x, T) =
_
1 if x aT < 0
0 otherwise
The L
1
norm is translation invariant and both proles are moving with the
same speed a, I can go into a moving frame and take
u(x, T) = 1 erf
_
x

4DT
_
, v(x, T) =
_
1 if x < 0
0 otherwise
Next, write u(x, T) as u(x, T) = 1/2 + u(x, T) and v(x, T) = 1/2 + u(x, T)
where u and v are odd about x = 0. Hence, |u(x, T) v(x, T)| = | u(x, T)
v(x, T)| is an even function and so it suces to nd
2
_
0

## | u(x, T) v(x, T)| dx = 2

_
0

erf
_
x

4DT
_
dx = C

DT
where C is a constant that depends on the error function.
We are now ready to look for the convergence rate. We have just shown
that the L
1
norm of the error is a constant times

## D. For both the explicit

upwind scheme and the Lax-Friedrichs scheme, the diusion constant (78)
is h times a constant as long as you have taken a constant- renement
path. As a result, the L
1
norm of the error decreases like

h (or like

k
because is xed.)
6 Mary Pugh Mat1062 Feb. 26, 2008
1.3 Second-order schemes and dispersion
We now turn to the Law-Wendro and Beam-Warming schemes. Both have
modied equations of the form:
u
t
+ au
x
= Du
xxx
where
D
LW
=
h
2
a
6
_

2
1
_
(Lax-Wendro) (9)
D
BW
=
h
2
a
6
( 1) ( 2) (Beam-Warming) (10)
The equation u
t
+au
x
= Du
xxx
t
+au
x
= 0 with
dispersive smoothing. As with the rst-order schemes, we see immediately
that if one chooses the usual renement path of xed then as h 0 the
dispersive smoothing gets smaller and smaller. Again, one could use this as
a method to construct solutions of the underlying hyperbolic problem.
We nd solutions of u
t
+au
x
= Du
xxx
via Fourier methods. Specically,
we take u(x, t) of the form
u(x, t) =
_

u(, t)e
ix
d.
To nd u(, t) we look at a single frequency in isolation and seek c() such
that
e
i(xc()t)
solves u
t
+ au
x
= Du
xxx
. This results in
c() = a + D
3
.
And so we see that this particular oscillating wave moves with speed a+D
2
:
u(x, t) = e
i(x(a+D
2
)t)
is a travelling wave solution of u
t
+ au
x
= Du
xxx
. Because the speed de-
pends on , dierent frequencies travel with dierent speeds: the equation
is dispersive. And so the solution of the initial value problem is
u(x, t) =
_

u
0
()e
i(x(a+D
3
)t)
d where u
0
(x) =
_

u
0
()e
ix
d.
Mat1062 Feb. 26, 2008 Mary Pugh 7
Because the equation is dispersive, each frequency travels with dier-
ent speed and the only travelling wave solutions must be made of a single
frequency. Any other type of initial data will lose its shape as the dier-
ent frequencies that make it up travel at dierent speeds. For dispersive
equations, one considers the group velocity
c
g
() = c

() = a + 3D
2
.
For Lax-Wendro, if (1, 1) the dispersive coecient D
LW
< 0 and so
c
g
() < a. That is, the group velocity is smaller than the advection speed a.
This is why the ripples in Figure 2 of the February 14 notes occur behind the
shock. On the other hand, for Beam-Warming if (0, 1) then D
BW
> 0
and so c
g
() > a. This is why the ripples occur ahead of the shock in Figure
2.
2 Phase error
Another way to understand the error in the discrete computation is to con-
sider solutions of the form u(x, t) = U(t) exp(ix), for R. The true
solution has U(t) = exp(iat), so that u(x, t) = exp(i(x at)). To relate
these waves to the solutions of the discrete formula, we identify x
j
= jh and
t
n
= nk, and then see that in terms of the discrete dispersion relation ()
= e
ih
, = e
ik
so

j
= e
ink
e
ijh
= e
i(x
j
tn)
= e
i

x
j

Re

tn

e
Im tn
The scheme would be perfect if = a:
=
a

=
n

j
= e
i(x
j
atn)
If has an imaginary part then this will cause growth or decay of the Fourier
modes due to the discretization. For a stable scheme we will always have
|| 1 so Im 0. If Re > a (for > 0) then the mode with wavenum-
ber is traveling too quickly and if Re < a then the mode is traveling
too slowly.
For the explicit upwind scheme we know from the von Neumann sta-
bility analysis
= 1 (1 ) = 1 (1 e
ih
)
8 Mary Pugh Mat1062 Feb. 26, 2008
and so
=
i
k
ln() = = a i
a
2
h( 1)
2
+O(h
2
) = a iD
EU

2
+O(h
2
)
where the diusion constant D
EU
is from the modied equation (2). And so,
the O(h) term is precisely the D
2
that we would expect for a diusion.
For the Lax-Friedrichs scheme,
= cos(h) isin(h)
hence
= a i
h
2
2k
(1
2
)
2
+O(h
2
) = a iD
LF

2
+O(h
2
).
Again, we see the diusive eect.
For the Lax-Wendro scheme,
= 1
2
+
2
cos(h) isin(h)
hence
= a + h
2
a
6
_

2
1
_

3
+O(h
3
) = a + D
LW

3
+O(h
3
).
Bearing in mind that we take ||
2
1 in order to ensure stability, we see that
modes with = 0 travel slightly too slowly, by an amount that is second-
order in h, but are not damped (Im = 0). The errors are dispersive.
In practice, this can be even worse than dissipation since the maximum
principle is not maintained. Note that the errors depend on the product h,
the wavelength relative to the grid size, and is exactly zero if a = 0 or = 1.
Finally, for the Beam-Warming scheme,
= 1 +

2
_

2
+ 4 3
_
+

2
2
_

2
2 + 1
_
hence
= a +
a
6
h
2
( 1)( 2)
3
+O(h
3
) = a + D
BW

3
+O(h
3
).
Bearing in mind that we take 0 2 in order to ensure stability, we
see that for 0 < 1 modes with = 0 travel slightly too quickly by an
amount which is second-order in h. And if 1 < < 2 then modes travel
slightly too slowly.
In this way we see that phase analysis produces a number of the quali-
tative observations we made based on the modied equations.