anvaka / streamlines

Streamlines calculator
https://anvaka.github.io/streamlines/
MIT License
291 stars 27 forks source link

Algorithm #11

Open abelghazinyan opened 4 years ago

abelghazinyan commented 4 years ago

Thank you for the great implementation. I have read the paper several times, but couldn't implement it I want to implement it in python using numpy. Please can you provide detailed algorithm or pipeline, mainly the runge-kutta part

anvaka commented 4 years ago

The Runge-Kutta part is a simple way of approximating a function f(x) when all you have is its first derivative f'(x). You can see the code strictly follow the method description from wikipedia.

The streamlines are computed over a function that is defined in every single point (x, y). Usually the result of this function is interpreted as a velocity vector. f(x, y) = (Vx, Vy) - velocity vector at point (x, y).

Velocity is indeed can be interpreted as first derivative of your position. Which means to figure out the next position of a streamline segment we can apply Runge-Kutta method - its output going to be a point (x1, y1) where the streamline should go.