<div dir="ltr"><div dir="ltr">On Thu, Jan 30, 2025 at 9:43 AM Anna Dalklint <<a href="mailto:anna.dalklint@solid.lth.se">anna.dalklint@solid.lth.se</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 class="msg4625291697624802812">





<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="m_4625291697624802812WordSection1">
<p class="MsoNormal"><span style="font-size:11pt">I looked deeper into the petsc codebase regarding HDF5. From what I understood (which of course can be wrong), the current version of petsc does not save edge degrees-of-freedom to HDF5? Is this something
 you plan to allow?</span></p></div></div></div></blockquote><div><br></div><div>We write two different outputs (by default). One has all the data, and one has only cell and vertex data because Paraview does not understand anything else. This can be customized with options. What do you want to save?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg4625291697624802812"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="m_4625291697624802812WordSection1">
<p class="MsoNormal"><span style="font-size:11pt">Otherwise I’m fine with using CGNS. But could you please explain how I could save timeseries that paraview recognizes using this format? Right now I’m saving files e.g. file0001.cgns, file0002.cgns, … where
 each .cgns file is written using VecView (i.e. it stores a discretized field). But paraview cannot load this as a timeseries.</span></p></div></div></div></blockquote><div><br></div><div>Jed can explain how this works.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg4625291697624802812"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="m_4625291697624802812WordSection1">
<p class="MsoNormal"><span style="font-size:11pt">Also, do you have any documentation regarding node (vertex, edge, face, cell) numbering? E.g. how would a 10 node tetrahedral be numbered? From the documentation on your webpage (<a href="https://urldefense.us/v3/__https://petsc.org/release/manual/dmplex/__;!!G_uCfscf7eWS!ejLt_rGcvE6uln2mYtMTHg6zBUMpobt0KviK7ZOeyB9vp_BRV_c7m_xMnDdSnqjEerY4ApgAANbxBmrzLVYe$" target="_blank">https://petsc.org/release/manual/dmplex/</a>)
 it looks like cell dofs -> vertex dofs-> face dofs-> edge dofs. Is this correct?</span></p></div></div></div></blockquote><div><br></div><div>When you call DMPlexVecGetClosure(), the closure follows the point numbering, in that for each point, we lookup the dofs in the local Section, and push them into the array in order. So then you need the point ordering. For the closure, it goes by dimension, so cell dofs, face dofs, edge dofs, vertex dofs. You can see the definition of faces (and edges) here:</div><div><br></div><div>  <a href="https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/blob/main/src/dm/impls/plex/plexinterpolate.c?ref_type=heads*L196__;Iw!!G_uCfscf7eWS!ejLt_rGcvE6uln2mYtMTHg6zBUMpobt0KviK7ZOeyB9vp_BRV_c7m_xMnDdSnqjEerY4ApgAANbxBonw9GhL$">https://gitlab.com/petsc/petsc/-/blob/main/src/dm/impls/plex/plexinterpolate.c?ref_type=heads#L196</a></div><div><br></div><div>and triangles are ordered here</div><div><br></div><div>  <a href="https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/blob/main/src/dm/impls/plex/plexinterpolate.c?ref_type=heads*L115__;Iw!!G_uCfscf7eWS!ejLt_rGcvE6uln2mYtMTHg6zBUMpobt0KviK7ZOeyB9vp_BRV_c7m_xMnDdSnqjEerY4ApgAANbxBmRfa-Ea$">https://gitlab.com/petsc/petsc/-/blob/main/src/dm/impls/plex/plexinterpolate.c?ref_type=heads#L115</a></div><div><br></div><div>The idea is that DMPlexVecGetClosure() delivers the dofs in a standard order on the element, so that you can write</div><div>your residual function once. Also, for multiple fields, they are stacked contiguously, so the numbering is [field, point, dof on point].</div><div><br></div><div>Let me know if that does not make sense.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg4625291697624802812"><div lang="EN-US" style="overflow-wrap: break-word;"><div class="m_4625291697624802812WordSection1">
<p class="MsoNormal"><span style="font-size:11pt">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">Anna<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<div id="m_4625291697624802812mail-editor-reference-message-container">
<div>
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="color:black">From:
</span></b><span style="color:black">Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br>
<b>Date: </b>Thursday, 30 January 2025 at 00:39<br>
<b>To: </b>Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>><br>
<b>Cc: </b>Anna Dalklint <<a href="mailto:anna.dalklint@solid.lth.se" target="_blank">anna.dalklint@solid.lth.se</a>>, <a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject: </b>Re: [petsc-users] Visualizing higher order finite element output in ParaView<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal">That is all true. If you want lower level pieces to make it yourself, I have -dm_plex_high_order_view, which activates<u></u><u></u></p>
<div>
<p class="MsoNormal">DMPlexCreateHighOrderSurrogate_Internal(). This is a simple function that refines the mesh lg(p) times to try and<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">resolve the high order behavior.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">  Thanks,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">     Matt<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Wed, Jan 29, 2025 at 4:55<span style="font-family:Arial,sans-serif"> </span>PM Jed Brown <<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">I like the CGNS workflow for this, at least with quadratic and cubic elements. You can use options like -snes_view_solution cgns:solution.cgns (configure with --download-cgns). It can also monitor transient solves with flexible batch sizes
 (geometry and connectivity are stored only once within a batch of output frames).<br>
<br>
Anna Dalklint via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> writes:<br>
<br>
> Hello,<br>
><br>
> We have created a finite element code in PETSc for unstructured meshes using DMPlex. The first order meshes are created in gmsh and loaded into PETSc. To introduce higher order elements, e.g. 10 node tetrahedral elements, we start from scratch using PetscSection
 and loop over the relevant points it the DM to introduce additional degrees-of-freedom (example; for 10 node tets we have 4 vertices “nodes” and 6 edge “nodes”). The coordinates of the new “nodes” are obtained by interpolation using the finite element basis
 functions.<br>
><br>
> The simulations seem to run well, but we face issues when trying to visualize the results in ParaView. We have tried to use both CGNS and HDF5+XDMF file formats for e.g. VecView. CGNS works, but the edge degrees-of-freedom appear to not be interpolated correctly
 (we observe oscillations in the fields, don’t know if this is a PETSc och ParaView issue). Also, we would prefer to use another file format than CGNS since it does not appear to directly allow timeseries (at least ParaView doesn’t recognize it). We haven’t
 got the HDF5+XDMF file format to work at all when running on more than one core (the mesh is highly distorted when saving using VecView and DMView + running the “petsc_gen_xdmf.py” script on the .h5 output file).<br>
><br>
> VTU format works but then only the vertices’ degrees-of-freedom are visualized. As far as we have understood it, this is because VTU/VTK only supports degrees-of-freedom on vertices/cell level.<br>
><br>
> Does anyone have any idea of how to visualize fields generated from higher order elements in ParaView? Or understand what we might be doing wrong?<br>
><br>
> Best regards,<br>
> Anna<u></u><u></u></p>
</blockquote>
</div>
<div>
<p class="MsoNormal"><br clear="all">
<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal"><span class="m_4625291697624802812gmailsignatureprefix">-- </span><u></u><u></u></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">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<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><a href="https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!ejLt_rGcvE6uln2mYtMTHg6zBUMpobt0KviK7ZOeyB9vp_BRV_c7m_xMnDdSnqjEerY4ApgAANbxBuwcaQjh$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

</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!ejLt_rGcvE6uln2mYtMTHg6zBUMpobt0KviK7ZOeyB9vp_BRV_c7m_xMnDdSnqjEerY4ApgAANbxBuwcaQjh$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>