sph Subroutine

public pure subroutine sph(r, c, theta, phi, p)

球座標 (theta, phi) を中心 c・半径 r の直交座標へ変換する。

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: r

球半径 [m]。

real(kind=dp), intent(in) :: c(3)

球半径 [m]。

real(kind=dp), intent(in) :: theta

球半径 [m]。 方位角 [rad]。

real(kind=dp), intent(in) :: phi

球半径 [m]。 方位角 [rad]。 極角(+Z軸基準) [rad]。

real(kind=dp), intent(out) :: p(3)

Source Code

  pure subroutine sph(r, c, theta, phi, p)
    real(dp), intent(in) :: r, c(3), theta, phi
    real(dp), intent(out) :: p(3)
    p(1) = c(1) + r*sin(phi)*cos(theta)
    p(2) = c(2) + r*sin(phi)*sin(theta)
    p(3) = c(3) + r*cos(phi)
  end subroutine sph