<div dir="ltr"><div dir="ltr">On Thu, Oct 24, 2024 at 6:04 PM Matteo Semplice <<a href="mailto:matteo.semplice@uninsubria.it">matteo.semplice@uninsubria.it</a>> wrote:</div><div class="gmail_quote"><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>Hi. The HDF5 solution looks good to me, but I now get this error<br>
    </p>
    <p><span style="font-family:monospace"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)"></span></span></p></div></blockquote><div>Okay, I can make a workaround for this. Here is what is happening.</div><div><br></div><div>When you output solutions, you really want the essential boundary conditions included in the</div><div>output, and the only way I have to do that is for you to tell me about the discretization, so I</div><div>require the DS.</div><div><br></div><div>What I can do is ignore this step if there is no DS. Let me do that and mail you with the branch.</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><span style="font-family:monospace"><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">$
          ../src/saveDemo  </span><br>
        Creating mesh with (10,10) faces   <br>
        <span style="font-weight:bold;color:rgb(255,84,84);background-color:rgb(255,255,255)">[0]PETSC
          ERROR: --------------------- Error Message
          --------------------------------------------------------------</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
        </span><br>
        [0]PETSC ERROR: Object is in wrong state
        <br>
        [0]PETSC ERROR: Need to call DMCreateDS() before calling
        DMGetDS()
        <br>
        [0]PETSC ERROR: See <a href="https://urldefense.us/v3/__https://petsc.org/release/faq/__;!!G_uCfscf7eWS!dLtO-GGeUrd81R06hiAmfndS-cgZrVE4t8Hipjb8bHTF-vqn1VNb3pjTj5fljYzb6ejXt1QTiLZq1kEPxNH0$" target="_blank">https://petsc.org/release/faq/</a> for trouble
        shooting.
        <br>
        [0]PETSC ERROR: Petsc Release Version 3.21.5, unknown  <br>
        [0]PETSC ERROR: ../src/saveDemo on a  named dentdherens by
        matteo Fri Oct 25 00:00:44 2024
        <br>
        [0]PETSC ERROR: Configure options --COPTFLAGS="-O3 -march=native
        -mtune=native -mavx2" --CXXOPTFLAGS="-O3 -march=native
        -mtune=native -mavx2" --FOPTFLAGS="-O3 -march=native
        -mtune=native -mavx2" --PETSC_ARCH=op<br>
        t --with-strict-petscerrorcode --download-hdf5
        --prefix=/home/matteo/software/petsc/3.21-opt/
        --with-debugging=0 --with-gmsh --with-metis --with-parmetis
        --with-triangle PETSC_DIR=/home/matteo/software/petsc --<br>
        force
        <br>
        [0]PETSC ERROR: #1 DMGetDS() at
        /home/matteo/software/petsc/src/dm/interface/dm.c:5525
        <br>
        [0]PETSC ERROR: #2 DMPlexInsertBoundaryValues_Plex() at
        /home/matteo/software/petsc/src/dm/impls/plex/plexfem.c:1136
        <br>
        [0]PETSC ERROR: #3 DMPlexInsertBoundaryValues() at
        /home/matteo/software/petsc/src/dm/impls/plex/plexfem.c:1274
        <br>
        [0]PETSC ERROR: #4 VecView_Plex_HDF5_Internal() at
        /home/matteo/software/petsc/src/dm/impls/plex/plexhdf5.c:477
        <br>
        [0]PETSC ERROR: #5 VecView_Plex() at
        /home/matteo/software/petsc/src/dm/impls/plex/plex.c:656
        <br>
        [0]PETSC ERROR: #6 VecView() at
        /home/matteo/software/petsc/src/vec/vec/interface/vector.c:806
        <br>
        [0]PETSC ERROR: #7 main() at saveDemo.cpp:123
        <br>
        [0]PETSC ERROR: No PETSc Option Table entries
        <br>
        <span style="font-weight:bold;color:rgb(255,84,84);background-color:rgb(255,255,255)">[0]PETSC
          ERROR: ----------------End of Error Message -------send entire
          error message to <a href="mailto:petsc-maint@mcs.anl.gov" target="_blank">petsc-maint@mcs.anl.gov</a>----------</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
        </span><br>
--------------------------------------------------------------------------
        <br>
        MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_SELF
        <br>
        with errorcode 73.
        <br>
        <br>
        NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI
        processes.
        <br>
        You may or may not see output from other processes, depending on
        <br>
        exactly when Open MPI kills them.
        <br>
--------------------------------------------------------------------------<br>
      </span></p>
    <p>I attach the modified sample code that produced the above error.<br>
    </p>
    <p>Thanks</p>
    <p>    Matteo<br>
    </p>
    <div>Il 24/10/24 22:20, Matthew Knepley ha
      scritto:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">I just looked at the code. The VTK code is very
        old, and does not check for cell overlap.
        <div><br>
        </div>
        <div>We have been recommending that people use either HDF5 or
          CGNS, both of which work in this case</div>
        <div>I believe. I can fix VTK if that is what you want, but it
          might take me a little while as it is very busy at</div>
        <div>work right now. However, if you output HDF5, then you can
          run</div>
        <div><br>
        </div>
        <div>  ./lib/petsc/bin/petsc_gen_xdmf.py mesh.h5</div>
        <div><br>
        </div>
        <div>and it will generate an XDMF file so you can load it into
          ParaView. Or you can output CGNS which I think</div>
        <div>ParaView understands.</div>
        <div><br>
        </div>
        <div>  Thanks,</div>
        <div><br>
        </div>
        <div>     Matt</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Thu, Oct 24, 2024 at
          4:02 PM Semplice Matteo <<a href="mailto:matteo.semplice@uninsubria.it" target="_blank">matteo.semplice@uninsubria.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">
          <div>
            <div dir="ltr">
              <div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
                Hi,</div>
              <div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
                      I tried again today and have (re?)discovered this
                example <a href="https://urldefense.us/v3/__https://petsc.org/release/src/dm/impls/plex/tutorials/ex14.c.html__;!!G_uCfscf7eWS!dLtO-GGeUrd81R06hiAmfndS-cgZrVE4t8Hipjb8bHTF-vqn1VNb3pjTj5fljYzb6ejXt1QTiLZq1oOKrq2I$" id="m_2093919128985184015m_5982902773776001898LPlnk382398" target="_blank">
https://petsc.org/release/src/dm/impls/plex/tutorials/ex14.c.html</a>,
                but I cannot understand if in my case I should call
                <a href="https://urldefense.us/v3/__https://petsc.org/release/manualpages/PetscSF/PetscSFCreateSectionSF/__;!!G_uCfscf7eWS!dLtO-GGeUrd81R06hiAmfndS-cgZrVE4t8Hipjb8bHTF-vqn1VNb3pjTj5fljYzb6ejXt1QTiLZq1jGPN022$" id="m_2093919128985184015m_5982902773776001898OWA7823b4db-9caf-edfa-8c7d-7a06e4a231c3" target="_blank">
                  PetscSFCreateSectionSF</a> and, if so, how should I
                then activate the returned SF.</div>
              <div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
                Matteo</div>
              <hr style="display:inline-block;width:98%">
              <div id="m_2093919128985184015m_5982902773776001898divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>Da:</b> Semplice Matteo<br>
                  <b>Inviato:</b> martedì 22 ottobre 2024 00:24<br>
                  <b>A:</b> Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br>
                  <b>Cc:</b> PETSc <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
                  <b>Oggetto:</b> Re: [petsc-users] local/global DMPlex
                  Vec output</font>
                <div> </div>
              </div>
              <div>
                <p>Dear Matt,</p>
                <p>    I guess you're right: thresholding by rank==0 and
                  rank==1 in paraview reveals that it is indeed the
                  overlap cells that are appear twice in the output.<br>
                </p>
                <p>The attached file is not exactly minimal but
                  hopefully short enough. If I run it in serial, all is
                  ok, but with</p>
                <p>    mpirun -np 2 ./saveDemo</p>
                <p>it creates a 10x10 grid, but I get "output.vtu" with
                  a total of 120 cells. However the pointSF of the
                  DMPlex seems correct.</p>
                <p>Thanks</p>
                <p>    Matteo<br>
                </p>
                <div>Il 21/10/24 19:15, Matthew Knepley ha scritto:<br>
                </div>
                <blockquote type="cite">
                  <div dir="ltr">
                    <div dir="ltr">On Mon, Oct 21, 2024 at 12:22 PM
                      Matteo Semplice via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>>
                      wrote:<br>
                    </div>
                    <div>
                      <blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                        <div>
                          <p>Dear petsc-users,<br>
                          </p>
                          <p>    I am having issues with output of
                            parallel data attached to a DMPlex (or maybe
                            more fundamental ones about DMPlex...).</p>
                          <p>So I currently</p>
                          <ol>
                            <li>create a DMPlex
                              (DMPlexCreateGmshFromFile or
                              DMPlexCreateBoxMesh)</li>
                            <li>partition it</li>
                            <li>and create a section for my data layout
                              with DMPlexCreateSection(ctx.dmMesh, NULL,
                              numComp, numDof, numBC, NULL, NULL, NULL,
                              NULL, &sUavg)</li>
                            <li>DMSetLocalSection(ctx.dmMesh, sUavg)</li>
                            <li>create solLoc and solGlob vectors with
                              DMCreateGlobalVector and
                              DMCreateLocalVector</li>
                            <li>solve ....</li>
                            <li>VecView(ctx.solGlob, vtkViewer) on a
                              .vtu file<br>
                            </li>
                          </ol>
                          <p>but when I load data in ParaView I get more
                            cells than expected and it is as if the
                            cells in the halo are put twice in output.
                            (I could create a MWE if the above is not
                            clear)<br>
                          </p>
                        </div>
                      </blockquote>
                      <div>I think we need an MWE here, because from the
                        explanation above, it should work.</div>
                      <div><br>
                      </div>
                      <div>However, I can try to guess the problem. When
                        you partition the mesh, I am guessing that you
                        have cells in the overlap. These cells</div>
                      <div>must be in the point SF in order for the
                        global section to give them a unique owner.
                        Perhaps something has gone wrong here.</div>
                      <div><br>
                      </div>
                      <div>  Thanks,</div>
                      <div><br>
                      </div>
                      <div>     Matt </div>
                      <blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                        <div>
                          <p>I guess that the culprit is point (4), but
                            if I replace it with DMSetGlobalSection then
                            I cannot create the local vector at point
                            (5).<br>
                          </p>
                          <p>How should I handle this properly? In my
                            code I need to create both local and global
                            vectors, to perform at least GlobalToLocal
                            and to save the global data.<br>
                          </p>
                          <p>(On a side note, I tried also HDF5 but then
                            it complains about the DM not having a
                            DS...; really, any working solution that
                            allows data to be explored with Paraview is
                            fine)<br>
                          </p>
                          <p>Thanks for any advice!<br>
                          </p>
                          <p>Matteo Semplice</p>
                        </div>
                      </blockquote>
                    </div>
                    <br clear="all">
                    <div><br>
                    </div>
                    <span>-- </span><br>
                    <div dir="ltr">
                      <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!dLtO-GGeUrd81R06hiAmfndS-cgZrVE4t8Hipjb8bHTF-vqn1VNb3pjTj5fljYzb6ejXt1QTiLZq1o97P_XX$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </blockquote>
                <pre cols="72">-- 
---
Professore Associato in Analisi Numerica
Dipartimento di Scienza e Alta Tecnologia
Università degli Studi dell'Insubria
Via Valleggio, 11 - Como</pre>
              </div>
            </div>
          </div>
        </blockquote>
      </div>
      <br clear="all">
      <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!dLtO-GGeUrd81R06hiAmfndS-cgZrVE4t8Hipjb8bHTF-vqn1VNb3pjTj5fljYzb6ejXt1QTiLZq1o97P_XX$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <pre cols="72">-- 
---
Professore Associato in Analisi Numerica
Dipartimento di Scienza e Alta Tecnologia
Università degli Studi dell'Insubria
Via Valleggio, 11 - Como</pre>
  </div>

</blockquote></div><br clear="all"><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!dLtO-GGeUrd81R06hiAmfndS-cgZrVE4t8Hipjb8bHTF-vqn1VNb3pjTj5fljYzb6ejXt1QTiLZq1o97P_XX$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>