Class 29th Jan

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

numerical methods for

differential equations and


applications

Supervisor: Camile Fraga Delfino Kunz

January 29th, 2019


What do we have for today?

Stability condition for numerical methods for PDEs:


Method of Lines;
Von Neumann analysis.
Diffusion problem

Consider the diffusion problem on the 1D space x ∈ [0, 1] and


time interval t ∈ [0, 1]:

∂ 2u

∂u
= D


 ∂t ∂u 2



u(x, 0) = η(x) , x ∈ [0, 1]
u(0, t) = g0 (t) , t>0





u(1, t) = g1 (t) , t>0

In this problem η(x) is the initial condition (t = 0), and the


functions g0 (t) and g1 (t) are the boundary conditions, and D
is the diffusion coefficient.
Diffusion problem

As we have seen before, we can use the following numerical


method to solve this problem:

Uin+1 − Uin 1 n
= 2 (Ui−1 n
− 2Uin + Ui+1 )
k h
This is an explicit method, that is, we can calculate each Uin+1
using the previous data, in fact,
k n
Uin+1 = Uin + n
(U − 2Uin + Ui+1 )
h2 i−1
for i = 1, . . . , m.
Diffusion problem

The questions are:


How good is this method for solving this problem in
particular? What can we do to try to find it out?
Of course, we want to know if the method converges.
That is, if we choose small k and h, we expect that, for
many initial conditions, it will behave like the original
continuous problem.
By the theory, the method will be convergent if it is
consistent and presents some kind of stability.
Let us first talk about consistency ...
Diffusion problem

A method is consistent if the local truncation error goes to


zero as k, h goes to zero. The local truncation error is
calculated by substituting the exact solution on the method.
For simplicity, let us consider the diffusion coefficient D = 1.

u(x, t + k) − u(x, t)
τ (x, t) =
k
1
− 2 ( u(x − h, t) − 2u(x, t) + u(x + h, t) )
h
Diffusion problem

...making Taylor’s expansion for some terms:


k2 k3 k4
u(x, t + k) = u + kut + utt + uttt + utttt + O(k 5 )
2! 3! 4!
h2 h3 h4
u(x + h, t) = u + hux + uxx + uxxx + uxxxx + O(h5 )
2! 3! 4!
h2 h3 h4
u(x − h, t) = u − hux + uxx − uxxx + uxxxx + O(h5 )
2! 3! 4!
Diffusion problem

Substituting the Taylor’s expansion on the LTE expression,


and considering that ut = uxx and utt = utxx = uxxxx , we get
that the method is first order accurate on time and second
order accurate on space:
1 1 
τ (x, t) = k − h2 uxxxx + O(k 2 + h4 )
2 12
So for k, h → 0 we have τ → 0 and the method is in fact
consistent.
Method of Lines

Considering the same diffusion equation with Dirichlet


boundaries conditions, we can discretize the space alone,
which gives us a system of ODEs:
1
Ui0 (t) = (Ui−1 (t) − 2Ui (t) + Ui+1 (t)) , for i = 1, 2, . . . , m.
h2
we can also write this system on a matrix and vector notation
U 0 (t) = AU(t) + g (t), that is,
−2
    

U10 (t)
 1 U1 (t) g0 (t)
 1 −2 1   U2 (t)   0 
 . 
1
  
1  . 
 
 U 0 (t)..  = . . . .
    
 .. .. ..  . +  .  (∗)
 2
h2 . 2  . 
U 0 h 
   
m−1 (t)    
0
 1 −2 1 Um−1 (t)  0 
Um (t) 1 −2 Um (t) g1 (t)
Stability theory

We have studied the stability theory for an ODE system.


Now we can apply this theory to the ODE system
obtained by the Method of Lines.
That is, we expect the method to be stable if kλ ∈ S, i.
e., if the time step k multiplied by any eigenvalue λ of A
lies on the stability region S of the ODE method.
If we want to solve the ODE system using Euler’s
method, we do U n+1 = U n + kAU n = (1 + kλ)U n ; and
using the hypothesis that A is a diagonalizable matrix, it
is possible to decouple the system into m equations, using
the eigenvalues λp of A, Vpn+1 = (1 + kλp )Vpn ; as we
know, the stability region will be |1 + kλp | ≤ 1.
Stability theory
Example:
Considering the ODE system (∗), if we want to study the
stability for solving it using Euler’s method, we should impose
|1 + kλp | ≤ 1, where λp for the matrix A is given by (A is a
circulant matrix, so it has some special features!):
2
λp = 2 (cos pπh − 1) , p = 1, 2, . . . , m
h
the stability condition implies that
2k
1 + 2 (cos pπh − 1) ≤ 1 , or,

h
2k
− 1 ≤ 1 + 2 (cos pπh − 1) ≤ 1
h
2k
− 2 ≤ 2 (cos pπh − 1) ≤ 0
h
Stability theory
Example:
2k
−2 ≤ (cos pπh − 1) ≤ 0
|{z} h2 |{z}
(1) (2)

We are going to analyse the inequalities separately.


The function cossine is bounded on the interval [−1, 1],
so the inequality (2) is satisfied for all k, h, p.
Now we have only the inequality (1): if it is satisfied for
the smallest value of the function on the right, it will be
satisfied for the other values. The minimum occurs for
cos pπh = −1, the stability condition for the method is:
k 1
2

h 2
Stability theory
Example:
So if we choose k and h such that

k 1
2

h 2

and using centered finite difference on space, the Euler’s


method applied to the diffusion equation (with D = 1, for
other values of D you should repeat the calculation and find
the stability condition!) will have a good behave. It happens
that to fulfill this condition, we have to take very small time
steps k, compared to space grid size. So maybe it is not the
best method to solve this problem! The Crank-Nicolson
method, for an example, is a unconditionally stable method, it
means that it converges for all choices of k and h!
Stability theory

Using the Method of Lines (MOL), we can write our original


PDE as

U n+1 = B(k)U n + b (∗∗)

Examples
- Euler: B(k) = I + kA
- Crank-Nicolson: B(k) = (I − k2 A)−1 (I + k2 A)
For stability for numerical methods for PDEs we need another
kind of stability definition.
Lax-Richtmyer stability

Definition:
A linear method of the form (∗∗) is Lax-Richtmyer stable if,
for each time T , there is a constant CT > 0 such that
kB(k)n k ≤ CT

for all k > 0 and integers n such that nk ≤ T .

Theorem (Lax equivalence theorem):


A consistent linear method of the form (∗∗) is convergent if
and only if it is Lax-Richtmyer stable.
Lax-Richtmyer stability

If there is a constant α so that a bound of the form

kB(k)k ≤ 1 + αk

holds in some norm (at least for sufficiently small time steps
k), then we will have Lax-Richtmyer stable in this norm, since

kB(k)n k ≤ (1 + αk)n ≤ e αT

for nk ≤ T . This result is important because bounding B(k)n


means to bound a matrix with exponent n, that is, i depends
on each n, and if we can get a general result looking only to
the matrix B(k) is easier to work. They say that we have
strong stability if kB(k)k ≤ 1.
Von Neumann analysis
The Von Neumann approach to stability analysis is based
on Fourier analysis;
Usually it is applied to a Cauchy problem which is the
PDE having as domain all the space with no boundaries,
−∞ ≤ x ≤ +∞ in the 1D case;
We can use Fourier transforms because of the property:
∂ iξx
e = iξe iξx ,
∂x
that is, the functions e iξx with wave number ξ (constant)
are eigenfunctions of the differential operator ∂/∂x;
Von Neumann analysis is based on the fact that the
related grid functions Wj = e ijhξ is an eigenfunction of
any translation invariance operator.
Von Neumann analysis

For an example, if we approximate v 0 (xj ) by


1 i(j+1)hξ
D0 Wj = (e − e i(j−1)hξ )
2h
1 ihξ
= (e − e −ihξ )e jhξ
2h
i
= sin hξe jhξ
h
i
Finally, D0 Wj = sin hξWj . So Wj is an eingengridfunction of
h
the operator D0 with eigenvalue hi sin hξ.
Von Neumann analysis
Suppose that we have a grid function Vj defined at grid points
xj = jh, for j = 0, ±1, ±2, . . ., which is a l2 (Banach sequence
space based on norm 2), in that sense, the 2-norm
 X+∞ 1/2
2
kUk2 = h |Uj |
j=−∞
is finite.
Then we can express Vj as a linear combination of the grid
functions e ijhξ for all ξ in range −π/h ≤ ξ ≤ π/h:
Z π/h
1
Vj = √ V̂ (ξ)e ijhξ dξ , where
2π −π/h
+∞
h X
V̂ (ξ) = √ Vj e −ijhξ
2π j=−∞
Von Neumann analysis

After Fourier transforming the finite difference method,w


e obtain a recurrence relation for each Û n (ξ) that is
decoupled from all wave numbers, it has the form:
Û n+1 (ξ) = g (ξ)Û n (ξ)

The factor g (ξ) is called amplification factor for the


method at wave number ξ.
If we can show that |g (ξ)| ≤ 1 + αk, for some α that
doesn’t depend on ξ, then the method is stable.
Von Neumann analysis

Theorem[2]:
A one-step finite difference scheme is stable in a stability
region S if and only if there is a α such that

|g (ξ)| ≤ 1 + αk

with k, h ∈ S. This stability condition can be replaced with


the restricted stability condition

|g (ξ)| ≤ 1

This theorem shows that to determine the stability of a finite


difference scheme we need to consider only the amplification
factor g (ξ).
Von Neumann analysis
Example:
k n
Consider the method Ujn+1 = Uin + 2 (Ui−1 − 2Uin + Uj+1
n
).
h
We take
Ujn = e ijhξ , and Ujn+1 = g (ξ)e ijhξ

Substituting on the method,


k
g (ξ)e ijhξ = e ijhξ + 2 (e i(j−1)hξ − 2e ijhξ + e i(j+1)hξ )
h
 k −ihξ 
= 1 + 2 (e − 2 + e ihξ ) e ijhξ
h
k
So the amplification factor is g (ξ) = 1 + 2 (cos ξh − 1).
h2
Von Neumann analysis

Example:
Since −1 ≤ cos ξh ≤ 1 for any ξ and h,
4k
1− ≤ g (ξ) ≤ 1 , ∀ξ
h2
4k
So |g (ξ)| ≤ 1 if ≤ 2, or,
h2

k 1

h2 2
References

1. Leveque, R. J. Finite Difference Methods for Ordinary


and Partial Differential Equations. SIAM, 2007.

2. Strikwerda, J. C. Finite Difference Schemes and Partial


Differential Equations. SIAM, Philadelphia, 2004.

You might also like