You are on page 1of 80

Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference

An Introduction to Numerical Partial


Differential Equations
CHUN-HAO TENG
Department of Applied Mathematics
National Chiao Tung University
Hsin-Chu, Taiwan
1
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Outline
1
Introduction
Numerical Partial Differential Equations
2
Well-posed Problems
Well-posedness
3
Numerical Framework
Consistency, Stability and Convergence
4
Phase Error Analysis
Low-Order or High-Order Method
5
Penalty Method
Energy estimate of problems involving boundary
conditions
Strongly and Weakly impositions of boundary conditions
6
SBP Difference
Basic concepts and notations for constructing high-order
schemes
2
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
An Overview
1
What is numerical partial differential equations?
Many natural phenomena are formulated by partial
differential equations (PDEs) and by solving the equations
one gains a better understanding on the mechanism of
these phenomena.
The topics of numerical PDEs is about constructing
computational algorithms to analyze problems.
2
Does there exist a general methodology for constructing
numerical schemes?
The answer is "Yes" to certain types of problems. General
speaking we need to construct a well-posed analysis on the
problem wherever possible. This analysis is our guide line
for constructing numerical schemes.
3
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Well-posedness of Problems Described by Partial
Differential Equations
Example (Model Wave Problem)
u
t
+
u
x
= 0, x [0, 1], t 0,
u(x, t) = f (x), x [0, 1], t = 0,
u(0, t) = g(t), x = 0, t 0.
Smoothness condition : f (0) = g(0)
We say the problem is well-posed if
1
The solution exists.
2
The solution is unique.
3
The solution is stable.
4
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Well-posedness II
It would be meaningful if there exists a solution to the
problem.
If the problem does have a solution we need to ask
whether the problem has other solutions.
In physics we consider that a physical quantity is a nite
number and can be measured by certain methods or
devices. Moreover, we wish that the system of a physical
problem is stable, in the sense that when a small
perturbation is introduced into the system, the solution
does not deviate away from the unperturbed one.
5
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Well-posedness of the Initial Value Problem
Consider the following example.
Example (2-periodic scalar wave equation)
u
t
+
u
x
= 0, x [0, 2], t 0, (1)
u(x, t) = f (x), t = 0, (2)
u
(p)
(0, t) = u
(p)
(2, t), u
(p)
=

(p)
u
x
(p)
, p = 0, 1, 2, . . . (3)
Does the solution exist ?
6
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Well-posedness of the Initial Value Problem II
Assume
u(x, t) = u
k
(t) e
ikx
, k Z (4)
If (4) is a solution to (1) then
u
t
+
u
x
= 0

du
k
(t)
dt
e
ikx
= (ik) u
k
(t) e
ikx
u
k
(t) = u
k
(0) e
ikt
u(x, t) = u
k
(0) e
ikt
e
ikx
= u
k
(0) e
ik(xt)
7
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Well-posedness of the Initial Value Problem III
Invoking linear superposition we have
u(x, t) =

k=
u
k
(0)e
ik(xt)
.
Take t = 0
u(x, 0) = f (x)

k=
u
k
(0)e
ikx
= f (x)
where u
k
(0) is the fourier coefcients of the function f (x),
provided that f has a fourier series representation.
We have a solution to the problem.
8
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Well-posedness of the Initial Value Problem IV
Uniqueness: Is this the only one ?
Assume that v = u is also a solution to the problem, i.e.,
v
t
+
v
x
= 0, v(x, 0) = f (x), v
(p)
(0, t) = v
(p)
(2, t).
Let w = u v then
w
t
+
w
x
= 0, w(x, 0) = 0, w
(p)
(0, t) = w
(p)
(2, t).
Hence
w(x, t) =

k=
w
k
(0) e
ik(xt)
and w(x, 0) = 0 =

k=
w
k
(0) e
ikx
.
This implies
w
k
(0) = 0 w(x, t) = u(x, t) v(x, t) = 0.
u(x, t) and v(x, t) are identical.
9
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Well-posedness of the Initial Value Problem V
How do we know a solution is stable?
In addition to the issues concerning the existence and
uniqueness of the solution, we also need to know whether
the solution is stable.
Consider the problem:
u
t
+
u
x
= 0,
u(x, 0) = f (x),
u
(p)
(0, t) = u
(p)
(2, t).
Dene the energy of the
system as
Denition
E(t) =
_
2
0
u
2
(x, t) dx
10
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Energy of Physical Systems
We observe similar denitions of energy for various types
of physical systems, for example
1
in electromagnetism
Energy =
_

1
2
E
2
+
1
2
H
2
dx
2
in uid dynamics
Energy =
_

(V V) d
11
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Energy Estimate for
u
t
+
u
x
= 0
Multiplying u to the equation and integrating over the entire
domain, we have the energy rate equation
dE(t)
dt
=
d
dt
_
2
0
u
2
(x, t) dx =
_
2
0
2u
u(x, t)
t
dx
=
_
2
0
2u
_

u
x
_
dx =
_
2
0
u
2
x
dx = u
2
(x, t)

2
0
= 0
Hence,
E(t) = E(0)
_
2
0
u
2
(x, t) dx =
_
2
0
f
2
(x) dx
12
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Well-posedness of the Initial Value Problem VI
Energy of a Perturbed System
Let us now consider the following problems.
Unperturbed Problem:
u
t
+
u
x
= 0
u(x, 0) = f (x)
u
(p)
(0, t) = u
(p)
(2, t)
Perturbed Problem:
v
t
+
v
x
= 0
v(x, 0) = f (x) + (x), |(x)| << 1
v
(p)
(0, t) = v
(p)
(2, t)
13
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Well-posedness of the Initial Value Problem VII
How do we know a solution is stable?
Let w = v u
w
t
+
w
x
= 0
w(x, 0) = (x)
w
(p)
(0, t) = w
(p)
(2, t)
Then
_
2
0
w
2
(x, t) dx =
_
2
0
(v(x, t) u(x, t))
2
dx =
_
2
0

2
(x) dx
At any given time the difference between u and v measured in
the sense of energy is bounded by the energy of the initial
perturbation.
14
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Consistency
Dene the grid points:
x
j
= j h = j
2
N + 1
, j = 0, 1, 2, . . . , N
Let
u(x
j
, t) = u
j
(t)
Recall that
u(x, t)
x
can be approximated by
forward difference:
u
j+1
u
j
h
+O(h)
backward difference:
u
j
u
j1
h
+O(h)
central difference:
u
j+1
u
j1
2h
+O(h
2
)
15
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Upwind Scheme:
dv
i
dt
=
v
i
v
i1
h
I
Dene the numerical solution as
v
i
(t), i = 0, 1, 2, ..., N
satisfying the semi-discrete scheme
dv
i
dt
+
v
i
v
i1
h
= 0, i = 0, 1, ..., N
v
i
(t) = f (x
i
) = f
i
v
1
= v
N
,
16
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Upwind Scheme:
dv
i
dt
=
v
i
v
i1
h
II
Consistency
Substituting the exact solution u
i
(t) = u(x
i
, t) to the scheme
dv
i
dt
+
v
i
v
i1
h
= 0
we get the truncation error (TE)
TE =
du
i
dt
+
u
i
u
i1
h
=
u(x
i
, t)
t
+
u(x
i
, t)
x
+O(h) = O(h).
Observe that TE 0 as h 0. The scheme is consistent.
17
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Upwind Scheme:
dv
i
dt
=
v
i
v
i1
h
III
Energy Estimate
N

i=0
v
i
dv
i
dt
h =
N

i=0
v
i
v
i
+
N

i=0
v
i
v
i1

N

i=0
v
2
i
+
1
2
N

i=0
v
2
i
+
1
2
N

i=0
v
2
i1
=
1
2
N

i=0
v
2
i
+
1
2
N

i=0
v
2
i1
(periodicity v
1
= v
N
)
= 0
18
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Upwind Scheme:
dv
i
dt
=
v
i
v
i1
h
IV
Energy Estimate
Hence
1
2
d
dt
N

i=0
v
2
j
h 0
N

i=0
v
2
i
h
N

i=0
f
2
i
h
The scheme has a bounded energy estimate for a given
terminal time.
Recall the energy estimate of the continuous system:
_
2
0
u
2
(x, t) dx =
_
2
0
f
2
(x) dx.
19
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Down Wind Scheme:
dv
i
dt
=
v
i+1
v
i
h
I
Consider the scheme:
dv
i
dt
=
v
i+1
v
i
h
i = 0, 1, 2, ..., N
v
i
(0) = f (x
i
) = f
i
v
N+1
= v
0
Consistency Check: Substituting the exact solution u
i
(t) to the
scheme we get the truncation error (TE)
TE =
du
i
dt
+
u
i+1
u
i
h
=
u(x
i
, t)
t
+
u(x
i
, t)
x
+O(h) = O(h).
Observe that TE 0 as h 0. The scheme is consistent
20
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Down Wind Scheme:
dv
i
dt
=
v
i+1
v
i
h
II
Energy Estimate
dE(t)
dt
=
N

i=0
v
i
dv
i
dt
h =
N

i=0
v
i+1
v
i
+
N

i=0
v
2
i
=
1
2
N

i=0
v
2
i
+
1
2
N

i=0
v
2
i

N

i=0
v
i+1
v
i
+
1
2
N

i=0
v
2
i+1

1
2
N

i=0
v
2
i+1
=
1
2
N

i=0
(v
i
v
i+1
)
2
0 (= 0 when constant)
21
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Down Wind Scheme:
dv
i
dt
=
v
i+1
v
i
h
III
Energy Estimate
The fact that
dE(t)
dt
=
N

i=0
v
i
dv
i
dt
h 0
leads to
N

i=0
v
2
i
h
N

i=0
f
2
i
h.
We have a scheme with an energy estimate that can not be
bounded by the prescribed data.
22
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
What Does the Bounded Energy Estimate Imply?
Energy of the Error Equation
Consider vectors
a = [a
0
, a
1
, ..., a
N
]
T
, b = [b
0
, b
1
, ..., b
N
]
T
we dene the vector inner product and norm as
(a, b)
h
= a
T
bh =
N

i=0
a
i
b
i
h, ||a||
2
= (a, a)
h
Useful inequality: For real numbers a and b, we have
2ab a
2
+ b
2
For vectors a and b
(a, b)
2
h
||a|| ||b||
23
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
What Does the Bounded Energy Estimate Imply?
Energy of the Error Equation (Upwind Scheme)
Recall the scheme
dv
i
dt
+
v
i
v
i1
h
= 0
v
i
(0) = f (x
i
) = f
i
v
1
= v
N
,
Let u
i
(t) = u(x
i
, t). Then
du
i
dt
+
u
i
u
i1
h
= te
i
, te
i
= O(h)
u
i
(0) = f (x
i
) = f
i
u
1
= u
N
,
Dene e
i
= u
i
v
i
. Then e
i
satises
de
i
dt
+
e
i
e
i1
h
= te
i
,
e
i
(0) = 0
e
1
= e
N
,
We now examine the energy of the discrete system.
24
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
What Does the Bounded Energy Estimate Imply?
Energy of the Error Equation (Upwind Scheme)
Denote
e = [e
0
, e
1
, ..., e
N
]
T
, te = [te
0
, te
1
, ..., te
N
]
T
1
2
d||e||
2
dt
=
N

i=0
e
i
de
i
dt
h =
N

i=0
(e
i
e
i1
)e
i
+
N

i=0
e
i
te
i
h

1
2
N

i=0
(e
i
e
i1
)
2
+
1
2
N

i=0
e
2
i
h +
1
2
N

i=0
te
2
i
h

1
2
||e||
2
+
1
2
||te||
2
25
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
What Does the Bounded Energy Estimate Imply?
Energy of the Error Equation (Upwind Scheme)
e
t
d||e||
2
dt
e
t
||e||
2
e
t
||te||
2

d
dt
_
e
t
||e||
2
_
e
t
||te||
2
e
t
||e(t)||
2
e
0
||e(0)||
2

_
t
0
e

||te()||
2
d
||e(t)||
2
e
t
_
t
0
e

||te()||
2
d
||e(t)||
2
e
t
_
max
[0,t]
||te()||
2
__
t
0
e

d
||e(t)||
2

_
max
[0,t]
||te()||
2
_
(e
t
1)
26
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
What Does the Bounded Energy Estimate Imply?
Energy of the Error Equation (Upwind Scheme)
From
||e(t)||
2

_
max
[0,t]
||te()||
2
_
(e
t
1)
we have
1
As time evolves the error may grow exponentially.
2
For constant t, e
t
1 is xed. As h 0,
max
[0,t]
||te()||
2
0. Hence
||e(t)||
2
= ||u(t) v(t)||
2
0
implying convergence.
27
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
What Does the Bounded Energy Estimate Imply?
Energy of the Error Equation (Down Wind Scheme)
For down wind scheme one can follow a similar and yield
||e|| min
[0,t]
c(t)
h
2

0
(e

0
t
h
1)
where c(t) = O(1) and
0
> 0 is a constant. From the result we
observe that
1
as h 0 h
2
(e

0
t
h
1)
28
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Classical Theory on Convergence
Theorem (Lax-Richtmyer Equivalence Theorem)
A consistent approximation to a linear well-posed partial
differential equation is convergent if and only if it is stable.
Remark:
We need a consistent scheme which has an energy
estimate bounded by the prescribed data.
The upwind scheme is consistent and stable. Thus, the
numerical solution converges to the exact solution.
The downwind scheme is consistent and unstable. Thus,
the numerical solution does not converge to the exact one.
29
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Phase Error Analysis I
Consider the linear wave problem
u
t
= c
u
x
, 0 x 2, (5)
u(x, 0) = e
ikx
.
The solution to equation (5) is a travelling wave
u(x, t) = e
ik(xct)
with phase speed c
30
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Phase Error Analysis II
We use the equidistant grid
x
j
= j x =
2j
N + 1
, j [0, . . . , N].
The 2m-order approximation of the derivative of a function f (x) is
d f
d x

x
j
=
m

n=1

m
n
D
n
f (x
j
)
where
D
n
f (x
j
) =
f (x
j
+ n x) f (x
j
n x)
2n x
=
f
j+n
f
jn
2n x

m
n
= 2(1)
n
(m!)
2
(m n)! (m + n)!
31
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Phase Error Analysis III
In the semi-discrete version of Equation (5) we seek a vector
v = (v
0
(t), v
1
(t), . . . , v
N
(t)) which satises
dv
j
dt
= c
m

n=1

m
n
D
n
v
j
, v
j
(0) = e
ikx
j
. (6)
We may interpret the grid vector, v, as a vector of grid point
values of a trigonometric polynomial, v(x, t), with v(x
j
, t) = v
j
(t),
such that
v(x, t)
t
= c
m

n=1

m
n
D
n
v(x, t), v(x, 0) = e
ikx
(7)
If v(x, t) satises Equation (7), the solution to Equation (6) is
given by v(x
j
, t).
32
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Phase Error Analysis IV
The solution to Equation (7) is
v(x, t) = e
ik(xc
m
(k)t)
,
where c
m
(k) is the numerical wave speed. The dependence of
c
m
on the wave number k is known as the dispersion relation.
The phase error e
m
(k), is dened as the leading term in the
relative error between the actual solution u(x, t) and the
approximate solution v(x, t):

u(x, t) v(x, t)
u(x, t)

1 e
ik(cc
m
(k))t

|k(c c
m
(k))t| = e
m
(k).
33
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Phase Error Analysis V
Applying phase error analysis to the second-order nite
difference scheme
v(x, t)
t
= c
v(x + x, t) v(x x, t)
2x
,
v(x, 0) = e
ikx
,
we obtain the numerical phase speed
c
1
(k) = c
sin(kx)
kx
.
For x 1,
c
1
(k) = c
_
1
(k x)
2
6
+O
_
(k x)
4
_
_
,
conrming the second-order accuracy of the scheme.
34
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Phase Error Analysis VI
For the fourth-order scheme
v(x, t)
t
=
c
12 x
_
v(x 2 x, t) 8v(x x, t)
+ 8v(x + x, t) v(x + 2 x, t)
_
,
we obtain
c
2
(k) = c
_
8 sin(kx) sin(2kx)
6kx
_
.
For x 1 we recover the approximation
c
2
(k) = c
_
1
(kx)
4
30
+O
_
(kx)
6
_
_
.
illustrating the expected fourth-order accuracy.
35
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Phase Error Analysis VII
Denoting e
1
(k, t) as the phase error of the second-order
scheme and e
2
(k, t) as the phase error of the fourth-order
scheme, with the corresponding numerical wave speeds c
1
(k)
and c
2
(k), we obtain
e
1
(k, t) = kct

1
sin(kx)
kx

, (8)
e
2
(k, t) = kct

1
8 sin(kx) sin(2kx)
6kx

. (9)
36
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Phase Error Analysis VIII
Introduce
p =
N + 1
k
=
2
kx
(the number of points per wavelength)
=
kct
2
(the number of periods in time)
Rewriting the phase error in term of p and yields
e
1
(p, v) = 2v

1
sin(2p
1
)
2p
1

, (10)
e
2
(p, v) = 2v

1
8 sin(2p
1
) sin(4p
1
)
12p
1

. (11)
37
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Phase Error Analysis IX
The leading order approximation to (10) is
e
1
(p, v)
v
3
_
2
p
_
2
, (12)
e
2
(p, v)
v
15
_
2
p
_
4
(13)
from which we immediately observe that the phase error is
directly proportional to the number of periods i.e., the error
grows linearly in time.
38
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Phase Error Analysis X
We arrive at a more straightforward measure of the error of the
scheme by introducing p
m
(
p
, ) as a measure of the number of
points per wavelength required to guarantee a phase error,
e
p

p
, after periodic for a 2m-order scheme. Indeed, from
(12) we directly obtain the lower bounds
p
1
(, v) 2
_
v
3
p
(14)
p
2
(, v) 2
4
_
v
15
p
(15)
39
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Phase Error Analysis XI
Example

p
= 0.1 Consider the case in which the desired phase error is
10%. For this relatively large error,
p
1
20

v, p
2
7
4

v.
= 0.01 When the desired phase error is within 1%, we have
p
1
64

v, p
2
13
4

v.
= 10
5
p
1
643

v, p
2
43
4

v
40
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Phase Error Analysis XII
Sixth-order method
As an illustration of the general trend in the behavior of the
phase error, we give the bound on p
3
(
p
, ) for the sixth-order
centered-difference scheme as
p
3
(
p
, ) 2
6
_

70
p
,
for which the above special cases become
p
3
(0.1, ) = 5
6

, p
3
(0.01, ) = 8
6

, p
3
(10
5
, ) = 26
6

,
conrming that when high accuracy is required, a high-order is
the optimal choice.
41
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Energy Estimate of IBVP
Consider the initial boundary value problem:
u
t
+
u
x
= 0 x [0, 1] t 0
u(x, 0) = f (x) x [0, 1] t = 0
u(1, t) = g(t) x = 0 t 0.
42
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Energy Estimate of IBVP
Multiplying u to the partial differential equation, integrating over
the domain and applying the boundary condition, we have
_
1
0
u
u
t
dx =
_
1
0
u
u
x
dx

1
2
dE
dt
=
1
2
u
2

1
0
=
1
2
u
2
(0, t)
1
2
u
2
(1, t), E(t) =
_
1
0
u
2
(x, t) dx

dE
dt
= g
2
(t) u
2
(1, t) g
2
(t)
Integrating the energy rate equation with respect to time and
invoking the initial condition, we have
E(t) E(0) +
_
t
0
g
2
() d E(0) + t G, G = max
[0,t]
g
2
()
or
_
1
0
u
2
(x, t)dx
_
1
0
f
2
(x)dx + t G
43
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Schemes for the Model Wave Equation
We now construct nite difference schemes for the model wave
problem
u
t
+
u
x
= 0, x [0, 1], t 0,
u(x, t) = f (x), x [0, 1], t = 0,
u(0, t) = g(t), x = 0, t 0.
We dene the grid points as
x
i
= ih, h = 1/N, i = 0, 1, 2, ..., N
Denote v
i
(t) the approximation of u(x
i
, t) at x
i
.
44
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Upwind Scheme I
Strongly Enforced Boundary Condition
Consider the scheme
dv
i
dt
+
v
i
v
i1
h
= 0, i = 1, 2, . . . , N
v
i
(0) = f (x
i
)
v
0
(t) = g(t)
Accuracy: rst order in space
Stability
N

i=1
v
i
dv
i
dt
h =
N

i=1
v
i
(v
i
v
i1
)
45
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Upwind Scheme II
Strongly Enforced Boundary Condition
1
2
d
dt
E
D
(t) =
1
2
d
dt
N

i=1
h v
2
i
(t) =
N

i=1
v
2
i
+
N

i=1
v
i
v
i1
=
1
2
N

i=1
v
2
i

1
2
N

i=1
v
2
i
+
N

i=1
v
i
v
i1

1
2
N

i=1
v
2
i1
+
1
2
N

i=1
v
2
i1
=
1
2
N

i=1
v
2
i

1
2
N

i=1
(v
i
v
i1
)
2
+
1
2
N1

i=0
v
2
i
=
1
2
v
2
0

1
2
v
2
N

1
2
N

i=1
(v
i
v
i1
)
2
=
1
2
g
2
(t)
1
2
v
2
N

1
2
N

i=1
(v
i
v
i1
)
2

1
2
g
2
(t)
46
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Upwind Scheme III
Strongly Enforced Boundary Condition
Then
dE
D
(t)
dt
g
2
(t) E
D
(t) E
D
(0) +
_
t
0
g
2
() d,
or explicitly
N

i=1
h v
2
i
(t)
N

i=1
h f
2
i
+
_
t
0
g
2
() d
Recall that for the continuous system we have
_
1
0
u
2
(x, t) dx
_
1
0
f
2
(x) dx +
_
t
0
g
2
() d
47
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Upwind Scheme IV
Weakly Enforced Boundary Condition
Consider the scheme
dv
i
dt
+
v
i
v
i1
h
= 0 i = 1, 2, . . . , N
dv
0
dt
+
v
1
v
0
h
= (v
0
g(t))
v
i
(0) = f (x
i
) i = 0, 1, 2, . . . , N
: free parameter.
(1) 0 (the scheme behaves like the PDE)
dv
0
dt
+
v
1
v
0
h
= (v
0
g(t)) 0
(2) (the scheme behaves like the boundary condition)
v
0
g(t) =
1

_
dv
0
dt
+
v
1
v
0
h
_
0
48
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Upwind Scheme V
Weakly Enforced Boundary Condition
Accuracy: 1st order in space
Stability: We need to check whether the discrete energy
E
D
(t) =
N

i=0
v
2
i
(t)h
has an estimate bounded by the prescribed data and .
49
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Upwind Scheme VI
Weakly Enforced Boundary Condition
Multiplying v
i
h to the scheme and summing up the resultant
equations, we have
N

i=0
v
i
dv
i
dt
h =
N

i=1
v
i
(v
i
v
i1
) v
0
(v
1
v
0
) h v
0
(v
0
g(t))
Recall

i=1
v
i
(v
i
v
i1
) =
1
2
v
2
0

1
2
v
2
N

1
2
N

i=1
(v
i
v
i1
)
2
1
2
dE
D
dt
=
1
2
v
2
0

1
2
v
2
N

1
2
N

i=2
(v
i
v
i1
)
2

1
2
(v
2
1
2v
1
v
0
+ v
2
0
)
v
0
v
1
+ v
2
0
h v
0
(v
0
g(t))
=
1
2
v
2
N

1
2
N

i=2
(v
i
v
i1
)
2

1
2
v
2
1
+ v
2
0
(1 h) + h v
0
g(t)
50
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Upwind Scheme VII
Weakly Enforced Boundary Condition
dE
D
dt
=v
2
N
v
2
1

i=2
(v
i
v
i1
)
2
+ 2(1 h)
_
v
0
+
hg(t)
2(1 h)
_
2


2
h
2
g
2
(t)
2(1 h)
Take 1 h < 0 >
1
h
dE
D
dt


2
h
2
g
2
(t)
2(h 1)
If h = 2
dE
D
dt
2 g
2
(t) E
D
(t) E
D
(0) + 2
_
t
0
g
2
() d
51
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Upwind Scheme VII
Weakly Enforced Boundary Condition
Remarks:
1
By properly choosing the value of the parameter the
scheme has a bounded energy estimate, implying stability.
2
Since > 1/h as h 0, , the equation at x
0
= 0,
v
0
g(t) =
1

_
dv
0
dt
+
v
1
v
0
h
_
converges to the boundary condition as h 0.
52
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Central Difference Scheme I
Strongly Enforced Boundary Condition
Consider the scheme
dv
i
dt
+
v
i+1
v
i1
2h
= 0 i = 1, 2, . . . , N
dv
N
dt
+
v
N
v
N1
h
= 0
v
0
(t) = g(t)
v
i
(0) = f (x
i
)
Accuracy: 2nd order at interior points
1st order at boundary points
globally second order
1
1
Gustafsson (1975) The Convergence Rate for Difference Approximations
to Mixed Initial Boundary Value Problems
53
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Central Difference Scheme II
Strongly Enforced Boundary Condition
Let c
N
=
1
2
, c
i
= 1 for i = N. Multiplying c
i
v
i
h to the scheme we
have
N

i=1
c
i
v
i
dv
i
dt
h =
N1

i=1
v
i
_
v
i+1
v
i1
2
_
v
N
_
v
N
v
N1
2
_

d
dt
N

i=1
c
i
v
2
i
h =
N1

i=1
v
i
(v
i+1
v
i1
) v
N
(v
N
v
N1
)
=
N1

i=1
v
i
v
i+1
+
N1

i=1
v
i
v
i1
v
2
N
+ v
N
v
N1
54
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Central Difference Scheme III
Strongly Enforced Boundary Condition
d
dt
N

i=1
c
i
v
2
i
h =
N1

i=1
v
i
v
i+1
+
N

i=1
v
i
v
i1
v
2
N
=
N1

i=1
v
i
v
i+1
+
N1

i=0
v
i+1
v
i
v
2
N
= v
1
v
0
v
2
N
We have no idea on bounding the discrete energy rate.
55
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Central Difference Scheme IV
Weakly Enforced Boundary Condition
Consider the scheme
dv
i
dt
+
v
i+1
v
i1
2h
= 0 i = 1, 2, . . . , N 1
dv
N
dt
+
v
N
v
N1
h
= 0
dv
0
dt
+
v
1
v
0
h
= (v
0
g(t))
1
2
v
0
dv
0
dt
h +
N1

i=1
v
i
dv
i
dt
h +
1
2
v
N
dv
N
dt
h
=
N1

i=1
v
i
(v
i+1
v
i1
)
2

v
N
(v
N
v
N1
)
2

(v
1
v
0
)v
0
2

hv
0
2
(v
0
g(t))
56
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Central Difference Scheme V
Weakly Enforced Boundary Condition
d
dt
N

i=0
c
i
v
2
i
h = v
1
v
0
v
2
N
v
1
v
0
+ v
2
0
hv
2
0
+ hv
0
g(t)
= v
2
N
+ (1 h)v
2
0
+ hv
0
g(t)
= v
2
N
+ (1 h)
_
v
2
0
+
h
1 h
v
0
g(t) +
_
h
2(1 h)
_
2
g
2
(t)
_
(1 h)
_
h
2(1 h)
_
2
g
2
(t)
If h = 2
d
dt
N

i=0
c
i
v
2
i
h = v
2
N
(v
0
g(t))
2
+ g
2
(t) g
2
(t)

i=0
c
i
v
2
i
(t)h
N

i=0
c
i
f
2
i
h +
_
t
0
g
2
() d
57
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Central Difference Scheme VI
Weakly Enforced Boundary Condition
Remarks:
1
By properly choosing the value of the scheme has a
discrete energy estimate that is bounded by the prescribed
data f
i
and g(t) and it is independent of N. This implies
stability.
2
A scheme is stable at the semi-discrete level does not
ensure the stability of the scheme at the fully discrete level.
This is because the stability condition at the semidiscrete
level is only a necessary condition.
3
The advantage of using semidiscrete analysis is that we
can check whether the boundary closure will cause
instability, and possibly x the problem.
58
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Central Difference Scheme VI
Matrix Vector Representation
Let v = [v
0
(t) v
1
(t) v
N
(t)] The scheme has a matrix-vector
representation as
d
dt

v
0
v
1
v
2
.
.
.
v
N1
v
N

+
1
2h

2 2 0
1 0 1
.
.
.
0 1 0 1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1 0 1
0 2 2

v
0
v
1
v
2
.
.
.
v
N1
v
N

(v
0
g(t))
0
0
.
.
.
0
0

or
d
dt
v(t) + Dv(t) = (v
0
g(t))e
0
, e
0
= [1 0 0 0 0]
T
Dene H = diag(
1
2
, 1, 1, , 1,
1
2
)
v
T
H
dv
dt
h + v
T
H Dh v(t) = (v
0
g(t))v
T
He
0
h
59
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Central Difference Scheme VII
Interesting Property: Summation-by-Parts Rule
Observe
H Dh =
1
2

1/2 0
0 1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1 0
0 1/2

2 2 0
1 0 1
.
.
.
.
.
.
.
.
.
1 0 1
2 2

=
1
2

1 1 0
1 0 1
.
.
.
.
.
.
.
.
.
1 0 1
1 1

=
1
2

1
0
.
.
.
1

+
1
2

0 1 0
1 0 0
.
.
.
.
.
.
.
.
.
0 0 1
1 0

=Q
S
+ Q
A
So
v
T
HDhv = v
T
Q
S
v + v
T
Q
A
v =
1
2
(v
2
0
+ v
2
N
)
60
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Central Difference Scheme VII
Interesting Property: Summation-by-Parts Rule
Hence
v
T
H
dv
dt
h = v
T
H Dh v (v
0
g(t))v
T
He
0
h
1
2
d
dt
_
v
T
Hvh

=
1
2
v
2
0

1
2
v
2
N

h
2
v
0
(v
0
g(t))
The rule
v
T
HDhv = v
T
Q
S
v + v
T
Q
A
v =
1
2
(v
2
0
+ v
2
N
)
in fact mimic the action of
_
1
0
u(x)
u(x)
x
dx =
1
2
u(1)
1
2
u(0)
61
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
From Low-Order to High-Order Methods
To construct a high-order scheme we basically seek a
differentiation matrix D (resulting from central and
one-sided difference scheme) and a positive denite matrix
H such that a rule similar to
v
T
HDhv = v
T
Q
S
v + v
T
Q
A
v =
1
2
(v
2
0
+ v
2
N
)
exists.
Notice that a summation-by-parts rule is only for estimating
the energy of the system. To stably impose boundary
conditions we still use the penalty methodology.
62
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Basic Concepts and Notations I
Let I = [0, 1]. Consider two functions f (x) and g(x) dened on I.
We dene the continuous L
2
inner product and norm for
functions over I as
(f , g) =
_
I
f g dx, ||f ||
2
I
= (f , f )
Consider I
2
= [0, 1] [0, 1]. The continuous L
2
inner product
and norm for functions over I
2
are dened as
(f , g) =
_
I
2
f g dx dy, ||f ||
2
I
2
= (f , f ).
Likewise, for functions dened on I
3
= [0, 1] [0, 1] [0, 1] we
denote the continuous L
2
inner product and norm for functions
over I
3
as
(f , g) =
_
I
3
f g dx dy dz, ||f ||
2
I
3
= (f , f ).
63
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Basic Concepts and Notations II
We introduce a set of uniformly spaced grid points:
x
i
= ih, i = 0, 1, 2, ..., L, h = 1/L,
where h is the grid distance. Consider two vectors, f , g V
L+1
,
explicitly given by
f = [f
0
, f
1
, ..., f
L
]
T
, g = [g
0
, g
1
, ..., g
L
]
T
,
We dene a weighted discrete L
2
inner product and norm, with
respect to the step size h and the matrix M, for vectors as
(f , g)
h,M
= hf
T
Mg, ||f ||
2
h,M
= (f , f )
h,M
.
If M is an identity matrix then
(f , g)
h
= hf
T
g, ||f ||
2
h
= (f , f )
h
.
64
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Basic Concepts and Notations III
To numerically approximate a function u and its derivative
du/dx, we consider the difference approximation of the form
Pv
x
= h
1
Qv, or v
x
= Dv = h
1
P
1
Qv, (16)
where
v = [v
0
, v
1
, ..., v
L
]
T
, v
x
= [v
x
0
, v
x
1
, ..., v
x
L
]
T
,
denote the numerical approximations of u and u

evaluated at
the grid points, and D, P, Q M
L+1
.
65
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Basic Concepts and Notations IV
Let u and u
x
denote vectors with components being,
respectively, the collocated values of the functions u and du/dx
at the grid points, i.e.,
u = [u(x
0
), u(x
1
), ..., u(x
L
)]
T
, u
x
=
_
du(x
0
)
dx
,
du(x
1
)
dx
, ...,
du(x
L
)
dx
_
T
.
The truncation error t
e
of the scheme Eq.(16) is dened by
Pt
e
= Pu
x
h
1
Qu,
and |t
e
| = O(h

x
, h

x
) where and are the convergence rates
of the approximation at interior and boundary grid points,
respectively.
66
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Basic Concepts and Notations V
We devise implicit difference methods for approximating the
differential operator d/dx by constructing a special class of P
and Q satisfying the following properties;
SBP1: The matrix P is symmetric positive denite.
SBP2: The matrix Q is nearly skew-symmetric and satises the
constraint
Q + Q
T
2
= diag(q
00
, 0, ..., 0, q
LL
), q
00
< 0, q
LL
= q
00
> 0.
where q
00
and q
LL
are the upper most and lower most diagonal
elements of Q.
67
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Summation-by-Parts Rule in 1D Space I
Lemma (Summation-by-Parts)
Consider the difference operator D = h
1
P
1
Q where P and Q
satisfy SBP1 and SBP2, respectively. We have
(v, Dv)
h,P
= (v, h
1
P
1
Qv)
h,P
= q
00
v
2
0
+ q
LL
v
2
L
,
for v V
L+1
.
68
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Summation-by-Parts Rule in 1D Space II
Proof.
First we rewrite the inner product as
(v, Dv)
h,P
=
_
v, h
1
Qv
_
h
= v
T
Q
S
v + v
T
Q
A
v
where Q
S
= (Q + Q
T
)/2 and Q
A
= (Q Q
T
)/2 are, respectively,
the symmetric and anti-symmetric parts of the matrix Q. Notice
that v
T
Q
A
v = 0 since Q
A
is antisymmetric. Thus, we have
(v, Dv)
h,P
= v
T
Q
S
v = q
00
v
2
0
+ q
LL
v
2
L
,
where the last equality is due to SPB2. This completes the
proof.
69
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
One Dimensional Advection Equation I
Consider the advection equation
u
t
+
u
x
= 0, x I, t 0, (17)
with the initial condition
u(x, 0) = f (x), x I, (18)
and the boundary condition
u(0, t) = g(t), t 0. (19)
70
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
One Dimensional Advection Equation II
Equation (17) leads to an energy rate
d
dt
||u||
2
I
= g
2
(t) u
2
(1, t),
For well-posed analysis it is sufcient to consider g = 0, and we
obtain an energy estimate
||u(x, t)||
2
I
||u(x, 0)||
2
I
= ||f (x)||
2
I
. (20)
71
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
One Dimensional Advection Equation III
Consider a equally spaced partition:
x
i
= ih, h = 1/L.
With v
i
denoting the approximation of u(x
i
), we seek a
numerical solution v of the form
v(t) = [v
0
(t), v
1
(t), ..., v
L
(t)]
T
,
which satises the semidiscrete scheme
dv
dt
+ h
1
P
1
Qv = h
1
q
00
(v
0
g(t))P
1
e
0
, (21a)
v(0) = f = [f (x
0
), f (x
1
), ..., f (x
L
)]
T
, (21b)
where P and Q are dened by Eq.(16), and e
0
= [1, 0, ..., 0]
T
.
72
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
One Dimensional Advection Equation IV
Theorem
Assume that there exists a smooth solution to the one dimen-
sional wave problem described by Eqs.(17-19). Then Eq.(21a)
is stable at the semi-discrete level provided that
1.
Moreover, v(t) satises the estimate
||v(t)||
2
h,P
||f ||
2
h,P
.
73
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
One Dimensional Advection Equation V
Proof.
Multiplying hv
T
P to the scheme and invoking Lemma 11 we
obtain
1
2
d
dt
||v||
2
h,P
= (q
00
v
2
0
+ q
LL
v
2
L
) + v
0
q
00
(v
0
g(t)).
For the stability analysis, it is sufcient enough to consider the
scheme subject to g(t) = 0. Hence,
1
2
d
dt
||v||
2
h,P
= q
00
( 1)v
2
0
q
LL
v
2
L
q
00
( 1)v
2
0
,
where the last inequality results from q
LL
> 0 demanded by
SBP2. Recall that q
00
< 0.
74
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
One Dimensional Advection Equation VI
So, taking 1 immediately yields a non-increasing energy
rate
1
2
d
dt
||v||
2
h,P
0,
which leads to the estimate
||v(t)||
2
h,P
||v(0)||
2
h,P
= ||f ||
2
h,P
.
Thus, the scheme is stable. This completes the proof.
75
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Important Reference: Bo Strand (1994)
Difference method
v
x
=
1
h
Qv,
Summation-By-Parts
vHv
x
=
1
h
vHQv =
1
2
(v
2
N
v
2
0
)
76
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Fourth-Order (Class 1: Accuracy = 4, = 3)
H =
_

_
_
H
U
_
.
.
.
_
H
L
_
_

_
hQ =
_

_






.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
_

_
77
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Bo Strand (Class 2: Accuracy = 6, = 3)
H = diag[h
00
, h
11
, h
22
, . . . . . . ]
hQ =
_

_







.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
_

_
78
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Other References
Bo Strand (1998) Numerical studies of hyperbolic IBVP
with high-order nite difference operators satisfying a
summation by parts rule
Jan Nordstrm, Mark H. Carpenter (2001) High-Order
Finite Difference Methods, Multidimensional Linear
Problems, and Curvilinear Coordinates
Ken Mattsson, Jan Nordstrm (2004), Summation by parts
operators for nite difference approximations of second
derivatives
Magnus Sard, Jan Nordstrm (2006), On the order of
accuracy for difference approximations of initial- boundary
value problems
79
Introduction Well-posed Problems Numerical Framework Phase Error Analysis Penalty Method SBP Difference
Carpenter, Gottlieb, Abarbanel (1994)
Difference Method:
Pv
x
= Qv
Summation-by-parts rule:
v
T
HPv
x
= v
T
HQv =
1
2
_
v
2
N
v
2
0
_
P is tridiagonal (implicit method) and HP is symmetric positive
denite.
Class 1: Accuracy = 4, = 3
Class 2: Accuracy = 6, = 5 (H is a identity matrix)
80