[Paraview] Python scripting: Updating PVDReader source when pvd file has changed and rendering latest time step

Florian Rathgeber frat at kth.se
Fri Mar 19 08:40:31 EDT 2010


Hi,

I'm trying to get ParaView to work in an interactive context for
numerical simulations. The first goal is to have ParaView visualize time
steps as they are output by the solver (vtu for individual steps, pvd as
collection). I searched the wiki, mailing lists etc. and it seems this
cannot be done easily.

My current approach uses the python scripting interface. I open a socket
in python and wait for messages from the solver that a time step was
finished and a new file written out. When this happens for the first
time I initialize the visualization, i.e. load the pvd file and set some
basic properties. For every subsequent event I set ViewTime to the
latest sample and re-render the view. Is there a more elegant way to do
that?

This works as long as the pvd file contains all the expected time steps
from the beginning. But the solver updates the pvd file for every vtu
file written out and appends it to the collection. Hence, when I
initially load the pvd, I only have the first time step. I tried all
methods PVDReader provides but there seems to be no way to re-read the
file of a PVDReader source. Did I miss something?

I wonder if it might be a better option to try to realize this as a
plugin, since in the end is should also be possible to send messages
back to the solver to trigger a parameter change for the next time step
while the simulation is running. As I'm not so familiar with the VTK /
ParaView source and have no experience writing ParaView plugins I'd be
happy to get some input or estimate if that is achievable in a
reasonable amount of time.

Best regards,
Florian


More information about the ParaView mailing list