15 use mo_message,
only : message, error_message
39 use mo_kind,
only : i4
42 character(*),
intent(in) :: file_namelist
43 character(*),
intent(in) :: file_namelist_param
54 call message(
' Inititalize mRM')
60 call message(
' Read config: river temperature routing')
61 call riv_temp_pcs%config(file_namelist, file_namelist_param)
99 subroutine mrm_init(file_namelist, file_namelist_param)
108 use mo_kind,
only : i4
125 use mo_timer,
only : timer_get, timer_start, timer_stop, timer_clear
126 use mo_string_utils,
only : num2str
130 character(*),
intent(in) :: file_namelist
131 character(*),
intent(in) :: file_namelist_param
134 integer(i4) :: istart, iend
136 integer(i4) :: s11, e11
138 integer(i4) :: domainid, idomain, gauge_counter
174 if (idomain .eq. 1)
then
179 else if ((
domainmeta%L0DataFrom(idomain) == idomain))
then
229 call message(
' Flow direction upscaled ...')
231 call message(
' in ', trim(num2str(timer_get(1),
'(F9.3)')),
' seconds.')
236 call message(
' Flow accumulation upscaled ...')
238 call message(
' in ', trim(num2str(timer_get(1),
'(F9.3)')),
' seconds.')
243 call message(
' Topology configured ...')
245 call message(
' in ', trim(num2str(timer_get(1),
'(F9.3)')),
' seconds.')
250 call message(
' Routing order ready ...')
252 call message(
' in ', trim(num2str(timer_get(1),
'(F9.3)')),
' seconds.')
257 call message(
' Link location done ...')
259 call message(
' in ', trim(num2str(timer_get(1),
'(F9.3)')),
' seconds.')
264 call message(
' Gauges assigned with nodes ...')
266 call message(
' in ', trim(num2str(timer_get(1),
'(F9.3)')),
' seconds.')
272 call message(
' Stream features generated ...')
274 call message(
' in ', trim(num2str(timer_get(1),
'(F9.3)')),
' seconds.')
293 gauge_counter = gauge_counter + 1
296 if (gauge_counter .lt. 1)
then
298 call message(
' WARNING: no gauge found within modelling domain')
333 call message(
' Initialization of river temperature routing.')
352 call message(
' Finished Initialization of mRM')
362 use mo_kind,
only : i4
364 use mo_string_utils,
only : num2str, separator
368 character(*),
intent(in) :: file_namelist
369 character(*),
intent(in) :: file_namelist_param
372 integer(i4),
dimension(8) :: datetime
374 CHARACTER(len=1024) :: message_text =
''
376 call message(separator)
377 call message(
' mRM-UFZ')
379 call message(
' MULTISCALE ROUTING MODEL')
380 call message(
' Version ', trim(
version))
383 call message(
'Made available by S. Thober & M. Cuntz')
385 call message(
'Based on mHM-UFZ by L. Samaniego & R. Kumar')
387 call message(separator)
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))
410 use mo_kind,
only : i4
414 use mo_string_utils,
only : num2str
418 integer(i4) :: domainID, iDomain
427 call message(
'Read namelist file: ', trim(
file_defoutput),
' (if it is given)')
430 call message(
' # of domains: ', trim(num2str(
domainmeta%nDomains)))
432 call message(
' Input data directories:')
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')
444 call message(
' ', trim(adjustl(num2str(jj))),
' ', &
445 trim(adjustl(num2str(
domain_mrm(idomain)%gaugeIdList(jj)))))
447 if (
domain_mrm(idomain)%nInflowGauges .GT. 0)
then
448 call message(
' Inflow gauge ',
'ID')
450 call message(
' ', trim(adjustl(num2str(jj))),
' ', &
451 trim(adjustl(num2str(
domain_mrm(idomain)%InflowGaugeIdList(jj)))))
500 use mo_kind,
only: i4
508 integer(i4),
intent(in),
optional :: idomain
510 integer(i4) :: s11, e11
517 if (
present(idomain))
then
549 use mo_kind,
only : i4
551 use mo_string_utils,
only : num2str
555 integer(i4),
intent(in) :: L0Domain_iDomain
559 CHARACTER(len=1024) :: message_text =
''
561 do k =
level0(l0domain_idomain)%iStart,
level0(l0domain_idomain)%iEnd
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 ', &
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 ', &
584 use mo_append,
only : append
585 use mo_kind,
only : dp, i4
594 integer(i4),
intent(in) :: iDomain
596 real(dp),
dimension(:),
allocatable :: dummy_Vector11
598 real(dp),
dimension(:, :),
allocatable :: dummy_Matrix11_IT
602 allocate(dummy_vector11(
level11(idomain)%nCells))
606 dummy_vector11(:) = 0.0_dp
607 call append(
l11_qmod, dummy_vector11)
610 dummy_vector11(:) = 0.0_dp
611 call append(
l11_qout, dummy_vector11)
614 dummy_matrix11_it(:, :) = 0.0_dp
615 call append(
l11_qtin, dummy_matrix11_it)
618 dummy_matrix11_it(:, :) = 0.0_dp
619 call append(
l11_qtr, dummy_matrix11_it)
622 dummy_vector11(:) = 0.0_dp
623 call append(
l11_k, dummy_vector11)
626 dummy_vector11(:) = 0.0_dp
627 call append(
l11_xi, dummy_vector11)
630 dummy_vector11(:) = 0.0_dp
631 call append(
l11_c1, dummy_vector11)
634 dummy_vector11(:) = 0.0_dp
635 call append(
l11_c2, dummy_vector11)
638 dummy_vector11(:) = 0.0_dp
642 if (
allocated(dummy_vector11))
deallocate(dummy_vector11)
644 dummy_vector11(:) = 0.0_dp
648 if (
allocated(dummy_vector11))
deallocate(dummy_vector11)
649 if (
allocated(dummy_matrix11_it))
deallocate(dummy_matrix11_it)
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
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.
logical, public mrm_read_river_network
character(256), dimension(:), allocatable, public mrmfilerestartin
real(dp), dimension(:), allocatable, public resolutionrouting
integer(i4) mrm_coupling_mode
Reading of main model configurations.
subroutine, public common_read_config(file_namelist)
Read main configurations commonly used by mHM, mRM and MPR.
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.
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
subroutine, public mrm_read_restart_config(idomain, domainid, infile)
reads Level 11 configuration from a restart directory
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