[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: block matrices



Ok, I should have been more explicit.  I'm trying to implement the Elman et al. style preconditioner for Stokes using FEniCS and dolfin, in which the system:

K = [A B^T; B 0]
A the vector laplacian, B the divergence operator, B^T the gradient operator, is preconditioned with an approximate inverse of

P = [ A 0; 0 Q]
where A is still the vector laplacian, and Q is the pressure mass matrix.

Matrix A naturally appears in the construction of matrix K, but matrix Q will be constructed separately.  I can grab matrix A as a submatrix from K, but the question then becomes how to assemble them into a matrix P to hand off to:

KSPSetOperators(ksp, K, P, SAME_NONZERO_PATTERN);


On Jan 6, 2008, at 8:40 AM, Barry Smith wrote:

Gideon,

  It really depends on what you want to use this new matrix for? If you wish to do
matrix vector products with it then I would suggest making a shell matrix that then
calls the matrix vector product on each part.  In other words, if possible you probably
want to avoid explicitly constructing this entire new matrix, unless you really need
it.

   Barry


On Jan 5, 2008, at 7:54 PM, Gideon Simpson wrote:

Suppose I have two sparse matrices A and Q and now I want to construct a block diagonal matrix, K,

K = [A,0]
[0,Q]

What is the "right" way to do this is?


-Gideon Simpson
 Department of Applied Physics and Applied Mathematics
 Columbia University