[petsc-users] MatNest question

Alex Fleeter luis.saturday at gmail.com
Sun Aug 23 22:50:25 CDT 2020


Hi:

I have been trying MatNest. I have two questions.

1. I have to call MatAssemblyBegin/End for both sub-matrices and for the
MatNest object. From my experiment, if I miss any of those, I will get an
error message
[0]PETSC ERROR: Object is in wrong state
[0]PETSC ERROR: Not for unassembled matrix

I am a bit confused because in the example
https://www.mcs.anl.gov/petsc/petsc-current/src/snes/tutorials/ex70.c.html The
MatAssemblyBegin/End are only called for submatrices. I assume that example
works correctly.

On the other hand, in the actual implementation,
https://www.mcs.anl.gov/petsc/petsc-current/src/mat/impls/nest/matnest.c.html#MatAssemblyBegin_Nest,
I can see that the MatAssemblyBegin/End are already called for each
sub-matrix. It seems that one should only call one MatAssemblyBegin/End for
the big nest matrix. Unfortunately, I tried that and got an error message
shown above. I must have misunderstood something.

2. From previous threads, Jed has strongly suggested using standard Vec
instead of VecNest, unless there are strong reasons. In my case, since
MatNest is already used as the underlying matrix object, the local element
assembly will generate residual vectors for separate physics. So it is
rather natural to put the right-hand side residual vector as a nest vector.
Of course, a consequence is that I have to put every vector object in the
nested format, since my experiments suggest VecNest cannot be used with
standard Vec. My question is this. How mature is the
VecNest implementation? Is it a good design to put every vector in the nest
format?

Thanks,

Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200823/8318a7bf/attachment.html>


More information about the petsc-users mailing list