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

Blaise Bourdin bourdin at mcmaster.ca
Mon Nov 7 09:51:43 CST 2022


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?

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



More information about the petsc-users mailing list