Skip to content

Commit

Permalink
remove more esmf_logmsg_error statements
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Jan 28, 2025
1 parent d1a5023 commit d17661c
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 59 deletions.
75 changes: 27 additions & 48 deletions mediator/med_methods_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ module med_methods_mod
use ESMF , only : operator(<), operator(/=), operator(+), operator(-), operator(*) , operator(>=)
use ESMF , only : operator(<=), operator(>), operator(==)
use ESMF , only : ESMF_FieldStatus_Flag
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_SUCCESS, ESMF_FAILURE
use ESMF , only : ESMF_LOGERR_PASSTHRU, ESMF_LogFoundError, ESMF_LOGMSG_ERROR
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_SUCCESS
use ESMF , only : ESMF_LOGERR_PASSTHRU, ESMF_LogFoundError
use ESMF , only : ESMF_MAXSTR, ESMF_LOGMSG_WARNING
use med_constants_mod , only : dbug_flag => med_constants_dbug_flag
use med_constants_mod , only : czero => med_constants_czero
Expand Down Expand Up @@ -1516,10 +1516,8 @@ subroutine med_methods_Field_GetFldPtr(field, fldptr1, fldptr2, rank, abort, rc)
endif

if (.not.present(rc)) then
call ESMF_LogWrite(trim(subname)//": ERROR rc not present ", &
ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//": ERROR rc not present ", &
line=__LINE__, file=u_FILE_u)
endif

rc = ESMF_SUCCESS
Expand Down Expand Up @@ -1568,29 +1566,23 @@ subroutine med_methods_Field_GetFldPtr(field, fldptr1, fldptr2, rank, abort, rc)

elseif (lrank == 1) then
if (.not.present(fldptr1)) then
call ESMF_LogWrite(trim(subname)//": ERROR missing rank=1 array ", &
ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//": ERROR missing rank=1 array ", &
line=__LINE__, file=u_FILE_u)
endif
call ESMF_FieldGet(field, farrayPtr=fldptr1, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

elseif (lrank == 2) then
if (.not.present(fldptr2)) then
call ESMF_LogWrite(trim(subname)//": ERROR missing rank=2 array ", &
ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//": ERROR missing rank=2 array ", &
line=__LINE__, file=u_FILE_u)
endif
call ESMF_FieldGet(field, farrayPtr=fldptr2, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

else
call ESMF_LogWrite(trim(subname)//": ERROR in rank ", &
ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//": ERROR in rank ", &
line=__LINE__, file=u_FILE_u)
endif

endif ! status
Expand Down Expand Up @@ -1634,19 +1626,16 @@ subroutine med_methods_FB_GetFldPtr(FB, fldname, fldptr1, fldptr2, rank, field,
endif

if (.not.present(rc)) then
call ESMF_LogWrite(trim(subname)//": ERROR rc not present "//trim(fldname), &
ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//": ERROR rc not present "//trim(fldname), &
line=__LINE__, file=u_FILE_u)
endif

rc = ESMF_SUCCESS

if (.not. med_methods_FB_FldChk(FB, trim(fldname), rc=rc)) then
call ESMF_LogWrite(trim(subname)//": ERROR field "//trim(fldname)//" not in FB ", &
ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u)
rc = ESMF_FAILURE
return

call shr_sys_abort(trim(subname)//": ERROR field "//trim(fldname)//" not in FB ", &
line=__LINE__, file=u_FILE_u)
endif

call ESMF_FieldBundleGet(FB, fieldName=trim(fldname), field=lfield, rc=rc)
Expand Down Expand Up @@ -1687,12 +1676,9 @@ logical function med_methods_FieldPtr_Compare1(fldptr1, fldptr2, cstring, rc)

med_methods_FieldPtr_Compare1 = .false.
if (lbound(fldptr2,1) /= lbound(fldptr1,1) .or. ubound(fldptr2,1) /= ubound(fldptr1,1)) then
call ESMF_LogWrite(trim(subname)//": ERROR in data size "//trim(cstring), ESMF_LOGMSG_ERROR, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
write(msgString,*) trim(subname)//': fldptr1 ',lbound(fldptr1),ubound(fldptr1)
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)
write(msgString,*) trim(subname)//': fldptr2 ',lbound(fldptr2),ubound(fldptr2)
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)
write(msgString,*) trim(subname)//': fldptr1 ',lbound(fldptr1),ubound(fldptr1),"\n",&
trim(subname)//': fldptr2 ',lbound(fldptr2),ubound(fldptr2),": ERROR in data size "//trim(cstring)
call shr_sys_abort(msgstring,rc=rc)
else
med_methods_FieldPtr_Compare1 = .true.
endif
Expand Down Expand Up @@ -1725,12 +1711,9 @@ logical function med_methods_FieldPtr_Compare2(fldptr1, fldptr2, cstring, rc)
med_methods_FieldPtr_Compare2 = .false.
if (lbound(fldptr2,2) /= lbound(fldptr1,2) .or. lbound(fldptr2,1) /= lbound(fldptr1,1) .or. &
ubound(fldptr2,2) /= ubound(fldptr1,2) .or. ubound(fldptr2,1) /= ubound(fldptr1,1)) then
call ESMF_LogWrite(trim(subname)//": ERROR in data size "//trim(cstring), ESMF_LOGMSG_ERROR, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
write(msgString,*) trim(subname)//': fldptr2 ',lbound(fldptr2),ubound(fldptr2)
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)
write(msgString,*) trim(subname)//': fldptr1 ',lbound(fldptr1),ubound(fldptr1)
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)
write(msgString,*) trim(subname)//': fldptr2 ',lbound(fldptr2),ubound(fldptr2),': fldptr1 ',lbound(fldptr1),ubound(fldptr1),&
": ERROR in data size "//trim(cstring)
call shr_sys_abort(trim(msgString))
else
med_methods_FieldPtr_Compare2 = .true.
endif
Expand Down Expand Up @@ -1853,10 +1836,8 @@ subroutine med_methods_Field_GeomPrint(field, string, rc)
call ESMF_FieldGet(field, status=status, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return
if (status == ESMF_FIELDSTATUS_EMPTY) then
call ESMF_LogWrite(trim(subname)//":"//trim(string)//": ERROR field does not have a geom yet ", &
ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//":"//trim(string)//": ERROR field does not have a geom yet ", &
line=__LINE__, file=u_FILE_u)
endif

call ESMF_FieldGet(field, geomtype=geomtype, rc=rc)
Expand Down Expand Up @@ -1891,10 +1872,8 @@ subroutine med_methods_Field_GeomPrint(field, string, rc)
! means data allocation does not exist yet
continue
else
call ESMF_LogWrite(trim(subname)//": ERROR rank not supported ", &
ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//": ERROR rank not supported ", &
line=__LINE__, file=u_FILE_u)
endif

if (dbug_flag > 10) then
Expand Down Expand Up @@ -2520,7 +2499,7 @@ end subroutine med_methods_FB_getmesh

!-----------------------------------------------------------------------------
subroutine med_methods_FB_check_for_nans(FB, maintask, logunit, rc)
use ESMF, only : ESMF_FieldBundle, ESMF_Field, ESMF_FieldBundleGet, ESMF_FieldGet
use ESMF, only : ESMF_FieldBundle, ESMF_Field, ESMF_FieldBundleGet, ESMF_FieldGet, ESMF_LOGMSG_ERROR
! input/output variables
type(ESMF_FieldBundle) , intent(in) :: FB
logical , intent(in) :: maintask
Expand Down Expand Up @@ -2569,8 +2548,8 @@ subroutine med_methods_FB_check_for_nans(FB, maintask, logunit, rc)
if (nancount > 0) then
write(nancount_char, '(i0)') nancount
msg_error = "ERROR: " // trim(nancount_char) //" nans found in "//trim(fieldname)
call ESMF_LogWrite(trim(msg_error), ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u)
nanfound = .true.
call ESMF_LogWrite(trim(msg_error), ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u)
end if
end do
if (nanfound) then
Expand Down
2 changes: 1 addition & 1 deletion mediator/med_phases_post_rof_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module med_phases_post_rof_mod
use NUOPC_Mediator , only : NUOPC_MediatorGet
use NUOPC , only : NUOPC_CompAttributeGet
use ESMF , only : ESMF_Clock, ESMF_ClockIsCreated
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_LOGMSG_ERROR, ESMF_SUCCESS, ESMF_FAILURE
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_SUCCESS
use ESMF , only : ESMF_GridComp, ESMF_GridCompGet
use ESMF , only : ESMF_Mesh, ESMF_MESHLOC_ELEMENT, ESMF_TYPEKIND_R8
use ESMF , only : ESMF_Field, ESMF_FieldCreate
Expand Down
1 change: 0 additions & 1 deletion mediator/med_phases_prep_ice_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ subroutine med_phases_prep_ice(gcomp, rc)
use ESMF , only : ESMF_GridComp, ESMF_GridCompGet, ESMF_StateGet
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_SUCCESS
use ESMF , only : ESMF_FieldBundleGet, ESMF_FieldGet, ESMF_Field
use ESMF , only : ESMF_LOGMSG_ERROR, ESMF_FAILURE
use ESMF , only : ESMF_StateItem_Flag, ESMF_STATEITEM_NOTFOUND
use ESMF , only : ESMF_VMBroadCast
use med_utils_mod , only : chkerr => med_utils_ChkErr
Expand Down
2 changes: 1 addition & 1 deletion mediator/med_phases_prep_lnd_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ subroutine med_phases_prep_lnd(gcomp, rc)

use NUOPC , only : NUOPC_CompAttributeGet
use ESMF , only : operator(/=), operator(==)
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_LOGMSG_ERROR, ESMF_SUCCESS, ESMF_FAILURE
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_SUCCESS
use ESMF , only : ESMF_FieldBundle, ESMF_FieldBundleGet, ESMF_Field, ESMF_FieldGet
use ESMF , only : ESMF_GridComp, ESMF_GridCompGet
use ESMF , only : ESMF_StateGet, ESMF_StateItem_Flag, ESMF_STATEITEM_NOTFOUND
Expand Down
2 changes: 0 additions & 2 deletions mediator/med_phases_prep_ocn_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ subroutine med_phases_prep_ocn_accum(gcomp, rc)

use ESMF , only : ESMF_GridComp, ESMF_FieldBundleGet
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_SUCCESS
use ESMF , only : ESMF_FAILURE, ESMF_LOGMSG_ERROR
use med_constants_mod , only : shr_const_cpsw, shr_const_tkfrz, shr_const_pi
use med_phases_prep_atm_mod , only : med_phases_prep_atm_enthalpy_correction

Expand Down Expand Up @@ -354,7 +353,6 @@ subroutine med_phases_prep_ocn_custom(gcomp, rc)
use ESMF , only : ESMF_GridComp, ESMF_StateGet, ESMF_Field, ESMF_FieldGet
use ESMF , only : ESMF_VMBroadCast
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_SUCCESS
use ESMF , only : ESMF_FAILURE, ESMF_LOGMSG_ERROR

! input/output variables
type(ESMF_GridComp) :: gcomp
Expand Down
1 change: 0 additions & 1 deletion mediator/med_phases_prep_wav_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ subroutine med_phases_prep_wav_accum(gcomp, rc)

use ESMF , only : ESMF_GridComp, ESMF_FieldBundleGet
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_SUCCESS
use ESMF , only : ESMF_FAILURE, ESMF_LOGMSG_ERROR

! input/output variables
type(ESMF_GridComp) :: gcomp
Expand Down
10 changes: 5 additions & 5 deletions mediator/med_phases_restart_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ subroutine med_phases_restart_alarm_init(gcomp, rc)
use ESMF , only : ESMF_Clock, ESMF_ClockGet, ESMF_ClockAdvance, ESMF_ClockSet
use ESMF , only : ESMF_Time, ESMF_TimeInterval, ESMF_TimeIntervalGet
use ESMF , only : ESMF_Alarm, ESMF_AlarmSet
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_LOGMSG_ERROR
use ESMF , only : ESMF_SUCCESS, ESMF_FAILURE
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO
use ESMF , only : ESMF_SUCCESS
use NUOPC , only : NUOPC_CompAttributeGet
use NUOPC_Model , only : NUOPC_ModelGet
use nuopc_shr_methods, only : AlarmInit
Expand Down Expand Up @@ -126,7 +126,7 @@ subroutine med_phases_restart_write(gcomp, rc)
use ESMF , only : ESMF_GridComp, ESMF_VM, ESMF_Clock, ESMF_Time, ESMF_Alarm
use ESMF , only : ESMF_TimeInterval, ESMF_CalKind_Flag, ESMF_MAXSTR
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_SUCCESS, ESMF_FAILURE
use ESMF , only : ESMF_LOGMSG_ERROR, operator(==), operator(-)
use ESMF , only : operator(==), operator(-)
use ESMF , only : ESMF_GridCompGet, ESMF_ClockGet, ESMF_ClockGetNextTime
use ESMF , only : ESMF_TimeGet, ESMF_ClockGetAlarm, ESMF_ClockPrint, ESMF_TimeIntervalGet
use ESMF , only : ESMF_AlarmIsRinging, ESMF_AlarmRingerOff, ESMF_FieldBundleIsCreated
Expand Down Expand Up @@ -481,8 +481,8 @@ subroutine med_phases_restart_read(gcomp, rc)
! Read mediator restart

use ESMF , only : ESMF_GridComp, ESMF_VM, ESMF_Clock, ESMF_Time, ESMF_MAXSTR
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_SUCCESS, ESMF_FAILURE
use ESMF , only : ESMF_LOGMSG_ERROR, ESMF_VMBroadCast
use ESMF , only : ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_SUCCESS
use ESMF , only : ESMF_VMBroadCast
use ESMF , only : ESMF_GridCompGet, ESMF_ClockGet, ESMF_ClockPrint
use ESMF , only : ESMF_FieldBundleIsCreated, ESMF_TimeGet
use NUOPC , only : NUOPC_CompAttributeGet
Expand Down

0 comments on commit d17661c

Please sign in to comment.