1 | !> @file gust_mod.f90 |
---|
2 | !--------------------------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General |
---|
6 | ! Public License as published by the Free Software Foundation, either version 3 of the License, or |
---|
7 | ! (at your option) any later version. |
---|
8 | ! |
---|
9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
---|
10 | ! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
11 | ! Public License for more details. |
---|
12 | ! |
---|
13 | ! You should have received a copy of the GNU General Public License along with PALM. If not, see |
---|
14 | ! <http://www.gnu.org/licenses/>. |
---|
15 | ! |
---|
16 | ! Copyright 1997-2021 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: gust_mod.f90 4842 2021-01-14 10:42:28Z raasch $ |
---|
26 | ! reading of namelist file and actions in case of namelist errors revised so that statement labels |
---|
27 | ! and goto statements are not required any more |
---|
28 | ! |
---|
29 | ! 4828 2021-01-05 11:21:41Z Giersch |
---|
30 | ! Enable 3D data output also with 64-bit precision |
---|
31 | ! |
---|
32 | ! 4646 2020-08-24 16:02:40Z raasch |
---|
33 | ! file re-formatted to follow the PALM coding standard |
---|
34 | ! |
---|
35 | ! 4535 2020-05-15 12:07:23Z raasch |
---|
36 | ! bugfix for restart data format query |
---|
37 | ! |
---|
38 | ! 4517 2020-05-03 14:29:30Z raasch |
---|
39 | ! added restart with MPI-IO for reading local arrays |
---|
40 | ! |
---|
41 | ! 4495 2020-04-13 20:11:20Z raasch |
---|
42 | ! restart data handling with MPI-IO added |
---|
43 | ! |
---|
44 | ! 4360 2020-01-07 11:25:50Z suehring |
---|
45 | ! CASE statement for dummy variable u2_av in gust_rrd_local changed to avoid unintended |
---|
46 | ! interdependencies with user-defined variables |
---|
47 | ! |
---|
48 | ! 3837 2019-03-28 16:55:58Z knoop |
---|
49 | ! unused variable for file index removed from rrd-subroutines parameter list |
---|
50 | ! |
---|
51 | ! 3725 2019-02-07 10:11:02Z raasch |
---|
52 | ! dummy statement modified to avoid compiler warnings about unused variables |
---|
53 | ! |
---|
54 | ! 3685 2019-01-21 01:02:11Z knoop |
---|
55 | ! Some interface calls moved to module_interface + cleanup |
---|
56 | ! |
---|
57 | ! 3665 2019-01-10 08:28:24Z raasch |
---|
58 | ! dummy statements added to avoid compiler warnings about unused variables |
---|
59 | ! |
---|
60 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
61 | ! Bugfix: domain bounds of local_pf corrected |
---|
62 | ! |
---|
63 | ! |
---|
64 | ! Interfaces concerning data output updated |
---|
65 | ! |
---|
66 | ! |
---|
67 | ! renamed gust_par to gust_parameters |
---|
68 | ! |
---|
69 | ! |
---|
70 | ! Initial interface definition |
---|
71 | ! |
---|
72 | ! |
---|
73 | ! Description: |
---|
74 | ! ------------ |
---|
75 | !> Gust model. |
---|
76 | !> |
---|
77 | !> @todo This is just a dummy module. The actual module ist not released yet. |
---|
78 | !--------------------------------------------------------------------------------------------------! |
---|
79 | MODULE gust_mod |
---|
80 | |
---|
81 | USE control_parameters, & |
---|
82 | ONLY: restart_data_format_output |
---|
83 | |
---|
84 | USE indices, & |
---|
85 | ONLY: nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb, nzt |
---|
86 | |
---|
87 | USE kinds |
---|
88 | |
---|
89 | ! USE restart_data_mpi_io_mod, & |
---|
90 | ! ONLY: |
---|
91 | |
---|
92 | IMPLICIT NONE |
---|
93 | |
---|
94 | INTEGER(iwp) :: idum !< dummy variable used to avoid compiler warnings about unused variables |
---|
95 | |
---|
96 | LOGICAL :: dummy_logical = .FALSE. !< switch to avoid compiler warnings about unused variables |
---|
97 | LOGICAL :: gust_module_enabled = .FALSE. !< switch, if the entire module is used at all |
---|
98 | |
---|
99 | SAVE |
---|
100 | |
---|
101 | PRIVATE |
---|
102 | |
---|
103 | ! |
---|
104 | !-- Public functions |
---|
105 | PUBLIC & |
---|
106 | gust_parin, & |
---|
107 | gust_check_parameters, & |
---|
108 | gust_check_data_output_pr, & |
---|
109 | gust_check_data_output, & |
---|
110 | gust_init_arrays, & |
---|
111 | gust_init, & |
---|
112 | gust_define_netcdf_grid, & |
---|
113 | gust_header, & |
---|
114 | gust_actions, & |
---|
115 | gust_prognostic_equations, & |
---|
116 | gust_swap_timelevel, & |
---|
117 | gust_3d_data_averaging, & |
---|
118 | gust_data_output_2d, & |
---|
119 | gust_data_output_3d, & |
---|
120 | gust_statistics, & |
---|
121 | gust_rrd_global, & |
---|
122 | gust_wrd_global, & |
---|
123 | gust_rrd_local, & |
---|
124 | gust_wrd_local |
---|
125 | ! |
---|
126 | !-- Public parameters, constants and initial values |
---|
127 | PUBLIC & |
---|
128 | gust_module_enabled |
---|
129 | |
---|
130 | |
---|
131 | INTERFACE gust_parin |
---|
132 | MODULE PROCEDURE gust_parin |
---|
133 | END INTERFACE gust_parin |
---|
134 | |
---|
135 | INTERFACE gust_check_parameters |
---|
136 | MODULE PROCEDURE gust_check_parameters |
---|
137 | END INTERFACE gust_check_parameters |
---|
138 | |
---|
139 | INTERFACE gust_check_data_output_pr |
---|
140 | MODULE PROCEDURE gust_check_data_output_pr |
---|
141 | END INTERFACE gust_check_data_output_pr |
---|
142 | |
---|
143 | INTERFACE gust_check_data_output |
---|
144 | MODULE PROCEDURE gust_check_data_output |
---|
145 | END INTERFACE gust_check_data_output |
---|
146 | |
---|
147 | INTERFACE gust_init_arrays |
---|
148 | MODULE PROCEDURE gust_init_arrays |
---|
149 | END INTERFACE gust_init_arrays |
---|
150 | |
---|
151 | INTERFACE gust_init |
---|
152 | MODULE PROCEDURE gust_init |
---|
153 | END INTERFACE gust_init |
---|
154 | |
---|
155 | INTERFACE gust_define_netcdf_grid |
---|
156 | MODULE PROCEDURE gust_define_netcdf_grid |
---|
157 | END INTERFACE gust_define_netcdf_grid |
---|
158 | |
---|
159 | INTERFACE gust_header |
---|
160 | MODULE PROCEDURE gust_header |
---|
161 | END INTERFACE gust_header |
---|
162 | |
---|
163 | INTERFACE gust_actions |
---|
164 | MODULE PROCEDURE gust_actions |
---|
165 | MODULE PROCEDURE gust_actions_ij |
---|
166 | END INTERFACE gust_actions |
---|
167 | |
---|
168 | INTERFACE gust_prognostic_equations |
---|
169 | MODULE PROCEDURE gust_prognostic_equations |
---|
170 | MODULE PROCEDURE gust_prognostic_equations_ij |
---|
171 | END INTERFACE gust_prognostic_equations |
---|
172 | |
---|
173 | INTERFACE gust_swap_timelevel |
---|
174 | MODULE PROCEDURE gust_swap_timelevel |
---|
175 | END INTERFACE gust_swap_timelevel |
---|
176 | |
---|
177 | INTERFACE gust_3d_data_averaging |
---|
178 | MODULE PROCEDURE gust_3d_data_averaging |
---|
179 | END INTERFACE gust_3d_data_averaging |
---|
180 | |
---|
181 | INTERFACE gust_data_output_2d |
---|
182 | MODULE PROCEDURE gust_data_output_2d |
---|
183 | END INTERFACE gust_data_output_2d |
---|
184 | |
---|
185 | INTERFACE gust_data_output_3d |
---|
186 | MODULE PROCEDURE gust_data_output_3d |
---|
187 | END INTERFACE gust_data_output_3d |
---|
188 | |
---|
189 | INTERFACE gust_statistics |
---|
190 | MODULE PROCEDURE gust_statistics |
---|
191 | END INTERFACE gust_statistics |
---|
192 | |
---|
193 | INTERFACE gust_rrd_global |
---|
194 | MODULE PROCEDURE gust_rrd_global_ftn |
---|
195 | MODULE PROCEDURE gust_rrd_global_mpi |
---|
196 | END INTERFACE gust_rrd_global |
---|
197 | |
---|
198 | INTERFACE gust_wrd_global |
---|
199 | MODULE PROCEDURE gust_wrd_global |
---|
200 | END INTERFACE gust_wrd_global |
---|
201 | |
---|
202 | INTERFACE gust_rrd_local |
---|
203 | MODULE PROCEDURE gust_rrd_local_ftn |
---|
204 | MODULE PROCEDURE gust_rrd_local_mpi |
---|
205 | END INTERFACE gust_rrd_local |
---|
206 | |
---|
207 | INTERFACE gust_wrd_local |
---|
208 | MODULE PROCEDURE gust_wrd_local |
---|
209 | END INTERFACE gust_wrd_local |
---|
210 | |
---|
211 | CONTAINS |
---|
212 | |
---|
213 | |
---|
214 | !--------------------------------------------------------------------------------------------------! |
---|
215 | ! Description: |
---|
216 | ! ------------ |
---|
217 | !> Parin for &gust_parameters for gust module |
---|
218 | !--------------------------------------------------------------------------------------------------! |
---|
219 | SUBROUTINE gust_parin |
---|
220 | |
---|
221 | |
---|
222 | IMPLICIT NONE |
---|
223 | |
---|
224 | CHARACTER(LEN=100) :: line !< dummy string that contains the current line of the parameter |
---|
225 | !< file |
---|
226 | INTEGER(iwp) :: io_status !< status after reading the namelist file |
---|
227 | |
---|
228 | |
---|
229 | NAMELIST /gust_parameters/ gust_module_enabled |
---|
230 | |
---|
231 | ! |
---|
232 | !-- Move to the beginning of the namelist file and try to find and read the namelist. |
---|
233 | REWIND( 11 ) |
---|
234 | READ( 11, gust_parameters, IOSTAT=io_status ) |
---|
235 | |
---|
236 | ! |
---|
237 | !-- Action depending on the READ status |
---|
238 | IF ( io_status == 0 ) THEN |
---|
239 | ! |
---|
240 | !-- gust_parameters namelist was found and read correctly. Set flag that indicates that the gust |
---|
241 | !-- module is switched on. |
---|
242 | gust_module_enabled = .TRUE. |
---|
243 | |
---|
244 | ELSEIF ( io_status > 0 ) THEN |
---|
245 | ! |
---|
246 | !-- gust_parameters namelist was found, but contained errors. Print an error message including |
---|
247 | !-- the line that caused the problem. |
---|
248 | BACKSPACE( 11 ) |
---|
249 | READ( 11 , '(A)') line |
---|
250 | CALL parin_fail_message( 'gust_parameters', line ) |
---|
251 | |
---|
252 | ENDIF |
---|
253 | |
---|
254 | END SUBROUTINE gust_parin |
---|
255 | |
---|
256 | |
---|
257 | !--------------------------------------------------------------------------------------------------! |
---|
258 | ! Description: |
---|
259 | ! ------------ |
---|
260 | !> Check parameters routine for gust module |
---|
261 | !--------------------------------------------------------------------------------------------------! |
---|
262 | SUBROUTINE gust_check_parameters |
---|
263 | |
---|
264 | |
---|
265 | IMPLICIT NONE |
---|
266 | |
---|
267 | |
---|
268 | END SUBROUTINE gust_check_parameters |
---|
269 | |
---|
270 | |
---|
271 | !--------------------------------------------------------------------------------------------------! |
---|
272 | ! Description: |
---|
273 | ! ------------ |
---|
274 | !> Check data output of profiles for gust module |
---|
275 | !--------------------------------------------------------------------------------------------------! |
---|
276 | SUBROUTINE gust_check_data_output_pr( variable, var_count, unit, dopr_unit ) |
---|
277 | |
---|
278 | |
---|
279 | IMPLICIT NONE |
---|
280 | |
---|
281 | CHARACTER (LEN=*) :: dopr_unit !< local value of dopr_unit |
---|
282 | CHARACTER (LEN=*) :: unit !< |
---|
283 | CHARACTER (LEN=*) :: variable !< |
---|
284 | |
---|
285 | INTEGER(iwp) :: var_count !< |
---|
286 | |
---|
287 | ! |
---|
288 | !-- Next line is just to avoid compiler warnings about unused variables. You may remove it. |
---|
289 | IF ( dummy_logical ) idum = LEN( unit ) + LEN( variable ) + LEN( dopr_unit ) + var_count |
---|
290 | |
---|
291 | END SUBROUTINE gust_check_data_output_pr |
---|
292 | |
---|
293 | !--------------------------------------------------------------------------------------------------! |
---|
294 | ! Description: |
---|
295 | ! ------------ |
---|
296 | !> Check data output for gust module |
---|
297 | !--------------------------------------------------------------------------------------------------! |
---|
298 | SUBROUTINE gust_check_data_output( var, unit ) |
---|
299 | |
---|
300 | |
---|
301 | IMPLICIT NONE |
---|
302 | |
---|
303 | CHARACTER (LEN=*) :: unit !< |
---|
304 | CHARACTER (LEN=*) :: var !< |
---|
305 | |
---|
306 | ! |
---|
307 | !-- Next line is just to avoid compiler warnings about unused variables. You may remove it. |
---|
308 | IF ( dummy_logical ) idum = LEN( var ) + LEN( unit ) |
---|
309 | |
---|
310 | END SUBROUTINE gust_check_data_output |
---|
311 | |
---|
312 | |
---|
313 | !--------------------------------------------------------------------------------------------------! |
---|
314 | ! Description: |
---|
315 | ! ------------ |
---|
316 | !> Allocate gust module arrays and define pointers |
---|
317 | !--------------------------------------------------------------------------------------------------! |
---|
318 | SUBROUTINE gust_init_arrays |
---|
319 | |
---|
320 | |
---|
321 | IMPLICIT NONE |
---|
322 | |
---|
323 | |
---|
324 | END SUBROUTINE gust_init_arrays |
---|
325 | |
---|
326 | |
---|
327 | !--------------------------------------------------------------------------------------------------! |
---|
328 | ! Description: |
---|
329 | ! ------------ |
---|
330 | !> Initialization of the gust module |
---|
331 | !--------------------------------------------------------------------------------------------------! |
---|
332 | SUBROUTINE gust_init |
---|
333 | |
---|
334 | |
---|
335 | IMPLICIT NONE |
---|
336 | |
---|
337 | |
---|
338 | END SUBROUTINE gust_init |
---|
339 | |
---|
340 | |
---|
341 | !--------------------------------------------------------------------------------------------------! |
---|
342 | ! |
---|
343 | ! Description: |
---|
344 | ! ------------ |
---|
345 | !> Subroutine defining appropriate grid for netcdf variables. |
---|
346 | !> It is called out from subroutine netcdf. |
---|
347 | !--------------------------------------------------------------------------------------------------! |
---|
348 | SUBROUTINE gust_define_netcdf_grid( var, found, grid_x, grid_y, grid_z ) |
---|
349 | |
---|
350 | |
---|
351 | IMPLICIT NONE |
---|
352 | |
---|
353 | CHARACTER (LEN=*), INTENT(IN) :: grid_x !< |
---|
354 | CHARACTER (LEN=*), INTENT(IN) :: grid_y !< |
---|
355 | CHARACTER (LEN=*), INTENT(IN) :: grid_z !< |
---|
356 | CHARACTER (LEN=*), INTENT(IN) :: var !< |
---|
357 | |
---|
358 | LOGICAL, INTENT(IN) :: found !< |
---|
359 | |
---|
360 | ! |
---|
361 | !-- Next line is just to avoid compiler warnings about unused variables. You may remove it. |
---|
362 | IF ( found ) idum = LEN( var ) + LEN( grid_x ) + LEN( grid_y ) + LEN( grid_z ) |
---|
363 | |
---|
364 | END SUBROUTINE gust_define_netcdf_grid |
---|
365 | |
---|
366 | |
---|
367 | !--------------------------------------------------------------------------------------------------! |
---|
368 | ! Description: |
---|
369 | ! ------------ |
---|
370 | !> Header output for gust module |
---|
371 | !--------------------------------------------------------------------------------------------------! |
---|
372 | SUBROUTINE gust_header ( io ) |
---|
373 | |
---|
374 | |
---|
375 | IMPLICIT NONE |
---|
376 | |
---|
377 | INTEGER(iwp), INTENT(IN) :: io !< Unit of the output file |
---|
378 | |
---|
379 | ! |
---|
380 | !-- Next line is just to avoid compiler warnings about unused variables. You may remove it. |
---|
381 | IF ( dummy_logical ) idum = io |
---|
382 | |
---|
383 | END SUBROUTINE gust_header |
---|
384 | |
---|
385 | |
---|
386 | !--------------------------------------------------------------------------------------------------! |
---|
387 | ! Description: |
---|
388 | ! ------------ |
---|
389 | !> Call for all grid points |
---|
390 | !--------------------------------------------------------------------------------------------------! |
---|
391 | SUBROUTINE gust_actions( location ) |
---|
392 | |
---|
393 | |
---|
394 | IMPLICIT NONE |
---|
395 | |
---|
396 | CHARACTER (LEN=*) :: location !< |
---|
397 | |
---|
398 | ! |
---|
399 | !-- Next line is just to avoid compiler warnings about unused variables. You may remove it. |
---|
400 | IF ( dummy_logical ) idum = LEN( location ) |
---|
401 | |
---|
402 | END SUBROUTINE gust_actions |
---|
403 | |
---|
404 | |
---|
405 | !--------------------------------------------------------------------------------------------------! |
---|
406 | ! Description: |
---|
407 | ! ------------ |
---|
408 | !> Call for grid point i,j |
---|
409 | !--------------------------------------------------------------------------------------------------! |
---|
410 | SUBROUTINE gust_actions_ij( i, j, location ) |
---|
411 | |
---|
412 | |
---|
413 | IMPLICIT NONE |
---|
414 | |
---|
415 | CHARACTER (LEN=*) :: location |
---|
416 | |
---|
417 | INTEGER(iwp) :: i |
---|
418 | INTEGER(iwp) :: j |
---|
419 | |
---|
420 | ! |
---|
421 | !-- Next line is just to avoid compiler warnings about unused variables. You may remove it. |
---|
422 | IF ( dummy_logical ) idum = i + j + LEN( location ) |
---|
423 | |
---|
424 | END SUBROUTINE gust_actions_ij |
---|
425 | |
---|
426 | |
---|
427 | !--------------------------------------------------------------------------------------------------! |
---|
428 | ! Description: |
---|
429 | ! ------------ |
---|
430 | !> Call for all grid points |
---|
431 | !--------------------------------------------------------------------------------------------------! |
---|
432 | SUBROUTINE gust_prognostic_equations() |
---|
433 | |
---|
434 | ! |
---|
435 | !-- Next line is just to avoid compiler warnings about unused variables. You may remove it. |
---|
436 | IF ( dummy_logical ) idum = 1 |
---|
437 | |
---|
438 | END SUBROUTINE gust_prognostic_equations |
---|
439 | |
---|
440 | |
---|
441 | !--------------------------------------------------------------------------------------------------! |
---|
442 | ! Description: |
---|
443 | ! ------------ |
---|
444 | !> Call for grid point i,j |
---|
445 | !--------------------------------------------------------------------------------------------------! |
---|
446 | SUBROUTINE gust_prognostic_equations_ij( i, j, i_omp_start, tn ) |
---|
447 | |
---|
448 | |
---|
449 | INTEGER(iwp), INTENT(IN) :: i !< grid index in x-direction |
---|
450 | INTEGER(iwp), INTENT(IN) :: i_omp_start !< first loop index of i-loop in prognostic_equations |
---|
451 | INTEGER(iwp), INTENT(IN) :: j !< grid index in y-direction |
---|
452 | INTEGER(iwp), INTENT(IN) :: tn !< task number of openmp task |
---|
453 | |
---|
454 | ! |
---|
455 | !-- Next line is just to avoid compiler warnings about unused variables. You may remove it. |
---|
456 | IF ( dummy_logical ) idum = i + j + i_omp_start + tn |
---|
457 | |
---|
458 | END SUBROUTINE gust_prognostic_equations_ij |
---|
459 | |
---|
460 | |
---|
461 | !--------------------------------------------------------------------------------------------------! |
---|
462 | ! Description: |
---|
463 | ! ------------ |
---|
464 | !> Swapping of timelevels |
---|
465 | !--------------------------------------------------------------------------------------------------! |
---|
466 | SUBROUTINE gust_swap_timelevel ( mod_count ) |
---|
467 | |
---|
468 | |
---|
469 | IMPLICIT NONE |
---|
470 | |
---|
471 | INTEGER, INTENT(IN) :: mod_count |
---|
472 | |
---|
473 | ! |
---|
474 | !-- Next line is just to avoid compiler warnings about unused variables. You may remove it. |
---|
475 | IF ( dummy_logical ) idum = mod_count |
---|
476 | |
---|
477 | END SUBROUTINE gust_swap_timelevel |
---|
478 | |
---|
479 | |
---|
480 | !--------------------------------------------------------------------------------------------------! |
---|
481 | ! |
---|
482 | ! Description: |
---|
483 | ! ------------ |
---|
484 | !> Subroutine for averaging 3D data |
---|
485 | !--------------------------------------------------------------------------------------------------! |
---|
486 | SUBROUTINE gust_3d_data_averaging( mode, variable ) |
---|
487 | |
---|
488 | |
---|
489 | IMPLICIT NONE |
---|
490 | |
---|
491 | CHARACTER (LEN=*) :: mode !< |
---|
492 | CHARACTER (LEN=*) :: variable !< |
---|
493 | |
---|
494 | ! |
---|
495 | !-- Next line is just to avoid compiler warnings about unused variables. You may remove it. |
---|
496 | IF ( dummy_logical ) idum = LEN( mode ) + LEN( variable ) |
---|
497 | |
---|
498 | END SUBROUTINE gust_3d_data_averaging |
---|
499 | |
---|
500 | !--------------------------------------------------------------------------------------------------! |
---|
501 | ! |
---|
502 | ! Description: |
---|
503 | ! ------------ |
---|
504 | !> Subroutine defining 2D output variables |
---|
505 | !--------------------------------------------------------------------------------------------------! |
---|
506 | SUBROUTINE gust_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, & |
---|
507 | nzt_do, fill_value ) |
---|
508 | |
---|
509 | |
---|
510 | IMPLICIT NONE |
---|
511 | |
---|
512 | CHARACTER (LEN=*), INTENT(INOUT) :: grid !< name of vertical grid |
---|
513 | CHARACTER (LEN=*), INTENT(IN) :: mode !< either 'xy', 'xz' or 'yz' |
---|
514 | CHARACTER (LEN=*), INTENT(IN) :: variable !< name of variable |
---|
515 | |
---|
516 | INTEGER(iwp), INTENT(IN) :: av !< flag for (non-)average output |
---|
517 | INTEGER(iwp), INTENT(IN) :: nzb_do !< vertical output index (bottom) |
---|
518 | INTEGER(iwp), INTENT(IN) :: nzt_do !< vertical output index (top) |
---|
519 | |
---|
520 | LOGICAL, INTENT(INOUT) :: found !< flag if output variable is found |
---|
521 | LOGICAL, INTENT(INOUT) :: two_d !< flag parameter that indicates 2D variables (horizontal cross sections) |
---|
522 | |
---|
523 | REAL(wp), INTENT(IN) :: fill_value !< value for the _FillValue attribute |
---|
524 | |
---|
525 | REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do), INTENT(INOUT) :: local_pf !< local |
---|
526 | !< array to which output data is resorted to |
---|
527 | |
---|
528 | ! |
---|
529 | !-- Next line is just to avoid compiler warnings about unused variables. You may remove it. |
---|
530 | IF ( found .AND. two_d ) THEN |
---|
531 | idum = av + LEN( variable ) + LEN( grid // mode ) + local_pf(nxl,nys,nzb_do) + fill_value |
---|
532 | ENDIF |
---|
533 | |
---|
534 | END SUBROUTINE gust_data_output_2d |
---|
535 | |
---|
536 | |
---|
537 | !--------------------------------------------------------------------------------------------------! |
---|
538 | ! |
---|
539 | ! Description: |
---|
540 | ! ------------ |
---|
541 | !> Subroutine defining 3D output variables |
---|
542 | !--------------------------------------------------------------------------------------------------! |
---|
543 | SUBROUTINE gust_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do ) |
---|
544 | |
---|
545 | |
---|
546 | IMPLICIT NONE |
---|
547 | |
---|
548 | CHARACTER (LEN=*), INTENT(IN) :: variable !< name of variable |
---|
549 | |
---|
550 | INTEGER(iwp), INTENT(IN) :: av !< flag for (non-)average output |
---|
551 | INTEGER(iwp), INTENT(IN) :: nzb_do !< lower limit of the data output (usually 0) |
---|
552 | INTEGER(iwp), INTENT(IN) :: nzt_do !< vertical upper limit of the data output (usually nz_do3d) |
---|
553 | |
---|
554 | LOGICAL, INTENT(INOUT) :: found !< flag if output variable is found |
---|
555 | |
---|
556 | REAL(wp), INTENT(IN) :: fill_value !< value for the _FillValue attribute |
---|
557 | |
---|
558 | REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do), INTENT(INOUT) :: local_pf !< local |
---|
559 | !< array to which output data is resorted to |
---|
560 | |
---|
561 | ! |
---|
562 | !-- Next line is just to avoid compiler warnings about unused variables. You may remove it. |
---|
563 | IF ( found ) idum = av + LEN( variable ) + fill_value + local_pf(nxl,nys,nzb_do) |
---|
564 | |
---|
565 | END SUBROUTINE gust_data_output_3d |
---|
566 | |
---|
567 | |
---|
568 | !--------------------------------------------------------------------------------------------------! |
---|
569 | ! Description: |
---|
570 | ! ------------ |
---|
571 | !> This routine computes profile and timeseries data for the gust module. |
---|
572 | !--------------------------------------------------------------------------------------------------! |
---|
573 | SUBROUTINE gust_statistics( mode, sr, tn, dots_max ) |
---|
574 | |
---|
575 | |
---|
576 | IMPLICIT NONE |
---|
577 | |
---|
578 | CHARACTER (LEN=*) :: mode !< |
---|
579 | |
---|
580 | INTEGER(iwp) :: dots_max !< |
---|
581 | INTEGER(iwp) :: sr !< |
---|
582 | INTEGER(iwp) :: tn !< |
---|
583 | |
---|
584 | ! |
---|
585 | !-- Next line is just to avoid compiler warnings about unused variables. You may remove it. |
---|
586 | IF ( dummy_logical ) idum = dots_max + sr + tn + LEN( mode ) |
---|
587 | |
---|
588 | END SUBROUTINE gust_statistics |
---|
589 | |
---|
590 | |
---|
591 | !--------------------------------------------------------------------------------------------------! |
---|
592 | ! Description: |
---|
593 | ! ------------ |
---|
594 | !> Read module-specific global restart data (Fortran binary format). |
---|
595 | !--------------------------------------------------------------------------------------------------! |
---|
596 | SUBROUTINE gust_rrd_global_ftn( found ) |
---|
597 | |
---|
598 | |
---|
599 | USE control_parameters, & |
---|
600 | ONLY: length, restart_string |
---|
601 | |
---|
602 | |
---|
603 | IMPLICIT NONE |
---|
604 | |
---|
605 | LOGICAL, INTENT(OUT) :: found |
---|
606 | |
---|
607 | |
---|
608 | found = .TRUE. |
---|
609 | |
---|
610 | |
---|
611 | SELECT CASE ( restart_string(1:length) ) |
---|
612 | |
---|
613 | CASE ( 'global_paramter' ) |
---|
614 | ! READ ( 13 ) global_parameter |
---|
615 | |
---|
616 | CASE DEFAULT |
---|
617 | |
---|
618 | found = .FALSE. |
---|
619 | |
---|
620 | END SELECT |
---|
621 | |
---|
622 | |
---|
623 | END SUBROUTINE gust_rrd_global_ftn |
---|
624 | |
---|
625 | |
---|
626 | !--------------------------------------------------------------------------------------------------! |
---|
627 | ! Description: |
---|
628 | ! ------------ |
---|
629 | !> Read module-specific global restart data (MPI-IO). |
---|
630 | !--------------------------------------------------------------------------------------------------! |
---|
631 | SUBROUTINE gust_rrd_global_mpi |
---|
632 | |
---|
633 | |
---|
634 | ! CALL rrd_mpi_io( 'global_parameter', global_parameter ) |
---|
635 | ! READ ( 13 ) global_parameter |
---|
636 | |
---|
637 | END SUBROUTINE gust_rrd_global_mpi |
---|
638 | |
---|
639 | |
---|
640 | !--------------------------------------------------------------------------------------------------! |
---|
641 | ! Description: |
---|
642 | ! ------------ |
---|
643 | !> Read module-specific local restart data arrays (Fortran binary format). |
---|
644 | !--------------------------------------------------------------------------------------------------! |
---|
645 | SUBROUTINE gust_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc, nxr_on_file, nynf, nync,& |
---|
646 | nyn_on_file, nysf, nysc, nys_on_file, tmp_2d, tmp_3d, found ) |
---|
647 | |
---|
648 | |
---|
649 | USE control_parameters |
---|
650 | |
---|
651 | USE indices |
---|
652 | |
---|
653 | USE kinds |
---|
654 | |
---|
655 | USE pegrid |
---|
656 | |
---|
657 | |
---|
658 | IMPLICIT NONE |
---|
659 | |
---|
660 | INTEGER(iwp) :: k !< |
---|
661 | INTEGER(iwp) :: nxlc !< |
---|
662 | INTEGER(iwp) :: nxlf !< |
---|
663 | INTEGER(iwp) :: nxl_on_file !< |
---|
664 | INTEGER(iwp) :: nxrc !< |
---|
665 | INTEGER(iwp) :: nxrf !< |
---|
666 | INTEGER(iwp) :: nxr_on_file !< |
---|
667 | INTEGER(iwp) :: nync !< |
---|
668 | INTEGER(iwp) :: nynf !< |
---|
669 | INTEGER(iwp) :: nyn_on_file !< |
---|
670 | INTEGER(iwp) :: nysc !< |
---|
671 | INTEGER(iwp) :: nysf !< |
---|
672 | INTEGER(iwp) :: nys_on_file !< |
---|
673 | |
---|
674 | LOGICAL, INTENT(OUT) :: found |
---|
675 | |
---|
676 | REAL(wp), DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_2d !< |
---|
677 | REAL(wp), DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d !< |
---|
678 | |
---|
679 | |
---|
680 | ! |
---|
681 | !-- Next lins are just to avoid compiler warnings about unused variables in case of empty user interface routine. |
---|
682 | !-- You may remove them. |
---|
683 | IF ( dummy_logical ) THEN |
---|
684 | idum = k + nxlc + nxlf + nxrc + nxrf + nync + nynf + nysc + nysf + & |
---|
685 | tmp_2d(nys_on_file,nxl_on_file) + tmp_3d(nzb,nys_on_file,nxl_on_file) |
---|
686 | ENDIF |
---|
687 | |
---|
688 | ! |
---|
689 | !-- Here the reading of user-defined restart data follows: |
---|
690 | !-- Sample for user-defined output |
---|
691 | found = .TRUE. |
---|
692 | |
---|
693 | SELECT CASE ( restart_string(1:length) ) |
---|
694 | |
---|
695 | CASE ( '.......' ) |
---|
696 | ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN |
---|
697 | ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
698 | ! ENDIF |
---|
699 | ! IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
700 | ! u2_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
701 | ! tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
702 | ! |
---|
703 | CASE DEFAULT |
---|
704 | |
---|
705 | found = .FALSE. |
---|
706 | |
---|
707 | END SELECT |
---|
708 | |
---|
709 | |
---|
710 | END SUBROUTINE gust_rrd_local_ftn |
---|
711 | |
---|
712 | |
---|
713 | !--------------------------------------------------------------------------------------------------! |
---|
714 | ! Description: |
---|
715 | ! ------------ |
---|
716 | !> Read module-specific local restart data arrays (MPI-IO). |
---|
717 | !--------------------------------------------------------------------------------------------------! |
---|
718 | SUBROUTINE gust_rrd_local_mpi |
---|
719 | |
---|
720 | |
---|
721 | ! CALL rrd_mpi_io( 'local_array', local_array ) |
---|
722 | |
---|
723 | END SUBROUTINE gust_rrd_local_mpi |
---|
724 | |
---|
725 | |
---|
726 | !--------------------------------------------------------------------------------------------------! |
---|
727 | ! Description: |
---|
728 | ! ------------ |
---|
729 | !> This routine writes the respective restart data for the gust module. |
---|
730 | !--------------------------------------------------------------------------------------------------! |
---|
731 | SUBROUTINE gust_wrd_global |
---|
732 | |
---|
733 | |
---|
734 | IMPLICIT NONE |
---|
735 | |
---|
736 | |
---|
737 | IF ( TRIM( restart_data_format_output ) == 'fortran_binary' ) THEN |
---|
738 | |
---|
739 | ! CALL wrd_write_string( 'global_parameter' ) |
---|
740 | ! WRITE ( 14 ) global_parameter |
---|
741 | |
---|
742 | ! IF ( ALLOCATED( inflow_damping_factor ) ) THEN |
---|
743 | ! CALL wrd_write_string( 'inflow_damping_factor' ) |
---|
744 | ! WRITE ( 14 ) inflow_damping_factor |
---|
745 | ! ENDIF |
---|
746 | |
---|
747 | ELSEIF ( restart_data_format_output(1:3) == 'mpi' ) THEN |
---|
748 | |
---|
749 | ! CALL wrd_mpi_io( 'global_parameter', global_parameter ) |
---|
750 | ! IF ( ALLOCATED( inflow_damping_factor ) ) THEN |
---|
751 | ! CALL wrd_mpi_io_global_array( 'inflow_damping_factor', inflow_damping_factor ) |
---|
752 | ! ENDIF |
---|
753 | |
---|
754 | ENDIF |
---|
755 | |
---|
756 | END SUBROUTINE gust_wrd_global |
---|
757 | |
---|
758 | |
---|
759 | !--------------------------------------------------------------------------------------------------! |
---|
760 | ! Description: |
---|
761 | ! ------------ |
---|
762 | !> This routine writes the respective restart data for the gust module. |
---|
763 | !--------------------------------------------------------------------------------------------------! |
---|
764 | SUBROUTINE gust_wrd_local |
---|
765 | |
---|
766 | |
---|
767 | IMPLICIT NONE |
---|
768 | |
---|
769 | |
---|
770 | IF ( TRIM( restart_data_format_output ) == 'fortran_binary' ) THEN |
---|
771 | |
---|
772 | ! IF ( ALLOCATED( u2_av ) ) THEN |
---|
773 | ! CALL wrd_write_string( 'u2_av' ) |
---|
774 | ! WRITE ( 14 ) u2_av |
---|
775 | ! ENDIF |
---|
776 | |
---|
777 | ELSEIF ( restart_data_format_output(1:3) == 'mpi' ) THEN |
---|
778 | |
---|
779 | ! IF ( ALLOCATED( u2_av ) ) CALL wrd_mpi_io( 'u2_av', u2_av ) |
---|
780 | |
---|
781 | ENDIF |
---|
782 | |
---|
783 | END SUBROUTINE gust_wrd_local |
---|
784 | |
---|
785 | |
---|
786 | |
---|
787 | END MODULE gust_mod |
---|