Skip to content

Commit

Permalink
Merge pull request #441 from nmizukami/cesm-coupling_upstream-fix
Browse files Browse the repository at this point in the history
Fixed upstream reach detection for cesm-coupling branch
  • Loading branch information
nmizukami authored Nov 10, 2023
2 parents 5fe1014 + 907b018 commit 5b57af3
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 5b57af3

Please sign in to comment.