6 numerical solution of parabolic equations - tu-freiberg.de · 6 numerical solution of parabolic...
TRANSCRIPT
Numerical Analysis of Differential Equations 215
6 Numerical Solution of Parabolic Equations
6 Numerical Solution of Parabolic Equations TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 216
6.1 The One-Dimensional Model Problem
We consider the following initial boundary value problem (IBVP) modellingheat flow in a thin rod, i.e., in one space dimension:
ut = κuxx, x ∈ (0, 1), t > 0, (6.1a)
u(0, t) = g0(t), t > 0, (6.1b)
u(1, t) = g1(t), t > 0, (6.1c)
u(x, 0) = u0(x), x ∈ [0, 1] (6.1d)
with given (constant) heat conductivity κ (which we set to one in the follo-wing) as well as (possibly time-dependent) Dirichlet boundary values g0, g1
and initial data u0.
6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 217
• Steady-state version:
uxx = 0, u(0) = g0, u(1) = g1.
• Analogous IBVP in 2D and 3D:
ut = ∆u + initial and boundary data.
• Related: linear ordinary differential equation
ut = Au , u : t 7→ u(t) ∈ Rn.
Here linear differential operator ∂xx in place of matrix A.
6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 218
Series solution by separation of variables: in special cases an ana-lytic representation of the (exact) solution may be constructed using thetechnique of separation of variables. This is helpful for checking numeri-cal approximations and provides important insight into the structure of thesolution.
Inserting the special trial solution u(x, t) = f(x)g(t) into the PDE ut = uxxresults in
fg′ = f ′′g, i.e.g′
g=f ′′
f= const. =: −k2.
For each value of k we obtain a solution
uk(x, t) = e−k2t sin(kx)
of ut = uxx. The boundary condition u(0, t) = u(1, t) = 0 constrains k to thediscrete values
k = km := mπ, m ∈ N.
6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 219
Due to the linearity and homogeneity of ut = uxx any linear combination ofthese solutions is also a solution. If we succeed in finding coefficients amin such a way that
u0(x) =∞∑m=1
am sin(mπx),
then the series
u(x, t) :=∞∑m=1
ame−m2π2t sin(mπx)
solves the complete IBVP (6.1).
Since the functions {sin(mπx)}∞m=1 form a complete orthogonal system ofthe function space L2(0, 1), this is possible for all u0 ∈ L2(0, 1).
The coefficients are given by
am = 2
∫ 1
0
u0(x) sin(mπx) dx.
6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 220
Example:
u0(x) = 1− 2|x− 12 |.
Here the coefficients are
am =8
m2π2sin
mπ
2,
m ∈ N.
0 0.2 0.4 0.6 0.8 10
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
x
N=1N=3N=5N=19u
0(x)
Partial sums∑Nm=1 am sin(mπx)
of the Fourier series of u0.
6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 221
0 1 2 3 4 5 6 710
−120
10−100
10−80
10−60
10−40
10−20
100
m
t=0t=1/2
Decay of first 4 nonzero Fouriercoefficients of u0.
0
0.5
1
00.2
0.40.6
0.81
0
0.2
0.4
0.6
0.8
1
tx
Fourier series solution of IBVP (6.1) withκ = 1 and u0(x) = 1− 2|x− 1
2 |in domain (x, t) ∈ [0, 1]× [0, 1].
6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 222
We first discretize the IBVP (6.1) in the spatial variable x only, leaving timet continuous. To this end we proceed as in the elliptic case and introducethe grid points
0 = x0 < x1 < · · · < xJ < xJ+1 = 1
using a fixed grid spacing ∆x = 1/(J + 1) and approximate
uxx|x=xj ≈ [A∆xu ]j , j = 1, 2, . . . , J,
withA∆x =
1
∆x2tridiag(1,−2, 1). (6.2)
If u = u(t) denotes the vector with components
uj(t) ≈ u(xj , t), t > 0, j = 1, 2, . . . , J,
6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 223
then (6.1) is transformed into the semi-discrete system of ODEs
u ′(t) = A∆xu(t) + g(t), (6.3a)
u(0) = u0, (6.3b)
with [u0]j = u0(xj), j = 1, 2, . . . , J as well as
g(t) = 1/(∆x2)[g0(t), 0, . . . , 0, g1(t)]> ∈ RJ .
We can now solve (6.3) with known numerical methods for solving ODEs.Introducing the fixed time step ∆t > 0, we set
Unj ≈ [u(tn)]j ≈ u(xj , tn), tn = n∆t.
The approximation of the solution of a time-dependent PDE as a system ofODEs along the “lines” {(xj , t) : t > 0} is known as the method of lines.
6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 224
Applying the explicit Euler method to (6.3) (setting g0(t) = g1(t) = 0 fornow) leads to
Un+1j = Unj +
∆t
∆x2
(Unj−1 − 2Unj + Unj+1
), 1 ≤ j ≤ J, n = 0, 1, 2 . . . .
This corresponds to the finite difference approximation
Un+1j − Unj
∆t︸ ︷︷ ︸≈ut
=Unj−1 − 2Unj + Unj+1
∆x2︸ ︷︷ ︸≈uxx
(6.4)
of the differential equation (6.1a).
In matrix notation:
U n+1 = (I + ∆t A∆x)U n, n = 0, 1, 2, . . . ,
with U n = [Un1 , Un2 , . . . , U
nJ ]>.
6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 225
We define the local discretisation error of the difference scheme (6.4) tobe the residual obtained on inserting the exact solution into the differencescheme:
d(x, t) :=u(x, t+ ∆t)− u(x, t)
∆t− u(x−∆x, t)− 2u(x, t) + u(x+ ∆x, t)
∆x2.
Using Taylor expansions in (x, t) one easily obtains:
deE(x, t) =
(∆t
2− ∆x2
12
)uxxxx +O(∆t2) +O(∆x4). (6.5)
Terminology: the explicit Euler method for solving the heat equation isconsistent of first order in time and of second order in space.
6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 226
Besides the asymptotic statement (6.5) we also require upper bounds for d.Truncating the Taylor expansions with a remainder term, we obtain in time
u(x, t+ ∆t) = (u+ ∆t ut) |(x,t) +∆t2
2utt(x, τ), τ ∈ (t, t+ ∆t).
Proceeding analogously in x yields
deE(x, t) =∆t
2utt(x, τ)− ∆x2
12uxxxx(ξ, t), ξ ∈ (x−∆x, x+ ∆x),
and we obtain, setting µ := ∆t∆x2 ,
|deE(x, t)| ≤ ∆t
2Mtt −
∆x2
12Mxxxx =
∆t
2
(Mtt +
1
6µMxxxx
), (6.6)
assuming |utt| ≤Mtt und |uxxxx| ≤Mxxxx on [0, 1]× [0, T ].
6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 227
Applying the implicit Euler method to (6.3) one obtains, in place of (6.4),the implicit difference scheme
Un+1j − Unj
∆t=Un+1j−1 − 2Un+1
j + Un+1j+1
∆x2. (6.7)
The calculation of un+1 from un is seen to require the solution of a linearsystem of equations with coefficient matrix I −∆tA∆x.
Here Taylor expansion results in a local discretization error of
diE(x, t) = −(
∆t
2+
∆x2
12
)uxxxx +O(∆t2) +O(∆x4).
6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 228
Applying instead the trapezoidal rule, which for an ODE y ′(t) = f (t,y(t))
is given by
yn+1 = yn +∆t
2
[f (tn,y
n) + f (tn+1,yn+1)
]yields another implicit scheme
Un+1j − Unj
∆t=
1
2
(Unj−1 − 2Unj + Unj+1
∆x2+Un+1j−1 − 2Un+1
j + Un+1j+1
∆x2
),
which in this context is known as the Crank-Nicolson schemea. This methodis also implicit, requiring in each time step the solution of a linear system ofequations with the coefficient matrix I − ∆t
2 A∆x.
For Crank-Nicolson (CN) there holds
dCN(x, t) = O(∆t2) +O(∆x2).
aJ. CRANK AND P. NICOLSON (1947)
6.1 The One-Dimensional Model Problem TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 229
6.2 Convergence
All three methods considered so far are consistent, i.e., at all points (x, t)
of the domain we have d(x, t)→ 0 as ∆x→ 0 and ∆t→ 0.
To analyze their convergence, we proceed as in the case of numericalmethods for ODEs and consider a finite time interval t ∈ [0, T ], T > 0
as well as a sequence of grids with grid spacings ∆x → 0, ∆t → 0 anddetermine whether at every fixed grid point (xj , tn) also the global erroru(xj , tn)− Unj tends to zero uniformly.
A sequence of grid spacings {(∆x)k, (∆t)k} can approach the point (0, 0)
in different ways. The following figure shows different “refinement curves”in the (∆x,∆t)-plane.
We will see that the explicit Euler method converges only if the refinementsatisfies
µ :=∆t
∆x2≤ 1
2.
6.2 Convergence TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 230
0 0.1 0.2 0.3 0.4 0.5 0.6 0.70
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
0.45
0.5
∆ x
∆ t
∆ t = ∆ x2/4
∆ t = ∆ x2/2
∆ t = ∆ x2
∆ t = ∆ x∆ t = ∆ x/2
Different refinement curves ∆t,∆x→ 0:red: ∆t/∆x2 = const, blue: ∆t/∆x = const.
6.2 Convergence TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 231
Theorem 6.1 If a sequence of grids satisfies
µk =(∆t)k(∆x)2
k
≤ 1
2for all k sufficiently large,
and if for the corresponding sequences {jk} and {nk} there holds
nk(∆t)k → t ∈ [0, T ], jk(∆x)k → x ∈ [0, 1],
then, under the assumption that |uxxxx| ≤Mxxxx uniformly in [0, 1]× [0, T ],the approximations generated by the explicit Euler method (6.4) convergeto the exact solution u(x, t) as k →∞ uniformly on [0, 1]× [0, T ].
6.2 Convergence TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 232
0 0.2 0.4 0.6 0.8 110
−7
10−6
10−5
10−4
10−3
10−2
t
En
expl. Euler dx=1/10expl. Euler dx=1/20Crank Nicolson, dx = 1/10Crank Nicolson, dx = 1/20
Error E(tn) = maxj |unj − Unj | of numerical solution of model problem(6.1) withg0 = g1 = 0 and u0(x) = x(1− x) obtained with explicit Euler method with
∆t = ∆x2/2 and the Crank-Nicolson method with ∆t = ∆x/2.
6.2 Convergence TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 233
6.3 Stability
In the method of lines, an ODE solver is applied to the semidiscrete system(6.3). Recalling the regions of absolute stability of the explicit and implicitEuler and trapezoidal methods, we are led to investigate the behavior ofthe eigenvalues of the matrix A∆x in (6.2) as ∆x→ 0.
−3 −2 −1 0 1−2
−1.5
−1
−0.5
0
0.5
1
1.5
2
explicit EulerR(λ) = 1 + λ
−1 0 1 2 3−2
−1.5
−1
−0.5
0
0.5
1
1.5
2
implicit EulerR(λ) = 1
1−λ
−2 −1 0 1 2−2
−1.5
−1
−0.5
0
0.5
1
1.5
2
trapezoidalR(λ) = 1+λ/2
1−λ/2
6.3 Stability TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 234
The eigenvalues of A∆x (cf. (5.7)) are given by
λj = − 4
∆x2sin2 jπ∆x
2, j = 1, 2 . . . , J.
The eigenvalue of largest magnitude is
λJ = − 4
∆x2sin2
(π2
(1−∆x))
=−4
∆x2+ π2 +O
(∆x2) .
Therefore, in order to satisfy
|R(∆t λj
)| ≤ 1 for all j = 1, 2, . . . , J
in the explicit Euler method, it is necessary that
∆t
∆x2≤ 1
2. (6.8)
Both implicit Euler and the trapezoidal rule are absolutely stable methods. Therefo-re, as all eigenvalues of A∆x lie in the left half plane, the requirement of absolutestability places no constraints on the time step ∆t.Since the CN scheme (trapezoidal rule) is consisten of order 2 in both x and t, thissuggests a time step ∆t ≈ ∆x.
6.3 Stability TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 235
Absolute stability describes the behavior of a numerical approximation un
at time tn of the solution of an ODE as n → ∞. The appropriate stabilityconcept for the convergence analysis of numerical methods for solvingIVPs for PDEs was developed by Laxa and Richtmyerb.
All three methods considered so far can be written in the formc
U n+1 = B(∆t)U n + gn(∆t), n = 0, 1, . . . (6.9)
with different matrices B(∆t) given in each case by
BeE(∆t) = I + ∆t A∆x, (6.10a)
B iE(∆t) = (I −∆t A∆x)−1, (6.10b)
BCN(∆t) =
(I − ∆t
2A∆x
)−1(I +
∆t
2A∆x
). (6.10c)
aPETER D. LAX (∗ 1906)bROBERT DAVIS RICHTMYER (1910–2003)cWe assume that ∆t is chosen as a fixed given function of ∆x.
6.3 Stability TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 236
A linear finite difference scheme of the form (6.9) is called Lax-Richtmyerstable, if for any fixed stopping time T there exists a constant KT > 0 suchthat
‖B(∆t)n‖ ≤ KT , ∀∆t > 0 and n ∈ N, n∆t ≤ T.
Theorem 6.2 (Lax-Richtmyer equivalence theorem) A consistent linearfinite difference scheme (6.9) is convergent if, and only if, it is Lax-Richtmyerstable.
Examples: For the explicit Euler method applied to (6.1) the resultingmatrix (6.10a) is normal, implying ‖B(∆t)‖2 = ρ(B(∆t)). If condition (6.8)is satisfied, we have ‖B(∆t)‖2 ≤ 1, implying that the explicit Euler methodis Lax-Richtmyer stable and therefore convergent.
The implicit Euler and Crank-Nicolson schemes are also Lax-Richtmyerstable but without constraints on the mesh ratio or time step.
6.3 Stability TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 237
Remark 6.3 In all three schemes considered so far we were able to showthe stronger statement ‖B(∆t)‖ ≤ 1, which is sometimes called strong sta-bility. However, strong stability is not necessary for Lax-Richtmyer stability.
More precisely, for Lax-Richtmyer stability it is necessary that there exist aconstant α such that
‖B(∆t)‖ ≤ 1 + α∆t (6.11)
for all sufficiently small time steps ∆t, which is evident from the inequality
‖B(∆t)n‖ ≤ (1 + α∆t)n ≤ eαT , ∀ n∆t ≤ T.
6.3 Stability TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 238
6.4 Von-Neumann Analysis
A formal procedure based on Fourier analysis for determining stabilitybounds was introduced by von Neumann a.
In general, von Neumann analysis only yields necessary conditions, whichare also sufficient only in special cases, among these linear PDEs with con-stant coefficients, unbounded spatial domain (Cauchy problem) or periodicboundary conditions, uniform grid.
Fundamental fact: in the continuous case (x ∈ R) the functions eiξx, ξ ∈ R,are eigenfunctions of the differential operator ∂x, i.e.,
∂xeiξx = iξ eiξx,
and thus are also eigenfunctions of any linear differential operator withconstant coefficients.
aJOHN VON NEUMANN (1903–1957)
6.4 Von-Neumann Analysis TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 239
On the unbounded spatial grid {xj = j∆x}j∈Z the grid function
vj := eiξxj = eiξj∆x, j ∈ Z,
is an eigenfunction of any difference operator with constant coefficients.
Example: For the central difference operator δ0 defined as(δ0v)j := (vj+1 − vj−1)/(2∆x) there holds
δ0vj := (δ0v)j =eiξ(j+1)∆x − eiξ(j−1)∆x
2∆x=eiξ∆x − e−iξ∆x
2∆xeiξj∆x
=i
∆xsin(ξ∆x) vj
The power series expansion
i
∆xsin(ξ∆x) =
i
∆x
(ξ∆x− (ξ∆x)3
6+O
((ξ∆x)5)) = iξ +O(∆x2ξ3)
shows that the eigenvalue of δ0 approximates the corresponding eigenvalue of ∂x.
6.4 Von-Neumann Analysis TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 240
Any grid function on {xj = j∆x : j ∈ Z} can be represented as the superposition
vj =1
2π
∫ π/∆x
−π/∆xv(ξ)eiξj∆x dξ, j ∈ Z
of “grid waves” eiξj∆x, ξ ∈ [−π∆x, π
∆x] with Fourier coefficients v(ξ) given by
v(ξ) = ∆x
∞∑j=−∞
vje−iξj∆x, ξ ∈
[−π∆x
,π
∆x
].
If the magnitude of grid functions and their Fourier coefficients are measured by
‖v‖ =
(∆x
∞∑j=−∞
|vj |2)1/2
and ‖v‖ =
(∫ π/∆x
−π/∆x|v(ξ)|2 dξ
)1/2
,
then Parseval’s identity states that
‖v‖ =√
2π‖v‖. (6.12)
6.4 Von-Neumann Analysis TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 241
The bound ‖B‖ ≤ 1 + α∆t requires verifying
‖Bu‖ ≤ (1 + α∆t)‖u‖ ∀u.
According to (6.12), an equivalent condition is
‖Bu‖ ≤ (1 + α∆t)‖u‖ ∀u, (6.13)
which is easier to show because the Fourier coefficients are decoupled.
For a one-step method one obtains
un+1(ξ) = g(ξ) un(ξ)
with a so-called amplification factor g(ξ). If we are able to show that
|g(ξ)| ≤ 1 + α∆t.
with a constant α which is independent of ξ, then this implies (6.13).
6.4 Von-Neumann Analysis TU Bergakademie Freiberg, SS 2012
Numerical Analysis of Differential Equations 242
Examples:
(a) For the explicit Euler scheme applied to (6.3) we obtain the amplificationfactor
g(ξ) = 1− 4∆t
∆x2sin2 ξ∆x
2.
(b) For Crank-Nicolson,
g(ξ) =1 + z(ξ)
1− z(ξ), z(ξ) =
∆t
∆x2
(−1 + cos(ξ∆x)
)≤ 0 ∀ξ.
6.4 Von-Neumann Analysis TU Bergakademie Freiberg, SS 2012