Compute divergence of vector field using python

Posted by nyvltak on Stack Overflow See other posts from Stack Overflow or by nyvltak
Published on 2012-07-11T15:14:02Z Indexed on 2012/07/11 15:15 UTC
Read the original article Hit count: 261

Filed under:
|
|

Is there a function that could be used for calculation of the divergence of the vectorial field? (in matlab http://www.mathworks.ch/help/techdoc/ref/divergence.html)

I would expect it exists in numpy/scipy but I can not find it using google :(.

#

I need to calculate div[A * grad(F)], where

F = np.array([[1,2,3,4],[5,6,7,8]]) (2D numpy ndarray)

A = np.array([[1,2,3,4],[1,2,3,4]]) (2D numpy ndarray)

so grad(F) is a set of 2D ndarrays

#

I know, I can calculate divergence like this: http://en.wikipedia.org/wiki/Divergence#Application_in_Cartesian_coordinates but do not want to reinvent the wheel. (and also I expent there is some optimized function)

© Stack Overflow or respective owner

Related posts about python

Related posts about numpy