numerical methods for differential · pdf filenumerical methods for differential equations ......
TRANSCRIPT
Numerical Methods for Differential Equations
Chapter 5: Partial differential equations – elliptic and pa rabolic
Gustaf Soderlind and Carmen Arevalo
Numerical Analysis, Lund University
Textbooks: A First Course in the Numerical Analysis of Differential Equations, by Arieh Iserles
and Introduction to Mathematical Modelling with Differential Equations, by Lennart Edsberg
c© Gustaf Soderlind, Numerical Analysis, Mathematical Sciences, Lund University, 2008-09
Numerical Methods for Differential Equations – p. 1/50
1. Brief overview of PDE problems
Classification: Three basic types, four prototype equations
Elliptic
∆u = 0 + BC
Parabolic
ut = ∆u + BC & IC
Hyperbolic
utt = ∆u + BC & IC
ut + a(u)ux = 0 + BC & IC
Numerical Methods for Differential Equations – p. 2/50
Classification of PDEs
Linear PDE with two independent variables
Auxx + 2Buxy + Cuyy + L(ux, uy, u, x, y) = 0
with L linear in ux, uy, u. Study
δ := det
A B
B C
= AC − B2
Elliptic δ > 0 Parabolic δ = 0 Hyperbolic δ < 0
Numerical Methods for Differential Equations – p. 3/50
Standard PDEs. Prototypical problems
δ > 0 Elliptic PDE Laplace equation
uxx + uyy = 0 A = C = 1; B = 0
δ = 0 Parabolic PDE Diffusion equation
ut = uxx A = 1; B = C = 0
δ < 0 Hyperbolic PDEs Wave equation
utt = uxx A = 1; B = 0; C = −1
Numerical Methods for Differential Equations – p. 4/50
PDE method types
FDM Finite difference methods
FEM Finite element methods
FVM Finite volume methods
BEM Boundary element methods
We will mostly study FDM to cover basic theory
Industrial relevance: FEM
Numerical Methods for Differential Equations – p. 5/50
PDE methods for elliptic problems
Simple geometry FDM or Fourier methods
Complex geometry FEM
Special problems FVM or BEM
Large sparse systemsCombine with iterative solvers such as multigrid methods
Numerical Methods for Differential Equations – p. 6/50
PDE methods for parabolic problems
Simple geometry FDM or Fourier methods
Complex geometry FEM
StiffnessAlways use A–stable time-stepping methods
Need Newton-type solvers for large sparse systems
Numerical Methods for Differential Equations – p. 7/50
PDE methods for hyperbolic problems
FDM, FVM. Sometimes FEM
ShocksSolutions may be discontinuous – example: “sonic boom”
TurbulenceMultiscale phenomena
Hyperbolic problems have several complications and manyhighly specialized techniques are often needed
Numerical Methods for Differential Equations – p. 8/50
2. Elliptic problems. FDM
Laplacian ∆ =∂2
∂x2+
∂2
∂y2+
∂2
∂z2
Laplace equation ∆u = 0
with boundary conditions u = u0(x, y, z) x, y, z ∈ ∂Ω
Poisson equation −∆u = f
with boundary conditions u = u0(x, y, z) x, y, z ∈ ∂Ω
Other boundary conditions also of interest (∂Ω = bdry of Ω)
Numerical Methods for Differential Equations – p. 9/50
Elliptic problems. Some applications
Equilibrium problems
Structural analysis (strength of materials)
Heat distribution
Potential problems
Potential flow (inviscid, subsonic flow)
Electromagnetics (fields, radiation)
Eigenvalue problems
Acoustics
Microphysics
Numerical Methods for Differential Equations – p. 10/50
Poisson equation – an elliptic model problem
∂2u
∂x2+
∂2u
∂y2= f(x, y)
Computational domain Ω = [0, 1] × [0, 1] (unit square)Dirichlet conditions u(x, y) = 0 on boundary
Uniform grid xi, yjN,Mi,j=1 with equidistant mesh widths
∆x = 1/(N + 1) and ∆y = 1/(M + 1)
Discretization Finite differences with ui,j ≈ u(xi, yj)
ui−1,j − 2ui,j + ui+1,j
∆x2+
ui,j−1 − 2ui,j + ui,j+1
∆y2= f(xi, yj)
Numerical Methods for Differential Equations – p. 11/50
Equidistant mesh ∆x = ∆y
ui−1,j + ui,j−1 − 4ui,j + ui,j+1 + ui+1,j
∆x2= f(xi, yj)
Participating approximations and mesh points
xi−1 xi xi+1
yj
yj+1
yj−1
Numerical Methods for Differential Equations – p. 12/50
Computational “stencil” for ∆x = ∆y
ui−1,j + ui,j−1 − 4ui,j + ui,j+1 + ui+1,j
∆x2= f(xi, yj)
“Five-point operator”1
1 −4 1
1
Numerical Methods for Differential Equations – p. 13/50
The FDM linear system of equations
Lexicographic ordering of unknowns ⇒ partitioned system
1
∆x2
T I 0 . . .
I T I
I T I
. . . I
. . . 0 I T
u·,1
u·,2
u·,3
...
u·,N
=
f(x·, y1)
f(x·, y2)
f(x·, y3)...
f(x·, yN )
with Toeplitz matrix T = tridiag(1 −4 1)
The system is N 2 × N 2, hence large and very sparse
Numerical Methods for Differential Equations – p. 14/50
3. Elliptic problems. FEM
Finite Element Method
PDE Lu = 0
Ansatz u =∑
ciϕi ⇒ Lu =∑
ciLϕi
Requirement 〈ϕi, Lu〉 = 0 gives coefficients ci
FEM is a least squares approximation, fitting a linearcombination of basis functions ϕi to the differentialequation using orthogonality
Simplest case Piecewise linear basis functions
Numerical Methods for Differential Equations – p. 15/50
Strong and weak forms
Strong form
−∆u = f ; u = 0 on ∂Ω
Take v with v = 0 on ∂Ω∫
Ω
−∆u · v =
∫
Ω
f · v
Integrate by parts to get weak form∫
Ω
∇u · ∇v =
∫
Ω
f · v
Numerical Methods for Differential Equations – p. 16/50
Strong and weak forms. 1D case
Recall integration by parts in 1D
∫ 1
0
−u′′v = [−u′v]10 +
∫ 1
0
u′v′
or in terms of an inner product
−〈u′′, v〉 = 〈u′, v′〉
Generalization to 2D, 3D uses vector calculus
Numerical Methods for Differential Equations – p. 17/50
Weak form of −∆u = f
Define inner product
〈v, u〉 =
∫
Ω
vu dΩ
and energy norm (note scalar product!)
a(v, u) =
∫
Ω
∇v · ∇u dΩ
to get the weak form of −∆u = f as
a(v, u) = 〈v, f〉
Numerical Methods for Differential Equations – p. 18/50
Galerkin method (Finite Element Method)
1. Basis functions ϕi2. Approximate u =
∑
cjϕj
3. Determine cj from∑
cj
∫
∇ϕi · ∇ϕj =∫
fϕi
The cj are determined by the linear system
Kc = F
The matrix K is called stiffness matrix
Stiffness matrix elements kij =∫
∇ϕi · ∇ϕj = a(ϕi, ϕj)
Right-hand side Fi =∫
ϕif = 〈ϕi, f〉
Numerical Methods for Differential Equations – p. 19/50
The FEM mesh. Domain triangulation
Piecewise linear basis ϕj require domain triangulation
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Numerical Methods for Differential Equations – p. 20/50
4. Parabolic problems
The prototypical equation is the
Diffusion equation ut = ∆u
Nonlinear diffusion
ut = div (k(u)gradu)
Boundary and initial conditions are needed
Numerical Methods for Differential Equations – p. 21/50
Parabolic problems. Some applications
Diffusive processes
Heat conduction ut = d · uxx
Chemical reactions
Reaction–diffusion ut = d · uxx + f(u)
Convection–diffusion ut = ux + 1Pe
uxx
Irreversibility ut = −∆u is not well-posed!
Numerical Methods for Differential Equations – p. 22/50
Diffusion – a parabolic model problem
Equation ut = uxx
Initial values u(x, 0) = g(x)
Boundary values u(0, t) = u(1, t) = 0
Separation of variables u(x, t) := X(x)T (t) ⇒
ut = XT , uxx = X ′′T ⇒ T
T=
X ′′
X=: λ
T = Ceλt X = A sin√−λx + B cos
√−λx
Numerical Methods for Differential Equations – p. 23/50
Parabolic model problem. . .
Boundary values
X(0) = X(1) = 0 ⇒ λk = −(kπ)2, therefore
Xk(x) =√
2 sin kπx Tk(t) = e−(kπ)2t
Initial values
Fourier expansion g(x) =∑
∞
1 ck
√2 sin kπx ⇒
u(x, t) =√
2
∞∑
k=1
cke−(kπ)2tsin kπx
Numerical Methods for Differential Equations – p. 24/50
5. Method of lines (MOL) discretization
In ut = uxx, discretize ∂2/∂x2 by
uxx ≈ ui−1 − 2ui + ui+1
∆x2
System of ODEs (semidiscretization) u = T∆xu
u =1
∆x2
−2 1
1 −2 1. . .
1 −2
u
Numerical Methods for Differential Equations – p. 25/50
Full FDM discretization
Note that ui(t) ≈ u(x, t) along the line x = xi in (x, t) plane
Use time-stepping to solve the IVP; Explicit Euler withui,j ≈ u(xi, tj) implies
ui,j+1 − ui,j
∆t=
ui−1,j − 2ui,j + ui+1,j
∆x2
With the Courant number µ = ∆t/∆x2 we obtain recursion
ui,j+1 = ui,j + µ · (ui−1,j − 2ui,j + ui+1,j)
Numerical Methods for Differential Equations – p. 26/50
Method of lines. The grid
Rectangular grid (i · ∆x, j · ∆t), i = 0 : N + 1, j ≥ 0 with∆x = 1/(N + 1)
0 1 2 3 4 5 6 70
1
2
3
4
5
6
7
8
t
x
ui,j ≈ u(i · ∆x, j · ∆t)
Numerical Methods for Differential Equations – p. 27/50
Method of lines. Computational stencil
Explicit Euler time stepping. Participating grid points
xi−1 xi xi+1
tj
tj+1
Courant number µ = ∆t/∆x2
1
−µ 2µ−1 −µ
Numerical Methods for Differential Equations – p. 28/50
Method of lines. Stability and the CFL condition
Explicit Euler with ∆x = 1/(N + 1) implies recursion
u·,j+1 = u·,j + ∆t · T∆xu·,j
Recall λk[T∆x] = −4(N + 1)2 sin2 kπ
2(N + 1)for k = 1 : N
Stability requires ∆t · λk ∈ S for all eigenvalues
−2.5 −2 −1.5 −1 −0.5 0 0.5−1.5
−1
−0.5
0
0.5
1
1.5
Re
Im
∆t · λk ∈[
− 4∆t
∆x2,−π2∆t
]
S
Numerical Methods for Differential Equations – p. 29/50
The CFL condition
For stability we need 4∆t/∆x2 ≤ 2
CFL condition (Courant, Friedrichs, Lewy 1928)
∆t
∆x2≤ 1
2
The CFL condition is a severe restriction on time step ∆t
Stiffness The CFL condition can be avoided by usingA-stable methods, e.g. Trapezoidal Rule or Implicit Euler
Numerical Methods for Differential Equations – p. 30/50
Experimental stability investigation
N = 30 internal pts in [0, 1], M = 187 time steps on [0, 0.1]
Stable solution at CFL = .514
00.02
0.040.06
0.080.1
0
0.2
0.4
0.6
0.8
10
0.2
0.4
0.6
0.8
1
Numerical Methods for Differential Equations – p. 31/50
Violating the CFL condition. Instability
N = 30 internal pts in [0, 1], M = 184 time steps on [0, 0.1]
Unstable solution at CFL = .522
00.02
0.040.06
0.080.1
0
0.2
0.4
0.6
0.8
1−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
Numerical Methods for Differential Equations – p. 32/50
Crank–Nicolson method (1947)
Crank–Nicolson method ⇔ Trapezoidal Rule for PDEs
The trapezoidal rule is
implicit ⇒ more work/step
A–stable ⇒ no restriction on ∆t
Theorem Crank–Nicolson is unconditionally stable
There is no CFL condition on the time-step ∆t
Numerical Methods for Differential Equations – p. 33/50
Crank–Nicolson method. . .
Courant number µ = ∆t/∆x2 ⇒ recursion
(I − µ
2T )u·,j+1 = (I +
µ
2T )u·,j
with Toeplitz matrix T = tridiag(1 − 2 1)
Tridiagonal structure ⇒ low complexity
Refactorize only if Courant number µ = ∆t/∆x2 changes
Numerical Methods for Differential Equations – p. 34/50
6. Error analysis. Convergence
MOL with explicit Euler for ut = uxx
Global error ei,j = ui,j − u(xi, tj)
Local error Insert exact solution to get
u(xi, tj+1) − u(xi, tj)
∆t=
=u(xi−1, tj) − 2u(xi, tj) + u(xi+1, tj)
∆x2− li,j
Expand local error li,j in Taylor series
Numerical Methods for Differential Equations – p. 35/50
Local error
Taylor expansion
−li,j = ut − uxx +∆t
2utt +
∆x2
12uxxxx + O(∆t2,∆x4)
Therefore
−li,j =∆t
2utt +
∆x2
12uxxxx + O(∆t2,∆x4)
Numerical Methods for Differential Equations – p. 36/50
The Lax Principle
Conclusion
Consistency li,j → 0 as ∆t,∆x → 0
Stability CFL condition ∆t/∆x2 ≤ 1/2
Convergence ei,j → 0 as ∆t,∆x → 0
Theorem (Lax Principle)
Consistency + Stability ⇒ Convergence
Note Choice of norm is very important
Numerical Methods for Differential Equations – p. 37/50
The order of the method
With local error
−li,j =∆t
2utt +
∆x2
12uxxxx = O(∆t,∆x2)
and stability in terms of CFL condition µ = ∆t/∆x2 ≤ 1/2
we have global error ei,j = O(∆t,∆x2)
For fixed µ we have ∆t ∼ ∆x2 and it follows that
Global error ei,j = O(∆t,∆x2) = O(∆x2) ⇒
Theorem The order of convergence is p = 2
Numerical Methods for Differential Equations – p. 38/50
Order of PDE discretizations
Discretization process from PDE to SD to FD
ut = uxx → v∆x = P∆xv∆x + h∆x(t) → uj+1µ = Aµu
jµ + kj
µ
Suppose
order of SD scheme for spatial variables is p1
order of ODE time discretization is p2
Theorem If ∆t = µ∆x2 the FD order of convergence isp = minp1, 2p2
Numerical Methods for Differential Equations – p. 39/50
Example. The Crank–Nicolson method
From Trapezoidal rule yn+1 = yn + h2[f(yn) + f(yn+1)]
uj+1i = uj
i +∆t
2∆x2[(uj
i−1 − 2uji + uj
i+1) + (uj+1i−1 − 2uj+1
i + uj+1i+1 )]
−µ
2uj+1
i−1 + (1 + µ)uj+1i − µ
2uj+1
i+1 =µ
2uj
i−1 + (1 − µ)uji +
µ
2uj
i+1
Same order p = min2, 4 = 2 as with Explicit Euler
xi−1 xi xi+1
tj
tj+1
Numerical Methods for Differential Equations – p. 40/50
Crank–Nicolson. Stability
Aµ = (I − µ
2T )−1(I +
µ
2T ) with usual Toeplitz matrix T
Theorem The eigenvalues are λ[Aµ] =1 + µ
2λ[T ]
1 − µ
2λ[T ]
Note λ[T ] ∈ (−4, 0) ⇒ −1 < λ[Aµ] < 1 This implies thatthere is no CFL stability condition on the Courant ratio µ!The method is stable for all ∆t > 0
Theorem Crank–Nicolson is unconditionally stable
Numerical Methods for Differential Equations – p. 41/50
Experimental stability investigation
N = 30 internal pts in [0, 1], M = 30 time steps on [0, 0.1]
Stable solution at CFL = 3.2
00.02
0.040.06
0.080.1
0
0.2
0.4
0.6
0.8
10
0.2
0.4
0.6
0.8
1
Numerical Methods for Differential Equations – p. 42/50
7. Parabolic problems. FEM
Consider diffusion problem in strong form ut − uxx = 0 withDirichlet boundary conditions
Multiply by test function v and integrate by parts
∫ 1
0
vut dx +
∫ 1
0
v′u′ dx = 0
In terms of inner product and energy norm –
Weak form 〈v, ut〉+a(v, u) = 0 for all v with v(0) = v(1) = 0
Numerical Methods for Differential Equations – p. 43/50
Galerkin method (Finite Element Method)
1. Basis functions ϕi2. Approximate u(t, x) =
∑
cj(t)ϕj(x)
3. Determine cj from 〈ϕi, ut〉 + a(ϕi, u) = 0
Note 〈ϕi, ut〉 =∑
cj〈ϕi, ϕj〉 and a(ϕi, u) =∑
cj〈ϕ′
i, ϕ′
j〉
We get an initial value problem
B∆xc + K∆xc = 0
for the determination of the coefficients cj(t) with c(0)
determined by the initial condition
Numerical Methods for Differential Equations – p. 44/50
Galerkin method
Simplest casePiecewise linear basis functions on equidistant grid
Stiffness matrix elements kij = 〈ϕ′
i, ϕ′
j〉
K∆x =1
∆xtridiag(−1 2 −1)
and mass matrix elements bij = 〈ϕi, ϕj〉
B∆x =∆x
6tridiag(1 4 1)
Numerical Methods for Differential Equations – p. 45/50
Simplest Galerkin FEM. . .
Note that in the initial value problem
B∆xc + K∆xc = 0
the matrix B∆x is tridiagonal ⇒ no advantage fromexplicit time stepping methods
Explicit Euler
B∆x(cn+1 − cn) = −∆t · K∆xcn
requires the solution of a tridiagonal system on every step
Numerical Methods for Differential Equations – p. 46/50
Simplest Galerkin FEM. . .
As the system is stiff, consider implicit A-stable method
B∆x(cn+1 − cn) = − ∆t
2· K∆x(cn + cn+1)
and solve tridiagonal system
(B∆x +∆t
2K∆x)cn+1 = (B∆x −
∆t
2K∆x)cn
on every step
Trapezoidal rule has same cost, but better stability
Numerical Methods for Differential Equations – p. 47/50
8. Well-posedness
Linear partial differential equationut = Lu + f, 0 ≤ x ≤ 1, t ≥ 0, u(x, 0) = h(x),
u(0, t) = φ0(t), u(1, t) = φ1(t)
Suppose
wt = Lw + f, w(x, 0) = h(x)
vt = Lv + f, v(x, 0) = h(x) + g(x)
Subtract to get homogeneous Dirichlet problem
ut = Lu, u(x, 0) = g(x), φ0(t) ≡ 0, φ1(t) ≡ 0
Numerical Methods for Differential Equations – p. 48/50
Well-posedness. Time evolution
Suppose time evolution u(x, t) = E(t)g(x)
Definition The equation is well-posed if for every t∗ > 0
there is a constant 0 < C(t∗) < ∞ such that‖E(t)‖ ≤ C(t∗) for all 0 ≤ t ≤ t∗
Theorem A well-posed equation has a solution that
depends continuously on the initial value (the “data”)
is uniformly bounded in any compact interval
Numerical Methods for Differential Equations – p. 49/50
ut = uxx is well posed
Fourier series expansion g(x) =√
2∑
∞
1 ck sin kπx implies
u(x, t) =√
2∞
∑
k=1
cke−(kπ)2t sin kπx
‖E(t)g‖22 =
∫ 1
0
|u(x, t)|2 dx
= 2∞
∑
k=1
∞∑
j=1
ckcje−(k2+j2)π2t
∫ 1
0
sin kπx sin jπx dx
=∞
∑
k=1
c2ke
−2(kπ)2t ≤∞
∑
k=1
c2k = ‖g‖2
2
Hence ‖E(t)‖2 ≤ 1 for every t ≥ 0Numerical Methods for Differential Equations – p. 50/50