Catalyst: In-Situ Visualization
Typically, the results of a simulation are visualized in ParaView only after the simulation is complete and the results have been written to disk. These results are then imported into ParaView and a visualization pipeline is created to render them as desired. This workflow is successful in many situations, but suffers the limitation of having separated simulation and visualization processes and incurs the overhead of lots of disk I/O.
Catalyst is a framework that allows ParaView to operate "in situ" with a simulation. The simulation communicates more directly and simultaneously with ParaView, providing the following benefits:
- Uses memory instead of disk to send data from a simulation to ParaView, saving time by avoiding expensive disk operations.
- Can update the visualization data after each iteration of the simulation and easily generate visualization output for each iteration.
- Allows feedback from ParaView to control the simulation.
The Catalyst User's Guide is an excellent resource for learning more about the details of working with Catalyst. It contains an overview of the functionality and its underpinnings, followed by explanations of how to adapt simulations to work with Catalyst and how users interact with Catalyst from within ParaView. To better understand what Catalyst can do for your research, you can read about some successful catalyst-enabled simulations.
Modifying a Simulation to Communicate With Catalyst
Simulation code can be interfaced with Catalyst by writing an "adapter", which is responsible for converting simulation data into forms that Catalyst can use within ParaView. This involves writing three main functions: one to initialize Catalyst, one to update Catalyst with data and time information after each simulation time-step, and one to clean things up when the simulation is complete.
These functions will need to call methods in both the
VTK API and the
VTK Coprocessing API.
Simulations that are written in C++ can directly call these APIs,
and those written in Python can use the ParaView wrapper modules paraview.vtk
,
paraview.simple
and
paraview.coprocessing
.
Source code for numerous examples of Catalyst integrations can be found
on GitHub.
Connecting ParaView to a Simulation
A ParaView user will need to create an appropriate visualization pipeline to accept and process the data that the Catalyst-enabled simulation is feeding to it. This process can be simplified by using the "Catalyst Script Generator" plugin that is included with the ParaView installation. This plugin produces a Python script that will build a visualization pipeline and then respond to the Catalyst-enabled simulation's function calls. The Catalyst User's Guide describes the use of this plugin, which involves providing a representative data set and then running a "wizard" to specify what the script will do with the data it receives.
Controlling a Simulation From ParaView
If "Catalyst Live" has been enabled in the script that connects ParaView to the simulation,
the ParaView user can control the simulation by using the Catalyst
menu in ParaView.
- Catalyst→Connect establishes the connection between the two processes.
- Catalyst→Pause Simulation will cause the simulation to pause the next time it sends data to ParaView.
- Catalyst→Set Breakpoint lets the user specify a runtime after which to pause the simulation.
- Catalyst→Continue resumes the simulation after either of these pauses.
A recorded demonstration of this functionality is available.