Hello everyone!
I am trying to obtain the timestamp associated with the HDF5 file (in the function readHDF5Files) in Fenics 2019.1.0
// A function that writes HDF5 files:
def output_state(mesh,var,fname,t):
ff=HDF5File(mesh.mpi_comm(),fname + '.h5', 'w')
ff.write(mesh,'mesh')
ff.write(var,'var',t)
ff.close()
def get_space(mesh):
Q = FiniteElement("Lagrange", mesh.ufl_cell(), 1)
V = VectorElement("Lagrange", mesh.ufl_cell(), 2)
W = FunctionSpace(mesh,MixedElement([V,Q,Q,Q,Q]))
return W
/* Reading of HDF5 files*/
def readHDF5Files(filePath):
mesh = Mesh()
f=HDF5File(mesh.mpi_comm(),filePath, 'r')
f.read(mesh,"mesh",False)
var = Function(get_space(mesh))
f.read(var,"var")
u,p,c,q,phi = var.split(True)
return u
Until now I have been saving HDF5 files based on iteration numbers (iterations in the loop: for eg., state100.h5, state200.h5 …) and the time step for the simulation is fixed. However I am now using variable time steps and I want to obtain the timestamp associated with the quantity being returned by the function readHDF5Files.
Any insights or leads would highly be appreciated.