Академический Документы
Профессиональный Документы
Культура Документы
Fall, 2016
1 / 16
Iterative solution of sparse linear systems revisited
For report 2, we are solving
Z Z
n (Pe uT T ) dS = ST d
S
Discretization (CDS or UDS)
AT = s
A = M N, T0
M T k = N T k 1 + s, k = 1, 2, . . .
2 / 16
To beat the direct solution, we need MULTIGRID 1
The essential principle of multigrid methods
k k 1
ej1 2ejk + ej+1 =0 (2)
4 / 16
Analysis of the error
=4
exp (ij )
=3
=2
=1
5 / 16
Analysis of the error
The error ejk = Tjk Tj satisfies:
k k 1
ej1 2ejk + ej+1 =0 (2)
1
|g( )| = p
(5 4 cos )
6 / 16
Analysis of the error
Taylor expand this to get:
7 / 16
The basic two-grid algorithm
Define a coarse grid with xj = (j 12 )x , x = 2/n, the original grid
is called the fine grid. Three operators are needed:
1. A prolongation operator, the matrix P, which linearly interpolates
from the coarse to the fine grid using
3 1 3 1
T2j = Tj + Tj+1 ; T2j+1 = Tj+1 + Tj
4 4 4 4
2. A restriction operator, the matrix R, which takes a weighted
average on the fine grid to obtain values on the coarse grid
1 3 3 1
Tj = T2j2 + T2j1 + T2j + T2j+1
8 8 8 8
One choice is the Galerkin
3. A coarse grid smoother, the matrix A.
coarse grid smoother
T = s
A ; = RAP
A
8 / 16
Prolongation, restriction and coarse grid operators
Linear interpolation (unit spaced, periodic grid):
3/4 1/4
2 1 1
3/4 1/4
1 2 1 1/4 3/4
A=
. . .
P=
. . .
1 2 1
3/4 1/4
1 1 2 1/4 3/4
1/4 3/4
3/8 3/8 1/8 1/8
1/8 3/8 3/8 1/8
R= . . .
1/8 3/8 3/8 1/8
1/8 1/8 3/8 3/8
= RAP
A
9 / 16
Coarse grid correction
Let T be a fine grid approximation to the solution T , then the error is
e = T T . Apply A to both sides:
A e = AT AT = s AT = r
So, solve for the coarse grid error and correct:
e
A = Rr T = T + P e
The basic algorithm:
% Produce the initial guess T0(1:n)
for (iter < maxiter) & (res > tol)
% Smooth times on the fine grid.
% Form the fine grid residual
% Restrict the residual and solve for the error.
% Prolong error, correct the fine grid solution.
% Smooth times on the fine grid.
% Compute the relative change in the solution
end
10 / 16
Two-grid analysis
For the 1-D periodic case, a two-grid analysis shows that
convergence is independent of the mesh size x .
2T
An example: x 2
= 4 2 cos (2x ), T (x ) = cos (2x )
The exact solution on the two grids
1
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
11 / 16
Iteration counts for Gauss-Seidel vs. two-grid (1-D ex.)
6 Iteration count, 1-D periodic example
10
Two-grid
Gauss-Seidel
5
10
Fine grid iteration count
4
10 Gauss-Seidel slope=1.7207
3
10
2
10
1
10 0 1 2 3 4
10 10 10 10 10
N
12 / 16
Multigrid
{k = 1, 2, . . . , K }, nk +1 = 2nk
P k : T k 1 T k , R k : T k T k 1 .
Ak T k = b k .
Ak 1 = R k Ak P k .
13 / 16
The linear multigrid algorithm (recursive)
1 function T = LMG(T , f , , k )
2 % The recursive linear multigrid algorithm.
3 if k = 1
4 T k = A\f k
5 else
7 T k = S(T , f , , k )
8 r k = f k Ak T k
9 f k 1 = R k 1 r k
k 1
10 T =0
11 T k 1 = LMG(T , f , k 1)
12 T k = T k + P k T k 1
13 T k = S(T , f , , k )
14 end
14 / 16
A pure diffusion problem in 2D
15 / 16
Pseudo-multigrid (suggestion for Report 2)
16 / 16