Skip to content

Commit

Permalink
Add scrape of outer edge of domain so water doesn't pile up. Not test…
Browse files Browse the repository at this point in the history
…ed in parallel and lots of prints.

Fixed init issue with boundary adjustment variables and condensed. Changed looping to just cover boundaries. Fixed broadcast call. Passes ncores for small test domain.

Print mods.

Remove prints.
  • Loading branch information
aubreyd committed Oct 26, 2022
1 parent f9fd317 commit 46326c7
Showing 1 changed file with 54 additions and 3 deletions.
57 changes: 54 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,55 @@ 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
! use double precision to solve the underflow problem.
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 46326c7

Please sign in to comment.