Skip to content

Commit

Permalink
Merge branch 'liho745/river/bug-fix-417902b' (PR E3SM-Project#6146)
Browse files Browse the repository at this point in the history
A bug in RtmMod.F90 has been causing a floating-point error, related to Tunit%rlen,
when the land-river two-way coupling is invoked. This PR fixes that bug based on
a branch off the commit, 417920b, where the bug was introduced into the master.

[BFB]
Fixes E3SM-Project#5540
  • Loading branch information
bishtgautam committed Feb 6, 2024
2 parents 02192fe + 181e4f7 commit 6607537
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions components/mosart/src/riverroute/RtmMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2310,23 +2310,23 @@ subroutine Rtmrun(rstwr,nlend,rdate)
if (inundflag .and. Tctl%OPT_inund .eq. 1 ) then
do nr = rtmCTL%begr, rtmCTL%endr

!if ( TUnit%mask( nr ) .gt. 0 ) then ! 0--Ocean; 1--Land; 2--Basin outlet.
if ( rtmCTL%mask(nr) .eq. 1 .or. rtmCTL%mask(nr) .eq. 3 ) then ! 1--Land; 3--Basin outlet (downstream is ocean).
budget_terms(bv_fp_i, 1) = budget_terms(bv_fp_i, 1) + TRunoff%wf_ini( nr )
!budget_terms(bv_fp_i, 1) = budget_terms(bv_fp_i, 1) + rtmCTL%inundwf(nr) ! 17-6-7
endif

! land river two way coupling, update floodplain inundation volume with drainage from lnd
if (use_lnd_rof_two_way) then
TRunoff%wf_ini(nr) = TRunoff%wf_ini(nr) - rtmCTL%inundinf(nr) * coupling_period

if ( TRunoff%wf_ini(nr) < 0._r8 ) then
TRunoff%wr(nr, 1) = TRunoff%wr(nr, 1) + TRunoff%wf_ini(nr)
TRunoff%wf_ini(nr) = 0._r8
TRunoff%yr(nr, 1) = TRunoff%wr(nr, 1) / TUnit%rlen(nr) / TUnit%rwidth(nr)
! land river two way coupling, update floodplain inundation volume with drainage from lnd
if (use_lnd_rof_two_way) then
TRunoff%wf_ini(nr) = TRunoff%wf_ini(nr) - rtmCTL%inundinf(nr) * coupling_period

if ( TRunoff%wf_ini(nr) < 0._r8 ) then
TRunoff%wr(nr, 1) = TRunoff%wr(nr, 1) + TRunoff%wf_ini(nr)
TRunoff%wf_ini(nr) = 0._r8
TRunoff%yr(nr, 1) = TRunoff%wr(nr, 1) / TUnit%rlen(nr) / TUnit%rwidth(nr)
endif
endif
endif

endif

end do
end if

Expand Down

0 comments on commit 6607537

Please sign in to comment.