[petsc-users] Dof ordering in DMPlexVecGet/Set/RestoreClosure

Matthew Knepley knepley at gmail.com
Mon Nov 7 11:14:33 CST 2022


On Mon, Nov 7, 2022 at 10:51 AM Blaise Bourdin <bourdin at mcmaster.ca> wrote:

> Hi,
>
> How are degree of freedom ordered in calls to
> DMPlexVec[Set/Get/Restore]Closure?
> Given a FE mesh and a section for P2-Lagrange elements (i.e. 1 dof per
> vertex and edge), I was naively assuming that the “local” vector would
> contain dof at vertices then edges (in this order), since it matches the
> section ordering, but it looks like I get edges then vertices…
>
> Here is my section (my mesh has 8 cells, 16 edges, and 9 vertices)
> PetscSection Object: U 1 MPI process
>   type not yet set
> 1 fields
>   field 0 with 1 components
> Process 0:
>   (   0) dim  0 offset   0
>   (   1) dim  0 offset   0
>   (   2) dim  0 offset   0
>   (   3) dim  0 offset   0
>   (   4) dim  0 offset   0
>   (   5) dim  0 offset   0
>   (   6) dim  0 offset   0
>   (   7) dim  0 offset   0
>   (   8) dim  1 offset   0
>   (   9) dim  1 offset   1
>   (  10) dim  1 offset   2
>   (  11) dim  1 offset   3
>   (  12) dim  1 offset   4
>   (  13) dim  1 offset   5
>   (  14) dim  1 offset   6
>   (  15) dim  1 offset   7
>   (  16) dim  1 offset   8
>   (  17) dim  1 offset   9
>   (  18) dim  1 offset  10
>   (  19) dim  1 offset  11
>   (  20) dim  1 offset  12
>   (  21) dim  1 offset  13
>   (  22) dim  1 offset  14
>   (  23) dim  1 offset  15
>   (  24) dim  1 offset  16
>   (  25) dim  1 offset  17
>   (  26) dim  1 offset  18
>   (  27) dim  1 offset  19
>   (  28) dim  1 offset  20
>   (  29) dim  1 offset  21
>   (  30) dim  1 offset  22
>   (  31) dim  1 offset  23
>   (  32) dim  1 offset  24
>
> Start from the following local vector:
> Vec Object: U 1 MPI process
>   type: seq
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
> 24.
> 25.
>
> Call PetscCallA(DMPlexVecGetClosure(dmU,sectionU,U,0_Ki,UArray,ierr)) and
> get the following for Array:
> 10.000000000000000        11.000000000000000        12.000000000000000
>     1.0000000000000000        2.0000000000000000        3.0000000000000000
>
> Is this ordering predictable and documented somewhere? Is it ordered by
> stratum?
>

The ordering is determined. It follows the same order that
DMPlexGetTransitiveClosure() gives for the points.

Transitive closure orders points by stratum. It is a BFS of the Hasse
Diagram, starting from the initial point. For
your triangle, it would be

  tri0, e0, e1, e2, v0, v1, v2

For each cell type, the order of faces is specified in Table 1.2 of the
attached. This gives an order to each level
of the BFS.

  Thanks,

     Matt


> Regards,
> Blaise
>
>> Canada Research Chair in Mathematical and Computational Aspects of Solid
> Mechanics (Tier 1)
> Professor, Department of Mathematics & Statistics
> Hamilton Hall room 409A, McMaster University
> 1280 Main Street West, Hamilton, Ontario L8S 4K1, Canada
> https://www.math.mcmaster.ca/bourdin | +1 (905) 525 9140 ext. 27243
>
>

-- 
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

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221107/0ee614cc/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PlexBook.pdf
Type: application/pdf
Size: 2737694 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221107/0ee614cc/attachment-0001.pdf>


More information about the petsc-users mailing list