VTK - separate mesh and data files

Hi! I am running a simulation on a static, unstructured mesh. Currently I output the variables at every timestep using .vtu files, but it seems wasteful to output the mesh points & connectivity that many times since the mesh does not evolve.

Is it possible to point the .vtu file containing cell data to a separate points/connectivity file? And if so, what might that look like? Thank you!

1 Like

Hi @nikic,

You might want to take a look at the “.pvtu” format (https://kitware.github.io/vtk-examples/site/VTKFileFormats/). You might be able to use the indirection provided by the format (usually to read distributed datasets) to read your field and mesh files independently.

If that does not work, I would advise you to look into the XDMF format (XDMF Model and Format - XdmfWeb) supported by ParaView. While changing the format of your files may be cumbersome, this file format is really meant for the kind of storage optimizations you are describing.

Hope that helps!

Best regards,

Julien

3 Likes

Hi there @jfausty , I think you have a good point.

My understanding is that you are proposing to use a vtu file to hold all the geometry point information, another file to hold the field data at a particular moment, and then a pvtu file to link these files together.

However, I looked up the documentation and tutorials for the vtk library and didn’t find any relevant examples. The relevant functions of the vtkXMLPUnstructuredGridWriter class do not look like the functionality I want. Can you provide a simple example to show me how to do this?

Or, did you @nikic already achieved this, and could you show me your implementation?

Many thanks!

Hi @metorm, I have not achieved this yet unfortunately, been occupied with other work! And @jfausty - a belated thank you for the suggestions!

I believe the .pvtu files allow you to combine several individual .vtu files. However as @metorm says, I don’t think VTK has the functionality to direct the points data to a separate file.

Had a brief look at xdmf - this might be closer to what I’m trying to achieve. It looks like you can include a points array in an .h5 file, and point the xdmf file to it. I haven’t seen an explicit example though, so that’s just a guess. Will update this thread if I try it successfully, please do the same!

I posted my exploration here for reference. Basically, I think we cannot achieve this without modifying VTU itself.

Hi @metorm, that is a shame. As I said before, I’ll try at some point to use xdmf instead of vtu files, but it’s quite some effort so may take a while.

Side note - you might want to check out this plugin. It doesn’t address the problem of large data sizes, but it may help with paraview visualisation times.
https://www.kitware.com/staticmeshplugin/

Im afraid such a feature is not planned for the VTU XML format but may be added in the vtkHDF format in the future.

https://gitlab.kitware.com/vtk/vtk/-/issues/19216