Skip to content

Commit

Permalink
Add scrape of outer edge of domain so water doesn't pile up. (NCAR#658)
Browse files Browse the repository at this point in the history
Add scrape of outer edge of domain so water doesn't pile up
  • Loading branch information
aubreyd authored and scrasmussen committed Aug 4, 2023
1 parent c543724 commit e7b18dd
Showing 1 changed file with 53 additions and 3 deletions.
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

0 comments on commit e7b18dd

Please sign in to comment.