Lecture 1
Wednesday, March 30, 2005
1 Introduction
This course is concerned with the numerical solution of partial differential
equations. The focus is on hyperbolic PDE. We will also discuss basic meth-
ods for numerically solving parabolic and elliptic equations as they relate
to hyperbolic problems. Our approach follows the historical development of
the numerical methods. Specifically, we will study the numerical solution of
equations of types
1. hyperbolic
2. parabolic
3. elliptic
through looking at, respectively, the problems of
A. compressible flow
B. heat flow
C. incompressible flow
2 Convection
Reference: Osher and Fedkiw, Section 3.1
There are two different approaches we can take in describing fluid motion.
1. In the Lagrangian formulation, we follow the motion of individual
particles as they are advected with the flow. Assuming that a velocity
1
~ (~x) = hu, v, wi is known for every point ~x we can compute the particle
V
motion by solving the ordinary differential equation (ODE)
d~x ~ (~x)
=V (1)
dt
This approach is simple, and the equation is easy to solve numerically,
but it is hard to apply it to nonlinear phenomena such as shock waves.
2. In the Eulerian formulation we use the simple convection (or advec-
tion) equation
~ · ∇φ = 0
φt + V (2)
where the t subscript denotes a temporal partial derivative in the time
variable t. Recall that ∇ is the gradient operator so that V ~ · ∇φ =
uφx + vφy + wφz . This approach can be regarded as sitting still at a
point ~x and observing the changes in various quantities at that point
due to the flow.
3 Upwind Differencing
Reference: Osher and Fedkiw, Section 3.2
3.1 Notation
In the notes that follow we will always indicate the time step in the super-
script, and the spatial indices in the subscripts.
At some point in time, say time tn , let φn = φ(tn ) represent the current
values of φ. Updating φ in time consists of finding new values of φ at every
grid point after some time increment 4t. We denote these new values of φ
by φn+1 = φ(tn+1 ) where tn+1 = tn + 4t.
3.2 Temporal Discretization
We look at some possible discretizations for the time derivatives in the above
convection equation. The equations below are called semi-discrete because
we have discretized only the time derivatives.
• forward Euler
φn+1 − φn ~ n
+ V · ∇φn = 0 (3)
4t
2
• backward Euler
φn+1 − φn ~ n+1
+V · ∇φn+1 = 0 (4)
4t
The forward Euler and backward Euler are both first order accurate, mean-
ing that the error in the discretization is O(4t).
3.3 Spatial Discretization
We begin by writing equation 3 in expanded form as
φn+1 − φn
+ un φnx + v n φny + wn φnz = 0 (5)
4t
and address the evaluation of the un φnx term first. The techniques used to
approximate this term can then be applied independently to the v n φny and
wn φnz terms in a dimension by dimension manner.
For simplicity, consider the one dimensional version of equation 5
φn+1 − φn
+ un φnx = 0 (6)
4t
where the sign of un indicates whether the values of φ are moving to the
right or to the left. Since un can be spatially varying, we focus on a specific
grid point xi where we write
φin+1 − φni
+ uni (φx )ni = 0 (7)
4t
We use the forward Euler discretization in time. This means that we can
solve the equations for each grid point independently, and we will not have
to solve a linear system at each time step as in the case of backward Euler.
We first introduce the difference operators Do , D+ and D− .
• Do , central difference operator (second-order accurate)
φi+1 − φi−1
(Do φ)i = (8)
24x
• D+ , forward difference operator (first-order accurate)
φi+1 − φi
(D+ φ)i = (9)
4x
3
• D− , backward difference operator (first-order accurate)
φi − φi−1
(D− φ)i = (10)
4x
For the hyperbolic equations, the data is propagated in specific directions
(along the characteristic curves). Therefore central differencing, which uses
information from both directions, is not very useful for numerically solving
hyperbolic problems. Instead we prefer to use upwinding. In upwinding
the idea is to choose the spatial discretization based on the direction that
information is propagating. For the one-dimensional case,
if ui > 0, we use D− φ
if ui < 0, we use D+ φ
if ui = 0, then ui φx = 0, so we do not need to approximate φx
Upwinding is first-order accurate. If we instead choose the difference op-
erators so that data is taken from the direction opposite the one from which
it is propagating, then we are using downwinding which is unstable.
The numerical errors resulting from upwind differencing cause dissipation
in the numerical solution. The numerical errors resulting from central differ-
encing cause dispersion in the numerical solution (see Strikwerda, Chapter
5).
In any numerical method for solving PDE, we must be concerned with
convergence. The means that as we refine our grid in time and space, the
numerical solution converges to the analytical solution. To this end we
examine the notions of consistency and stability. For precise definitions of
convergence, consistency, and stability, see Strikwerda, Chapter 1.
1. Consistency
The errors in approximating the differential operator vanish as 4t,
4x → 0. This is typically proved by assuming a sufficiently smooth
solution and using Taylor series expansion.
2. Stability
The solution does not blow up in a finite time. Stability may be uncon-
ditional or conditional. In conditional stability, we have restrictions
on the value of 4t so that it be sufficiently small.
For example, it can be shown that discretizing the scalar, linear, constant
coefficient convection equation above using central differencing in space and
forward Euler in time is consistent, but unstable.
4
According to the Lax-Richtmyer Equivalence Theorem a finite difference
approximation to a linear partial differential equation is convergent if and
only if it is both consistent and stable.
A necessary condition for stability is the Courant-Friedreichs-Lewy con-
dition (CFL condition) which asserts that the numerical waves should prop-
agate at least as fast as the physical waves. This means that the numerical
wave speed of 4x/4t must be at least as fast as the physical wave speed
|u|, i.e. 4x/4t > |u|. This leads us to the CFL time step restriction of
4x
4t < (11)
max{|u|}
where max{|u|} is chosen to be the largest value of |u| over the entire Carte-
sian grid. Equation 11 is usually enforced by choosing a CFL number α
with
max{|u|}
4t =α (12)
4x
and 0 < α < 1. A common near optimal choice is α = .9, and a common
conservative choice is α = .5. A multidimensional CFL condition can be
written as
|u| |v| |w|
4t max + + =α (13)
4x 4y 4z
although
~ |}
!
max{|V
4t =α (14)
min{4x, 4y, 4z}
is also quite popular.
Instead of upwinding, the spatial derivatives in equation 2 could be ap-
proximated with the more accurate central differencing. Unfortunately, sim-
ple central differencing is unstable with forward Euler time discretization
and the usual CFL conditions with 4t ∼ 4x. We look at three possible
ways of achieving stability while using central differencing.
1. Stability can be achieved by using a much more restrictive CFL con-
dition with 4t ∼ (4x)2 although this is too computationally costly.
2. Stability can also be achieved by using a different temporal discretiza-
tion, e.g. the third order accurate Runge-Kutta method (discussed
below).
5
3. A third way of achieving stability consists of adding some artificial
dissipation to the right hand side of equation 2 to obtain
~ · ∇φ = µ4φ
φt + V (15)
where the viscosity coefficient µ is chosen proportional to 4x, i.e.
µ ∼ 4x, so that the artifical viscosity vanishes as 4x → 0 enforcing
consistency for this method.
While all three of these approaches stabilize central differencing, we instead
prefer to use upwind methods which draw on the highly sucessful technology
developed for the numerical solution of conservation laws.