linear
linear
In this chapter we discuss the finite difference methods for linear partial differential equa-
tions. We consider one example from each of Hyperbolic, Parabolic and Elliptic partial dif-
ferential equations. The basic concept of consistency, stability and convergence of numerical
schemes are discussed.
1 Hyperbolic equation
Simplest hyperbolic partial differential equation is one way wave equation,
(1.1) P u = ut + aux = 0, − ∞ < x < ∞, t > 0, u = u(x, t)
with initial condition
(1.2) u(x, 0) = u0 (x).
(1.1) - (1.2) is an initial value problem.
First define the grid of points in the (x, t) plane by drawing vertical and horizontal lines
through the points (xi , tn )
where
tn = n∆t, n = 0, 1, 2, . . .
xi = ih, i = 0, ±1, ±2, . . .
1
The lines x = xi and t = tn are called grid lines and their intersections are called mesh points
of the grid. We denote
u(xi , tn ) = u(ih, n∆t) = uni
The basic idea of finite difference method is to replace derivatives by finite differ-
ences. This can be done in many ways; as example we have
(i) Forward difference:
∂u uni+1 − uni
(xi , tn ) = + O(h) (Forward difference)
∂x h
uni − uni−1
= + O(h) (Backward difference)
h
n n
ui+1 − ui−1
= + O(h2 ) (Central difference)
2h
By replacing the derivatives by finite differences and neglecting the error terms we have list of
difference equations. For example
vin+1 − vin n )
(v n − vi−1
(1.4) P∆t,h v = +a i = 0 (forward time − backward space)
∆t h
vin+1 − vin n )
(v n − vi−1
(1.5) P∆t,h v = + a i+1 = 0 (forward time − central space)
∆t 2h
vin − vin−1 n )
(v n − vi−1
(1.7) P∆t,h v = +a i = 0 (backward time − backward space)
∆t h
Like this one can consider several schemes. Here in all we replace the derivatives by finite
differences. Given a list of schemes one naturally ask the question which of the schemes are
useful and which are not, as indeed some are not.
2
Example : Take a = 1 in (1.1)
ut + ux = 0
1 if x≤0
with I.C : u(x, 0) = u0 (x) = 2x3 − 3x2 + 1 if 0≤x≤1
0 x≥1
∆t n
vin+1 = vin − (v − vin ) (forward time − forward space).
h i+1
∆t
Let λ = h , then
⇒ vjn = 0 ∀j ≥ j0
⇒ v(x, t) = 0 ∀x ≥ 1
Solution obtained from (1.3) does not converges to u(x, t) as mesh size h and ∆t goes to
zero. Therefore Scheme (1.3) is not a correct scheme for ut + ux = 0. To study what are the
schemes are useful (convergent) let us first introduce the concepts of consistency and stability.
Throughout the notes, norm || · || means either
1/2 1/2
X X
||u|| = ||u||2 = h |u(xj )|2 = h |uj |2
j j
or
3
Definition : Given a partial differential equation P u = 0 and a finite difference scheme
P∆t,h v = 0 we say that the finite difference scheme is consistent with the partial differential
equation in norm || · ||, if for the actual solution u of P u = 0,
Definition : The finite difference method is accurate of order (p, q) in || · || if for the actual
solution u of P u = 0,
By defining forward shift operator S+ vj = vj+1 and backward shift operator S− vj = vj−1 we
can write
k n
vin+1 = α−k S− vi + . . . α−1 S− vin + α0 vin + α1 S+ vin + . . . + αk S+
k n
vi
where
k
S± = S± oS± . . . oS± (k times composition)
0 0
I = Identity operator = S− = S+ .
Therefore
vin+1 = Q(S+ , S− )vin ∀i
In general one can write the one step scheme by
T
n+1 n+1 n+1
(1.7). v n+1 = Qv n where v n+1 = . . . , vi−1 , vi , vi+1 , . . . .
and Q is a matrix.
Definition : The finite difference method (1.7) is called stable in || · ||, if there exist constants
K and β such that
4
Definition : A finite difference method is unconditionally stable if it is stable for any time
step ∆t and space step h.
Examples :
∆t n
vin+1 = vin − n
(v − vi−1 )
h i
a finite difference scheme for ut + ux = 0
∆t
vin+1 = vin (1 − λ) + λvi−1
n
, λ=
h
If 0 < λ ≤ 1, then ||v n+1 ||∞ ≤ ||v n ||∞ ≤ . . . ≤ ||v 0 ||∞ . Therefore this scheme is l∞ -stable if
λ ≤ 1 (conditionally stable).
Consider the following implicit scheme:
vin = vin−1 − λ(vin − vi−1
n ) n ≥ 1 (backward time - backward space)
n
i.e, vin (1 + λ) − λvi−1 = vin−1 This can be written in the matrix form, Av n = v n−1 where
A = (aij ) with aii = (1 + λ) and aii−1 = −λ and aij = 0 if j 6= i, i − 1.
−λ
A = (1 + λ)[I + C] where C = (Cij ) with Cii−1 = 1+λ and Cij = 0 if j 6= i − 1. Hence
λ
||C||∞ ≤ 1+λ < 1. Hence A is invertible and
1 1
||A−1 ||∞ ≤
1 + λ 1 − ||C||∞
1 1
≤ λ
≤1
λ + 1 1 − 1+λ
Hence
v n = A−1 v n−1 , where v n = (. . . , vi−1
n
, vin , vi+1
n
. . .)T
||v n ||∞ ≤ ||A−1 ||∞ ||v n−1 ||∞ ≤ ||v n−1 ||∞ ≤ . . . ≤ ||v 0 ||∞
Hence this scheme is unconditionally stable.
Definition : A finite difference method is said to be linear if it is of the form
m2
X
vin+1 = n
cj vj+i where cj ′ s are constants
j=−m1
5
This implies
||Qn v 0 ||
||Qn || = sup 0 ||
≤ Keβt
0
||v ||6=0 ||v
Let u(x, t) be the exact solution of the problem P u = 0. Then
w n = v n − un , w 0 = v 0 − u0 = 0
wn = Qwn−1 + ∆t(O(hp ) + O(∆tq ))
= Q2 wn−2 + Q((O(hp ) + O(∆tq ))∆t) + ∆t(O(hp ) + O(∆tq ))
..
.
n−1
X
= Qn w0 + ∆t Qj (O(hp ) + O(∆tq ))
j=0
n−1
X
||wn || ≤ ∆t ||Qj ||(O(hp ) + O(∆tq ))
j=0
Let v = (vj )∞
j=−∞ be a sequence. Define the discrete Fourier transform of v by
X √
vb(ξ) = vj eijξ i= −1, ξ ∈ [0, 2π).
j
S+ v = (S+ vj )∞
j=−∞ , S+ vj = vj+1
6
Backward shift operator S− defined by
S− v = (S− vj )∞
j=−∞ , S− vj = vj−1
X X
Sd
+v = (S+ vj )eijξ = vj+1 eijξ
j j
X X
= vj ei(j−1)ξ = e−iξ vj eijξ
j j
−iξ
=e vb(ξ).
Similarly Sd iξ b(ξ).
−v = e v
Example :
ut + ux = 0
Consider the numerical scheme
∆t n
vin+1 = vin − n
(v − vi−1 )
h i
∆t
= (1 − λ)vin + λvi−1
n
, λ=
h
= (1 − λ)vin + λS− vin
= ((1 − λ) + λS− )vin = Q(S+ , S− )vin
⇒ v n+1 = Q(S+ , S− )v n
P n+1 ijξ
⇒ vbn+1 = v e
Pj j
= ((1 − λ) + λS− )vjn eijξ
Pj ijξ n P iξ n ijξ
= j (1 − λ)e vj + j λe vj e
= (1 − λ)vbn + λeiξ vbn = ((1 − λ) + λeiξ )vbn
= (1 − λ + λeiξ )vbn
In general
Definition : A symbol ρ(ξ) is said to satisfy the Von Neumann condition if there exists a
constant C > 0 (independent of ∆t, h, n and ξ) such that
Theorem : A finite difference method v n+1 = Qv n is stable in the l2 norm iff the Von-Neumann
condition is satisfied
Proof : Suppose the Von Neumann condition is satisfied. Let v n+1 = Qv n . By Parsevel ’s
relation
X Z2π
1
n+1 2
(vj ) = |vd
n+1 (ξ)|2 dξ
j
2π
0
7
upon multiplying by h
Z2π
h
||v n+1 ||22 = |vbn+1 (ξ)|2 dξ
2π
0
Z2π
h
= |ρ(ξ)|2 |vbn (ξ)|2
2π
0
Z2π
h
≤ (1 + C∆t)2 |vbn (ξ)|2 = (1 + C∆t)2 ||v n ||22
2π
0
⇒
⇒ scheme is l2 stable.
Conversely, suppose Von-Neumann condition is not satisfied. This implies for each C > 0 ∃
a number ξC ∈ [0, 2π) such that |ρ(ξC )| > (1 + C∆t). Since ρ(ξ) is a continuous function of ξ
there exists an interval [θ1 , θ2 ] in [0, 2π) such that
X Z2π
h
||v n+1 ||22 =h (vjn+1 )2 = |vbn+1 (ξ)|2 dξ
j
2π
0
Z2π
h
= |ρ(ξ)|2 |vbn (ξ)|2 dξ
2π
0
Z2π
h
= |ρ(ξ)|2(n+1) |vb0 (ξ)|2 dξ
2π
0
Zθ2
h
= |ρ(ξ)|2(n+1) |vb0 (ξ)|2 dξ
2π
θ1
h 2π
≥ (1 + C∆t)2(n+1) (θ2 − θ1 ) = (1 + C∆t)2(n+1)
2π h(θ2 − θ1 )
= (1 + C∆t)2(n+1) ||v 0 ||22
8
⇒
||v n+1 ||2 ≥ (1 + C∆t)n+1 ||v 0 ||2 for any C > 0
⇒ scheme is not l2 stable.
Examples : consider the equation
ut + aux = 0
u(x, 0) = u0 (x), a ∈ IR1
(1 + sgn a)
vin+1 = vin − λ a(vin − vi−1
n
)
2
(1 − sgn a) n
−λ a(vi+1 − vin )
2
(1 − sgn a) n (1 + sgn a) (1 − sgn a) n
= −aλ vi+1 + (1 − λa + aλ )vi
2 2 2
(1 + sgn a) n
+aλ vi−1
2
n
= vi+1 max(0, −aλ) + vin (1 − |λa|) + max(0, aλ)vi−1n
where λ = ∆t/h.
l∞ stability:
n
+ max(0, aλ) sup |vi−1 |
i
9
we have
∆ta n
vin+1 = vin − n
(vi+1 − vi−1 ) + O(h2 )
h
!
v n+1 − vin n )
(v n − vi−1 h2
⇒ i − a i+1 +O =0
∆t 2h ∆t
!
2 h2
= vt + O(∆t) + avx + O(h ) + O
∆t
h
= vt + avx + O(∆t) + O(h) is bounded.
if
∆t
The Lax-Friedrich’s Scheme is first order accurate i.e. p = 1, q = 1
l∞ Stability:
(1 − aλ) n (1 + aλ) n
vin+1 = vi+1 + vi−1
2 2
1 1
||v n+1 ||∞ = sup |vin+1 | ≤ n
|1 − aλ| sup |vi+1 n
| + |1 + aλ| sup |vi−1 |
i 2 i 2 i
1
≤ (|1 − aλ| + |1 + aλ|)||v n ||∞
2
≤ ||v n ||∞ if |aλ| ≤ 1
∆ta n a2 (∆t)2 n
vin+1 = vin − n
(vi+1 − vi−1 )+ (vi+1 − 2vin + vi−1
n
)
2h 2h2
This scheme is second order accurate i.e, p = q = 2
l2 stability :
10
λa −iξ a2 λ2 −iξ
ρ(ξ) = 1 − (e − eiξ ) + (e − 2 + eiξ )
2 2
λa iξ a2 λ2 iξ
= 1+ (e − e−iξ ) + (e + e−iξ − 2)
2 2
= 1 + λai sin ξ + a2 λ2 (cos ξ − 1)
= 1 − a2 λ2 (1 − cos ξ) + iλa sin ξ
ξ ξ
= 1 − 2a2 λ2 sin2 + iλa sin ξ (because 1 − cos ξ = 2 sin2 )
2 2
ξ
|ρ(ξ)|2 = 1 − 4a2 λ2 (1 − a2 λ2 ) sin4
2
|ρ(ξ)| ≤ 1 if |aλ| ≤ 1
Scheme is l2 stable. Hence converges in l2 norm
Remark : Lax-Wendroff scheme is not l∞ stable
4. Crank-Nicolson Scheme : Let u be the solution. Then
t+∆t
Z
u(x, t + ∆t) − u(x, t) 1
= ut (x, ξ)dξ
∆t ∆t
t
ut (x, t + ∆t) + ut (x, t)
= + O(∆t2 )
2
ux (x, t + ∆t) + ux (x, t)
= −a + O(∆t2 )
2
a (u(x + h, t + ∆t) − u(x − h, t + ∆t))
= −
2 2h
a (u(x + h, t) − u(x − h, t))
− + O(∆t2 ) + O(h2 )
2 2h
Crank-Nicolson scheme is given by
n+1 n+1
vin+1 − vin a (vi+1 − vi−1 n − vn )
) a (vi+1 i−1
=− −
∆t 2 2h 2 2h
This scheme is second order accurate i.e., p = q = 2
Let λ = ∆t
h
aλ n+1 aλ n+1 aλ n
− vi−1 + vin+1 + vi+1 = vin − (vi+1 − vi−1n
)
4 4
4
−aλ aλ aλ
S− + I + S+ vin+1 = I− (S+ − S− ) vin
4 4 4
aλ +iξ aλ −iξ n+1 aλ −iξ
− e +1+ e vb = 1− (e − e ) vbn
iξ
4 4 4
!
aλ
1 + i sin ξ
vbn+1 = 2
vbn
1 − aλ2 i sin ξ
aλ
1+ 2 i sin ξ z
ρ(ξ) = aλ
=
1− 2 i sin ξ
z
|ρ(ξ)| = 1
11
Hence the Scheme is unconditionally stable.
⇒ Crank-Nicolson is convergent in l2 norm
5. Unconditionally unstable scheme : Let a=1 in (1.1)
∆t n
vin+1 = vin − (v n
− vi−1 )
2h i+1
vin+1 − vin vi+1
n − vn
i−1
+ = vt + vx + O(∆t) + O(h2 ),
∆t 2h
order of accuracy = (p, q) = (2, 1)
λ −iξ
ρ(ξ) = 1 − (e − eiξ )
2
= 1 + iλ sin ξ
|ρ(ξ)|2 = 1 + λ2 sin2 ξ > 1 if ξ 6= 0, π
2 Parabolic equation
Consider the heat equation
vin+1 − vin b n
= 2 (vi+1 − 2vin + vi−1
n
) is of order (p, q) = (2, 1).
∆t h
l∞ Stability :
12
if λb ≤ 1/2 then scheme is l∞ stable
Define a scheme by
n+1
vin+1 − vin b (vi+1 − 2vin+1 + vi−1
n+1
)
= 2
∆t 2 h
n − 2v n + v n )
b (vi+1 i i−1
+
2 h2
This scheme is second order accurate i.e. p = q = 2.
⇒
b∆t n+1 b∆t n
(2.4) vin+1 = v n + 2
(vi+1 − 2vin+1 + vi−1
n+1
) + 2 (vi+1 − 2vin + vi−1
n
)
2h 2h
The scheme (2.4) is called Crank-Nicolson Scheme.
Then
(−θbλe−iξ + (1 + 2θbλ) − θbλeiξ )vbn+1 = (1 − θ)λbeiξ + (1 − 2(1 − θ)λb)
+(1 − θ)λbe−iξ vbn
13
ξ
1 − 4(1 − θ)λb sin2 2
ρ(ξ) = ξ
1 + 4θbλ sin2 2
ξ
Let w = 4λb sin2 2 Now −1 ≤ ρ(ξ) ≤ 1
1 − (1 − θ)w
⇒ −1≤ ≤1
1 + θw
or 2 + 2θw ≥ w ≥ 0,
w ≥ 0 is obvious. Therefore
If θ ≥ 1/2 (2.7) is obvious. For 0 ≤ θ < 1/2, (1−2θ) > 0. Hence |ρ(ξ)| ≤ 1 if (1−2θ)4λb ≤ 2.
Therefore θ scheme is unconditionally stable if θ ≥ 1/2 and conditionally stable (i.e. λb ≤
1
2(1−2θ) ) for 0 ≤ θ < 1/2.
A v n+1 = Bv n
where A = (aij ) is an infinite tridiagonal matrix with aii = (1+2θλb), aii−1 = aii+1 = −θλb and
aij = 0 if j 6= i, i−1, i+1. B = (bij ) is also an infinite matrix with bii = (1−2(1−θ)bλ), bii−1 =
bii+1 = (1 − θ)λb and bij = 0 if j 6= i, i − 1, i + 1.
−θλb
Now A = (1 + 2θλb)(I + C). Where C = (Cij ) be a matrix with Cii+1 = Cii−1 = 1+2θλb and
Cij = 0 if j 6= i − 1, i + 1
X 2θλb
||C||∞ = sup( |Cij |) = <1
i j
1 + 2θλb
1
⇒ ||A−1 ||∞ = ||(I + C)−1 ||∞ ≤ 1
1 + 2θλb
Now v n+1 = A−1 Bv n and
14
3 Elliptic equation
Consider the Dirichlet problem
∂2u ∂2u
(3.1) Pu = + 2 = f (x, y) in Ω = (0, 1) × (0, 1)
∂x2 ∂y
with boundary condition
Let us denote u(xi .yj ) = uji , f (xi , yj ) = fij and on boundary uji = vij = g(xi , yj ). Then the
numerical scheme corresponding to (3.1) can be written as
j
vi+1 j
− 2vij + vi−1 (vij+1 − 2vij + vij−1 )
(3.3) P∆x,∆y v = 2
+ 2
= fij
(∆x) (∆y)
which is second order accurate. Because if u is a solution of (3.1) then
Since the ratio of the mesh plays an insignificant role in the theory of elliptic problems. to
study the above problem we take ∆x = ∆y = h for simplicity. Then (3.3) becomes
j
vi+1 − 2vij + vi−1
j
+ (vij+1 − 2vij + vij−1 ) = h2 fij
i.e.,
Av = bg,f
i.e.
4 −1 −1 0 v11 g01 + g10 − h2 f11
−1 4
0 −1 v21 g31 + g20 − h2 f21
Av = = = bg, f.
−1 0 4 −1 v12 g02 + g13 − h2 f12
0 −1 −1 4 v22 g32 + g23 − h2 f22
15
Now A can be written as
" # " # " #
B −I 4 −1 1 0
A= , where B = , I=
−I B −1 4 0 1
A is a strictly diagonally dominant matrix. Hence A is invertible. Therefore above linear system
can be solved uniquely.
Now let us consider the case M = 4
16
where
4 −1 O
−1 4 −1
B=
. . .
O −1 4
with A is a matrix of order (M − 1)2 . B , O and I are matrices of order M − 1. v is a vector
given by
M −1 M −1 T
v = (v11 , v21 , . . . , vM
1 2 2 2
−1 , v1 , v2 , . . . , vM −1 , . . . , v1 , . . . , vM −1 )
and bg is a vector depends on the boundary values.
A is symmetric and positive definite. As A is tridioganal block matix there are several
methods like direct methods or iterative methods to solve the above system.
Convergence : Let u = u(x, y) be the actual solution of the problem and let ǫji = uji − vij
where uji = u(xi , yj ) = u(ih, jh) and vij is obtained from (3.4). Since ∆u = f we have
Lǫ̃ = Lǫ + M h2 Lw ≤ M h4 − M h4 = 0
⇒
1
ǫ̃ji ≤ (ǫ̃ji+1 + ǫ̃ji−1 + ǫ̃j+1
i + ǫij−1 )
4
⇒ ǫ̃ji attains maxima on the boundary
Let r denotes the radius of a circle about the origin enclosing the region Ω = (0, 1) × (0, 1).
Then
ǫ̃ji ≤ maximum of ǫji on the boundary +M h2 r 2
= 0 + M h2 r = M h2 r 2 ( because ǫji ≡ 0 on boundary)
Now define ǫji = ǫji − M h2 wij . By similar arguments one can show that
ǫji ≥ −M r 2 h2
References:
17
1. R.L. Burden, J.D. Faires and A.C. Reynolds, Numerical Analysis, Prindle, Weber and
Schmidt(1978).
2. E.Isaacson and H.B. Keller, Analysis of numerical methods, John Wiley and Sons(1966).
4. J.C. Strikwerda, Finite difference schemes and Partial differential equations, Wordsworth
and Brooks(1989).
APPENDIX:
Let v = (vj )∞ 2
j=−∞ be a comlex sequence in l . Define the discrete Fourier transform of v by
X √
vb(ξ) = vj eijξ i= −1, ξ ∈ [0, 2π)
j
. Then
(1)
Z2π
1
vj = vb(ξ) e−ijξ dξ
2π
0
X Z2π
2 1
|vj | = |vb(ξ)|2 dξ
j
2π
0
Proof: Let
Z2π
2 1
L [0, 2π] = {f : [0, 2π] → C, f is measureble and |f (x)|2 dx < ∞}
2π
0
Then {en = √1 einx }n∈N forms an orthonormal basis for L2 [0, 2π]. Therefore we have
2π
Z2π Z2π X
1 −ijξ 1
vb(ξ)e dξ = ( vn einξ )e−ijξ
2π 2π n
0 0
Z 2π
1 X
= vn ei(n−j)ξ )d ξ
2π n
0
= vj .
Also,
Z2π Z2π
1 2 1
|vb(ξ)| dξ = vb(ξ) vb(ξ)dξ
2π 2π
0 0
18
Z2π X X
1
= ( vn einξ ) ( vj eijξ )dξ
2π n j
0
2π
Z
1 X X
= ( vn einξ ) ( vj e−ijξ )dξ
2π n j
0
X
= |vj |2
j
19