[petsc-users] DMPlex assembly global stiffness matrix

Mark Adams mfadams at lbl.gov
Sat May 18 11:27:26 CDT 2019


I don't think that will work. Offsets refer to the graph storage.

On Fri, May 17, 2019 at 7:59 PM Josh L via petsc-users <
petsc-users at mcs.anl.gov> wrote:

> 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/20190518/bd85e96b/attachment.html>


More information about the petsc-users mailing list