14 use mo_kind,
only : i4, dp
15 use mo_message,
only: message, error_message
64 use mo_string_utils,
only : num2str
74 character(*),
intent(in) :: file_namelist, file_namelist_param
77 logical,
intent(in) :: do_message
79 integer(i4),
dimension(maxNoDomains) :: nogauges_domain
80 integer(i4),
dimension(maxNoDomains, maxNoGauges) :: gauge_id
81 character(256),
dimension(maxNoDomains, maxNoGauges) :: gauge_filename
83 integer(i4),
dimension(maxNoDomains) :: noinflowgauges_domain
84 integer(i4),
dimension(maxNoDomains, maxNoGauges) :: inflowgauge_id
85 character(256),
dimension(maxNoDomains, maxNoGauges) :: inflowgauge_filename
86 logical,
dimension(maxNoDomains, maxNoGauges) :: inflowgauge_headwater
88 integer(i4) :: domainid, idomain
94 character(256),
dimension(maxNoDomains) :: dir_gauges
95 character(256),
dimension(maxNoDomains) :: dir_total_runoff
96 character(256),
dimension(maxNoDomains) :: dir_bankfull_runoff
98 logical :: file_exists
127 dirgauges(idomain) = dir_gauges(domainid)
142 call error_message(
'***ERROR: ', trim(file_namelist),
': Total number of evaluation gauges is restricted to', &
144 call error_message(
' Error occured in namlist: evaluation_gauges')
169 allocate(domain_mrm_idomain%gaugeIdList(maxval(nogauges_domain(:))))
170 domain_mrm_idomain%gaugeIdList =
nodata_i4
171 allocate(domain_mrm_idomain%gaugeIndexList(maxval(nogauges_domain(:))))
172 domain_mrm_idomain%gaugeIndexList =
nodata_i4
173 allocate(domain_mrm_idomain%gaugeNodeList(maxval(nogauges_domain(:))))
174 domain_mrm_idomain%gaugeNodeList =
nodata_i4
176 if (nogauges_domain(domainid) .EQ.
nodata_i4)
then
177 call error_message(
'***ERROR: ', trim(file_namelist),
': Number of evaluation gauges for subdomain ', &
178 trim(adjustl(num2str(domainid))),
' is not defined!', raise=.false.)
179 call error_message(
' Error occured in namelist: evaluation_gauges')
182 domain_mrm_idomain%nGauges = nogauges_domain(domainid)
184 do igauge = 1, nogauges_domain(domainid)
186 if (gauge_id(domainid, igauge) .EQ.
nodata_i4)
then
187 call error_message(
'***ERROR: ', trim(file_namelist),
': ID ', &
188 trim(adjustl(num2str(gauge_id(domainid, igauge)))),
' of evaluation gauge ', &
189 trim(adjustl(num2str(igauge))),
' for subdomain ', &
190 trim(adjustl(num2str(idomain))),
' is not defined!', raise=.false.)
191 call error_message(
' Error occured in namelist: evaluation_gauges')
192 else if (trim(gauge_filename(domainid, igauge)) .EQ. trim(num2str(
nodata_i4)))
then
193 call error_message(
'***ERROR: ', trim(file_namelist),
': Filename of evaluation gauge ', &
194 trim(adjustl(num2str(igauge))),
' for subdomain ', &
195 trim(adjustl(num2str(idomain))),
' is not defined!', raise=.false.)
196 call error_message(
' Error occured in namelist: evaluation_gauges')
200 gauge%domainId(idx) = idomain
201 gauge%gaugeId(idx) = gauge_id(domainid, igauge)
202 gauge%fname(idx) = trim(
dirgauges(idomain)) // trim(gauge_filename(domainid, igauge))
203 domain_mrm_idomain%gaugeIdList(igauge) = gauge_id(domainid, igauge)
204 domain_mrm_idomain%gaugeIndexList(igauge) = idx
209 call error_message(
'***ERROR: ', trim(file_namelist),
': Total number of evaluation gauges (', &
211 ') different from sum of gauges in subdomains (', trim(adjustl(num2str(idx))),
')!', raise=.false.)
212 call error_message(
' Error occured in namelist: evaluation_gauges')
227 call error_message(
'***ERROR: ', trim(file_namelist), &
228 ':read_gauge_lut: Total number of inflow gauges is restricted to', num2str(
maxnogauges), raise=.false.)
229 call error_message(
' Error occured in namlist: inflow_gauges')
246 allocate(domain_mrm_idomain%InflowGaugeIdList (max(1, maxval(noinflowgauges_domain(:)))))
247 allocate(domain_mrm_idomain%InflowGaugeHeadwater (max(1, maxval(noinflowgauges_domain(:)))))
248 allocate(domain_mrm_idomain%InflowGaugeIndexList (max(1, maxval(noinflowgauges_domain(:)))))
249 allocate(domain_mrm_idomain%InflowGaugeNodeList (max(1, maxval(noinflowgauges_domain(:)))))
251 domain_mrm_idomain%nInflowGauges = 0
252 domain_mrm_idomain%InflowGaugeIdList =
nodata_i4
253 domain_mrm_idomain%InflowGaugeHeadwater = .false.
254 domain_mrm_idomain%InflowGaugeIndexList =
nodata_i4
255 domain_mrm_idomain%InflowGaugeNodeList =
nodata_i4
257 if (noinflowgauges_domain(domainid) .EQ.
nodata_i4)
then
258 noinflowgauges_domain(domainid) = 0
261 domain_mrm_idomain%nInflowGauges = noinflowgauges_domain(domainid)
263 do igauge = 1, noinflowgauges_domain(domainid)
265 if (inflowgauge_id(domainid, igauge) .EQ.
nodata_i4)
then
266 call error_message(
'***ERROR: ', trim(file_namelist),
':ID of inflow gauge ', &
267 trim(adjustl(num2str(igauge))),
' for subdomain ', &
268 trim(adjustl(num2str(idomain))),
' is not defined!', raise=.false.)
269 call error_message(
' Error occured in namlist: inflow_gauges')
270 else if (trim(inflowgauge_filename(domainid, igauge)) .EQ. trim(num2str(
nodata_i4)))
then
271 call error_message(
'***ERROR: ', trim(file_namelist),
':Filename of inflow gauge ', &
272 trim(adjustl(num2str(igauge))),
' for subdomain ', &
273 trim(adjustl(num2str(idomain))),
' is not defined!', raise=.false.)
274 call error_message(
' Error occured in namlist: inflow_gauges')
279 inflowgauge%gaugeId(idx) = inflowgauge_id(domainid, igauge)
280 inflowgauge%fname(idx) = trim(
dirgauges(domainid)) // trim(inflowgauge_filename(domainid, igauge))
281 domain_mrm_idomain%InflowGaugeIdList(igauge) = inflowgauge_id(domainid, igauge)
282 domain_mrm_idomain%InflowGaugeHeadwater(igauge) = inflowgauge_headwater(domainid, igauge)
283 domain_mrm_idomain%InflowGaugeIndexList(igauge) = idx
288 call error_message(
'***ERROR: ', trim(file_namelist),
': Total number of inflow gauges (', &
290 ') different from sum of inflow gauges in subdomains (', trim(adjustl(num2str(idx))),
')!', raise=.false.)
291 call error_message(
' Error occured in namlist: inflow_gauges')
315 call message(
' Following output will be written:')
318 call message(
' NetCDF output precision: double')
320 call message(
' NetCDF output precision: single')
324 call message(
' NetCDF output time reference point: start of time interval')
326 call message(
' NetCDF output time reference point: center of time interval')
328 call message(
' NetCDF output time reference point: end of time interval')
330 call message(
' FLUXES:')
332 call message(
' routed streamflow (L11_qMod) [m3 s-1]')
335 call message(
' river temperature (RivTemp) [deg C]')
338 call message(
' river head (river_head) [m]')
343 call message(
' FINISHED reading config')
375 use mo_message,
only : message
384 integer(i4),
intent(in) :: processCase
387 character(*),
intent(in) :: file_namelist_param
390 integer(i4) :: start_index
392 real(dp),
dimension(nColPars) :: muskingumTravelTime_constant
393 real(dp),
dimension(nColPars) :: muskingumTravelTime_riverLength
394 real(dp),
dimension(nColPars) :: muskingumTravelTime_riverSlope
395 real(dp),
dimension(nColPars) :: muskingumTravelTime_impervious
396 real(dp),
dimension(nColPars) :: muskingumAttenuation_riverSlope
398 real(dp),
dimension(nColPars) :: streamflow_celerity
399 real(dp),
dimension(nColPars) :: slope_factor
401 if (processcase .eq. 1_i4)
then
403 muskingumtraveltime_constant =
nml_routing1%muskingumTravelTime_constant
404 muskingumtraveltime_riverlength =
nml_routing1%muskingumTravelTime_riverLength
405 muskingumtraveltime_riverslope =
nml_routing1%muskingumTravelTime_riverSlope
406 muskingumtraveltime_impervious =
nml_routing1%muskingumTravelTime_impervious
407 muskingumattenuation_riverslope =
nml_routing1%muskingumAttenuation_riverSlope
408 else if (processcase .eq. 2_i4)
then
411 else if (processcase .eq. 3_i4)
then
420 if (processcase .eq. 1_i4)
then
433 'muskingumTravelTime_constant ', &
434 'muskingumTravelTime_riverLength', &
435 'muskingumTravelTime_riverSlope ', &
436 'muskingumTravelTime_impervious ', &
437 'muskingumAttenuation_riverSlope'/)
439 else if (processcase .eq. 2_i4)
then
447 'streamflow_celerity'/)
449 else if (processcase .eq. 3_i4)
then
463 call error_message(
'***ERROR: parameter in routing namelist out of bound in ', &
464 trim(adjustl(file_namelist_param)))
Provides constants commonly used by mHM, mRM and MPR.
integer(i4), parameter, public ncolpars
integer(i4), parameter, public maxnodomains
integer(i4), parameter, public nodata_i4
Provides small utility functions used by multiple parts of the code (mHM, mRM, MPR)
logical function, public in_bound(params)
TODO: add description.
Reading of main model configurations.
subroutine, public common_check_resolution(do_message, allow_subgrid_routing)
check resolution
Provides structures needed by mHM, mRM and/or mpr.
real(dp), dimension(:, :), allocatable, target, public global_parameters
character(256), dimension(:), allocatable, public global_parameters_name
type(domain_meta), public domainmeta
integer(i4), dimension(nprocesses, 3), public processmatrix
Provides mRM specific constants.
integer(i4), parameter, public maxnogauges
Provides file names and units for mRM.
character(:), allocatable file_defoutput
file defining mRM's outputs
Global variables for mRM only.
type(gaugingstation), public inflowgauge
logical output_double_precision_mrm
float precision in output nc files
character(256), dimension(:), allocatable, public dirbankfullrunoff
character(256), dimension(:), allocatable, public dirgauges
integer(i4) output_time_reference_mrm
time reference point location in output nc files
type(gaugingstation), public gauge
logical, dimension(noutflxstate) outputflxstate_mrm
Define model outputs see "mhm_outputs.nml".
type(domaininfo_mrm), dimension(:), allocatable, target, public domain_mrm
integer(i4), public ngaugeslocal
character(256), public varnametotalrunoff
integer(i4) timestep_model_outputs_mrm
timestep for writing model outputs
character(256), dimension(:), allocatable, public dirtotalrunoff
integer(i4), public ninflowgaugestotal
integer(i4) output_deflate_level_mrm
compression of output nc files
integer(i4), public ngaugestotal
character(256), public filenametotalrunoff
subroutine, public mrm_read_config(file_namelist, file_namelist_param, do_message)
Read the general config of mRM.
subroutine read_mrm_routing_params(processcase, file_namelist_param)
TODO: add description.
Module containing all namelists representations.
type(nml_evaluation_gauges_t), public nml_evaluation_gauges
'evaluation_gauges' namelist content
type(nml_directories_mrm_t), public nml_directories_mrm
'directories_mrm' namelist content
type(nml_mainconfig_mrm_t), public nml_mainconfig_mrm
'mainconfig_mrm' namelist content
type(nml_routing3_t), public nml_routing3
'routing3' namelist content
type(nml_routing1_t), public nml_routing1
'routing1' namelist content
type(nml_inflow_gauges_t), public nml_inflow_gauges
'inflow_gauges' namelist content
type(nml_mrm_outputs_t), public nml_mrm_outputs
'mrm_outputs' namelist content
type(nml_routing2_t), public nml_routing2
'routing2' namelist content