check_value Function

public function check_value(exp_val, act_val, tol)

Arguments

Type IntentOptional Attributes Name
real(kind=ESMF_KIND_R8), intent(in) :: exp_val
real(kind=ESMF_KIND_R8), intent(in) :: act_val
real(kind=ESMF_KIND_R8), intent(in) :: tol

Return Value logical


Source Code

  logical function check_value (exp_val, act_val, tol)
    real(ESMF_KIND_R8), intent(in) :: exp_val
    real(ESMF_KIND_R8), intent(in) :: act_val
    real(ESMF_KIND_R8), intent(in) :: tol

    real(ESMF_KIND_R8) :: abs_err
    real(ESMF_KIND_R8) :: tol_band

    abs_err  = abs(act_val - exp_val)
    tol_band = abs(tol * exp_val) + RegridMinNeighborhood

    check_value = abs_err .LT. tol_band

#if 1
    ! print error message if value rejected because its outside of the minimum tolerance band
    if (.NOT. check_value) then
      if (abs_err .GE. RegridMinNeighborhood) then
        call ESMF_LogSetError (ESMF_FAILURE, msg="regrid error - value outside of minimum tolerance band", &
          line=__LINE__, file=__FILE__)
      end if
    end if
#endif

! debug
#if 0
    if (.NOT. check_value) then
      print *, "check_value - value out of tolerance(debug)", exp_val, act_val, abs_err, tol_band
    endif
#endif

    return
  !-----------------------------------------------------------------------------
  end function check_value