14 use mo_kind,
only : i4, dp
15 use mo_message,
only : message, error_message
47 use mo_julian,
only : caldat, julday
48 use mo_nml,
only : close_nml, open_nml, position_nml
49 use mo_string_utils,
only : num2str
53 character(*),
intent(in) :: file_namelist
54 integer,
intent(in) :: unamelist
58 integer(i4) :: domainid, idomain
60 integer(i4),
dimension(maxNoDomains) :: warming_days
62 type(
period),
dimension(maxNoDomains) :: eval_per
64 real(dp),
dimension(maxNoDomains) :: resolution_routing
66 character(256),
dimension(maxNoDomains) :: mhm_file_restartin
67 character(256),
dimension(maxNoDomains) :: mrm_file_restartin
74 mhm_file_restartin, mrm_file_restartin
79 namelist /time_periods/ warming_days, eval_per
89 call open_nml(file_namelist, unamelist, quiet = .true.)
94 call position_nml(
'mainconfig_mhm_mrm', unamelist)
95 read(unamelist, nml = mainconfig_mhm_mrm)
99 call message(
'***WARNING: mrm_read_river_network is set to .true. because read_restart is .true.')
117 call error_message(
'***ERROR: cannot read states from restart file when optimizing')
124 call message(
'Warning: although defined in namelist, routing is switched off for domain', trim(num2str(domainid)))
125 call message(
' since the calibration of Q is not possible with the chosen opti input')
134 call error_message(
'mo_startup: timeStep must be a divisor of 24: ', num2str(
timestep))
147 call position_nml(
'time_periods', unamelist)
148 read(unamelist, nml = time_periods)
164 jday = julday(dd =
evalper(idomain)%dStart, mm =
evalper(idomain)%mStart, yy =
evalper(idomain)%yStart)
165 evalper(idomain)%julStart = jday
196 call position_nml(
'Optimization', unamelist)
197 read(unamelist, nml = optimization)
200 call close_nml(unamelist)
215 integer(i4) :: n_true_pars
220 call error_message(
'Number of iterations for Optimization (nIterations) must be greater than zero')
222 if (
dds_r .lt. 0.0_dp .or.
dds_r .gt. 1.0_dp)
then
223 call error_message(
'dds_r must be between 0.0 and 1.0')
226 call error_message(
'number of complexes in SCE (sce_ngs) must be at least 1')
231 sce_npg = 2 * n_true_pars + 1_i4
239 call error_message(
'number of points per complex (sce_npg) must be greater or', raise=.false.)
240 call error_message(
'equal number of points per sub-complex (sce_nps)')
253 use mo_string_utils,
only : num2str
257 logical,
intent(in) :: do_message
258 logical,
intent(in) :: allow_subgrid_routing
260 integer(i4) :: idomain, domainid
263 real(dp) :: cellfactorrbyh
274 call message(
'domain ', trim(adjustl(num2str(domainid))),
': ')
275 call message(
'resolution Hydrology (domain ', trim(adjustl(num2str(domainid))),
') = ', &
277 call message(
'resolution Routing (domain ', trim(adjustl(num2str(domainid))),
') = ', &
281 if(nint(cellfactorrbyh * 100.0_dp) .eq. 100)
then
284 call message(
'Resolution of routing and hydrological modeling are equal!')
287 else if ((nint(cellfactorrbyh * 100.0_dp) .gt. 100) .and. .not.allow_subgrid_routing)
then
288 if(nint(mod(cellfactorrbyh, 2.0_dp) * 100.0_dp) .ne. 0)
then
289 call error_message(
'***ERROR: Resolution of routing is not a multiple of hydrological model resolution!', raise=.false.)
290 call error_message(
' FILE: mhm.nml, namelist: mainconfig, variable: resolutionRouting')
295 call message(
'Resolution of routing is bigger than hydrological model resolution by ', &
296 trim(adjustl(num2str(nint(cellfactorrbyh)))),
' times !')
309 type(
period),
intent(inout) :: toPeriod
310 type(
period),
intent(in) :: fromPeriod
312 toperiod%dStart = fromperiod%dStart
313 toperiod%mStart = fromperiod%mStart
314 toperiod%yStart = fromperiod%yStart
315 toperiod%dEnd = fromperiod%dEnd
316 toperiod%mEnd = fromperiod%mEnd
317 toperiod%yEnd = fromperiod%yEnd
318 toperiod%julStart = 0
Provides constants commonly used by mHM, mRM and MPR.
integer(i4), parameter, public maxnodomains
integer(i4), parameter, public nodata_i4
Reading of main model configurations.
subroutine period_copy_period_data(toperiod, fromperiod)
copy period data
subroutine, public common_check_resolution(do_message, allow_subgrid_routing)
check resolution
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.
integer(i4), public niterations
logical, public mrm_read_river_network
integer(i4), public sce_nps
integer(i4), public sce_npg
integer(i4), public sce_ngs
logical, public optimize_restart
character(256), dimension(:), allocatable, public mrmfilerestartin
logical, public restart_reset_fluxes_states
flag to reset fluxes and states read from restart to default values
type(period), dimension(:), allocatable, public warmper
character(256), dimension(:), allocatable, public mhmfilerestartin
integer(i4), public opti_method
real(dp), dimension(:), allocatable, public resolutionrouting
real(dp), dimension(nerror_model), public mcmc_error_params
integer(i4), public ntstepday
logical, public read_old_style_restart_bounds
integer(i4), dimension(:), allocatable, public warmingdays
logical, public mcmc_opti
integer(i4), public opti_function
integer(i4), dimension(:, :), allocatable, public lcyearid
type(period), dimension(:), allocatable, public simper
integer(i4), public timestep
logical, public read_restart
type(period), dimension(:), allocatable, public evalper
Reading of main model configurations.
subroutine, public set_land_cover_scenes_id(sim_per, lcyear_id)
Set land cover scenes IDs.
Provides common types needed by mHM, mRM and/or mpr.
Provides structures needed by mHM, mRM and/or mpr.
real(dp), dimension(:), allocatable, public resolutionhydrology
real(dp), dimension(:, :), allocatable, target, public global_parameters
character(256), dimension(:), allocatable, public lcfilename
type(domain_meta), public domainmeta
integer(i4), dimension(nprocesses, 3), public processmatrix