Defining Time-Varying Sources with ParaView’s Programmable Source

One question about ParaView that comes up from time to time is how to define time-varying data sources with the Programmable Source. I’ll show the basics of doing this here.

Let’s start by looking at a simple example that produces a single static sphere. First, fire up ParaView and create a Programmable Source. The Script property for the Programmable Source in this example should be:

This creates a simple sphere source at the origin. Pretty boring, right?

Let’s make the sphere radius vary with time. To do this, we need to tell ParaView that our Programmable Source produces time-varying data. First, we tell the pipeline that the source has time information and define the time values in the Script (RequestInformation) property:

Here, we define 100 timesteps [0, 1, 2, … 99]. We need to inform the pipeline about the time range as well as the actual time values themselves. To do this, we set the vtkStreamingDemandDrivenPipeline.TIME_RANGE() and vtkStreamingDemandDrivenPipeline.TIME_STEPS() information keys in the output information.

Next, we adjust our original Script property to modify the radius according to the time value. We retrieve the time value with the vtkStreamingDemandDrivenPipeline.UPDATE_TIME_STEP() key in the output information from the Programmable Filter and derive a radius value from it.

When you click the Apply button on the Programmable Filter, you will notice that the number of time steps in the animation controls jumps to 100. If you click the play button, you will see a pulsing sphere.

Obviously, you can do a lot more with the timestep values. See, for example, section 13.2.2 in the ParaView User’s Guide for how to read series of CSV files where each one defines a different timestep.

Update 2016/1/5: To create an XML filter with a time-varying Programmable Source as outlined in this blog post, you will need to add one special property to the XML describing your source. Simply add this XML to your proxy XML description to let ParaView know your source provides time-varying data:

9 Responses to Defining Time-Varying Sources with ParaView’s Programmable Source

  1. Pingback: Christian H

  2. Pingback: Cory Quammen

  3. Pingback: Cory Quammen

  4. Pingback: Christian H

  5. Pingback: Farid

    • Pingback: Cory Quammen

      • Pingback: Farid

  6. Pingback: Patrick Heenan

    • Pingback: Cory Quammen

Questions or comments are always welcome!