Extract velocity field from streamlines

I have a Streamtracer object which contains the streamlines of an UnstructuredGrid.
I need to extract the velocity associated with each point of the streamlines.
To compute the velocity of the i-th point I was thinking of extracting a set of three points from the original grid surrounding it (maybe using a nearest neighbors algorithm) and then interpolate the value of their velocity.

Here is a figure representing what I’m trying to achieve (The blue points are the ones of the Streamstracer, while the red ones are related to the original grid):

The problem with this approach is the computational complexity since the original grid contains hundreds of thousands of points to check.

Using Paraview the same result can be achieved much faster. In fact, Paraview allows to color the streamlines according to the Velocity information.
Is there a way to achieve the same result using the python vtk library?
Thank you

1 Like