BATCH_ALM_CONS Subroutine

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

Batch-consistency check: ASSOC_LEGENDRE_ALL vs. looped ASSOC_LEGENDRE calls, for , swept over NX points . Writes every (l,m,x) triple's batch value, single-mode value, and absolute difference to OUTUNIT; fails (STATUS=1) if any relative error exceeds .

X P_batch P_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_alm_cons~~CallsGraph proc~batch_alm_cons BATCH_ALM_CONS interface~assoc_legendre ASSOC_LEGENDRE proc~batch_alm_cons->interface~assoc_legendre interface~assoc_legendre_all ASSOC_LEGENDRE_ALL proc~batch_alm_cons->interface~assoc_legendre_all proc~plm_index PLM_INDEX proc~batch_alm_cons->proc~plm_index proc~assoc_legendre_dp ASSOC_LEGENDRE_DP interface~assoc_legendre->proc~assoc_legendre_dp proc~assoc_legendre_all_dp ASSOC_LEGENDRE_ALL_DP interface~assoc_legendre_all->proc~assoc_legendre_all_dp proc~assoc_legendre_all_dp->proc~plm_index interface~log_fact LOG_FACT proc~assoc_legendre_dp->interface~log_fact proc~log_fact_dp LOG_FACT_DP interface~log_fact->proc~log_fact_dp

Called by

proc~~batch_alm_cons~~CalledByGraph proc~batch_alm_cons BATCH_ALM_CONS program~convergence_main CONVERGENCE_MAIN program~convergence_main->proc~batch_alm_cons program~main MAIN program~main->proc~batch_alm_cons

Source Code

  SUBROUTINE BATCH_ALM_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, P_SINGLE, SCALE, REL_ERR
  REAL(KIND=dp), ALLOCATABLE :: P_BATCH(:)

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

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

  DEALLOCATE(P_BATCH)
  END SUBROUTINE BATCH_ALM_CONS