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!