[R] div, curl, grad, laplacian and Poisson solver.
Pascal Oettli
kridox at ymail.com
Fri Jun 8 08:43:12 CEST 2012
Good morning/afternoon/evening,
Using R, I am trying to calculate stream function (psi) and velocity potential (phi) from both 2D zonal (u) and meridional wind (v).
I Stream function
The stream function can be obtained from the vorticity (vorticity):
vorticity = curl(u,v)
or in other terms:
vorticity = dv/dx - du/dy + u tan(th)/rad
This second approach is easily done using the function 'grad' in 'oce' package.
Thus, the stream fuction is obtained solving the following Poisson equation (1):
laplacian(psi) = vorticity (1)
or:
div grad (psi) = vorticity
II Vorticity
The vorticity can be obtained from the divergence (divergence):
divergence = div(u,v)
or in other terms:
divergence = du/dx + dv/dy - v tan(th)/rad
This second approach is also easily done using the function 'grad' in 'oce' package.
Thus, the vorticity is obtained solving the following Poisson equation (2):
laplacian(phi) = divergence (2)
or:
div grad (phi) = divergence
Is there a way to solve both Poisson equations (1) and (2) in R?
Best Regards,
Pascal Oettli
More information about the R-help
mailing list