<div dir="ltr">Sorry, I have been traveling. I just got back to this.<div><br></div><div>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.</div><div><br></div><div>I apologize for the C. I am just not as quick in Fortran.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, Nov 6, 2025 at 1:42 AM Aldo Bonfiglioli <<a href="mailto:aldo.bonfiglioli@unibas.it">aldo.bonfiglioli@unibas.it</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  

    
  
  <div>
    <p>Dear all,</p>
    <p>I am having troubles in using DMPlexExtractSubMesh to extract the
      different strata of the Face Sets of a given mesh.</p>
    <p>When run on the enclosed tetrahedral mesh of the unit cube
      generated with gmsh</p>
    <p>
      </p><blockquote type="cite">
        <span style="font-family:monospace"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">Face Sets: 6
            strata with value/size (1 (246), 2 (246), 3 (246), 4 (246),
            5 (242), 6 (242))</span><br>
          <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
        </span>
      </blockquote>
      I would expect 246 "points" on stratum 3, but when I DMview the
      subdm (and plot it) the surface mesh looks incomplete<p></p>
    <p>
      </p><blockquote type="cite">
        <span style="font-family:monospace"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">DM Object:
            patch_03 1 MPI process</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
          <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">  type:
            plex</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
          <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">patch_03
            in 2 dimensions:</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
          <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">  Cells
            are at height 1</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
          <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">  Number
            of 0-cells per rank: 122</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
          <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">  Number
            of 1-cells per rank: 325</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
           <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">Number
            of 2-cells per rank: 204</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
           <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">Number
            of 3-cells per rank: 204 [204]</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
          <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">Labels:</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
           <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">celltype:
            4 strata with value/size (0 (122), 1 (325), 3 (204), 12
            (204))</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
           <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">depth:
            4 strata with value/size (0 (122), 1 (325), 2 (204), 3
            (204))</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
           <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">Cell
            Sets: 1 strata with value/size (1 (204))</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
           <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">Face
            Sets: 1 strata with value/size (3 (204))</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
           <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">Edge
            Sets: 2 strata with value/size (1 (8), 5 (8))</span><br>
          <span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
          </span><br>
        </span>
      </blockquote>
      see also patch_03.pdf<p></p>
    <p>What am I doing wrong?</p>
    <p>A simple reproducer (compiles with petsc-3.24.0) and the gmsh
      mesh are enclosed.</p>
    <p>Thanks,</p>
    <p>Aldo</p>
    <pre cols="72">-- 
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: <a href="https://urldefense.us/v3/__http://docenti.unibas.it/site/home/docente.html?m=002423__;!!G_uCfscf7eWS!aMKmGG4aim9XcbNSnDyHUkDyhUkQHGZ-u-xX2C-sycYUMmtTij6AwqsQbZPXJSvPp9KUfgwRJK2Ok6Me2BLgO0en1w4QF2fHo7s$" target="_blank">http://docenti.unibas.it/site/home/docente.html?m=002423</a></pre>
  </div>

</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!aNqQNIAnqfeL74GBiwHA9seVWu0ove-CSJIwX6f353WAN55As1veo1pVXphJIAAgvQIkWls9Xnm5sbieON39$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div>