Read back .h5 file created when exporting function to xdmf file

Hello,
In this minimal working example

from __future__ import print_function
from fenics import *

mesh = UnitSquareMesh(96, 96)
V = FunctionSpace(mesh, "Lagrange", 1)

v  = Function( V )
w  = Function( V )

expr = Expression("p*x[0]", degree = 1, p = 1.0)
v.interpolate(expr)

# write to XDMF file, this creates v.xdmf and v.h5
XDMF_file_v = XDMFFile(  'v.xdmf' )
XDMF_file_v.write(v)

#read back from v.h5 and store the result in w
HDF5_file_read = HDF5File( MPI.comm_world, "v.h5", "r" )
HDF5_file_read.read(w, "/f" )
HDF5_file_read.close()

i write the function v to an xdmf file: this creates an .xdmf and an .h5 file. Then I read back the .h5 file and write the result into the function w, but I get the following error:

HDF5-DIAG: Error detected in HDF5 (1.10.0-patch1) MPI-process 0:
  #000: ../../../src/H5L.c line 873 in H5Lexists(): no name specified
    major: Invalid arguments to routine
    minor: Bad value
HDF5-DIAG: Error detected in HDF5 (1.10.0-patch1) MPI-process 0:
  #000: ../../../src/H5O.c line 663 in H5Oget_info_by_name(): no name
    major: Invalid arguments to routine
    minor: Bad value
Traceback (most recent call last):
  File "example.py", line 21, in <module>
    HDF5_file_read.read(w, "/f" )
RuntimeError: 

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***     fenics-support@googlegroups.com
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to read function from file.
*** Reason:  Group with name "/f" does not exist.
*** Where:   This error was encountered inside HDF5File.cpp.
*** Process: 0
*** 
*** DOLFIN version: 2019.1.0
*** Git changeset:  74d7efe1e84d65e9433fd96c50f1d278fa3e3f3f
*** -------------------------------------------------------------------------

With the same reading lines above I can successfully read an .h5 file which I created (without an .xdmf file) by setting “/f” as a group name, with

HDF5_file_write = HDF5File( "v.h5", "w" )
HDF5_file_write.write( v, "/f" )
HDF5_file_write.close()

However, I don’t know that the group name is when the .h5 file is created with an .xdmf file. How do I find out ? How may I change it ?

Thank you

These two formats are different.

XDMF has a strict setup, where the xdmf contains an xml tree that points to data in the h5 file.

HDF5 is a non specified format, and HDF5File.write creates a different h5 file than XDMFFile.write.

If you want to read in data from XDMFFile, use write_checkpoint and read_checkpoint.

Thank you.
My code contains a time loop, and I can make it write at each iteration in the loop the function v into a .xdmf file with

mesh = UnitSquareMesh(96, 96)
V = FunctionSpace(mesh, "Lagrange", 1)
v  = Function( V )

# Time-stepping
xdmffile_v = XDMFFile('v.xdmf' )
for step in range(10):
        [... compute v ...]
        xdmffile_v.write(v, step)

However, the code may crash before the loop is finished. If the code crashes at, say, step = 5, I be able to recover the fields written for steps < 5 and write them into a function v2 = Function( V ) by using write_checkpoint and read_checkpoint in another Python code ?

If the code crashes like that, the xdmf file is corrupted and Paraview cannot open it.