[petsc-users] fieldsplit-preconditioner for block-system of linear equations
Eike Mueller
E.Mueller at bath.ac.uk
Wed Sep 30 03:00:50 CDT 2015
Dear PETSc,
I am solving a linear system of equations
(1) A.X = B
where the vector X is divided into chunks, such that X= (x_1,x_2,…,x_k) and each of the vectors x_i has length n_i (same for the vector B=(b_1,b_2,…,b_k)). k=5 in my case, and n_i >> 1. This partitioning implies that the matrix has a block-structure, where the submatrices A_{ij} are of size n_i x n_j. So explicitly for k=3:
A_{1,1}.x_1 + A_{1,2}.x_2 + A_{1,3}.x_3 = b_1
(2) A_{2,1}.x_1 + A_{2,2}.x_2 + A_{2,3}.x_3 = b_2
A_{3,1}.x_1 + A_{3,2}.x_2 + A_{3,3}.x_3 = b_3
I now want to solve this system with a Krylov-method (say, GMRES) and precondition it with a field-split preconditioner, such that the Schur-complement is formed in the 1-block. I know how to do this if I have assembled the big matrix A, and I store all x_i in one big vector X (I construct the index-sets corresponding to the vectors x_1 and (x_2,x_3), and then call PCFieldSplitSetIS()). This all works without any problems.
However, I now want to do this for an existing code which
1. Assembles the matrices A_{ij} separately (i.e. they are not stored as part of a big matrix A, but are stored in independent memory locations)
2. Stores the vectors x_i separately, i.e. they are not stored as parts of one big chunk of memory of size n_1+…+n_k
I can of course implement the matrix application via a matrix shell, but is there still an easy way of using the fieldsplit preconditioner?
The naive way I can think of is to allocate a new big matrix A, and copy the A_{ij} into the corresponding blocks. Then allocate big vectors x and b, and also copy in/out the data before and after the solve. This, however, seems to be wasteful, so before I go down this route I wanted to double check if there is a way around it, since this seems to be a very common problem?
Thanks a lot,
Eike
More information about the petsc-users
mailing list