From 4c5996ebe70765a613d79456953d30c66ce1f5ce Mon Sep 17 00:00:00 2001 From: Bill Sacks Date: Mon, 24 Jun 2024 16:31:55 -0600 Subject: [PATCH] Don't try to remove negative runoff on an absent field 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. --- mediator/med_phases_post_rof_mod.F90 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mediator/med_phases_post_rof_mod.F90 b/mediator/med_phases_post_rof_mod.F90 index ff05bb2e..f58c901d 100644 --- a/mediator/med_phases_post_rof_mod.F90 +++ b/mediator/med_phases_post_rof_mod.F90 @@ -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)' !--------------------------------------- @@ -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