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