spherical_to_cartesian Function

public pure function spherical_to_cartesian(r, alpha, beta) result(rvec)

Convert spherical (r,alpha,beta) to Cartesian (x,y,z).

Arguments

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

magnitude

real(kind=wp), intent(in) :: alpha

right ascension [rad]

real(kind=wp), intent(in) :: beta

declination [rad]

Return Value real(kind=wp), dimension(3)

[x,y,z] vector


Called by

proc~~spherical_to_cartesian~~CalledByGraph proc~spherical_to_cartesian vector_module::spherical_to_cartesian proc~geopotential_module_test geopotential_module::geopotential_module_test proc~geopotential_module_test->proc~spherical_to_cartesian

Source Code

    pure function spherical_to_cartesian(r,alpha,beta) result(rvec)

    implicit none

    real(wp),intent(in)   :: r        !! magnitude
    real(wp),intent(in)   :: alpha    !! right ascension [rad]
    real(wp),intent(in)   :: beta     !! declination [rad]
    real(wp),dimension(3) :: rvec     !! [x,y,z] vector

    rvec(1) = r * cos(alpha) * cos(beta)
    rvec(2) = r * sin(alpha) * cos(beta)
    rvec(3) = r * sin(beta)

    end function spherical_to_cartesian