16 use mo_kind,
only : i4, dp
18 use mo_append,
only : append
32 integer(i4),
intent(in) :: idomain
33 real(dp),
dimension(:),
allocatable,
intent(inout) :: data
34 real(dp),
dimension(:),
allocatable :: dummy_1d
36 allocate(dummy_1d(
level0(idomain)%nCells))
38 call append(
data, dummy_1d)
47 real(dp),
dimension(:,:),
allocatable :: channel_dpth
48 real(dp),
dimension(:,:),
allocatable :: channel_elev
49 real(dp),
dimension(:,:),
allocatable :: slope
50 real(dp),
dimension(:,:),
allocatable :: elev0
51 integer(i4),
dimension(:,:),
allocatable :: fdir0
52 integer(i4),
dimension(:,:),
allocatable :: facc0
54 integer(i4) :: nrows0, ncols0
62 nrows0 =
level0(idomain)%nrows
63 ncols0 =
level0(idomain)%ncols
64 s0 =
level0(idomain)%iStart
66 allocate(channel_dpth(nrows0, ncols0))
67 allocate(channel_elev(nrows0, ncols0))
68 allocate(elev0(nrows0, ncols0))
69 allocate(fdir0(nrows0, ncols0))
70 allocate(facc0(nrows0, ncols0))
71 allocate(slope(nrows0, ncols0))
80 do k = 1,
level0(idomain)%nCells
81 i =
level0(idomain)%CellCoor(k, 1)
82 j =
level0(idomain)%CellCoor(k, 2)
83 if (facc0(i,j) > 1)
then
84 slope(i,j) =
calc_slope(idomain, elev0, fdir0, i, j)
85 channel_dpth(i,j) = ((n * &
87 (4.8 * slope(i,j)**.5))**.6
88 channel_elev(i,j) = elev0(i,j) - channel_dpth(i,j)
96 call append(
l0_slope, pack(slope(:,:), &
99 deallocate(channel_dpth)
100 deallocate(channel_elev)
110 integer(i4),
intent(in) :: idomain
111 real(dp),
dimension(:),
intent(in) :: l11_qmod
112 real(dp),
dimension(:),
allocatable,
intent(inout) :: river_head
114 integer(i4) :: s0, e0
115 integer(i4) i, j, k, l11_ind
119 s0 = level0(idomain)%iStart
120 e0 = level0(idomain)%iEnd
123 i = level0(idomain)%CellCoor(k - s0 + 1, 1)
124 j = level0(idomain)%CellCoor(k - s0 + 1, 2)
125 if (i >= 0 .and. i < 99999 .and. j >= 0 .and. j < 99999)
then
126 l11_ind = l0_l11_remap(idomain)%lowres_id_on_highres(i,j)
128 river_head(k) = l0_channel_elevation(k) + &
129 (n * l11_qmod(l11_ind) / l11_bankfull_runoff_in(l11_ind) / &
137 function calc_slope(iDomain, elev0, fDir0, i, j)
result(slope)
140 integer(i4),
intent(in) :: idomain
141 integer(i4),
intent(in) :: i, j
142 integer(i4),
intent(in),
dimension(:,:),
allocatable :: fdir0
143 real(dp),
intent(in),
dimension(:,:),
allocatable :: elev0
144 real(dp) :: slope, length
145 integer(i4) :: i_down, j_down
153 slope = (elev0(i,j) - elev0(i_down, j_down)) / length
157 if(slope < 0.0001_dp .OR. slope > 20._dp .OR. slope /= slope)
then
Provides constants commonly used by mHM, mRM and MPR.
real(dp), parameter, public nodata_dp
integer(i4), parameter, public nodata_i4
Provides structures needed by mHM, mRM and/or mpr.
type(domain_meta), public domainmeta
real(dp), dimension(:), allocatable, public l0_elev
integer(i4), public iflag_cordinate_sys
type(grid), dimension(:), allocatable, target, public level0
Global variables for mRM only.
type(gridremapper), dimension(:), allocatable, public l0_l11_remap
integer(i4), dimension(:), allocatable, public l0_fdir
real(dp), dimension(:), allocatable, public l0_channel_depth
integer(i4), dimension(:), allocatable, public l0_facc
real(dp), dimension(:), allocatable, public l0_slope
real(dp), dimension(:), allocatable, public l11_bankfull_runoff_in
real(dp), dimension(:), allocatable, public l0_channel_elevation
Startup drainage network for mHM.
subroutine celllength(idomain, fdir, irow, jcol, icoorsystem, length)
TODO: add description.
subroutine movedownonecell(fdir, irow, jcol)
TODO: add description.
subroutine, public init_masked_zeros_l0(idomain, data)
allocates memory for L0 variable
subroutine, public calc_river_head(idomain, l11_qmod, river_head)
calculates the river head
subroutine, public calc_channel_elevation()
calculates the channel elevation from the bankfull river discharge
real(dp) function calc_slope(idomain, elev0, fdir0, i, j)
calculates domain slope