SSH_ALL_DP Subroutine

private subroutine SSH_ALL_DP(YLM, LMAX, THETA, PHI)

All scalar spherical harmonics for , in one call. Computes ASSOC_LEGENDRE_NORM_ALL once, then fills directly and via the conjugate symmetry rather than a second recurrence pass.

Warning

Inherits ASSOC_LEGENDRE_NORM_ALL's -dependent stability limit (safe for unconditionally) -- see STABILITY_FINDINGS.md at the repo root.

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(out) :: YLM((LMAX+1)**2)
integer(kind=i4), intent(in) :: LMAX

Maximum degree, .

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

Colatitude in radians, .

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

Longitude in radians, .


Calls

proc~~ssh_all_dp~~CallsGraph proc~ssh_all_dp SSH_ALL_DP dcos dcos proc~ssh_all_dp->dcos interface~assoc_legendre_norm_all ASSOC_LEGENDRE_NORM_ALL proc~ssh_all_dp->interface~assoc_legendre_norm_all proc~plm_index PLM_INDEX proc~ssh_all_dp->proc~plm_index proc~ylm_index YLM_INDEX proc~ssh_all_dp->proc~ylm_index proc~assoc_legendre_norm_all_dp ASSOC_LEGENDRE_NORM_ALL_DP interface~assoc_legendre_norm_all->proc~assoc_legendre_norm_all_dp proc~assoc_legendre_norm_all_dp->proc~plm_index

Called by

proc~~ssh_all_dp~~CalledByGraph proc~ssh_all_dp SSH_ALL_DP interface~ssh_all SSH_ALL interface~ssh_all->proc~ssh_all_dp proc~batch_ssh_cons BATCH_SSH_CONS proc~batch_ssh_cons->interface~ssh_all proc~bench_ssh BENCH_SSH proc~bench_ssh->interface~ssh_all program~convergence_main CONVERGENCE_MAIN program~convergence_main->interface~ssh_all program~convergence_main->proc~batch_ssh_cons program~bench_main BENCH_MAIN program~bench_main->proc~bench_ssh program~main MAIN program~main->proc~batch_ssh_cons

Source Code

  SUBROUTINE SSH_ALL_DP(YLM, LMAX, THETA, PHI)
  IMPLICIT NONE
  INTEGER(KIND=i4), INTENT(IN) :: LMAX
  REAL(KIND=dp), INTENT(IN) :: THETA
  REAL(KIND=dp), INTENT(IN) :: PHI
  COMPLEX(KIND=dp), INTENT(OUT) :: YLM((LMAX+1)**2)
  INTEGER(KIND=i4) :: L, M, PSIZE
  REAL(KIND=dp), ALLOCATABLE :: PNORM(:)
  REAL(KIND=dp) :: SIGN_M

  PSIZE = (LMAX+1)*(LMAX+2)/2
  ALLOCATE(PNORM(PSIZE))
  CALL ASSOC_LEGENDRE_NORM_ALL(PNORM, LMAX, DCOS(THETA))

  DO L = 0, LMAX
    DO M = 0, L
        YLM(YLM_INDEX(L, M)) = &
            PNORM(PLM_INDEX(L, M)) * EXP(j*M*PHI)
    END DO
    DO M = 1, L
        SIGN_M = 1.0_dp - 2.0_dp * MOD(M, 2)
        YLM(YLM_INDEX(L, -M)) = SIGN_M * &
            CONJG(YLM(YLM_INDEX(L, M)))
    END DO
  END DO

  DEALLOCATE(PNORM)
  END SUBROUTINE SSH_ALL_DP