[petsc-users] related to DMPLExvecsetclsoure

Matthew Knepley knepley at gmail.com
Mon Feb 3 17:49:29 CST 2014


On Mon, Feb 3, 2014 at 5:29 PM, Dharmendar Reddy <dharmareddy84 at gmail.com>wrote:

> Hello,
>         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:
>

If, as in this case, the fields have the same element, its just normal
array ordering:

  (f, b, c) = (f*numBasis + b)*numComponents + c

In general, all field values are stacked together, and ordered by
basis vec and then component.

    Matt


> 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
> enddo
>
> call
> DMPlexVecSetClosure(dm,section,localResVec,cellId,elemResVec,ADD_VALUES,ierr)
>
> Thanks
> Reddy
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140203/f3d38947/attachment.html>


More information about the petsc-users mailing list