# Clarification regarding creating VTKHDF5 file for CFD

**URL:** https://discourse.paraview.org/t/clarification-regarding-creating-vtkhdf5-file-for-cfd/12115
**Category:** ParaView Support
**Tags:** vtk
**Created:** [May 16, 2023, 5:46pm UTC](https://discourse.paraview.org/t/clarification-regarding-creating-vtkhdf5-file-for-cfd/12115 "2023-05-16T17:46:02Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Suman\_Vajjala](https://discourse.paraview.org/user_avatar/discourse.paraview.org/suman_vajjala/32/8560_2.png) [@Suman\_Vajjala](https://discourse.paraview.org/u/Suman_Vajjala)
#### Post date: [May 16, 2023, 5:46pm UTC](https://discourse.paraview.org/t/clarification-regarding-creating-vtkhdf5-file-for-cfd/12115/1 "2023-05-16T17:46:02Z")

</div>

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

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.paraview.org/user_avatar/discourse.paraview.org/danlipsa/32/1563_2.png) [@danlipsa](https://discourse.paraview.org/u/danlipsa)
#### Post date: [May 16, 2023, 7:20pm UTC](https://discourse.paraview.org/t/clarification-regarding-creating-vtkhdf5-file-for-cfd/12115/2 "2023-05-16T19:20:15Z")

</div>

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](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](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](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
