15 use mo_message,
only : message, error_message
32 subroutine mrm_configuration(file_namelist, unamelist, file_namelist_param, unamelist_param)
39 use mo_kind,
only : i4
42 character(*),
intent(in) :: file_namelist
43 integer,
intent(in) :: unamelist
44 character(*),
intent(in) :: file_namelist_param
45 integer,
intent(in) :: unamelist_param
56 call message(
' Inititalize mRM')
62 call message(
' Read config: river temperature routing')
63 call riv_temp_pcs%config(file_namelist, unamelist, file_namelist_param, unamelist_param)
101 subroutine mrm_init(file_namelist, unamelist, file_namelist_param, unamelist_param)
110 use mo_kind,
only : i4
129 character(*),
intent(in) :: file_namelist
130 integer,
intent(in) :: unamelist
131 character(*),
intent(in) :: file_namelist_param
132 integer,
intent(in) :: unamelist_param
135 integer(i4) :: istart, iend
137 integer(i4) :: s11, e11
139 integer(i4) :: domainid, idomain, gauge_counter
173 if (idomain .eq. 1)
then
178 else if ((
domainmeta%L0DataFrom(idomain) == idomain))
then
248 gauge_counter = gauge_counter + 1
251 if (gauge_counter .lt. 1)
then
253 call message(
' WARNING: no gauge found within modelling domain')
288 call message(
' Initialization of river temperature routing.')
307 call message(
' Finished Initialization of mRM')
317 use mo_kind,
only : i4
319 use mo_string_utils,
only : num2str, separator
323 character(*),
intent(in) :: file_namelist
324 character(*),
intent(in) :: file_namelist_param
327 integer(i4),
dimension(8) :: datetime
329 CHARACTER(len=1024) :: message_text =
''
331 call message(separator)
332 call message(
' mRM-UFZ')
334 call message(
' MULTISCALE ROUTING MODEL')
335 call message(
' Version ', trim(
version))
338 call message(
'Made available by S. Thober & M. Cuntz')
340 call message(
'Based on mHM-UFZ by L. Samaniego & R. Kumar')
342 call message(separator)
345 call date_and_time(values = datetime)
346 message_text = trim(num2str(datetime(3),
'(I2.2)')) //
"." // trim(num2str(datetime(2),
'(I2.2)')) &
347 //
"." // trim(num2str(datetime(1),
'(I4.4)')) //
" " // trim(num2str(datetime(5),
'(I2.2)')) &
348 //
":" // trim(num2str(datetime(6),
'(I2.2)')) //
":" // trim(num2str(datetime(7),
'(I2.2)'))
349 call message(
'Start at ', trim(message_text),
'.')
350 call message(
'Using main file ', trim(
file_main),
' and namelists: ')
351 call message(
' ', trim(file_namelist))
352 call message(
' ', trim(file_namelist_param))
365 use mo_kind,
only : i4
369 use mo_string_utils,
only : num2str
373 integer(i4) :: domainID, iDomain
382 call message(
'Read namelist file: ', trim(
file_defoutput),
' (if it is given)')
385 call message(
' # of domains: ', trim(num2str(
domainmeta%nDomains)))
387 call message(
' Input data directories:')
390 call message(
' --------------')
391 call message(
' DOMAIN ', num2str(domainid,
'(I3)'))
392 call message(
' --------------')
393 call message(
' Morphological directory: ', trim(
dirmorpho(idomain)))
394 call message(
' Land cover directory: ', trim(
dirlcover(idomain)))
395 call message(
' Discharge directory: ', trim(
dirgauges(idomain)))
396 call message(
' Output directory: ', trim(
dirout(idomain)))
397 call message(
' Evaluation gauge ',
'ID')
399 call message(
' ', trim(adjustl(num2str(jj))),
' ', &
400 trim(adjustl(num2str(
domain_mrm(idomain)%gaugeIdList(jj)))))
402 if (
domain_mrm(idomain)%nInflowGauges .GT. 0)
then
403 call message(
' Inflow gauge ',
'ID')
405 call message(
' ', trim(adjustl(num2str(jj))),
' ', &
406 trim(adjustl(num2str(
domain_mrm(idomain)%InflowGaugeIdList(jj)))))
455 use mo_kind,
only: i4
463 integer(i4),
intent(in),
optional :: idomain
465 integer(i4) :: s11, e11
472 if (
present(idomain))
then
504 use mo_kind,
only : i4
506 use mo_string_utils,
only : num2str
510 integer(i4),
intent(in) :: L0Domain_iDomain
514 CHARACTER(len=1024) :: message_text =
''
516 do k =
level0(l0domain_idomain)%iStart,
level0(l0domain_idomain)%iEnd
519 message_text = trim(num2str(k,
'(I5)')) //
',' // trim(num2str(l0domain_idomain,
'(I5)'))
520 call error_message(
' Error: flow direction has missing value within the valid masked area at cell in domain ', &
525 message_text = trim(num2str(k,
'(I5)')) //
',' // trim(num2str(l0domain_idomain,
'(I5)'))
526 call error_message(
' Error: flow accumulation has missing values within the valid masked area at cell in domain ', &
539 use mo_append,
only : append
540 use mo_kind,
only : dp, i4
549 integer(i4),
intent(in) :: iDomain
551 real(dp),
dimension(:),
allocatable :: dummy_Vector11
553 real(dp),
dimension(:, :),
allocatable :: dummy_Matrix11_IT
557 allocate(dummy_vector11(
level11(idomain)%nCells))
561 dummy_vector11(:) = 0.0_dp
562 call append(
l11_qmod, dummy_vector11)
565 dummy_vector11(:) = 0.0_dp
566 call append(
l11_qout, dummy_vector11)
569 dummy_matrix11_it(:, :) = 0.0_dp
570 call append(
l11_qtin, dummy_matrix11_it)
573 dummy_matrix11_it(:, :) = 0.0_dp
574 call append(
l11_qtr, dummy_matrix11_it)
577 dummy_vector11(:) = 0.0_dp
578 call append(
l11_k, dummy_vector11)
581 dummy_vector11(:) = 0.0_dp
582 call append(
l11_xi, dummy_vector11)
585 dummy_vector11(:) = 0.0_dp
586 call append(
l11_c1, dummy_vector11)
589 dummy_vector11(:) = 0.0_dp
590 call append(
l11_c2, dummy_vector11)
593 dummy_vector11(:) = 0.0_dp
597 if (
allocated(dummy_vector11))
deallocate(dummy_vector11)
599 dummy_vector11(:) = 0.0_dp
603 if (
allocated(dummy_vector11))
deallocate(dummy_vector11)
604 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
Reading of main model configurations.
subroutine, public common_mhm_mrm_read_config(file_namelist, unamelist)
Read main configurations for common parts.
subroutine, public check_optimization_settings
check optimization settings
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, unamelist)
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
subroutine, public set_domain_indices(grids, indices)
TODO: add description.
subroutine, public init_lowres_level(highres, target_resolution, lowres, highres_lowres_remap)
Level-1 variable initialization.
subroutine, public l0_grid_setup(new_grid)
level 0 variable initialization
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
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 config_output
print mRM configuration
subroutine print_startup_message(file_namelist, file_namelist_param)
Print mRM startup message.
subroutine, public mrm_configuration(file_namelist, unamelist, file_namelist_param, unamelist_param)
read mRM configuration from namelists
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
subroutine, public mrm_init(file_namelist, unamelist, file_namelist_param, unamelist_param)
Initialize all mRM variables at all levels (i.e., L0, L1, and L11).
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, unamelist, file_namelist_param, unamelist_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