On Thu, Nov 3, 2022 at 12:16 PM Edoardo alinovi <edoardo.alin...@gmail.com> wrote:
> 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) ? > No, you pass a contiguous chunk of memory, but it is _logically_ 2D in that the size is (idxm * bs) x (idxn * bs) 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. > Yes. Thanks, Matt > Thank you as always! > > > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>