From 5adf83aa59447efdfbc4783eae56f5e2c93d8950 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Wed, 31 Jul 2024 17:14:52 -0600 Subject: [PATCH] nan was picked up in pslv field on first pass --- mediator/med_methods_mod.F90 | 4 ++-- mediator/med_phases_prep_ocn_mod.F90 | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mediator/med_methods_mod.F90 b/mediator/med_methods_mod.F90 index d4bdab2a7..1634e7523 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 d911d93e1..44512d58b 100644 --- a/mediator/med_phases_prep_ocn_mod.F90 +++ b/mediator/med_phases_prep_ocn_mod.F90 @@ -266,6 +266,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)' !--------------------------------------- @@ -306,9 +307,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) @@ -320,6 +322,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