[petsc-users] access to matnest block (0,1) ?

Klaij, Christiaan C.Klaij at marin.nl
Thu Jan 19 02:42:57 CST 2012


> > I have two DMs which I add to a DMComposite and then use MATNEST when
> > getting the corresponding matrix. This gives me block (0,0) and block
> > (1,1). How do I set/get blocks (0,1) and (1,0)? Looking at ex28 I tried
> > MatGetLocalSubMatrix but it gives a null arg...
> >
>
> So the problem is that we have no way of knowing what preallocation
> (nonzero pattern) _should_ go in the off-diagonal part. Unfortunately, the
> current preallocation mechanism (DMCompositeSetCoupling()) is a difficult
> thing to implement and the mechanism does not directly apply to MatNest. If
> you have ideas for a good preallocation API, I would like to hear it. I
> need to get back to the preallocation issue because it's an obvious wart in
> the multiphysics support (as long as we don't have fast dynamic
> preallocation, which is a somewhat viable alternative). What I would like
> is for the user to call MatGetLocalSubMatrix() for any blocks that they
> want allocated and set preallocation in terms of the local ordering.
>
> The current (unfortunate) solution for MatNest with off-diagonal parts is
> to create the submatrices after DMGetMatrix(), preallocate as you like, and
> copy the ISLocalToGlobalMappings over.

I see the problem, no ideas for a good general preallocation
mechanism, sorry. Preallocation would depend on how the user
discretizes the cross terms, wouldn't it? So how can we expect
PETSc to "deduce" it from the diagonal blocks? As a user I would
be happy to preallocate myself.

Out of curiosity, how does it happen in ex28.c: I only see two
matrices being defined (line 347 and 355), I don't see
DMCompositeSetCoupling() at all, yet on line 271 block (0,1) is
available...

What about a less general (but important) case: saddle point
problems arising from incompressible Stokes, Oseen and
Navier-Stokes eqs. with Schur type preconditioning. In 2D with N
cells and co-located variables arranged
as (u1,...,uN,v1,...,vN,p1,...pN) the matrix would have the form
[Q G, D 0] with Q a 2N-by-2N matrix, G a 2N-by-N matrix and D a
N-by-2N matrix. Since the variables are co-located, they share
the same partitioning but could have different stencils. How to use
the "split local space", DMComposite and MATNEST in this case?


dr. ir. Christiaan Klaij
CFD Researcher
Research & Development
E mailto:C.Klaij at marin.nl
T +31 317 49 33 44

MARIN
2, Haagsteeg, P.O. Box 28, 6700 AA Wageningen, The Netherlands
T +31 317 49 39 11, F +31 317 49 32 45, I www.marin.nl



More information about the petsc-users mailing list