Clarification regarding creating VTKHDF5 file for CFD

I am Suman Vajjala and I am developing a parallel, high order, unstructured grid based CFD code in C++ for LES/DNS. As I will be using high order mesh elements, I decided to use Paraview as my main visualization software.

I am writing for help regarding writing a VTK file in HDF5 format. I have followed the Kitware githib link for file formats and also your blog post for this. However, I am not clear regarding some specifics for implementation and I will be grateful if you can provide help (@danlipsa @berkgeveci ).

I understand that sizeof means the size of the data type in bytes(?). However, I do not understand how the offset is computed. Can you please illustrate this with a small example?

Also, I am not clear how the point and cell data for each partition/rank are stored. Are they stored as is with some kind of global to local mapping/numbering of elements? Can you please elaborate?

Is there a small example I can use as a reference?

@danlipsa provided a link for a python script to convert (p)vtk (or p(vtu)?) xml to vtk hdf5 file. If I want to use the script, then how do I write the pvtu/pvtk file for my application? Can you point me to a CFD specific example? I know that the VTK API has a pvtu/pvtk file writer but I do not know how to implement it for my case.

Regards
Suman

Hi Suman,

I am Suman Vajjala and I am developing a parallel, high order, unstructured grid based CFD code for LES/DNS. As I will be using high order mesh elements, I decided to use Paraview as my main visualization software.

I am writing for help regarding writing a VTK file in HDF5 format. I have followed the Kitware githib link for file formats and also your blog post for this. However, I am not clear regarding some specifics for implementation and I will be grateful if you can provide help (@danlipsa @berkgeveci ).

I understand that sizeof means the size of the data type in bytes(?).

In number of items (this is what the hdf API requires in python and I assume in c++ as well.)
https://gitlab.kitware.com/danlipsa/vtkxml-to-vtkhdf/-/blob/main/vtkxml-to-vtkhdf.py#L34

However, I do not understand how the offset is computed. Can you please illustrate this with a small example?

Also, I am not clear how the point and cell data for each partition/rank are stored. Are they stored as is with some kind of global to local mapping/numbering of elements? Can you please elaborate?

Is there a small example I can use as a reference?

This link shows you the header and the value of attributes for the can dataset split in three partitions.

https://examples.vtk.org/site/VTKFileFormats/#unstructuredgrid_1

The actual data is part of the VTK testing
ctest -R HDFReader

You can start the paraview server on three ranks and the HDFReader will load each partition on a rank:

bin/mpiexec -n 3 bin/pvserver&

bin/paraview --url=cs://constanta:11111

then load
https://drive.google.com/file/d/1O1nxG1DyODLN5BKy2E8_72W5KD02TfT_/view?usp=share_link

or if you have a VTK build
./ExternalData/Testing/Data/can-pvtu.hdf