Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scrape of outer edge of domain so water doesn't pile up. #658

Merged
merged 2 commits into from
Nov 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 53 additions & 3 deletions src/Routing/Noah_distr_routing_overland.F
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,6 @@ subroutine ov_rtng( &
REAL :: DT_FRAC,SUM_INFXS,sum_head
!INTEGER SO8RT_D(IXRT,JXRT,3), rt_option




!DJG ----------------------------------------------------------------------
! DJG BEGIN 1-D or 2-D OVERLAND FLOW ROUTING LOOP
!DJG ---------------------------------------------------------------------
Expand Down Expand Up @@ -473,6 +470,7 @@ SUBROUTINE ROUTE_OVERLAND1(dt, &
REAL, INTENT(IN), DIMENSION(XX,YY,8) :: SO8RT
REAL*8, DIMENSION(XX,YY) :: QBDRY_tmp, DH
REAL*8, DIMENSION(XX,YY) :: DH_tmp
REAL, DIMENSION(XX,YY) :: edge_adjust ! mm

!!! Declare Local Variables

Expand Down Expand Up @@ -554,6 +552,7 @@ SUBROUTINE ROUTE_OVERLAND1(dt, &

!yw changed as following:
tmp_adjust=qqsfc*1000

if((h(i,j) - tmp_adjust) <0 ) then
#ifdef HYDRO_D
print*, "Error Warning: surface head is negative: ",i,j,ixx0,jyy0, &
Expand Down Expand Up @@ -581,10 +580,13 @@ SUBROUTINE ROUTE_OVERLAND1(dt, &
QBDRY_tmp(IXX0,JYY0)=QBDRY_tmp(IXX0,JYY0) - qqsfc*1000.
QBDRYT=QBDRYT - qqsfc
DH_tmp(IXX0,JYY0)= DH_tmp(IXX0,JYY0)-tmp_adjust

end if
end if

!! End loop to route sfc water
end if

end do
end do

Expand All @@ -603,6 +605,54 @@ SUBROUTINE ROUTE_OVERLAND1(dt, &

H = H + DH

!!! Scrape the outermost edges
edge_adjust = 0.0
do j=1,YY,YY-1
do i=1,XX
#ifdef MPP_LAND
if( ((i.eq.XX).and.(right_id .lt. 0)) .or. &
((i.eq.1) .and.(left_id .lt. 0)) .or. &
((j.eq.1) .and.(down_id .lt. 0)) .or. &
((j.eq.YY).and.(up_id .lt. 0)) ) then
#else
if ((i.eq.XX).or.(i.eq.1).or.(j.eq.1) &
.or.(j.eq.YY )) then
#endif
if (h(i,j) .GT. retent_dep(i,j)) then
edge_adjust(i,j) = h(i,j) - retent_dep(i,j) ! positive mm
end if

end if
end do
end do

do i=1,XX,XX-1
do j=1,YY
#ifdef MPP_LAND
if( ((i.eq.XX).and.(right_id .lt. 0)) .or. &
((i.eq.1) .and.(left_id .lt. 0)) .or. &
((j.eq.1) .and.(down_id .lt. 0)) .or. &
((j.eq.YY).and.(up_id .lt. 0)) ) then
#else
if ((i.eq.XX).or.(i.eq.1).or.(j.eq.1) &
.or.(j.eq.YY )) then
#endif
if (h(i,j) .GT. retent_dep(i,j)) then
edge_adjust(i,j) = h(i,j) - retent_dep(i,j) ! positive mm
end if

end if
end do
end do


#ifdef MPP_LAND
call MPP_LAND_COM_REAL(edge_adjust,XX,YY,99)
#endif
QBDRY = QBDRY - edge_adjust ! making this negative term more negative
H = H - edge_adjust ! making this positive term less positive
!!! End outermost edge scrape

return

!DJG ----------------------------------------------------------------------
Expand Down