[petsc-users] related to DMPLExvecsetclsoure

Dharmendar Reddy dharmareddy84 at gmail.com
Mon Feb 3 17:29:03 CST 2014

        I am trying to understand the layout of the values array
argument of the DMPLexVecSetClosure.

Consider a triangular element with two fields at each node, say n, p
vertices : v1,v2,v3
If the value of fields in the local vector :  n1,p1, n2, p2, n3, p3

If the equation set is: F(n,p) = 0 and G(n,p) = 0

if the values of F and G evaluated at v1,v2, v3 are F1,F2,F3 and
G1,G2G3 respectively.

Then the elemVec that goes into DMPLexVecSetClosure is:

elemVec = { F1,F2,F3,G1G2,G3} is that correct ?

Now, i am looking for some functionality which will let me access the
following mapping information, (local dof id)?

what is the Local Dof Id , i.e, the position in elemVec given the
field id, component id and basis id (or node id for the case of P1
Lagrange ?)

The usage will be like this:

do fid=1,numField
   numBasis = getNumBasis(fid)
   numComponent = getNumComponent(fid)
   do bid=1,numBasis
      do cid =1,numCompoent
       localId = getLocalDofId( fid, bid, cid)
        elemResVec(localId) = residual value
     end do
   end do

call DMPlexVecSetClosure(dm,section,localResVec,cellId,elemResVec,ADD_VALUES,ierr)


More information about the petsc-users mailing list