[petsc-users] On PCFIELDSPLIT and its implementation

Edoardo alinovi edoardo.alinovi at gmail.com
Sat Nov 19 02:52:57 CST 2022


Morning Guys,

The good news is that finally fieldsplit is working ok! I have just a
simple question about the interaction of
MatMPIAIJSetPreallocation with MatSetValuesBlocked.

In this simple example I have a 27x27 matrix (9 blocks, each composed by a
3x3 matrix). The only entry I have on each line of the matrix is 1.0 in the
diagonal.

I set the block size of the matrix to 3 with call MatSetBlockSize(A, 3,
ierr) as discussed, and I pass a dnnz(1:27)  = 1, since every line of the
matrix has just 1 diagonal entry.  Now, using MatSetValuesBlocked with this
preallocation leads to a wrong matrix, only the first line of the block is
assigned correctly. I get A(1,1) = 1, A(2,2) = 0, A(3,3) = 0, A(4,4) = 1,
A(5,5) = 0, A(6,6) = 0 and so on.  Instead, if I set dnnz = 3, i correctly
get I get A(1,1) = 1, A(2,2) = 1, A(3,3) = 1, A(4,4) = 1, A(5,5) = 1,
A(6,6) = 1 and so on.

Why should I say that dnnz = 3 instead of 1? Is MatSetValuesBlocked kind of
requesting this?

Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221119/af87ed6f/attachment.html>


More information about the petsc-users mailing list