Commit 202c03ce authored by POLCHER Jan's avatar POLCHER Jan 🚴🏾
Browse files

Dsum is the current reference configuration until we solve the HTU decomposssition issues.

parent e8959997
...@@ -47,7 +47,8 @@ MODULE routing_reg ...@@ -47,7 +47,8 @@ MODULE routing_reg
! values are then averaged over the HTU. ! values are then averaged over the HTU.
! topo_option = 4 : The length and elevation change of all rivers within the HTU are computed. ! topo_option = 4 : The length and elevation change of all rivers within the HTU are computed.
! These values are then used to compute the topoindex of the HTU. ! These values are then used to compute the topoindex of the HTU.
! topo_option = 5 : The average of the dz have to be larger than min(dz) and smaller than orog_max-orog_min ! topo_option = 5 : We only keel the river segment length and elevation change of the grid point
! with the largest flow accumulation.
! !
INTEGER(i_std), SAVE :: topo_option = 4 !! Option to calculate topoindex INTEGER(i_std), SAVE :: topo_option = 4 !! Option to calculate topoindex
! !
...@@ -58,12 +59,13 @@ MODULE routing_reg ...@@ -58,12 +59,13 @@ MODULE routing_reg
! !
! Option to limit the dz when computing topoindex ! Option to limit the dz when computing topoindex
! !
INTEGER(i_std), SAVE :: dzrang_limiter = 1 INTEGER(i_std), SAVE :: dzrang_limiter = 0
! Tested combinations : ! Tested combinations :
! Asum : topo_option = 3, kill_option = 1, dzrang_limiter = 0 ! Asum : topo_option = 3, kill_option = 1, dzrang_limiter = 0
! Bsum : topo_option = 4, kill_option = 1, dzrang_limiter = 0 ! Bsum : topo_option = 4, kill_option = 1, dzrang_limiter = 0
! Csum : topo_option = 4, kill_option = 2, dzrang_limiter = 0 ! Csum : topo_option = 4, kill_option = 2, dzrang_limiter = 0
! Dsum : topo_option = 4, kill_option = 2, dzrang_limiter = 1 ! Dsum : topo_option = 4, kill_option = 2, dzrang_limiter = 1
! Esum : topo_option = 5, kill_option = 2, dzrang_limiter = 1
! !
CONTAINS CONTAINS
!! ================================================================================================================================ !! ================================================================================================================================
...@@ -1031,7 +1033,7 @@ CONTAINS ...@@ -1031,7 +1033,7 @@ CONTAINS
! !
! Work only for topo_option number 3 or 4 ! Work only for topo_option number 3 or 4
! !
IF ( topo_option .EQ. 3 .OR. topo_option .EQ. 4) THEN IF ( topo_option .GE. 3 ) THEN
rivpas(:,:) = 0 rivpas(:,:) = 0
! Loop for all sub-basins and each point belongs to that sub-basin ! Loop for all sub-basins and each point belongs to that sub-basin
DO ij=1,nb_basin DO ij=1,nb_basin
...@@ -1665,8 +1667,9 @@ SUBROUTINE routing_reg_globalize(nbpt, nb_htu, nbv, ib, ijdimmax, neighbours, ar ...@@ -1665,8 +1667,9 @@ SUBROUTINE routing_reg_globalize(nbpt, nb_htu, nbv, ib, ijdimmax, neighbours, ar
INTEGER(i_std), DIMENSION(nbpt) :: nbcoastal !! INTEGER(i_std), DIMENSION(nbpt) :: nbcoastal !!
INTEGER(i_std), DIMENSION(nbpt,nwbas) :: coastal_basin !! INTEGER(i_std), DIMENSION(nbpt,nwbas) :: coastal_basin !!
! !
INTEGER(i_std) :: ij, iz !! Indices (unitless) INTEGER(i_std) :: ij, iz !! Indices (unitless)
INTEGER(i_std) :: ip, jp, cnt INTEGER(i_std) :: ip, jp, cnt
REAL(r_std) :: fac
CHARACTER(LEN=4) :: hierar_method = 'OUTP' !! CHARACTER(LEN=4) :: hierar_method = 'OUTP' !!
! !
! To calculate topoindex in new method ! To calculate topoindex in new method
...@@ -1689,7 +1692,7 @@ SUBROUTINE routing_reg_globalize(nbpt, nb_htu, nbv, ib, ijdimmax, neighbours, ar ...@@ -1689,7 +1692,7 @@ SUBROUTINE routing_reg_globalize(nbpt, nb_htu, nbv, ib, ijdimmax, neighbours, ar
! !
IF ( topo_option .LT. 1 .OR. topo_option .GT. 5 ) THEN IF ( topo_option .LT. 1 .OR. topo_option .GT. 5 ) THEN
WRITE(numout,*) ' You chose wrong topo_option for calculating topoindex: ', topo_option WRITE(numout,*) ' You chose wrong topo_option for calculating topoindex: ', topo_option
WRITE(numout,*) ' It should be: 1, 2, 3 or 4' WRITE(numout,*) ' It should be: 1, 2, 3, 4 or 5'
STOP 'routing_reg_globalize' STOP 'routing_reg_globalize'
ENDIF ENDIF
! !
...@@ -1859,19 +1862,40 @@ SUBROUTINE routing_reg_globalize(nbpt, nb_htu, nbv, ib, ijdimmax, neighbours, ar ...@@ -1859,19 +1862,40 @@ SUBROUTINE routing_reg_globalize(nbpt, nb_htu, nbv, ib, ijdimmax, neighbours, ar
ENDDO ENDDO
ENDIF ENDIF
! !
! Compute mean length of rivers in HTU ! Compute mean length of rivers in HTU in all cases for topo_option <= 4.
! For topo_option == 5 we use the dominant river only.
! !
cnt = 0 cnt = 0
DO iz=1,basin_sz(ij) IF ( topo_option .LE. 4 ) THEN
ip = basin_pts(ij,iz,1) DO iz=1,basin_sz(ij)
jp = basin_pts(ij,iz,2) ip = basin_pts(ij,iz,1)
! Both rlen and rdz are zero outside of the first point in a river of the HTU jp = basin_pts(ij,iz,2)
IF ( rlen_bx(ip,jp) .GT. 0 ) THEN ! Both rlen and rdz are zero outside of the first point in a river of the HTU
cnt = cnt + 1 IF ( rlen_bx(ip,jp) .GT. 0 ) THEN
basin_rlen(ib,ij) = basin_rlen(ib,ij)+rlen_bx(ip,jp) cnt = cnt + 1
basin_rdz(ib,ij) = basin_rdz(ib,ij)+rdz_bx(ip,jp) basin_rlen(ib,ij) = basin_rlen(ib,ij)+rlen_bx(ip,jp)
ENDIF basin_rdz(ib,ij) = basin_rdz(ib,ij)+rdz_bx(ip,jp)
ENDDO ENDIF
ENDDO
ELSE IF ( topo_option .EQ. 5 ) THEN
cnt = 1
fac = 0.0
DO iz=1,basin_sz(ij)
ip = basin_pts(ij,iz,1)
jp = basin_pts(ij,iz,2)
! Both rlen and rdz are zero outside of the first point in a river of the HTU
IF ( rlen_bx(ip,jp) .GT. 0 .AND. fac_bx(ip,jp) > fac ) THEN
basin_rlen(ib,ij) = rlen_bx(ip,jp)
basin_rdz(ib,ij) = rdz_bx(ip,jp)
ENDIF
ENDDO
ELSE
WRITE(numout,*) ' We should not be here for topoindex = ', topo_option
STOP 'routing_reg_globalize'
ENDIF
!
!
!
IF ( cnt > 0 ) THEN IF ( cnt > 0 ) THEN
basin_rlen(ib,ij) = basin_rlen(ib,ij)/cnt basin_rlen(ib,ij) = basin_rlen(ib,ij)/cnt
IF ( dzrang_limiter == 0 ) THEN IF ( dzrang_limiter == 0 ) THEN
...@@ -1887,7 +1911,7 @@ SUBROUTINE routing_reg_globalize(nbpt, nb_htu, nbv, ib, ijdimmax, neighbours, ar ...@@ -1887,7 +1911,7 @@ SUBROUTINE routing_reg_globalize(nbpt, nb_htu, nbv, ib, ijdimmax, neighbours, ar
ENDIF ENDIF
! !
! !
IF ( topo_option .EQ. 4 ) THEN IF ( topo_option .EQ. 4 .OR. topo_option .EQ. 5 ) THEN
basin_topoind(ib,ij) = SQRT(basin_rlen(ib,ij)**3./(basin_rdz(ib,ij)*1.0e6)) basin_topoind(ib,ij) = SQRT(basin_rlen(ib,ij)**3./(basin_rdz(ib,ij)*1.0e6))
ENDIF ENDIF
! !
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment