2

I print out data from C/C++ simulation code to vtk files at each time step. I create numbered data files (e.g. data.000.vtk, data.001.vtk, …).

I am having trouble with including the time from each calculation step in these vtk files that contains structured grid data so that I can view time (seconds) by paraView during animation.

Is that possible in any way? Your help is really appreciated.

Ali_Sh
  • 2,667
  • 3
  • 43
  • 66
  • 1
    Can you be more specific on what the problem is? The standard VTK file format (documented at http://www.vtk.org/VTK/img/file-formats.pdf) supports structured grids. If you create a numbered series of files (e.g. data001.vtk, data002.vtk, data003.vtk,...), then ParaView will read them in as a time sequence. Is there some particular part that is not working for you or some particular feature that is missing? – Kenneth Moreland Sep 16 '16 at 21:17
  • Thanks very much for the response. Exactly, I create a numbered series of files (e.g. data001.vtk, data002.vtk, data003.vtk,...), These numbers are time loop numbers. I need to include time (seconds) from each step of the calculations in the vtk file so that I can view the time (seconds) during animation not the loop number. – mohamed mohsen Sep 18 '16 at 09:42

1 Answers1

1

Unfortunately, there is no way to record the simulation time in the legacy VTK file format. Thus, if you want to pass the time from the simulation to ParaView, you will need to use a different file format.

I think the easiest way to record the simulation time is to use a ParaView Data (PVD) file. A PVD file is a simple XML file that captures metadata about a group of data files, and time value information is one of the things that can be captured. A brief description of the PVD format is given at http://www.paraview.org/Wiki/ParaView/Data_formats#PVD_File_Format. The example on that page has "timestep" values that are integers starting at 0, but you can replace them with any sequence of floating point numbers.

The PVD file itself does not hold the data itself. Rather, it points to other files that have the actual data. The data files it points to have to be in the newer XML-based VTK file formats (vti, vtr, or vts depending on the nature of your structured data). The XML-based VTK file format is also documented in http://www.vtk.org/VTK/img/file-formats.pdf (after the documentation for the legacy VTK format).

Ali_Sh
  • 2,667
  • 3
  • 43
  • 66
  • There _is_ a way to record the simulation time even in the legacy VTK file format: http://www.visitusers.org/index.php?title=Time_and_Cycle_in_VTK_files Unfortunately ParaView cannot interpret the field data as expected... – Jakub Klinkovský Mar 20 '20 at 13:02
  • Actually, you can use the ParaView filter "Annotate Global Data" to visualize any field data, including CYCLE and TIME. – Jakub Klinkovský Mar 20 '20 at 13:09