Curl, Gradient and Divergence [message #59658] |
Fri, 04 April 2008 03:49  |
AleDiPappa
Messages: 1 Registered: April 2008
|
Junior Member |
|
|
I am new idl user and I would like to know if there is any easy way or
direct function for computing the curl, gradient and divergence of
vectorial fields.
Regards
|
|
|
Re: Curl, Gradient and Divergence [message #59720 is a reply to message #59658] |
Fri, 04 April 2008 06:33  |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article
<833f085f-3c70-41c3-aa28-7a1927e44d0c@m73g2000hsh.googlegroups.com>,
AleDiPappa@gmail.com wrote:
> I am new idl user and I would like to know if there is any easy way or
> direct function for computing the curl, gradient and divergence of
> vectorial fields.
>
> Regards
To my knowledge there are no general built-in routines to do this;
you need to roll your own. But, it is relatively easy to do by using
the SHIFT operator, e.g., the gradient of a 2-D scalar field psi using
centered differences on a regular Cartesian grid is
grad_x = (SHIFT(psi, -1, 0) - SHIFT(psi, 1, 0))/(2 * dx)
grad_y = (SHIFT(psi, 0, -1) - SHIFT(psi, 0, 1))/(2 * dy)
Don't forget to clean up the boundaries.
Ken Bowman
|
|
|