<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 10/6/25 20:10, Matthew Knepley
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAMYG4G=ayJck4N0ZF1cQEM+P47DNoRpZm-a8SdSmbLn0P2xLRw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr">On Mon, Oct 6, 2025 at 1:11 PM Aldo Bonfiglioli
          <<a href="mailto:aldo.bonfiglioli@unibas.it"
            moz-do-not-send="true" class="moz-txt-link-freetext">aldo.bonfiglioli@unibas.it</a>>
          wrote:</div>
        <div class="gmail_quote gmail_quote_container">
          <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
            <div>
              <p>Dear all,</p>
              <p>what is the best approach for defining vectors that
                "sit" on the (vertices and/or faces) of a given stratum
                of the "Face Sets" of a DMPlex?</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: 3D
                    plex 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)">3D plex in 3
                    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)">  Number of
                    0-cells per rank: 9261</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: 59660</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: 98400</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: 48000</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)">  marker: 1
                    strata with value/size (1 (14402))</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 (9261), 1 (59660), 3
                    (98400), 6 (48000))</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 (9261), 1 (59660), 2
                    (98400), 3 (48000))</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:
                    6 strata with value/size (1 (800), 2 (800), 3 (800),
                    4 (800), 5 (800), 6 (800))</span><br>
                  <span
style="color:rgb(0,0,0);background-color:rgb(255,255,255)"> </span><br>
                </span> </blockquote>
              These vectors are going to be used (for example) to store
              stresses and heat flux on solid surfaces.
              <p>To be more specific: suppose stratum 3 of the "Face
                Sets" is a solid wall. </p>
              <p>I want to create a vector that that stores quantities
                computed on the (800) faces of that wall OR the vertices
                of that wall.</p>
            </div>
          </blockquote>
          <div><br>
          </div>
          <div>It should be simple to just create such vectors. You
            request a submesh using that label</div>
          <div><br>
          </div>
          <div>  DM subdm;</div>
          <div>  DMLabel label, sublabel;</div>
          <div><br>
          </div>
          <div>  DMGetLabel(dm, "Face Sets", &label);</div>
          <div>  DMLabelDuplicate(label, &sublabel);</div>
          <div>  DMPlexLabelComplete(dm, sublabel);</div>
          <div>  DMPlexCreateSubmesh(dm, sublabel, 3, PETSC_TRUE,
            &subdm)</div>
          <div>  DMLabelDestroy(&sublabel);</div>
          <div><br>
          </div>
          <div>Now you can define a PetscFE over this submesh in the
            same way as any other mesh. Moreover, the subdm contains a
            mapping back to the original DM, from which you can create a
            mapping of dofs, so that you can inject the subvector into a
            larger field if you wish.</div>
          <div><br>
          </div>
          <div>If you want to use fields on submeshes inside a PetscDS,
            so that the Plex manages the solve, the procedure is
            slightly different, but I can detail it if you want.</div>
          <div><br>
          </div>
          <div>  Thanks,</div>
          <div><br>
          </div>
          <div>     Matt</div>
          <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
            <div>
              <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!dx5g28NqJW34oxLLKP1Fjtp65c0KkvUjelPzjza0lBJtf6uu5ROFqpa2GTX5Cle8L7S_YjHssSDqe6szXd2PEYvYVHHq5mtW8EU$"
              target="_blank" moz-do-not-send="true">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!Yk-uGKnWGfd4b87jjp07cII-ta6Rld0p_kmImii1ZuYnG2DCFwjpUQkeQ8z3mrWOHPd6-oKoBkZsW8rkoKSWFblHNxPy-jdNsBo$" target="_blank" moz-do-not-send="true">https://www.cse.buffalo.edu/~knepley/</a><br>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <p>Matthew,</p>
    <p>I followed your suggestions, but I face a deadlock when the
      enclosed demonstrator is run in parallel (for the attached
      dotfile, deadlock occurs when nproc = 3).</p>
    <p>I suspect it might be due to the fact that in a parallel
      environment the various strata of the "Face Sets" are not
      necessarily available to all processes.</p>
    <p>Therefore, not all processes are going to call
      DMPlexCreateSubmesh with a given "value". </p>
    <p>The attached piece of code links with petsc-3.24.0.</p>
    <p>Thanks,</p>
    <p>Aldo</p>
    <p><br>
    </p>
    <pre class="moz-signature" 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 class="moz-txt-link-freetext" href="https://urldefense.us/v3/__http://docenti.unibas.it/site/home/docente.html?m=002423__;!!G_uCfscf7eWS!Yk-uGKnWGfd4b87jjp07cII-ta6Rld0p_kmImii1ZuYnG2DCFwjpUQkeQ8z3mrWOHPd6-oKoBkZsW8rkoKSWFblHNxPyamZ0CHI$">http://docenti.unibas.it/site/home/docente.html?m=002423</a></pre>
  </body>
</html>