Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plotting pathlines, streaklines given velocity vector field

So I have a 2D vector field {u(x,y,t), v(x,y,t)} representing velocities of an unsteady flow at different instances in time. I don't have an analytical description of the flow, just the two components u and v over time.

I am aware of matplotlib.quiver and the answer to this question which suggests to use this for plotting streamlines.

Now I want to also plot a couple of pathlines and streaklines of the vector field.

Is there any tool that is capable of doing this (preferably a Python package)? This seems to be a common task but I couldn't find anything and don't want to waste time on reinventing the wheel.

like image 443
Tobias Avatar asked Jan 19 '26 09:01

Tobias


1 Answers

Currently, there is no functionality in matplotlib to plot streaklines. However, Tom Flannaghan's streamline plotting utility has been improved and merged into the codebase. It will be available in matplotlib version 1.2, which is to be released in the next few weeks.

At present, your best bet is to solve the streakline ODE in the Wikipedia page you linked to. If you want to use python to do this, you can use scipy.integrate.odeint. This is exactly what matplotlib.axes.streamplot does at present for streamlines.

like image 86
dmcdougall Avatar answered Jan 21 '26 00:01

dmcdougall