[petsc-users] Probelm with DMPlexExtractSubMesh
Aldo Bonfiglioli
aldo.bonfiglioli at unibas.it
Mon Nov 17 01:50:59 CST 2025
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 at 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:https://urldefense.us/v3/__http://docenti.unibas.it/site/home/docente.html?m=002423__;!!G_uCfscf7eWS!abF6mWj2v5ivSvUET6QFY34S5Jw6daKMHiS5E9ztz2YbV2jQPr-0WGi09d7IEArZlAwqdLwjjsQeUl2PlNwJMcq6AAnRpMwHc3Q$ <https://urldefense.us/v3/__http://docenti.unibas.it/site/home/docente.html?m=002423__;!!G_uCfscf7eWS!aMKmGG4aim9XcbNSnDyHUkDyhUkQHGZ-u-xX2C-sycYUMmtTij6AwqsQbZPXJSvPp9KUfgwRJK2Ok6Me2BLgO0en1w4QF2fHo7s$>
>
>
>
> --
> 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!abF6mWj2v5ivSvUET6QFY34S5Jw6daKMHiS5E9ztz2YbV2jQPr-0WGi09d7IEArZlAwqdLwjjsQeUl2PlNwJMcq6AAnRT1dw3uY$
> <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!abF6mWj2v5ivSvUET6QFY34S5Jw6daKMHiS5E9ztz2YbV2jQPr-0WGi09d7IEArZlAwqdLwjjsQeUl2PlNwJMcq6AAnRaIPU6qs$ >
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:https://urldefense.us/v3/__http://docenti.unibas.it/site/home/docente.html?m=002423__;!!G_uCfscf7eWS!abF6mWj2v5ivSvUET6QFY34S5Jw6daKMHiS5E9ztz2YbV2jQPr-0WGi09d7IEArZlAwqdLwjjsQeUl2PlNwJMcq6AAnRpMwHc3Q$
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20251117/1c60e4ed/attachment.html>
More information about the petsc-users
mailing list