[petsc-users] question about creating a block matrix

Randall Mackie rlmackie862 at gmail.com
Mon Aug 10 18:29:24 CDT 2020


Dear PETSc users -

I am trying to create a block matrix but it is not clear to me what is the right way to do this.

First, I create 2 sparse matrices J1 and J2 using two different DMDAs.
Then I compute the products J1^T J1, and J2^T J2, which are different sized matrices.

Since the matrices are already constructed and built, what is the best way to place those matrices into a block matrix?


Does it work to create a composite DM, call DMCreateMatrix on the composite DM, then call MatGetLocalSubMatrix on the blocks, then simply do a MatCopy?


Thanks for any advice,

Randy M.


More information about the petsc-users mailing list