eqdbish Subroutine

public pure subroutine eqdbish(self, dcart, dpcart, dbish)

Convert gradients of a function f w.r.t. R,Z into bishop form. Note that dbish(1, :, :) is not valid

Type Bound

abstract_geo_type

Arguments

Type IntentOptional Attributes Name
class(abstract_geo_type), intent(in) :: self
real, intent(in), dimension(:, :, :) :: dcart

dcart(:,:,1) is gradient of f w.r.t. R; dcart(:,:,2) is gradient of f w.r.t. Z

real, intent(in), dimension(:, :, :) :: dpcart

dcart(:,:,1) is gradient of f w.r.t. R; dcart(:,:,2) is gradient of f w.r.t. Z

real, intent(out), dimension(:, :, :) :: dbish

dbish(:,:,1) is set to (df/dR dpsi/dR + df/dZ dpsi/dZ)/|grad psi|; dbish(:,:,2) is set to (-df/dR dpsi/dZ + df/dZ dpsi/dR)/|grad psi|. Note that in the special case where f=psi: dbish(:,:,1) is |grad psi|; dbish(:,:,2) is 0


Contents

Source Code


Source Code

  pure subroutine eqdbish(self, dcart, dpcart, dbish)
    implicit none
    class(abstract_geo_type), intent(in) :: self
    !> dcart(:,:,1) is gradient of f w.r.t. R;
    !> dcart(:,:,2) is gradient of f w.r.t. Z
    real, dimension(:, :, :), intent (in) :: dcart, dpcart
    !> dbish(:,:,1) is set to (df/dR dpsi/dR + df/dZ dpsi/dZ)/|grad psi|;
    !> dbish(:,:,2) is set to (-df/dR dpsi/dZ + df/dZ dpsi/dR)/|grad psi|.
    !> Note that in the special case where f=psi:
    !> dbish(:,:,1) is |grad psi|; dbish(:,:,2) is 0
    real, dimension(:, :, :), intent(out) :: dbish
    real, dimension(size(dcart, 1) - 1, size(dcart, 2)) :: denom
    ! denom is |grad psi|
    denom = hypot(dpcart(2:,:,1), dpcart(2:,:,2))
    dbish(:,:,1) = dcart(:,:,1) * dpcart(:,:,1) + dcart(:,:,2) * dpcart(:,:,2)
    dbish(:,:,2) =-dcart(:,:,1) * dpcart(:,:,2) + dcart(:,:,2) * dpcart(:,:,1)
    dbish(2:, :, 1) = dbish(2:, :, 1) / denom
    dbish(2:, :, 2) = dbish(2:, :, 2) / denom
    UNUSED_DUMMY(self)
  end subroutine eqdbish