5.13.3-dev0
mHM
The mesoscale Hydrological Model
Loading...
Searching...
No Matches
mo_mrm_init.f90
Go to the documentation of this file.
1!> \file mo_mrm_init.f90
2!> \brief \copybrief mo_mrm_init
3!> \details \copydetails mo_mrm_init
4
5!> \brief Wrapper for initializing Routing.
6!> \details Calling all routines to initialize all mRM variables
7!> \authors Luis Samaniego, Rohini Kumar and Stephan Thober
8!> \date Aug 2015
9!> \copyright Copyright 2005-\today, the mHM Developers, Luis Samaniego, Sabine Attinger: All rights reserved.
10!! mHM is released under the LGPLv3+ license \license_note
11!> \ingroup f_mrm
13
14 use mo_common_variables, only : dirout
15 use mo_message, only : message, error_message
16
17 ! This module sets the river network characteristics and routing order.
18
19 ! Written Luis Samaniego, Mar 2005
20
21 IMPLICIT NONE
22
26
27 private
28
29CONTAINS
30
31 !> \brief read mRM configuration from namelists
32 subroutine mrm_configuration(file_namelist, file_namelist_param)
39 use mo_kind, only : i4
40 implicit none
41
42 character(*), intent(in) :: file_namelist !< namelist file name
43 character(*), intent(in) :: file_namelist_param !< parameter namelist file name
44
45 if (mrm_coupling_mode .eq. 0_i4) then
46 call common_read_config(file_namelist)
47 call common_mhm_mrm_read_config(file_namelist)
48 !-----------------------------------------------------------
49 ! PRINT STARTUP MESSAGE
50 !-----------------------------------------------------------
51 call print_startup_message(file_namelist, file_namelist_param)
52 else
53 call message('')
54 call message(' Inititalize mRM')
55 if ( processmatrix(11, 1) .ne. 0 ) then
56 ! processCase(11): river temperature routing
57 riv_temp_pcs%active = .true.
58 riv_temp_pcs%case = processmatrix(11, 1)
59 call message('')
60 call message(' Read config: river temperature routing')
61 call riv_temp_pcs%config(file_namelist, file_namelist_param)
62 end if
63 end if
64
65 ! read config for mrm, readlatlon is set here depending on whether output is needed
66 call mrm_read_config(file_namelist, file_namelist_param, (mrm_coupling_mode .eq. 0_i4))
67
68 ! this was moved here, because it depends on global_parameters that are only set in mrm_read_config
69 if (mrm_coupling_mode .eq. 0_i4) then
71 !-----------------------------------------------------------
72 ! CONFIG OUTPUT
73 !-----------------------------------------------------------
74 call config_output()
75 end if
76 end subroutine mrm_configuration
77
78
79 !> \brief Initialize all mRM variables at all levels (i.e., L0, L1, and L11).
80 !> \details Initialize all mRM variables at all levels (i.e., L0, L1, and L11)
81 !! either with default values or with values from restart file. The L0 mask (L0_mask),
82 !! L0 elevation (L0_elev), and L0 land cover (L0_LCover) can be provided as optional
83 !! variables to save memory because these variable will then not be read in again.
84 !> \changelog
85 !! - Stephan Thober Sep 2015
86 !! - added L0_mask, L0_elev, and L0_LCover
87 !! - Stephan Thober May 2016
88 !! - added warning message in case no gauge is found in modelling domain
89 !! - Matthias Kelbling Aug 2017
90 !! - added L11_flow_accumulation to Initialize Stream Netwo
91 !! - Lennart Schueler May 2018
92 !! - added initialization for groundwater coupling
93 !! - Stephan Thober Jun 2018
94 !! - refactored for mpr_extract version
95 !! - Stephan Thober May 2019
96 !! - added init of level0 in case of read restart
97 !> \authors Stephan Thober
98 !> \date Aug 2015
99 subroutine mrm_init(file_namelist, file_namelist_param)
100
108 use mo_kind, only : i4
113 riv_temp_pcs, &
114 readlatlon, &
122 use mo_read_latlon, only : read_latlon
124 use mo_mrm_mpr, only : mrm_init_param
125 use mo_timer, only : timer_get, timer_start, timer_stop, timer_clear
126 use mo_string_utils, only : num2str
127
128 implicit none
129
130 character(*), intent(in) :: file_namelist !< namelist file name
131 character(*), intent(in) :: file_namelist_param !< parameter namelist file name
132
133 ! start and end index for routing parameters
134 integer(i4) :: istart, iend
135 ! start and end index at L11
136 integer(i4) :: s11, e11
137
138 integer(i4) :: domainid, idomain, gauge_counter
139
140
141 if (mrm_coupling_mode .eq. 0_i4) then
142 allocate(l0_l1_remap(domainmeta%nDomains))
143 allocate(level1(domainmeta%nDomains))
144 end if
145
146 ! ----------------------------------------------------------
147 ! READ DATA
148 ! ----------------------------------------------------------
149 allocate(level11(domainmeta%nDomains))
150 allocate(l0_l11_remap(domainmeta%nDomains))
151 allocate(sink_cells(domainmeta%nDomains))
152
153 if (.not. mrm_read_river_network) then
154 ! read all (still) necessary level 0 data
155 if (processmatrix(8, 1) .eq. 1_i4) call mrm_read_l0_data(mrm_coupling_mode .eq. 0_i4, readlatlon, .true.)
156 if (processmatrix(8, 1) .eq. 2_i4) call mrm_read_l0_data(mrm_coupling_mode .eq. 0_i4, readlatlon, .false.)
157 if (processmatrix(8, 1) .eq. 3_i4) call mrm_read_l0_data(mrm_coupling_mode .eq. 0_i4, readlatlon, .false.)
158 end if
159
160 do idomain = 1, domainmeta%nDomains
161 allocate(sink_cells(idomain)%ids(0))
162 domainid = domainmeta%indices(idomain)
163 if (mrm_read_river_network) then
164 ! this reads the domain properties
165 if (.not. allocated(level0)) allocate(level0(domainmeta%nDomains))
166 ! ToDo: L0_Domain, parallel
167 call read_grid_info(mrmfilerestartin(idomain), "0", level0(domainmeta%L0DataFrom(idomain)))
168 if (mrm_coupling_mode .eq. 0_i4) then
169 call read_grid_info(mrmfilerestartin(idomain), "1", level1(idomain))
170 end if
171 call read_grid_info(mrmfilerestartin(idomain), "11", level11(idomain))
172 call mrm_read_restart_config(idomain, domainid, mrmfilerestartin(idomain))
173 else
174 if (idomain .eq. 1) then
175 call l0_check_input_routing(domainmeta%L0DataFrom(idomain))
176 if (mrm_coupling_mode .eq. 0_i4) then
177 call l0_grid_setup(level0(domainmeta%L0DataFrom(idomain)))
178 end if
179 else if ((domainmeta%L0DataFrom(idomain) == idomain)) then
180 call l0_check_input_routing(domainmeta%L0DataFrom(idomain))
181 if (mrm_coupling_mode .eq. 0_i4) then
182 call l0_grid_setup(level0(domainmeta%L0DataFrom(idomain)))
183 end if
184 end if
185
186 if (mrm_coupling_mode .eq. 0_i4) then
187 call init_lowres_level(level0(domainmeta%L0DataFrom(idomain)), resolutionhydrology(idomain), &
188 level1(idomain), l0_l1_remap(idomain))
189 end if
190 call init_lowres_level(level0(domainmeta%L0DataFrom(idomain)), resolutionrouting(idomain), &
191 level11(idomain), l0_l11_remap(idomain))
192 call l11_l1_mapping(idomain)
193
194 if (readlatlon) then
195 ! read lat lon coordinates of each domain
196 call read_latlon(idomain, "lon", "lat", "level1", level1(idomain))
197 call read_latlon(idomain, "lon_l11", "lat_l11", "level11", level11(idomain))
198 else
199 ! allocate the memory and set to nodata
200 allocate(level11(idomain)%x(level11(idomain)%nrows, level11(idomain)%ncols))
201 allocate(level11(idomain)%y(level11(idomain)%nrows, level11(idomain)%ncols))
202 level11(idomain)%x = nodata_dp
203 level11(idomain)%y = nodata_dp
204 end if
205 end if
206 end do
207
210 call set_domain_indices(level0, indices=domainmeta%L0DataFrom)
211
212 ! ----------------------------------------------------------
213 ! INITIALIZE STATES AND AUXILLIARY VARIABLES
214 ! ----------------------------------------------------------
215 do idomain = 1, domainmeta%nDomains
216 call variables_alloc_routing(idomain)
217 end do
218
219 ! ----------------------------------------------------------
220 ! INITIALIZE STREAM NETWORK
221 ! ----------------------------------------------------------
222 do idomain = 1, domainmeta%nDomains
223 if (.not. mrm_read_river_network) then
224
225 call timer_clear(1)
226 call timer_start(1)
227 call l11_flow_direction(idomain)
228 call message(' ')
229 call message(' Flow direction upscaled ...')
230 call timer_stop(1)
231 call message(' in ', trim(num2str(timer_get(1), '(F9.3)')), ' seconds.')
232
233 call timer_clear(1)
234 call timer_start(1)
235 call l11_flow_accumulation(idomain)
236 call message(' Flow accumulation upscaled ...')
237 call timer_stop(1)
238 call message(' in ', trim(num2str(timer_get(1), '(F9.3)')), ' seconds.')
239
240 call timer_clear(1)
241 call timer_start(1)
242 call l11_set_network_topology(idomain)
243 call message(' Topology configured ...')
244 call timer_stop(1)
245 call message(' in ', trim(num2str(timer_get(1), '(F9.3)')), ' seconds.')
246
247 call timer_clear(1)
248 call timer_start(1)
249 call l11_routing_order(idomain)
250 call message(' Routing order ready ...')
251 call timer_stop(1)
252 call message(' in ', trim(num2str(timer_get(1), '(F9.3)')), ' seconds.')
253
254 call timer_clear(1)
255 call timer_start(1)
256 call l11_link_location(idomain)
257 call message(' Link location done ...')
258 call timer_stop(1)
259 call message(' in ', trim(num2str(timer_get(1), '(F9.3)')), ' seconds.')
260
261 call timer_clear(1)
262 call timer_start(1)
263 call l11_set_drain_outlet_gauges(idomain)
264 call message(' Gauges assigned with nodes ...')
265 call timer_stop(1)
266 call message(' in ', trim(num2str(timer_get(1), '(F9.3)')), ' seconds.')
267
268 ! stream characteristics
269 call timer_clear(1)
270 call timer_start(1)
271 call l11_stream_features(idomain)
272 call message(' Stream features generated ...')
273 call timer_stop(1)
274 call message(' in ', trim(num2str(timer_get(1), '(F9.3)')), ' seconds.')
275 call timer_clear(1)
276 end if
277 end do
278
279 ! ----------------------------------------------------------
280 ! INITIALIZE PARAMETERS
281 ! ----------------------------------------------------------
282 do idomain = 1, domainmeta%nDomains
283 istart = processmatrix(8, 3) - processmatrix(8, 2) + 1
284 iend = processmatrix(8, 3)
285 call mrm_init_param(idomain, global_parameters(istart : iend, 3))
286 end do
287
288 ! check whether there are gauges within the modelling domain
289 if (allocated(domain_mrm)) then
290 gauge_counter = 0
291 do idomain = 1, domainmeta%nDomains
292 if (.not. all(domain_mrm(idomain)%gaugeNodeList .eq. nodata_i4)) then
293 gauge_counter = gauge_counter + 1
294 end if
295 end do
296 if (gauge_counter .lt. 1) then
297 call message('')
298 call message(' WARNING: no gauge found within modelling domain')
299 end if
300 end if
301 ! mpr-like definiton of sealed floodplain fraction
302 if ((processmatrix(8, 1) .eq. 1_i4) .and. (.not. mrm_read_river_network)) then
303 call l11_fraction_sealed_floodplain(2_i4, .true.)
304 else
305 ! dummy initialization
306 call l11_fraction_sealed_floodplain(2_i4, .false.)
307 end if
308
309 ! -------------------------------------------------------
310 ! READ INPUT DATA AND OBSERVED DISCHARGE DATA
311 ! -------------------------------------------------------
312 ! read simulated runoff at level 1
313 if (mrm_coupling_mode .eq. 0_i4) then
314 do idomain = 1, domainmeta%nDomains
315 call mrm_read_total_runoff(idomain)
316 end do
317 end if
318 ! discharge data
319 call mrm_read_discharge()
320
321 ! init groundwater coupling
322 if (gw_coupling) then
323 do idomain = 1, domainmeta%nDomains
325 call mrm_read_bankfull_runoff(idomain)
326 end do
328 end if
329
330 ! init riv temp
331 if ( riv_temp_pcs%active ) then
332 call message('')
333 call message(' Initialization of river temperature routing.')
334 do idomain = 1, domainmeta%nDomains
335 s11 = level11(idomain)%iStart
336 e11 = level11(idomain)%iEnd
337 call riv_temp_pcs%init(level11(idomain)%nCells)
338 call riv_temp_pcs%init_area( &
339 idomain, &
340 l11_netperm(s11 : e11), & ! routing order at L11
341 l11_fromn(s11 : e11), & ! link source at L11
342 l11_length(s11 : e11 - 1), & ! link length
343 level11(idomain)%nCells - l11_noutlets(idomain), &
344 level11(idomain)%nCells, &
345 level11(idomain)%nrows, &
346 level11(idomain)%ncols, &
347 level11(idomain)%mask &
348 )
349 end do
350 end if
351 call message('')
352 call message(' Finished Initialization of mRM')
353
354 end subroutine mrm_init
355
356
357 !> \brief Print mRM startup message
358 !> \authors Robert Schweppe
359 !> \date Jun 2018
360 subroutine print_startup_message(file_namelist, file_namelist_param)
361
362 use mo_kind, only : i4
364 use mo_string_utils, only : num2str, separator
365
366 implicit none
367
368 character(*), intent(in) :: file_namelist !< namelist file name
369 character(*), intent(in) :: file_namelist_param !< parameter namelist file name
370
371 ! Date and time
372 integer(i4), dimension(8) :: datetime
373
374 CHARACTER(len=1024) :: message_text = ''
375
376 call message(separator)
377 call message(' mRM-UFZ')
378 call message()
379 call message(' MULTISCALE ROUTING MODEL')
380 call message(' Version ', trim(version))
381 call message(' ', trim(version_date))
382 call message()
383 call message('Made available by S. Thober & M. Cuntz')
384 call message()
385 call message('Based on mHM-UFZ by L. Samaniego & R. Kumar')
386
387 call message(separator)
388
389 call message()
390 call date_and_time(values = datetime)
391 message_text = trim(num2str(datetime(3), '(I2.2)')) // "." // trim(num2str(datetime(2), '(I2.2)')) &
392 // "." // trim(num2str(datetime(1), '(I4.4)')) // " " // trim(num2str(datetime(5), '(I2.2)')) &
393 // ":" // trim(num2str(datetime(6), '(I2.2)')) // ":" // trim(num2str(datetime(7), '(I2.2)'))
394 call message('Start at ', trim(message_text), '.')
395 call message('Using main file ', trim(file_main), ' and namelists: ')
396 call message(' ', trim(file_namelist))
397 call message(' ', trim(file_namelist_param))
398 call message(' ', trim(file_defoutput), ' (if it is given)')
399 call message()
400
401 end subroutine print_startup_message
402
403
404 !> \brief print mRM configuration
405 !> \authors Robert Schweppe
406 !> \date Jun 2018
407 subroutine config_output
408
410 use mo_kind, only : i4
414 use mo_string_utils, only : num2str
415
416 implicit none
417
418 integer(i4) :: domainID, iDomain
419
420 integer(i4) :: jj
421
422
423 !
424 call message()
425 call message('Read namelist file: ', trim(file_namelist_mrm))
426 call message('Read namelist file: ', trim(file_namelist_param_mrm))
427 call message('Read namelist file: ', trim(file_defoutput), ' (if it is given)')
428
429 call message()
430 call message(' # of domains: ', trim(num2str(domainmeta%nDomains)))
431 call message()
432 call message(' Input data directories:')
433 do idomain = 1, domainmeta%nDomains
434 domainid = domainmeta%indices(idomain)
435 call message(' --------------')
436 call message(' DOMAIN ', num2str(domainid, '(I3)'))
437 call message(' --------------')
438 call message(' Morphological directory: ', trim(dirmorpho(idomain)))
439 call message(' Land cover directory: ', trim(dirlcover(idomain)))
440 call message(' Discharge directory: ', trim(dirgauges(idomain)))
441 call message(' Output directory: ', trim(dirout(idomain)))
442 call message(' Evaluation gauge ', 'ID')
443 do jj = 1, domain_mrm(idomain)%nGauges
444 call message(' ', trim(adjustl(num2str(jj))), ' ', &
445 trim(adjustl(num2str(domain_mrm(idomain)%gaugeIdList(jj)))))
446 end do
447 if (domain_mrm(idomain)%nInflowGauges .GT. 0) then
448 call message(' Inflow gauge ', 'ID')
449 do jj = 1, domain_mrm(idomain)%nInflowGauges
450 call message(' ', trim(adjustl(num2str(jj))), ' ', &
451 trim(adjustl(num2str(domain_mrm(idomain)%InflowGaugeIdList(jj)))))
452 end do
453 end if
454 end do
455 end subroutine config_output
456
457
458 !> \brief Default initalization mRM related L11 variables
459 !> \details Default initalization of mHM related L11 variables (e.g., states,
460 !! fluxes, and parameters) as per given constant values given in mo_mhm_constants.
461 !! Variables initalized here is defined in the mo_global_variables.f90 file.
462 !! Only Variables that are defined in the variables_alloc subroutine are
463 !! intialized here.
464 !! If a variable is added or removed here, then it also has to be added or removed
465 !! in the subroutine state_variables_set in the module mo_restart and in the
466 !! subroutine set_state in the module mo_set_netcdf_restart.
467 !> \authors Stephan Thober, Rohini Kumar, and Juliane Mai
468 !> \date Aug 2015
469 !> \authors Robert Schweppe
470 !> \date Jun 2018
472
475
476 implicit none
477
478 !-------------------------------------------
479 ! L11 ROUTING STATE VARIABLES, FLUXES AND
480 ! PARAMETERS
481 !-------------------------------------------
482
483 ! fluxes and states
485
486 ! kappa: Muskingum travel time parameter.
488 ! xi: Muskingum diffusion parameter
490 ! Routing parameter C1=f(K,xi, DT) (Chow, 25-41)
492 ! Routing parameter C2 =f(K,xi, DT) (Chow, 25-41)
494
495 end subroutine variables_default_init_routing
496
497 !> \brief initialize fluxes and states with default values for mRM
499
500 use mo_kind, only: i4
504
505 implicit none
506
507 !> number of Domain (if not present, set for all)
508 integer(i4), intent(in), optional :: idomain
509
510 integer(i4) :: s11, e11
511
512 !-------------------------------------------
513 ! L11 ROUTING STATE VARIABLES, FLUXES AND
514 ! PARAMETERS
515 !-------------------------------------------
516
517 if (present(idomain)) then
518 s11 = level11(idomain)%iStart
519 e11 = level11(idomain)%iEnd
520 ! simulated discharge at each node
521 l11_qmod(s11 : e11) = p1_initstatefluxes
522 ! Total outflow from cells L11 at time tt
523 l11_qout(s11 : e11) = p1_initstatefluxes
524 ! Total discharge inputs at t-1 and t
525 l11_qtin(s11 : e11, :) = p1_initstatefluxes
526 ! Routed outflow leaving a node
527 l11_qtr(s11 : e11, :) = p1_initstatefluxes
528 else
529 ! simulated discharge at each node
531 ! Total outflow from cells L11 at time tt
533 ! Total discharge inputs at t-1 and t
535 ! Routed outflow leaving a node
537 end if
538
540
541
542 !> \brief check routing input on level-0
543 !> \authors Robert Schweppe
544 !> \date Jun 2018
545 subroutine l0_check_input_routing(L0Domain_iDomain)
546
548 use mo_common_variables, only : level0
549 use mo_kind, only : i4
551 use mo_string_utils, only : num2str
552
553 implicit none
554
555 integer(i4), intent(in) :: L0Domain_iDomain !< domain index for associated level-0 data
556
557 integer(i4) :: k
558
559 CHARACTER(len=1024) :: message_text = ''
560
561 do k = level0(l0domain_idomain)%iStart, level0(l0domain_idomain)%iEnd
562 ! flow direction [-]
563 if (l0_fdir(k) .eq. nodata_i4) then
564 message_text = trim(num2str(k, '(I5)')) // ',' // trim(num2str(l0domain_idomain, '(I5)'))
565 call error_message(' Error: flow direction has missing value within the valid masked area at cell in domain ', &
566 trim(message_text))
567 end if
568 ! flow accumulation [-]
569 if (l0_facc(k) .eq. nodata_i4) then
570 message_text = trim(num2str(k, '(I5)')) // ',' // trim(num2str(l0domain_idomain, '(I5)'))
571 call error_message(' Error: flow accumulation has missing values within the valid masked area at cell in domain ', &
572 trim(message_text))
573 end if
574 end do
575
576 end subroutine l0_check_input_routing
577
578
579 !> \brief allocated routing related variables
580 !> \authors Robert Schweppe
581 !> \date Jun 2018
582 subroutine variables_alloc_routing(iDomain)
583
584 use mo_append, only : append
585 use mo_kind, only : dp, i4
591
592 implicit none
593
594 integer(i4), intent(in) :: iDomain !< domain index
595
596 real(dp), dimension(:), allocatable :: dummy_Vector11
597
598 real(dp), dimension(:, :), allocatable :: dummy_Matrix11_IT
599
600
601 ! dummy vector and matrix
602 allocate(dummy_vector11(level11(idomain)%nCells))
603 allocate(dummy_matrix11_it(level11(idomain)%nCells, nroutingstates))
604
605 ! simulated discharge at each node
606 dummy_vector11(:) = 0.0_dp
607 call append(l11_qmod, dummy_vector11)
608
609 ! Total outflow from cells L11 at time tt
610 dummy_vector11(:) = 0.0_dp
611 call append(l11_qout, dummy_vector11)
612
613 ! Total discharge inputs at t-1 and t
614 dummy_matrix11_it(:, :) = 0.0_dp
615 call append(l11_qtin, dummy_matrix11_it)
616
617 ! Routed outflow leaving a node
618 dummy_matrix11_it(:, :) = 0.0_dp
619 call append(l11_qtr, dummy_matrix11_it)
620
621 ! kappa: Muskingum travel time parameter.
622 dummy_vector11(:) = 0.0_dp
623 call append(l11_k, dummy_vector11)
624
625 ! xi: Muskingum diffusion parameter
626 dummy_vector11(:) = 0.0_dp
627 call append(l11_xi, dummy_vector11)
628
629 ! Routing parameter C1=f(K,xi, DT) (Chow, 25-41)
630 dummy_vector11(:) = 0.0_dp
631 call append(l11_c1, dummy_vector11)
632
633 ! Routing parameter C2 =f(K,xi, DT) (Chow, 25-41)
634 dummy_vector11(:) = 0.0_dp
635 call append(l11_c2, dummy_vector11)
636
637 ! Celerity at each link
638 dummy_vector11(:) = 0.0_dp
639 call append(l11_celerity, dummy_vector11)
640
641 ! celerity at level 0
642 if (allocated(dummy_vector11)) deallocate(dummy_vector11)
643 allocate(dummy_vector11(level0(domainmeta%L0DataFrom(idomain))%ncells))
644 dummy_vector11(:) = 0.0_dp
645 call append(l0_celerity, dummy_vector11)
646
647 ! free space
648 if (allocated(dummy_vector11)) deallocate(dummy_vector11)
649 if (allocated(dummy_matrix11_it)) deallocate(dummy_matrix11_it)
650
651 end subroutine variables_alloc_routing
652
653END MODULE mo_mrm_init
Provides constants commonly used by mHM, mRM and MPR.
real(dp), parameter, public p1_initstatefluxes
real(dp), parameter, public nodata_dp
integer(i4), parameter, public nodata_i4
gridding tools
subroutine, public init_lowres_level(highres, target_resolution, lowres, highres_lowres_remap)
Level-1 variable initialization.
subroutine, public set_domain_indices(grids, indices)
TODO: add description.
subroutine, public l0_grid_setup(new_grid)
level 0 variable initialization
Reading of main model configurations.
subroutine, public check_optimization_settings
check optimization settings
subroutine, public common_mhm_mrm_read_config(file_namelist)
Read main configurations for common parts.
Provides structures needed by mHM, mRM and/or mpr.
character(256), dimension(:), allocatable, public mrmfilerestartin
real(dp), dimension(:), allocatable, public resolutionrouting
Reading of main model configurations.
subroutine, public common_read_config(file_namelist)
Read main configurations commonly used by mHM, mRM and MPR.
common restart tools
subroutine, public read_grid_info(infile, level_name, new_grid)
reads configuration apart from Level 11 configuration from a restart directory
Provides structures needed by mHM, mRM and/or mpr.
real(dp), dimension(:), allocatable, public resolutionhydrology
real(dp), dimension(:, :), allocatable, target, public global_parameters
type(domain_meta), public domainmeta
character(256), dimension(:), allocatable, public dirlcover
character(256), dimension(:), allocatable, public dirout
character(256), dimension(:), allocatable, public dirmorpho
integer(i4), dimension(nprocesses, 3), public processmatrix
type(grid), dimension(:), allocatable, target, public level1
type(grid), dimension(:), allocatable, target, public level0
type(gridremapper), dimension(:), allocatable, public l0_l1_remap
Provides mRM specific constants.
integer(i4), parameter, public nroutingstates
Provides file names and units for mRM.
character(len=*), parameter version
Current mHM model version.
character(len=*), parameter file_main
Driver file.
character(:), allocatable file_defoutput
file defining mRM's outputs
character(len=*), parameter file_namelist_param_mrm
Parameter namelists file name.
character(len=*), parameter version_date
Time of current mHM model version release.
character(len=*), parameter file_namelist_mrm
Namelist file name.
Global variables for mRM only.
real(dp), dimension(:, :), allocatable, public l11_qtin
type(gridremapper), dimension(:), allocatable, public l0_l11_remap
integer(i4), dimension(:), allocatable, public l11_netperm
real(dp), dimension(:), allocatable, public l11_qout
real(dp), dimension(:), allocatable, public l0_celerity
type(riv_temp_type), public riv_temp_pcs
This is a container for the river temperature routing process (pcs)
integer(i4), dimension(:), allocatable, public l0_fdir
type(sink_cells_t), dimension(:), allocatable sink_cells
sink cell ids for each domain
real(dp), dimension(:), allocatable, public l11_xi
character(256), dimension(:), allocatable, public dirgauges
integer(i4), dimension(:), allocatable, public l11_fromn
real(dp), dimension(:), allocatable, public l11_length
real(dp), dimension(:), allocatable, public l11_qmod
type(domaininfo_mrm), dimension(:), allocatable, target, public domain_mrm
type(grid), dimension(:), allocatable, target, public level11
integer(i4), dimension(:), allocatable, public l0_facc
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_k
real(dp), dimension(:), allocatable, public l0_river_head_mon_sum
real(dp), dimension(:, :), allocatable, public l11_qtr
real(dp), dimension(:), allocatable, public l11_c2
Wrapper for initializing Routing.
subroutine, public fluxes_states_default_init_routing(idomain)
initialize fluxes and states with default values for mRM
subroutine, public mrm_configuration(file_namelist, file_namelist_param)
read mRM configuration from namelists
subroutine config_output
print mRM configuration
subroutine print_startup_message(file_namelist, file_namelist_param)
Print mRM startup message.
subroutine, public mrm_init(file_namelist, file_namelist_param)
Initialize all mRM variables at all levels (i.e., L0, L1, and L11).
subroutine, public variables_default_init_routing
Default initalization mRM related L11 variables.
subroutine l0_check_input_routing(l0domain_idomain)
check routing input on level-0
subroutine variables_alloc_routing(idomain)
allocated routing related variables
Perform Multiscale Parameter Regionalization on Routing Parameters.
subroutine, public mrm_init_param(idomain, param)
TODO: add description.
Startup drainage network for mHM.
subroutine, public l11_stream_features(idomain)
Stream features (stream network and floodplain)
subroutine, public l11_flow_direction(idomain)
Determine the flow direction of the upscaled river network at level L11.
subroutine, public l11_fraction_sealed_floodplain(lcclassimp, do_init)
Fraction of the flood plain with impervious cover.
subroutine, public l11_set_drain_outlet_gauges(idomain)
Draining cell identification and Set gauging node.
subroutine, public l11_set_network_topology(idomain)
Set network topology.
subroutine, public l11_routing_order(idomain)
Find routing order, headwater cells and sink.
subroutine, public l11_link_location(idomain)
Estimate the LO (row,col) location for each routing link at level L11.
subroutine, public l11_l1_mapping(idomain)
TODO: add description.
subroutine, public l11_flow_accumulation(idomain)
Calculates L11 flow accumulation per grid cell.
subroutine, public mrm_read_config(file_namelist, file_namelist_param, do_message)
Read the general config of mRM.
mRM reading routines
subroutine, public mrm_read_bankfull_runoff(idomain)
subroutine, public mrm_read_discharge
Read discharge timeseries from file.
subroutine, public mrm_read_l0_data(do_reinit, do_readlatlon, do_readlcover)
read L0 data from file
subroutine, public mrm_read_total_runoff(idomain)
read simulated runoff that is to be routed
Restart routines.
subroutine, public mrm_read_restart_config(idomain, domainid, infile)
reads Level 11 configuration from a restart directory
River head calculation.
subroutine, public init_masked_zeros_l0(idomain, data)
allocates memory for L0 variable
subroutine, public calc_channel_elevation()
calculates the channel elevation from the bankfull river discharge
reading latitude and longitude coordinates for each domain
subroutine, public read_latlon(ii, lon_var_name, lat_var_name, level_name, level)
reads latitude and longitude coordinates