Skip to content

Commit

Permalink
Don't try to remove negative runoff on an absent field
Browse files Browse the repository at this point in the history
I'm not sure if this is necessary, but it seems like it could be in some
configurations, and it won't hurt to do this check.
  • Loading branch information
billsacks committed Jun 24, 2024
1 parent 516b8ef commit 4c5996e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mediator/med_phases_post_rof_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ subroutine med_phases_post_rof(gcomp, rc)
real(r8), pointer :: data_orig(:)
real(r8), pointer :: data_copy(:)
integer :: n
logical :: exists
character(len=*), parameter :: subname='(med_phases_post_rof)'
!---------------------------------------

Expand All @@ -144,8 +145,12 @@ subroutine med_phases_post_rof(gcomp, rc)

if (remove_negative_runoff) then
do n = 1, size(fields_to_remove_negative_runoff)
call med_phases_post_rof_remove_negative_runoff(gcomp, fields_to_remove_negative_runoff(n), rc)
call ESMF_FieldBundleGet(FBrof_r, fieldName=trim(fields_to_remove_negative_runoff(n)), isPresent=exists, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (exists) then
call med_phases_post_rof_remove_negative_runoff(gcomp, fields_to_remove_negative_runoff(n), rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if
end do
end if

Expand Down

0 comments on commit 4c5996e

Please sign in to comment.