Skip to content

Commit

Permalink
Merge pull request #490 from jedwards4b/fix_nan_in_pslv
Browse files Browse the repository at this point in the history
nan was picked up in pslv field on first pass
  • Loading branch information
jedwards4b committed Aug 1, 2024
2 parents 739b964 + 5adf83a commit a41d9c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions mediator/med_methods_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

!-----------------------------------------------------------------------------
Expand Down
9 changes: 6 additions & 3 deletions mediator/med_phases_prep_ocn_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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)'
!---------------------------------------

Expand Down Expand Up @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit a41d9c2

Please sign in to comment.