[petsc-users] On the usage of MatSetValuesBlocked

Edoardo alinovi edoardo.alinovi at gmail.com
Thu Nov 3 11:16:16 CDT 2022


Hello Jed/Barry/Petsc friends

I am trying to assemble a block matrix with 3x3 in 2D and 4x4 blocks in 3D
coming from the fully coupled NS equation.

I am not sure I am understanding the example provided here:
https://petsc.org/main/docs/manualpages/Mat/MatSetValuesBlocked/

The description says that " *v -* a logically two-dimensional array of
values", while in the example is passed as a 1D array.

Should I pass a 2D array like v(1:nComp,1:nComp) or an array
v(1:nComp*nComp) to MatSetValuesBlocked (I am using fortran that's why I
start form 1 in my arrays) ?

Are *idxm *and *idxn *the global index of each block right? I guess PETSc
will correctly assign each block row and column as it knows the matrix has
a given structure.

Thank you as always!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221103/d3f5bb6a/attachment-0001.html>


More information about the petsc-users mailing list