On 11/13/25 19:48, Matthew Knepley wrote:
Sorry, I have been traveling. I just got back to this.

The problem is that _everything_ that goes in the submesh has to have the same label value. That way you can distinguish exactly what you want in. However, the boundary label has to make decisions about shared edges and vertices. I am attaching a modified code that does what you want by making a separate label for each side.

I apologize for the C. I am just not as quick in Fortran.

  Thanks,

     Matt

On Thu, Nov 6, 2025 at 1:42 AM Aldo Bonfiglioli <aldo.bonfiglioli@unibas.it> wrote:

Dear all,

I am having troubles in using DMPlexExtractSubMesh to extract the different strata of the Face Sets of a given mesh.

When run on the enclosed tetrahedral mesh of the unit cube generated with gmsh

Face Sets: 6 strata with value/size (1 (246), 2 (246), 3 (246), 4 (246), 5 (242), 6 (242))

I would expect 246 "points" on stratum 3, but when I DMview the subdm (and plot it) the surface mesh looks incomplete

DM Object: patch_03 1 MPI process
 type: plex
patch_03 in 2 dimensions:
 Cells are at height 1
 Number of 0-cells per rank: 122
 Number of 1-cells per rank: 325
 Number of 2-cells per rank: 204
 Number of 3-cells per rank: 204 [204]
Labels:
 celltype: 4 strata with value/size (0 (122), 1 (325), 3 (204), 12 (204))
 depth: 4 strata with value/size (0 (122), 1 (325), 2 (204), 3 (204))
 Cell Sets: 1 strata with value/size (1 (204))
 Face Sets: 1 strata with value/size (3 (204))
 Edge Sets: 2 strata with value/size (1 (8), 5 (8))

see also patch_03.pdf

What am I doing wrong?

A simple reproducer (compiles with petsc-3.24.0) and the gmsh mesh are enclosed.

Thanks,

Aldo

-- 
Dr. Aldo Bonfiglioli
Associate professor of Fluid Mechanics
Dipartimento di Ingegneria
Universita' della Basilicata
V.le dell'Ateneo Lucano, 10 85100 Potenza ITALY
tel:+39.0971.205203 fax:+39.0971.205215
web: http://docenti.unibas.it/site/home/docente.html?m=002423


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

Matthew,

thank you for providing the working C code.

I will ba back to you in case I need further advice.

Regards,

Aldo

-- 
Dr. Aldo Bonfiglioli
Associate professor of Fluid Mechanics
Dipartimento di Ingegneria
Universita' della Basilicata
V.le dell'Ateneo Lucano, 10 85100 Potenza ITALY
tel:+39.0971.205203 fax:+39.0971.205215
web: http://docenti.unibas.it/site/home/docente.html?m=002423