Converts derivatives w.r.t. (psi_index,theta_index) to derivatives
w.r.t. (R,Z). Note that dfcart(1, :, :)
is not valid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(abstract_geo_type), | intent(in) | :: | self | |||
real, | intent(in), | dimension (:,:,:) | :: | dfm |
dfm(:,:,1) is deriv w.r.t. psi_index (i.e. (df/dpsi)_theta * delta psi); dfm(:,:,2) is deriv w.r.t. theta_index |
|
real, | intent(in), | dimension (:,:,:) | :: | drm |
dfm(:,:,1) is deriv w.r.t. psi_index (i.e. (df/dpsi)_theta * delta psi); dfm(:,:,2) is deriv w.r.t. theta_index |
|
real, | intent(in), | dimension (:,:,:) | :: | dzm |
dfm(:,:,1) is deriv w.r.t. psi_index (i.e. (df/dpsi)_theta * delta psi); dfm(:,:,2) is deriv w.r.t. theta_index |
|
real, | intent(out), | dimension (:,:,:) | :: | dfcart |
dfcart(:,:,1) is deriv w.r.t. R; dfcart(:,:,2) is deriv w.r.t. Z |
pure subroutine eqdcart(self, dfm, drm, dzm, dfcart)
implicit none
class(abstract_geo_type), intent(in) :: self
!> dfm(:,:,1) is deriv w.r.t. psi_index (i.e. (df/dpsi)_theta * delta psi);
!> dfm(:,:,2) is deriv w.r.t. theta_index
real, dimension (:,:,:), intent(in) :: dfm, drm, dzm
!> dfcart(:,:,1) is deriv w.r.t. R;
!> dfcart(:,:,2) is deriv w.r.t. Z
real, dimension (:,:,:), intent(out) :: dfcart
real, dimension (size(dfm, 1), size(dfm, 2)) :: denom
denom = drm(:,:,1) * dzm(:,:,2) - drm(:,:,2) * dzm(:,:,1)
dfcart(:,:,1) = dfm(:,:,1) * dzm(:,:,2) - dzm(:,:,1) * dfm(:,:,2)
dfcart(:,:,2) = - dfm(:,:,1) * drm(:,:,2) + drm(:,:,1) * dfm(:,:,2)
! Skips first point in first dimension because it's likely exactly on the
! magnetic axis, which means the Jacobian is zero.
dfcart(2:, :, 1) = dfcart(2:, :, 1) / denom(2:, :)
dfcart(2:, :, 2) = dfcart(2:, :, 2) / denom(2:, :)
UNUSED_DUMMY(self)
end subroutine eqdcart