@@ -284,6 +284,7 @@ subroutine med_phases_prep_ocn_avg(gcomp, rc)
284
284
! local variables
285
285
type (InternalState) :: is_local
286
286
integer :: ncnt
287
+ logical , save :: first_call = .true.
287
288
character (len=* ),parameter :: subname= ' (med_phases_prep_ocn_avg)'
288
289
!- --------------------------------------
289
290
@@ -324,9 +325,10 @@ subroutine med_phases_prep_ocn_avg(gcomp, rc)
324
325
if (ChkErr(rc,__LINE__,u_FILE_u)) return
325
326
326
327
! 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
330
332
! zero accumulator
331
333
is_local% wrap% ExpAccumOcnCnt = 0
332
334
call FB_reset(is_local% wrap% FBExpAccumOcn, value= czero, rc= rc)
@@ -338,6 +340,7 @@ subroutine med_phases_prep_ocn_avg(gcomp, rc)
338
340
call ESMF_LogWrite(trim (subname)// " : done" , ESMF_LOGMSG_INFO)
339
341
end if
340
342
call t_stopf(' MED:' // subname)
343
+ first_call = .false.
341
344
342
345
end subroutine med_phases_prep_ocn_avg
343
346
0 commit comments