5.13.2-dev0
mHM
The mesoscale Hydrological Model
Loading...
Searching...
No Matches
mo_mrm_mpr.f90
Go to the documentation of this file.
1!> \file mo_mrm_mpr.f90
2!> \brief \copybrief mo_mrm_mpr
3!> \details \copydetails mo_mrm_mpr
4
5!> \brief Perform Multiscale Parameter Regionalization on Routing Parameters
6!> \details This module contains the subroutine for calculating the regionalized
7!! routing parameters (beta-parameters) given the five global routing parameters (gamma) at the level 0 scale.
8!> \authors Luis Samaniego, Stephan Thober
9!> \date Aug 2015
10!> \copyright Copyright 2005-\today, the mHM Developers, Luis Samaniego, Sabine Attinger: All rights reserved.
11!! mHM is released under the LGPLv3+ license \license_note
12!> \ingroup f_mrm
14 use mo_kind, only : dp
15 use mo_message, only : message
16
17 implicit none
18
19 public :: reg_rout
20 public :: mrm_init_param
21 public :: mrm_update_param
22 private
23contains
24
25 ! ----------------------------------------------------------------------------
26
27 ! NAME
28 ! reg_rout
29
30 ! PURPOSE
31 !> \brief Regionalized routing
32
33 !> \details sets up the Regionalized Routing parameters
34 !> Global parameters needed (see mhm_parameter.nml):
35 !> - param(1) = muskingumTravelTime_constant
36 !> - param(2) = muskingumTravelTime_riverLength
37 !> - param(3) = muskingumTravelTime_riverSlope
38 !> - param(4) = muskingumTravelTime_impervious
39 !> - param(5) = muskingumAttenuation_riverSlope
40
41 ! INTENT(IN)
42 !> \param[in] "real(dp), dimension(5) :: param" input parameter
43 !> \param[in] "real(dp), dimension(:) :: length" [m] total length
44 !> \param[in] "real(dp), dimension(:) :: slope" average slope
45 !> \param[in] "real(dp), dimension(:) :: fFPimp" fraction of the flood plain with
46 !> impervious layer
47 !> \param[in] "real(dp) :: TS" - [h] time step in
48
49 ! INTENT(OUT)
50 !> \param[out] "real(dp), dimension(:) :: C1" routing parameter C1 (Chow, 25-41)
51 !> \param[out] "real(dp), dimension(:) :: C2" routing parameter C2 (")
52
53 ! HISTORY
54 !> \authors Stephan Thober, Rohini Kumar
55
56 !> \date Dec 2012
57
58 ! Modifications:
59 ! Robert Schweppe Jun 2018 - refactoring and reformatting
60
61 subroutine reg_rout(param, length, slope, fFPimp, TS, C1, C2)
62 implicit none
63
64 ! input parameter
65 real(dp), dimension(5), intent(in) :: param
66
67 ! [m] total length
68 real(dp), dimension(:), intent(in) :: length
69
70 ! average slope
71 real(dp), dimension(:), intent(in) :: slope
72
73 ! fraction of the flood plain with
74 ! impervious layer
75 real(dp), dimension(:), intent(in) :: ffpimp
76
77 ! - [h] time step in
78 real(dp), intent(in) :: ts
79
80 ! routing parameter C1 (Chow, 25-41)
81 real(dp), dimension(:), intent(out) :: c1
82
83 ! routing parameter C2 (")
84 real(dp), dimension(:), intent(out) :: c2
85
86 ! stream slope max
87 real(dp) :: ssmax
88
89 ! [d] Muskingum travel time parameter
90 real(dp), dimension(size(fFPimp, 1)) :: k
91
92 ! [1] Muskingum diffusion parameter (attenuation)
93 real(dp), dimension(size(fFPimp, 1)) :: xi
94
95
96 ! normalize stream bed slope
97 ssmax = maxval(slope(:))
98
99 ! New regional relationship; K = f(length, slope, & fFPimp)
100 k = param(1) + param(2) * (length * 0.001_dp) &
101 + param(3) * slope &
102 + param(4) * ffpimp
103
104 ! Xi = f(slope)
105 xi = param(5) * (1.0_dp + slope / ssmax)
106
107 ! constraints on Xi
108 xi = merge(0.5_dp, xi, xi > 0.5_dp)
109 xi = merge(0.005_dp, xi, xi < 0.005_dp)
110
111 ! constrains on Ki
112 k = merge(0.5_dp * ts / xi, k, k > 0.5_dp * ts / xi)
113 k = merge(0.5_dp * ts / (1.0_dp - xi), k, k < 0.5_dp * ts / (1.0_dp - xi))
114
115 ! Muskingum parameters
116 c1 = ts / (k * (1.0_dp - xi) + 0.5_dp * ts)
117 c2 = 1.0_dp - c1 * k / ts
118
119 end subroutine reg_rout
120
121 ! --------------------------------------------------------------------------
122 ! L11 PARAMETERS
123 ! --------------------------------------------------------------------------
124 ! The parameters are set following Thober et al. 2017
125 ! Modified:
126 ! NAME
127 ! mrm_init_param
128
129 ! PURPOSE
130 !> \brief TODO: add description
131
132 !> \details TODO: add description
133
134 ! INTENT(IN)
135 !> \param[in] "integer(i4) :: iDomain" domain number
136 !> \param[in] "real(dp), dimension(:) :: param" input parameter (param(1) is celerity in m/s)
137
138 ! HISTORY
139 !> \authors Stephan Thober, Matthias Kelbling
140
141 !> \date Jun 2018
142
143 ! Modifications:
144
145 subroutine mrm_init_param(iDomain, param)
146
147 use mo_constants, only : hoursecs
150 use mo_kind, only : dp, i4
151 use mo_mrm_constants, only : given_ts
153 use mo_string_utils, only : num2str
154 use mo_utils, only : locate, notequal
156
157 implicit none
158
159 ! domain number
160 integer(i4), intent(in) :: idomain
161
162 ! input parameter (param(1) is celerity in m/s)
163 real(dp), dimension(:), intent(in) :: param
164
165 ! index selected from given_TS
166 integer(i4) :: index
167
168 ! spatial routing resolution
169 real(dp) :: deltax
170
171 ! [s] wave travel time parameter
172 real(dp) :: k
173
174 ! start and end index at level11
175 integer(i4) :: s11, e11
176
177 ! Number of cells within
178
179 ! initialize indices
180 s11 = level11(idomain)%iStart
181 e11 = level11(idomain)%iEnd
182
183 ! temporal resolution of routing
184 if (idomain .eq. 1 .and. .not. allocated(l11_tsrout)) then
185 allocate(l11_tsrout(domainmeta%nDomains))
186 l11_tsrout = 0._dp
187 end if
188
189 if (processmatrix(8, 1) .eq. 1) then
190 l11_tsrout = timestep * hoursecs
191
192 if ( notequal(mod(hoursecs * 24.0_dp, l11_tsrout(idomain)), 0.0_dp) .and. &
193 (domain_mrm(idomain)%nInflowGauges .gt. 0)) then
194 call message('***WARNING: routing timestep is not a multiple of 24 h.')
195 call message(' Inflowgauge timeseries is averaged over values')
196 call message(' of different days, small mismatches at')
197 call message(' inflowgauge location might occur.')
198 end if
199
200 else
201
202 ! called for initialization
203 call mrm_update_param(idomain, param)
204
205 end if
206
207 call message('')
208 call message(' domain: '//num2str(idomain, '(i3)'))
209 call message(' routing resolution [s]:. '//num2str(l11_tsrout(idomain), '(f7.0)'))
210 call message(' routing factor:......... '//num2str(l11_tsrout(idomain) / (timestep * hoursecs), '(f5.2)'))
211
212 if ( notequal(mod(hoursecs * 24.0_dp, l11_tsrout(idomain)), 0.0_dp) .and. &
213 (domain_mrm(idomain)%nInflowGauges .gt. 0)) then
214 call message('***WARNING: routing timestep is not a multiple of 24 h.')
215 call message(' Inflowgauge timeseries is averaged over values')
216 call message(' of different days, small mismatches at')
217 call message(' inflowgauge location might occur.')
218 end if
219
220 end subroutine mrm_init_param
221
222 ! NAME
223 ! mrm_update_param
224
225 ! PURPOSE
226 !> \brief TODO: add description
227
228 !> \details TODO: add description
229
230 ! INTENT(IN)
231 !> \param[in] "integer(i4) :: iDomain" domain number
232 !> \param[in] "real(dp), dimension(1) :: param" celerity parameter [m s-1]
233
234 ! HISTORY
235 !> \authors Stehpan Thober, Matthias Kelbling
236
237 !> \date Jun 2018
238
239 ! Modifications:
240
241 subroutine mrm_update_param(iDomain, param)
242
243 use mo_kind, only: i4, dp
245 use mo_mrm_global_variables, only: &
246 ! input variable
247 level11, &
248 l11_tsrout, &
250 ! output variables
255 use mo_utils, only: locate
257 use mo_mrm_constants, only: given_ts
258 use mo_constants, only: hoursecs
259 use mo_string_utils, only: num2str
260 use mo_utils, only: locate
261
262 implicit none
263
264 ! domain number
265 integer(i4), intent(in) :: idomain
266
267 ! celerity parameter [m s-1]
268 real(dp), intent(in), dimension(1) :: param
269
270 integer(i4) :: s11
271 integer(i4) :: e11
272 integer(i4) :: nnodes
273
274 ! index selected from given_TS
275 integer(i4) :: ind
276
277 ! spatial routing resolution
278 real(dp) :: deltax
279 real(dp), allocatable :: length(:)
280
281 ! [s] wave travel time parameter
282 real(dp), allocatable :: k(:)
283
284 ! [1] Muskingum diffusion parameter (attenuation)
285 real(dp) :: xi
286
287 ! get domain information
288 s11 = level11(idomain)%iStart
289 e11 = level11(idomain)%iEnd
290 nnodes = level11(idomain)%nCells
291
292 allocate(k(nnodes))
293
294 if (processmatrix(8, 1) .eq. 2_i4) then
295
296 ! [s] wave travel time parameter
297 k(:) = l11_length(s11: e11) / param(1)
298
299 else if (processmatrix(8, 1) .eq. 3_i4) then
300
301 ! [s] wave travel time parameter
302 call l11_calc_celerity( idomain, param)
303
304 ! Allocate and calculate K
305 k(:) = l11_length(s11: e11) / l11_celerity(s11:e11)
306
307 end if
308
309 ! set time-weighting scheme
310 xi = abs(rout_space_weight) ! set weighting factor to 0._dp
311
312 ! determine routing timestep
313 ind = locate(given_ts, minval(k(1:(nnodes-l11_noutlets(idomain)))))
314
315 ! set min-wave traveltime to min given_TS
316 if (ind .lt. 1) ind = 1
317 l11_tsrout(idomain) = given_ts(ind)
318
319 ! Muskingum parameters
320 l11_c1(s11:e11) = l11_tsrout(idomain) / ( k(:) * (1.0_dp - xi) + 0.5_dp * l11_tsrout(idomain) )
321 l11_c2(s11:e11) = 1.0_dp - l11_c1(s11:e11) * k(:) / l11_tsrout(idomain)
322
323 deallocate(k)
324
325 ! optional print
326 ! print *, 'C1 Muskingum routing parameter: ', L11_C1(s11)
327 ! print *, 'C2 Muskingum routing parameter: ', L11_C2(s11)
328
329 end subroutine mrm_update_param
330
331end module mo_mrm_mpr
Provides structures needed by mHM, mRM and/or mpr.
real(dp), dimension(:), allocatable, public resolutionrouting
Provides structures needed by mHM, mRM and/or mpr.
type(domain_meta), public domainmeta
integer(i4), public iflag_cordinate_sys
integer(i4), dimension(nprocesses, 3), public processmatrix
Provides mRM specific constants.
real(dp), dimension(19), parameter given_ts
real(dp), parameter, public rout_space_weight
Global variables for mRM only.
real(dp), dimension(:), allocatable, public l11_length
type(domaininfo_mrm), dimension(:), allocatable, target, public domain_mrm
type(grid), dimension(:), allocatable, target, public level11
real(dp), dimension(:), allocatable, public l11_c1
real(dp), dimension(:), allocatable, public l11_celerity
integer(i4), dimension(:), allocatable, public l11_noutlets
real(dp), dimension(:), allocatable, public l11_tsrout
real(dp), dimension(:), allocatable, public l11_c2
Perform Multiscale Parameter Regionalization on Routing Parameters.
subroutine, public reg_rout(param, length, slope, ffpimp, ts, c1, c2)
Regionalized routing.
subroutine, public mrm_init_param(idomain, param)
TODO: add description.
subroutine, public mrm_update_param(idomain, param)
TODO: add description.
Startup drainage network for mHM.
subroutine, public l11_calc_celerity(idomain, param)
L11 celerity based on L0 elevation and L0 fAcc.