[petsc-users] Mat indices for DMPlex jacobian

Matteo Semplice matteo.semplice at uninsubria.it
Mon Sep 23 04:33:37 CDT 2024


Dear petsc,

     I need to hand-code a jacobian and I can't figure out how to 
translate the DMplex points/fields to matrix indices.

My DMPlex has a section with m fields per cell (which makes for n>m dof 
per cell since some fields are vector). Say I want to insert an nxn 
block for the row corresponding to cell c and coloumn of its neighbour 
d. I guess that I should call either MatSetValues/MatSetValuesLocal or 
the blocked variants, but how do I find the row/col indices to pass in 
starting from the c/d dmplex points? And, while I am at it, which 
MatSetValues version standard/Local standard/blocked is best?

I looked for a petsc example, but fails to find it: if there's one, can 
you just point me to it?

Thanks in advance.

Matteo Semplice



More information about the petsc-users mailing list