Skip to content

Commit

Permalink
Fixed upstream reach detection. Use goodBas that indicate there are c…
Browse files Browse the repository at this point in the history
…ontributory areas so there is flow coming from the upstreams
  • Loading branch information
nmizukami committed Nov 10, 2023
1 parent 5fe1014 commit 907b018
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion route/build/src/dfw_route.f90
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ SUBROUTINE dfw_rch(this, & ! dfw_route_rch object to bound this proced
end if

! get discharge coming from upstream
nUps = size(NETOPO_in(segIndex)%UREACHI)
nUps = count(NETOPO_in(segIndex)%goodBas) ! reminder: goodBas is reach with >0 total contributory area
isHW = .true.
q_upstream = 0.0_dp
if (nUps>0) then
isHW = .false.
do iUps = 1,nUps
if (.not. NETOPO_in(segIndex)%goodBas(iUps)) cycle ! skip upstream reach which does not any flow due to zero total contributory areas
iRch_ups = NETOPO_in(segIndex)%UREACHI(iUps) ! index of upstream of segIndex-th reach
if (qmodOption==1 .and. RCHFLX_out(iens,iRch_ups)%Qobs/=realMissing) then
RCHFLX_out(iens, iRch_ups)%ROUTE(idxDW)%REACH_Q = RCHFLX_out(iens,iRch_ups)%Qobs
Expand Down
3 changes: 2 additions & 1 deletion route/build/src/kwe_route.f90
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ SUBROUTINE kw_rch(this, & ! kwe_route_rch object to bound this procedu
end if

! get discharge coming from upstream
nUps = size(NETOPO_in(segIndex)%UREACHI)
nUps = count(NETOPO_in(segIndex)%goodBas) ! reminder: goodBas is reach with >0 total contributory area
isHW = .true.
q_upstream = 0.0_dp
if (nUps>0) then
isHW = .false.
do iUps = 1,nUps
if (.not. NETOPO_in(segIndex)%goodBas(iUps)) cycle ! skip upstream reach which does not any flow due to zero total contributory areas
iRch_ups = NETOPO_in(segIndex)%UREACHI(iUps) ! index of upstream of segIndex-th reach
if (qmodOption==1 .and. RCHFLX_out(iens,iRch_ups)%Qobs/=realMissing) then
RCHFLX_out(iens, iRch_ups)%ROUTE(idxKW)%REACH_Q = RCHFLX_out(iens,iRch_ups)%Qobs
Expand Down
3 changes: 2 additions & 1 deletion route/build/src/mc_route.f90
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ SUBROUTINE mc_rch(this, & ! mc_route_rch object to bound this procedur
end if

! get discharge coming from upstream
nUps = size(NETOPO_in(segIndex)%UREACHI)
nUps = count(NETOPO_in(segIndex)%goodBas) ! reminder: goodBas is reach with >0 total contributory area
isHW = .true.
q_upstream = 0.0_dp
if (nUps>0) then
isHW = .false.
do iUps = 1,nUps
if (.not. NETOPO_in(segIndex)%goodBas(iUps)) cycle ! skip upstream reach which does not any flow due to zero total contributory areas
iRch_ups = NETOPO_in(segIndex)%UREACHI(iUps) ! index of upstream of segIndex-th reach
if (qmodOption==1 .and. RCHFLX_out(iens,iRch_ups)%Qobs/=realMissing) then
RCHFLX_out(iens, iRch_ups)%ROUTE(idxMC)%REACH_Q = RCHFLX_out(iens,iRch_ups)%Qobs
Expand Down

0 comments on commit 907b018

Please sign in to comment.