<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>hi,</p>
    <p>I reported this bug back in 2021 and it was meant to be fixed,
      but I have just been testing this HDF5 file reading stuff with
      more recent versions of PETSc and it doesn't look like it has
      actually been fixed.</p>
    <p>The issue was with reading HDF5 files that had been written with
      PETSc before the HDF5 timestepping stuff (e.g.
      PetscViewerHDF5PushTimestepping()) was introduced in PETSc 3.16.
      The default timestepping (if not present in the HDF5 file) was
      assumed false. The function
      PetscViewerHDF5SetDefaultTimestepping() was introduced so you
      could set the default true if needed.</p>
    <p>The offending line in src/vec/is/utils/hdfio.c was supposed to
      read the timestepping attribute, applying the default if it wasn't
      present. However there was a bug which I found in it (see below).</p>
    <p>Now (even in latest main branch), the line hdf5io.c:21 reads
      essentially:</p>
    <p>
PetscViewerHDF5ReadAttribute(viewer,name,"timestepping",PETSC_BOOL,&timestepping,&timestepping)</p>
    <p>which also looks wrong to me, though in a slightly new way (and
      still doesn't seem to work). I'd have thought (as in 2021) that it
      should read:</p>
    <p>
PetscViewerHDF5ReadAttribute(viewer,name,"timestepping",PETSC_BOOL,&hdf5->defTimestepping,&timestepping)</p>
    <p>Is that not right?</p>
    <p>Regards, Adrian<br>
    </p>
    <div class="moz-cite-prefix">On 4/11/21 00:39, Matthew Knepley
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CAMYG4Gk6q=hjRb6z-vqQE9_0gohq7rzbEWB8du6VFC+U3FdB4A@mail.gmail.com">
      <div dir="ltr">
        <div dir="ltr">On Tue, Nov 2, 2021 at 9:41 PM Adrian Croucher
          <<a href="mailto:a.croucher@auckland.ac.nz" moz-do-not-send="true" class="moz-txt-link-freetext">a.croucher@auckland.ac.nz</a>>
          wrote:<br>
        </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>
              <p>hi again,</p>
              <p>I found the bug. At hdf5io.c:24, the arguments in the
                call to PetscViewerHDF5ReadAttribute() are in the wrong
                order. It should be:</p>
              <p>  ierr =
PetscViewerHDF5ReadAttribute(viewer,name,"timestepping",PETSC_BOOL,&hdf5->defTimestepping,&timestepping);CHKERRQ(ierr);</p>
            </div>
          </blockquote>
          <div><br>
          </div>
          <div>Adrian, you are the best. Thanks for fixing it. I pushed
            your fix into the branch and am now starting CI testing.<br>
          </div>
          <div><br>
          </div>
          <div>    Thanks again,</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>With this change both the test code and my actual
                Waiwera code work properly.</p>
              <p>- Adrian<br>
              </p>
              <div>On 11/3/21 11:55 AM, Adrian Croucher wrote:<br>
              </div>
              <blockquote type="cite">
                <p>hi Matt<br>
                </p>
                <div>On 11/2/21 10:18 PM, Matthew Knepley wrote:<br>
                </div>
                <blockquote type="cite">
                  <div dir="ltr">
                    <div class="gmail_quote">Okay, so there is something
                      funny with the viewer we are getting. Is there any
                      way for me to run this? I can just step through
                      <div>with the debugger and find out why that var
                        is not set.</div>
                    </div>
                  </div>
                </blockquote>
                <p>I have written a little minimal example program which
                  you can debug- attached testh5.c, and HDF5 file
                  fluid.h5 which it reads. It crashes in VecLoad() with
                  the same kind of error I get in my actual code (and
                  the same as if you leave out the call to
                  PetscViewerHDF5SetDefaultTimestepping()).<br>
                </p>
                <p>I've debugged through it myself and the default
                  timestepping in the viewer is true until somewhere in
                  the call to PetscViewerHDF5ReadAttribute() at
                  hdf5io.c:24 (in
                  PetscViewerHDF5CheckTimestepping_Internal()), where it
                  turns false for some reason. </p>
                <p>- Adrian<br>
                </p>
              </blockquote>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Dr Adrian Croucher
Senior Research Fellow
Department of Engineering Science
University of Auckland, New Zealand
email: <a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:a.croucher@auckland.ac.nz" moz-do-not-send="true">a.croucher@auckland.ac.nz</a>
tel: +64 (0)9 923 4611
</pre>
  </body>
</html>