Hi, I have been trying to add vtkParticleTracer in external python script based on vtkPythonAlgorithmBase.
Paraview Version: 5.11.1
So far what I have understood is:
- vtkParticleTracer requires two inputs: A dataset containing ‘velocity’ field and Seeds.
- Time related information such as TIME_STEPS, TIME_RANGE, UPDATE_TIME_STEPS and DATA_TIME_STEPS must be present in both inputs.
- Then Update() method of vtkParticleTracer() should move particles given in the ‘Seed’ object.
What I have done:
- I have a dataset from which I am manually calculating ‘velocity’ field, copying old dataset onto a vtkPolyData object named ‘output_velocity_field’ using ShallowCopy() and then appending ‘velocity’ field to this vtkPolyData object. I am doing same for Seeds with name ‘output_seeds’.
- I also set ‘velocity’ field: tracer.SetInputArrayToProcess(0, 0, 0, vtk.vtkDataObject.FIELD_ASSOCIATION_POINTS, “velocity”).
- Now, when I ran Update() of vtkParticleTracer(), it gives error: Input Data does not have TIME_STEPS.
- So, I manually copy all four above mentioned time related fields to both: using ‘Set’ method which looks like Set(SDSP.TIME_STEPS(), time_steps, len(time_steps)). where SDSP = vtkStreamingDemandDrivenPipeline.
- I connect input to vtkParticleTracer(): tracer.SetInputData(0, output_velocity_field.VTKObject) and tracer.SetInputData(1, output_seeds) where tracer = vtkParticleTracer(). Particles were not moving.
- Then after copying, I wrap both of these object in TrivialProducer() objects and also again copy all four time related field onto both producers.
- Then, I use different method to set input to vtkParticleTracer: self.particle_tracer.SetInputConnection(0, velocity_field_producer.GetOutputPort()) and self.particle_tracer.SetInputConnection(1, self.seed_producer.GetOutputPort()).
- Particles were still not moving.
- I compared results by manually adding ParticleTracer from Paraview’s Filter menu with the external script and I found that ParticleAge is NOT incrementing at all when I use script but increments when I use filter from Paraview’s menu.
- I print the output of ‘GetIntegrator()’ method of vtkParticleTracer():
vtkRungeKutta4 (0x2745fe10)
Debug: Off
Modified Time: 8761737
Reference Count: 2
Registered Events: (none)
Function set : 0
Function values : 0
Function derivatives: 0
Initialized: No
Runge-Kutta 4 function derivatives: 0 0 0
What could be issue here? I want an external filter which applies Particle Tracer filter and then Temporal Particles to Pathlines filter using vtkPythonAlgorithmBase. Both of these filter works perfectly when using Paraview within GUI from filters menu. But I want to apply them using external script.