precice icon indicating copy to clipboard operation
precice copied to clipboard

Create Paraview .pvd files for time-window exports

Open fsimonis opened this issue 1 year ago • 3 comments

Please describe the problem you are trying to solve.

preCICE exports are numbered either using the current time window or iteration. For exported time windows, it can be tedious to visualize the results as they are decoupled from the actual time.

When comparing exports to other exports, this is not an issue as all exports follow the same numbering scheme, assuming no mixed time-window-sizes.

It can be tedious to synchronize exports of preCICE to exports of the solvers, as they may follow different time scales.

Describe the solution you propose.

As exports of time-window have a unique mapping from file to time, we can export this mapping in the shape of a .series file.

Example of a Paraview series file SolidMesh-Solid.vtk.series:

{
  "file-series-version" : "1.0",
  "files" : [
    { "name" : "SolidMesh-Solid.dt0.vtk", "time" : 0 },
    { "name" : "SolidMesh-Solid.dt1.vtk", "time" : 0.1 },
    { "name" : "SolidMesh-Solid.dt2.vtk", "time" : 0.2 }
  ]
}

This allows to directly integrate the visualization of the preCICE exports with the result of OpenFOAM foamToVTK script.

Describe alternatives you've considered

Instead of handling this in the Export, we could also create a generator-script. Meshes, Participants, time-window-sizes and exports can be extracted from the configuration file.

fsimonis avatar Apr 05 '24 08:04 fsimonis

An alternative seem to be pvd files, which are in XML.

fsimonis avatar Apr 05 '24 09:04 fsimonis

I have encountered .pvd files in the wild, but not .series, as far as I can remember. Definitely a nice addition!

MakisH avatar Apr 05 '24 18:04 MakisH

It seems that pvd is the perfect fit. It can be used to refer to any kind of data loadable by Paraview and can refer to various parts per timestep. So in theory it can be used for all exporters, even to load partitioned CSV.

<VTKFile type="Collection" version="0.1">
  <Collection>
    <DataSet file="mypiece_dt1.pvtu" timestep="0.001"/>
    <DataSet file="mypiece_dt2.pvtu" timestep="0.002"/>
  </Collection>
</VTKFile>

For formats with multiple parts:

<VTKFile type="Collection" version="0.1">
  <Collection>
    <DataSet file="mypiece_r0.csv" part="0" timestep="0.001"/>
    <DataSet file="mypiece_r0.csv" part="1" timestep="0.001"/>
  </Collection>
</VTKFile>

fsimonis avatar Apr 23 '24 09:04 fsimonis