You are on page 1of 43

Numerical Methods for Partial

Differential Equations
CAAM 452
Spring 2005
Lecture 8

Instructor: Tim Warburton
CAAM 452 Spring 2005
Recall: Convergence Conditions for
LMM Time-stepping Methods
i. Establish that a unique solution to the ODE exists via Picards
theorem (http://mathworld.wolfram.com/PicardsExistenceTheorem.html)
ii. For time stepping Dahlquists Equivalence Theorem tells us that
a linear multistep time-stepping formula is convergent if and
only if it is consistent and stable
iii. We can easily verify consistency by using Taylor expansions for
the local truncation error.
iv. We check stability conditions by finding roots of the stability
polynomial.
v. A global error analysis tells us that if the right hand side function
is sufficiently smooth (p times continuously differentiable), and
the LMM is stable with local truncation error then the
error at a fixed time converges as

( )
p
O dt
( )
1 p
O dt
+
CAAM 452 Spring 2005
Consistency of Finite Difference Operator
Definition:

A finite difference operator is consistent if it converges
towards the continuous operator of the PDE as both
dt0 and dx0

CAAM 452 Spring 2005
Example:
Euler-Forward + Right Difference
The finite difference method is:

We define the local truncation error as the operator which
maps the actual solution of the PDE to the correction
required to make it satisfy the scheme at each time step:
1 n n
n
m m
m
u u
c u
dt
o
+
+

=
( ) ( )
( )
( )
( )
( )
( )
( ) ( )
1
2 2
*
2
2 2
*
2
, ,
,
1
, ,
2!
, ,
2!
n m n m n
m m n
m n m n
m n m n
u x t u x t
T u c u x t
dt
u dt u
dt x t x t
dt t t
c u dx u
dx x t x t
dx x x
O dt O dx
o
+
+

=
c c
= +
`
c c
)
c c
+
`
c c
)
= +
CAAM 452 Spring 2005
Quick Note
Notice that in the definition of the LTE for the finite
difference scheme we have not multiplied through
by dt (since that would bias the LTE with respect to
dt)



In this example the scheme is said to be first order
method accurate in both time and space.
( ) ( )
( )
( ) ( )
1
, ,
,
n m n m n
m m n
u x t u x t
T u c u x t
dt
O dt O dx
o
+
+

=
= +
CAAM 452 Spring 2005
Second Example
(Leap Frog in Time and 4
th
Order Central in Space)
Here we use the fourth order central differencing in
space and Leap Frog in time:


The truncation error in this case is:





Thus we declare the method accuracy to be 2
nd

order in time and 4
th
order in space.
1 1 2
4 0
1
2 6
n n
n n
m m
m m
u u dx
c u c u
dt
o o o o
+
+
| |
= =
|
\ .
( ) ( )
( )
( ) ( )
( ) ( )
1 1
4
2 3 4 5
*
5
2
*
3
4
, ,
,
2
48
, ,
6 5!
n m n m n
m m n
m n m n
O
u x t u x t
T u c u x t
dt
dt u dx u
x t c x t
t
O dt d
x
x
o
+

=
c c
= +
` `
c c
) )
= +
CAAM 452 Spring 2005
cont
In this case there is a discrepancy between the
magnitude of the time stepping error and the spatial
error.

Using this scheme may require a smaller time step
than dx to ensure that the truncation errors for each
part are of similar size.
CAAM 452 Spring 2005
Definition: Method Order Accuracy
If the local truncation error satisfies:



Then the method s order accurate in time and rth
order accurate in space.

Again if there is a discrepancy between r and s
then it may be wise to consider reducing dt (if s<r)
or dx (if r<s) possibly significantly more than the
CFL condition suggests.
( ) ( )
as , 0
n s r
m
T u O dt O dx dt dx = +
CAAM 452 Spring 2005
Scheme Notation
For brevity we will denote the linear finite difference
schemes:


where the coefficients may depend on dt,dx as:


then the scheme reads:
1
0
j p j q
n j n j
j m j m
j j r
u c u o |
= =
+ +
= =
=

1
,
0
j p j q
n n j n j
dt dx m j m j m
j j r
P u u c u o |
= =
+ +
= =
=

,
0
n
dt dx m
P u =
CAAM 452 Spring 2005
Stability
Definition:

A finite difference scheme for a first-order PDE is
stable if there is an integer J and positive numbers dt
0
and dx
0

such that for any positive time T, there is a constant C
T
such that:
,
0
n
dt dx m
P u =
1 1
2 2
0 0 0
0 0

for 0 , 0 and 0
M J M
n j
m T m
m j m
dx u C dx u
ndt T dx dx dt dt

= = =
s
s s < s < s

i.e. for a scheme to be stable it must not increase the
solution energy beyond some energy injected at the
start of the time stepping.
CAAM 452 Spring 2005
cont (norm notation)
We define a discrete Euclidean norm on the discrete
solution as:




Then the stability condition is:


Or equivalently:
1
0
:
or sometimes denoted by
dx
m M
m m
m
h
u dx u u
u
=
=

=
`
)

2
0
J
n j
T
dx dx
j
u C u
=
s

*
0
J
n j
T
dx dx
j
u C u
=
s

CAAM 452 Spring 2005
Well Posedness
Definition:

The initial value problem for a first-order PDE is well
posed if the following holds for all initial data u(x,0)


for some choice of norm (say with integration over
the interval in x ) where the constant C(t) is
independent of the solution.
( ) ( ) ( )
, , 0 u x t C t u x s
2
L
CAAM 452 Spring 2005
Consequences of Well Posedness
If a first order PDE is well posed, it satisfies an
analog of the numerical stability we have been
seeking.


There are two important consequences:
two initial conditions which are almost everywhere
identical will generate two solutions which are almost
everywhere identical.
two solutions which start close together will remain
close together almost everywhere.
( ) ( ) ( )
, , 0 u x t C t u x s
*
0
J
n j
T
dx dx
j
u C u
=
s

CAAM 452 Spring 2005
cont
The following PDEs are well-posed
2
2
3
2
2 2
2
u u
c su
t x
u u
su
t x
u u u
c du
t t x x
u u u
cu
t t x x
c c
= +
c c
c c
= +
c c
c c c
= +
c c c c
c c c
= +
c c c c
CAAM 452 Spring 2005
Convergence
Definition:

A one-step finite difference scheme approximating a PDE
is a convergent scheme if for any solution to the PDE
,u(x,t), with solution to the finite difference scheme, ,
such that converges to as m*dx converges to x,
then converges to u(x,t) as (m*dx,n*dt) converges to
(x,t) as (dt,dx) (0,0)

n
m
u
0
m
u
( )
0
u x
n
m
u
CAAM 452 Spring 2005
cont
Convergence requires:






for all solutions
( )
( )
0
0
a) if as
b) then , as ,
when 0 0
m
n
m
u u x mdx x
u u x t mdx x ndt t
dt and dx



( ) ( ) ( )
0
, with , 0 u x t u x u x =
CAAM 452 Spring 2005
Lax-Richtmyer Equivalence Theorem
Theorem:

A consistent finite difference scheme for a partial
differential equation for which the initial value problem
is well-posed is convergent if and only if it is stable.
CAAM 452 Spring 2005
Accuracy
There is a technical issue in comparing the numerical
solution and the actual solution.

For any specific resolution (choice of dt,dx) the
numerical solution is defined at discrete points in
space and time.

However, the actual solution to the PDE is defined
over the entire interval.

We now discuss how to compare these very different
representations
CAAM 452 Spring 2005
Solution Norms
We will need to compare two solutions over the
periodic interval.
We will use conventional L
2
and slightly less
conventional H
s
,Sobolev, norms:





Notice this Sobolev norm is constructed with
respect to Fourier derivatives
( )
2
2 2
0
2 2
:
: 1
s
L
L
s
H
u dx u u dx
u dx u
e
e
e
e
e

=
= =
= +

CAAM 452 Spring 2005


Approach 1) Compare Solution With
Interpolated Numerical Solution
In the first approach we compare the actual solution
and a trigonometric interpolation of the numerical
solution.

We find a Fourier sum which interpolates the
numerical solution at the M data points.

i.e. we form a Fourier series with uhat coefficients:
( )
2
1
0
1
,
jx
M
i
n
L
M n j
j
I u x t u e
M
t

=
=

CAAM 452 Spring 2005
cont
Where we demand that the interpolant agrees with
the vector of values of the numerical solution



The interpolant is a map from discrete points to a
function defined on the periodic interval, which we
will denote as:
( )
2
1
0
1
,

m
jx
M
i
n n
L
m M m n j
j
u I u x t u e
M
t

=
= =

2
1 1
0 0
1
jx
M M
i
n n
L
jk k
j k
Su u e
M
t

= =

=
`
)

F
CAAM 452 Spring 2005
Where F is the discrete Fourier transform from Lecture 6



Then a theorem indicating solution accuracy is:

Theorem:

If the initial value problem for a linear PDE (for which the initial value
problem is well-posed), is approximated by a stable one-step finite
difference scheme which is rth order method accurate in space and sth
order in time (with r<=s) and the initial function is the initial condition
truncated to its lowest M Fourier modes then for each time T there exists a
constant C
T
such that:
cont
2
:
n
x
im
L
nm
e
t

= F
( ) ( )
, , with 0
r
n r
n T n n n
H
u t Su C dx u t t ndt t T s = s s
CAAM 452 Spring 2005
Approach 2) Compare Solution and
Numerical Solution at Nodes
It is trickier to perform a pointwise evaluation of the
difference between the numerical solution and the
exact solution.

The primary difficulty is that solutions in L
2
are
equivalent if they only differ on a set of measure
zero.

Since the set of data points is a set of measure
zero the evaluation of an L
2
solution at the points is
not well defined.
CAAM 452 Spring 2005
cont
We rely on the following approximation result

Theorem 1.3.4 GKO:

Let u be a periodic function and assume that its Fourier
coefficients satisfy:



Then:


where the norm is the sup norm.
with 0, 1
m
C
u m
e
e
e
s = >
( ) ( )
1 m
M
u I u CCdx

s
The assumption on the coefficients implies at least the mth order Fourier derivative exists.
CAAM 452 Spring 2005
cont (sketch of convergence)
With this estimate in hand:

We consider:
( ) ( )
1 m
M
u I u CCdx

s
( )
( ) ( ) ( )
( ) ( ) ( )
,
,
,
,
, ,
,
n
m n m
dx
n
n m M n M n
dx
n n n
n M n M n m m m
dx
n n
m m
dx dx
u x t u
u t u
u t I u t I u t v
I u t I
v u
u t v v

s
s + +
+ +
Bound by approximation estimate
(assumes regularity of solution)
Compare interpolant of solution
and numerical solution started
with M term series truncation of
solution:
n
m
v
CAAM 452 Spring 2005
Sketch cont
( )
( ) ( ) ( )
, , ,
,
m n M m n
n
M m n m
dx
n n
m m
dx
n
x
n
m m
dx
d
I u x t I u x t v u x t
u x t u
v u

s + +
i. Bounded by approximation result
ii. use well posedness to bound in
terms of the initial data
Bounded by approach 1 Bounded by
stability of method
and accuracy of
initial condition
Notice we use:
regularity of the solution
well posedness of the initial value problem
comparison of interpolated numerical solution with solution
stability of method
accuracy of initial condition
CAAM 452 Spring 2005
cont (final result)
We are left with the final accuracy estimate theorem

Theorem:

If the initial value problem for a PDE for which the initial value
problem is well posed, is approximated by a stable one-step
finite difference scheme that is rth order in space and sth order
in time with r<=s and the initial condition
then for each positive time T, there is a constant C
T
such that:

( )
0
0
with
r
m
u u mdx u H = e
( ) ( )
, 0
r
n r
m m T
H
dx
u x t u C dx u s
CAAM 452 Spring 2005
Summary of Convergence Test for
Finite Difference Schemes
i. Is the PDE well posed (if in doubt look it up) ?
ii. Is the finite-difference method stable ?
i. use the method of lines
ii. a standard time-stepping method has a known region of
absolute stability bound for dt*maximum eigenvalue of
the spatial operator
iii. Is the finite-difference method consistent
i. use a Taylor series to estimate the local truncation in both
time and space
iv. what is the method order of accuracy ?
i. beware the case of low regularity initial data unbounded
remainder terms from Taylor series analysis
Finally, if the method order is p then the error analysis gives order p
in the solution (assuming the solution has p bounded Fourier derivatives)
CAAM 452 Spring 2005
Boundary Conditions
We are now faced with the inevitable discussion of
how to apply boundary conditions for a non-
periodic domain.

The advection equation only requires inflow data at
the node
n
t
3 M
x
2 M
x
1
x
x
1 M
x
0
x
advection direction
M
x
M
x
CAAM 452 Spring 2005
Example Right-Difference
The obvious choice is to set the last node to be dx
away from the inflow boundary
( ) ( )
1
inflow
0,1,..., 1
m m m
m
M
du u u
c u c m M
dt dx
u t u t
o
+
+
| |
= = =
|
\ .
=
CAAM 452 Spring 2005
System
An example system for 10 data points this time
looks like:
0 0 0
1 1 1
2 2 2
9 9 9 in
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1
u u u
u u u
u u u
d d c c
c
dt dx dx dx
u u u u
| | | | | | | |
| | | |

| | | |
| | | |
| | | |

| | | |
| | | |

= = +
| | | |

| | | |
| | | |

| | | |

| | | |
| | | |

| | | |
| | | |

\ . \ . \ . \ . flow
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\ .
CAAM 452 Spring 2005
Interim (summation by parts) Result
First we define a discrete inner-product:

and associated norm:


Lemma (summation by parts formula):



This looks very much like an integration by parts formula, but
in this case with a discrete inner-product
( )
,
,
m s
r s
r s
m r
u v dx u v
=
=
=

( )
2
, ,
,
r s r s
u u u =
( ) ( ) ( ) { }
1 1
, , ,
, , ,
s s r r
r s r s r s
u v u v dx u v u v u v o o o o
+ + + + + +
= +
CAAM 452 Spring 2005
Energy Method for Semi-discrete Difference Approximation
of the Upwind Finite Difference Method
We assume exact treatment of the time variable
and 1
st
order upwind in the space derivative.








The left hand side represents the time rate change
of a numerical energy.
( )
( ) ( )
( ) { }
2
0, 1 0, 1
0, 1 0, 1
0, 1 0, 1
0 0
0, 1
,
, ,
, ,
,
M M
M M
M M
M M
M
d d
u u u
dt dt
du du
u u
dt dt
c u u c u u
dxc u u c u u u u
o o
o o


+ +

+ +

=
| | | |
= +
| |
\ . \ .
= +
= +
CAAM 452 Spring 2005
cont




The right hand side indicates that the scheme is
dissipative and the only source is from the inflow
boundary condition.
i.e. the total energy can only increase by input from
the boundary condition
( ) { }
2
0 0
0, 1 0, 1
2
,
M M
M M
M
d
u cdx u u c u u u u
dt
c u
o o
+ +

= +
s
CAAM 452 Spring 2005
cont
Thus:





we are certainly in good shape (see GKO p448 for
generalization to discrete in time and space).
The big but for this method is that it is first order in space
A method of lines analysis reveals that all the eigenvalues of
the homogeneous operator are c/dx and then we have to
rely on further results on the impact of lower order terms (in
this case the boundary condition contribution) on the
stability of finite difference schemes
( ) ( ) ( )
2 2
0, 1
2 2 2
inflow
0, 1 0, 1
0
0
M
M
t
M M
d
u c u
dt
u t u c u d t t


s
s +
}
CAAM 452 Spring 2005
2
nd
Order Central + Boundary Conditions
Consider the following semi-discrete scheme:




We need special treatments for the two end points as the
stencil extends beyond the end of the data.

At the zero node we use the first order upwind condition:



At the Mth node we supply the inflow data as before.
( ) ( )
0
for 1, 2,..., 1
0
m
m
m m
du
c u m N
dt
u f x
o = =
=
0 1 0
0
du u u
c u c
dt dx
o
+
| |
= =
|
\ .
CAAM 452 Spring 2005
System
0 0 0
1 1 1
2 2 2
9 9 9
2 2
1 0 1
1 0 1
1 0 1
1 0 1
1 0 1 2
1 0 1
1 0 1
1 0 1
1 0
u u u
u u u
u u u
d d c
c
dt dx dx
u u u
| | | | | | | |
| | | |

| | | |
| | | |
| | | |

| | | |
| | | |

= =
| | | |

| | | |
| | | |

| | | |

| | | |
| | |

| | |
| | |

\ . \ . \ . \ . inflow
2
c
dx
u
| |
|
|
|
|
|
|
+
|
|
|
|
|
| |
| |
| |
\ .
CAAM 452 Spring 2005
Interim (summation by parts) Result 2
We define a modified discrete inner-product:


and associated norm:


Lemma (summation by parts formula with central differences):



This looks very much like an integration by parts formula, but
in this case with a discrete inner-product
( ) { } ( )
0 0
1, 1
, : ,
2
M M
dx M
dx
u v u v u v u v

= + +
( )
2
,
dx dx
u u u =
( ) ( ) { }
0 0 1 1 1 1
, ,
1
, ,
2
s s s s r r r r
r s r s
u v u v u v u v u v u v o o
+ +
= + +
CAAM 452 Spring 2005
Corollary
Setting v=u






This looks rather like a discrete analog of the
divergence theorem (or integration by parts).
The end point evaluation is now approximated by
an average of the end point and neighbor.
( ) ( ) { }
( ) ( ) { }
0 0 1 1 1 1
, ,
0 0 1 1 1 1
, ,
1
, ,
2
1
, ,
2
s s s s r r r r
r s r s
s s s s r r r r
r s r s
u v u v u v u v u v u v
u u u v u u u u u u u u
o o
o o
+ +
+ +
= + +

+ = +
CAAM 452 Spring 2005
Example 2: Energy Method
The scheme:





has an energy equation (in the tailored norm):
( ) ( )
0
inflow
0 1 0
0
for 1, 2,..., 1
0
m
m
M
m m
du
c u m N
dt
u u
du u u
c u c
dt dx
u f x
o
o
+
= =
=
| |
= =
|
\ .
=
2 2 2
0 M
dx
d
u c u c u
dt
=
See GKO p452 for details
CAAM 452 Spring 2005
Higher Order + Boundary Conditions
It is possible to apply modification to the higher order
central differences but it gets quite complicated.

We will reserve higher order treatment of boundary
conditions for finite-element and discontinuous
Galerkin where it is more straightforward to
accommodate boundary conditions (i.e. I have
chickened out).

For the interested, see GKO p474-484 for some non
trivial manipulations to the difference operators to
accommodate the boundary conditions in a stable
manner.
CAAM 452 Spring 2005
Class Discussion
i. Pros and cons of finite difference methods
i. ease of implementation in simple geometries
ii. locality of derivatives
iii. cheap!!!!!!!!!!
iv. time stepping condition not generally artificially costly
v. difficulty of implementing boundary conditions
vi. technical difficulties in analysis
vii. spurious modes
ii. Boundary conditions
i. using extra points at boundary
ii. maintaining stability
iii. one sided stencil interpolation
iii. Geometry
i. stair stepping in 2D,3D
ii. embedded methods
CAAM 452 Spring 2005
Next Lecture
Higher order PDEs
2D and 3D domains
i.e. wrap up of finite-difference introduction.

Preparation for finite-volume methods.

You might also like