<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Thibault, would it make sense to you if we replace the current DMSetOutputSequenceNumber() and PetscViewerHDF5SetTimestep() by just VecSetTimestep()? Details <a href="https://gitlab.com/petsc/petsc/-/merge_requests/3881#note_558257800" class="">here</a>.
<div class=""><br class="">
</div>
<div class="">From what I can see, this could simplify and robustify the code and reduce docs scattering.<br class="">
<div class=""><br class="">
</div>
<div class="">Matt, it seems that the OutputSequenceNumber was meant as some more general concept, but now it's exclusively interpreted as a timestep selector for Vec I/O. See</div>
<div class=""> grep -RIn -e DMGetOutputSequenceNumber -e DMSetOutputSequenceNumber -e outputSequenceNum src | less</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">
<div class="">Thanks,</div>
<div class="">Vaclav <br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 9 Apr 2021, at 16:34, Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" class="">thibault.bridelbertomeu@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Yes hmmm more documentation could simply be added to VecLoad ? What do you think ? I mean there are already a few special cases mentioned in there, so maybe adding the case where the Vec stems from a DM could be helpful.
<div class="">What's more, I think VecLoad is the first function users are going to look up before going into more details, so it could as well have as much details as possible.</div>
<div class=""><br class="">
</div>
<div class="">Anyways if anyone looks up this thread in the mailing list, here are the snippets that do the job.</div>
<div class=""><br class="">
</div>
<div class="">First snippet : how to write a HDF5 file with only the last iteration of a solution vector carried by a DM and a TS :</div>
<div class=""><br class="">
</div>
<div class="">
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre" class="">
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
DMGetOutputSequenceNumber</span>(dm, save_seqnum, save_seqval, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
DMSetOutputSequenceNumber</span>(dm, <span style="color:rgb(181,206,168)" class="">
-1</span>, <span style="color:rgb(181,206,168)" class="">0.d0</span>, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerCreate</span>(PETSC_COMM_WORLD, hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerSetType</span>(hdf5Viewer, PETSCVIEWERHDF5, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerFileSetMode</span>(hdf5Viewer, FILE_MODE_WRITE, ierr); CHKERRA(ierr);</div>
<div class=""><span style="color:rgb(197,134,192)" class="">write</span>(filename,<span style="color:rgb(206,145,120)" class="">'(A,I5.5,A)'</span>)
<span style="color:rgb(206,145,120)" class="">"restart_"</span>, stepnum, <span style="color:rgb(206,145,120)" class="">
".h5"</span></div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerFileSetName</span>(hdf5Viewer, <span style="color:rgb(220,220,170)" class="">
trim</span>(filename), ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
VecView</span>(X, hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerDestroy</span>(hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
DMSetOutputSequenceNumber</span>(dm, save_seqnum, save_seqval, ierr); CHKERRA(ierr)</div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">Second snippet : how to read such a HDF5 file back into a new DM that has no idea whatsoever what happened when the file was written :</div>
<div class=""><br class="">
</div>
<div class="">
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre" class="">
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
DMGetOutputSequenceNumber</span>(dm, save_seqnum, save_seqval, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
DMSetOutputSequenceNumber</span>(dm, <span style="color:rgb(181,206,168)" class="">
-1</span>, <span style="color:rgb(181,206,168)" class="">0.d0</span>, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5Open</span>(PETSC_COMM_WORLD, <span style="color:rgb(220,220,170)" class="">
trim</span>(restartname), FILE_MODE_READ, hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5SetTimestep</span>(hdf5Viewer, restartiter, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
VecLoad</span>(sol, hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerDestroy</span>(hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
DMSetOutputSequenceNumber</span>(dm, save_seqnum, save_seqval, ierr); CHKERRA(ierr)</div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">Note that in both snippets, vectors X and sol resp. are global vectors.</div>
<div class=""><br class="">
</div>
<div class="">Cheers and thanks again for the help !!</div>
<div class=""><br clear="all" class="">
<div class="">
<div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">Thibault</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br class="">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le jeu. 8 avr. 2021 à 22:17, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> a écrit :<br class="">
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr" class="">
<div dir="ltr" class="">On Thu, Apr 8, 2021 at 9:00 AM Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank" class="">thibault.bridelbertomeu@gmail.com</a>> wrote:<br class="">
</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">
<div dir="ltr" class="">Hello everyone,
<div class=""><br class="">
</div>
<div class="">So i figured it out, and I got a work-around, but it's not pretty and I think there might be a nicer solution that you guys will see.</div>
<div class=""><br class="">
</div>
<div class="">Here is the stack of calls for the VecLoad of a vector generated via a DMPlex :</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><span class=""> </span>CALLING PETSCVIEWERHDF5SETTIMESTEP FROM FORTRAN</span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">TOTOTOTOTO :::>>> IN PETSCVIEWERHDF5SETTIMESTEP. <hdf5v.c></span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">TOTOTOTOTO :::>>> HDF5->TIMESTEP = 20. <hdf5v.c></span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><span class=""> </span>CALLING VECLOAD FROM FORTRAN</span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">TOTOTOTOTO :::>>> INSIDE VECLOAD <vector.c></span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">TOTOTOTOTO :::>>> FORMAT = PETSC_VIEWER_RAW. <vector.c></span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">TOTOTOTOTO :::>>> IN VECLOAD_PLEX. <plex.c></span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">TOTOTOTOTO :::>>> IN VECLOAD_PLEX_HDF5_INTERNAL <plexhdf5.c></span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">TOTOTOTOTO :::>>> IN PETSCVIEWERHDF5SETTIMESTEP. <hdf5v.c></span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">TOTOTOTOTO :::>>> HDF5->TIMESTEP = 20. <hdf5v.c></span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">TOTOTOTOTO :::>>> IN VECLOAD_DEFAULT. <vecio.c></span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">TOTOTOTOTO :::>>> IN VECLOAD_HDF5 <vecio.c>.</span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">TOTOTOTOTO :::>>> IN PETSCVIEWERHDF5LOAD. <hdf5io.c></span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">TOTOTOTOTO :::>>> IN PETSCVIEWERHDF5READINITIALIZE_PRIVATE. <hdf5io.c></span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">TOTOTOTOTO :::>>> TIMESTEP = 20. <hdf5io.c></span></div>
<div style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(252, 238, 207);" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">TOTOTOTOTO :::>>> LENIND = 1, TIMESTEP = 20. <hdf5io.c></span></div>
</div>
<div class=""><br class="">
</div>
<div class="">Not everything is there, I just stopped at line 78 of hdf5io.c as Matt suggested.</div>
<div class="">The thing is, you can call </div>
<div class=""><br class="">
</div>
<div class="">
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre-wrap" class="">
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5SetTimestep</span>(hdf5Viewer, restartiter, ierr); CHKERRA(ierr)</div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">all you want before calling </div>
<div class=""><br class="">
</div>
<div class="">
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre-wrap" class="">
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
VecLoad</span>(sol, hdf5Viewer, ierr); CHKERRA(ierr)</div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">it won't have any effect.</div>
<div class="">The timestep that is set by the ..SetTimestep routine is overriden inside the </div>
<div class=""><br class="">
</div>
<div class="">
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre-wrap" class="">
<div class=""><span style="color:rgb(220,220,170)" class="">VecLoad_Plex_HDF5_Internal</span></div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">routine because of these lines :</div>
<div class=""><br class="">
</div>
<div class="">
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre-wrap" class="">
<div class=""><span style="color:rgb(156,220,254)" class="">ierr</span> = <span style="color:rgb(220,220,170)" class="">
DMGetOutputSequenceNumber</span>(<span style="color:rgb(156,220,254)" class="">dm</span>, &<span style="color:rgb(156,220,254)" class="">seqnum</span>,
<span style="color:rgb(86,156,214)" class="">NULL</span>);<span style="color:rgb(86,156,214)" class="">CHKERRQ</span>(<span style="color:rgb(156,220,254)" class="">ierr</span>);</div>
<div class=""><span style="color:rgb(156,220,254)" class="">ierr</span> = <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5SetTimestep</span>(<span style="color:rgb(156,220,254)" class="">viewer</span>,
<span style="color:rgb(156,220,254)" class="">seqnum</span>);<span style="color:rgb(86,156,214)" class="">CHKERRQ</span>(<span style="color:rgb(156,220,254)" class="">ierr</span>);</div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">Since my point is to "restart" a computation from such a HDF5 file, when i read the file the DMPlex is brand new and has no idea what happened during another run of the program --> the "seqnum" is set to -1.</div>
<div class="">As a consequence, the viewer always sees its "timestep" variable as being -1 even if you try forcing it with</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre-wrap" class="">
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5SetTimestep</span>(hdf5Viewer, restartiter, ierr); CHKERRA(ierr)</div>
</div>
</div>
<div class=""></div>
</div>
<div class=""><br class="">
</div>
<div class="">Anyways, one way to do it is then to add :</div>
<div class=""><br class="">
</div>
<div class="">
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre-wrap" class="">
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
DMSetOutputSequenceNumber</span>(dm, restartiter, PETSC_NULL_REAL, ierr); CHKERRA(ierr)</div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">to the code, that thus becomes :</div>
<div class=""><br class="">
</div>
<div class="">
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre-wrap" class="">
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
DMSetOutputSequenceNumber</span>(dm, restartiter, PETSC_NULL_REAL, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5Open</span>(PETSC_COMM_WORLD, <span style="color:rgb(220,220,170)" class="">
trim</span>(restartname), FILE_MODE_READ, hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5PushGroup</span>(hdf5Viewer, <span style="color:rgb(206,145,120)" class="">
"/fields"</span>, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5SetTimestep</span>(hdf5Viewer, restartiter, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
VecLoad</span>(sol, hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerDestroy</span>(hdf5Viewer, ierr); CHKERRA(ierr)</div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">By the way, it even works if you remove the PushGroup(..., "/fields", ...) because this is also forced in VecLoad_Plex_HDF5_Internal.</div>
<div class=""><br class="">
</div>
<div class="">Might be a better idea would be to do a DMLoad, what do you think ?</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">Okay, this is correct. I should have thought of this. If a Vec comes from a DM, then the DM controls the I/O. We should be</div>
<div class="">more explicit about this in the documentation. From this decision flows the decision to have the Solver (TS) communicate</div>
<div class="">with the DM instead of the Viewer.</div>
<div class=""><br class="">
</div>
<div class="">Thus, if you want to load a certain output in the absence of a solver, you too should communicate with it through the DM. I think</div>
<div class="">the problem here is lack of documentation rather than the choice. I will think about where to document this. If you have a suggestion,</div>
<div class="">maybe where you looked first, it would be appreciated.</div>
<div class=""><br class="">
</div>
<div class=""> Thanks,</div>
<div class=""><br class="">
</div>
<div class=""> Matt</div>
<div class=""> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr" class="">
<div class="">Thanks !!</div>
<div class=""><br clear="all" class="">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">Thibault</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br class="">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le jeu. 8 avr. 2021 à 13:35, Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank" class="">thibault.bridelbertomeu@gmail.com</a>> a écrit :<br class="">
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr" class="">
<div dir="ltr" class="">Argh no I don't, I implemented it straight in a larger CFD code because everything is already there for setting-up the DM, DS, PetscFV etc...
<div class="">Now that you guys gave me some more pointers I'll dig around with a debugger ..</div>
<div class=""><br class="">
</div>
<div class="">Thanks !</div>
</div>
<br class="">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le jeu. 8 avr. 2021 à 13:25, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>> a écrit :<br class="">
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr" class="">Do you have a self-contained thing I could run? This should be easy to clear up in the debugger.
<div class=""><br class="">
</div>
<div class=""> Thanks,</div>
<div class=""><br class="">
</div>
<div class=""> Matt</div>
</div>
<br class="">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Apr 8, 2021 at 7:22 AM Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank" class="">thibault.bridelbertomeu@gmail.com</a>> wrote:<br class="">
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr" class="">Doesn't seem to be a Fortran stub problem, it's automatically generated and looks good to me ...<br clear="all" class="">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class=""><br class="">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br class="">
</div>
<br class="">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le jeu. 8 avr. 2021 à 13:20, Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank" class="">thibault.bridelbertomeu@gmail.com</a>> a écrit :<br class="">
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">Well ... I cleaned everything and did a fresh compile just now with "print*, "foo"" here and there and it does print foo on the terminal ... So yes, I am running the changed code ! ;)</div>
</div>
</div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre-wrap" class="">
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
DMCreateGlobalVector</span>(dm, sol, ierr); CHKERRA(ierr)</div>
<div style="line-height:18px" class="">
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
VecZeroEntries</span>(sol, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscObjectSetName</span>(sol, <span style="color:rgb(206,145,120)" class="">"Solution"</span>, ierr); CHKERRA(ierr)</div>
</div>
<div class=""><span style="color:rgb(197,134,192)" class="">print</span>*, <span style="color:rgb(206,145,120)" class="">
"foo"</span></div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerCreate</span>(PETSC_COMM_WORLD, hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerSetType</span>(hdf5Viewer, PETSCVIEWERHDF5, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerFileSetMode</span>(hdf5Viewer, FILE_MODE_READ, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerFileSetName</span>(hdf5Viewer, <span style="color:rgb(220,220,170)" class="">
trim</span>(restartname), ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5SetTimestep</span>(hdf5Viewer, restartiter, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5PushGroup</span>(hdf5Viewer, <span style="color:rgb(206,145,120)" class="">
"/fields"</span>, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
VecLoad</span>(sol, hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerDestroy</span>(hdf5Viewer, ierr); CHKERRA(ierr)</div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">In the snippet, restartiter is an integer equal to 20.</div>
<div class="">I agree with you the line you just sent me should fix the issue. Maybe it's a fortran stub problem, I'll double check the stubs.</div>
<div class=""><br class="">
</div>
<div class="">Thanks !</div>
<div class="">Thibault<br class="">
<br class="">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le jeu. 8 avr. 2021 à 13:11, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>> a écrit :<br class="">
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr" class="">
<div dir="ltr" class="">On Thu, Apr 8, 2021 at 4:08 AM Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank" class="">thibault.bridelbertomeu@gmail.com</a>> wrote:<br class="">
</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">
<div dir="ltr" class="">Hi everyone,
<div class=""><br class="">
</div>
<div class="">Thank you for your answers.</div>
<div class="">Unfortunately, it does not work yet.</div>
<div class=""><br class="">
</div>
<div class="">1/ I first tried just adding</div>
<div class=""><br class="">
</div>
<div class=""> <span style="background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre-wrap;color:rgb(197,134,192)" class="">call</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre-wrap" class="">
</span><span style="background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre-wrap;color:rgb(220,220,170)" class="">PetscViewerHDF5SetTimestep</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre-wrap" class="">(hdf5Viewer,
20, ierr); CHKERRA(ierr)</span></div>
<div class=""><br class="">
</div>
<div class="">(the latest iteration in the *.hdf5 is iter 20) before the VecLoad, i.e.:</div>
<div class=""><br class="">
</div>
<div class="">
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre-wrap" class="">
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerCreate</span>(PETSC_COMM_WORLD, hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerSetType</span>(hdf5Viewer, PETSCVIEWERHDF5, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerFileSetMode</span>(hdf5Viewer, FILE_MODE_READ, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerFileSetName</span>(hdf5Viewer, <span style="color:rgb(220,220,170)" class="">
trim</span>(restartname), ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5SetTimestep</span>(hdf5Viewer, 20, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5PushGroup</span>(hdf5Viewer, <span style="color:rgb(206,145,120)" class="">
"/fields"</span>, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
VecLoad</span>(sol, hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerDestroy</span>(hdf5Viewer, ierr); CHKERRA(ierr)</div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">but it does not change anything, the error is exactly the same as before (with or without the PushGroup by the way).</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">This is the one I do not believe. If the Viewer has a non-negative timestep, it will increase the length index:</div>
<div class=""><br class="">
</div>
<div class=""> <a href="https://gitlab.com/petsc/petsc/-/blob/main/src/vec/is/utils/hdf5io.c#L78" target="_blank" class="">https://gitlab.com/petsc/petsc/-/blob/main/src/vec/is/utils/hdf5io.c#L78</a></div>
<div class=""><br class="">
</div>
<div class="">and we can see all the sizes in your HDF5 file. Are you sure you are running the one with the changed code?</div>
<div class=""><br class="">
</div>
<div class=""> Thanks,</div>
<div class=""><br class="">
</div>
<div class=""> Matt</div>
<div class=""> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr" class="">
<div class=""><br class="">
</div>
<div class="">2/ I then tried adding </div>
<div class=""><br class="">
</div>
<div class=""> <span style="background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre-wrap;color:rgb(197,134,192)" class="">call</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre-wrap" class="">
</span><span style="background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre-wrap;color:rgb(220,220,170)" class="">PetscViewerHDF5SetTimestep</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre-wrap" class="">(hdf5Viewer,
-1, ierr); CHKERRA(ierr)</span><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">before the VecView to "prevent blocking with timesteps" as the doc says (<a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerHDF5SetTimestep.html#PetscViewerHDF5SetTimestep" target="_blank" class="">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerHDF5SetTimestep.html#PetscViewerHDF5SetTimestep</a>),
i.e. :</div>
<div class=""><br class="">
</div>
<div class="">
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre-wrap" class="">
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerCreate</span>(PETSC_COMM_WORLD, hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerSetType</span>(hdf5Viewer, PETSCVIEWERHDF5, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerFileSetMode</span>(hdf5Viewer, FILE_MODE_WRITE, ierr); CHKERRA(ierr);</div>
<div class=""><span style="color:rgb(197,134,192)" class="">write</span>(filename,<span style="color:rgb(206,145,120)" class="">'(A,I5.5,A)'</span>)
<span style="color:rgb(206,145,120)" class="">"restart_"</span>, stepnum, <span style="color:rgb(206,145,120)" class="">
".h5"</span></div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerFileSetName</span>(hdf5Viewer, <span style="color:rgb(220,220,170)" class="">
trim</span>(filename), ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5SetTimestep</span>(hdf5Viewer, -1, ierr); CHKERRA(ierr)<br class="">
</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
VecView</span>(X, hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerDestroy</span>(hdf5Viewer, ierr); CHKERRA(ierr)</div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">but the hdf5 files keep increasing in size and each one stores more data than the previous one ... can I not disable that "stacking" effect and just keep the iteration I want ?</div>
<div class=""><br class="">
</div>
<div class="">3/ I tried adding </div>
<div class=""><br class="">
</div>
<div class=""> <span style="background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre-wrap;color:rgb(197,134,192)" class="">call</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre-wrap" class="">
</span><span style="background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre-wrap;color:rgb(220,220,170)" class="">PetscViewerHDF5SetTimestep</span><span style="background-color:rgb(30,30,30);color:rgb(212,212,212);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;white-space:pre-wrap" class="">(hdf5Viewer,
stepnum, ierr); CHKERRA(ierr)</span><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">before the VecView to try and just keep one iteration in the file, i.e. :</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre-wrap" class="">
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerCreate</span>(PETSC_COMM_WORLD, hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerSetType</span>(hdf5Viewer, PETSCVIEWERHDF5, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerFileSetMode</span>(hdf5Viewer, FILE_MODE_WRITE, ierr); CHKERRA(ierr);</div>
<div class=""><span style="color:rgb(197,134,192)" class="">write</span>(filename,<span style="color:rgb(206,145,120)" class="">'(A,I5.5,A)'</span>)
<span style="color:rgb(206,145,120)" class="">"restart_"</span>, stepnum, <span style="color:rgb(206,145,120)" class="">
".h5"</span></div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerFileSetName</span>(hdf5Viewer, <span style="color:rgb(220,220,170)" class="">
trim</span>(filename), ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5SetTimestep</span>(hdf5Viewer, stepnum, ierr); CHKERRA(ierr)<br class="">
</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
VecView</span>(X, hdf5Viewer, ierr); CHKERRA(ierr)</div>
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerDestroy</span>(hdf5Viewer, ierr); CHKERRA(ierr)</div>
</div>
</div>
<div class=""></div>
</div>
<div class=""><br class="">
</div>
<div class="">but it has no effect whatsoever on the hdf5 files that are written ... they still store several timesteps, and then I cannot VecLoad what I want, i still get the same error.</div>
<div class=""><br class="">
</div>
<div class="">Any more idea ? I keep reading the doc on the HDF5 viewer and thinking that this or that function could solve the issue but either it has zero effect or does not solve the issue ...</div>
<div class=""><br class="">
</div>
<div class="">Thanks !!!</div>
<div class=""><br class="">
</div>
<div class="">Thibault</div>
<div class=""><br class="">
</div>
</div>
<br class="">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le jeu. 8 avr. 2021 à 02:42, Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank" class="">bsmith@petsc.dev</a>> a écrit :<br class="">
</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="">
<div class=""><br class="">
</div>
Matt,
<div class=""><br class="">
</div>
<div class=""> Is there anyway to provide this "extra meta-data" inside the generated HDF file? Then when a fresh viewer opens the file it uses this meta-data to know that the file contains "time-steps" and allows processing of them? The simplest thing would
be to have the viewer generate an error if the file has time-steps but the user does not "request a (or more) time-steps" instead of getting confused about the vector sizes.</div>
<div class=""><br class="">
</div>
<div class=""> Barry</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On Apr 7, 2021, at 6:32 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>> wrote:</div>
<br class="">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">On Wed, Apr 7, 2021 at 4:10 PM Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank" class="">thibault.bridelbertomeu@gmail.com</a>> wrote:<br class="">
</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">
<div dir="ltr" class="">Hello Vaclav,
<div class=""><br class="">
</div>
<div class="">Thank you for your quick answer !!</div>
<div class="">OK so, if I need to push the group, I added :</div>
<div class=""><br class="">
</div>
<div class="">
<div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Menlo,Monaco,"Courier New",monospace;font-size:12px;line-height:18px;white-space:pre-wrap" class="">
<div class=""><span style="color:rgb(197,134,192)" class="">call</span> <span style="color:rgb(220,220,170)" class="">
PetscViewerHDF5PushGroup</span>(hdf5Viewer, <span style="color:rgb(206,145,120)" class="">
"/fields"</span>, ierr); CHKERRA(ierr)</div>
</div>
</div>
<div class=""><br class="">
</div>
<div class="">right after the call to PetscViewerFileSetName.</div>
<div class="">The result is the same, it produces the following error :</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(172,31,22);background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""><b class="">[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------</b></span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: Unexpected data in file</span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: Global size of array in file is 105, not 25300 as expected</span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: See
<a href="https://www.mcs.anl.gov/petsc/documentation/faq.html" target="_blank" class="">
https://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.</span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: Petsc Development GIT revision: v3.14.4-671-g707297fd510<span class="">
</span>GIT Date: 2021-02-24 22:50:05 +0000</span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: ../../../bin/eulerian3D on a<span class="">
</span>named macbook-pro-de-thibault.home by tbridel Wed Apr<span class=""> </span>
7 22:05:14 2021</span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: Configure options --with-clean=1 --prefix=/Users/tbridel/Documents/1-CODES/04-PETSC/build_uns3D --with-make-np=2 --with-windows-graphics=0 --with-debugging=0 --download-fblaslapack
--download-mpich-shared=0 --with-x=0 --with-pthread=0 --with-valgrind=0 --PETSC_ARCH=macosx_uns3D --with-fc=/usr/local/bin/mpifort --with-cc=/usr/local/bin/mpicc --with-cxx=/usr/local/bin/mpic++ --with-openmp=0 --download-hypre=yes --download-sowing=yes --download-metis=yes
--download-parmetis=yes --download-triangle=yes --download-tetgen=yes --download-ctetgen=yes --download-p4est=yes --download-zlib=yes --download-c2html=yes --download-eigen=yes --download-pragmatic=yes --with-hdf5-dir=/usr/local/opt/hdf5-mpi --with-cmake-dir=/usr/local/opt/cmake
--with-libtoolize=/usr/local/bin/glibtoolize --with-autoreconf=/usr/local/bin/autoreconf</span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: #1 PetscViewerHDF5ReadSizes_Private() line 114 in /Users/tbridel/Documents/1-CODES/04-PETSC/src/vec/is/utils/hdf5io.c</span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: #2 PetscViewerHDF5Load() line 208 in /Users/tbridel/Documents/1-CODES/04-PETSC/src/vec/is/utils/hdf5io.c</span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: #3 VecLoad_HDF5() line 132 in /Users/tbridel/Documents/1-CODES/04-PETSC/src/vec/vec/utils/vecio.c</span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: #4 VecLoad_Default() line 257 in /Users/tbridel/Documents/1-CODES/04-PETSC/src/vec/vec/utils/vecio.c</span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: #5 VecLoad_Plex_Local() line 474 in /Users/tbridel/Documents/1-CODES/04-PETSC/src/dm/impls/plex/plex.c</span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: #6 VecLoad_Plex_HDF5_Internal() line 295 in /Users/tbridel/Documents/1-CODES/04-PETSC/src/dm/impls/plex/plexhdf5.c</span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: #7 VecLoad_Plex() line 496 in /Users/tbridel/Documents/1-CODES/04-PETSC/src/dm/impls/plex/plex.c</span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: #8 VecLoad() line 953 in /Users/tbridel/Documents/1-CODES/04-PETSC/src/vec/vec/interface/vector.c</span></div>
<div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;background-color:rgb(252,238,207)" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">[0]PETSC ERROR: #9 User provided function() line 0 in User file</span></div>
</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">Do you know where it could come from ?</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">I think I understand this. PETSc tries to be clever to allow you to store timesteps. It gives the HDF5 array an extra dimension. Somehow</div>
<div class="">the Viewer has to know this. The TS does this automatically, so you have an array</div>
<div class=""><br class="">
</div>
<div class=""> <span style="font-variant-ligatures:no-common-ligatures;font-size:11px" class="">GROUP "fields" {</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> DATASET "Solution" {</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> DATATYPE H5T_IEEE_F64LE</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> DATASPACE SIMPLE { ( 21, 5060, 5 ) / ( H5S_UNLIMITED, 5060, 5 ) }</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> }</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> }</span></div>
<div class=""><br class="">
</div>
<div class="">which has 21 timesteps. However, when you create a brand new Viewer, it does not know, and mistakenly thinks there is a single vector</div>
<div class="">of length 21 * 5 = 105. You can tell your reader which timestep you want to extract using</div>
<div class=""><br class="">
</div>
<div class=""> <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerHDF5SetTimestep.html" target="_blank" class="">
https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Viewer/PetscViewerHDF5SetTimestep.html</a><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""> Thanks,</div>
<div class=""><br class="">
</div>
<div class=""> Matt</div>
<div class=""> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr" class="">
<div class="">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div class="">
<div class="">
<div class="">
<div class="">As for what I am doing exactly : i am using the DMPlex with a PetscFV to solve the fluid mechanics Euler equations in 3D. The PetscFV linked to the DS of the DMPlex might be why there is a /fields before the /Solution maybe .. ?</div>
<div class=""><br class="">
</div>
<div class="">Cheers and thank you again for your help !!</div>
<div class=""><br class="">
</div>
<div class="">Thibault</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br class="">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Le mer. 7 avr. 2021 à 10:07, Hapla Vaclav <<a href="mailto:vaclav.hapla@erdw.ethz.ch" target="_blank" class="">vaclav.hapla@erdw.ethz.ch</a>> a écrit :<br class="">
</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="">
<div class=""><span class="">Dear Thibault</span></div>
<div class=""><br class="">
</div>
<div class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On 7 Apr 2021, at 08:18, Thibault Bridel-Bertomeu <<a href="mailto:thibault.bridelbertomeu@gmail.com" target="_blank" class="">thibault.bridelbertomeu@gmail.com</a>> wrote:</div>
<br class="">
<div class="">
<div dir="ltr" class="">
<div class="">Dear all, <br class="">
</div>
<div class=""><br class="">
</div>
<div class="">I have been facing a problem with VecLoad recently, even though it seems to me I did exactly like in the examples/tutorials.</div>
<div class=""><br class="">
</div>
<div class="">Basically, a program writes a vector with the HDF5 writer like this :</div>
<div class=""></div>
<div class="">
<pre lang="fortran" class=""><span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC45" lang="fortran" class=""><span class=""> </span><span class=""> call</span><span class=""> </span><span class="">DMCreateGlobalVector</span><span class="">(</span><span class="">dm</span><span class="">,</span><span class=""> </span><span class="">sol</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC46" lang="fortran" class=""><span class=""> </span><span class=""> call</span><span class=""> </span><span class="">VecZeroEntries</span><span class="">(X</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC47" lang="fortran" class=""><span class=""> </span><span class=""> call</span><span class=""> </span><span class="">PetscObjectSetName</span><span class="">(X</span><span class="">,</span><span class=""> </span><span class="">"Solution"</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span><span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC65" lang="fortran" class=""><span class=""> <br class=""></span></span></pre>
<pre lang="fortran" class=""><span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC65" lang="fortran" class=""><span class=""> < do something with X to fill it up with relevant data ><br class=""></span></span></pre>
<pre lang="fortran" class=""><span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC65" lang="fortran" class=""><span class=""> </span><span class="">call</span><span class=""> </span><span class="">PetscViewerCreate</span><span class="">(</span><span class="">PETSC_COMM_WORLD</span><span class="">,</span><span class=""> </span><span class="">hdf5Viewer</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC66" lang="fortran" class=""><span class=""> </span><span class="">call</span><span class=""> </span><span class="">PetscViewerSetType</span><span class="">(</span><span class="">hdf5Viewer</span><span class="">,</span><span class=""> </span><span class="">PETSCVIEWERHDF5</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC67" lang="fortran" class=""><span class=""> </span><span class="">call</span><span class=""> </span><span class="">PetscViewerFileSetMode</span><span class="">(</span><span class="">hdf5Viewer</span><span class="">,</span><span class=""> </span><span class="">FILE_MODE_WRITE</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">);</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC68" lang="fortran" class=""><span class=""> </span><span class="">write</span><span class="">(</span><span class="">filename</span><span class="">,</span><span class="">'(A,I5.5,A)'</span><span class="">)</span><span class=""> </span><span class="">"restart_"</span><span class="">,</span><span class=""> </span><span class="">stepnum</span><span class="">,</span><span class=""> </span><span class="">".h5"</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC69" lang="fortran" class=""><span class=""> </span><span class="">call</span><span class=""> </span><span class="">PetscViewerFileSetName</span><span class="">(</span><span class="">hdf5Viewer</span><span class="">,</span><span class=""> </span><span class="">trim</span><span class="">(</span><span class="">filename</span><span class="">),</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC70" lang="fortran" class=""><span class=""> </span><span class="">call</span><span class=""> </span><span class="">VecView</span><span class="">(</span><span class="">X</span><span class="">,</span><span class=""> </span><span class="">hdf5Viewer</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC71" lang="fortran" class=""><span class=""> </span><span class="">call</span><span class=""> </span><span class="">PetscViewerDestroy</span><span class="">(</span><span class="">hdf5Viewer</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
</pre>
</div>
<div class="">and the same program (but with different start-up options, say) re-reads such a file like this :</div>
<div class=""><br class="">
</div>
<div class="">
<pre lang="fortran" class=""><span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC64" lang="fortran" class=""><span class=""><span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC45" lang="fortran" class=""><span class=""> </span><span class=""> call</span><span class=""> </span><span class="">DMCreateGlobalVector</span><span class="">(</span><span class="">dm</span><span class="">,</span><span class=""> </span><span class="">sol</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC46" lang="fortran" class=""><span class=""> </span><span class=""> call</span><span class=""> </span><span class="">VecZeroEntries</span><span class="">(</span><span class="">sol</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC47" lang="fortran" class=""><span class=""> </span><span class=""> call</span><span class=""> </span><span class="">PetscObjectSetName</span><span class="">(</span><span class="">sol</span><span class="">,</span><span class=""> </span><span class="">"Solution"</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span> <br class=""> </span><span class="">call</span><span class=""> </span><span class="">PetscViewerCreate</span><span class="">(</span><span class="">PETSC_COMM_WORLD</span><span class="">,</span><span class=""> </span><span class="">hdf5Viewer</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC65" lang="fortran" class=""><span class=""> </span><span class="">call</span><span class=""> </span><span class="">PetscViewerSetType</span><span class="">(</span><span class="">hdf5Viewer</span><span class="">,</span><span class=""> </span><span class="">PETSCVIEWERHDF5</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC66" lang="fortran" class=""><span class=""> </span><span class="">call</span><span class=""> </span><span class="">PetscViewerFileSetMode</span><span class="">(</span><span class="">hdf5Viewer</span><span class="">,</span><span class=""> </span><span class="">FILE_MODE_READ</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC67" lang="fortran" class=""><span class=""> </span><span class="">call</span><span class=""> </span><span class="">PetscViewerFileSetName</span><span class="">(</span><span class="">hdf5Viewer</span><span class="">,</span><span class=""> </span><span class="">trim</span><span class="">(</span><span class="">restartname</span><span class="">),</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC68" lang="fortran" class=""><span class=""> </span><span class="">call</span><span class=""> </span><span class="">VecLoad</span><span class="">(</span><span class="">sol</span><span class="">,</span><span class=""> </span><span class="">hdf5Viewer</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
<span id="gmail-m_-4277693900190823117gmail-m_154241931133953492gmail-m_4634622126182048306gmail-m_2871988643623181545gmail-m_-3627241083550638964gmail-m_-8877699833071185355gmail-m_-1795475030234232808gmail-m_1441798517920077622gmail-m_4982510822038283072gmail-m_3416988461638334820gmail-m_6621939839129280338gmail-LC69" lang="fortran" class=""><span class=""> </span><span class="">call</span><span class=""> </span><span class="">PetscViewerDestroy</span><span class="">(</span><span class="">hdf5Viewer</span><span class="">,</span><span class=""> </span><span class="">ierr</span><span class="">);</span><span class=""> </span><span class="">CHKERRA</span><span class="">(</span><span class="">ierr</span><span class="">)</span></span>
</pre>
</div>
<div class=""><br class="">
</div>
<div class="">Such a dataset can be found under this link : <a href="https://drive.google.com/file/d/1owLAx5vknNhj61_5ieAwnWOR9cmkTseL/view?usp=sharing" target="_blank" class="">
https://drive.google.com/file/d/1owLAx5vknNhj61_5ieAwnWOR9cmkTseL/view?usp=sharing</a></div>
</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">
<div class="">I'm just looking at the HDF5 file. The structure is like this</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">> $PETSC_DIR/$PETSC_ARCH/bin/h5dump -H restart_00020.h5</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> </span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">HDF5 "restart_00020.h5" {</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">GROUP "/" {</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> GROUP "cell_fields" {</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> DATASET "Solution_FV solver" {</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> DATATYPE H5T_IEEE_F64LE</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> DATASPACE SIMPLE { ( 21, 3884, 5 ) / ( H5S_UNLIMITED, 3884, 5 ) }</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> ATTRIBUTE "vector_field_type" {</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> DATATYPE H5T_STRING {</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> STRSIZE 7;</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> STRPAD H5T_STR_NULLTERM;</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> CSET H5T_CSET_ASCII;</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> CTYPE H5T_C_S1;</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> }</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> DATASPACE SCALAR</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> }</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> }</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> }</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> GROUP "fields" {</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> DATASET "Solution" {</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> DATATYPE H5T_IEEE_F64LE</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> DATASPACE SIMPLE { ( 21, 5060, 5 ) / ( H5S_UNLIMITED, 5060, 5 ) }</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> }</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> }</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> DATASET "time" {</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> DATATYPE H5T_IEEE_F64LE</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> DATASPACE SIMPLE { ( 21, 1 ) / ( H5S_UNLIMITED, 1 ) }</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class=""> }</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">}</span></div>
<div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal" class="">
<span style="font-variant-ligatures:no-common-ligatures" class="">}</span></div>
</div>
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class=""><br class="">
</div>
<div class="">I would like the reader to read the /fields/Solution group basically, but I am not even sure it tries to do that.</div>
<div class="">Anyhow, I got an error, saying that the size found in the file (105) does not match the expected size (25300). If I look at the shape of /fields/Solution it is given as (21, 5030, 5). First, it is weird, cause the 21 seems to be 1 + current iteration
number ... but anyways we find the 5 variables and the 5030 cells. Only the reader seems to do 21 * 5 when it should be doing 5030 * 5 ...</div>
<div class="">I tried adding 'PetscViewerHDF5PushGroup(hdf5Viewer, "/fields/Solution", ierr)' to force it to read that group, but it does not change anything.</div>
</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">You definitely need to push the group, unless it's the root group "/". There is no way the reader would guess the correct group if it's not the root one [and I don't think it would be a good idea to implement such searching].</div>
<div class=""><br class="">
</div>
<div class="">If you tried adding</div>
<div class=""> PetscViewerHDF5PushGroup(hdf5Viewer, "/fields/Solution", ierr)</div>
<div class="">you likely pushed a wrong group. If the Vec name was set to "Solution" like in your snippet [using PetscObjectSetName()], the absolute dataset name to look up would be "/fields/Solution/Solution".</div>
<div class=""><br class="">
</div>
<div class="">But in your file, there's just a dataset "/fields/Solution", so its parent group is just "/fields". So please try pushing this.</div>
<div class=""><br class="">
</div>
<div class="">I would gladly try to reproduce your case - perhaps the error handling should be improved so that it would guide you into the right direction. But it would be helpful to know exactly what you're doing - the snippet with VecView() above should
produce "/Solution" dataset but in the file you're sending, there's "/fields/Solution".</div>
<div class=""><br class="">
</div>
<div class="">Note also you don't need to do VecZeroEntries() before loading because VecLoad() fully rewrites the Vec data in memory anyway.</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class=""><br class="">
</div>
<div class="">I would appreciate it if anyone could give me pointers on this issue ...
<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Thank you very much in advance !!</div>
<div class=""><br class="">
</div>
<div class="">Thibault<br class="">
</div>
</div>
</div>
</blockquote>
<br class="">
</div>
<div class="">Thanks,</div>
<div class="">Vaclav</div>
<br class="">
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<br clear="all" class="">
<div class=""><br class="">
</div>
-- <br class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">
-- Norbert Wiener</div>
<div class=""><br class="">
</div>
<div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class="">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<br clear="all" class="">
<div class=""><br class="">
</div>
-- <br class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">
-- Norbert Wiener</div>
<div class=""><br class="">
</div>
<div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class="">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<br clear="all" class="">
<div class=""><br class="">
</div>
-- <br class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">
-- Norbert Wiener</div>
<div class=""><br class="">
</div>
<div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class="">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<br clear="all" class="">
<div class=""><br class="">
</div>
-- <br class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">
<div dir="ltr" class="">
<div class="">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">
-- Norbert Wiener</div>
<div class=""><br class="">
</div>
<div class=""><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" class="">https://www.cse.buffalo.edu/~knepley/</a><br class="">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</div>
</body>
</html>