StaticMeshPlugin: A ParaView plugin to take benefit from transient dataset with fixed geometry

Kitware has just released the StaticMeshPlugin for ParaView !

Postprocessing of temporal dataset with static geometry is wide spread in several physics domains like CFD and mechanics.

A screenshot from a temporal dataset with a static geometry from Code_Saturne

The aim of this plugin is to optimize post-processing and visualization time of transient datasets with static geometries. Currently, there is no specific handling of this case in ParaView/VTK filters, and thus they recompute everything when the time step changes.

Note: The terms mesh and geometry will be used interchangeably.

However, you can easily think of a typical case of static mesh slicing: the slice geometry will not change over time, only the attached data (point, cell or field data) will change, so you could avoid the computation time linked to the slice geometry computation.

A static mesh optimized (SMO) implementation of a filter typically uses a cache to store the geometry.
It will then only compute the data and attach it to a shallow copy of the cached geometry. A static filter can detect if its cache becomes invalid by using the GetMeshMTime() method. In that case, the cache will be recomputed.

Of course, this can provide huge speedups when used right (see the benchmark section).

This plugin addresses the case of static meshes by replacing certain readers and filters by their own SMO version operating with static meshes.

On the Readers/Sources side, we make sure to create the geometry only once and store it in a cache. When executed with other timesteps, this cache will always be used (unless some parameters change), saving the reading and the mesh construction time. Only the point, cell and field data will be read.

On the Filters side, we consider the modification time of the dataset in order to know if the cached mesh needs to be recomputed.

Surface Filter without static mesh optimization
Surface Filter with static mesh optimization

Implementation

A SMO implementation of a filter typically uses a cache to store the geometry. It will then only compute the point, cell and field data and set it on the cached geometry. A static filter can detect if its cache has become invalid by using the GetMeshMTime(), in that case, the cache will be recomputed. Of course, this can provide huge speedups when used right.

For now, the following filters are supported by this plugin:

  • vtkDataSetSurfaceFilter / Extract Surface (used internally by ParaView for the rendering)
  • vtkPlaneCutter / Slice with plane
  • vtkUnstructuredGridGhostCellGenerator / Generate Ghost Cells (only available if PARAVIEW_USE_MPI is ON)

Note that, for now, only unstructured grids or multiblocks containing a single unstructured grid are supported in input.

A SMO implementation of a reader uses a similar mechanism, as it will generally only read the geometry the first time it is executed, and then only read the data associated with the following time steps and update it on its cached geometry.

Currently, only a single reader is supported by this plugin:
EnSight Reader, in all its versions: 6, 6Binary, Gold and GoldBinary.
In the EnSight format, there is no way to detect if a dataset is actually static or not, so the user should choose by checking, or not, the UseStaticMesh checkbox.

There is also a specific source in the plugin, that lets you generate static
meshes from scratch: vtkTemporalUGWavelet / Temporal Unstructured Grid Wavelet

Moreover, the specific filter vtkForceStaticMesh / Force Static Mesh provided by this plugin forces its output to be considered as a static mesh and can be used to optimize the pipeline downstream.

Benchmark

Generated Data

This benchmark has been done on a generated, 16M cells, dataset. The timings have been taken three times for each measure and averaged.

  • SurfaceFilter :
    • No plugin / First time step : 25.5137s
    • Plugin further time steps : 0.8198s -> x31.2 speedup
  • SliceWithPlane
    • No plugin / First time step : 17.9882s
    • Plugin further time steps : 0.0674s -> x266.65 speedup
Slice With Plane without static mesh optimization
Slice With Plane with static mesh optimization

Real Data

This benchmark has been done on a actual Ensight Gold Binary dataset of CFD bench study computed by Code_Saturne. It contains ~13M cells and ~34M Points. The timings have been taken three times for each measure and averaged.

  • EnsightGoldBinaryReader :
    • No plugin / First time step : 1.1331s
    • Plugin further time steps : 0.5422s -> x2.01 speedup
  • SurfaceFilter :
    • No plugin / First time step : 7.4548s
    • Plugin further time steps : 0.0693s -> x107.5 speedup
  • SliceWithPlane
    • No plugin / First time step : 2.4890s
    • Plugin further time steps : 0.0032s -> x777.8 speedup

You can easily see that, with these kinds of speedups, a dataset that previously could not be animated interactively can now become smoothly animated.

Animating a slice of an Ensight Gold Binary dataset without the plugin
Animating a slice of an Ensight Gold Binary dataset with the plugin

Limitations

  • 1. Static pipeline break

Most “non-static” filters (e.g. Clip) completely rewrite the geometry of the mesh when executed. Therefore including one between two static filters/readers will trigger cache re-computation in the filters below, loosing all potential speedups. A work around is to add a vtkForceStaticMesh filter to make sure filters downstream keep using static mesh optimization, considering those filters do not break the static pipeline.

  • 2. Parallel support

The EnSight reader given in this plugin does not support parallelism. Even if PARAVIEW_USE_MPI is true, the file will be read with a single node.

  • 3. VTK_ALL_NEW_OBJECT_FACTORY

This plugin relies on the VTK factory mechanism in order to replace a filter by another. This option is not enabled by default in ParaView for performance reasons. For this reason, this plugin is not compatible with ParaView’s binary release.

  • 4. Multi-block datasets support

The vtkStaticcPlaneCutter and vtkForceStaticMesh applied on a multiblock dataset only process the first block.

  • 5. Reader XML duplication

There is no way to inherit and override a proxy at the same time. In order to provide static related option in the GUI of the readers, it was necessary to duplicate the XML of these proxies.

Future Work

In order to improve this plugin usability and functionality, increase set of readers and filters taking advantage of static mesh optimization would be very beneficial. The following readers come to mind : All XML readers, Exodus Reader, OpenFOAM reader. The following filters come to mind : Clip, Threshold, Extract Selection.

Then, the need for the VTK_ALL_NEW_OBJECT_FACTORY CMake variable could be removed by making modifications into VTK. Doing this may let us consider the possibility of providing a binary build of this plugin which would be compatible with ParaView’s binary release and also potentially with package managers provided ParaView.

Finally, an actual inclusion of the static mechanism into VTK could be discussed regarding the tradeoff between performance gain and complexity of implementation it implies.

Acknowledgments

This work was initiated by Code_Saturne

This work was supported by EDF (Electricité de France)

Developments were done by Kitware Europe, France

Questions or comments are always welcome!

X