BATCH_DALM_CONS Subroutine

public subroutine BATCH_DALM_CONS(LMAX, NX, OUTUNIT, STATUS)

Batch-consistency check: DDX_ASSOC_LEGENDRE_ALL vs. looped DDX_ASSOC_LEGENDRE calls, for , swept over NX points . Same tolerance/output convention as BATCH_ALM_CONS.

X dP_batch dP_single abs_diff`). ).

Arguments

Type IntentOptional Attributes Name
integer(kind=i4), intent(in) :: LMAX

Maximum degree tested, .

integer(kind=i4), intent(in) :: NX

Number of points swept over .

integer(kind=i4), intent(in) :: OUTUNIT

Fortran unit number to write results to (columns: `L M

integer(kind=i4), intent(out) :: STATUS

Output: 0 = pass, 1 = fail (some relative error


Calls

proc~~batch_dalm_cons~~CallsGraph proc~batch_dalm_cons BATCH_DALM_CONS interface~assoc_legendre_all ASSOC_LEGENDRE_ALL proc~batch_dalm_cons->interface~assoc_legendre_all interface~ddx_assoc_legendre DDX_ASSOC_LEGENDRE proc~batch_dalm_cons->interface~ddx_assoc_legendre interface~ddx_assoc_legendre_all DDX_ASSOC_LEGENDRE_ALL proc~batch_dalm_cons->interface~ddx_assoc_legendre_all proc~plm_index PLM_INDEX proc~batch_dalm_cons->proc~plm_index proc~assoc_legendre_all_dp ASSOC_LEGENDRE_ALL_DP interface~assoc_legendre_all->proc~assoc_legendre_all_dp proc~ddx_assoc_legendre_dp DDX_ASSOC_LEGENDRE_DP interface~ddx_assoc_legendre->proc~ddx_assoc_legendre_dp proc~ddx_assoc_legendre_all_dp DDX_ASSOC_LEGENDRE_ALL_DP interface~ddx_assoc_legendre_all->proc~ddx_assoc_legendre_all_dp proc~assoc_legendre_all_dp->proc~plm_index proc~ddx_assoc_legendre_all_dp->proc~plm_index interface~assoc_legendre_and_deriv ASSOC_LEGENDRE_AND_DERIV proc~ddx_assoc_legendre_dp->interface~assoc_legendre_and_deriv proc~assoc_legendre_and_deriv_dp ASSOC_LEGENDRE_AND_DERIV_DP interface~assoc_legendre_and_deriv->proc~assoc_legendre_and_deriv_dp interface~log_fact LOG_FACT proc~assoc_legendre_and_deriv_dp->interface~log_fact proc~log_fact_dp LOG_FACT_DP interface~log_fact->proc~log_fact_dp

Called by

proc~~batch_dalm_cons~~CalledByGraph proc~batch_dalm_cons BATCH_DALM_CONS program~main MAIN program~main->proc~batch_dalm_cons

Source Code

  SUBROUTINE BATCH_DALM_CONS(LMAX, NX, OUTUNIT, STATUS)
  IMPLICIT NONE
  INTEGER(KIND=i4), INTENT(IN) :: LMAX
  INTEGER(KIND=i4), INTENT(IN) :: NX
  INTEGER(KIND=i4), INTENT(IN) :: OUTUNIT
  INTEGER(KIND=i4), INTENT(OUT) :: STATUS
  INTEGER(KIND=i4) :: L, M, IX, PSIZE
  REAL(KIND=dp) :: X, DX, DP_SINGLE, SCALE, REL_ERR
  REAL(KIND=dp), ALLOCATABLE :: P_BATCH(:), DP_BATCH(:)

  PSIZE = (LMAX+1)*(LMAX+2)/2
  ALLOCATE(P_BATCH(PSIZE), DP_BATCH(PSIZE))
  STATUS = 0
  DX = 1.8_dp / (NX - 1)

  WRITE(OUTUNIT, '(A)') '# L  M  X  dP_batch  dP_single  abs_diff'
  DO IX = 0, NX-1
    X = -0.9_dp + IX * DX
    CALL ASSOC_LEGENDRE_ALL(P_BATCH, LMAX, X)
    CALL DDX_ASSOC_LEGENDRE_ALL(DP_BATCH, P_BATCH, LMAX, X)
    DO L = 0, LMAX
      DO M = 0, L
        DP_SINGLE = DDX_ASSOC_LEGENDRE(L, M, X)
        WRITE(OUTUNIT, *) L, M, X, &
            DP_BATCH(PLM_INDEX(L, M)), DP_SINGLE, &
            ABS(DP_BATCH(PLM_INDEX(L, M)) - DP_SINGLE)
        SCALE = MAX(ABS(DP_SINGLE), 1.0_dp)
        REL_ERR = ABS(DP_BATCH(PLM_INDEX(L, M)) - DP_SINGLE) / SCALE
        IF (REL_ERR > 1.0E-12_dp) STATUS = 1
      END DO
    END DO
  END DO

  DEALLOCATE(P_BATCH, DP_BATCH)
  END SUBROUTINE BATCH_DALM_CONS