VTKHDF usage

I am evaluating the possibility of converting my data I/O to using the VTKHDF format.

I am using ParaView v6.2.0-RC1. My datasets are made of single-block unstructured grids (either hexs, or quads)

I can use the following command without issues. ParaView writes all my data

SaveData(‘vol.vtkhdf’, proxy=vol, WriteAllTimeSteps=1, SplitByTimeSteps=1)

Reading the surface element data does not satisfy all my requirements:
the true values of my timesteps are lost. TimestepValues are simply in the range [0, N-1]

When writing a timeseries, a “master” file without a numbered index is written. Yet, ParaView cannot automatically detect it is a VTK HDF file, even though it has a .vtkhdf extension. So I wonder what is the real purpose of the master file, and how it can be used. Attempting to open it directly with a VTKHDFReader() results in an error.

While opening my quad mesh files singularly succeeds without error (meshes are small, around 25 M cells), opening my hexahedral mesh files breaks with errors (I suspect connectivity list uses 32-bit integers, but my meshes are big (around 300 M cells)

( 358.186s) [pvserver ] vtkHDFUtilities.cxx:222 ERR| (nullptr): Error H5Dread start: 0, count: 2361934848
( 358.186s) [pvserver ] vtkHDFReader.cxx:116 ERR| (nullptr): Cannot read the Connectivity_0_ array from file
( 358.186s) [pvserver ] vtkHDFReader.cxx:1223 ERR| vtkHDFReader (0x2e678210): Cannot read the Connectivity array

One last question. My mesh is static overtime, but I don’t see an option to specify that in SaveData(). I thought there had been some support for that. What am I missing to activate that?

Thanks in advance for the feedback.

Yet, ParaView cannot automatically detect it is a VTK HDF file, even though it has a .vtkhdf extension. So I wonder what is the real purpose of the master file, and how it can be used. Attempting to open it directly with a VTKHDFReader() results in an error.

Im unable to reproduce this, it works well for me.

You should open this master file and you should NOT open the file series.
You should not even use SplitByTimeSteps unless you have a specific need for it tbh.

In any case, please share steps to reproduce the issue.

One last question. My mesh is static overtime, but I don’t see an option to specify that in SaveData(). I thought there had been some support for that. What am I missing to activate that?

Its automatic, assuming your data is properly static (GetMeshMTime() does not change over time).
If it is not, you can force it using “ForceStaticMesh” filter.

I also experiment with VTKHDF and my experience is the same: it seems that the vtkHDFWriter does not yet support writing static meshes: #19888. However, you can easily do it yourself. As far as I understand, VTKHDF is an HDF5 file, which must satisfy the specification so that it can be read by ParaView. It means that you can use an existing HDF5 library to write your data into a .vtkhdf file. An important implication of this is that if you want to write your data while the simulation is running, you can now do it easily with an HDF5 library, no need to introduce the heavy VTK dependency. Technically, you could write binary XML VTK files “by hand” without VTK, that’s what we did, but it is error-prone and not easy in MPI parallel mode. And forget the in-memory compression without the VTK library…

There is a nice tutorial on how to create VTKHDF files from Python, using h5py (by the way, h5py comes with the ParaView binary release, so writing VTKHDF with pvpython works out of the box). But the same logic applies to write it from other languages, just respect the specification. There is a section in the tutorial for writing static meshes, and an associated script.

VTKHDF has more and more features, check out the implementation status.

If you want to convert an existing XML-based grid to the VTKHDF format, there is a script for that, although I don’t know if it supports static meshes.

Other blog posts I found useful:

Already fixed.