I slightly reworked your example to make it easier for me to see what is going on. It is attached.
If you run with
mpiexec -n 2 ./test -dm_plex_filename mesh.msh -dm_plex_gmsh_use_regions
-dm_plex_gmsh_mark_vertices -dm_plex_gmsh_multiple_tags -dm_view draw
-draw_pause -1 -petscpartitioner_type simple
then you do indeed get the left and right lower cells on process 0 and top
and middle cell on process 1. If you run
mpiexec -n 2 ./test -dm_plex_filename mesh.msh -dm_plex_gmsh_use_regions
-dm_plex_gmsh_mark_vertices -dm_plex_gmsh_multiple_tags
-petscpartitioner_type simple -label_view -dm_view ::ascii_info_detail
then you get
DM Object: DM_0x84000004_0 2 MPI processes
type: plex
DM_0x84000004_0 in 2 dimensions:
Supports:
[0] Max support size: 4
[0]: 2 ----> 7
[0]: 2 ----> 9
[0]: 3 ----> 10
[0]: 3 ----> 11
[0]: 4 ----> 7
[0]: 4 ----> 8
[0]: 4 ----> 10
[0]: 4 ----> 12
[0]: 5 ----> 11
[0]: 5 ----> 12
[0]: 6 ----> 8
[0]: 6 ----> 9
[0]: 7 ----> 0
[0]: 8 ----> 0
[0]: 9 ----> 0
[0]: 10 ----> 1
[0]: 11 ----> 1
[0]: 12 ----> 1
[1] Max support size: 3
[1]: 2 ----> 8
[1]: 2 ----> 9
[1]: 3 ----> 6
[1]: 3 ----> 7
[1]: 4 ----> 7
[1]: 4 ----> 8
[1]: 4 ----> 10
[1]: 5 ----> 6
[1]: 5 ----> 9
[1]: 5 ----> 10
[1]: 6 ----> 1
[1]: 7 ----> 1
[1]: 8 ----> 0
[1]: 9 ----> 0
[1]: 10 ----> 0
[1]: 10 ----> 1
Cones:
[0] Max cone size: 3
[0]: 0 <---- 7 (0)
[0]: 0 <---- 8 (0)
[0]: 0 <---- 9 (0)
[0]: 1 <---- 10 (0)
[0]: 1 <---- 11 (0)
[0]: 1 <---- 12 (0)
[0]: 7 <---- 2 (0)
[0]: 7 <---- 4 (0)
[0]: 8 <---- 4 (0)
[0]: 8 <---- 6 (0)
[0]: 9 <---- 6 (0)
[0]: 9 <---- 2 (0)
[0]: 10 <---- 4 (0)
[0]: 10 <---- 3 (0)
[0]: 11 <---- 3 (0)
[0]: 11 <---- 5 (0)
[0]: 12 <---- 5 (0)
[0]: 12 <---- 4 (0)
[1] Max cone size: 3
[1]: 0 <---- 8 (0)
[1]: 0 <---- 9 (0)
[1]: 0 <---- 10 (0)
[1]: 1 <---- 7 (-1)
[1]: 1 <---- 10 (-1)
[1]: 1 <---- 6 (-1)
[1]: 6 <---- 3 (0)
[1]: 6 <---- 5 (0)
[1]: 7 <---- 4 (0)
[1]: 7 <---- 3 (0)
[1]: 8 <---- 4 (0)
[1]: 8 <---- 2 (0)
[1]: 9 <---- 2 (0)
[1]: 9 <---- 5 (0)
[1]: 10 <---- 5 (0)
[1]: 10 <---- 4 (0)
coordinates with 1 fields
field 0 with 2 components
Process 0:
( 2) dof 2 offset 0 0. 0.
( 3) dof 2 offset 2 1. 0.
( 4) dof 2 offset 4 0.5 0.
( 5) dof 2 offset 6 0.5 0.5
( 6) dof 2 offset 8 0. 0.5
Process 1:
( 2) dof 2 offset 0 0. 1.
( 3) dof 2 offset 2 0.5 0.
( 4) dof 2 offset 4 0.5 0.5
( 5) dof 2 offset 6 0. 0.5
Labels:
Label 'celltype':
[0]: 2 (0)
[0]: 3 (0)
[0]: 4 (0)
[0]: 5 (0)
[0]: 6 (0)
[0]: 7 (1)
[0]: 8 (1)
[0]: 9 (1)
[0]: 10 (1)
[0]: 11 (1)
[0]: 12 (1)
[0]: 0 (3)
[0]: 1 (3)
[1]: 2 (0)
[1]: 3 (0)
[1]: 4 (0)
[1]: 5 (0)
[1]: 6 (1)
[1]: 7 (1)
[1]: 8 (1)
[1]: 9 (1)
[1]: 10 (1)
[1]: 0 (3)
[1]: 1 (3)
Label 'surf_1':
[0]: 0 (1)
Label 'surf_2':
[0]: 1 (2)
Label 'surf_3':
[1]: 0 (3)
Label 'surf_4':
[1]: 1 (4)
Label 'edge':
[0]: 7 (5)
[0]: 10 (5)
Label 'P1':
[0]: 2 (8)
Label 'P2':
[0]: 3 (9)
Label 'P3':
[1]: 2 (10)
PetscSF Object: 2 MPI processes
type: basic
[0] Number of roots=13, leaves=5, remote ranks=1
[0] 4 <- (1,3)
[0] 5 <- (1,4)
[0] 6 <- (1,5)
[0] 8 <- (1,6)
[0] 12 <- (1,7)
[1] Number of roots=11, leaves=0, remote ranks=0
[0] Roots referenced by my leaves, by rank
[0] 1: 5 edges
[0] 4 <- 3
[0] 5 <- 4
[0] 6 <- 5
[0] 8 <- 6
[0] 12 <- 7
[1] Roots referenced by my leaves, by rank
MultiSF sort=rank-order
surf_1 : s / e : 0 / 1
surf_1 : s / e : -1 / -1
Label 'surf_1':
Index has been calculated in [-1, -1)
Label 'surf_1':
Index has been calculated in [0, 1)
[0]: 0 (1)
surf_2 : s / e : 1 / 2
Label 'surf_2':
Index has been calculated in [-1, -1)
surf_2 : s / e : -1 / -1
Label 'surf_2':
Index has been calculated in [1, 2)
[0]: 1 (2)
surf_3 : s / e : -1 / -1
Label 'surf_3':
Index has been calculated in [0, 1)
[0]: 0 (3)
surf_3 : s / e : 0 / 1
Label 'surf_3':
Index has been calculated in [-1, -1)
surf_4 : s / e : -1 / -1
Label 'surf_4':
Index has been calculated in [1, 2)
[0]: 1 (4)
surf_4 : s / e : 1 / 2
Label 'surf_4':
Index has been calculated in [-1, -1)
edge : s / e : 7 / 11
Label 'edge':
Index has been calculated in [-1, -1)
edge : s / e : -1 / -1
Label 'edge':
Index has been calculated in [7, 11)
[0]: 7 (5)
[0]: 10 (5)
P1 : s / e : 2 / 3
Label 'P1':
Index has been calculated in [-1, -1)
P1 : s / e : -1 / -1
Label 'P1':
Index has been calculated in [2, 3)
[0]: 2 (8)
P2 : s / e : 3 / 4
Label 'P2':
Index has been calculated in [-1, -1)
P2 : s / e : -1 / -1
Label 'P2':
Index has been calculated in [3, 4)
[0]: 3 (9)
P3 : s / e : -1 / -1
Label 'P3':
Index has been calculated in [2, 3)
[0]: 2 (10)
P3 : s / e : 2 / 3
Label 'P3':
Index has been calculated in [-1, -1)
which is a lot of output, but we can check all the labels. The labels
surf_1 and surf_2 mark the cells on process 0, and thus are not shared with
process 1. surf_3 and surf_4 are the same for process 1.
The edge labels marks edges 7 and 10 on process 0. These run between
vertices 2, 4, and 3
[0]: 7 <---- 2 (0)
[0]: 7 <---- 4 (0)
[0]: 10 <---- 4 (0)
[0]: 10 <---- 3 (0)
which have coordinates
( 2) dof 2 offset 0 0. 0.
( 3) dof 2 offset 2 1. 0.
( 4) dof 2 offset 4 0.5 0.
and thus we have the two bottom edges. These edges are not shared, and thus
the label has no entries on process 1. P1 and P2 are not shared with
process 1, and P2 is not shared with process 0.
You wrote "The "edge" label is the one that I found confusing. It contains
the three points att the botom (0,0), (0.5,0) and (1,0). So in rank 1, the
vertex at (0.5,0) should be marked (?). But it returns -1/-1"
The label does _not_ contain the three points at the bottom. It contains
the two edges. It will only contain the vertices as well if you run
DMPlexLabelComplete() which sticks in the transitive closure. You could
also put those vertices into the same group using GMsh.
Thanks,
Matt
On Fri, Oct 2, 2026 at 8:33 AM Noam T. <[email protected]> wrote:
>
> The "edge" label is the one that I found confusing. It contains the three
> points att the botom (0,0), (0.5,0) and (1,0). So in rank 1, the vertex at
> (0.5,0) should be marked (?). But it returns -1/-1
>
>
> Correction: the "edge" label contains edges. So rank 1 not marking it is
> not entirely wrong? It does not contain either of the edges, only the
> vertex at (0.5,0).
>
> However, since BCs are ultimately applied on vertices, I still need rank 1
> to somehow figure out that it needs to take this label into account.
>
> Thanks,
>
> ---
> Noam
>
--
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!b03q6BDtyu0WI9YM0mvmNissC3XwUT3j_nTkplb0op58ldLSfPtade9jGhsFMkPQ1ICPqF7FX3vnlmnoJQna$
<https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!b03q6BDtyu0WI9YM0mvmNissC3XwUT3j_nTkplb0op58ldLSfPtade9jGhsFMkPQ1ICPqF7FX3vnllxFOVom$
>
test.c
Description: Binary data
