Homework 8. (Due April 8)

advertisement
Homework 8. (Due April 8)
Math. 639
This homework involve implementing a multiplicative domain decomposition
preconditioner for the problem
e = Fe.
Ac
e We
We focus on a one dimensional problem resulting in a tridiagonal A.
consider the finite difference approximation to
−(a(x)u′ (x))′ + q(x)u(x) = 1,
x ∈ (0, 1)
u(0) = u(1) = 0.
The matrix entries are given by
 −2
h (a(xi−1/2 ) + a(xi+1/2 )) + q(xi )


eij =
−h−2 a(xi−1/2 )
A


−h−2 a(xi+1/2 )
if i = j,
if j = i − 1,
if j = i + 1.
and the right had side is Fej = 1. Here xα = αh, h = 1/(m + 1), and
i, j = 1, . . . , m. In this assignment, we take a(x) = 1 + x and q(x) = 0.
This problem is an extension of the previous but in this case, we add the
coarse subspace. In this case, we shall have to extend the code to do Type
2 subspaces. This is the general case where the basis functions for S0 (of
dimension m0 ) involve linear combinations of basis functions for S. In this
case the subspace is defined using a m0 ×m matrix P0 (stored in CRS format)
with the k’th row containing the coefficients for the expansion of the k’th
basis function of S0 in terms of the basis functions of S.
You will need to implement four additional routines, namely routines to
compute P0 v and P0t w for appropriately sized vectors v and w and two
e t . Routines implementing the first two in croutines for computing P0 AP
0
code are given in sparse.c and I will refer to that code below.
You should have P0 v already implemented where P0 is a sparse matrix in
CRS format. The routine to implement y = P0t w using P0 is almost identical
to that for implementing P0 v. The loop structure is identical and one needs
only:
(a) Initialize the result y. (See line 170 of sparse.c).
(b) Increments are added into the result array (not into a temporary variable
(su of line 160 of sparse.c).
1
2
(c) Indices on the left and right are switched (see line 162/163 and 173).
e and P0 AP
e t are symmetric and tri-diagonal. To
For this assignment, both A
0
build the diagonal and off diagonal, you need routines:
e with P0 in CRS
(a) You need to develop a routine for computing B = P0 A
e tri-diagonal. If the j’th row of P0 has l entries, the the j’
format and A
row of B has at most l + 2 entries. Compute the rows of B one row at
a time. This enables you to build the CRS structure of the product one
row at a time.
(b) Next you need to develop a routine for computing C = P0 B t with P0 and
B in CRS format. For this assignment, C is symmetric tri-diagonal and
you may assemble it in this structure, i.e,, compute only D and LD. This
e t = P0 B t
is relatively easy but involves some testing. Then A0 = P0 AP
0
e gives the D,LD structure for the coarse grid matrix A0 .
with B = P0 A
In this assignment, we shall use exact subspace solvers but implement the
product algorithm. The preconditioner Bm (tF ) implements as:
set v=0; // a vector of length m, tF a given inner product vector
for j=1:l-1
// assuming type l-1 standar overlapping spaces
// 0 is the coarse space
R=tF-tA v;
// you need a routine for computing tA v
Fj=subIP1(R,PJ(j));
si=solve(tA_j,Fj);
v=subCoefadd1(v,si,PJ(j))
// v=v+PJ(j)^t*si
end
//
coarse grid space
R=tF-tA v;
// you need a routine for computing tA v
F0=sparsemult(R,P_0); // F0= P_0 * R
si=solve(A_0,F0);
v=sparsemulttrans(v,si,P_0) // v=v+P_0^t y
for j=l-1:1 // assuming type l-1 standar overlapping spaces
// 0 is the coarse space
R=tF-tA v;
// you need a routine for computing tA v
Fj=subIP1(R,PJ(j));
si=solve(tA_j,Fj);
v=subCoefadd1(v,si,PJ(j))
// v=v+PJ(j)^t*si
end
Set B_m tF = v.
3
The non-coarse subspaces are as in the previous assignment.
Problem 1. Apply your preconditioned conjugate gradient (PCG) iteration
procedure (with the above right hand side and zero initial iterate) using Bm
as a preconditioner. and report the estimates for the largest and smallest
em A
e computed by PCG as well as their quotient (the estimate
eigenvalues of B
for the condition number). Do this for the following combinations of l and
m.
(i)
(ii)
(iii)
(iv)
l = 4, m = 15, 31, 63, 127, 255, 511, 1023.
l = 8, m = 15, 31, 63, 127, 255, 511, 1023.
l = 16, m = 15, 31, 63, 127, 255, 511, 1023.
l = 4, 8, 16, 32, 64, 128, m = 2047
You should see uniformly bounded condition numbers for all combinations.
Download