jed at 59A2.org
Mon Sep 29 03:54:11 CDT 2008
On Sun 2008-09-28 13:44, Manav Bhatia wrote:
> I was reading the Petsc manual pages and came across the following
> functions: MatCreateBlockMat, MatCreateSeqAIJWithArrays and
I don't think you want to use any of these. It sounds like you are
misinterpreting the meaning of block matrices in PETSc. The PETSc block
matrices (BAIJ) are a way to store matrices for multi-component problems
which have dense coupling between the components. These blocks are
quite small, often 3 or 5 components, and there is normally one block
per node in the discretization.
> 1> So, if I have the S1,S2,...,S5, and I want to build the B matrix as
> mentioned below, would the BAIJ matrix be better to use than the AIJ?
I think you want to use AIJ. If you are using a direct solver, just
iterate through the rows of your S matrices and assemble B using
MatSetValues (you can use MatGetRow to access the rows of the S
If you want to use an iterative solver, you will probably need to write
your own preconditioner (see PCSHELL) which uses a block factorization
of B. For instance, use your knowledge of the invertibility of the S
matrices to perform pivoting in order to get a block LU decomposition.
This will normally involve a Schur complement which you need to
precondition (a very problem-specific thing). The block LU
decomposition can be used to invert completely B (i.e. use the
preconditioner as a `direct' method) but it may be more efficient to
drop some blocks from the factorization and/or replace some inverses in
the factorization with their preconditioner. Again, what is appropriate
is highly problem-specific. I don't know where your matrix comes from
but perhaps there is some literature on preconditioning this matrix.
My guess is that effective preconditioning of B will be fairly
nontrivial and involve `advanced' use of PETSc. I would recommend using
a direct solver first.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: not available
More information about the petsc-users