[petsc-users] DMPlex assembly global stiffness matrix

Josh L ysjosh.lo at gmail.com
Fri May 17 18:58:05 CDT 2019


Hi,

I have a DM that has 2 fields , and field #1 has 2 dofs and field #2 has 1
dof.
I only have dofs on vertex.

Can I use the following to assemble global stiffness matrix instead of
using MatSetClosure(I am not integrating 2 field separately)

DMGetGlobalSection(dm,GlobalSection)
For cells
   calculate element stiffness matrix eleMat
   For vertex in cells
      PetscSectionGetOffset(GlobalSection, vertex, offset)
      loc=[offset_v1, offset_v1+1, offset_v1+2,  offset_v2,
offset_v2+1.......]
    End
    MatSetValues(GlobalMat, n,loc,n,loc, eleMat, ADD_VALUES)
End
AssemblyBegin and End.

Basically use the offset from global section to have the global dof number.

Thanks,
Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190517/caca111e/attachment.html>


More information about the petsc-users mailing list