1 | !> @file check_parameters.f90 |
---|
2 | !--------------------------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General |
---|
6 | ! Public License as published by the Free Software Foundation, either version 3 of the License, or |
---|
7 | ! (at your option) any later version. |
---|
8 | ! |
---|
9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
---|
10 | ! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
11 | ! Public License for more details. |
---|
12 | ! |
---|
13 | ! You should have received a copy of the GNU General Public License along with PALM. If not, see |
---|
14 | ! <http://www.gnu.org/licenses/>. |
---|
15 | ! |
---|
16 | ! Copyright 1997-2021 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: check_parameters.f90 4844 2021-01-18 09:22:26Z gronemeier $ |
---|
26 | ! size check for profile output added |
---|
27 | ! |
---|
28 | ! 4828 2021-01-05 11:21:41Z Giersch |
---|
29 | ! allow prescribing initial uv_profiles AND geostrophic wind |
---|
30 | ! by changing error message PA0347 to an informative message |
---|
31 | ! |
---|
32 | ! 4685 2020-09-18 11:49:50Z gronemeier |
---|
33 | ! filter data_output_pr and data_output list for duplicate entries |
---|
34 | ! |
---|
35 | ! 4633 2020-08-05 14:21:14Z suehring |
---|
36 | ! todo added |
---|
37 | ! |
---|
38 | ! 4565 2020-06-15 08:30:38Z oliver.maas |
---|
39 | ! added check for pt_surface_heating_rate |
---|
40 | ! |
---|
41 | ! 4564 2020-06-12 14:03:36Z raasch |
---|
42 | ! Vertical nesting method of Huq et al. (2019) removed |
---|
43 | ! |
---|
44 | ! 4562 2020-06-12 08:38:47Z raasch |
---|
45 | ! bugfix: revised error message for exceeding allow number of time series |
---|
46 | ! |
---|
47 | ! 4559 2020-06-11 08:51:48Z raasch |
---|
48 | ! file re-formatted to follow the PALM coding standard |
---|
49 | ! |
---|
50 | ! 4536 2020-05-17 17:24:13Z raasch |
---|
51 | ! unneccessary query for restart data format removed |
---|
52 | ! |
---|
53 | ! 4534 2020-05-14 18:35:22Z raasch |
---|
54 | ! adjustments for I/O on reduced number of cores using shared memory MPI |
---|
55 | ! |
---|
56 | ! 4514 2020-04-30 16:29:59Z suehring |
---|
57 | ! Enable output of qsurf and ssurf |
---|
58 | ! |
---|
59 | ! 4513 2020-04-30 13:45:47Z raasch |
---|
60 | ! unused modules removed |
---|
61 | ! |
---|
62 | ! 4511 2020-04-30 12:20:40Z raasch |
---|
63 | ! call of chem_boundary_conds removed (respective settings are now done in the chemistry module) |
---|
64 | ! |
---|
65 | ! 4495 2020-04-13 20:11:20Z raasch |
---|
66 | ! check new restart_data_format parameters |
---|
67 | ! |
---|
68 | ! 4493 2020-04-10 09:49:43Z pavelkrc |
---|
69 | ! Kolmogorov length scale eta added to profile output |
---|
70 | ! |
---|
71 | ! 4444 2020-03-05 15:59:50Z raasch |
---|
72 | ! bugfix: cpp-directives for serial mode added |
---|
73 | ! |
---|
74 | ! 4392 2020-01-31 16:14:57Z pavelkrc |
---|
75 | ! Some error numbers revised to prevent double usage |
---|
76 | ! |
---|
77 | ! 11:55:33Z oliver.maas |
---|
78 | ! Checks for closed channel flow implemented |
---|
79 | ! |
---|
80 | ! 11:55:33Z oliver.maas |
---|
81 | ! Move 2-m potential temperature output to diagnostic_output_quantities |
---|
82 | ! |
---|
83 | ! 11:55:33Z oliver.maas |
---|
84 | ! removed message PA0421, concerning old parameter recycling_yshift |
---|
85 | ! |
---|
86 | ! 11:55:33Z oliver.maas |
---|
87 | ! adjust message to the modified parameter recycling_yshift |
---|
88 | ! |
---|
89 | ! 11:55:33Z oliver.maas |
---|
90 | ! Check if a cross section is specified if any output cross-section quantity |
---|
91 | ! is given |
---|
92 | ! |
---|
93 | ! 11:55:33Z oliver.maas |
---|
94 | ! Overwrite rotation_angle from namelist by value from static driver |
---|
95 | ! |
---|
96 | ! 11:55:33Z oliver.maas |
---|
97 | ! removed conversion from recycle_absolute_quantities to raq, added check and |
---|
98 | ! error message for correct input of recycling_method_for_thermodynamic_quantities |
---|
99 | ! |
---|
100 | ! 11:55:33Z oliver.maas |
---|
101 | ! Corrected "Former revisions" section |
---|
102 | ! |
---|
103 | ! 11:55:33Z oliver.maas |
---|
104 | ! bugfix error message: replaced PA184 by PA0184 |
---|
105 | ! |
---|
106 | ! 11:55:33Z oliver.maas |
---|
107 | ! added conversion from recycle_absolute_quantities to raq for recycling of |
---|
108 | ! absolute quantities and added error message PA184 for not implemented quantities |
---|
109 | ! |
---|
110 | ! 4142 2019-08-05 12:38:31Z suehring |
---|
111 | ! Consider spinup in number of output timesteps for averaged 2D output (merge |
---|
112 | ! from branch resler). |
---|
113 | ! |
---|
114 | ! 4069 2019-07-01 14:05:51Z Giersch |
---|
115 | ! Masked output running index mid has been introduced as a local variable to |
---|
116 | ! avoid runtime error (Loop variable has been modified) in time_integration |
---|
117 | ! |
---|
118 | ! 4048 2019-06-21 21:00:21Z knoop |
---|
119 | ! Moved tcm_check_data_output to module_interface |
---|
120 | ! |
---|
121 | ! 4039 2019-06-18 10:32:41Z suehring |
---|
122 | ! Modularize diagnostic output |
---|
123 | ! |
---|
124 | ! 4017 2019-06-06 12:16:46Z schwenkel |
---|
125 | ! output of turbulence intensity added |
---|
126 | ! |
---|
127 | ! 3933 2019-04-25 12:33:20Z kanani |
---|
128 | ! Alphabetical resorting in CASE, condense settings for theta_2m* into one IF clause |
---|
129 | ! |
---|
130 | ! 3885 2019-04-11 11:29:34Z kanani |
---|
131 | ! Changes related to global restructuring of location messages and introduction |
---|
132 | ! of additional debug messages |
---|
133 | ! |
---|
134 | ! 3766 2019-02-26 16:23:41Z raasch |
---|
135 | ! trim added to avoid truncation compiler warnings |
---|
136 | ! |
---|
137 | ! 3761 2019-02-25 15:31:42Z raasch |
---|
138 | ! unused variables removed |
---|
139 | ! |
---|
140 | ! 3735 2019-02-12 09:52:40Z dom_dwd_user |
---|
141 | ! Passing variable j (averaged output?) to |
---|
142 | ! module_interface.f90:chem_check_data_output. |
---|
143 | ! |
---|
144 | ! 3705 2019-01-29 19:56:39Z suehring |
---|
145 | ! bugfix: renamed thetav_t to vtheta_t |
---|
146 | ! |
---|
147 | ! 3702 2019-01-28 13:19:30Z gronemeier |
---|
148 | ! most_method removed |
---|
149 | ! |
---|
150 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
151 | ! Formatting |
---|
152 | ! |
---|
153 | ! Revision 1.1 1997/08/26 06:29:23 raasch |
---|
154 | ! Initial revision |
---|
155 | ! |
---|
156 | ! |
---|
157 | ! Description: |
---|
158 | ! ------------ |
---|
159 | !> Check control parameters and deduce further quantities. |
---|
160 | ! |
---|
161 | !> @todo Increase character length of unit and corresponding characters to LEN>=8 in order to allow |
---|
162 | !> units like degree_C (05.08.2020) |
---|
163 | !--------------------------------------------------------------------------------------------------! |
---|
164 | SUBROUTINE check_parameters |
---|
165 | |
---|
166 | |
---|
167 | USE arrays_3d |
---|
168 | |
---|
169 | USE basic_constants_and_equations_mod |
---|
170 | |
---|
171 | USE bulk_cloud_model_mod, & |
---|
172 | ONLY: bulk_cloud_model |
---|
173 | |
---|
174 | USE control_parameters |
---|
175 | |
---|
176 | USE grid_variables |
---|
177 | |
---|
178 | USE kinds |
---|
179 | |
---|
180 | USE indices |
---|
181 | |
---|
182 | USE model_1d_mod, & |
---|
183 | ONLY: damp_level_1d, damp_level_ind_1d |
---|
184 | |
---|
185 | USE module_interface, & |
---|
186 | ONLY: module_interface_check_data_output, & |
---|
187 | module_interface_check_data_output_pr, & |
---|
188 | module_interface_check_data_output_ts, & |
---|
189 | module_interface_check_parameters |
---|
190 | |
---|
191 | USE netcdf_data_input_mod, & |
---|
192 | ONLY: init_model, input_pids_static, netcdf_data_input_check_dynamic, & |
---|
193 | netcdf_data_input_check_static |
---|
194 | |
---|
195 | USE netcdf_interface, & |
---|
196 | ONLY: do2d_unit, do3d_unit, dopr_unit, dots_label, dots_max, dots_num, dots_unit, & |
---|
197 | heatflux_output_unit, momentumflux_output_unit, netcdf_data_format, & |
---|
198 | netcdf_data_format_string, waterflux_output_unit |
---|
199 | |
---|
200 | USE particle_attributes, & |
---|
201 | ONLY: particle_advection, use_sgs_for_particles |
---|
202 | |
---|
203 | USE pegrid |
---|
204 | |
---|
205 | USE pmc_interface, & |
---|
206 | ONLY: cpl_id, nested_run |
---|
207 | |
---|
208 | USE profil_parameter |
---|
209 | |
---|
210 | USE statistics |
---|
211 | |
---|
212 | USE subsidence_mod |
---|
213 | |
---|
214 | USE transpose_indices |
---|
215 | |
---|
216 | IMPLICIT NONE |
---|
217 | |
---|
218 | CHARACTER (LEN=varnamelength) :: var !< variable name |
---|
219 | CHARACTER (LEN=7) :: unit !< unit of variable |
---|
220 | CHARACTER (LEN=8) :: date !< current date string |
---|
221 | CHARACTER (LEN=10) :: time !< current time string |
---|
222 | CHARACTER (LEN=20) :: ensemble_string !< string containing number of ensemble member |
---|
223 | CHARACTER (LEN=15) :: nest_string !< string containing id of nested domain |
---|
224 | CHARACTER (LEN=40) :: coupling_string !< string containing type of coupling |
---|
225 | CHARACTER (LEN=100) :: action !< flag string |
---|
226 | |
---|
227 | CHARACTER (LEN=varnamelength), DIMENSION(:), ALLOCATABLE :: data_output_filtered !< filtered list of output variables |
---|
228 | |
---|
229 | INTEGER(iwp) :: i !< loop index |
---|
230 | INTEGER(iwp) :: ilen !< string length |
---|
231 | INTEGER(iwp) :: j !< loop index |
---|
232 | INTEGER(iwp) :: k !< loop index |
---|
233 | INTEGER(iwp) :: kk !< loop index |
---|
234 | INTEGER(iwp) :: mid !< masked output running index |
---|
235 | INTEGER(iwp) :: netcdf_data_format_save !< initial value of netcdf_data_format |
---|
236 | INTEGER(iwp) :: position !< index position of string |
---|
237 | |
---|
238 | LOGICAL :: found !< flag, true if output variable is already marked for averaging |
---|
239 | |
---|
240 | REAL(wp) :: gradient !< local gradient |
---|
241 | #if defined( __parallel ) |
---|
242 | REAL(wp) :: dt_spinup_max !< maximum spinup timestep in nested domains |
---|
243 | REAL(wp) :: remote = 0.0_wp !< MPI id of remote processor |
---|
244 | REAL(wp) :: spinup_time_max !< maximum spinup time in nested domains |
---|
245 | REAL(wp) :: time_to_be_simulated_from_reference_point !< time to be simulated from reference point |
---|
246 | #endif |
---|
247 | |
---|
248 | |
---|
249 | CALL location_message( 'checking parameters', 'start' ) |
---|
250 | ! |
---|
251 | !-- At first, check static and dynamic input for consistency. |
---|
252 | CALL netcdf_data_input_check_dynamic |
---|
253 | CALL netcdf_data_input_check_static |
---|
254 | ! |
---|
255 | !-- Check for overlap combinations, which are not realized yet |
---|
256 | IF ( transpose_compute_overlap .AND. numprocs == 1 ) THEN |
---|
257 | message_string = 'transpose-compute-overlap not implemented for single PE runs' |
---|
258 | CALL message( 'check_parameters', 'PA0000', 1, 2, 0, 6, 0 ) |
---|
259 | ENDIF |
---|
260 | |
---|
261 | ! |
---|
262 | !-- Check the coupling mode |
---|
263 | IF ( coupling_mode /= 'uncoupled' .AND. & |
---|
264 | coupling_mode /= 'precursor_atmos' .AND. & |
---|
265 | coupling_mode /= 'precursor_ocean' .AND. & |
---|
266 | coupling_mode /= 'atmosphere_to_ocean' .AND. & |
---|
267 | coupling_mode /= 'ocean_to_atmosphere' ) THEN |
---|
268 | message_string = 'illegal coupling mode: ' // TRIM( coupling_mode ) |
---|
269 | CALL message( 'check_parameters', 'PA0002', 1, 2, 0, 6, 0 ) |
---|
270 | ENDIF |
---|
271 | |
---|
272 | ! |
---|
273 | !-- Check if humidity is set to .TRUE. in case of the atmospheric run (for coupled runs) |
---|
274 | IF ( coupling_mode == 'atmosphere_to_ocean' .AND. .NOT. humidity) THEN |
---|
275 | message_string = ' Humidity has to be set to .T. in the _p3d file ' // & |
---|
276 | 'for coupled runs between ocean and atmosphere.' |
---|
277 | CALL message( 'check_parameters', 'PA0476', 1, 2, 0, 6, 0 ) |
---|
278 | ENDIF |
---|
279 | |
---|
280 | ! |
---|
281 | !-- Check and set the restart data format variables |
---|
282 | IF ( TRIM( restart_data_format ) /= 'fortran_binary' .AND. & |
---|
283 | TRIM( restart_data_format ) /= 'mpi' .AND. & |
---|
284 | TRIM( restart_data_format ) /= 'mpi_shared_memory' ) THEN |
---|
285 | message_string = 'illegal restart data format "' // TRIM( restart_data_format ) // '"' |
---|
286 | CALL message( 'check_parameters', 'PA0724', 1, 2, 0, 6, 0 ) |
---|
287 | ENDIF |
---|
288 | |
---|
289 | IF ( TRIM( restart_data_format_input ) == 'undefined' ) THEN |
---|
290 | restart_data_format_input = restart_data_format |
---|
291 | ENDIF |
---|
292 | IF ( TRIM( restart_data_format_output ) == 'undefined' ) THEN |
---|
293 | restart_data_format_output = restart_data_format |
---|
294 | ENDIF |
---|
295 | |
---|
296 | IF ( TRIM( restart_data_format_input ) /= 'fortran_binary' .AND. & |
---|
297 | TRIM( restart_data_format_input ) /= 'mpi' .AND. & |
---|
298 | TRIM( restart_data_format_input ) /= 'mpi_shared_memory' ) THEN |
---|
299 | message_string = 'illegal restart input data format "' // & |
---|
300 | TRIM( restart_data_format_input ) // '"' |
---|
301 | CALL message( 'check_parameters', 'PA0725', 1, 2, 0, 6, 0 ) |
---|
302 | ENDIF |
---|
303 | IF ( TRIM( restart_data_format_output ) /= 'fortran_binary' .AND. & |
---|
304 | TRIM( restart_data_format_output ) /= 'mpi' .AND. & |
---|
305 | TRIM( restart_data_format_output ) /= 'mpi_shared_memory' ) THEN |
---|
306 | message_string = 'illegal restart output data format "' // & |
---|
307 | TRIM( restart_data_format_output ) // '"' |
---|
308 | CALL message( 'check_parameters', 'PA0726', 1, 2, 0, 6, 0 ) |
---|
309 | ENDIF |
---|
310 | |
---|
311 | ! |
---|
312 | !-- Set flag for including total domain boundaries in the restart data (MPI-IO) in case of |
---|
313 | !-- non-cyclic boundary conditions |
---|
314 | include_total_domain_boundaries = .NOT. ( bc_lr_cyc .AND. bc_ns_cyc ) |
---|
315 | |
---|
316 | ! |
---|
317 | !-- Check dt_coupling, restart_time, dt_restart, end_time, dx, dy, nx and ny |
---|
318 | IF ( coupling_mode /= 'uncoupled' .AND. & |
---|
319 | coupling_mode /= 'precursor_atmos' .AND. & |
---|
320 | coupling_mode /= 'precursor_ocean' ) THEN |
---|
321 | |
---|
322 | IF ( dt_coupling == 9999999.9_wp ) THEN |
---|
323 | message_string = 'dt_coupling is not set but required for coupling mode "' // & |
---|
324 | TRIM( coupling_mode ) // '"' |
---|
325 | CALL message( 'check_parameters', 'PA0003', 1, 2, 0, 6, 0 ) |
---|
326 | ENDIF |
---|
327 | |
---|
328 | #if defined( __parallel ) |
---|
329 | |
---|
330 | |
---|
331 | IF ( myid == 0 ) THEN |
---|
332 | CALL MPI_SEND( dt_coupling, 1, MPI_REAL, target_id, 11, comm_inter, ierr ) |
---|
333 | CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 11, comm_inter, status, ierr ) |
---|
334 | ENDIF |
---|
335 | CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr) |
---|
336 | |
---|
337 | IF ( dt_coupling /= remote ) THEN |
---|
338 | WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), '": dt_coupling = ',& |
---|
339 | dt_coupling, '& is not equal to ', 'dt_coupling_remote = ', remote |
---|
340 | CALL message( 'check_parameters', 'PA0004', 1, 2, 0, 6, 0 ) |
---|
341 | ENDIF |
---|
342 | IF ( dt_coupling <= 0.0_wp ) THEN |
---|
343 | |
---|
344 | IF ( myid == 0 ) THEN |
---|
345 | CALL MPI_SEND( dt_max, 1, MPI_REAL, target_id, 19, comm_inter, ierr ) |
---|
346 | CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 19, comm_inter, status, ierr ) |
---|
347 | ENDIF |
---|
348 | CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr) |
---|
349 | |
---|
350 | dt_coupling = MAX( dt_max, remote ) |
---|
351 | WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & |
---|
352 | '": dt_coupling <= 0.0 & is not allowed and is reset to ', 'MAX(dt_max(A,O)) = ', & |
---|
353 | dt_coupling |
---|
354 | CALL message( 'check_parameters', 'PA0005', 0, 1, 0, 6, 0 ) |
---|
355 | ENDIF |
---|
356 | |
---|
357 | IF ( myid == 0 ) THEN |
---|
358 | CALL MPI_SEND( restart_time, 1, MPI_REAL, target_id, 12, comm_inter, ierr ) |
---|
359 | CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 12, comm_inter, status, ierr ) |
---|
360 | ENDIF |
---|
361 | CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr) |
---|
362 | |
---|
363 | IF ( restart_time /= remote ) THEN |
---|
364 | WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & |
---|
365 | '": restart_time = ', restart_time, '& is not equal to ', & |
---|
366 | 'restart_time_remote = ', remote |
---|
367 | CALL message( 'check_parameters', 'PA0006', 1, 2, 0, 6, 0 ) |
---|
368 | ENDIF |
---|
369 | |
---|
370 | IF ( myid == 0 ) THEN |
---|
371 | CALL MPI_SEND( dt_restart, 1, MPI_REAL, target_id, 13, comm_inter, ierr ) |
---|
372 | CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 13, comm_inter, status, ierr ) |
---|
373 | ENDIF |
---|
374 | CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr) |
---|
375 | |
---|
376 | IF ( dt_restart /= remote ) THEN |
---|
377 | WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), '": dt_restart = ', & |
---|
378 | dt_restart, '& is not equal to ', 'dt_restart_remote = ', remote |
---|
379 | CALL message( 'check_parameters', 'PA0007', 1, 2, 0, 6, 0 ) |
---|
380 | ENDIF |
---|
381 | |
---|
382 | time_to_be_simulated_from_reference_point = end_time-coupling_start_time |
---|
383 | |
---|
384 | IF ( myid == 0 ) THEN |
---|
385 | CALL MPI_SEND( time_to_be_simulated_from_reference_point, 1, MPI_REAL, target_id, 14, & |
---|
386 | comm_inter, ierr ) |
---|
387 | CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 14, comm_inter, status, ierr ) |
---|
388 | ENDIF |
---|
389 | CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr) |
---|
390 | |
---|
391 | IF ( time_to_be_simulated_from_reference_point /= remote ) THEN |
---|
392 | WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & |
---|
393 | '": time_to_be_simulated_from_reference_point = ', & |
---|
394 | time_to_be_simulated_from_reference_point, '& is not equal ', & |
---|
395 | 'to time_to_be_simulated_from_reference_point_remote = ', & |
---|
396 | remote |
---|
397 | CALL message( 'check_parameters', 'PA0008', 1, 2, 0, 6, 0 ) |
---|
398 | ENDIF |
---|
399 | |
---|
400 | IF ( myid == 0 ) THEN |
---|
401 | CALL MPI_SEND( dx, 1, MPI_REAL, target_id, 15, comm_inter, ierr ) |
---|
402 | CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 15, comm_inter, status, ierr ) |
---|
403 | ENDIF |
---|
404 | CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr) |
---|
405 | |
---|
406 | |
---|
407 | IF ( coupling_mode == 'atmosphere_to_ocean') THEN |
---|
408 | |
---|
409 | IF ( dx < remote ) THEN |
---|
410 | WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & |
---|
411 | '": dx in Atmosphere is not equal to or not larger than dx in ocean' |
---|
412 | CALL message( 'check_parameters', 'PA0009', 1, 2, 0, 6, 0 ) |
---|
413 | ENDIF |
---|
414 | |
---|
415 | IF ( (nx_a+1)*dx /= (nx_o+1)*remote ) THEN |
---|
416 | WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & |
---|
417 | '": Domain size in x-direction is not equal in ocean and atmosphere' |
---|
418 | CALL message( 'check_parameters', 'PA0010', 1, 2, 0, 6, 0 ) |
---|
419 | ENDIF |
---|
420 | |
---|
421 | ENDIF |
---|
422 | |
---|
423 | IF ( myid == 0) THEN |
---|
424 | CALL MPI_SEND( dy, 1, MPI_REAL, target_id, 16, comm_inter, ierr ) |
---|
425 | CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 16, comm_inter, status, ierr ) |
---|
426 | ENDIF |
---|
427 | CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr) |
---|
428 | |
---|
429 | IF ( coupling_mode == 'atmosphere_to_ocean') THEN |
---|
430 | |
---|
431 | IF ( dy < remote ) THEN |
---|
432 | WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & |
---|
433 | '": dy in Atmosphere is not equal to or not larger than dy in ocean' |
---|
434 | CALL message( 'check_parameters', 'PA0011', 1, 2, 0, 6, 0 ) |
---|
435 | ENDIF |
---|
436 | |
---|
437 | IF ( (ny_a+1)*dy /= (ny_o+1)*remote ) THEN |
---|
438 | WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & |
---|
439 | '": Domain size in y-direction is not equal in ocean and atmosphere' |
---|
440 | CALL message( 'check_parameters', 'PA0012', 1, 2, 0, 6, 0 ) |
---|
441 | ENDIF |
---|
442 | |
---|
443 | IF ( MOD( nx_o+1, nx_a+1 ) /= 0 ) THEN |
---|
444 | WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & |
---|
445 | '": nx+1 in ocean is not divisible by nx+1 in', ' atmosphere without remainder' |
---|
446 | CALL message( 'check_parameters', 'PA0339', 1, 2, 0, 6, 0 ) |
---|
447 | ENDIF |
---|
448 | |
---|
449 | IF ( MOD(ny_o+1,ny_a+1) /= 0 ) THEN |
---|
450 | WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & |
---|
451 | '": ny+1 in ocean is not divisible by ny+1 in', ' atmosphere without remainder' |
---|
452 | |
---|
453 | CALL message( 'check_parameters', 'PA0340', 1, 2, 0, 6, 0 ) |
---|
454 | ENDIF |
---|
455 | |
---|
456 | ENDIF |
---|
457 | #else |
---|
458 | WRITE( message_string, * ) 'coupling requires PALM to be compiled with', & |
---|
459 | ' cpp-option "-D__parallel"' |
---|
460 | CALL message( 'check_parameters', 'PA0141', 1, 2, 0, 6, 0 ) |
---|
461 | #endif |
---|
462 | ENDIF |
---|
463 | |
---|
464 | #if defined( __parallel ) |
---|
465 | ! |
---|
466 | !-- Exchange via intercommunicator |
---|
467 | IF ( coupling_mode == 'atmosphere_to_ocean' .AND. myid == 0 ) THEN |
---|
468 | CALL MPI_SEND( humidity, 1, MPI_LOGICAL, target_id, 19, comm_inter, ierr ) |
---|
469 | ELSEIF ( coupling_mode == 'ocean_to_atmosphere' .AND. myid == 0) THEN |
---|
470 | CALL MPI_RECV( humidity_remote, 1, MPI_LOGICAL, target_id, 19, comm_inter, status, ierr ) |
---|
471 | ENDIF |
---|
472 | CALL MPI_BCAST( humidity_remote, 1, MPI_LOGICAL, 0, comm2d, ierr) |
---|
473 | |
---|
474 | #endif |
---|
475 | |
---|
476 | ! |
---|
477 | !-- User settings for restart times requires that "restart" has been given as file activation |
---|
478 | !-- string. Otherwise, binary output would not be saved by palmrun. |
---|
479 | IF ( ( restart_time /= 9999999.9_wp .OR. dt_restart /= 9999999.9_wp ) & |
---|
480 | .AND. .NOT. write_binary ) THEN |
---|
481 | WRITE( message_string, * ) 'manual restart settings requires file ', & |
---|
482 | 'activation string "restart"' |
---|
483 | CALL message( 'check_parameters', 'PA0001', 1, 2, 0, 6, 0 ) |
---|
484 | ENDIF |
---|
485 | |
---|
486 | |
---|
487 | ! |
---|
488 | !-- Generate the file header which is used as a header for most of PALM's output files |
---|
489 | CALL DATE_AND_TIME( date, time, run_zone ) |
---|
490 | run_date = date(1:4) // '-' // date(5:6) // '-' // date(7:8) |
---|
491 | run_time = time(1:2) // ':' // time(3:4) // ':' // time(5:6) |
---|
492 | IF ( coupling_mode == 'uncoupled' ) THEN |
---|
493 | coupling_string = '' |
---|
494 | ELSEIF ( coupling_mode == 'atmosphere_to_ocean' ) THEN |
---|
495 | coupling_string = ' coupled (atmosphere)' |
---|
496 | ELSEIF ( coupling_mode == 'ocean_to_atmosphere' ) THEN |
---|
497 | coupling_string = ' coupled (ocean)' |
---|
498 | ENDIF |
---|
499 | IF ( ensemble_member_nr /= 0 ) THEN |
---|
500 | WRITE( ensemble_string, '(2X,A,I2.2)' ) 'en-no: ', ensemble_member_nr |
---|
501 | ELSE |
---|
502 | ensemble_string = '' |
---|
503 | ENDIF |
---|
504 | IF ( nested_run ) THEN |
---|
505 | WRITE( nest_string, '(2X,A,I2.2)' ) 'nest-id: ', cpl_id |
---|
506 | ELSE |
---|
507 | nest_string = '' |
---|
508 | ENDIF |
---|
509 | |
---|
510 | WRITE ( run_description_header, '(A,2X,A,2X,A,A,A,I2.2,A,A,A,2X,A,A,2X,A,1X,A)' ) & |
---|
511 | TRIM( version ), TRIM( revision ), 'run: ', TRIM( run_identifier ), '.', runnr, & |
---|
512 | TRIM( coupling_string ), TRIM( nest_string ), TRIM( ensemble_string), 'host: ', & |
---|
513 | TRIM( host ), run_date, run_time |
---|
514 | |
---|
515 | ! |
---|
516 | !-- Check the general loop optimization method |
---|
517 | SELECT CASE ( TRIM( loop_optimization ) ) |
---|
518 | |
---|
519 | CASE ( 'cache', 'vector' ) |
---|
520 | CONTINUE |
---|
521 | |
---|
522 | CASE DEFAULT |
---|
523 | message_string = 'illegal value given for loop_optimization: "' // & |
---|
524 | TRIM( loop_optimization ) // '"' |
---|
525 | CALL message( 'check_parameters', 'PA0013', 1, 2, 0, 6, 0 ) |
---|
526 | |
---|
527 | END SELECT |
---|
528 | |
---|
529 | ! |
---|
530 | !-- Check topography setting (check for illegal parameter combinations) |
---|
531 | IF ( topography /= 'flat' ) THEN |
---|
532 | action = ' ' |
---|
533 | IF ( scalar_advec /= 'pw-scheme' .AND. scalar_advec /= 'ws-scheme' ) THEN |
---|
534 | WRITE( action, '(A,A)' ) 'scalar_advec = ', scalar_advec |
---|
535 | ENDIF |
---|
536 | IF ( momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ws-scheme' ) THEN |
---|
537 | WRITE( action, '(A,A)' ) 'momentum_advec = ', momentum_advec |
---|
538 | ENDIF |
---|
539 | IF ( psolver == 'sor' ) THEN |
---|
540 | WRITE( action, '(A,A)' ) 'psolver = ', psolver |
---|
541 | ENDIF |
---|
542 | IF ( sloping_surface ) THEN |
---|
543 | WRITE( action, '(A)' ) 'sloping surface = .TRUE.' |
---|
544 | ENDIF |
---|
545 | IF ( galilei_transformation ) THEN |
---|
546 | WRITE( action, '(A)' ) 'galilei_transformation = .TRUE.' |
---|
547 | ENDIF |
---|
548 | IF ( cloud_droplets ) THEN |
---|
549 | WRITE( action, '(A)' ) 'cloud_droplets = .TRUE.' |
---|
550 | ENDIF |
---|
551 | IF ( .NOT. constant_flux_layer .AND. topography /= 'closed_channel' ) THEN |
---|
552 | WRITE( action, '(A)' ) 'constant_flux_layer = .FALSE.' |
---|
553 | ENDIF |
---|
554 | IF ( action /= ' ' ) THEN |
---|
555 | message_string = 'The specified topography does not allow ' // TRIM( action ) |
---|
556 | CALL message( 'check_parameters', 'PA0014', 1, 2, 0, 6, 0 ) |
---|
557 | ENDIF |
---|
558 | ! |
---|
559 | !-- Check illegal/untested parameter combinations for closed channel |
---|
560 | If ( topography == 'closed_channel' ) THEN |
---|
561 | symmetry_flag = 1 |
---|
562 | message_string = 'Bottom and top boundary are treated equal' |
---|
563 | CALL message( 'check_parameters', 'PA0699', 0, 0, 0, 6, 0 ) |
---|
564 | |
---|
565 | IF ( dz(1) /= dz(COUNT( dz /= -1.0_wp )) .OR. dz_stretch_level /= -9999999.9_wp) THEN |
---|
566 | WRITE( message_string, * ) 'dz should be equal close to the ' // & |
---|
567 | 'boundaries due to symmetrical problem' |
---|
568 | CALL message( 'check_parameters', 'PA0700', 1, 2, 0, 6, 0 ) |
---|
569 | ENDIF |
---|
570 | |
---|
571 | IF ( constant_flux_layer ) THEN |
---|
572 | WRITE( message_string, * ) 'A constant flux layer is not ' // & |
---|
573 | 'allowed if a closed channel shall be used' |
---|
574 | CALL message( 'check_parameters', 'PA0701', 1, 2, 0, 6, 0 ) |
---|
575 | ENDIF |
---|
576 | |
---|
577 | IF ( ocean_mode ) THEN |
---|
578 | WRITE( message_string, * ) 'The ocean mode is not allowed if ' // & |
---|
579 | 'a closed channel shall be used' |
---|
580 | CALL message( 'check_parameters', 'PA0702', 1, 2, 0, 6, 0 ) |
---|
581 | ENDIF |
---|
582 | |
---|
583 | IF ( momentum_advec /= 'ws-scheme' .OR. & |
---|
584 | scalar_advec /= 'ws-scheme' ) THEN |
---|
585 | WRITE( message_string, * ) 'A closed channel require the upwind scheme of Wicker' // & |
---|
586 | ' and Skamarock as the advection scheme' |
---|
587 | CALL message( 'check_parameters', 'PA0703', 1, 2, 0, 6, 0 ) |
---|
588 | ENDIF |
---|
589 | ENDIF |
---|
590 | ENDIF |
---|
591 | |
---|
592 | ! |
---|
593 | !-- Check approximation |
---|
594 | IF ( TRIM( approximation ) /= 'boussinesq' .AND. TRIM( approximation ) /= 'anelastic' ) THEN |
---|
595 | message_string = 'unknown approximation: approximation = "' // TRIM( approximation ) // '"' |
---|
596 | CALL message( 'check_parameters', 'PA0446', 1, 2, 0, 6, 0 ) |
---|
597 | ENDIF |
---|
598 | |
---|
599 | ! |
---|
600 | !-- Check approximation requirements |
---|
601 | IF ( TRIM( approximation ) == 'anelastic' .AND. TRIM( momentum_advec ) /= 'ws-scheme' ) THEN |
---|
602 | message_string = 'Anelastic approximation requires momentum_advec = "ws-scheme"' |
---|
603 | CALL message( 'check_parameters', 'PA0447', 1, 2, 0, 6, 0 ) |
---|
604 | ENDIF |
---|
605 | IF ( TRIM( approximation ) == 'anelastic' .AND. TRIM( psolver ) == 'multigrid' ) THEN |
---|
606 | message_string = 'Anelastic approximation currently only supports psolver = "poisfft", ' // & |
---|
607 | 'psolver = "sor" and psolver = "multigrid_noopt"' |
---|
608 | CALL message( 'check_parameters', 'PA0448', 1, 2, 0, 6, 0 ) |
---|
609 | ENDIF |
---|
610 | IF ( TRIM( approximation ) == 'anelastic' .AND. conserve_volume_flow ) THEN |
---|
611 | message_string = 'Anelastic approximation is not allowed with ' // & |
---|
612 | 'conserve_volume_flow = .TRUE.' |
---|
613 | CALL message( 'check_parameters', 'PA0449', 1, 2, 0, 6, 0 ) |
---|
614 | ENDIF |
---|
615 | |
---|
616 | ! |
---|
617 | !-- Check flux input mode |
---|
618 | IF ( TRIM( flux_input_mode ) /= 'dynamic' .AND. TRIM( flux_input_mode ) /= 'kinematic' & |
---|
619 | .AND. TRIM( flux_input_mode ) /= 'approximation-specific' ) THEN |
---|
620 | message_string = 'unknown flux input mode: flux_input_mode = "' // & |
---|
621 | TRIM( flux_input_mode ) // '"' |
---|
622 | CALL message( 'check_parameters', 'PA0450', 1, 2, 0, 6, 0 ) |
---|
623 | ENDIF |
---|
624 | ! |
---|
625 | !-- Set flux input mode according to approximation if applicable |
---|
626 | IF ( TRIM( flux_input_mode ) == 'approximation-specific' ) THEN |
---|
627 | IF ( TRIM( approximation ) == 'anelastic' ) THEN |
---|
628 | flux_input_mode = 'dynamic' |
---|
629 | ELSEIF ( TRIM( approximation ) == 'boussinesq' ) THEN |
---|
630 | flux_input_mode = 'kinematic' |
---|
631 | ENDIF |
---|
632 | ENDIF |
---|
633 | |
---|
634 | ! |
---|
635 | !-- Check flux output mode |
---|
636 | IF ( TRIM( flux_output_mode ) /= 'dynamic' .AND. TRIM( flux_output_mode ) /= 'kinematic' & |
---|
637 | .AND. TRIM( flux_output_mode ) /= 'approximation-specific' ) THEN |
---|
638 | message_string = 'unknown flux output mode: flux_output_mode = "' // & |
---|
639 | TRIM( flux_output_mode ) // '"' |
---|
640 | CALL message( 'check_parameters', 'PA0451', 1, 2, 0, 6, 0 ) |
---|
641 | ENDIF |
---|
642 | ! |
---|
643 | !-- Set flux output mode according to approximation if applicable |
---|
644 | IF ( TRIM( flux_output_mode ) == 'approximation-specific' ) THEN |
---|
645 | IF ( TRIM( approximation ) == 'anelastic' ) THEN |
---|
646 | flux_output_mode = 'dynamic' |
---|
647 | ELSEIF ( TRIM( approximation ) == 'boussinesq' ) THEN |
---|
648 | flux_output_mode = 'kinematic' |
---|
649 | ENDIF |
---|
650 | ENDIF |
---|
651 | |
---|
652 | |
---|
653 | ! |
---|
654 | !-- When the land- or urban-surface model is used, the flux output must be dynamic. |
---|
655 | IF ( land_surface .OR. urban_surface ) THEN |
---|
656 | flux_output_mode = 'dynamic' |
---|
657 | ENDIF |
---|
658 | |
---|
659 | ! |
---|
660 | !-- Set the flux output units according to flux_output_mode |
---|
661 | IF ( TRIM( flux_output_mode ) == 'kinematic' ) THEN |
---|
662 | heatflux_output_unit = 'K m/s' |
---|
663 | waterflux_output_unit = 'kg/kg m/s' |
---|
664 | momentumflux_output_unit = 'm2/s2' |
---|
665 | ELSEIF ( TRIM( flux_output_mode ) == 'dynamic' ) THEN |
---|
666 | heatflux_output_unit = 'W/m2' |
---|
667 | waterflux_output_unit = 'W/m2' |
---|
668 | momentumflux_output_unit = 'N/m2' |
---|
669 | ENDIF |
---|
670 | |
---|
671 | ! |
---|
672 | !-- set time series output units for fluxes |
---|
673 | dots_unit(14:16) = TRIM( heatflux_output_unit ) |
---|
674 | dots_unit(21) = TRIM( waterflux_output_unit ) |
---|
675 | dots_unit(19:20) = TRIM( momentumflux_output_unit ) |
---|
676 | |
---|
677 | ! |
---|
678 | !-- Add other module specific timeseries |
---|
679 | CALL module_interface_check_data_output_ts( dots_max, dots_num, dots_label, dots_unit ) |
---|
680 | |
---|
681 | ! |
---|
682 | !-- Check if maximum number of allowed timeseries is exceeded |
---|
683 | IF ( dots_num > dots_max ) THEN |
---|
684 | WRITE( message_string, * ) 'number of time series quantities exceeds', & |
---|
685 | ' its maximum of dots_max = ', dots_max, & |
---|
686 | '&Please increase dots_max in netcdf_interface_mod.f90.' |
---|
687 | CALL message( 'check_parameters', 'PA0194', 1, 2, 0, 6, 0 ) |
---|
688 | ENDIF |
---|
689 | |
---|
690 | ! |
---|
691 | !-- Check whether there are any illegal values |
---|
692 | !-- Pressure solver: |
---|
693 | IF ( psolver /= 'poisfft' .AND. psolver /= 'sor' .AND. psolver /= 'multigrid' .AND. & |
---|
694 | psolver /= 'multigrid_noopt' ) THEN |
---|
695 | message_string = 'unknown solver for perturbation pressure: psolver' // & |
---|
696 | ' = "' // TRIM( psolver ) // '"' |
---|
697 | CALL message( 'check_parameters', 'PA0016', 1, 2, 0, 6, 0 ) |
---|
698 | ENDIF |
---|
699 | |
---|
700 | IF ( psolver(1:9) == 'multigrid' ) THEN |
---|
701 | IF ( cycle_mg == 'w' ) THEN |
---|
702 | gamma_mg = 2 |
---|
703 | ELSEIF ( cycle_mg == 'v' ) THEN |
---|
704 | gamma_mg = 1 |
---|
705 | ELSE |
---|
706 | message_string = 'unknown multigrid cycle: cycle_mg = "' // TRIM( cycle_mg ) // '"' |
---|
707 | CALL message( 'check_parameters', 'PA0020', 1, 2, 0, 6, 0 ) |
---|
708 | ENDIF |
---|
709 | ENDIF |
---|
710 | |
---|
711 | IF ( fft_method /= 'singleton-algorithm' .AND. fft_method /= 'temperton-algorithm' .AND. & |
---|
712 | fft_method /= 'fftw' .AND. fft_method /= 'system-specific' ) THEN |
---|
713 | message_string = 'unknown fft-algorithm: fft_method = "' // TRIM( fft_method ) // '"' |
---|
714 | CALL message( 'check_parameters', 'PA0021', 1, 2, 0, 6, 0 ) |
---|
715 | ENDIF |
---|
716 | |
---|
717 | IF( momentum_advec == 'ws-scheme' .AND. .NOT. call_psolver_at_all_substeps ) THEN |
---|
718 | message_string = 'psolver must be called at each RK3 substep when "'// & |
---|
719 | TRIM(momentum_advec) // ' "is used for momentum_advec' |
---|
720 | CALL message( 'check_parameters', 'PA0344', 1, 2, 0, 6, 0 ) |
---|
721 | END IF |
---|
722 | ! |
---|
723 | !-- Advection schemes: |
---|
724 | IF ( momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ws-scheme' .AND. & |
---|
725 | momentum_advec /= 'up-scheme' ) THEN |
---|
726 | message_string = 'unknown advection scheme: momentum_advec = "' // & |
---|
727 | TRIM( momentum_advec ) // '"' |
---|
728 | CALL message( 'check_parameters', 'PA0022', 1, 2, 0, 6, 0 ) |
---|
729 | ENDIF |
---|
730 | IF ( ( momentum_advec == 'ws-scheme' .OR. scalar_advec == 'ws-scheme' ) & |
---|
731 | .AND. ( timestep_scheme == 'euler' .OR. timestep_scheme == 'runge-kutta-2' ) ) THEN |
---|
732 | message_string = 'momentum_advec or scalar_advec = "' // TRIM( momentum_advec ) // & |
---|
733 | '" is not allowed with timestep_scheme = "' // & |
---|
734 | TRIM( timestep_scheme ) // '"' |
---|
735 | CALL message( 'check_parameters', 'PA0023', 1, 2, 0, 6, 0 ) |
---|
736 | ENDIF |
---|
737 | IF ( scalar_advec /= 'pw-scheme' .AND. scalar_advec /= 'ws-scheme' .AND. & |
---|
738 | scalar_advec /= 'bc-scheme' .AND. scalar_advec /= 'up-scheme' ) THEN |
---|
739 | message_string = 'unknown advection scheme: scalar_advec = "' // TRIM( scalar_advec ) // '"' |
---|
740 | CALL message( 'check_parameters', 'PA0024', 1, 2, 0, 6, 0 ) |
---|
741 | ENDIF |
---|
742 | IF ( scalar_advec == 'bc-scheme' .AND. loop_optimization == 'cache' ) THEN |
---|
743 | message_string = 'advection_scheme scalar_advec = "' // TRIM( scalar_advec ) // & |
---|
744 | '" not implemented for loop_optimization = "' // & |
---|
745 | TRIM( loop_optimization ) // '"' |
---|
746 | CALL message( 'check_parameters', 'PA0026', 1, 2, 0, 6, 0 ) |
---|
747 | ENDIF |
---|
748 | |
---|
749 | IF ( use_sgs_for_particles .AND. .NOT. cloud_droplets .AND. .NOT. use_upstream_for_tke & |
---|
750 | .AND. scalar_advec /= 'ws-scheme' ) THEN |
---|
751 | use_upstream_for_tke = .TRUE. |
---|
752 | message_string = 'use_upstream_for_tke is set to .TRUE. because ' // & |
---|
753 | 'use_sgs_for_particles = .TRUE. and scalar_advec /= ws-scheme' |
---|
754 | CALL message( 'check_parameters', 'PA0025', 0, 1, 0, 6, 0 ) |
---|
755 | ENDIF |
---|
756 | |
---|
757 | ! |
---|
758 | !-- Set LOGICAL switches to enhance performance |
---|
759 | IF ( momentum_advec == 'ws-scheme' ) ws_scheme_mom = .TRUE. |
---|
760 | IF ( scalar_advec == 'ws-scheme' ) ws_scheme_sca = .TRUE. |
---|
761 | |
---|
762 | |
---|
763 | ! |
---|
764 | !-- Timestep schemes: |
---|
765 | SELECT CASE ( TRIM( timestep_scheme ) ) |
---|
766 | |
---|
767 | CASE ( 'euler' ) |
---|
768 | intermediate_timestep_count_max = 1 |
---|
769 | |
---|
770 | CASE ( 'runge-kutta-2' ) |
---|
771 | intermediate_timestep_count_max = 2 |
---|
772 | |
---|
773 | CASE ( 'runge-kutta-3' ) |
---|
774 | intermediate_timestep_count_max = 3 |
---|
775 | |
---|
776 | CASE DEFAULT |
---|
777 | message_string = 'unknown timestep scheme: timestep_scheme = "' // & |
---|
778 | TRIM( timestep_scheme ) // '"' |
---|
779 | CALL message( 'check_parameters', 'PA0027', 1, 2, 0, 6, 0 ) |
---|
780 | |
---|
781 | END SELECT |
---|
782 | |
---|
783 | IF ( ( momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ws-scheme' ) & |
---|
784 | .AND. timestep_scheme(1:5) == 'runge' ) THEN |
---|
785 | message_string = 'momentum advection scheme "' // TRIM( momentum_advec ) // & |
---|
786 | '" & does not work with timestep_scheme "' // TRIM( timestep_scheme ) & |
---|
787 | // '"' |
---|
788 | CALL message( 'check_parameters', 'PA0029', 1, 2, 0, 6, 0 ) |
---|
789 | ENDIF |
---|
790 | ! |
---|
791 | !-- Check for proper settings for microphysics |
---|
792 | IF ( bulk_cloud_model .AND. cloud_droplets ) THEN |
---|
793 | message_string = 'bulk_cloud_model = .TRUE. is not allowed with cloud_droplets = .TRUE.' |
---|
794 | CALL message( 'check_parameters', 'PA0442', 1, 2, 0, 6, 0 ) |
---|
795 | ENDIF |
---|
796 | |
---|
797 | ! |
---|
798 | !-- Initializing actions must have been set by the user |
---|
799 | IF ( TRIM( initializing_actions ) == '' ) THEN |
---|
800 | message_string = 'no value specified for initializing_actions' |
---|
801 | CALL message( 'check_parameters', 'PA0149', 1, 2, 0, 6, 0 ) |
---|
802 | ENDIF |
---|
803 | |
---|
804 | IF ( TRIM( initializing_actions ) /= 'read_restart_data' .AND. & |
---|
805 | TRIM( initializing_actions ) /= 'cyclic_fill' ) THEN |
---|
806 | ! |
---|
807 | !-- No restart run: several initialising actions are possible |
---|
808 | action = initializing_actions |
---|
809 | DO WHILE ( TRIM( action ) /= '' ) |
---|
810 | position = INDEX( action, ' ' ) |
---|
811 | SELECT CASE ( action(1:position-1) ) |
---|
812 | |
---|
813 | CASE ( 'set_constant_profiles', 'set_1d-model_profiles', 'by_user', & |
---|
814 | 'initialize_vortex', 'initialize_ptanom', 'initialize_bubble', 'inifor' ) |
---|
815 | action = action(position+1:) |
---|
816 | |
---|
817 | CASE DEFAULT |
---|
818 | message_string = 'initializing_action = "' // & |
---|
819 | TRIM( action ) // '" unknown or not allowed' |
---|
820 | CALL message( 'check_parameters', 'PA0030', 1, 2, 0, 6, 0 ) |
---|
821 | |
---|
822 | END SELECT |
---|
823 | ENDDO |
---|
824 | ENDIF |
---|
825 | |
---|
826 | IF ( TRIM( initializing_actions ) == 'initialize_vortex' .AND. conserve_volume_flow ) THEN |
---|
827 | message_string = 'initializing_actions = "initialize_vortex"' // & |
---|
828 | ' is not allowed with conserve_volume_flow = .T.' |
---|
829 | CALL message( 'check_parameters', 'PA0343', 1, 2, 0, 6, 0 ) |
---|
830 | ENDIF |
---|
831 | |
---|
832 | |
---|
833 | IF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0 .AND. & |
---|
834 | INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) THEN |
---|
835 | message_string = 'initializing_actions = "set_constant_profiles"' // & |
---|
836 | ' and "set_1d-model_profiles" are not allowed simultaneously' |
---|
837 | CALL message( 'check_parameters', 'PA0031', 1, 2, 0, 6, 0 ) |
---|
838 | ENDIF |
---|
839 | |
---|
840 | IF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0 .AND. & |
---|
841 | INDEX( initializing_actions, 'by_user' ) /= 0 ) THEN |
---|
842 | message_string = 'initializing_actions = "set_constant_profiles"' // & |
---|
843 | ' and "by_user" are not allowed simultaneously' |
---|
844 | CALL message( 'check_parameters', 'PA0032', 1, 2, 0, 6, 0 ) |
---|
845 | ENDIF |
---|
846 | |
---|
847 | IF ( INDEX( initializing_actions, 'by_user' ) /= 0 .AND. & |
---|
848 | INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) THEN |
---|
849 | message_string = 'initializing_actions = "by_user" and ' // & |
---|
850 | '"set_1d-model_profiles" are not allowed simultaneously' |
---|
851 | CALL message( 'check_parameters', 'PA0033', 1, 2, 0, 6, 0 ) |
---|
852 | ENDIF |
---|
853 | ! |
---|
854 | !-- In case of spinup and nested run, spinup end time must be identical in order to have |
---|
855 | !-- synchronously running simulations. |
---|
856 | IF ( nested_run ) THEN |
---|
857 | #if defined( __parallel ) |
---|
858 | CALL MPI_ALLREDUCE( spinup_time, spinup_time_max, 1, MPI_REAL, MPI_MAX, MPI_COMM_WORLD, & |
---|
859 | ierr ) |
---|
860 | CALL MPI_ALLREDUCE( dt_spinup, dt_spinup_max, 1, MPI_REAL, MPI_MAX, MPI_COMM_WORLD, & |
---|
861 | ierr ) |
---|
862 | |
---|
863 | IF ( spinup_time /= spinup_time_max .OR. dt_spinup /= dt_spinup_max ) THEN |
---|
864 | message_string = 'In case of nesting, spinup_time and ' // & |
---|
865 | 'dt_spinup must be identical in all parent and child domains.' |
---|
866 | CALL message( 'check_parameters', 'PA0489', 3, 2, 0, 6, 0 ) |
---|
867 | ENDIF |
---|
868 | #endif |
---|
869 | ENDIF |
---|
870 | |
---|
871 | IF ( bulk_cloud_model .AND. .NOT. humidity ) THEN |
---|
872 | WRITE( message_string, * ) 'bulk_cloud_model = ', bulk_cloud_model, & |
---|
873 | ' is not allowed with humidity = ', humidity |
---|
874 | CALL message( 'check_parameters', 'PA0034', 1, 2, 0, 6, 0 ) |
---|
875 | ENDIF |
---|
876 | |
---|
877 | IF ( humidity .AND. sloping_surface ) THEN |
---|
878 | message_string = 'humidity = .TRUE. and sloping_surface = .TRUE. ' // & |
---|
879 | 'are not allowed simultaneously' |
---|
880 | CALL message( 'check_parameters', 'PA0036', 1, 2, 0, 6, 0 ) |
---|
881 | ENDIF |
---|
882 | |
---|
883 | !-- Check the module settings |
---|
884 | CALL module_interface_check_parameters |
---|
885 | |
---|
886 | ! |
---|
887 | !-- In case of no restart run, check initialising parameters and calculate further quantities |
---|
888 | IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN |
---|
889 | |
---|
890 | ! |
---|
891 | !-- Initial profiles for 1D and 3D model, respectively (u,v further below) |
---|
892 | pt_init = pt_surface |
---|
893 | IF ( humidity ) q_init = q_surface |
---|
894 | IF ( passive_scalar ) s_init = s_surface |
---|
895 | |
---|
896 | !-- |
---|
897 | !-- If required, compute initial profile of the geostrophic wind (component ug) |
---|
898 | i = 1 |
---|
899 | gradient = 0.0_wp |
---|
900 | |
---|
901 | IF ( .NOT. ocean_mode ) THEN |
---|
902 | |
---|
903 | ug_vertical_gradient_level_ind(1) = 0 |
---|
904 | ug(0) = ug_surface |
---|
905 | DO k = 1, nzt+1 |
---|
906 | IF ( i < 11 ) THEN |
---|
907 | IF ( ug_vertical_gradient_level(i) < zu(k) .AND. & |
---|
908 | ug_vertical_gradient_level(i) >= 0.0_wp ) THEN |
---|
909 | gradient = ug_vertical_gradient(i) / 100.0_wp |
---|
910 | ug_vertical_gradient_level_ind(i) = k - 1 |
---|
911 | i = i + 1 |
---|
912 | ENDIF |
---|
913 | ENDIF |
---|
914 | IF ( gradient /= 0.0_wp ) THEN |
---|
915 | IF ( k /= 1 ) THEN |
---|
916 | ug(k) = ug(k-1) + dzu(k) * gradient |
---|
917 | ELSE |
---|
918 | ug(k) = ug_surface + dzu(k) * gradient |
---|
919 | ENDIF |
---|
920 | ELSE |
---|
921 | ug(k) = ug(k-1) |
---|
922 | ENDIF |
---|
923 | ENDDO |
---|
924 | |
---|
925 | ELSE |
---|
926 | |
---|
927 | ug_vertical_gradient_level_ind(1) = nzt+1 |
---|
928 | ug(nzt+1) = ug_surface |
---|
929 | DO k = nzt, nzb, -1 |
---|
930 | IF ( i < 11 ) THEN |
---|
931 | IF ( ug_vertical_gradient_level(i) > zu(k) .AND. & |
---|
932 | ug_vertical_gradient_level(i) <= 0.0_wp ) THEN |
---|
933 | gradient = ug_vertical_gradient(i) / 100.0_wp |
---|
934 | ug_vertical_gradient_level_ind(i) = k + 1 |
---|
935 | i = i + 1 |
---|
936 | ENDIF |
---|
937 | ENDIF |
---|
938 | IF ( gradient /= 0.0_wp ) THEN |
---|
939 | IF ( k /= nzt ) THEN |
---|
940 | ug(k) = ug(k+1) - dzu(k+1) * gradient |
---|
941 | ELSE |
---|
942 | ug(k) = ug_surface - 0.5_wp * dzu(k+1) * gradient |
---|
943 | ug(k+1) = ug_surface + 0.5_wp * dzu(k+1) * gradient |
---|
944 | ENDIF |
---|
945 | ELSE |
---|
946 | ug(k) = ug(k+1) |
---|
947 | ENDIF |
---|
948 | ENDDO |
---|
949 | |
---|
950 | ENDIF |
---|
951 | |
---|
952 | ! |
---|
953 | !-- In case of no given gradients for ug, choose a zero gradient |
---|
954 | IF ( ug_vertical_gradient_level(1) == -9999999.9_wp ) THEN |
---|
955 | ug_vertical_gradient_level(1) = 0.0_wp |
---|
956 | ENDIF |
---|
957 | |
---|
958 | ! |
---|
959 | !-- |
---|
960 | !-- If required, compute initial profile of the geostrophic wind (component vg) |
---|
961 | i = 1 |
---|
962 | gradient = 0.0_wp |
---|
963 | |
---|
964 | IF ( .NOT. ocean_mode ) THEN |
---|
965 | |
---|
966 | vg_vertical_gradient_level_ind(1) = 0 |
---|
967 | vg(0) = vg_surface |
---|
968 | DO k = 1, nzt+1 |
---|
969 | IF ( i < 11 ) THEN |
---|
970 | IF ( vg_vertical_gradient_level(i) < zu(k) .AND. & |
---|
971 | vg_vertical_gradient_level(i) >= 0.0_wp ) THEN |
---|
972 | gradient = vg_vertical_gradient(i) / 100.0_wp |
---|
973 | vg_vertical_gradient_level_ind(i) = k - 1 |
---|
974 | i = i + 1 |
---|
975 | ENDIF |
---|
976 | ENDIF |
---|
977 | IF ( gradient /= 0.0_wp ) THEN |
---|
978 | IF ( k /= 1 ) THEN |
---|
979 | vg(k) = vg(k-1) + dzu(k) * gradient |
---|
980 | ELSE |
---|
981 | vg(k) = vg_surface + dzu(k) * gradient |
---|
982 | ENDIF |
---|
983 | ELSE |
---|
984 | vg(k) = vg(k-1) |
---|
985 | ENDIF |
---|
986 | ENDDO |
---|
987 | |
---|
988 | ELSE |
---|
989 | |
---|
990 | vg_vertical_gradient_level_ind(1) = nzt+1 |
---|
991 | vg(nzt+1) = vg_surface |
---|
992 | DO k = nzt, nzb, -1 |
---|
993 | IF ( i < 11 ) THEN |
---|
994 | IF ( vg_vertical_gradient_level(i) > zu(k) .AND. & |
---|
995 | vg_vertical_gradient_level(i) <= 0.0_wp ) THEN |
---|
996 | gradient = vg_vertical_gradient(i) / 100.0_wp |
---|
997 | vg_vertical_gradient_level_ind(i) = k + 1 |
---|
998 | i = i + 1 |
---|
999 | ENDIF |
---|
1000 | ENDIF |
---|
1001 | IF ( gradient /= 0.0_wp ) THEN |
---|
1002 | IF ( k /= nzt ) THEN |
---|
1003 | vg(k) = vg(k+1) - dzu(k+1) * gradient |
---|
1004 | ELSE |
---|
1005 | vg(k) = vg_surface - 0.5_wp * dzu(k+1) * gradient |
---|
1006 | vg(k+1) = vg_surface + 0.5_wp * dzu(k+1) * gradient |
---|
1007 | ENDIF |
---|
1008 | ELSE |
---|
1009 | vg(k) = vg(k+1) |
---|
1010 | ENDIF |
---|
1011 | ENDDO |
---|
1012 | |
---|
1013 | ENDIF |
---|
1014 | |
---|
1015 | ! |
---|
1016 | !-- In case of no given gradients for vg, choose a zero gradient |
---|
1017 | IF ( vg_vertical_gradient_level(1) == -9999999.9_wp ) THEN |
---|
1018 | vg_vertical_gradient_level(1) = 0.0_wp |
---|
1019 | ENDIF |
---|
1020 | |
---|
1021 | ! |
---|
1022 | !-- Let the initial wind profiles be the calculated ug/vg profiles or interpolate them from wind |
---|
1023 | !-- profile data (if given) |
---|
1024 | IF ( u_profile(1) == 9999999.9_wp .AND. v_profile(1) == 9999999.9_wp ) THEN |
---|
1025 | |
---|
1026 | u_init = ug |
---|
1027 | v_init = vg |
---|
1028 | |
---|
1029 | ELSEIF ( u_profile(1) == 0.0_wp .AND. v_profile(1) == 0.0_wp ) THEN |
---|
1030 | |
---|
1031 | IF ( uv_heights(1) /= 0.0_wp ) THEN |
---|
1032 | message_string = 'uv_heights(1) must be 0.0' |
---|
1033 | CALL message( 'check_parameters', 'PA0345', 1, 2, 0, 6, 0 ) |
---|
1034 | ENDIF |
---|
1035 | |
---|
1036 | IF ( omega /= 0.0_wp ) THEN |
---|
1037 | message_string = 'Coriolis force is switched on (omega /= 0.0) and' // & |
---|
1038 | ' initial profiles u_profile and v_profile are prescribed' |
---|
1039 | CALL message( 'check_parameters', 'PA0347', 0, 0, 0, 6, 0 ) |
---|
1040 | ENDIF |
---|
1041 | |
---|
1042 | use_prescribed_profile_data = .TRUE. |
---|
1043 | |
---|
1044 | kk = 1 |
---|
1045 | u_init(0) = 0.0_wp |
---|
1046 | v_init(0) = 0.0_wp |
---|
1047 | |
---|
1048 | DO k = 1, nz+1 |
---|
1049 | |
---|
1050 | IF ( kk < 200 ) THEN |
---|
1051 | DO WHILE ( uv_heights(kk+1) <= zu(k) ) |
---|
1052 | kk = kk + 1 |
---|
1053 | IF ( kk == 200 ) EXIT |
---|
1054 | ENDDO |
---|
1055 | ENDIF |
---|
1056 | |
---|
1057 | IF ( kk < 200 .AND. uv_heights(kk+1) /= 9999999.9_wp ) THEN |
---|
1058 | u_init(k) = u_profile(kk) + ( zu(k) - uv_heights(kk) ) / & |
---|
1059 | ( uv_heights(kk+1) - uv_heights(kk) ) * & |
---|
1060 | ( u_profile(kk+1) - u_profile(kk) ) |
---|
1061 | v_init(k) = v_profile(kk) + ( zu(k) - uv_heights(kk) ) / & |
---|
1062 | ( uv_heights(kk+1) - uv_heights(kk) ) * & |
---|
1063 | ( v_profile(kk+1) - v_profile(kk) ) |
---|
1064 | ELSE |
---|
1065 | u_init(k) = u_profile(kk) |
---|
1066 | v_init(k) = v_profile(kk) |
---|
1067 | ENDIF |
---|
1068 | |
---|
1069 | ENDDO |
---|
1070 | |
---|
1071 | ELSE |
---|
1072 | |
---|
1073 | message_string = 'u_profile(1) and v_profile(1) must be 0.0' |
---|
1074 | CALL message( 'check_parameters', 'PA0346', 1, 2, 0, 6, 0 ) |
---|
1075 | |
---|
1076 | ENDIF |
---|
1077 | |
---|
1078 | ! |
---|
1079 | !-- Compute initial temperature profile using the given temperature gradients |
---|
1080 | IF ( .NOT. neutral ) THEN |
---|
1081 | CALL init_vertical_profiles( pt_vertical_gradient_level_ind, pt_vertical_gradient_level, & |
---|
1082 | pt_vertical_gradient, pt_init, pt_surface, bc_pt_t_val ) |
---|
1083 | ENDIF |
---|
1084 | ! |
---|
1085 | !-- Compute initial humidity profile using the given humidity gradients |
---|
1086 | IF ( humidity ) THEN |
---|
1087 | CALL init_vertical_profiles( q_vertical_gradient_level_ind, q_vertical_gradient_level, & |
---|
1088 | q_vertical_gradient, q_init, q_surface, bc_q_t_val ) |
---|
1089 | ENDIF |
---|
1090 | ! |
---|
1091 | !-- Compute initial scalar profile using the given scalar gradients |
---|
1092 | IF ( passive_scalar ) THEN |
---|
1093 | CALL init_vertical_profiles( s_vertical_gradient_level_ind, s_vertical_gradient_level, & |
---|
1094 | s_vertical_gradient, s_init, s_surface, bc_s_t_val ) |
---|
1095 | ENDIF |
---|
1096 | ! |
---|
1097 | !-- TODO |
---|
1098 | !-- Compute initial chemistry profile using the given chemical species gradients |
---|
1099 | !-- Russo: Is done in chem_init --> kanani: Revise |
---|
1100 | |
---|
1101 | ENDIF |
---|
1102 | |
---|
1103 | ! |
---|
1104 | !-- Check if the control parameter use_subsidence_tendencies is used correctly |
---|
1105 | IF ( use_subsidence_tendencies .AND. .NOT. large_scale_subsidence ) THEN |
---|
1106 | message_string = 'The usage of use_subsidence_tendencies ' // & |
---|
1107 | 'requires large_scale_subsidence = .T..' |
---|
1108 | CALL message( 'check_parameters', 'PA0396', 1, 2, 0, 6, 0 ) |
---|
1109 | ELSEIF ( use_subsidence_tendencies .AND. .NOT. large_scale_forcing ) THEN |
---|
1110 | message_string = 'The usage of use_subsidence_tendencies ' // & |
---|
1111 | 'requires large_scale_forcing = .T..' |
---|
1112 | CALL message( 'check_parameters', 'PA0397', 1, 2, 0, 6, 0 ) |
---|
1113 | ENDIF |
---|
1114 | |
---|
1115 | ! |
---|
1116 | !-- Initialize large scale subsidence if required |
---|
1117 | If ( large_scale_subsidence ) THEN |
---|
1118 | IF ( subs_vertical_gradient_level(1) /= -9999999.9_wp .AND. .NOT. large_scale_forcing ) & |
---|
1119 | THEN |
---|
1120 | CALL init_w_subsidence |
---|
1121 | ENDIF |
---|
1122 | ! |
---|
1123 | !-- In case large_scale_forcing is used, profiles for subsidence velocity are read in from file |
---|
1124 | !-- LSF_DATA |
---|
1125 | |
---|
1126 | IF ( subs_vertical_gradient_level(1) == -9999999.9_wp .AND. .NOT. large_scale_forcing ) & |
---|
1127 | THEN |
---|
1128 | message_string = 'There is no default large scale vertical velocity profile set. ' // & |
---|
1129 | 'Specify the subsidence velocity profile via subs_vertical_gradient' // & |
---|
1130 | ' and subs_vertical_gradient_level.' |
---|
1131 | CALL message( 'check_parameters', 'PA0380', 1, 2, 0, 6, 0 ) |
---|
1132 | ENDIF |
---|
1133 | ELSE |
---|
1134 | IF ( subs_vertical_gradient_level(1) /= -9999999.9_wp ) THEN |
---|
1135 | message_string = 'Enable usage of large scale subsidence by ' // & |
---|
1136 | 'setting large_scale_subsidence = .T..' |
---|
1137 | CALL message( 'check_parameters', 'PA0381', 1, 2, 0, 6, 0 ) |
---|
1138 | ENDIF |
---|
1139 | ENDIF |
---|
1140 | |
---|
1141 | ! |
---|
1142 | !-- Overwrite parameters from namelist if necessary and compute Coriolis parameter. |
---|
1143 | !-- @todo - move initialization of f and fs to coriolis_mod. |
---|
1144 | IF ( input_pids_static ) THEN |
---|
1145 | latitude = init_model%latitude |
---|
1146 | longitude = init_model%longitude |
---|
1147 | rotation_angle = init_model%rotation_angle |
---|
1148 | ENDIF |
---|
1149 | |
---|
1150 | f = 2.0_wp * omega * SIN( latitude / 180.0_wp * pi ) |
---|
1151 | fs = 2.0_wp * omega * COS( latitude / 180.0_wp * pi ) |
---|
1152 | |
---|
1153 | ! |
---|
1154 | !-- Check and set buoyancy related parameters and switches |
---|
1155 | IF ( reference_state == 'horizontal_average' ) THEN |
---|
1156 | CONTINUE |
---|
1157 | ELSEIF ( reference_state == 'initial_profile' ) THEN |
---|
1158 | use_initial_profile_as_reference = .TRUE. |
---|
1159 | ELSEIF ( reference_state == 'single_value' ) THEN |
---|
1160 | use_single_reference_value = .TRUE. |
---|
1161 | IF ( pt_reference == 9999999.9_wp ) pt_reference = pt_surface |
---|
1162 | vpt_reference = pt_reference * ( 1.0_wp + 0.61_wp * q_surface ) |
---|
1163 | ELSE |
---|
1164 | message_string = 'illegal value for reference_state: "' // TRIM( reference_state ) // '"' |
---|
1165 | CALL message( 'check_parameters', 'PA0056', 1, 2, 0, 6, 0 ) |
---|
1166 | ENDIF |
---|
1167 | |
---|
1168 | ! |
---|
1169 | !-- In case of a given slope, compute the relevant quantities |
---|
1170 | IF ( alpha_surface /= 0.0_wp ) THEN |
---|
1171 | IF ( ABS( alpha_surface ) > 90.0_wp ) THEN |
---|
1172 | WRITE( message_string, * ) 'ABS( alpha_surface = ', alpha_surface, ' ) must be < 90.0' |
---|
1173 | CALL message( 'check_parameters', 'PA0043', 1, 2, 0, 6, 0 ) |
---|
1174 | ENDIF |
---|
1175 | sloping_surface = .TRUE. |
---|
1176 | cos_alpha_surface = COS( alpha_surface / 180.0_wp * pi ) |
---|
1177 | sin_alpha_surface = SIN( alpha_surface / 180.0_wp * pi ) |
---|
1178 | ENDIF |
---|
1179 | |
---|
1180 | ! |
---|
1181 | !-- Check time step and cfl_factor |
---|
1182 | IF ( dt /= -1.0_wp ) THEN |
---|
1183 | IF ( dt <= 0.0_wp ) THEN |
---|
1184 | WRITE( message_string, * ) 'dt = ', dt , ' <= 0.0' |
---|
1185 | CALL message( 'check_parameters', 'PA0044', 1, 2, 0, 6, 0 ) |
---|
1186 | ENDIF |
---|
1187 | dt_3d = dt |
---|
1188 | dt_fixed = .TRUE. |
---|
1189 | ENDIF |
---|
1190 | |
---|
1191 | IF ( cfl_factor <= 0.0_wp .OR. cfl_factor > 1.0_wp ) THEN |
---|
1192 | IF ( cfl_factor == -1.0_wp ) THEN |
---|
1193 | IF ( timestep_scheme == 'runge-kutta-2' ) THEN |
---|
1194 | cfl_factor = 0.8_wp |
---|
1195 | ELSEIF ( timestep_scheme == 'runge-kutta-3' ) THEN |
---|
1196 | cfl_factor = 0.9_wp |
---|
1197 | ELSE |
---|
1198 | cfl_factor = 0.9_wp |
---|
1199 | ENDIF |
---|
1200 | ELSE |
---|
1201 | WRITE( message_string, * ) 'cfl_factor = ', cfl_factor, & |
---|
1202 | ' out of range &0.0 < cfl_factor <= 1.0 is required' |
---|
1203 | CALL message( 'check_parameters', 'PA0045', 1, 2, 0, 6, 0 ) |
---|
1204 | ENDIF |
---|
1205 | ENDIF |
---|
1206 | |
---|
1207 | ! |
---|
1208 | !-- Store simulated time at begin |
---|
1209 | simulated_time_at_begin = simulated_time |
---|
1210 | |
---|
1211 | ! |
---|
1212 | !-- Store reference time for coupled runs and change the coupling flag, if ... |
---|
1213 | IF ( simulated_time == 0.0_wp ) THEN |
---|
1214 | IF ( coupling_start_time == 0.0_wp ) THEN |
---|
1215 | time_since_reference_point = 0.0_wp |
---|
1216 | ELSEIF ( time_since_reference_point < 0.0_wp ) THEN |
---|
1217 | run_coupled = .FALSE. |
---|
1218 | ENDIF |
---|
1219 | ENDIF |
---|
1220 | |
---|
1221 | ! |
---|
1222 | !-- Set wind speed in the Galilei-transformed system |
---|
1223 | IF ( galilei_transformation ) THEN |
---|
1224 | IF ( use_ug_for_galilei_tr .AND. & |
---|
1225 | ug_vertical_gradient_level(1) == 0.0_wp .AND. & |
---|
1226 | ug_vertical_gradient(1) == 0.0_wp .AND. & |
---|
1227 | vg_vertical_gradient_level(1) == 0.0_wp .AND. & |
---|
1228 | vg_vertical_gradient(1) == 0.0_wp ) THEN |
---|
1229 | u_gtrans = ug_surface * 0.6_wp |
---|
1230 | v_gtrans = vg_surface * 0.6_wp |
---|
1231 | ELSEIF ( use_ug_for_galilei_tr .AND. ( ug_vertical_gradient_level(1) /= 0.0_wp .OR. & |
---|
1232 | ug_vertical_gradient(1) /= 0.0_wp ) ) THEN |
---|
1233 | message_string = 'baroclinity (ug) not allowed simultaneously' // & |
---|
1234 | ' with galilei transformation' |
---|
1235 | CALL message( 'check_parameters', 'PA0046', 1, 2, 0, 6, 0 ) |
---|
1236 | ELSEIF ( use_ug_for_galilei_tr .AND. ( vg_vertical_gradient_level(1) /= 0.0_wp .OR. & |
---|
1237 | vg_vertical_gradient(1) /= 0.0_wp ) ) THEN |
---|
1238 | message_string = 'baroclinity (vg) not allowed simultaneously' // & |
---|
1239 | ' with galilei transformation' |
---|
1240 | CALL message( 'check_parameters', 'PA0047', 1, 2, 0, 6, 0 ) |
---|
1241 | ELSE |
---|
1242 | message_string = 'variable translation speed used for Galilei-transformation, which ' // & |
---|
1243 | 'may cause & instabilities in stably stratified regions' |
---|
1244 | CALL message( 'check_parameters', 'PA0048', 0, 1, 0, 6, 0 ) |
---|
1245 | ENDIF |
---|
1246 | ENDIF |
---|
1247 | |
---|
1248 | ! |
---|
1249 | !-- In case of using a prandtl-layer, calculated (or prescribed) surface fluxes have to be used in |
---|
1250 | !-- the diffusion-terms |
---|
1251 | IF ( constant_flux_layer ) use_surface_fluxes = .TRUE. |
---|
1252 | |
---|
1253 | ! |
---|
1254 | !-- Check boundary conditions and set internal variables: |
---|
1255 | !-- Attention: the lateral boundary conditions have been already checked in parin |
---|
1256 | ! |
---|
1257 | !-- Non-cyclic lateral boundaries require the multigrid method and Piascek-Willimas or |
---|
1258 | !-- Wicker - Skamarock advection scheme. Several schemes and tools do not work with non-cyclic |
---|
1259 | !-- boundary conditions. |
---|
1260 | IF ( bc_lr /= 'cyclic' .OR. bc_ns /= 'cyclic' ) THEN |
---|
1261 | IF ( psolver(1:9) /= 'multigrid' ) THEN |
---|
1262 | message_string = 'non-cyclic lateral boundaries do not allow ' // 'psolver = "' // & |
---|
1263 | TRIM( psolver ) // '"' |
---|
1264 | CALL message( 'check_parameters', 'PA0051', 1, 2, 0, 6, 0 ) |
---|
1265 | ENDIF |
---|
1266 | IF ( momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ws-scheme' ) THEN |
---|
1267 | |
---|
1268 | message_string = 'non-cyclic lateral boundaries do not allow momentum_advec = "' // & |
---|
1269 | TRIM( momentum_advec ) // '"' |
---|
1270 | CALL message( 'check_parameters', 'PA0052', 1, 2, 0, 6, 0 ) |
---|
1271 | ENDIF |
---|
1272 | IF ( scalar_advec /= 'pw-scheme' .AND. scalar_advec /= 'ws-scheme' ) THEN |
---|
1273 | message_string = 'non-cyclic lateral boundaries do not allow scalar_advec = "' // & |
---|
1274 | TRIM( scalar_advec ) // '"' |
---|
1275 | CALL message( 'check_parameters', 'PA0053', 1, 2, 0, 6, 0 ) |
---|
1276 | ENDIF |
---|
1277 | IF ( galilei_transformation ) THEN |
---|
1278 | message_string = 'non-cyclic lateral boundaries do not allow galilei_transformation = .T.' |
---|
1279 | CALL message( 'check_parameters', 'PA0054', 1, 2, 0, 6, 0 ) |
---|
1280 | ENDIF |
---|
1281 | ENDIF |
---|
1282 | |
---|
1283 | ! |
---|
1284 | !-- Bottom boundary condition for the turbulent Kinetic energy |
---|
1285 | IF ( bc_e_b == 'neumann' ) THEN |
---|
1286 | ibc_e_b = 1 |
---|
1287 | ELSEIF ( bc_e_b == '(u*)**2+neumann' ) THEN |
---|
1288 | ibc_e_b = 2 |
---|
1289 | IF ( .NOT. constant_flux_layer ) THEN |
---|
1290 | bc_e_b = 'neumann' |
---|
1291 | ibc_e_b = 1 |
---|
1292 | message_string = 'boundary condition bc_e_b changed to "' // TRIM( bc_e_b ) // '"' |
---|
1293 | CALL message( 'check_parameters', 'PA0057', 0, 1, 0, 6, 0 ) |
---|
1294 | ENDIF |
---|
1295 | ELSE |
---|
1296 | message_string = 'unknown boundary condition: bc_e_b = "' // TRIM( bc_e_b ) // '"' |
---|
1297 | CALL message( 'check_parameters', 'PA0058', 1, 2, 0, 6, 0 ) |
---|
1298 | ENDIF |
---|
1299 | |
---|
1300 | ! |
---|
1301 | !-- Boundary conditions for perturbation pressure |
---|
1302 | IF ( bc_p_b == 'dirichlet' ) THEN |
---|
1303 | ibc_p_b = 0 |
---|
1304 | ELSEIF ( bc_p_b == 'neumann' ) THEN |
---|
1305 | ibc_p_b = 1 |
---|
1306 | ELSE |
---|
1307 | message_string = 'unknown boundary condition: bc_p_b = "' // TRIM( bc_p_b ) // '"' |
---|
1308 | CALL message( 'check_parameters', 'PA0059', 1, 2, 0, 6, 0 ) |
---|
1309 | ENDIF |
---|
1310 | |
---|
1311 | IF ( bc_p_t == 'dirichlet' ) THEN |
---|
1312 | ibc_p_t = 0 |
---|
1313 | !-- TO_DO: later set bc_p_t to neumann before, in case of nested domain |
---|
1314 | ELSEIF ( bc_p_t == 'neumann' .OR. bc_p_t == 'nested' ) THEN |
---|
1315 | ibc_p_t = 1 |
---|
1316 | ELSE |
---|
1317 | message_string = 'unknown boundary condition: bc_p_t = "' // TRIM( bc_p_t ) // '"' |
---|
1318 | CALL message( 'check_parameters', 'PA0061', 1, 2, 0, 6, 0 ) |
---|
1319 | ENDIF |
---|
1320 | |
---|
1321 | ! |
---|
1322 | !-- Boundary conditions for potential temperature |
---|
1323 | IF ( coupling_mode == 'atmosphere_to_ocean' ) THEN |
---|
1324 | ibc_pt_b = 2 |
---|
1325 | ELSE |
---|
1326 | IF ( bc_pt_b == 'dirichlet' ) THEN |
---|
1327 | ibc_pt_b = 0 |
---|
1328 | ELSEIF ( bc_pt_b == 'neumann' ) THEN |
---|
1329 | ibc_pt_b = 1 |
---|
1330 | ELSE |
---|
1331 | message_string = 'unknown boundary condition: bc_pt_b = "' // TRIM( bc_pt_b ) // '"' |
---|
1332 | CALL message( 'check_parameters', 'PA0062', 1, 2, 0, 6, 0 ) |
---|
1333 | ENDIF |
---|
1334 | ENDIF |
---|
1335 | |
---|
1336 | IF ( bc_pt_t == 'dirichlet' ) THEN |
---|
1337 | ibc_pt_t = 0 |
---|
1338 | ELSEIF ( bc_pt_t == 'neumann' ) THEN |
---|
1339 | ibc_pt_t = 1 |
---|
1340 | ELSEIF ( bc_pt_t == 'initial_gradient' ) THEN |
---|
1341 | ibc_pt_t = 2 |
---|
1342 | ELSEIF ( bc_pt_t == 'nested' .OR. bc_pt_t == 'nesting_offline' ) THEN |
---|
1343 | ibc_pt_t = 3 |
---|
1344 | ELSE |
---|
1345 | message_string = 'unknown boundary condition: bc_pt_t = "' // TRIM( bc_pt_t ) // '"' |
---|
1346 | CALL message( 'check_parameters', 'PA0063', 1, 2, 0, 6, 0 ) |
---|
1347 | ENDIF |
---|
1348 | |
---|
1349 | IF ( ANY( wall_heatflux /= 0.0_wp ) .AND. surface_heatflux == 9999999.9_wp ) THEN |
---|
1350 | message_string = 'wall_heatflux additionally requires setting of surface_heatflux' |
---|
1351 | CALL message( 'check_parameters', 'PA0443', 1, 2, 0, 6, 0 ) |
---|
1352 | ENDIF |
---|
1353 | |
---|
1354 | ! |
---|
1355 | ! This IF clause needs revision, got too complex!! |
---|
1356 | IF ( surface_heatflux == 9999999.9_wp ) THEN |
---|
1357 | constant_heatflux = .FALSE. |
---|
1358 | IF ( large_scale_forcing .OR. land_surface .OR. urban_surface ) THEN |
---|
1359 | IF ( ibc_pt_b == 0 ) THEN |
---|
1360 | constant_heatflux = .FALSE. |
---|
1361 | ELSEIF ( ibc_pt_b == 1 ) THEN |
---|
1362 | constant_heatflux = .TRUE. |
---|
1363 | surface_heatflux = 0.0_wp |
---|
1364 | ENDIF |
---|
1365 | ENDIF |
---|
1366 | ELSE |
---|
1367 | constant_heatflux = .TRUE. |
---|
1368 | ENDIF |
---|
1369 | |
---|
1370 | IF ( top_heatflux == 9999999.9_wp ) constant_top_heatflux = .FALSE. |
---|
1371 | |
---|
1372 | IF ( neutral ) THEN |
---|
1373 | |
---|
1374 | IF ( surface_heatflux /= 0.0_wp .AND. surface_heatflux /= 9999999.9_wp ) THEN |
---|
1375 | message_string = 'heatflux must not be set for pure neutral flow' |
---|
1376 | CALL message( 'check_parameters', 'PA0351', 1, 2, 0, 6, 0 ) |
---|
1377 | ENDIF |
---|
1378 | |
---|
1379 | IF ( top_heatflux /= 0.0_wp .AND. top_heatflux /= 9999999.9_wp ) THEN |
---|
1380 | message_string = 'heatflux must not be set for pure neutral flow' |
---|
1381 | CALL message( 'check_parameters', 'PA0351', 1, 2, 0, 6, 0 ) |
---|
1382 | ENDIF |
---|
1383 | |
---|
1384 | ENDIF |
---|
1385 | |
---|
1386 | IF ( top_momentumflux_u /= 9999999.9_wp .AND. top_momentumflux_v /= 9999999.9_wp ) THEN |
---|
1387 | constant_top_momentumflux = .TRUE. |
---|
1388 | ELSEIF ( .NOT. ( top_momentumflux_u == 9999999.9_wp .AND. & |
---|
1389 | top_momentumflux_v == 9999999.9_wp ) ) THEN |
---|
1390 | message_string = 'both, top_momentumflux_u AND top_momentumflux_v must be set' |
---|
1391 | CALL message( 'check_parameters', 'PA0064', 1, 2, 0, 6, 0 ) |
---|
1392 | ENDIF |
---|
1393 | |
---|
1394 | ! |
---|
1395 | !-- A given surface temperature implies Dirichlet boundary condition for temperature. In this case |
---|
1396 | !-- specification of a constant heat flux is forbidden. |
---|
1397 | IF ( ibc_pt_b == 0 .AND. constant_heatflux .AND. surface_heatflux /= 0.0_wp ) THEN |
---|
1398 | message_string = 'boundary_condition: bc_pt_b = "' // TRIM( bc_pt_b ) // & |
---|
1399 | '& is not allowed with constant_heatflux = .TRUE.' |
---|
1400 | CALL message( 'check_parameters', 'PA0065', 1, 2, 0, 6, 0 ) |
---|
1401 | ENDIF |
---|
1402 | IF ( constant_heatflux .AND. pt_surface_initial_change /= 0.0_wp ) THEN |
---|
1403 | WRITE ( message_string, * ) 'constant_heatflux = .TRUE. is not allo', & |
---|
1404 | 'wed with pt_surface_initial_change (/=0) = ', pt_surface_initial_change |
---|
1405 | CALL message( 'check_parameters', 'PA0066', 1, 2, 0, 6, 0 ) |
---|
1406 | ENDIF |
---|
1407 | IF ( constant_heatflux .AND. pt_surface_heating_rate /= 0.0_wp ) THEN |
---|
1408 | WRITE ( message_string, * ) 'constant_heatflux = .TRUE. is not allo', & |
---|
1409 | 'wed with pt_surface_heating_rate (/=0) = ', pt_surface_heating_rate |
---|
1410 | CALL message( 'check_parameters', 'PA0497', 1, 2, 0, 6, 0 ) |
---|
1411 | ENDIF |
---|
1412 | |
---|
1413 | ! |
---|
1414 | !-- A given temperature at the top implies Dirichlet boundary condition for temperature. In this |
---|
1415 | !-- case specification of a constant heat flux is forbidden. |
---|
1416 | IF ( ibc_pt_t == 0 .AND. constant_top_heatflux .AND. top_heatflux /= 0.0_wp ) THEN |
---|
1417 | message_string = 'boundary_condition: bc_pt_t = "' // TRIM( bc_pt_t ) // & |
---|
1418 | '" is not allowed with constant_top_heatflux = .TRUE.' |
---|
1419 | CALL message( 'check_parameters', 'PA0067', 1, 2, 0, 6, 0 ) |
---|
1420 | ENDIF |
---|
1421 | |
---|
1422 | ! |
---|
1423 | !-- Set boundary conditions for total water content |
---|
1424 | IF ( humidity ) THEN |
---|
1425 | |
---|
1426 | IF ( ANY( wall_humidityflux /= 0.0_wp ) .AND. surface_waterflux == 9999999.9_wp ) THEN |
---|
1427 | message_string = 'wall_humidityflux additionally requires setting of surface_waterflux' |
---|
1428 | CALL message( 'check_parameters', 'PA0444', 1, 2, 0, 6, 0 ) |
---|
1429 | ENDIF |
---|
1430 | |
---|
1431 | CALL set_bc_scalars( 'q', bc_q_b, bc_q_t, ibc_q_b, ibc_q_t, 'PA0071', 'PA0072' ) |
---|
1432 | |
---|
1433 | IF ( surface_waterflux == 9999999.9_wp ) THEN |
---|
1434 | constant_waterflux = .FALSE. |
---|
1435 | IF ( large_scale_forcing .OR. land_surface ) THEN |
---|
1436 | IF ( ibc_q_b == 0 ) THEN |
---|
1437 | constant_waterflux = .FALSE. |
---|
1438 | ELSEIF ( ibc_q_b == 1 ) THEN |
---|
1439 | constant_waterflux = .TRUE. |
---|
1440 | ENDIF |
---|
1441 | ENDIF |
---|
1442 | ELSE |
---|
1443 | constant_waterflux = .TRUE. |
---|
1444 | ENDIF |
---|
1445 | |
---|
1446 | CALL check_bc_scalars( 'q', bc_q_b, ibc_q_b, 'PA0073', 'PA0074', constant_waterflux, & |
---|
1447 | q_surface_initial_change ) |
---|
1448 | |
---|
1449 | ENDIF |
---|
1450 | |
---|
1451 | IF ( passive_scalar ) THEN |
---|
1452 | |
---|
1453 | IF ( ANY( wall_scalarflux /= 0.0_wp ) .AND. surface_scalarflux == 9999999.9_wp ) THEN |
---|
1454 | message_string = 'wall_scalarflux additionally requires setting of surface_scalarflux' |
---|
1455 | CALL message( 'check_parameters', 'PA0445', 1, 2, 0, 6, 0 ) |
---|
1456 | ENDIF |
---|
1457 | |
---|
1458 | IF ( surface_scalarflux == 9999999.9_wp ) constant_scalarflux = .FALSE. |
---|
1459 | |
---|
1460 | CALL set_bc_scalars( 's', bc_s_b, bc_s_t, ibc_s_b, ibc_s_t, 'PA0071', 'PA0072' ) |
---|
1461 | |
---|
1462 | CALL check_bc_scalars( 's', bc_s_b, ibc_s_b, 'PA0073', 'PA0074', constant_scalarflux, & |
---|
1463 | s_surface_initial_change ) |
---|
1464 | |
---|
1465 | IF ( top_scalarflux == 9999999.9_wp ) constant_top_scalarflux = .FALSE. |
---|
1466 | ! |
---|
1467 | !-- A fixed scalar concentration at the top implies Dirichlet boundary condition for scalar. |
---|
1468 | !-- Hence, in this case specification of a constant scalar flux is forbidden. |
---|
1469 | IF ( ( ibc_s_t == 0 .OR. ibc_s_t == 2 ) .AND. constant_top_scalarflux .AND. & |
---|
1470 | top_scalarflux /= 0.0_wp ) THEN |
---|
1471 | message_string = 'boundary condition: bc_s_t = "' // TRIM( bc_s_t ) // & |
---|
1472 | '" is not allowed with top_scalarflux /= 0.0' |
---|
1473 | CALL message( 'check_parameters', 'PA0441', 1, 2, 0, 6, 0 ) |
---|
1474 | ENDIF |
---|
1475 | ENDIF |
---|
1476 | |
---|
1477 | ! |
---|
1478 | !-- Boundary conditions for horizontal components of wind speed |
---|
1479 | IF ( bc_uv_b == 'dirichlet' ) THEN |
---|
1480 | ibc_uv_b = 0 |
---|
1481 | ELSEIF ( bc_uv_b == 'neumann' ) THEN |
---|
1482 | ibc_uv_b = 1 |
---|
1483 | IF ( constant_flux_layer ) THEN |
---|
1484 | message_string = 'boundary condition: bc_uv_b = "' // TRIM( bc_uv_b ) // & |
---|
1485 | '" is not allowed with constant_flux_layer = .TRUE.' |
---|
1486 | CALL message( 'check_parameters', 'PA0075', 1, 2, 0, 6, 0 ) |
---|
1487 | ENDIF |
---|
1488 | ELSE |
---|
1489 | message_string = 'unknown boundary condition: bc_uv_b = "' // TRIM( bc_uv_b ) // '"' |
---|
1490 | CALL message( 'check_parameters', 'PA0076', 1, 2, 0, 6, 0 ) |
---|
1491 | ENDIF |
---|
1492 | ! |
---|
1493 | !-- In case of coupled simulations u and v at the ground in atmosphere will be assigned with the u |
---|
1494 | !-- and v values of the ocean surface |
---|
1495 | IF ( coupling_mode == 'atmosphere_to_ocean' ) THEN |
---|
1496 | ibc_uv_b = 2 |
---|
1497 | ENDIF |
---|
1498 | |
---|
1499 | IF ( coupling_mode == 'ocean_to_atmosphere' ) THEN |
---|
1500 | bc_uv_t = 'neumann' |
---|
1501 | ibc_uv_t = 1 |
---|
1502 | ELSE |
---|
1503 | IF ( bc_uv_t == 'dirichlet' .OR. bc_uv_t == 'dirichlet_0' ) THEN |
---|
1504 | ibc_uv_t = 0 |
---|
1505 | IF ( bc_uv_t == 'dirichlet_0' ) THEN |
---|
1506 | ! |
---|
1507 | !-- Velocities for the initial u,v-profiles are set zero at the top in case of dirichlet_0 |
---|
1508 | !-- conditions |
---|
1509 | u_init(nzt+1) = 0.0_wp |
---|
1510 | v_init(nzt+1) = 0.0_wp |
---|
1511 | ENDIF |
---|
1512 | ELSEIF ( bc_uv_t == 'neumann' ) THEN |
---|
1513 | ibc_uv_t = 1 |
---|
1514 | ELSEIF ( bc_uv_t == 'nested' .OR. bc_uv_t == 'nesting_offline' ) THEN |
---|
1515 | ibc_uv_t = 3 |
---|
1516 | ELSE |
---|
1517 | message_string = 'unknown boundary condition: bc_uv_t = "' // TRIM( bc_uv_t ) // '"' |
---|
1518 | CALL message( 'check_parameters', 'PA0077', 1, 2, 0, 6, 0 ) |
---|
1519 | ENDIF |
---|
1520 | ENDIF |
---|
1521 | |
---|
1522 | ! |
---|
1523 | !-- Compute and check, respectively, the Rayleigh Damping parameter |
---|
1524 | IF ( rayleigh_damping_factor == -1.0_wp ) THEN |
---|
1525 | rayleigh_damping_factor = 0.0_wp |
---|
1526 | ELSE |
---|
1527 | IF ( rayleigh_damping_factor < 0.0_wp .OR. rayleigh_damping_factor > 1.0_wp ) THEN |
---|
1528 | WRITE( message_string, * ) 'rayleigh_damping_factor = ', rayleigh_damping_factor, & |
---|
1529 | ' out of range [0.0,1.0]' |
---|
1530 | CALL message( 'check_parameters', 'PA0078', 1, 2, 0, 6, 0 ) |
---|
1531 | ENDIF |
---|
1532 | ENDIF |
---|
1533 | |
---|
1534 | IF ( rayleigh_damping_height == -1.0_wp ) THEN |
---|
1535 | IF ( .NOT. ocean_mode ) THEN |
---|
1536 | rayleigh_damping_height = 0.66666666666_wp * zu(nzt) |
---|
1537 | ELSE |
---|
1538 | rayleigh_damping_height = 0.66666666666_wp * zu(nzb) |
---|
1539 | ENDIF |
---|
1540 | ELSE |
---|
1541 | IF ( .NOT. ocean_mode ) THEN |
---|
1542 | IF ( rayleigh_damping_height < 0.0_wp .OR. rayleigh_damping_height > zu(nzt) ) THEN |
---|
1543 | WRITE( message_string, * ) 'rayleigh_damping_height = ', rayleigh_damping_height, & |
---|
1544 | ' out of range [0.0,', zu(nzt), ']' |
---|
1545 | CALL message( 'check_parameters', 'PA0079', 1, 2, 0, 6, 0 ) |
---|
1546 | ENDIF |
---|
1547 | ELSE |
---|
1548 | IF ( rayleigh_damping_height > 0.0_wp .OR. rayleigh_damping_height < zu(nzb) ) THEN |
---|
1549 | WRITE( message_string, * ) 'rayleigh_damping_height = ', rayleigh_damping_height, & |
---|
1550 | ' out of range [0.0,', zu(nzb), ']' |
---|
1551 | CALL message( 'check_parameters', 'PA0079', 1, 2, 0, 6, 0 ) |
---|
1552 | ENDIF |
---|
1553 | ENDIF |
---|
1554 | ENDIF |
---|
1555 | |
---|
1556 | ! |
---|
1557 | !-- Check number of chosen statistic regions |
---|
1558 | IF ( statistic_regions < 0 ) THEN |
---|
1559 | WRITE ( message_string, * ) 'number of statistic_regions = ', statistic_regions+1, & |
---|
1560 | ' is not allowed' |
---|
1561 | CALL message( 'check_parameters', 'PA0082', 1, 2, 0, 6, 0 ) |
---|
1562 | ENDIF |
---|
1563 | IF ( normalizing_region > statistic_regions .OR. normalizing_region < 0) THEN |
---|
1564 | WRITE ( message_string, * ) 'normalizing_region = ', normalizing_region, & |
---|
1565 | ' must be >= 0 and <= ',statistic_regions, ' (value of statistic_regions)' |
---|
1566 | CALL message( 'check_parameters', 'PA0083', 1, 2, 0, 6, 0 ) |
---|
1567 | ENDIF |
---|
1568 | |
---|
1569 | ! |
---|
1570 | !-- Set the default intervals for data output, if necessary |
---|
1571 | !-- NOTE: dt_dosp has already been set in spectra_parin |
---|
1572 | IF ( dt_data_output /= 9999999.9_wp ) THEN |
---|
1573 | IF ( dt_dopr == 9999999.9_wp ) dt_dopr = dt_data_output |
---|
1574 | IF ( dt_dopts == 9999999.9_wp ) dt_dopts = dt_data_output |
---|
1575 | IF ( dt_do2d_xy == 9999999.9_wp ) dt_do2d_xy = dt_data_output |
---|
1576 | IF ( dt_do2d_xz == 9999999.9_wp ) dt_do2d_xz = dt_data_output |
---|
1577 | IF ( dt_do2d_yz == 9999999.9_wp ) dt_do2d_yz = dt_data_output |
---|
1578 | IF ( dt_do3d == 9999999.9_wp ) dt_do3d = dt_data_output |
---|
1579 | IF ( dt_data_output_av == 9999999.9_wp ) dt_data_output_av = dt_data_output |
---|
1580 | DO mid = 1, max_masks |
---|
1581 | IF ( dt_domask(mid) == 9999999.9_wp ) dt_domask(mid) = dt_data_output |
---|
1582 | ENDDO |
---|
1583 | ENDIF |
---|
1584 | |
---|
1585 | ! |
---|
1586 | !-- Set the default skip time intervals for data output, if necessary |
---|
1587 | IF ( skip_time_dopr == 9999999.9_wp ) skip_time_dopr = skip_time_data_output |
---|
1588 | IF ( skip_time_do2d_xy == 9999999.9_wp ) skip_time_do2d_xy = skip_time_data_output |
---|
1589 | IF ( skip_time_do2d_xz == 9999999.9_wp ) skip_time_do2d_xz = skip_time_data_output |
---|
1590 | IF ( skip_time_do2d_yz == 9999999.9_wp ) skip_time_do2d_yz = skip_time_data_output |
---|
1591 | IF ( skip_time_do3d == 9999999.9_wp ) skip_time_do3d = skip_time_data_output |
---|
1592 | IF ( skip_time_data_output_av == 9999999.9_wp ) & |
---|
1593 | skip_time_data_output_av = skip_time_data_output |
---|
1594 | DO mid = 1, max_masks |
---|
1595 | IF ( skip_time_domask(mid) == 9999999.9_wp ) & |
---|
1596 | skip_time_domask(mid) = skip_time_data_output |
---|
1597 | ENDDO |
---|
1598 | |
---|
1599 | ! |
---|
1600 | !-- Check the average intervals (first for 3d-data, then for profiles) |
---|
1601 | IF ( averaging_interval > dt_data_output_av ) THEN |
---|
1602 | WRITE( message_string, * ) 'averaging_interval = ', averaging_interval, & |
---|
1603 | ' must be <= dt_data_output_av = ', dt_data_output_av |
---|
1604 | CALL message( 'check_parameters', 'PA0085', 1, 2, 0, 6, 0 ) |
---|
1605 | ENDIF |
---|
1606 | |
---|
1607 | IF ( averaging_interval_pr == 9999999.9_wp ) THEN |
---|
1608 | averaging_interval_pr = averaging_interval |
---|
1609 | ENDIF |
---|
1610 | |
---|
1611 | IF ( averaging_interval_pr > dt_dopr ) THEN |
---|
1612 | WRITE( message_string, * ) 'averaging_interval_pr = ', averaging_interval_pr, & |
---|
1613 | ' must be <= dt_dopr = ', dt_dopr |
---|
1614 | CALL message( 'check_parameters', 'PA0086', 1, 2, 0, 6, 0 ) |
---|
1615 | ENDIF |
---|
1616 | |
---|
1617 | ! |
---|
1618 | !-- Set the default interval for profiles entering the temporal average |
---|
1619 | IF ( dt_averaging_input_pr == 9999999.9_wp ) THEN |
---|
1620 | dt_averaging_input_pr = dt_averaging_input |
---|
1621 | ENDIF |
---|
1622 | |
---|
1623 | ! |
---|
1624 | !-- Set the default interval for the output of timeseries to a reasonable value (tries to minimize |
---|
1625 | !-- the number of calls of flow_statistics) |
---|
1626 | IF ( dt_dots == 9999999.9_wp ) THEN |
---|
1627 | IF ( averaging_interval_pr == 0.0_wp ) THEN |
---|
1628 | dt_dots = MIN( dt_run_control, dt_dopr ) |
---|
1629 | ELSE |
---|
1630 | dt_dots = MIN( dt_run_control, dt_averaging_input_pr ) |
---|
1631 | ENDIF |
---|
1632 | ENDIF |
---|
1633 | |
---|
1634 | ! |
---|
1635 | !-- Check the sample rate for averaging (first for 3d-data, then for profiles) |
---|
1636 | IF ( dt_averaging_input > averaging_interval ) THEN |
---|
1637 | WRITE( message_string, * ) 'dt_averaging_input = ', dt_averaging_input, & |
---|
1638 | ' must be <= averaging_interval = ', averaging_interval |
---|
1639 | CALL message( 'check_parameters', 'PA0088', 1, 2, 0, 6, 0 ) |
---|
1640 | ENDIF |
---|
1641 | |
---|
1642 | IF ( dt_averaging_input_pr > averaging_interval_pr ) THEN |
---|
1643 | WRITE( message_string, * ) 'dt_averaging_input_pr = ', dt_averaging_input_pr, & |
---|
1644 | ' must be <= averaging_interval_pr = ', averaging_interval_pr |
---|
1645 | CALL message( 'check_parameters', 'PA0089', 1, 2, 0, 6, 0 ) |
---|
1646 | ENDIF |
---|
1647 | |
---|
1648 | ! |
---|
1649 | !-- Check data-output variable list for any duplicates and remove them |
---|
1650 | ALLOCATE( data_output_filtered(1:UBOUND( data_output_pr, DIM=1 )) ) |
---|
1651 | CALL filter_duplicate_strings( varnamelength, data_output_pr, data_output_filtered ) |
---|
1652 | data_output_pr = data_output_filtered |
---|
1653 | DEALLOCATE( data_output_filtered ) |
---|
1654 | ! |
---|
1655 | !-- Determine the number of output profiles and check whether they are permissible |
---|
1656 | DO WHILE ( data_output_pr(dopr_n+1) /= ' ' ) |
---|
1657 | |
---|
1658 | dopr_n = dopr_n + 1 |
---|
1659 | i = dopr_n |
---|
1660 | |
---|
1661 | ! |
---|
1662 | !-- Size check. Some arrays in the netcdf interface module are internally limited to 300 elements |
---|
1663 | !-- and would need to be increased for output of more than 300 profiles. |
---|
1664 | IF ( dopr_n > 300 ) THEN |
---|
1665 | message_string = 'output of more than 300 profiles requested' |
---|
1666 | CALL message( 'check_parameters', 'PA0017', 1, 2, 0, 6, 0 ) |
---|
1667 | ENDIF |
---|
1668 | |
---|
1669 | ! |
---|
1670 | !-- Determine internal profile number (for hom, homs) and store height levels |
---|
1671 | SELECT CASE ( TRIM( data_output_pr(i) ) ) |
---|
1672 | |
---|
1673 | CASE ( 'u', '#u' ) |
---|
1674 | dopr_index(i) = 1 |
---|
1675 | dopr_unit(i) = 'm/s' |
---|
1676 | hom(:,2,1,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1677 | IF ( data_output_pr(i)(1:1) == '#' ) THEN |
---|
1678 | dopr_initial_index(i) = 5 |
---|
1679 | hom(:,2,5,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1680 | data_output_pr(i) = data_output_pr(i)(2:) |
---|
1681 | ENDIF |
---|
1682 | |
---|
1683 | CASE ( 'v', '#v' ) |
---|
1684 | dopr_index(i) = 2 |
---|
1685 | dopr_unit(i) = 'm/s' |
---|
1686 | hom(:,2,2,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1687 | IF ( data_output_pr(i)(1:1) == '#' ) THEN |
---|
1688 | dopr_initial_index(i) = 6 |
---|
1689 | hom(:,2,6,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1690 | data_output_pr(i) = data_output_pr(i)(2:) |
---|
1691 | ENDIF |
---|
1692 | |
---|
1693 | CASE ( 'w' ) |
---|
1694 | dopr_index(i) = 3 |
---|
1695 | dopr_unit(i) = 'm/s' |
---|
1696 | hom(:,2,3,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1697 | |
---|
1698 | CASE ( 'theta', '#theta' ) |
---|
1699 | IF ( .NOT. bulk_cloud_model ) THEN |
---|
1700 | dopr_index(i) = 4 |
---|
1701 | dopr_unit(i) = 'K' |
---|
1702 | hom(:,2,4,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1703 | IF ( data_output_pr(i)(1:1) == '#' ) THEN |
---|
1704 | dopr_initial_index(i) = 7 |
---|
1705 | hom(:,2,7,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1706 | hom(nzb,2,7,:) = 0.0_wp ! because zu(nzb) is negative |
---|
1707 | data_output_pr(i) = data_output_pr(i)(2:) |
---|
1708 | ENDIF |
---|
1709 | ELSE |
---|
1710 | dopr_index(i) = 43 |
---|
1711 | dopr_unit(i) = 'K' |
---|
1712 | hom(:,2,43,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1713 | IF ( data_output_pr(i)(1:1) == '#' ) THEN |
---|
1714 | dopr_initial_index(i) = 28 |
---|
1715 | hom(:,2,28,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1716 | hom(nzb,2,28,:) = 0.0_wp ! because zu(nzb) is negative |
---|
1717 | data_output_pr(i) = data_output_pr(i)(2:) |
---|
1718 | ENDIF |
---|
1719 | ENDIF |
---|
1720 | |
---|
1721 | CASE ( 'e', '#e' ) |
---|
1722 | dopr_index(i) = 8 |
---|
1723 | dopr_unit(i) = 'm2/s2' |
---|
1724 | hom(:,2,8,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1725 | hom(nzb,2,8,:) = 0.0_wp |
---|
1726 | IF ( data_output_pr(i)(1:1) == '#' ) THEN |
---|
1727 | dopr_initial_index(i) = 8 |
---|
1728 | hom(:,2,8,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1729 | data_output_pr(i) = data_output_pr(i)(2:) |
---|
1730 | ENDIF |
---|
1731 | |
---|
1732 | CASE ( 'km', '#km' ) |
---|
1733 | dopr_index(i) = 9 |
---|
1734 | dopr_unit(i) = 'm2/s' |
---|
1735 | hom(:,2,9,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1736 | hom(nzb,2,9,:) = 0.0_wp |
---|
1737 | IF ( data_output_pr(i)(1:1) == '#' ) THEN |
---|
1738 | dopr_initial_index(i) = 23 |
---|
1739 | hom(:,2,23,:) = hom(:,2,9,:) |
---|
1740 | data_output_pr(i) = data_output_pr(i)(2:) |
---|
1741 | ENDIF |
---|
1742 | |
---|
1743 | CASE ( 'kh', '#kh' ) |
---|
1744 | dopr_index(i) = 10 |
---|
1745 | dopr_unit(i) = 'm2/s' |
---|
1746 | hom(:,2,10,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1747 | hom(nzb,2,10,:) = 0.0_wp |
---|
1748 | IF ( data_output_pr(i)(1:1) == '#' ) THEN |
---|
1749 | dopr_initial_index(i) = 24 |
---|
1750 | hom(:,2,24,:) = hom(:,2,10,:) |
---|
1751 | data_output_pr(i) = data_output_pr(i)(2:) |
---|
1752 | ENDIF |
---|
1753 | |
---|
1754 | CASE ( 'l', '#l' ) |
---|
1755 | dopr_index(i) = 11 |
---|
1756 | dopr_unit(i) = 'm' |
---|
1757 | hom(:,2,11,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1758 | hom(nzb,2,11,:) = 0.0_wp |
---|
1759 | IF ( data_output_pr(i)(1:1) == '#' ) THEN |
---|
1760 | dopr_initial_index(i) = 25 |
---|
1761 | hom(:,2,25,:) = hom(:,2,11,:) |
---|
1762 | data_output_pr(i) = data_output_pr(i)(2:) |
---|
1763 | ENDIF |
---|
1764 | |
---|
1765 | CASE ( 'w"u"' ) |
---|
1766 | dopr_index(i) = 12 |
---|
1767 | dopr_unit(i) = TRIM ( momentumflux_output_unit ) |
---|
1768 | hom(:,2,12,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1769 | IF ( constant_flux_layer ) hom(nzb,2,12,:) = zu(1) |
---|
1770 | |
---|
1771 | CASE ( 'w*u*' ) |
---|
1772 | dopr_index(i) = 13 |
---|
1773 | dopr_unit(i) = TRIM ( momentumflux_output_unit ) |
---|
1774 | hom(:,2,13,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1775 | |
---|
1776 | CASE ( 'w"v"' ) |
---|
1777 | dopr_index(i) = 14 |
---|
1778 | dopr_unit(i) = TRIM ( momentumflux_output_unit ) |
---|
1779 | hom(:,2,14,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1780 | IF ( constant_flux_layer ) hom(nzb,2,14,:) = zu(1) |
---|
1781 | |
---|
1782 | CASE ( 'w*v*' ) |
---|
1783 | dopr_index(i) = 15 |
---|
1784 | dopr_unit(i) = TRIM ( momentumflux_output_unit ) |
---|
1785 | hom(:,2,15,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1786 | |
---|
1787 | CASE ( 'w"theta"' ) |
---|
1788 | dopr_index(i) = 16 |
---|
1789 | dopr_unit(i) = TRIM ( heatflux_output_unit ) |
---|
1790 | hom(:,2,16,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1791 | |
---|
1792 | CASE ( 'w*theta*' ) |
---|
1793 | dopr_index(i) = 17 |
---|
1794 | dopr_unit(i) = TRIM ( heatflux_output_unit ) |
---|
1795 | hom(:,2,17,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1796 | |
---|
1797 | CASE ( 'wtheta' ) |
---|
1798 | dopr_index(i) = 18 |
---|
1799 | dopr_unit(i) = TRIM ( heatflux_output_unit ) |
---|
1800 | hom(:,2,18,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1801 | |
---|
1802 | CASE ( 'wu' ) |
---|
1803 | dopr_index(i) = 19 |
---|
1804 | dopr_unit(i) = TRIM ( momentumflux_output_unit ) |
---|
1805 | hom(:,2,19,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1806 | IF ( constant_flux_layer ) hom(nzb,2,19,:) = zu(1) |
---|
1807 | |
---|
1808 | CASE ( 'wv' ) |
---|
1809 | dopr_index(i) = 20 |
---|
1810 | dopr_unit(i) = TRIM ( momentumflux_output_unit ) |
---|
1811 | hom(:,2,20,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1812 | IF ( constant_flux_layer ) hom(nzb,2,20,:) = zu(1) |
---|
1813 | |
---|
1814 | CASE ( 'w*theta*BC' ) |
---|
1815 | dopr_index(i) = 21 |
---|
1816 | dopr_unit(i) = TRIM ( heatflux_output_unit ) |
---|
1817 | hom(:,2,21,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1818 | |
---|
1819 | CASE ( 'wthetaBC' ) |
---|
1820 | dopr_index(i) = 22 |
---|
1821 | dopr_unit(i) = TRIM ( heatflux_output_unit ) |
---|
1822 | hom(:,2,22,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1823 | |
---|
1824 | CASE ( 'u*2' ) |
---|
1825 | dopr_index(i) = 30 |
---|
1826 | dopr_unit(i) = 'm2/s2' |
---|
1827 | hom(:,2,30,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1828 | |
---|
1829 | CASE ( 'v*2' ) |
---|
1830 | dopr_index(i) = 31 |
---|
1831 | dopr_unit(i) = 'm2/s2' |
---|
1832 | hom(:,2,31,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1833 | |
---|
1834 | CASE ( 'w*2' ) |
---|
1835 | dopr_index(i) = 32 |
---|
1836 | dopr_unit(i) = 'm2/s2' |
---|
1837 | hom(:,2,32,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1838 | |
---|
1839 | CASE ( 'theta*2' ) |
---|
1840 | dopr_index(i) = 33 |
---|
1841 | dopr_unit(i) = 'K2' |
---|
1842 | hom(:,2,33,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1843 | |
---|
1844 | CASE ( 'e*' ) |
---|
1845 | dopr_index(i) = 34 |
---|
1846 | dopr_unit(i) = 'm2/s2' |
---|
1847 | hom(:,2,34,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1848 | |
---|
1849 | CASE ( 'w*2theta*' ) |
---|
1850 | dopr_index(i) = 35 |
---|
1851 | dopr_unit(i) = 'K m2/s2' |
---|
1852 | hom(:,2,35,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1853 | |
---|
1854 | CASE ( 'w*theta*2' ) |
---|
1855 | dopr_index(i) = 36 |
---|
1856 | dopr_unit(i) = 'K2 m/s' |
---|
1857 | hom(:,2,36,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1858 | |
---|
1859 | CASE ( 'w*e*' ) |
---|
1860 | dopr_index(i) = 37 |
---|
1861 | dopr_unit(i) = 'm3/s3' |
---|
1862 | hom(:,2,37,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1863 | |
---|
1864 | CASE ( 'w*3' ) |
---|
1865 | dopr_index(i) = 38 |
---|
1866 | dopr_unit(i) = 'm3/s3' |
---|
1867 | hom(:,2,38,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1868 | |
---|
1869 | CASE ( 'Sw' ) |
---|
1870 | dopr_index(i) = 39 |
---|
1871 | dopr_unit(i) = 'none' |
---|
1872 | hom(:,2,39,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1873 | |
---|
1874 | CASE ( 'p' ) |
---|
1875 | dopr_index(i) = 40 |
---|
1876 | dopr_unit(i) = 'Pa' |
---|
1877 | hom(:,2,40,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1878 | |
---|
1879 | CASE ( 'q', '#q' ) |
---|
1880 | IF ( .NOT. humidity ) THEN |
---|
1881 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
1882 | ' is not implemented for humidity = .FALSE.' |
---|
1883 | CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 ) |
---|
1884 | ELSE |
---|
1885 | dopr_index(i) = 41 |
---|
1886 | dopr_unit(i) = 'kg/kg' |
---|
1887 | hom(:,2,41,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1888 | IF ( data_output_pr(i)(1:1) == '#' ) THEN |
---|
1889 | dopr_initial_index(i) = 26 |
---|
1890 | hom(:,2,26,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1891 | hom(nzb,2,26,:) = 0.0_wp ! because zu(nzb) is negative |
---|
1892 | data_output_pr(i) = data_output_pr(i)(2:) |
---|
1893 | ENDIF |
---|
1894 | ENDIF |
---|
1895 | |
---|
1896 | CASE ( 's', '#s' ) |
---|
1897 | IF ( .NOT. passive_scalar ) THEN |
---|
1898 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
1899 | ' is not implemented for passive_scalar = .FALSE.' |
---|
1900 | CALL message( 'check_parameters', 'PA0093', 1, 2, 0, 6, 0 ) |
---|
1901 | ELSE |
---|
1902 | dopr_index(i) = 115 |
---|
1903 | dopr_unit(i) = 'kg/m3' |
---|
1904 | hom(:,2,115,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1905 | IF ( data_output_pr(i)(1:1) == '#' ) THEN |
---|
1906 | dopr_initial_index(i) = 121 |
---|
1907 | hom(:,2,121,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1908 | hom(nzb,2,121,:) = 0.0_wp ! because zu(nzb) is negative |
---|
1909 | data_output_pr(i) = data_output_pr(i)(2:) |
---|
1910 | ENDIF |
---|
1911 | ENDIF |
---|
1912 | |
---|
1913 | CASE ( 'qv', '#qv' ) |
---|
1914 | IF ( .NOT. bulk_cloud_model ) THEN |
---|
1915 | dopr_index(i) = 41 |
---|
1916 | dopr_unit(i) = 'kg/kg' |
---|
1917 | hom(:,2,41,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1918 | IF ( data_output_pr(i)(1:1) == '#' ) THEN |
---|
1919 | dopr_initial_index(i) = 26 |
---|
1920 | hom(:,2,26,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1921 | hom(nzb,2,26,:) = 0.0_wp ! because zu(nzb) is negative |
---|
1922 | data_output_pr(i) = data_output_pr(i)(2:) |
---|
1923 | ENDIF |
---|
1924 | ELSE |
---|
1925 | dopr_index(i) = 42 |
---|
1926 | dopr_unit(i) = 'kg/kg' |
---|
1927 | hom(:,2,42,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1928 | IF ( data_output_pr(i)(1:1) == '#' ) THEN |
---|
1929 | dopr_initial_index(i) = 27 |
---|
1930 | hom(:,2,27,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1931 | hom(nzb,2,27,:) = 0.0_wp ! because zu(nzb) is negative |
---|
1932 | data_output_pr(i) = data_output_pr(i)(2:) |
---|
1933 | ENDIF |
---|
1934 | ENDIF |
---|
1935 | |
---|
1936 | CASE ( 'thetal', '#thetal' ) |
---|
1937 | IF ( .NOT. bulk_cloud_model ) THEN |
---|
1938 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
1939 | ' is not implemented for bulk_cloud_model = .FALSE.' |
---|
1940 | CALL message( 'check_parameters', 'PA0094', 1, 2, 0, 6, 0 ) |
---|
1941 | ELSE |
---|
1942 | dopr_index(i) = 4 |
---|
1943 | dopr_unit(i) = 'K' |
---|
1944 | hom(:,2,4,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1945 | IF ( data_output_pr(i)(1:1) == '#' ) THEN |
---|
1946 | dopr_initial_index(i) = 7 |
---|
1947 | hom(:,2,7,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1948 | hom(nzb,2,7,:) = 0.0_wp ! because zu(nzb) is negative |
---|
1949 | data_output_pr(i) = data_output_pr(i)(2:) |
---|
1950 | ENDIF |
---|
1951 | ENDIF |
---|
1952 | |
---|
1953 | CASE ( 'thetav', '#thetav' ) |
---|
1954 | dopr_index(i) = 44 |
---|
1955 | dopr_unit(i) = 'K' |
---|
1956 | hom(:,2,44,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1957 | IF ( data_output_pr(i)(1:1) == '#' ) THEN |
---|
1958 | dopr_initial_index(i) = 29 |
---|
1959 | hom(:,2,29,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
1960 | hom(nzb,2,29,:) = 0.0_wp ! because zu(nzb) is negative |
---|
1961 | data_output_pr(i) = data_output_pr(i)(2:) |
---|
1962 | ENDIF |
---|
1963 | |
---|
1964 | CASE ( 'w"thetav"' ) |
---|
1965 | dopr_index(i) = 45 |
---|
1966 | dopr_unit(i) = TRIM ( heatflux_output_unit ) |
---|
1967 | hom(:,2,45,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1968 | |
---|
1969 | CASE ( 'w*thetav*' ) |
---|
1970 | dopr_index(i) = 46 |
---|
1971 | dopr_unit(i) = TRIM ( heatflux_output_unit ) |
---|
1972 | hom(:,2,46,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1973 | |
---|
1974 | CASE ( 'wthetav' ) |
---|
1975 | dopr_index(i) = 47 |
---|
1976 | dopr_unit(i) = TRIM ( heatflux_output_unit ) |
---|
1977 | hom(:,2,47,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1978 | |
---|
1979 | CASE ( 'w"q"' ) |
---|
1980 | IF ( .NOT. humidity ) THEN |
---|
1981 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
1982 | ' is not implemented for humidity = .FALSE.' |
---|
1983 | CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 ) |
---|
1984 | ELSE |
---|
1985 | dopr_index(i) = 48 |
---|
1986 | dopr_unit(i) = TRIM ( waterflux_output_unit ) |
---|
1987 | hom(:,2,48,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1988 | ENDIF |
---|
1989 | |
---|
1990 | CASE ( 'w*q*' ) |
---|
1991 | IF ( .NOT. humidity ) THEN |
---|
1992 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
1993 | ' is not implemented for humidity = .FALSE.' |
---|
1994 | CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 ) |
---|
1995 | ELSE |
---|
1996 | dopr_index(i) = 49 |
---|
1997 | dopr_unit(i) = TRIM ( waterflux_output_unit ) |
---|
1998 | hom(:,2,49,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
1999 | ENDIF |
---|
2000 | |
---|
2001 | CASE ( 'wq' ) |
---|
2002 | IF ( .NOT. humidity ) THEN |
---|
2003 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
2004 | ' is not implemented for humidity = .FALSE.' |
---|
2005 | CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 ) |
---|
2006 | ELSE |
---|
2007 | dopr_index(i) = 50 |
---|
2008 | dopr_unit(i) = TRIM ( waterflux_output_unit ) |
---|
2009 | hom(:,2,50,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
2010 | ENDIF |
---|
2011 | |
---|
2012 | CASE ( 'w"s"' ) |
---|
2013 | IF ( .NOT. passive_scalar ) THEN |
---|
2014 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
2015 | ' is not implemented for passive_scalar = .FALSE.' |
---|
2016 | CALL message( 'check_parameters', 'PA0093', 1, 2, 0, 6, 0 ) |
---|
2017 | ELSE |
---|
2018 | dopr_index(i) = 117 |
---|
2019 | dopr_unit(i) = 'kg/m3 m/s' |
---|
2020 | hom(:,2,117,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
2021 | ENDIF |
---|
2022 | |
---|
2023 | CASE ( 'w*s*' ) |
---|
2024 | IF ( .NOT. passive_scalar ) THEN |
---|
2025 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
2026 | ' is not implemented for passive_scalar = .FALSE.' |
---|
2027 | CALL message( 'check_parameters', 'PA0093', 1, 2, 0, 6, 0 ) |
---|
2028 | ELSE |
---|
2029 | dopr_index(i) = 114 |
---|
2030 | dopr_unit(i) = 'kg/m3 m/s' |
---|
2031 | hom(:,2,114,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
2032 | ENDIF |
---|
2033 | |
---|
2034 | CASE ( 'ws' ) |
---|
2035 | IF ( .NOT. passive_scalar ) THEN |
---|
2036 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
2037 | ' is not implemented for passive_scalar = .FALSE.' |
---|
2038 | CALL message( 'check_parameters', 'PA0093', 1, 2, 0, 6, 0 ) |
---|
2039 | ELSE |
---|
2040 | dopr_index(i) = 118 |
---|
2041 | dopr_unit(i) = 'kg/m3 m/s' |
---|
2042 | hom(:,2,118,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
2043 | ENDIF |
---|
2044 | |
---|
2045 | CASE ( 'w"qv"' ) |
---|
2046 | IF ( humidity .AND. .NOT. bulk_cloud_model ) THEN |
---|
2047 | dopr_index(i) = 48 |
---|
2048 | dopr_unit(i) = TRIM ( waterflux_output_unit ) |
---|
2049 | hom(:,2,48,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
2050 | ELSEIF ( humidity .AND. bulk_cloud_model ) THEN |
---|
2051 | dopr_index(i) = 51 |
---|
2052 | dopr_unit(i) = TRIM ( waterflux_output_unit ) |
---|
2053 | hom(:,2,51,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
2054 | ELSE |
---|
2055 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
2056 | ' is not implemented for bulk_cloud_model = .FALSE. ' // & |
---|
2057 | 'and humidity = .FALSE.' |
---|
2058 | CALL message( 'check_parameters', 'PA0095', 1, 2, 0, 6, 0 ) |
---|
2059 | ENDIF |
---|
2060 | |
---|
2061 | CASE ( 'w*qv*' ) |
---|
2062 | IF ( humidity .AND. .NOT. bulk_cloud_model ) THEN |
---|
2063 | dopr_index(i) = 49 |
---|
2064 | dopr_unit(i) = TRIM ( waterflux_output_unit ) |
---|
2065 | hom(:,2,49,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
2066 | ELSEIF( humidity .AND. bulk_cloud_model ) THEN |
---|
2067 | dopr_index(i) = 52 |
---|
2068 | dopr_unit(i) = TRIM ( waterflux_output_unit ) |
---|
2069 | hom(:,2,52,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
2070 | ELSE |
---|
2071 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
2072 | ' is not implemented for bulk_cloud_model = .FALSE. ' // & |
---|
2073 | 'and humidity = .FALSE.' |
---|
2074 | CALL message( 'check_parameters', 'PA0095', 1, 2, 0, 6, 0 ) |
---|
2075 | ENDIF |
---|
2076 | |
---|
2077 | CASE ( 'wqv' ) |
---|
2078 | IF ( humidity .AND. .NOT. bulk_cloud_model ) THEN |
---|
2079 | dopr_index(i) = 50 |
---|
2080 | dopr_unit(i) = TRIM ( waterflux_output_unit ) |
---|
2081 | hom(:,2,50,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
2082 | ELSEIF ( humidity .AND. bulk_cloud_model ) THEN |
---|
2083 | dopr_index(i) = 53 |
---|
2084 | dopr_unit(i) = TRIM ( waterflux_output_unit ) |
---|
2085 | hom(:,2,53,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
2086 | ELSE |
---|
2087 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
2088 | ' is not implemented for bulk_cloud_model = .FALSE. ' // & |
---|
2089 | 'and humidity = .FALSE.' |
---|
2090 | CALL message( 'check_parameters', 'PA0095', 1, 2, 0, 6, 0 ) |
---|
2091 | ENDIF |
---|
2092 | |
---|
2093 | CASE ( 'ql' ) |
---|
2094 | IF ( .NOT. bulk_cloud_model .AND. .NOT. cloud_droplets ) THEN |
---|
2095 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
2096 | ' is not implemented for bulk_cloud_model = .FALSE. ' // & |
---|
2097 | 'and cloud_droplets = .FALSE.' |
---|
2098 | CALL message( 'check_parameters', 'PA0096', 1, 2, 0, 6, 0 ) |
---|
2099 | ELSE |
---|
2100 | dopr_index(i) = 54 |
---|
2101 | dopr_unit(i) = 'kg/kg' |
---|
2102 | hom(:,2,54,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2103 | ENDIF |
---|
2104 | |
---|
2105 | CASE ( 'w*u*u*:dz' ) |
---|
2106 | dopr_index(i) = 55 |
---|
2107 | dopr_unit(i) = 'm2/s3' |
---|
2108 | hom(:,2,55,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2109 | |
---|
2110 | CASE ( 'w*p*:dz' ) |
---|
2111 | dopr_index(i) = 56 |
---|
2112 | dopr_unit(i) = 'm2/s3' |
---|
2113 | hom(:,2,56,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
2114 | |
---|
2115 | CASE ( 'w"e:dz' ) |
---|
2116 | dopr_index(i) = 57 |
---|
2117 | dopr_unit(i) = 'm2/s3' |
---|
2118 | hom(:,2,57,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2119 | |
---|
2120 | CASE ( 'u"theta"' ) |
---|
2121 | dopr_index(i) = 58 |
---|
2122 | dopr_unit(i) = TRIM ( heatflux_output_unit ) |
---|
2123 | hom(:,2,58,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2124 | |
---|
2125 | CASE ( 'u*theta*' ) |
---|
2126 | dopr_index(i) = 59 |
---|
2127 | dopr_unit(i) = TRIM ( heatflux_output_unit ) |
---|
2128 | hom(:,2,59,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2129 | |
---|
2130 | CASE ( 'utheta_t' ) |
---|
2131 | dopr_index(i) = 60 |
---|
2132 | dopr_unit(i) = TRIM ( heatflux_output_unit ) |
---|
2133 | hom(:,2,60,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2134 | |
---|
2135 | CASE ( 'v"theta"' ) |
---|
2136 | dopr_index(i) = 61 |
---|
2137 | dopr_unit(i) = TRIM ( heatflux_output_unit ) |
---|
2138 | hom(:,2,61,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2139 | |
---|
2140 | CASE ( 'v*theta*' ) |
---|
2141 | dopr_index(i) = 62 |
---|
2142 | dopr_unit(i) = TRIM ( heatflux_output_unit ) |
---|
2143 | hom(:,2,62,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2144 | |
---|
2145 | CASE ( 'vtheta_t' ) |
---|
2146 | dopr_index(i) = 63 |
---|
2147 | dopr_unit(i) = TRIM ( heatflux_output_unit ) |
---|
2148 | hom(:,2,63,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2149 | |
---|
2150 | CASE ( 'w*p*' ) |
---|
2151 | dopr_index(i) = 68 |
---|
2152 | dopr_unit(i) = 'm3/s3' |
---|
2153 | hom(:,2,68,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2154 | |
---|
2155 | CASE ( 'w"e' ) |
---|
2156 | dopr_index(i) = 69 |
---|
2157 | dopr_unit(i) = 'm3/s3' |
---|
2158 | hom(:,2,69,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2159 | |
---|
2160 | CASE ( 'q*2' ) |
---|
2161 | IF ( .NOT. humidity ) THEN |
---|
2162 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
2163 | ' is not implemented for humidity = .FALSE.' |
---|
2164 | CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 ) |
---|
2165 | ELSE |
---|
2166 | dopr_index(i) = 70 |
---|
2167 | dopr_unit(i) = 'kg2/kg2' |
---|
2168 | hom(:,2,70,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2169 | ENDIF |
---|
2170 | |
---|
2171 | CASE ( 'hyp' ) |
---|
2172 | dopr_index(i) = 72 |
---|
2173 | dopr_unit(i) = 'hPa' |
---|
2174 | hom(:,2,72,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2175 | |
---|
2176 | CASE ( 'rho' ) |
---|
2177 | dopr_index(i) = 119 |
---|
2178 | dopr_unit(i) = 'kg/m3' |
---|
2179 | hom(:,2,119,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2180 | |
---|
2181 | CASE ( 'rho_zw' ) |
---|
2182 | dopr_index(i) = 120 |
---|
2183 | dopr_unit(i) = 'kg/m3' |
---|
2184 | hom(:,2,120,:) = SPREAD( zw, 2, statistic_regions+1 ) |
---|
2185 | |
---|
2186 | CASE ( 'ug' ) |
---|
2187 | dopr_index(i) = 78 |
---|
2188 | dopr_unit(i) = 'm/s' |
---|
2189 | hom(:,2,78,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2190 | |
---|
2191 | CASE ( 'vg' ) |
---|
2192 | dopr_index(i) = 79 |
---|
2193 | dopr_unit(i) = 'm/s' |
---|
2194 | hom(:,2,79,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2195 | |
---|
2196 | CASE ( 'w_subs' ) |
---|
2197 | IF ( .NOT. large_scale_subsidence ) THEN |
---|
2198 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
2199 | ' is not implemented for large_scale_subsidence = .FALSE.' |
---|
2200 | CALL message( 'check_parameters', 'PA0382', 1, 2, 0, 6, 0 ) |
---|
2201 | ELSE |
---|
2202 | dopr_index(i) = 80 |
---|
2203 | dopr_unit(i) = 'm/s' |
---|
2204 | hom(:,2,80,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2205 | ENDIF |
---|
2206 | |
---|
2207 | CASE ( 's*2' ) |
---|
2208 | IF ( .NOT. passive_scalar ) THEN |
---|
2209 | message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & |
---|
2210 | ' is not implemented for passive_scalar = .FALSE.' |
---|
2211 | CALL message( 'check_parameters', 'PA0185', 1, 2, 0, 6, 0 ) |
---|
2212 | ELSE |
---|
2213 | dopr_index(i) = 116 |
---|
2214 | dopr_unit(i) = 'kg2/m6' |
---|
2215 | hom(:,2,116,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2216 | ENDIF |
---|
2217 | |
---|
2218 | CASE ( 'eta' ) |
---|
2219 | dopr_index(i) = 121 |
---|
2220 | dopr_unit(i) = 'mm' |
---|
2221 | hom(:,2,121,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
2222 | |
---|
2223 | kolmogorov_length_scale = .TRUE. |
---|
2224 | |
---|
2225 | CASE DEFAULT |
---|
2226 | unit = 'illegal' |
---|
2227 | ! |
---|
2228 | !-- Check for other modules |
---|
2229 | CALL module_interface_check_data_output_pr( data_output_pr(i), i, unit, dopr_unit(i) ) |
---|
2230 | |
---|
2231 | ! |
---|
2232 | !-- No valid quantity found |
---|
2233 | IF ( unit == 'illegal' ) THEN |
---|
2234 | IF ( data_output_pr_user(1) /= ' ' ) THEN |
---|
2235 | message_string = 'illegal value for data_output_pr or ' // & |
---|
2236 | 'data_output_pr_user = "' // TRIM( data_output_pr(i) ) // '"' |
---|
2237 | CALL message( 'check_parameters', 'PA0097', 1, 2, 0, 6, 0 ) |
---|
2238 | ELSE |
---|
2239 | message_string = 'illegal value for data_output_pr = "' // & |
---|
2240 | TRIM( data_output_pr(i) ) // '"' |
---|
2241 | CALL message( 'check_parameters', 'PA0098', 1, 2, 0, 6, 0 ) |
---|
2242 | ENDIF |
---|
2243 | ENDIF |
---|
2244 | |
---|
2245 | END SELECT |
---|
2246 | |
---|
2247 | ENDDO |
---|
2248 | |
---|
2249 | |
---|
2250 | ! |
---|
2251 | !-- Append user-defined data output variables to the standard data output |
---|
2252 | IF ( data_output_user(1) /= ' ' ) THEN |
---|
2253 | i = 1 |
---|
2254 | DO WHILE ( data_output(i) /= ' ' .AND. i <= 500 ) |
---|
2255 | i = i + 1 |
---|
2256 | ENDDO |
---|
2257 | j = 1 |
---|
2258 | DO WHILE ( data_output_user(j) /= ' ' .AND. j <= 500 ) |
---|
2259 | IF ( i > 500 ) THEN |
---|
2260 | message_string = 'number of output quantitities given by data' // & |
---|
2261 | '_output and data_output_user exceeds the limit of 500' |
---|
2262 | CALL message( 'check_parameters', 'PA0102', 1, 2, 0, 6, 0 ) |
---|
2263 | ENDIF |
---|
2264 | data_output(i) = data_output_user(j) |
---|
2265 | i = i + 1 |
---|
2266 | j = j + 1 |
---|
2267 | ENDDO |
---|
2268 | ENDIF |
---|
2269 | ! |
---|
2270 | !-- Check data-output variable list for any duplicates and remove them |
---|
2271 | ALLOCATE( data_output_filtered(1:UBOUND( data_output, DIM=1 )) ) |
---|
2272 | CALL filter_duplicate_strings( varnamelength, data_output, data_output_filtered ) |
---|
2273 | data_output = data_output_filtered |
---|
2274 | DEALLOCATE( data_output_filtered ) |
---|
2275 | ! |
---|
2276 | !-- Check and set steering parameters for 2d/3d data output and averaging |
---|
2277 | i = 1 |
---|
2278 | DO WHILE ( data_output(i) /= ' ' .AND. i <= 500 ) |
---|
2279 | ! |
---|
2280 | !-- Check for data averaging |
---|
2281 | ilen = LEN_TRIM( data_output(i) ) |
---|
2282 | j = 0 ! no data averaging |
---|
2283 | IF ( ilen > 3 ) THEN |
---|
2284 | IF ( data_output(i)(ilen-2:ilen) == '_av' ) THEN |
---|
2285 | j = 1 ! data averaging |
---|
2286 | data_output(i) = data_output(i)(1:ilen-3) |
---|
2287 | ENDIF |
---|
2288 | ENDIF |
---|
2289 | ! |
---|
2290 | !-- Check for cross section or volume data |
---|
2291 | ilen = LEN_TRIM( data_output(i) ) |
---|
2292 | k = 0 ! 3d data |
---|
2293 | var = data_output(i)(1:ilen) |
---|
2294 | IF ( ilen > 3 ) THEN |
---|
2295 | IF ( data_output(i)(ilen-2:ilen) == '_xy' .OR. data_output(i)(ilen-2:ilen) == '_xz' & |
---|
2296 | .OR. data_output(i)(ilen-2:ilen) == '_yz' ) THEN |
---|
2297 | k = 1 ! 2d data |
---|
2298 | var = data_output(i)(1:ilen-3) |
---|
2299 | ENDIF |
---|
2300 | ENDIF |
---|
2301 | |
---|
2302 | ! |
---|
2303 | !-- Check for allowed value and set units |
---|
2304 | SELECT CASE ( TRIM( var ) ) |
---|
2305 | |
---|
2306 | CASE ( 'e' ) |
---|
2307 | IF ( constant_diffusion ) THEN |
---|
2308 | message_string = 'output of "' // TRIM( var ) // '" requires ' // & |
---|
2309 | 'constant_diffusion = .FALSE.' |
---|
2310 | CALL message( 'check_parameters', 'PA0103', 1, 2, 0, 6, 0 ) |
---|
2311 | ENDIF |
---|
2312 | unit = 'm2/s2' |
---|
2313 | |
---|
2314 | CASE ( 'thetal' ) |
---|
2315 | IF ( .NOT. bulk_cloud_model ) THEN |
---|
2316 | message_string = 'output of "' // TRIM( var ) // '" requires ' // & |
---|
2317 | 'bulk_cloud_model = .TRUE.' |
---|
2318 | CALL message( 'check_parameters', 'PA0108', 1, 2, 0, 6, 0 ) |
---|
2319 | ENDIF |
---|
2320 | unit = 'K' |
---|
2321 | |
---|
2322 | CASE ( 'pc', 'pr' ) |
---|
2323 | IF ( .NOT. particle_advection ) THEN |
---|
2324 | message_string = 'output of "' // TRIM( var ) // '" requires ' // & |
---|
2325 | 'a "particle_parameters"-NAMELIST in the parameter file (PARIN)' |
---|
2326 | CALL message( 'check_parameters', 'PA0104', 1, 2, 0, 6, 0 ) |
---|
2327 | ENDIF |
---|
2328 | IF ( TRIM( var ) == 'pc' ) unit = 'number' |
---|
2329 | IF ( TRIM( var ) == 'pr' ) unit = 'm' |
---|
2330 | |
---|
2331 | CASE ( 'q', 'thetav' ) |
---|
2332 | IF ( .NOT. humidity ) THEN |
---|
2333 | message_string = 'output of "' // TRIM( var ) // '" requires humidity = .TRUE.' |
---|
2334 | CALL message( 'check_parameters', 'PA0105', 1, 2, 0, 6, 0 ) |
---|
2335 | ENDIF |
---|
2336 | IF ( TRIM( var ) == 'q' ) unit = 'kg/kg' |
---|
2337 | IF ( TRIM( var ) == 'thetav' ) unit = 'K' |
---|
2338 | |
---|
2339 | CASE ( 'ql' ) |
---|
2340 | IF ( .NOT. ( bulk_cloud_model .OR. cloud_droplets ) ) THEN |
---|
2341 | message_string = 'output of "' // TRIM( var ) // '" requires ' // & |
---|
2342 | 'bulk_cloud_model = .TRUE. or cloud_droplets = .TRUE.' |
---|
2343 | CALL message( 'check_parameters', 'PA0106', 1, 2, 0, 6, 0 ) |
---|
2344 | ENDIF |
---|
2345 | unit = 'kg/kg' |
---|
2346 | |
---|
2347 | CASE ( 'ql_c', 'ql_v', 'ql_vp' ) |
---|
2348 | IF ( .NOT. cloud_droplets ) THEN |
---|
2349 | message_string = 'output of "' // TRIM( var ) // '" requires ' // & |
---|
2350 | 'cloud_droplets = .TRUE.' |
---|
2351 | CALL message( 'check_parameters', 'PA0107', 1, 2, 0, 6, 0 ) |
---|
2352 | ENDIF |
---|
2353 | IF ( TRIM( var ) == 'ql_c' ) unit = 'kg/kg' |
---|
2354 | IF ( TRIM( var ) == 'ql_v' ) unit = 'm3' |
---|
2355 | IF ( TRIM( var ) == 'ql_vp' ) unit = 'none' |
---|
2356 | |
---|
2357 | CASE ( 'qv' ) |
---|
2358 | IF ( .NOT. bulk_cloud_model ) THEN |
---|
2359 | message_string = 'output of "' // TRIM( var ) // '" requires ' // & |
---|
2360 | 'bulk_cloud_model = .TRUE.' |
---|
2361 | CALL message( 'check_parameters', 'PA0108', 1, 2, 0, 6, 0 ) |
---|
2362 | ENDIF |
---|
2363 | unit = 'kg/kg' |
---|
2364 | |
---|
2365 | CASE ( 's' ) |
---|
2366 | IF ( .NOT. passive_scalar ) THEN |
---|
2367 | message_string = 'output of "' // TRIM( var ) // '" requires ' // & |
---|
2368 | 'passive_scalar = .TRUE.' |
---|
2369 | CALL message( 'check_parameters', 'PA0110', 1, 2, 0, 6, 0 ) |
---|
2370 | ENDIF |
---|
2371 | unit = 'kg/m3' |
---|
2372 | |
---|
2373 | CASE ( 'p', 'theta', 'u', 'v', 'w' ) |
---|
2374 | IF ( TRIM( var ) == 'p' ) unit = 'Pa' |
---|
2375 | IF ( TRIM( var ) == 'theta' ) unit = 'K' |
---|
2376 | IF ( TRIM( var ) == 'u' ) unit = 'm/s' |
---|
2377 | IF ( TRIM( var ) == 'v' ) unit = 'm/s' |
---|
2378 | IF ( TRIM( var ) == 'w' ) unit = 'm/s' |
---|
2379 | CONTINUE |
---|
2380 | |
---|
2381 | CASE ( 'ghf*', 'lwp*', 'ol*', 'qsurf*', 'qsws*', 'r_a*', 'shf*', 'ssurf*', 'ssws*', 't*',& |
---|
2382 | 'tsurf*', 'us*', 'z0*', 'z0h*', 'z0q*' ) |
---|
2383 | IF ( k == 0 .OR. data_output(i)(ilen-2:ilen) /= '_xy' ) THEN |
---|
2384 | message_string = 'illegal value for data_output: "' // TRIM( var ) // & |
---|
2385 | '" & only 2d-horizontal cross sections are allowed for this value' |
---|
2386 | CALL message( 'check_parameters', 'PA0111', 1, 2, 0, 6, 0 ) |
---|
2387 | ENDIF |
---|
2388 | |
---|
2389 | IF ( TRIM( var ) == 'lwp*' .AND. .NOT. bulk_cloud_model ) THEN |
---|
2390 | message_string = 'output of "' // TRIM( var ) // '" requires ' // & |
---|
2391 | 'bulk_cloud_model = .TRUE.' |
---|
2392 | CALL message( 'check_parameters', 'PA0108', 1, 2, 0, 6, 0 ) |
---|
2393 | ENDIF |
---|
2394 | IF ( TRIM( var ) == 'qsws*' .AND. .NOT. humidity ) THEN |
---|
2395 | message_string = 'output of "' // TRIM( var ) // '" requires humidity = .TRUE.' |
---|
2396 | CALL message( 'check_parameters', 'PA0322', 1, 2, 0, 6, 0 ) |
---|
2397 | ENDIF |
---|
2398 | |
---|
2399 | IF ( TRIM( var ) == 'ghf*' .AND. .NOT. land_surface ) THEN |
---|
2400 | message_string = 'output of "' // TRIM( var ) // '" requires land_surface = .TRUE.' |
---|
2401 | CALL message( 'check_parameters', 'PA0404', 1, 2, 0, 6, 0 ) |
---|
2402 | ENDIF |
---|
2403 | |
---|
2404 | IF ( ( TRIM( var ) == 'r_a*' .OR. TRIM( var ) == 'ghf*' ) .AND. .NOT. land_surface & |
---|
2405 | .AND. .NOT. urban_surface ) THEN |
---|
2406 | message_string = 'output of "' // TRIM( var ) // '" requires ' // & |
---|
2407 | 'land_surface = .TRUE. or ' // 'urban_surface = .TRUE.' |
---|
2408 | CALL message( 'check_parameters', 'PA0404', 1, 2, 0, 6, 0 ) |
---|
2409 | ENDIF |
---|
2410 | |
---|
2411 | IF ( TRIM( var ) == 'ssws*' .AND. .NOT. passive_scalar ) THEN |
---|
2412 | message_string = 'output of "' // TRIM( var ) // '" requires ' // & |
---|
2413 | 'passive_scalar = .TRUE.' |
---|
2414 | CALL message( 'check_parameters', 'PA0361', 1, 2, 0, 6, 0 ) |
---|
2415 | ENDIF |
---|
2416 | |
---|
2417 | IF ( TRIM( var ) == 'ghf*' ) unit = 'W/m2' |
---|
2418 | IF ( TRIM( var ) == 'lwp*' ) unit = 'kg/m2' |
---|
2419 | IF ( TRIM( var ) == 'ol*' ) unit = 'm' |
---|
2420 | IF ( TRIM( var ) == 'qsurf*' ) unit = 'kg/kg' |
---|
2421 | IF ( TRIM( var ) == 'qsws*' ) unit = 'kgm/kgs' |
---|
2422 | IF ( TRIM( var ) == 'r_a*' ) unit = 's/m' |
---|
2423 | IF ( TRIM( var ) == 'shf*' ) unit = 'K*m/s' |
---|
2424 | IF ( TRIM( var ) == 'ssurf*' ) unit = 'kg/kg' |
---|
2425 | IF ( TRIM( var ) == 'ssws*' ) unit = 'kg/m2*s' |
---|
2426 | IF ( TRIM( var ) == 't*' ) unit = 'K' |
---|
2427 | IF ( TRIM( var ) == 'tsurf*' ) unit = 'K' |
---|
2428 | IF ( TRIM( var ) == 'us*' ) unit = 'm/s' |
---|
2429 | IF ( TRIM( var ) == 'z0*' ) unit = 'm' |
---|
2430 | IF ( TRIM( var ) == 'z0h*' ) unit = 'm' |
---|
2431 | ! |
---|
2432 | !-- Output of surface latent and sensible heat flux will be in W/m2 in case of natural- and |
---|
2433 | !-- urban-type surfaces, even if flux_output_mode is set to kinematic units. |
---|
2434 | IF ( land_surface .OR. urban_surface ) THEN |
---|
2435 | IF ( TRIM( var ) == 'shf*' ) unit = 'W/m2' |
---|
2436 | IF ( TRIM( var ) == 'qsws*' ) unit = 'W/m2' |
---|
2437 | ENDIF |
---|
2438 | |
---|
2439 | CASE DEFAULT |
---|
2440 | ! |
---|
2441 | !-- Check for other modules |
---|
2442 | CALL module_interface_check_data_output( var, unit, i, j, ilen, k ) |
---|
2443 | |
---|
2444 | IF ( unit == 'illegal' ) THEN |
---|
2445 | IF ( data_output_user(1) /= ' ' ) THEN |
---|
2446 | message_string = 'illegal value for data_output or ' // & |
---|
2447 | 'data_output_user = "' // TRIM( data_output(i) ) // '"' |
---|
2448 | CALL message( 'check_parameters', 'PA0114', 1, 2, 0, 6, 0 ) |
---|
2449 | ELSE |
---|
2450 | message_string = 'illegal value for data_output = "' // & |
---|
2451 | TRIM( data_output(i) ) // '"' |
---|
2452 | CALL message( 'check_parameters', 'PA0115', 1, 2, 0, 6, 0 ) |
---|
2453 | ENDIF |
---|
2454 | ENDIF |
---|
2455 | |
---|
2456 | END SELECT |
---|
2457 | ! |
---|
2458 | !-- Set the internal steering parameters appropriately |
---|
2459 | IF ( k == 0 ) THEN |
---|
2460 | do3d_no(j) = do3d_no(j) + 1 |
---|
2461 | do3d(j,do3d_no(j)) = data_output(i) |
---|
2462 | do3d_unit(j,do3d_no(j)) = unit |
---|
2463 | ELSE |
---|
2464 | do2d_no(j) = do2d_no(j) + 1 |
---|
2465 | do2d(j,do2d_no(j)) = data_output(i) |
---|
2466 | do2d_unit(j,do2d_no(j)) = unit |
---|
2467 | IF ( data_output(i)(ilen-2:ilen) == '_xy' ) THEN |
---|
2468 | data_output_xy(j) = .TRUE. |
---|
2469 | ENDIF |
---|
2470 | IF ( data_output(i)(ilen-2:ilen) == '_xz' ) THEN |
---|
2471 | data_output_xz(j) = .TRUE. |
---|
2472 | ENDIF |
---|
2473 | IF ( data_output(i)(ilen-2:ilen) == '_yz' ) THEN |
---|
2474 | data_output_yz(j) = .TRUE. |
---|
2475 | ENDIF |
---|
2476 | ENDIF |
---|
2477 | |
---|
2478 | IF ( j == 1 ) THEN |
---|
2479 | ! |
---|
2480 | !-- Check, if variable is already subject to averaging |
---|
2481 | found = .FALSE. |
---|
2482 | DO k = 1, doav_n |
---|
2483 | IF ( TRIM( doav(k) ) == TRIM( var ) ) found = .TRUE. |
---|
2484 | ENDDO |
---|
2485 | |
---|
2486 | IF ( .NOT. found ) THEN |
---|
2487 | doav_n = doav_n + 1 |
---|
2488 | doav(doav_n) = var |
---|
2489 | ENDIF |
---|
2490 | ENDIF |
---|
2491 | |
---|
2492 | i = i + 1 |
---|
2493 | ENDDO |
---|
2494 | |
---|
2495 | ! |
---|
2496 | !-- Averaged 2d or 3d output requires that an averaging interval has been set |
---|
2497 | IF ( doav_n > 0 .AND. averaging_interval == 0.0_wp ) THEN |
---|
2498 | WRITE( message_string, * ) 'output of averaged quantity "', TRIM( doav(1) ), & |
---|
2499 | '_av" requires to set a ', 'non-zero averaging interval' |
---|
2500 | CALL message( 'check_parameters', 'PA0323', 1, 2, 0, 6, 0 ) |
---|
2501 | ENDIF |
---|
2502 | |
---|
2503 | ! |
---|
2504 | !-- Check sectional planes and store them in one shared array |
---|
2505 | IF ( ANY( section_xy > nz + 1 ) ) THEN |
---|
2506 | WRITE( message_string, * ) 'section_xy must be <= nz + 1 = ', nz + 1 |
---|
2507 | CALL message( 'check_parameters', 'PA0319', 1, 2, 0, 6, 0 ) |
---|
2508 | ENDIF |
---|
2509 | IF ( ANY( section_xz > ny + 1 ) ) THEN |
---|
2510 | WRITE( message_string, * ) 'section_xz must be <= ny + 1 = ', ny + 1 |
---|
2511 | CALL message( 'check_parameters', 'PA0320', 1, 2, 0, 6, 0 ) |
---|
2512 | ENDIF |
---|
2513 | IF ( ANY( section_yz > nx + 1 ) ) THEN |
---|
2514 | WRITE( message_string, * ) 'section_yz must be <= nx + 1 = ', nx + 1 |
---|
2515 | CALL message( 'check_parameters', 'PA0321', 1, 2, 0, 6, 0 ) |
---|
2516 | ENDIF |
---|
2517 | section(:,1) = section_xy |
---|
2518 | section(:,2) = section_xz |
---|
2519 | section(:,3) = section_yz |
---|
2520 | |
---|
2521 | IF ( ANY( data_output_xy ) .AND. .NOT. ANY( section(:,1) /= -9999 ) ) THEN |
---|
2522 | WRITE( message_string, * ) 'section_xy not defined for requested xy-cross section ' // & |
---|
2523 | 'output.&At least one cross section must be given.' |
---|
2524 | CALL message( 'check_parameters', 'PA0681', 1, 2, 0, 6, 0 ) |
---|
2525 | ENDIF |
---|
2526 | IF ( ANY( data_output_xz ) .AND. .NOT. ANY( section(:,2) /= -9999 ) ) THEN |
---|
2527 | WRITE( message_string, * ) 'section_xz not defined for requested xz-cross section ' // & |
---|
2528 | 'output.&At least one cross section must be given.' |
---|
2529 | CALL message( 'check_parameters', 'PA0681', 1, 2, 0, 6, 0 ) |
---|
2530 | ENDIF |
---|
2531 | IF ( ANY( data_output_yz ) .AND. .NOT. ANY( section(:,3) /= -9999 ) ) THEN |
---|
2532 | WRITE( message_string, * ) 'section_yz not defined for requested yz-cross section ' // & |
---|
2533 | 'output.&At least one cross section must be given.' |
---|
2534 | CALL message( 'check_parameters', 'PA0681', 1, 2, 0, 6, 0 ) |
---|
2535 | ENDIF |
---|
2536 | ! |
---|
2537 | !-- Upper plot limit for 3D arrays |
---|
2538 | IF ( nz_do3d == -9999 ) nz_do3d = nzt + 1 |
---|
2539 | |
---|
2540 | ! |
---|
2541 | !-- Set output format string (used in header) |
---|
2542 | SELECT CASE ( netcdf_data_format ) |
---|
2543 | CASE ( 1 ) |
---|
2544 | netcdf_data_format_string = 'netCDF classic' |
---|
2545 | CASE ( 2 ) |
---|
2546 | netcdf_data_format_string = 'netCDF 64bit offset' |
---|
2547 | CASE ( 3 ) |
---|
2548 | netcdf_data_format_string = 'netCDF4/HDF5' |
---|
2549 | CASE ( 4 ) |
---|
2550 | netcdf_data_format_string = 'netCDF4/HDF5 classic' |
---|
2551 | CASE ( 5 ) |
---|
2552 | netcdf_data_format_string = 'parallel netCDF4/HDF5' |
---|
2553 | CASE ( 6 ) |
---|
2554 | netcdf_data_format_string = 'parallel netCDF4/HDF5 classic' |
---|
2555 | |
---|
2556 | END SELECT |
---|
2557 | |
---|
2558 | ! |
---|
2559 | !-- Check mask conditions |
---|
2560 | DO mid = 1, max_masks |
---|
2561 | IF ( data_output_masks(mid,1) /= ' ' .OR. data_output_masks_user(mid,1) /= ' ' ) THEN |
---|
2562 | masks = masks + 1 |
---|
2563 | ENDIF |
---|
2564 | ENDDO |
---|
2565 | |
---|
2566 | IF ( masks < 0 .OR. masks > max_masks ) THEN |
---|
2567 | WRITE( message_string, * ) 'illegal value: masks must be >= 0 and ', '<= ', max_masks, & |
---|
2568 | ' (=max_masks)' |
---|
2569 | CALL message( 'check_parameters', 'PA0325', 1, 2, 0, 6, 0 ) |
---|
2570 | ENDIF |
---|
2571 | IF ( masks > 0 ) THEN |
---|
2572 | mask_scale(1) = mask_scale_x |
---|
2573 | mask_scale(2) = mask_scale_y |
---|
2574 | mask_scale(3) = mask_scale_z |
---|
2575 | IF ( ANY( mask_scale <= 0.0_wp ) ) THEN |
---|
2576 | WRITE( message_string, * ) 'illegal value: mask_scale_x, mask_scale_y and mask_scale_z',& |
---|
2577 | 'must be > 0.0' |
---|
2578 | CALL message( 'check_parameters', 'PA0326', 1, 2, 0, 6, 0 ) |
---|
2579 | ENDIF |
---|
2580 | ! |
---|
2581 | !-- Generate masks for masked data output. |
---|
2582 | !-- Parallel netcdf output is not tested so far for masked data, hence netcdf_data_format is |
---|
2583 | !-- switched back to non-parallel output. |
---|
2584 | netcdf_data_format_save = netcdf_data_format |
---|
2585 | IF ( netcdf_data_format > 4 ) THEN |
---|
2586 | IF ( netcdf_data_format == 5 ) netcdf_data_format = 3 |
---|
2587 | IF ( netcdf_data_format == 6 ) netcdf_data_format = 4 |
---|
2588 | message_string = 'netCDF file formats '// '5 (parallel netCDF 4) and 6 (parallel ' // & |
---|
2589 | 'netCDF 4 Classic model) & are currently not supported (not yet ' // & |
---|
2590 | 'tested) for masked data. &Using respective non-parallel' // & |
---|
2591 | ' output for masked data.' |
---|
2592 | CALL message( 'check_parameters', 'PA0383', 0, 0, 0, 6, 0 ) |
---|
2593 | ENDIF |
---|
2594 | CALL init_masks |
---|
2595 | netcdf_data_format = netcdf_data_format_save |
---|
2596 | ENDIF |
---|
2597 | |
---|
2598 | ! |
---|
2599 | !-- Check the NetCDF data format |
---|
2600 | IF ( netcdf_data_format > 2 ) THEN |
---|
2601 | #if defined( __netcdf4 ) |
---|
2602 | CONTINUE |
---|
2603 | #else |
---|
2604 | message_string = 'netCDF: netCDF4 format requested but no ' // & |
---|
2605 | 'cpp-directive __netcdf4 given & switch back to 64-bit offset format' |
---|
2606 | CALL message( 'check_parameters', 'PA0171', 0, 1, 0, 6, 0 ) |
---|
2607 | netcdf_data_format = 2 |
---|
2608 | #endif |
---|
2609 | ENDIF |
---|
2610 | IF ( netcdf_data_format > 4 ) THEN |
---|
2611 | #if defined( __netcdf4 ) && defined( __netcdf4_parallel ) |
---|
2612 | CONTINUE |
---|
2613 | #else |
---|
2614 | message_string = 'netCDF: netCDF4 parallel output requested but no ' // & |
---|
2615 | 'cpp-directive __netcdf4_parallel given & switch ' // & |
---|
2616 | 'back to netCDF4 non-parallel output' |
---|
2617 | CALL message( 'check_parameters', 'PA0099', 0, 1, 0, 6, 0 ) |
---|
2618 | netcdf_data_format = netcdf_data_format - 2 |
---|
2619 | #endif |
---|
2620 | ENDIF |
---|
2621 | |
---|
2622 | ! |
---|
2623 | !-- Calculate fixed number of output time levels for parallel netcdf output. |
---|
2624 | !-- The time dimension has to be defined as limited for parallel output, because otherwise the I/O |
---|
2625 | !-- performance drops significantly. |
---|
2626 | IF ( netcdf_data_format > 4 ) THEN |
---|
2627 | |
---|
2628 | ! |
---|
2629 | !-- Check if any of the follwoing data output interval is 0.0s, which is not allowed for parallel |
---|
2630 | !-- output. |
---|
2631 | CALL check_dt_do( dt_do3d, 'dt_do3d' ) |
---|
2632 | CALL check_dt_do( dt_do2d_xy, 'dt_do2d_xy' ) |
---|
2633 | CALL check_dt_do( dt_do2d_xz, 'dt_do2d_xz' ) |
---|
2634 | CALL check_dt_do( dt_do2d_yz, 'dt_do2d_yz' ) |
---|
2635 | CALL check_dt_do( dt_data_output_av, 'dt_data_output_av' ) |
---|
2636 | |
---|
2637 | !-- Set needed time levels (ntdim) to saved time levels + to be saved time levels. |
---|
2638 | ntdim_3d(0) = do3d_time_count(0) + CEILING( & |
---|
2639 | ( end_time - MAX( & |
---|
2640 | MERGE( skip_time_do3d, skip_time_do3d + spinup_time, & |
---|
2641 | data_output_during_spinup ), & |
---|
2642 | simulated_time_at_begin ) & |
---|
2643 | ) / dt_do3d ) |
---|
2644 | IF ( do3d_at_begin ) ntdim_3d(0) = ntdim_3d(0) + 1 |
---|
2645 | |
---|
2646 | ntdim_3d(1) = do3d_time_count(1) + CEILING( & |
---|
2647 | ( end_time - MAX( & |
---|
2648 | MERGE( skip_time_data_output_av, skip_time_data_output_av + spinup_time, & |
---|
2649 | data_output_during_spinup ), & |
---|
2650 | simulated_time_at_begin ) & |
---|
2651 | ) / dt_data_output_av ) |
---|
2652 | |
---|
2653 | ntdim_2d_xy(0) = do2d_xy_time_count(0) + CEILING( & |
---|
2654 | ( end_time - MAX( & |
---|
2655 | MERGE( skip_time_do2d_xy, skip_time_do2d_xy + spinup_time, & |
---|
2656 | data_output_during_spinup ), & |
---|
2657 | simulated_time_at_begin ) & |
---|
2658 | ) / dt_do2d_xy ) |
---|
2659 | |
---|
2660 | ntdim_2d_xz(0) = do2d_xz_time_count(0) + CEILING( & |
---|
2661 | ( end_time - MAX( & |
---|
2662 | MERGE( skip_time_do2d_xz, skip_time_do2d_xz + spinup_time, & |
---|
2663 | data_output_during_spinup ), & |
---|
2664 | simulated_time_at_begin ) & |
---|
2665 | ) / dt_do2d_xz ) |
---|
2666 | |
---|
2667 | ntdim_2d_yz(0) = do2d_yz_time_count(0) + CEILING( & |
---|
2668 | ( end_time - MAX( & |
---|
2669 | MERGE( skip_time_do2d_yz, skip_time_do2d_yz + spinup_time, & |
---|
2670 | data_output_during_spinup ), & |
---|
2671 | simulated_time_at_begin ) & |
---|
2672 | ) / dt_do2d_yz ) |
---|
2673 | |
---|
2674 | IF ( do2d_at_begin ) THEN |
---|
2675 | ntdim_2d_xy(0) = ntdim_2d_xy(0) + 1 |
---|
2676 | ntdim_2d_xz(0) = ntdim_2d_xz(0) + 1 |
---|
2677 | ntdim_2d_yz(0) = ntdim_2d_yz(0) + 1 |
---|
2678 | ENDIF |
---|
2679 | ! |
---|
2680 | !-- Please note, for averaged 2D data skip_time_data_output_av is the relavant output control |
---|
2681 | !-- parameter. |
---|
2682 | ntdim_2d_xy(1) = do2d_xy_time_count(1) + CEILING( & |
---|
2683 | ( end_time - MAX( MERGE( skip_time_data_output_av, & |
---|
2684 | skip_time_data_output_av + spinup_time, & |
---|
2685 | data_output_during_spinup ), & |
---|
2686 | simulated_time_at_begin ) & |
---|
2687 | ) / dt_data_output_av ) |
---|
2688 | |
---|
2689 | ntdim_2d_xz(1) = do2d_xz_time_count(1) + CEILING( & |
---|
2690 | ( end_time - MAX( MERGE( skip_time_data_output_av, & |
---|
2691 | skip_time_data_output_av + spinup_time, & |
---|
2692 | data_output_during_spinup ), & |
---|
2693 | simulated_time_at_begin ) & |
---|
2694 | ) / dt_data_output_av ) |
---|
2695 | |
---|
2696 | ntdim_2d_yz(1) = do2d_yz_time_count(1) + CEILING( & |
---|
2697 | ( end_time - MAX( MERGE( skip_time_data_output_av, & |
---|
2698 | skip_time_data_output_av + spinup_time, & |
---|
2699 | data_output_during_spinup ), & |
---|
2700 | simulated_time_at_begin ) & |
---|
2701 | ) / dt_data_output_av ) |
---|
2702 | |
---|
2703 | ENDIF |
---|
2704 | |
---|
2705 | ! |
---|
2706 | !-- Check, whether a constant diffusion coefficient shall be used |
---|
2707 | IF ( km_constant /= -1.0_wp ) THEN |
---|
2708 | IF ( km_constant < 0.0_wp ) THEN |
---|
2709 | WRITE( message_string, * ) 'km_constant = ', km_constant, ' < 0.0' |
---|
2710 | CALL message( 'check_parameters', 'PA0121', 1, 2, 0, 6, 0 ) |
---|
2711 | ELSE |
---|
2712 | IF ( prandtl_number < 0.0_wp ) THEN |
---|
2713 | WRITE( message_string, * ) 'prandtl_number = ', prandtl_number, ' < 0.0' |
---|
2714 | CALL message( 'check_parameters', 'PA0122', 1, 2, 0, 6, 0 ) |
---|
2715 | ENDIF |
---|
2716 | constant_diffusion = .TRUE. |
---|
2717 | |
---|
2718 | IF ( constant_flux_layer ) THEN |
---|
2719 | message_string = 'constant_flux_layer is not allowed with fixed value of km' |
---|
2720 | CALL message( 'check_parameters', 'PA0123', 1, 2, 0, 6, 0 ) |
---|
2721 | ENDIF |
---|
2722 | ENDIF |
---|
2723 | ENDIF |
---|
2724 | |
---|
2725 | ! |
---|
2726 | !-- In case of non-cyclic lateral boundaries and a damping layer for the potential temperature, |
---|
2727 | !-- check the width of the damping layer |
---|
2728 | IF ( bc_lr /= 'cyclic' ) THEN |
---|
2729 | IF ( pt_damping_width < 0.0_wp .OR. pt_damping_width > REAL( (nx+1) * dx ) ) THEN |
---|
2730 | message_string = 'pt_damping_width out of range' |
---|
2731 | CALL message( 'check_parameters', 'PA0124', 1, 2, 0, 6, 0 ) |
---|
2732 | ENDIF |
---|
2733 | ENDIF |
---|
2734 | |
---|
2735 | IF ( bc_ns /= 'cyclic' ) THEN |
---|
2736 | IF ( pt_damping_width < 0.0_wp .OR. pt_damping_width > REAL( (ny+1) * dy ) ) THEN |
---|
2737 | message_string = 'pt_damping_width out of range' |
---|
2738 | CALL message( 'check_parameters', 'PA0124', 1, 2, 0, 6, 0 ) |
---|
2739 | ENDIF |
---|
2740 | ENDIF |
---|
2741 | |
---|
2742 | ! |
---|
2743 | !-- Check value range for zeta = z/L |
---|
2744 | IF ( zeta_min >= zeta_max ) THEN |
---|
2745 | WRITE( message_string, * ) 'zeta_min = ', zeta_min, ' must be less ', 'than zeta_max = ', & |
---|
2746 | zeta_max |
---|
2747 | CALL message( 'check_parameters', 'PA0125', 1, 2, 0, 6, 0 ) |
---|
2748 | ENDIF |
---|
2749 | |
---|
2750 | ! |
---|
2751 | !-- Check random generator |
---|
2752 | IF ( (random_generator /= 'system-specific' .AND. & |
---|
2753 | random_generator /= 'random-parallel' ) .AND. & |
---|
2754 | random_generator /= 'numerical-recipes' ) THEN |
---|
2755 | message_string = 'unknown random generator: random_generator = "' // & |
---|
2756 | TRIM( random_generator ) // '"' |
---|
2757 | CALL message( 'check_parameters', 'PA0135', 1, 2, 0, 6, 0 ) |
---|
2758 | ENDIF |
---|
2759 | |
---|
2760 | ! |
---|
2761 | !-- Determine upper and lower hight level indices for random perturbations |
---|
2762 | IF ( disturbance_level_b == -9999999.9_wp ) THEN |
---|
2763 | IF ( ocean_mode ) THEN |
---|
2764 | disturbance_level_b = zu((nzt*2)/3) |
---|
2765 | disturbance_level_ind_b = ( nzt * 2 ) / 3 |
---|
2766 | ELSE |
---|
2767 | disturbance_level_b = zu(nzb+3) |
---|
2768 | disturbance_level_ind_b = nzb + 3 |
---|
2769 | ENDIF |
---|
2770 | ELSEIF ( disturbance_level_b < zu(3) ) THEN |
---|
2771 | WRITE( message_string, * ) 'disturbance_level_b = ', disturbance_level_b, ' must be >= ', & |
---|
2772 | zu(3), '(zu(3))' |
---|
2773 | CALL message( 'check_parameters', 'PA0126', 1, 2, 0, 6, 0 ) |
---|
2774 | ELSEIF ( disturbance_level_b > zu(nzt-2) ) THEN |
---|
2775 | WRITE( message_string, * ) 'disturbance_level_b = ', disturbance_level_b, ' must be <= ', & |
---|
2776 | zu(nzt-2), '(zu(nzt-2))' |
---|
2777 | CALL message( 'check_parameters', 'PA0127', 1, 2, 0, 6, 0 ) |
---|
2778 | ELSE |
---|
2779 | DO k = 3, nzt-2 |
---|
2780 | IF ( disturbance_level_b <= zu(k) ) THEN |
---|
2781 | disturbance_level_ind_b = k |
---|
2782 | EXIT |
---|
2783 | ENDIF |
---|
2784 | ENDDO |
---|
2785 | ENDIF |
---|
2786 | |
---|
2787 | IF ( disturbance_level_t == -9999999.9_wp ) THEN |
---|
2788 | IF ( ocean_mode ) THEN |
---|
2789 | disturbance_level_t = zu(nzt-3) |
---|
2790 | disturbance_level_ind_t = nzt - 3 |
---|
2791 | ELSE |
---|
2792 | disturbance_level_t = zu(nzt/3) |
---|
2793 | disturbance_level_ind_t = nzt / 3 |
---|
2794 | ENDIF |
---|
2795 | ELSEIF ( disturbance_level_t > zu(nzt-2) ) THEN |
---|
2796 | WRITE( message_string, * ) 'disturbance_level_t = ', disturbance_level_t, ' must be <= ', & |
---|
2797 | zu(nzt-2), '(zu(nzt-2))' |
---|
2798 | CALL message( 'check_parameters', 'PA0128', 1, 2, 0, 6, 0 ) |
---|
2799 | ELSEIF ( disturbance_level_t < disturbance_level_b ) THEN |
---|
2800 | WRITE( message_string, * ) 'disturbance_level_t = ', disturbance_level_t, & |
---|
2801 | ' must be >= disturbance_level_b = ', disturbance_level_b |
---|
2802 | CALL message( 'check_parameters', 'PA0129', 1, 2, 0, 6, 0 ) |
---|
2803 | ELSE |
---|
2804 | DO k = 3, nzt-2 |
---|
2805 | IF ( disturbance_level_t <= zu(k) ) THEN |
---|
2806 | disturbance_level_ind_t = k |
---|
2807 | EXIT |
---|
2808 | ENDIF |
---|
2809 | ENDDO |
---|
2810 | ENDIF |
---|
2811 | |
---|
2812 | ! |
---|
2813 | !-- Check again whether the levels determined this way are ok. |
---|
2814 | !-- Error may occur at automatic determination and too few grid points in z-direction. |
---|
2815 | IF ( disturbance_level_ind_t < disturbance_level_ind_b ) THEN |
---|
2816 | WRITE( message_string, * ) 'disturbance_level_ind_t = ', disturbance_level_ind_t, & |
---|
2817 | ' must be >= ', 'disturbance_level_ind_b = ', disturbance_level_ind_b |
---|
2818 | CALL message( 'check_parameters', 'PA0130', 1, 2, 0, 6, 0 ) |
---|
2819 | ENDIF |
---|
2820 | |
---|
2821 | ! |
---|
2822 | !-- Determine the horizontal index range for random perturbations. |
---|
2823 | !-- In case of non-cyclic horizontal boundaries, no perturbations are imposed near the inflow and |
---|
2824 | !-- the perturbation area is further limited to ...(1) after the initial phase of the flow. |
---|
2825 | |
---|
2826 | IF ( bc_lr /= 'cyclic' ) THEN |
---|
2827 | IF ( inflow_disturbance_begin == -1 ) THEN |
---|
2828 | inflow_disturbance_begin = MIN( 10, nx/2 ) |
---|
2829 | ENDIF |
---|
2830 | IF ( inflow_disturbance_begin < 0 .OR. inflow_disturbance_begin > nx ) THEN |
---|
2831 | message_string = 'inflow_disturbance_begin out of range' |
---|
2832 | CALL message( 'check_parameters', 'PA0131', 1, 2, 0, 6, 0 ) |
---|
2833 | ENDIF |
---|
2834 | IF ( inflow_disturbance_end == -1 ) THEN |
---|
2835 | inflow_disturbance_end = MIN( 100, 3*nx/4 ) |
---|
2836 | ENDIF |
---|
2837 | IF ( inflow_disturbance_end < 0 .OR. inflow_disturbance_end > nx ) THEN |
---|
2838 | message_string = 'inflow_disturbance_end out of range' |
---|
2839 | CALL message( 'check_parameters', 'PA0132', 1, 2, 0, 6, 0 ) |
---|
2840 | ENDIF |
---|
2841 | ELSEIF ( bc_ns /= 'cyclic' ) THEN |
---|
2842 | IF ( inflow_disturbance_begin == -1 ) THEN |
---|
2843 | inflow_disturbance_begin = MIN( 10, ny/2 ) |
---|
2844 | ENDIF |
---|
2845 | IF ( inflow_disturbance_begin < 0 .OR. inflow_disturbance_begin > ny ) THEN |
---|
2846 | message_string = 'inflow_disturbance_begin out of range' |
---|
2847 | CALL message( 'check_parameters', 'PA0131', 1, 2, 0, 6, 0 ) |
---|
2848 | ENDIF |
---|
2849 | IF ( inflow_disturbance_end == -1 ) THEN |
---|
2850 | inflow_disturbance_end = MIN( 100, 3*ny/4 ) |
---|
2851 | ENDIF |
---|
2852 | IF ( inflow_disturbance_end < 0 .OR. inflow_disturbance_end > ny ) THEN |
---|
2853 | message_string = 'inflow_disturbance_end out of range' |
---|
2854 | CALL message( 'check_parameters', 'PA0132', 1, 2, 0, 6, 0 ) |
---|
2855 | ENDIF |
---|
2856 | ENDIF |
---|
2857 | |
---|
2858 | IF ( random_generator == 'random-parallel' ) THEN |
---|
2859 | dist_nxl = nxl; dist_nxr = nxr |
---|
2860 | dist_nys = nys; dist_nyn = nyn |
---|
2861 | IF ( bc_lr == 'radiation/dirichlet' ) THEN |
---|
2862 | dist_nxr = MIN( nx - inflow_disturbance_begin, nxr ) |
---|
2863 | dist_nxl(1) = MAX( nx - inflow_disturbance_end, nxl ) |
---|
2864 | ELSEIF ( bc_lr == 'dirichlet/radiation' ) THEN |
---|
2865 | dist_nxl = MAX( inflow_disturbance_begin, nxl ) |
---|
2866 | dist_nxr(1) = MIN( inflow_disturbance_end, nxr ) |
---|
2867 | ELSEIF ( bc_lr == 'nested' .OR. bc_lr == 'nesting_offline' ) THEN |
---|
2868 | dist_nxl = MAX( inflow_disturbance_begin, nxl ) |
---|
2869 | dist_nxr = MIN( nx - inflow_disturbance_begin, nxr ) |
---|
2870 | ENDIF |
---|
2871 | IF ( bc_ns == 'dirichlet/radiation' ) THEN |
---|
2872 | dist_nyn = MIN( ny - inflow_disturbance_begin, nyn ) |
---|
2873 | dist_nys(1) = MAX( ny - inflow_disturbance_end, nys ) |
---|
2874 | ELSEIF ( bc_ns == 'radiation/dirichlet' ) THEN |
---|
2875 | dist_nys = MAX( inflow_disturbance_begin, nys ) |
---|
2876 | dist_nyn(1) = MIN( inflow_disturbance_end, nyn ) |
---|
2877 | ELSEIF ( bc_ns == 'nested' .OR. bc_ns == 'nesting_offline' ) THEN |
---|
2878 | dist_nys = MAX( inflow_disturbance_begin, nys ) |
---|
2879 | dist_nyn = MIN( ny - inflow_disturbance_begin, nyn ) |
---|
2880 | ENDIF |
---|
2881 | ELSE |
---|
2882 | dist_nxl = 0; dist_nxr = nx |
---|
2883 | dist_nys = 0; dist_nyn = ny |
---|
2884 | IF ( bc_lr == 'radiation/dirichlet' ) THEN |
---|
2885 | dist_nxr = nx - inflow_disturbance_begin |
---|
2886 | dist_nxl(1) = nx - inflow_disturbance_end |
---|
2887 | ELSEIF ( bc_lr == 'dirichlet/radiation' ) THEN |
---|
2888 | dist_nxl = inflow_disturbance_begin |
---|
2889 | dist_nxr(1) = inflow_disturbance_end |
---|
2890 | ELSEIF ( bc_lr == 'nested' .OR. bc_lr == 'nesting_offline' ) THEN |
---|
2891 | dist_nxr = nx - inflow_disturbance_begin |
---|
2892 | dist_nxl = inflow_disturbance_begin |
---|
2893 | ENDIF |
---|
2894 | IF ( bc_ns == 'dirichlet/radiation' ) THEN |
---|
2895 | dist_nyn = ny - inflow_disturbance_begin |
---|
2896 | dist_nys(1) = ny - inflow_disturbance_end |
---|
2897 | ELSEIF ( bc_ns == 'radiation/dirichlet' ) THEN |
---|
2898 | dist_nys = inflow_disturbance_begin |
---|
2899 | dist_nyn(1) = inflow_disturbance_end |
---|
2900 | ELSEIF ( bc_ns == 'nested' .OR. bc_ns == 'nesting_offline' ) THEN |
---|
2901 | dist_nyn = ny - inflow_disturbance_begin |
---|
2902 | dist_nys = inflow_disturbance_begin |
---|
2903 | ENDIF |
---|
2904 | ENDIF |
---|
2905 | |
---|
2906 | ! |
---|
2907 | !-- A turbulent inflow requires Dirichlet conditions at the respective inflow boundary (so far, a |
---|
2908 | !-- turbulent inflow is realized from the left side only). |
---|
2909 | IF ( turbulent_inflow .AND. bc_lr /= 'dirichlet/radiation' ) THEN |
---|
2910 | message_string = 'turbulent_inflow = .T. requires a Dirichlet ' // & |
---|
2911 | 'condition at the inflow boundary' |
---|
2912 | CALL message( 'check_parameters', 'PA0133', 1, 2, 0, 6, 0 ) |
---|
2913 | ENDIF |
---|
2914 | |
---|
2915 | ! |
---|
2916 | !-- Turbulent inflow requires that 3d arrays have been cyclically filled with data from prerun in |
---|
2917 | !-- the first main run |
---|
2918 | IF ( turbulent_inflow .AND. initializing_actions /= 'cyclic_fill' .AND. & |
---|
2919 | initializing_actions /= 'read_restart_data' ) THEN |
---|
2920 | message_string = 'turbulent_inflow = .T. requires ' // & |
---|
2921 | 'initializing_actions = ''cyclic_fill'' or ' // & |
---|
2922 | 'initializing_actions = ''read_restart_data'' ' |
---|
2923 | CALL message( 'check_parameters', 'PA0055', 1, 2, 0, 6, 0 ) |
---|
2924 | ENDIF |
---|
2925 | |
---|
2926 | ! |
---|
2927 | !-- In case of turbulent inflow |
---|
2928 | IF ( turbulent_inflow ) THEN |
---|
2929 | |
---|
2930 | ! |
---|
2931 | !-- Calculate the index of the recycling plane |
---|
2932 | IF ( recycling_width <= dx .OR. recycling_width >= nx * dx ) THEN |
---|
2933 | WRITE( message_string, * ) 'illegal value for recycling_width: ', recycling_width |
---|
2934 | CALL message( 'check_parameters', 'PA0134', 1, 2, 0, 6, 0 ) |
---|
2935 | ENDIF |
---|
2936 | ! |
---|
2937 | !-- Calculate the index |
---|
2938 | recycling_plane = recycling_width / dx |
---|
2939 | ! |
---|
2940 | !-- Check for correct input of recycling method for thermodynamic quantities |
---|
2941 | IF ( TRIM( recycling_method_for_thermodynamic_quantities ) /= 'turbulent_fluctuation' .AND.& |
---|
2942 | TRIM( recycling_method_for_thermodynamic_quantities ) /= 'absolute_value' ) THEN |
---|
2943 | WRITE( message_string, * ) 'unknown recycling method for thermodynamic quantities: ', & |
---|
2944 | TRIM( recycling_method_for_thermodynamic_quantities ) |
---|
2945 | CALL message( 'check_parameters', 'PA0184', 1, 2, 0, 6, 0 ) |
---|
2946 | ENDIF |
---|
2947 | |
---|
2948 | ENDIF |
---|
2949 | |
---|
2950 | |
---|
2951 | IF ( turbulent_outflow ) THEN |
---|
2952 | ! |
---|
2953 | !-- Turbulent outflow requires Dirichlet conditions at the respective inflow boundary (so far, a |
---|
2954 | !-- turbulent outflow is realized at the right side only). |
---|
2955 | IF ( bc_lr /= 'dirichlet/radiation' ) THEN |
---|
2956 | message_string = 'turbulent_outflow = .T. requires bc_lr = "dirichlet/radiation"' |
---|
2957 | CALL message( 'check_parameters', 'PA0038', 1, 2, 0, 6, 0 ) |
---|
2958 | ENDIF |
---|
2959 | ! |
---|
2960 | !-- The ouflow-source plane must lay inside the model domain |
---|
2961 | IF ( outflow_source_plane < dx .OR. outflow_source_plane > nx * dx ) THEN |
---|
2962 | WRITE( message_string, * ) 'illegal value for outflow_source'// '_plane: ', & |
---|
2963 | outflow_source_plane |
---|
2964 | CALL message( 'check_parameters', 'PA0145', 1, 2, 0, 6, 0 ) |
---|
2965 | ENDIF |
---|
2966 | ENDIF |
---|
2967 | |
---|
2968 | ! |
---|
2969 | !-- Determine damping level index for 1D model |
---|
2970 | IF ( INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) THEN |
---|
2971 | IF ( damp_level_1d == -1.0_wp ) THEN |
---|
2972 | damp_level_1d = zu(nzt+1) |
---|
2973 | damp_level_ind_1d = nzt + 1 |
---|
2974 | ELSEIF ( damp_level_1d < 0.0_wp .OR. damp_level_1d > zu(nzt+1) ) THEN |
---|
2975 | WRITE( message_string, * ) 'damp_level_1d = ', damp_level_1d, ' must be >= 0.0 and <= ',& |
---|
2976 | zu(nzt+1), '(zu(nzt+1))' |
---|
2977 | CALL message( 'check_parameters', 'PA0136', 1, 2, 0, 6, 0 ) |
---|
2978 | ELSE |
---|
2979 | DO k = 1, nzt+1 |
---|
2980 | IF ( damp_level_1d <= zu(k) ) THEN |
---|
2981 | damp_level_ind_1d = k |
---|
2982 | EXIT |
---|
2983 | ENDIF |
---|
2984 | ENDDO |
---|
2985 | ENDIF |
---|
2986 | ENDIF |
---|
2987 | |
---|
2988 | ! |
---|
2989 | !-- Check some other 1d-model parameters |
---|
2990 | IF ( TRIM( mixing_length_1d ) /= 'as_in_3d_model' .AND. & |
---|
2991 | TRIM( mixing_length_1d ) /= 'blackadar' ) THEN |
---|
2992 | message_string = 'mixing_length_1d = "' // TRIM( mixing_length_1d ) // '" is unknown' |
---|
2993 | CALL message( 'check_parameters', 'PA0137', 1, 2, 0, 6, 0 ) |
---|
2994 | ENDIF |
---|
2995 | IF ( TRIM( dissipation_1d ) /= 'as_in_3d_model' .AND. & |
---|
2996 | TRIM( dissipation_1d ) /= 'detering' .AND. & |
---|
2997 | TRIM( dissipation_1d ) /= 'prognostic' ) THEN |
---|
2998 | message_string = 'dissipation_1d = "' // TRIM( dissipation_1d ) // '" is unknown' |
---|
2999 | CALL message( 'check_parameters', 'PA0138', 1, 2, 0, 6, 0 ) |
---|
3000 | ENDIF |
---|
3001 | IF ( TRIM( mixing_length_1d ) /= 'as_in_3d_model' .AND. & |
---|
3002 | TRIM( dissipation_1d ) == 'as_in_3d_model' ) THEN |
---|
3003 | message_string = 'dissipation_1d = "' // TRIM( dissipation_1d ) // & |
---|
3004 | '" requires mixing_length_1d = "as_in_3d_model"' |
---|
3005 | CALL message( 'check_parameters', 'PA0485', 1, 2, 0, 6, 0 ) |
---|
3006 | ENDIF |
---|
3007 | |
---|
3008 | ! |
---|
3009 | !-- Set time for the next user defined restart (time_restart is the internal parameter for steering |
---|
3010 | !-- restart events) |
---|
3011 | IF ( restart_time /= 9999999.9_wp ) THEN |
---|
3012 | IF ( restart_time > time_since_reference_point ) THEN |
---|
3013 | time_restart = restart_time |
---|
3014 | ENDIF |
---|
3015 | ELSE |
---|
3016 | ! |
---|
3017 | !-- In case of a restart run, set internal parameter to default (no restart) if the |
---|
3018 | !-- NAMELIST-parameter restart_time is omitted |
---|
3019 | time_restart = 9999999.9_wp |
---|
3020 | ENDIF |
---|
3021 | |
---|
3022 | ! |
---|
3023 | !-- Check pressure gradient conditions |
---|
3024 | IF ( dp_external .AND. conserve_volume_flow ) THEN |
---|
3025 | WRITE( message_string, * ) 'Both dp_external and conserve_volume_flo', & |
---|
3026 | 'w are .TRUE. but one of them must be .FALSE.' |
---|
3027 | CALL message( 'check_parameters', 'PA0150', 1, 2, 0, 6, 0 ) |
---|
3028 | ENDIF |
---|
3029 | IF ( dp_external ) THEN |
---|
3030 | IF ( dp_level_b < zu(nzb) .OR. dp_level_b > zu(nzt) ) THEN |
---|
3031 | WRITE( message_string, * ) 'dp_level_b = ', dp_level_b, ' is out ', & |
---|
3032 | ' of range [zu(nzb), zu(nzt)]' |
---|
3033 | CALL message( 'check_parameters', 'PA0151', 1, 2, 0, 6, 0 ) |
---|
3034 | ENDIF |
---|
3035 | IF ( .NOT. ANY( dpdxy /= 0.0_wp ) ) THEN |
---|
3036 | WRITE( message_string, * ) 'dp_external is .TRUE. but dpdxy is ze', & |
---|
3037 | 'ro, i.e. the external pressure gradient will not be applied' |
---|
3038 | CALL message( 'check_parameters', 'PA0152', 0, 1, 0, 6, 0 ) |
---|
3039 | ENDIF |
---|
3040 | ENDIF |
---|
3041 | IF ( ANY( dpdxy /= 0.0_wp ) .AND. .NOT. dp_external ) THEN |
---|
3042 | WRITE( message_string, * ) 'dpdxy is nonzero but dp_external is ', & |
---|
3043 | '.FALSE., i.e. the external pressure gradient & will not be applied' |
---|
3044 | CALL message( 'check_parameters', 'PA0153', 0, 1, 0, 6, 0 ) |
---|
3045 | ENDIF |
---|
3046 | IF ( conserve_volume_flow ) THEN |
---|
3047 | IF ( TRIM( conserve_volume_flow_mode ) == 'default' ) THEN |
---|
3048 | |
---|
3049 | conserve_volume_flow_mode = 'initial_profiles' |
---|
3050 | |
---|
3051 | ELSEIF ( TRIM( conserve_volume_flow_mode ) /= 'initial_profiles' .AND. & |
---|
3052 | TRIM( conserve_volume_flow_mode ) /= 'bulk_velocity' ) THEN |
---|
3053 | WRITE( message_string, * ) 'unknown conserve_volume_flow_mode: ', & |
---|
3054 | conserve_volume_flow_mode |
---|
3055 | CALL message( 'check_parameters', 'PA0154', 1, 2, 0, 6, 0 ) |
---|
3056 | ENDIF |
---|
3057 | IF ( ( bc_lr /= 'cyclic' .OR. bc_ns /= 'cyclic') .AND. & |
---|
3058 | TRIM( conserve_volume_flow_mode ) == 'bulk_velocity' ) THEN |
---|
3059 | WRITE( message_string, * ) 'non-cyclic boundary conditions ', & |
---|
3060 | 'require conserve_volume_flow_mode = ''initial_profiles''' |
---|
3061 | CALL message( 'check_parameters', 'PA0155', 1, 2, 0, 6, 0 ) |
---|
3062 | ENDIF |
---|
3063 | ENDIF |
---|
3064 | IF ( ( u_bulk /= 0.0_wp .OR. v_bulk /= 0.0_wp ) .AND. & |
---|
3065 | ( .NOT. conserve_volume_flow .OR. TRIM( conserve_volume_flow_mode ) /= 'bulk_velocity' ) )& |
---|
3066 | THEN |
---|
3067 | WRITE( message_string, * ) 'nonzero bulk velocity requires ', & |
---|
3068 | 'conserve_volume_flow = .T. and ', 'conserve_volume_flow_mode = ''bulk_velocity''' |
---|
3069 | CALL message( 'check_parameters', 'PA0157', 1, 2, 0, 6, 0 ) |
---|
3070 | ENDIF |
---|
3071 | |
---|
3072 | ! |
---|
3073 | !-- Prevent empty time records in volume, cross-section and masked data in case of non-parallel |
---|
3074 | !-- netcdf-output in restart runs |
---|
3075 | IF ( netcdf_data_format < 5 ) THEN |
---|
3076 | IF ( TRIM( initializing_actions ) == 'read_restart_data' ) THEN |
---|
3077 | do3d_time_count = 0 |
---|
3078 | do2d_xy_time_count = 0 |
---|
3079 | do2d_xz_time_count = 0 |
---|
3080 | do2d_yz_time_count = 0 |
---|
3081 | domask_time_count = 0 |
---|
3082 | ENDIF |
---|
3083 | ENDIF |
---|
3084 | |
---|
3085 | |
---|
3086 | ! |
---|
3087 | !-- Check roughness length, which has to be smaller than dz/2 |
---|
3088 | IF ( ( constant_flux_layer .OR. INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) & |
---|
3089 | .AND. roughness_length >= 0.5 * dz(1) ) THEN |
---|
3090 | message_string = 'roughness_length must be smaller than dz/2' |
---|
3091 | CALL message( 'check_parameters', 'PA0424', 1, 2, 0, 6, 0 ) |
---|
3092 | ENDIF |
---|
3093 | |
---|
3094 | ! |
---|
3095 | !-- Check if topography is read from file in case of complex terrain simulations |
---|
3096 | IF ( complex_terrain .AND. TRIM( topography ) /= 'read_from_file' ) THEN |
---|
3097 | message_string = 'complex_terrain requires topography = ''read_from_file''' |
---|
3098 | CALL message( 'check_parameters', 'PA0295', 1, 2, 0, 6, 0 ) |
---|
3099 | ENDIF |
---|
3100 | |
---|
3101 | ! |
---|
3102 | !-- Check if vertical grid stretching is switched off in case of complex terrain simulations |
---|
3103 | IF ( complex_terrain .AND. ANY( dz_stretch_level_start /= -9999999.9_wp ) ) THEN |
---|
3104 | message_string = 'Vertical grid stretching is not allowed for complex_terrain = .TRUE.' |
---|
3105 | CALL message( 'check_parameters', 'PA0473', 1, 2, 0, 6, 0 ) |
---|
3106 | ENDIF |
---|
3107 | |
---|
3108 | CALL location_message( 'checking parameters', 'finished' ) |
---|
3109 | |
---|
3110 | CONTAINS |
---|
3111 | |
---|
3112 | !--------------------------------------------------------------------------------------------------! |
---|
3113 | ! Description: |
---|
3114 | ! ------------ |
---|
3115 | !> Check the length of data output intervals. In case of parallel NetCDF output the time levels of |
---|
3116 | !> the output files need to be fixed. Therefore setting the output interval to 0.0s (usually used to |
---|
3117 | !> output each timestep) is not possible as long as a non-fixed timestep is used. |
---|
3118 | !--------------------------------------------------------------------------------------------------! |
---|
3119 | |
---|
3120 | SUBROUTINE check_dt_do( dt_do, dt_do_name ) |
---|
3121 | |
---|
3122 | IMPLICIT NONE |
---|
3123 | |
---|
3124 | CHARACTER (LEN=*), INTENT (IN) :: dt_do_name !< parin variable name |
---|
3125 | |
---|
3126 | REAL(wp), INTENT (INOUT) :: dt_do !< data output interval |
---|
3127 | |
---|
3128 | IF ( dt_do == 0.0_wp ) THEN |
---|
3129 | IF ( dt_fixed ) THEN |
---|
3130 | WRITE( message_string, '(A,F9.4,A)' ) 'Output at every timestep is wanted (' // & |
---|
3131 | dt_do_name // ' = 0.0).&'// & |
---|
3132 | 'The output interval is set to the fixed timestep dt '// '= ', dt, 's.' |
---|
3133 | CALL message( 'check_parameters', 'PA0060', 0, 0, 0, 6, 0 ) |
---|
3134 | dt_do = dt |
---|
3135 | ELSE |
---|
3136 | message_string = dt_do_name // ' = 0.0 while using a ' // & |
---|
3137 | 'variable timestep and parallel netCDF4 is not allowed.' |
---|
3138 | CALL message( 'check_parameters', 'PA0081', 1, 2, 0, 6, 0 ) |
---|
3139 | ENDIF |
---|
3140 | ENDIF |
---|
3141 | |
---|
3142 | END SUBROUTINE check_dt_do |
---|
3143 | |
---|
3144 | |
---|
3145 | |
---|
3146 | !--------------------------------------------------------------------------------------------------! |
---|
3147 | ! Description: |
---|
3148 | ! ------------ |
---|
3149 | !> Set the bottom and top boundary conditions for humidity and scalars. |
---|
3150 | !--------------------------------------------------------------------------------------------------! |
---|
3151 | |
---|
3152 | SUBROUTINE set_bc_scalars( sq, bc_b, bc_t, ibc_b, ibc_t, err_nr_b, err_nr_t ) |
---|
3153 | |
---|
3154 | |
---|
3155 | IMPLICIT NONE |
---|
3156 | |
---|
3157 | CHARACTER (LEN=*) :: bc_b !< bottom boundary condition |
---|
3158 | CHARACTER (LEN=*) :: bc_t !< top boundary condition |
---|
3159 | CHARACTER (LEN=*) :: err_nr_b !< error number if bottom bc is unknown |
---|
3160 | CHARACTER (LEN=*) :: err_nr_t !< error number if top bc is unknown |
---|
3161 | CHARACTER (LEN=1) :: sq !< name of scalar quantity |
---|
3162 | |
---|
3163 | |
---|
3164 | INTEGER(iwp) :: ibc_b !< index for bottom boundary condition |
---|
3165 | INTEGER(iwp) :: ibc_t !< index for top boundary condition |
---|
3166 | |
---|
3167 | ! |
---|
3168 | !-- Set Integer flags and check for possilbe errorneous settings for bottom boundary condition |
---|
3169 | IF ( bc_b == 'dirichlet' ) THEN |
---|
3170 | ibc_b = 0 |
---|
3171 | ELSEIF ( bc_b == 'neumann' ) THEN |
---|
3172 | ibc_b = 1 |
---|
3173 | ELSE |
---|
3174 | message_string = 'unknown boundary condition: bc_' // TRIM( sq ) // '_b ="' // & |
---|
3175 | TRIM( bc_b ) // '"' |
---|
3176 | CALL message( 'check_parameters', err_nr_b, 1, 2, 0, 6, 0 ) |
---|
3177 | ENDIF |
---|
3178 | ! |
---|
3179 | !-- Set Integer flags and check for possilbe errorneous settings for top boundary condition |
---|
3180 | IF ( bc_t == 'dirichlet' ) THEN |
---|
3181 | ibc_t = 0 |
---|
3182 | ELSEIF ( bc_t == 'neumann' ) THEN |
---|
3183 | ibc_t = 1 |
---|
3184 | ELSEIF ( bc_t == 'initial_gradient' ) THEN |
---|
3185 | ibc_t = 2 |
---|
3186 | ELSEIF ( bc_t == 'nested' .OR. bc_t == 'nesting_offline' ) THEN |
---|
3187 | ibc_t = 3 |
---|
3188 | ELSE |
---|
3189 | message_string = 'unknown boundary condition: bc_' // TRIM( sq ) // '_t ="' // & |
---|
3190 | TRIM( bc_t ) // '"' |
---|
3191 | CALL message( 'check_parameters', err_nr_t, 1, 2, 0, 6, 0 ) |
---|
3192 | ENDIF |
---|
3193 | |
---|
3194 | |
---|
3195 | END SUBROUTINE set_bc_scalars |
---|
3196 | |
---|
3197 | |
---|
3198 | |
---|
3199 | !--------------------------------------------------------------------------------------------------! |
---|
3200 | ! Description: |
---|
3201 | ! ------------ |
---|
3202 | !> Check for consistent settings of bottom boundary conditions for humidity and scalars. |
---|
3203 | !--------------------------------------------------------------------------------------------------! |
---|
3204 | |
---|
3205 | SUBROUTINE check_bc_scalars( sq, bc_b, ibc_b, err_nr_1, err_nr_2, constant_flux, & |
---|
3206 | surface_initial_change ) |
---|
3207 | |
---|
3208 | |
---|
3209 | IMPLICIT NONE |
---|
3210 | |
---|
3211 | CHARACTER (LEN=*) :: bc_b !< bottom boundary condition |
---|
3212 | CHARACTER (LEN=*) :: err_nr_1 !< error number of first error |
---|
3213 | CHARACTER (LEN=*) :: err_nr_2 !< error number of second error |
---|
3214 | CHARACTER (LEN=1) :: sq !< name of scalar quantity |
---|
3215 | |
---|
3216 | |
---|
3217 | INTEGER(iwp) :: ibc_b !< index of bottom boundary condition |
---|
3218 | |
---|
3219 | LOGICAL :: constant_flux !< flag for constant-flux layer |
---|
3220 | |
---|
3221 | REAL(wp) :: surface_initial_change !< value of initial change at the surface |
---|
3222 | |
---|
3223 | ! |
---|
3224 | !-- A given surface value implies Dirichlet boundary condition for the respective quantity. In |
---|
3225 | !-- this case specification of a constant flux is forbidden. However, an exception is made for |
---|
3226 | !-- large-scale forcing as well as land-surface model. |
---|
3227 | IF ( .NOT. land_surface .AND. .NOT. large_scale_forcing ) THEN |
---|
3228 | IF ( ibc_b == 0 .AND. constant_flux ) THEN |
---|
3229 | message_string = 'boundary condition: bc_' // TRIM( sq ) // '_b = "' // & |
---|
3230 | TRIM( bc_b ) // '" is not allowed with prescribed surface flux' |
---|
3231 | CALL message( 'check_parameters', err_nr_1, 1, 2, 0, 6, 0 ) |
---|
3232 | ENDIF |
---|
3233 | ENDIF |
---|
3234 | IF ( constant_flux .AND. surface_initial_change /= 0.0_wp ) THEN |
---|
3235 | WRITE( message_string, * ) 'a prescribed surface flux is not allo', 'wed with ', sq, & |
---|
3236 | '_surface_initial_change (/=0) = ', surface_initial_change |
---|
3237 | CALL message( 'check_parameters', err_nr_2, 1, 2, 0, 6, 0 ) |
---|
3238 | ENDIF |
---|
3239 | |
---|
3240 | |
---|
3241 | END SUBROUTINE check_bc_scalars |
---|
3242 | |
---|
3243 | |
---|
3244 | |
---|
3245 | !--------------------------------------------------------------------------------------------------! |
---|
3246 | ! Description: |
---|
3247 | ! ------------ |
---|
3248 | !> Filter a list of strings for duplicates. The output list is of same length but does not contain |
---|
3249 | !> any duplicates. |
---|
3250 | !--------------------------------------------------------------------------------------------------! |
---|
3251 | |
---|
3252 | SUBROUTINE filter_duplicate_strings( string_length, string_list, string_list_filtered ) |
---|
3253 | |
---|
3254 | IMPLICIT NONE |
---|
3255 | |
---|
3256 | INTEGER, INTENT(IN) :: string_length !< length of a single string in list |
---|
3257 | |
---|
3258 | CHARACTER (LEN=*), DIMENSION(:), INTENT(IN) :: string_list !< non-filtered list |
---|
3259 | CHARACTER (LEN=string_length), DIMENSION(:), INTENT(OUT), ALLOCATABLE :: string_list_filtered !< filtered list |
---|
3260 | |
---|
3261 | CHARACTER (LEN=string_length) :: string_to_check !< string to be check for duplicates |
---|
3262 | |
---|
3263 | INTEGER(iwp) :: i !< loop index |
---|
3264 | INTEGER(iwp) :: j !< loop index |
---|
3265 | INTEGER(iwp) :: k !< loop index |
---|
3266 | INTEGER(iwp) :: nstrings !< number of strings in list |
---|
3267 | |
---|
3268 | LOGICAL :: is_duplicate !< true if string has duplicates in list |
---|
3269 | |
---|
3270 | |
---|
3271 | nstrings = UBOUND( string_list, DIM=1 ) |
---|
3272 | ALLOCATE( string_list_filtered(1:nstrings) ) |
---|
3273 | string_list_filtered(:) = ' ' |
---|
3274 | |
---|
3275 | k = 0 |
---|
3276 | DO i = 1, nstrings |
---|
3277 | string_to_check = string_list(i) |
---|
3278 | |
---|
3279 | IF ( string_to_check == ' ' ) EXIT |
---|
3280 | |
---|
3281 | is_duplicate = .FALSE. |
---|
3282 | DO j = 1, nstrings |
---|
3283 | IF ( string_list_filtered(j) == ' ' ) THEN |
---|
3284 | EXIT |
---|
3285 | ELSEIF ( string_to_check == string_list_filtered(j) ) THEN |
---|
3286 | is_duplicate = .TRUE. |
---|
3287 | EXIT |
---|
3288 | ENDIF |
---|
3289 | ENDDO |
---|
3290 | |
---|
3291 | IF ( .NOT. is_duplicate ) THEN |
---|
3292 | k = k + 1 |
---|
3293 | string_list_filtered(k) = string_to_check |
---|
3294 | ENDIF |
---|
3295 | |
---|
3296 | ENDDO |
---|
3297 | |
---|
3298 | END SUBROUTINE filter_duplicate_strings |
---|
3299 | |
---|
3300 | |
---|
3301 | END SUBROUTINE check_parameters |
---|