Lecture 15 18.086

advertisement
Lecture 15
18.086
Condition number
•
•
Condition number (A positive def.): c(A) =
min
Rule of thumb: Numerical round-off errors in Ax=b:
•
•
max
Computer looses O(log c) decimal digits of
accuracy
Bad conditioned problem => large round-off errors
in x (Matlab checks and issues a warning)
Iterative methods
•
Idea: Ax is still cheap because A is sparse.
•
Iterative methods:
•
Stationary methods (Jacobi, Gauss-Seidel etc.)
•
Multigrid methods
•
Krylov/Conjugate gradient methods
Eigenvalues for K (N=5)
566
Chapter 7 Solving Large Systems
1
L
x ~ a c o b weighted
i
by w = Xmax = cos 3
\
\
.
.High frequency smoothing
1
Figure 7.8: TheErrors
eigenvalues
of Jacobi's
M = I - decay
4K are cos
je, starting near X = 1
in low
frequencies
slowly
and ending near X = -1. Weighted Jacobi has X = 1 - w w cos je, ending near
+
Stationary iteration methods:
•
Jacobi: P=diag(A)
•
weighted Jacobi: P=w diag(A)
•
Gauss-Seidel: P=lower triangular part of A (incl.
diag.)
•
Successive overrelaxation (SOR): P = diag(A) +
w*lower triang. part of A (without diag.)
Demo
•
Setup: Solve Ax=b, with A=K/h2 and b oscillating:
•
I.e. we expect the
solution x to contain
superposition of low
and high frequency
eigenvectors
better to use full multigrid: FMG cycles are described below. Then the operation
count comes back to O(n) even for this higher required accuracy e = O(h2).
Multigrid methods (7.3)
V-Cycles and W-Cycles and Full Multigrid
Clearly multigrid need not stop at two grids. If it did stop, it would miss the remarkable power of the idea. The lowest frequency is still low on the 2h grid, and that part
• of
Low
freq.won't
on decay
fine mesh
frequency
the error
quickly =>
until high
we move
to 4h or 8hon
(or coarse
a very coarse 512h).
mesh
The two-grid v-cycle extends in a
natural way to more grids. It can go down to
coarser grids (2h, 4h, 8h) and back up to (4h, 2h, h) . This nested sequence of v-cycles
a V-cycle
V). Don't possible!
forget that coarse grid sweeps are much faster than
• isMore
than(capital
two meshes
fine grid sweeps. Analysis shows that time is well spent on the coarse grids. So the
W-cycle that stays coarse longer (Figure 7.11b) is generally superior to a V-cycle.
• “Notation”:
Figure 7.11: V-cycles and W-cycles and FMG use several grids several times.
•
Simplest one is the v-cycle with just two meshes (h and
2h grid spacing)
current residual rh = b - Auh to the coarse grid. We iterate a few times on that
grid, to approximate the coarse-grid error by E2h. Then interpolate back to Eh
the fine grid, make the correction to uh + Eh, and begin again.
v-cycle algorithm
This fine-coarse-fine loop is a two-grid V-cycle. We call it a v-cycle (small v
Here are the steps (remember, the error solves Ah(u - uh) = bh - Ahuh = rh):
1.
Iterate on Ahu = bh to reach uh (say 3 Jacobi or Gauss-Seidel steps).
2.
Restrict the residual rh = bh - Ahuh to the coarse grid by r2, = ~ i ~
3.
Solve A2,E2,
4.
Interpolate E2h back t o Eh = IthE,,.
5.
Iterate 3 more times on Ahu = bh starting from the improved uh
= r2, (or come close to
EZhby 3 iterations from E = 0).
Add Eh to uh.
+ Eh.
Steps 2-3-4 give the restriction-coarse solution-interpolation sequence that is t
In
theoffollowing:
heart
multigrid. Recall the three matrices we are working with:
ui: quantities on fine grid
A =grid
Ah = original matrix
vi: quantities on coarse
R = R2h
h = restriction matrix
h
Download