22 use mo_kind,
only: i4, dp
31 character(256) :: nml_name =
'coupling'
32 logical :: read_nml = .true.
34 integer(i4) :: meteo_timestep
35 logical :: meteo_time_ref_endpoint
36 logical :: meteo_expect_pre
37 logical :: meteo_expect_temp
38 logical :: meteo_expect_pet
39 logical :: meteo_expect_tmin
40 logical :: meteo_expect_tmax
41 logical :: meteo_expect_netrad
42 logical :: meteo_expect_absvappress
43 logical :: meteo_expect_windspeed
45 logical :: meteo_expect_ssrd
46 logical :: meteo_expect_strd
47 logical :: meteo_expect_tann
73 call self%set_config(read_nml=.true.)
79 use mo_nml,
only : close_nml, open_nml, position_nml
83 character(*),
intent(in) :: file_namelist
84 integer,
intent(in) :: unamelist
87 integer(i4) :: meteo_timestep
88 logical :: meteo_time_ref_endpoint
89 logical :: meteo_expect_pre
90 logical :: meteo_expect_temp
91 logical :: meteo_expect_pet
92 logical :: meteo_expect_tmin
93 logical :: meteo_expect_tmax
94 logical :: meteo_expect_netrad
95 logical :: meteo_expect_absvappress
96 logical :: meteo_expect_windspeed
97 logical :: meteo_expect_ssrd
98 logical :: meteo_expect_strd
99 logical :: meteo_expect_tann
101 integer(i4) :: status
104 namelist /coupling/ &
107 meteo_time_ref_endpoint, &
113 meteo_expect_netrad, &
114 meteo_expect_absvappress, &
115 meteo_expect_windspeed, &
121 if (self%read_nml)
then
122 call self%set_config(read_nml=.true.)
128 meteo_timestep = self%meteo_timestep
129 meteo_time_ref_endpoint = self%meteo_time_ref_endpoint
130 meteo_expect_pre = self%meteo_expect_pre
131 meteo_expect_temp = self%meteo_expect_temp
132 meteo_expect_pet = self%meteo_expect_pet
133 meteo_expect_tmin = self%meteo_expect_tmin
134 meteo_expect_tmax = self%meteo_expect_tmax
135 meteo_expect_netrad = self%meteo_expect_netrad
136 meteo_expect_absvappress = self%meteo_expect_absvappress
137 meteo_expect_windspeed = self%meteo_expect_windspeed
138 meteo_expect_ssrd = self%meteo_expect_ssrd
139 meteo_expect_strd = self%meteo_expect_strd
140 meteo_expect_tann = self%meteo_expect_tann
143 call open_nml(file_namelist, unamelist, quiet=.true.)
144 call position_nml(self%nml_name, unamelist, status=status)
147 if (status == 0_i4)
then
149 read(unamelist, nml=coupling)
153 call close_nml(unamelist)
156 self%meteo_timestep = meteo_timestep
157 self%meteo_time_ref_endpoint = meteo_time_ref_endpoint
158 self%meteo_expect_pre = meteo_expect_pre
159 self%meteo_expect_temp = meteo_expect_temp
160 self%meteo_expect_pet = meteo_expect_pet
161 self%meteo_expect_tmin = meteo_expect_tmin
162 self%meteo_expect_tmax = meteo_expect_tmax
163 self%meteo_expect_netrad = meteo_expect_netrad
164 self%meteo_expect_absvappress = meteo_expect_absvappress
165 self%meteo_expect_windspeed = meteo_expect_windspeed
166 self%meteo_expect_ssrd = meteo_expect_ssrd
167 self%meteo_expect_strd = meteo_expect_strd
168 self%meteo_expect_tann = meteo_expect_tann
177 meteo_time_ref_endpoint, &
183 meteo_expect_netrad, &
184 meteo_expect_absvappress, &
185 meteo_expect_windspeed, &
194 integer(i4),
intent(in),
optional :: case
195 integer(i4),
intent(in),
optional :: meteo_timestep
196 logical,
intent(in),
optional :: meteo_time_ref_endpoint
197 logical,
intent(in),
optional :: meteo_expect_pre
198 logical,
intent(in),
optional :: meteo_expect_temp
199 logical,
intent(in),
optional :: meteo_expect_pet
200 logical,
intent(in),
optional :: meteo_expect_tmin
201 logical,
intent(in),
optional :: meteo_expect_tmax
202 logical,
intent(in),
optional :: meteo_expect_netrad
203 logical,
intent(in),
optional :: meteo_expect_absvappress
204 logical,
intent(in),
optional :: meteo_expect_windspeed
205 logical,
intent(in),
optional :: meteo_expect_ssrd
206 logical,
intent(in),
optional :: meteo_expect_strd
207 logical,
intent(in),
optional :: meteo_expect_tann
208 logical,
intent(in),
optional :: read_nml
212 self%meteo_timestep = 0_i4
213 self%meteo_time_ref_endpoint = .false.
214 self%meteo_expect_pre = .false.
215 self%meteo_expect_temp = .false.
216 self%meteo_expect_pet = .false.
217 self%meteo_expect_tmin = .false.
218 self%meteo_expect_tmax = .false.
219 self%meteo_expect_netrad = .false.
220 self%meteo_expect_absvappress = .false.
221 self%meteo_expect_windspeed = .false.
222 self%meteo_expect_ssrd = .false.
223 self%meteo_expect_strd = .false.
224 self%meteo_expect_tann = .false.
227 self%read_nml = .false.
229 if (
present(case)) self%case =
case
230 if (
present(meteo_timestep)) self%meteo_timestep = meteo_timestep
231 if (
present(meteo_time_ref_endpoint)) self%meteo_time_ref_endpoint = meteo_time_ref_endpoint
232 if (
present(meteo_expect_pre)) self%meteo_expect_pre = meteo_expect_pre
233 if (
present(meteo_expect_temp)) self%meteo_expect_temp = meteo_expect_temp
234 if (
present(meteo_expect_pet)) self%meteo_expect_pet = meteo_expect_pet
235 if (
present(meteo_expect_tmin)) self%meteo_expect_tmin = meteo_expect_tmin
236 if (
present(meteo_expect_tmax)) self%meteo_expect_tmax = meteo_expect_tmax
237 if (
present(meteo_expect_netrad)) self%meteo_expect_netrad = meteo_expect_netrad
238 if (
present(meteo_expect_absvappress)) self%meteo_expect_absvappress = meteo_expect_absvappress
239 if (
present(meteo_expect_windspeed)) self%meteo_expect_windspeed = meteo_expect_windspeed
240 if (
present(meteo_expect_ssrd)) self%meteo_expect_ssrd = meteo_expect_ssrd
241 if (
present(meteo_expect_strd)) self%meteo_expect_strd = meteo_expect_strd
242 if (
present(meteo_expect_tann)) self%meteo_expect_tann = meteo_expect_tann
243 if (
present(read_nml)) self%read_nml = read_nml
255 self%meteo_expect_pre .or. &
256 self%meteo_expect_temp .or. &
257 self%meteo_expect_pet .or. &
258 self%meteo_expect_tmin .or. &
259 self%meteo_expect_tmax .or. &
260 self%meteo_expect_netrad .or. &
261 self%meteo_expect_absvappress .or. &
262 self%meteo_expect_windspeed .or. &
263 self%meteo_expect_ssrd .or. &
264 self%meteo_expect_strd .or. &
265 self%meteo_expect_tann
270 subroutine check(self, domainMeta, optimize)
271 use mo_message,
only : error_message
272 use mo_string_utils,
only : num2str
278 logical,
intent(in) :: optimize
280 if (.not. any(self%case == [0, 1])) &
281 call error_message(
"Coupling: case needs to be 0 or 1. Got: ", num2str(self%case))
284 if (self%case == 1 .and. domainmeta%nDomains > 1) &
285 call error_message(
"Coupling: Only one domain allowed when coupling.")
288 if (self%case /= 0 .and. optimize) &
289 call error_message(
"Coupling: no internal optimization allowed when coupling.")
292 if (self%case /= 0 .and. self%any_meteo_expected() .and. .not. any(self%meteo_timestep == [1, 24])) &
293 call error_message(
"Coupling: meteo data expected but no valid time-step (1 or 24) given for it.")
Provides common types needed by mHM, mRM and/or mpr.
Types to specify the coupling configuration of mHM.
subroutine set_config(self, case, meteo_timestep, meteo_time_ref_endpoint, meteo_expect_pre, meteo_expect_temp, meteo_expect_pet, meteo_expect_tmin, meteo_expect_tmax, meteo_expect_netrad, meteo_expect_absvappress, meteo_expect_windspeed, meteo_expect_ssrd, meteo_expect_strd, meteo_expect_tann, read_nml)
set configuration for the couple_cfg_type class
logical function active(self)
whether coupling is actived
logical function any_meteo_expected(self)
whether any meteo data is expected
subroutine read_config(self, file_namelist, unamelist)
read configuration for the couple_cfg_type class from the mhm namelist
subroutine clean_up(self)
clean up
subroutine check(self, domainmeta, optimize)
check configuration
DOMAIN general description.
This is a container to hold all coupling configurations for mHM.