# Determine the anti-derivative of 2D vector field

I have data on a (x,y) grid with scalar values (time) at each point.

I have used the numpy gradient function and linear interpolation to determine the gradient vector Velocity (Vx,Vy) at each point (See below).

I have achieved this by:

 #LinearTriInterpolator applied to a delaunay triangular mesh

#Gradient requested at the mesh nodes:


The first image below shows the velocity vectors at each point, and the point labels represent the time value which formed the derivatives (Vx,Vy)

The next image shows the resultant scalar value of the derivatives (Vx,Vy) plotted as a colored contour graph with associated node labels.

So my challenge is:

I need to reverse the process!

Using the use gradient vectors (Vx,Vy) or the resultant scalar value to determine the original Time-Value at that point.

Is this possible?

I was thinking that taking a line derivative between the original point (t=0 at x1,y1) to any point (xi,yi) over the Vx,Vy plane would give me the sum of the velocity components. I could then divide this value by the distance between the two points to get the time taken..

Would this approach work? And if so, which numpy integrate function would be best applied?

An example of my data can be found here [http://www.filedropper.com/calculatearrivaltimefromgradientvalues060820]

Your help would be greatly appreciated

EDIT: Maybe this can explain my problem more simply

• Are you trying to solve $\nabla a = \mathbf{v}$? – nicoguaro Aug 6 at 21:31
• @nicoguaro I'm sorry I don't completely understand. But I have the gradient values, but not the original values which formed the gradient.. I've added a simplified drawing above which might explain it better. – Morgan Aug 6 at 22:18
• I was asking if you want to find a scalar function from its directional derivatives. That can be written mathematically as the equation. – nicoguaro Aug 6 at 22:20
• Yes, I think that is what I'm trying to achieve :) – Morgan Aug 6 at 22:23
• Have you checked this question? scicomp.stackexchange.com/q/35322/9667 – nicoguaro Aug 7 at 1:01