Professional Documents
Culture Documents
Scientific Computing
An Introductory Survey
Second Edition
by Michael T. Heath
Chapter 11
More dimensions complicate problem formulation: can have pure initial value problem, pure
boundary value problem, or mixture
c 2001.
Copyright
ut = c ux,
where c is nonzero constant
Unique solution determined by initial condition
u(0, x) = u0(x),
< x < ,
ut = u/t
Characteristics
Example Continued
Level curves of solution to PDE are called characteristics
Characteristics for advection equation, for example, are straight lines of slope c
2
Characteristics determine where boundary conditions can or must be imposed for problem to
be well-posed
1.5
1
1
0.5
0.5
0
0
0.5
t
1
1.5
2.5
IV
. ....... c < 0
...
....... .............
...
.......
...
...
.......
........
...
.......
... ........
....... ....
.......
...
....... ...
.......
...
.......
.......
...........
.
.......
... ..................
....... ..... BV
... .......................
....... ..
... .....................................
.......
.
..................................................
... ............................................................ .....
... .......................................................... ...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
............................................................................................................ x
IV
Classification of PDEs
Classification of PDEs, cont.
Order of PDE is order of highest-order partial
derivative appearing in equation
Advection equation is first order, for example
b2 4ac > 0:
b2 4ac = 0:
b2 4ac < 0:
Time-dependent PDEs usually involve both initial values and boundary values
t
.
....
.......
...
.
...
b .....
... b
.
... o
o ...
...
u ....
... u
.
... n
n ..
...
.
.
.
... d
d ..
...
a ....
... a
.
... r
r ...
...
problem domain
y ....
... y
..
...
.
... v
v ...
... a
a ...
...
.
... l
.
l ...
...
.
... u
.
u ..
... e
e ....
...
.
... s
s ...
.
.
.
............................................................................................................................................................................................................................ x
initial values
10
0 x 1,
2y
(t)
+
y
(t)
,
yi0 (t) =
i
i1
i+1
(x)2
i = 1, . . . , n, where yi(t) u(t, xi)
t 0,
0 x 1,
u(t, 1) = 0,
t0
11
Method of Lines
Stiffness
MOL computes cross-sections of solution surface over space-time plane along series of lines,
each parallel to time axis and corresponding to
one of discrete spatial mesh points
y0 =
0
2
(x)
...
1
2
1
...
0
1
2
...
0
...
1
0 y = Ay
...
Jacobian matrix A of this system has eigenvalues between 4c/(x)2 and 0, which makes
ODE very stiff as spatial mesh size x becomes small
0.8
0.6
0.4
0.2
1
0
1
0.8
0.5
0.6
0.4
0.2
13
14
n
X
j (t)j (x),
j=1
0j (t)j (xi) = c
j=1
n
X
j (t)00j (xi),
j=1
16
0(t) = c M 1N (t),
Unlike finite difference method, spectral or finite element method does not produce approximate values of solution u directly, but rather
it generates representation of approximate solution as linear combination of basis functions
which is in form suitable for solution with standard ODE software (as usual, M need not be
inverted explicitly, but merely used to solve linear systems)
17
19
20
ut = c uxx,
Fully Discrete Methods, continued
t 0,
u(t, 0) = ,
u(t, 1) =
t k
ui+1 2uki + uki1 ,
2
(x)
i = 1, . . . , n
21
22
k
k1
......
i1
i+1
t 0,
u(0, x) = f (x),
u(t, 0) = ,
0 x 1,
utt = c uxx,
u(t, 1) =
With mesh points defined as before, using centered difference formulas for both utt and uxx
gives finite difference scheme
.....
...
..
..
....................................................................
uk+1
= 2uki uk1
+c
i
i
t 2 k
ui+1 2uki + uki1 ,
x
i = 1, . . . , n
24
Stability
Wave Equation, continued
Unlike Method of Lines, where time step is
chosen automatically by ODE solver, user must
choose time step t in fully discrete method,
taking into account both accuracy and stability
requirements
......
...
...
..
..
.
.................................
.....................................
.
...
..
...
..
..
..
i1
i+1
u1
i to get started, which can
initial conditions
u1
i = f (xi) + (t)g(xi),
where latter uses forward difference approximation to initial condition ut(0, x) = g(x)
25
(x)2
2c
..................................
.
.................................
......
...
...
..
..
...
.
k1
i1
i+1
27
28
Crank-Nicolson Method
Applying trapezoid method to semidiscrete system of ODEs for heat equation yields implicit
Crank-Nicolson method
t k+1
= uki + c
u
2uk+1
+ uk+1
uk+1
i
i
i1
2(x)2 i+1
i = 1, . . . , n,
..................................
.
.................................
......
...
...
..
..
..
....................................................................
i1
i+1
29
30
Stability
Convergence
In order for approximate solution to converge
to true solution of PDE as stepsizes in time
and space jointly go to zero, two conditions
must hold:
Consistency : local truncation error goes to
zero
Stability : approximate solution at any fixed
time t remains bounded
Lax Equivalence Theorem says that for wellposed linear PDE, consistency and stability are
together necessary and sufficient for convergence
31
or x c t is constant
Domain of dependence for wave equation for
given point is triangle with apex at given point
.....
... 1/
.
.....
.
.
c
1/
c
..
.
.
.....
..
.
.
.
.
...
.....
..
.
.
.
..
.
.
.....
..
.
.
.
.
.
...
.....
.. .........
..
x
............................................................................................................................................................................
33
Time-Independent Problems
.................
...
.. ..........................
................................................................................
.
.
.
t ......
.
.. ................................................................
.
.
.
.
...
..... ............................................................................................................................
........... ....
....................
.................
... ..............
.......................................................................................................... ......
34
Poisson equation: = 0
.....
..................
.
.
...................
.........
...................
................
.......
.....................
.
...........................
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
...........................
..................
..................................................... ................................................................
.....
........
.
.
.
..........
......................
......................
......................
.....................
......................
......................
.............
36
uxx + uyy = 0
on unit square with boundary conditions shown
on left below
.
........
.......1
........
...................
................
...
...
...
.
... .....
... 0
.
0 ....
.... ......
..
...
..............
...............
............................... x
.
........
...........................
.......................1
...
...
...
...
...
...
... 0
.
0 ....
...
...
....
.
...
............................................................. x
i, j = 1, . . . , n,
37
Ax
1
=
1
4
0
1
1
0
4
1
0
u1,1
0
u2,1
0
1
= =b
1
u1,2
1
1
4
u2,2
u1,1
0.125
u2,1
0.125
=
x=
u1,2
0.375
0.375
u2,2
40
41
42
43
Boundary value problems and implicit methods for time-dependent PDEs yield systems of
linear algebraic equations to solve
Finite difference schemes involving only a few
variables each, or localized basis functions in
finite element approach, cause linear system to
be sparse, with relatively few nonzero entries
Sparsity can be exploited to use much less
than O(n2) storage and O(n3) work required
in naive approach to solving system
44
Band Systems
Sparse Factorization Methods
Gaussian elimination and Cholesky factorization are applicable to large sparse systems, but
care is required to achieve reasonable efficiency
in solution time and storage requirements
45
46
Fill
47
48
49
50
.........
...
..
..
....
...
..
..
...
...
..
..
...
..
...
..
...
..
...
..
...
........
.........
...
...
..
..
...
..
...
..
...
..
...
.
.....
....
..
.
.....
.
.....
.......
With nodes numbered row-wise (or columnwise), matrix is block tridiagonal, with each
nonzero block either tridiagonal or diagonal
...........
...
..
..
...
..
...
..
...
...
..
..
...
..
...
..
...
..
...
..
...
.......
.........
.
....
...
...
...
...
...
...
...
...
...
...
......
...
...
..
.....
.
......
........
......
.....
...
..
..
...
..
...
..
...
...
..
..
...
..
...
..
...
..
...
..
...
.......
++
+
+
++
+
+
51
.........
....
..
...
..
...
..
...
..
...
..
...
..
...
..
...
..
...
..
......
.......
52
At each step, minimum degree selects for elimination a node of smallest degree, breaking ties
arbitrarily
If any such neighbors were not already connected, then fill results (new edges in mesh
and new nonzeros in matrix)
53
54
..........
..........
..........
.... 3 ............................................ 6............................................. 4 ....
..........
.........
..........
.....
.....
.....
...
...
...
...
...
...
...
...
...
...
...
...
.
.
........
.........
........
.
.
.
.
.
.
.
.
.
.
.
.
.... 7 ........................................... 9........................................... 8 ...
..........
..........
...........
....
....
.....
...
...
...
...
...
...
...
...
...
...
...
...
......
......
....
.
.
.
.
.
.
.
..
.
.
.
.
.
.
.
.
..... 1.............................................. 5.............................................. 2.....
..........
..........
..........
.........
...
..
..
...
..
...
..
...
..
...
..
...
..
...
..
...
..
...
..
...
.........
.........
...
..
..
...
..
...
..
...
..
..
.....
.....
.
.....
.
.....
......
.......
.........
...
..
..
...
..
...
..
...
..
...
..
...
..
...
..
...
..
...
..
...
.........
.........
...
..
..
...
..
...
..
...
..
..
.....
.....
.
.....
.
.....
......
.......
.........
...
..
..
...
..
...
..
...
..
...
..
...
..
...
..
...
..
...
..
...
.........
++
+++
.........
...
..
..
...
..
...
..
...
..
...
..
...
..
...
..
...
..
...
.
......
.......
55
56
..........
..........
..........
......4...............................................6...............................................5.....
........
........
........
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
.
.
.
...
......
..
....... .................................................. ................................................. ......
8
9
.
.
....7
.
.
.........
..........
.......
...
...
...
...
.....
...
...
...
...
...
...
...
...
...
...
...
...
.
.
.
........................................................................................................................
1
3
2
.
.
..........
..........
...........
..........
... 2
..
..
... 2
..
...
... .................................
... ..
...
... ...
...
... ..
...
... ...
...
.
... ..
... ..................................
..
..
...
..
...
..
...
.......
....................................
...
....
....
...
...
...
..
.
...................................
2
2
.........
.....
...
.....
..
..
...
..
...
.....
..
...
..
...
..
.....
.
.....
.......
57
58
...
..
...
.......
...................................
...
.....
....
...
...
...
..
.
...................................
2
2
.........
.....
...
.....
..
..
...
..
...
.....
..
...
..
...
..
.....
.
.....
.......
...........
...
..
..
... 2
..
....
... ..................................
... ..
...
... ...
...
...
... ..
...
... ....
... .
.
... ..................................
..
..
+
...
..
...
..
+
...
.......
++
.........
....
...
..
..
...
..
...
..
...
..
...
..
...
..
...
..
...
..
.
.....
.......
59
60
62
xk+1 = Gxk + c,
where matrix G and vector c are chosen so that
fixed point of equation x = Gx + c is solution
to Ax = b
Forward and back substitution using LU factorization in effect provides approximation, call it
B 1, to inverse of A
Iterative refinement has form
g (x) = Gx + c,
G = I B 1A,
c = B 1b,
and it converges if
(I B 1A) < 1
64
Convergence
Splitting
One way to obtain matrix G is by splitting,
A = M N,
with M nonsingular
xk+1 = M 1N xk + M 1b,
which is implemented as
M xk+1 = N xk + b
(i.e., we solve linear system with matrix M at
each iteration)
65
66
Jacobi Method
Jacobi Method, continued
In matrix splitting A = M N , simplest choice
for M is diagonal, specifically diagonal of A
Let D be diagonal matrix with same diagonal
entries as A, and let L and U be strict lower
and upper triangular portions of A
Then M = D and N = (L + U ) gives splitting of A
Assuming A has no zero diagonal entries, so
D is nonsingular, this gives Jacobi method:
x(k+1) = D 1 b (L + U )x(k)
67
(k+1)
xi
= bi
(k)
aij xj /aii,
i = 1, . . . , n
j6=i
68
Gauss-Seidel Method
ui,j
1 (k)
(k)
(k)
(k)
u
+ ui,j1 + ui+1,j + ui,j+1 ,
4 i1,j
(k+1)
xi
= bi
(k+1)
aij xj
j<i
(k)
aij xj /aii
j>i
= (D + L)1 b U x(k)
69
70
ui,j
1 (k+1)
(k+1)
(k)
(k)
u
+ ui,j1 + ui+1,j + ui,j+1
4 i1,j
71
72
Successive Over-Relaxation
Convergence rate of Gauss-Seidel can be accelerated by successive over-relaxation (SOR),
which in effect uses step to next Gauss-Seidel
iterate as search direction, but with fixed search
parameter denoted by
Starting with x(k), first compute next iterate
(k+1)
that would be given by Gauss-Seidel, xGS ,
then instead take next iterate to be
= (1 )x(k) + xGS
73
74
M=
1
D + L,
N=
1
1 DU
xk+1 = xk + sk ,
where is search parameter chosen to minimize objective function (xk + sk ) along sk
(x) = 12 xT Ax xT b
75
76
x0 = initial guess
r0 = b Ax0
s0 = r0
for k = 0, 1, 2, . . .
k = rkT rk /sT
k Ask
xk+1 = xk + k sk
rk+1 = rk k Ask
T
k+1 = rk+1
rk+1/rkT rk
sk+1 = rk+1 + k+1sk
end
77
78
Preconditioning
Generalizations of CG Method
CG cannot be generalized to nonsymmetric systems without sacrificing one of its two key
properties (short recurrence and minimum error)
Diagonal or block-diagonal
SSOR
Incomplete factorization
Polynomial
Approximate inverse
79
80
Example Continued
x1
0.000
0.000
0.062
0.094
0.109
0.117
0.121
0.123
0.124
0.125
x2
0.000
0.000
0.062
0.094
0.109
0.117
0.121
0.123
0.124
0.125
x3
0.000
0.250
0.312
0.344
0.359
0.367
0.371
0.373
0.374
0.375
x4
0.000
0.250
0.312
0.344
0.359
0.367
0.371
0.373
0.374
0.375
x1
0.000
0.000
0.062
0.109
0.121
0.124
0.125
x2
0.000
0.000
0.094
0.117
0.123
0.125
0.125
x3
0.000
0.250
0.344
0.367
0.373
0.375
0.375
x4
0.000
0.312
0.359
0.371
0.374
0.375
0.375
x1
0.000
0.000
0.072
0.119
0.123
0.125
x2
0.000
0.000
0.108
0.121
0.124
0.125
x3
0.000
0.268
0.356
0.371
0.374
0.375
x4
0.000
0.335
0.365
0.373
0.375
0.375
81
82
Rate of Convergence
For more systematic comparison of methods,
we compare them on k k model grid problem
for Laplace equation on unit square
Example Continued
CG method converges in only two iterations
for this problem:
k
0
1
2
x1
0.000
0.000
0.125
x2
0.000
0.000
0.125
x3
0.000
0.333
0.375
For this simple problem, spectral radius of iteration matrix for each method can be determined analytically, as well as optimal for
SOR
Gauss-Seidel is asymptotically twice as fast as
Jacobi for this model problem, but for both
methods, number of iterations per digit of accuracy gained is proportional to number of mesh
points
x4
0.000
0.333
0.375
84
k
10
50
100
500
Jacobi
0.9595
0.9981
0.9995
0.99998
Gauss-Seidel
0.9206
0.9962
0.9990
0.99996
Optimal SOR
0.5604
0.8840
0.9397
0.98754
85
86
+1
on average, where
= cond(A) =
kAk kA1k
max(A)
=
min(A)
When matrix A is well-conditioned, convergence is rapid, but if A is ill-conditioned, convergence can be arbitrarily slow
88
Smoothers
Multigrid Methods
Disappointing convergence rates observed for
stationary iterative methods are asymptotic
Much better progress may be made initially before eventually settling into slow asymptotic
phase
Many stationary iterative methods tend to reduce high-frequency (i.e., oscillatory) components of error rapidly, but reduce low-frequency
(i.e., smooth) components of error much more
slowly, which produces poor asymptotic rate of
convergence
For this reason, such methods are sometimes
called smoothers
This observation provides motivation for multigrid methods
89
90
Residual Equation
91
If x
is approximate solution to Ax = b, with
, then error e = x x
satresidual r = b Ax
isfies equation Ae = r
Thus, in improving approximate solution we
can work with just this residual equation involving error and residual, rather than solution
and original right-hand side
One advantage of residual equation is that zero
is reasonable starting guess for its solution
92
Two-Grid Algorithm
1. On fine grid, use few iterations of smoother
to compute approximate solution x
for system
Ax = b
2. Compute residual r = b Ax
94
Cycling Strategies
There are many possible strategies for cycling
through various grid levels, most common of
which are depicted schematically below
fine
....
......
....
...
.
........
.
coarse
....
..
.
...
...
...
...
..... .....
... ....
....
V-cycle
....
.
..
...
...
...
...
..... ........ .....
... .... ... ....
.... ....
W-cycle
.
.
......
...
... ...
...
... ...
...
.
.
.
.
.
.
.
.
.
... ...
... ... ...
... ...
... ... ...
....
.. ....
Full multigrid
96
97
98
99
2-D
k6
k4 log k
k4 log k
k4
k3 log k
k3
k3
k2.5 log k
k2.5
k2 log2 k
k2 log k
k2 log k
k2 log k
k2 log log k
k2
3-D
k9
k5 log k
k5 log k
k7
k4 log k
k6
k4
k3.5 log k
k3.5
k3 log2 k
k3 log k
k3 log k
k3 log k
k3 log log k
k3
Comparison of Methods
For those methods that remain viable choices
for finite element discretizations with less regular meshes, computational cost of solving elliptic boundary value problems is given below
in terms of exponent of n (order of matrix) in
dominant term of cost estimate
method
Dense Cholesky
Band Cholesky
Sparse Cholesky
Conjugate Gradient
Preconditioned CG
Multigrid
2-D
3
2
1.5
1.5
1.25
1
3-D
3
2.33
2
1.33
1.17
1
101
102
104