<div dir="ltr"><div dir="ltr">On Mon, Dec 15, 2025 at 3:43 AM Aldo Bonfiglioli <<a href="mailto:aldo.bonfiglioli@unibas.it">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"><u></u>
<div>
<div>On 12/2/25 15:02, Matthew Knepley
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">On Mon, Dec 1, 2025 at 8:22 AM Aldo Bonfiglioli
<<a href="mailto:aldo.bonfiglioli@unibas.it" target="_blank">aldo.bonfiglioli@unibas.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">Dear
developers,<br>
<br>
I wrote a code that extracts subDMs corresponding to the
various strata <br>
in the Face Sets.<br>
<br>
I run into troubles when I view a subDM or a Vec attached to
the subDM <br>
using the VTK format.<br>
<br>
More precisely, the problem only occurs on more than one
processor when <br>
the rank=0 processor has no points on a given subDM.<br>
<br>
For instance, when the attached reproducer is run on 2
procs, the <br>
u_01.vtu file (global u Vec mapped to the subDM
corresponding to stratum=1)<br>
<br>
only includes the header, but no data. All other u_0?.vtu
files can <br>
successfully be loaded and viewed in paraview.<br>
<br>
The problem does NOT arise when I view the same objects in
HDF5 format.<br>
<br>
However, my problem in using the HDF5 lies in the fact that:<br>
<br>
while the hdf5 file obtained with DMView can be
post-processed with <br>
"petsc/lib/petsc/bin/petsc_gen_xdmf.py" to create a xmf file
readable by <br>
paraview<br>
</blockquote>
<div><br>
</div>
<div>Hi Aldo,</div>
<div><br>
</div>
<div>Sorry about this, I would like to make it more intuitive.
First, the solution (I think)</div>
<div><br>
</div>
<div> -dm_plex_view_hdf5_storage_version 1.1.0</div>
<div><br>
</div>
<div>will write the Viz field by default, so that PAraview
will see it. Can you try this?</div>
<div><br>
</div>
<div>Why do we need this? I have now made version-controlled
output formats. There is something about</div>
<div>this in the manual, but not enough. Paraview only
supports vertex-based fields and cell-based fields</div>
<div>(at least that I understand), so we need to write a
separate copy of the field (since Plex supports any</div>
<div>layout). Lots of people do not want a separate copy,
since they are checkpointing, so we control this</div>
<div>with a format (PETSC_VIEWER_HDF5_VIZ). You can pass this
for specific output, or use the format</div>
<div>version that does it automatically.</div>
<div><br>
</div>
<div>Let me know if this works.</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">
I do not know how to view the field(s) associated with the
DM when the <br>
hdf5 file is obtained from VecView.<br>
<br>
The reproducer compiles with the latest petsc release.<br>
<br>
Thanks,<br>
<br>
Aldo<br>
<br>
-- <br>
Dr. Aldo Bonfiglioli<br>
Associate professor of Fluid Mechanics<br>
Dipartimento di Ingegneria<br>
Universita' della Basilicata<br>
V.le dell'Ateneo Lucano, 10 85100 Potenza ITALY<br>
tel:+39.0971.205203 fax:+39.0971.205215<br>
web: <a href="https://urldefense.us/v3/__http://docenti.unibas.it/site/home/docente.html?m=002423__;!!G_uCfscf7eWS!eXE2csxUb1J5bnRosf9LIGxLs17TdstMxQcGs0mbXFroRjzLN81jVmeAWfMr41X8JGEuVm286lVTmDgmi5s1zfsfegJNuWVVWTM$" rel="noreferrer" target="_blank">https://urldefense.us/v3/__http://docenti.unibas.it/site/home/docente.html?m=002423__;!!G_uCfscf7eWS!eXE2csxUb1J5bnRosf9LIGxLs17TdstMxQcGs0mbXFroRjzLN81jVmeAWfMr41X8JGEuVm286lVTmDgmi5s1zfsfegJNuWVVWTM$</a>
<br>
</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!e3ZEg0fMK55wMqFxwA8I9trdBUMCc27ap7Q8V8beAiyV258mz8N43KSQa8MUBZMDUTVJw33Yay2EgGGjuvYF$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<p>Matt,</p>
<p>use of the option "-dm_plex_view_hdf5_storage_version 1.1.0" is
indeed necessary,</p>
<p>but I also realized, thanks to a suggestion from
<a href="mailto:matteo.semplice@uninsubria.it" target="_blank">matteo.semplice@uninsubria.it</a>, that I have to View BOTH the dm and
vec in the same hdf5 file, i.e.</p>
<p>
</p><blockquote type="cite">
<span style="font-family:monospace"><span style="color:rgb(24,24,178);background-color:rgb(255,255,255)">!</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
</span><br>
<span style="color:rgb(24,24,178);background-color:rgb(255,255,255)">!
dump the dm+u to the same HDF5 file</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
</span><br>
<span style="color:rgb(24,24,178);background-color:rgb(255,255,255)">!</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
</span><br>
<br>
<span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">filename
</span><span style="color:rgb(175,95,0);background-color:rgb(255,255,255)">=</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)"> </span><span style="color:rgb(178,24,24);background-color:rgb(255,255,255)">"test.h5"</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)">
PetscCall(PetscViewerHDF5Open(PETSC_COMM_WORLD, </span><span style="color:rgb(24,178,178);background-color:rgb(255,255,255)">trim</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">(filename),
FILE_MODE_WRITE, viewer, ierr))</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)">
PetscCall(DMView(dm, viewer, ierr))</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)">
PetscCall(PetscViewerDestroy(viewer, ierr))</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)">
PetscCall(PetscViewerHDF5Open(PETSC_COMM_WORLD, </span><span style="color:rgb(24,178,178);background-color:rgb(255,255,255)">trim</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">(filename),
FILE_MODE_APPEND, viewer, ierr))</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)">
PetscCall(VecView(u, viewer, ierr))</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)">
PetscCall(PetscViewerDestroy(viewer, ierr))</span><span style="color:rgb(0,0,0);background-color:rgb(255,255,255)">
</span><br>
<br>
<br>
</span>
</blockquote>
Once test.h5 has been processed with "petsc_gen_xdmf.py", I can
load the xmf file in paraview e see the solution (there is NO
solution unless -dm_plex_view_hdf5_storage_version 1.1.0 is in the
options db).<p></p>
<p>I was probably misled by the fact that a single VecView in VTK
format gives both the mesh and solution in the same file.</p>
<p>Does this make sense?</p></div></blockquote><div>Ah, yes. VTK does not have a way to construct the file without the DM, so we force it. Our HDF5 format can actually handle multiple DMs (so the adaptive refinement can be visualized), so you need to specify what to put in.</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>
<p>Final question:</p>
<p>is it possible to specify, using command line options or the
options db, that vecview should be appended to an existing file?</p>
<p></p></div></blockquote><div>Yes. You use the mode</div><div><br></div><div> -vec_view hdf5:sol.h5::append</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!e3ZEg0fMK55wMqFxwA8I9trdBUMCc27ap7Q8V8beAiyV258mz8N43KSQa8MUBZMDUTVJw33Yay2EgLcMeEyC$" 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!e3ZEg0fMK55wMqFxwA8I9trdBUMCc27ap7Q8V8beAiyV258mz8N43KSQa8MUBZMDUTVJw33Yay2EgGGjuvYF$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>