<div dir="ltr">Hi,<div><br></div><div>I have a DM that has 2 fields , and field #1 has 2 dofs and field #2 has 1 dof.</div><div>I only have dofs on vertex. </div><div><br></div><div>Can I use the following to assemble global stiffness matrix instead of using MatSetClosure(I am not integrating 2 field separately) </div><div><br></div><div>DMGetGlobalSection(dm,GlobalSection)</div><div>For cells</div><div>   calculate element stiffness matrix eleMat</div><div>   For vertex in cells </div><div>      PetscSectionGetOffset(GlobalSection, vertex, offset)</div><div>      loc=[offset_v1, offset_v1+1, offset_v1+2,  offset_v2, offset_v2+1.......]</div><div>    End </div><div>    MatSetValues(GlobalMat, n,loc,n,loc, eleMat, ADD_VALUES)</div><div>End</div><div>AssemblyBegin and End. </div><div><br></div><div>Basically use the offset from global section to have the global dof number.</div><div><br></div><div>Thanks,</div><div>Josh</div><div><br></div><div><br></div></div>