diff --git a/mediator/med_methods_mod.F90 b/mediator/med_methods_mod.F90 index d4bdab2a..1634e752 100644 --- a/mediator/med_methods_mod.F90 +++ b/mediator/med_methods_mod.F90 @@ -2609,6 +2609,7 @@ subroutine med_methods_FB_check_for_nans(FB, maintask, logunit, rc) do index=1,fieldCount call med_methods_FB_getNameN(FB, index, fieldname, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return + call ESMF_FieldBundleGet(FB, fieldName=fieldname, field=field, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return call ESMF_FieldGet(field, rank=fieldrank, name=fieldname, rc=rc) @@ -2632,9 +2633,8 @@ subroutine med_methods_FB_check_for_nans(FB, maintask, logunit, rc) if (nanfound) then call ESMF_LogWrite('ABORTING JOB', ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u) rc = ESMF_FAILURE - return end if - + end subroutine med_methods_FB_check_for_nans !----------------------------------------------------------------------------- diff --git a/mediator/med_phases_prep_ocn_mod.F90 b/mediator/med_phases_prep_ocn_mod.F90 index 88811361..246ec586 100644 --- a/mediator/med_phases_prep_ocn_mod.F90 +++ b/mediator/med_phases_prep_ocn_mod.F90 @@ -284,6 +284,7 @@ subroutine med_phases_prep_ocn_avg(gcomp, rc) ! local variables type(InternalState) :: is_local integer :: ncnt + logical, save :: first_call = .true. character(len=*),parameter :: subname='(med_phases_prep_ocn_avg)' !--------------------------------------- @@ -324,9 +325,10 @@ subroutine med_phases_prep_ocn_avg(gcomp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Check for nans in fields export to ocn - call FB_check_for_nans(is_local%wrap%FBExp(compocn), maintask, logunit, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - + if(.not. first_call) then + call FB_check_for_nans(is_local%wrap%FBExp(compocn), maintask, logunit, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + endif ! zero accumulator is_local%wrap%ExpAccumOcnCnt = 0 call FB_reset(is_local%wrap%FBExpAccumOcn, value=czero, rc=rc) @@ -338,6 +340,7 @@ subroutine med_phases_prep_ocn_avg(gcomp, rc) call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) end if call t_stopf('MED:'//subname) + first_call = .false. end subroutine med_phases_prep_ocn_avg