Skip to content

Commit a41d9c2

Browse files
authored
Merge pull request #490 from jedwards4b/fix_nan_in_pslv
nan was picked up in pslv field on first pass
2 parents 739b964 + 5adf83a commit a41d9c2

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

mediator/med_methods_mod.F90

+2-2
Original file line numberDiff line numberDiff line change
@@ -2609,6 +2609,7 @@ subroutine med_methods_FB_check_for_nans(FB, maintask, logunit, rc)
26092609
do index=1,fieldCount
26102610
call med_methods_FB_getNameN(FB, index, fieldname, rc)
26112611
if (chkerr(rc,__LINE__,u_FILE_u)) return
2612+
26122613
call ESMF_FieldBundleGet(FB, fieldName=fieldname, field=field, rc=rc)
26132614
if (chkerr(rc,__LINE__,u_FILE_u)) return
26142615
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)
26322633
if (nanfound) then
26332634
call ESMF_LogWrite('ABORTING JOB', ESMF_LOGMSG_ERROR, line=__LINE__, file=u_FILE_u)
26342635
rc = ESMF_FAILURE
2635-
return
26362636
end if
2637-
2637+
26382638
end subroutine med_methods_FB_check_for_nans
26392639

26402640
!-----------------------------------------------------------------------------

mediator/med_phases_prep_ocn_mod.F90

+6-3
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ subroutine med_phases_prep_ocn_avg(gcomp, rc)
284284
! local variables
285285
type(InternalState) :: is_local
286286
integer :: ncnt
287+
logical, save :: first_call = .true.
287288
character(len=*),parameter :: subname='(med_phases_prep_ocn_avg)'
288289
!---------------------------------------
289290

@@ -324,9 +325,10 @@ subroutine med_phases_prep_ocn_avg(gcomp, rc)
324325
if (ChkErr(rc,__LINE__,u_FILE_u)) return
325326

326327
! Check for nans in fields export to ocn
327-
call FB_check_for_nans(is_local%wrap%FBExp(compocn), maintask, logunit, rc=rc)
328-
if (ChkErr(rc,__LINE__,u_FILE_u)) return
329-
328+
if(.not. first_call) then
329+
call FB_check_for_nans(is_local%wrap%FBExp(compocn), maintask, logunit, rc=rc)
330+
if (ChkErr(rc,__LINE__,u_FILE_u)) return
331+
endif
330332
! zero accumulator
331333
is_local%wrap%ExpAccumOcnCnt = 0
332334
call FB_reset(is_local%wrap%FBExpAccumOcn, value=czero, rc=rc)
@@ -338,6 +340,7 @@ subroutine med_phases_prep_ocn_avg(gcomp, rc)
338340
call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO)
339341
end if
340342
call t_stopf('MED:'//subname)
343+
first_call = .false.
341344

342345
end subroutine med_phases_prep_ocn_avg
343346

0 commit comments

Comments
 (0)