1 | !> @file gust_mod.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of PALM. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
6 | ! terms of the GNU General Public License as published by the Free Software |
---|
7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
8 | ! version. |
---|
9 | ! |
---|
10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
13 | ! |
---|
14 | ! You should have received a copy of the GNU General Public License along with |
---|
15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
16 | ! |
---|
17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! |
---|
27 | ! Initial interface definition |
---|
28 | ! |
---|
29 | ! |
---|
30 | ! |
---|
31 | ! Description: |
---|
32 | ! ------------ |
---|
33 | !> Gust model. |
---|
34 | !> |
---|
35 | !> @todo This is just a dummy module. The actual module ist not released yet. |
---|
36 | !------------------------------------------------------------------------------! |
---|
37 | MODULE gust_mod |
---|
38 | |
---|
39 | USE indices, & |
---|
40 | ONLY: nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb, nzt |
---|
41 | |
---|
42 | USE kinds |
---|
43 | |
---|
44 | IMPLICIT NONE |
---|
45 | |
---|
46 | LOGICAL :: gust_module_enabled = .FALSE. !< switch, if the entire module is used at all |
---|
47 | |
---|
48 | SAVE |
---|
49 | |
---|
50 | PRIVATE |
---|
51 | |
---|
52 | ! |
---|
53 | !-- Public functions |
---|
54 | PUBLIC & |
---|
55 | gust_parin, & |
---|
56 | gust_check_parameters, & |
---|
57 | gust_check_data_output_pr, & |
---|
58 | gust_check_data_output, & |
---|
59 | gust_init_arrays, & |
---|
60 | gust_init, & |
---|
61 | gust_define_netcdf_grid, & |
---|
62 | gust_header, & |
---|
63 | gust_actions, & |
---|
64 | gust_swap_timelevel, & |
---|
65 | gust_3d_data_averaging, & |
---|
66 | gust_data_output_2d, & |
---|
67 | gust_data_output_3d, & |
---|
68 | gust_statistics, & |
---|
69 | gust_read_restart_data, & |
---|
70 | gust_write_restart_data |
---|
71 | ! |
---|
72 | !-- Public parameters, constants and initial values |
---|
73 | PUBLIC & |
---|
74 | gust_module_enabled |
---|
75 | |
---|
76 | |
---|
77 | INTERFACE gust_parin |
---|
78 | MODULE PROCEDURE gust_parin |
---|
79 | END INTERFACE gust_parin |
---|
80 | |
---|
81 | INTERFACE gust_check_parameters |
---|
82 | MODULE PROCEDURE gust_check_parameters |
---|
83 | END INTERFACE gust_check_parameters |
---|
84 | |
---|
85 | INTERFACE gust_check_data_output_pr |
---|
86 | MODULE PROCEDURE gust_check_data_output_pr |
---|
87 | END INTERFACE gust_check_data_output_pr |
---|
88 | |
---|
89 | INTERFACE gust_check_data_output |
---|
90 | MODULE PROCEDURE gust_check_data_output |
---|
91 | END INTERFACE gust_check_data_output |
---|
92 | |
---|
93 | INTERFACE gust_init_arrays |
---|
94 | MODULE PROCEDURE gust_init_arrays |
---|
95 | END INTERFACE gust_init_arrays |
---|
96 | |
---|
97 | INTERFACE gust_init |
---|
98 | MODULE PROCEDURE gust_init |
---|
99 | END INTERFACE gust_init |
---|
100 | |
---|
101 | INTERFACE gust_define_netcdf_grid |
---|
102 | MODULE PROCEDURE gust_define_netcdf_grid |
---|
103 | END INTERFACE gust_define_netcdf_grid |
---|
104 | |
---|
105 | INTERFACE gust_header |
---|
106 | MODULE PROCEDURE gust_header |
---|
107 | END INTERFACE gust_header |
---|
108 | |
---|
109 | INTERFACE gust_actions |
---|
110 | MODULE PROCEDURE gust_actions |
---|
111 | MODULE PROCEDURE gust_actions_ij |
---|
112 | END INTERFACE gust_actions |
---|
113 | |
---|
114 | INTERFACE gust_swap_timelevel |
---|
115 | MODULE PROCEDURE gust_swap_timelevel |
---|
116 | END INTERFACE gust_swap_timelevel |
---|
117 | |
---|
118 | INTERFACE gust_3d_data_averaging |
---|
119 | MODULE PROCEDURE gust_3d_data_averaging |
---|
120 | END INTERFACE gust_3d_data_averaging |
---|
121 | |
---|
122 | INTERFACE gust_data_output_2d |
---|
123 | MODULE PROCEDURE gust_data_output_2d |
---|
124 | END INTERFACE gust_data_output_2d |
---|
125 | |
---|
126 | INTERFACE gust_data_output_3d |
---|
127 | MODULE PROCEDURE gust_data_output_3d |
---|
128 | END INTERFACE gust_data_output_3d |
---|
129 | |
---|
130 | INTERFACE gust_statistics |
---|
131 | MODULE PROCEDURE gust_statistics |
---|
132 | END INTERFACE gust_statistics |
---|
133 | |
---|
134 | INTERFACE gust_read_restart_data |
---|
135 | MODULE PROCEDURE gust_read_restart_data |
---|
136 | END INTERFACE gust_read_restart_data |
---|
137 | |
---|
138 | INTERFACE gust_write_restart_data |
---|
139 | MODULE PROCEDURE gust_write_restart_data |
---|
140 | END INTERFACE gust_write_restart_data |
---|
141 | |
---|
142 | CONTAINS |
---|
143 | |
---|
144 | |
---|
145 | !------------------------------------------------------------------------------! |
---|
146 | ! Description: |
---|
147 | ! ------------ |
---|
148 | !> Parin for &gust_par for gust module |
---|
149 | !------------------------------------------------------------------------------! |
---|
150 | SUBROUTINE gust_parin |
---|
151 | |
---|
152 | |
---|
153 | IMPLICIT NONE |
---|
154 | |
---|
155 | CHARACTER (LEN=80) :: line !< dummy string that contains the current line of the parameter file |
---|
156 | |
---|
157 | NAMELIST /gust_par/ & |
---|
158 | gust_module_enabled |
---|
159 | |
---|
160 | line = ' ' |
---|
161 | ! |
---|
162 | !-- Try to find gust module package |
---|
163 | REWIND ( 11 ) |
---|
164 | line = ' ' |
---|
165 | DO WHILE ( INDEX( line, '&gust_par' ) == 0 ) |
---|
166 | READ ( 11, '(A)', END=10 ) line |
---|
167 | ENDDO |
---|
168 | BACKSPACE ( 11 ) |
---|
169 | ! |
---|
170 | !-- Read user-defined namelist |
---|
171 | READ ( 11, gust_par ) |
---|
172 | ! |
---|
173 | !-- Set flag that indicates that the gust module is switched on |
---|
174 | gust_module_enabled = .TRUE. |
---|
175 | |
---|
176 | 10 CONTINUE |
---|
177 | |
---|
178 | |
---|
179 | END SUBROUTINE gust_parin |
---|
180 | |
---|
181 | |
---|
182 | !------------------------------------------------------------------------------! |
---|
183 | ! Description: |
---|
184 | ! ------------ |
---|
185 | !> Check parameters routine for gust module |
---|
186 | !------------------------------------------------------------------------------! |
---|
187 | SUBROUTINE gust_check_parameters |
---|
188 | |
---|
189 | |
---|
190 | IMPLICIT NONE |
---|
191 | |
---|
192 | |
---|
193 | END SUBROUTINE gust_check_parameters |
---|
194 | |
---|
195 | |
---|
196 | !------------------------------------------------------------------------------! |
---|
197 | ! Description: |
---|
198 | ! ------------ |
---|
199 | !> Check data output of profiles for gust module |
---|
200 | !------------------------------------------------------------------------------! |
---|
201 | SUBROUTINE gust_check_data_output_pr( variable, var_count, unit, dopr_unit ) |
---|
202 | |
---|
203 | |
---|
204 | IMPLICIT NONE |
---|
205 | |
---|
206 | CHARACTER (LEN=*) :: unit !< |
---|
207 | CHARACTER (LEN=*) :: variable !< |
---|
208 | CHARACTER (LEN=*) :: dopr_unit !< local value of dopr_unit |
---|
209 | |
---|
210 | INTEGER(iwp) :: var_count !< |
---|
211 | |
---|
212 | |
---|
213 | END SUBROUTINE gust_check_data_output_pr |
---|
214 | |
---|
215 | !------------------------------------------------------------------------------! |
---|
216 | ! Description: |
---|
217 | ! ------------ |
---|
218 | !> Check data output for gust module |
---|
219 | !------------------------------------------------------------------------------! |
---|
220 | SUBROUTINE gust_check_data_output( var, unit ) |
---|
221 | |
---|
222 | |
---|
223 | IMPLICIT NONE |
---|
224 | |
---|
225 | CHARACTER (LEN=*) :: unit !< |
---|
226 | CHARACTER (LEN=*) :: var !< |
---|
227 | |
---|
228 | |
---|
229 | END SUBROUTINE gust_check_data_output |
---|
230 | |
---|
231 | |
---|
232 | !------------------------------------------------------------------------------! |
---|
233 | ! Description: |
---|
234 | ! ------------ |
---|
235 | !> Allocate gust module arrays and define pointers |
---|
236 | !------------------------------------------------------------------------------! |
---|
237 | SUBROUTINE gust_init_arrays |
---|
238 | |
---|
239 | |
---|
240 | IMPLICIT NONE |
---|
241 | |
---|
242 | |
---|
243 | END SUBROUTINE gust_init_arrays |
---|
244 | |
---|
245 | |
---|
246 | !------------------------------------------------------------------------------! |
---|
247 | ! Description: |
---|
248 | ! ------------ |
---|
249 | !> Initialization of the gust module |
---|
250 | !------------------------------------------------------------------------------! |
---|
251 | SUBROUTINE gust_init( dots_label, dots_unit, dots_num, dots_max ) |
---|
252 | |
---|
253 | |
---|
254 | IMPLICIT NONE |
---|
255 | |
---|
256 | INTEGER(iwp) :: dots_num |
---|
257 | INTEGER(iwp) :: dots_max |
---|
258 | CHARACTER (LEN=13), DIMENSION(dots_max) :: dots_unit |
---|
259 | CHARACTER (LEN=13), DIMENSION(dots_max) :: dots_label |
---|
260 | |
---|
261 | |
---|
262 | END SUBROUTINE gust_init |
---|
263 | |
---|
264 | |
---|
265 | !------------------------------------------------------------------------------! |
---|
266 | ! |
---|
267 | ! Description: |
---|
268 | ! ------------ |
---|
269 | !> Subroutine defining appropriate grid for netcdf variables. |
---|
270 | !> It is called out from subroutine netcdf. |
---|
271 | !------------------------------------------------------------------------------! |
---|
272 | SUBROUTINE gust_define_netcdf_grid( var, found, grid_x, grid_y, grid_z ) |
---|
273 | |
---|
274 | |
---|
275 | IMPLICIT NONE |
---|
276 | |
---|
277 | CHARACTER (LEN=*), INTENT(IN) :: var !< |
---|
278 | LOGICAL, INTENT(IN) :: found !< |
---|
279 | CHARACTER (LEN=*), INTENT(IN) :: grid_x !< |
---|
280 | CHARACTER (LEN=*), INTENT(IN) :: grid_y !< |
---|
281 | CHARACTER (LEN=*), INTENT(IN) :: grid_z !< |
---|
282 | |
---|
283 | |
---|
284 | END SUBROUTINE gust_define_netcdf_grid |
---|
285 | |
---|
286 | |
---|
287 | !------------------------------------------------------------------------------! |
---|
288 | ! Description: |
---|
289 | ! ------------ |
---|
290 | !> Header output for gust module |
---|
291 | !------------------------------------------------------------------------------! |
---|
292 | SUBROUTINE gust_header ( io ) |
---|
293 | |
---|
294 | |
---|
295 | IMPLICIT NONE |
---|
296 | |
---|
297 | INTEGER(iwp), INTENT(IN) :: io !< Unit of the output file |
---|
298 | |
---|
299 | |
---|
300 | END SUBROUTINE gust_header |
---|
301 | |
---|
302 | |
---|
303 | !------------------------------------------------------------------------------! |
---|
304 | ! Description: |
---|
305 | ! ------------ |
---|
306 | !> Call for all grid points |
---|
307 | !------------------------------------------------------------------------------! |
---|
308 | SUBROUTINE gust_actions( location ) |
---|
309 | |
---|
310 | |
---|
311 | IMPLICIT NONE |
---|
312 | |
---|
313 | CHARACTER (LEN=*) :: location !< |
---|
314 | |
---|
315 | |
---|
316 | END SUBROUTINE gust_actions |
---|
317 | |
---|
318 | |
---|
319 | !------------------------------------------------------------------------------! |
---|
320 | ! Description: |
---|
321 | ! ------------ |
---|
322 | !> Call for grid point i,j |
---|
323 | !------------------------------------------------------------------------------! |
---|
324 | SUBROUTINE gust_actions_ij( i, j, location ) |
---|
325 | |
---|
326 | |
---|
327 | IMPLICIT NONE |
---|
328 | |
---|
329 | CHARACTER (LEN=*) :: location |
---|
330 | |
---|
331 | INTEGER(iwp) :: i |
---|
332 | INTEGER(iwp) :: j |
---|
333 | |
---|
334 | |
---|
335 | END SUBROUTINE gust_actions_ij |
---|
336 | |
---|
337 | |
---|
338 | !------------------------------------------------------------------------------! |
---|
339 | ! Description: |
---|
340 | ! ------------ |
---|
341 | !> Swapping of timelevels |
---|
342 | !------------------------------------------------------------------------------! |
---|
343 | SUBROUTINE gust_swap_timelevel ( mod_count ) |
---|
344 | |
---|
345 | |
---|
346 | IMPLICIT NONE |
---|
347 | |
---|
348 | INTEGER, INTENT(IN) :: mod_count |
---|
349 | |
---|
350 | |
---|
351 | END SUBROUTINE gust_swap_timelevel |
---|
352 | |
---|
353 | |
---|
354 | !------------------------------------------------------------------------------! |
---|
355 | ! |
---|
356 | ! Description: |
---|
357 | ! ------------ |
---|
358 | !> Subroutine for averaging 3D data |
---|
359 | !------------------------------------------------------------------------------! |
---|
360 | SUBROUTINE gust_3d_data_averaging( mode, variable ) |
---|
361 | |
---|
362 | |
---|
363 | IMPLICIT NONE |
---|
364 | |
---|
365 | CHARACTER (LEN=*) :: mode !< |
---|
366 | CHARACTER (LEN=*) :: variable !< |
---|
367 | |
---|
368 | |
---|
369 | END SUBROUTINE gust_3d_data_averaging |
---|
370 | |
---|
371 | !------------------------------------------------------------------------------! |
---|
372 | ! |
---|
373 | ! Description: |
---|
374 | ! ------------ |
---|
375 | !> Subroutine defining 2D output variables |
---|
376 | !------------------------------------------------------------------------------! |
---|
377 | SUBROUTINE gust_data_output_2d( av, variable, found, grid, local_pf, & |
---|
378 | two_d, nzb_do, nzt_do ) |
---|
379 | |
---|
380 | |
---|
381 | IMPLICIT NONE |
---|
382 | |
---|
383 | CHARACTER (LEN=*) :: grid !< |
---|
384 | CHARACTER (LEN=*) :: variable !< |
---|
385 | |
---|
386 | INTEGER(iwp) :: av !< flag to control data output of instantaneous or time-averaged data |
---|
387 | INTEGER(iwp) :: nzb_do !< lower limit of the data output (usually 0) |
---|
388 | INTEGER(iwp) :: nzt_do !< vertical upper limit of the data output (usually nz_do3d) |
---|
389 | |
---|
390 | LOGICAL :: found !< |
---|
391 | LOGICAL :: two_d !< flag parameter that indicates 2D variables (horizontal cross sections) |
---|
392 | |
---|
393 | REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb:nzt+1) :: local_pf !< |
---|
394 | |
---|
395 | |
---|
396 | END SUBROUTINE gust_data_output_2d |
---|
397 | |
---|
398 | |
---|
399 | !------------------------------------------------------------------------------! |
---|
400 | ! |
---|
401 | ! Description: |
---|
402 | ! ------------ |
---|
403 | !> Subroutine defining 3D output variables |
---|
404 | !------------------------------------------------------------------------------! |
---|
405 | SUBROUTINE gust_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do ) |
---|
406 | |
---|
407 | |
---|
408 | IMPLICIT NONE |
---|
409 | |
---|
410 | CHARACTER (LEN=*) :: variable !< |
---|
411 | |
---|
412 | INTEGER(iwp) :: av !< |
---|
413 | INTEGER(iwp) :: nzb_do !< lower limit of the data output (usually 0) |
---|
414 | INTEGER(iwp) :: nzt_do !< vertical upper limit of the data output (usually nz_do3d) |
---|
415 | |
---|
416 | LOGICAL :: found !< |
---|
417 | |
---|
418 | REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) :: local_pf !< |
---|
419 | |
---|
420 | |
---|
421 | END SUBROUTINE gust_data_output_3d |
---|
422 | |
---|
423 | |
---|
424 | !------------------------------------------------------------------------------! |
---|
425 | ! Description: |
---|
426 | ! ------------ |
---|
427 | !> This routine computes profile and timeseries data for the gust module. |
---|
428 | !------------------------------------------------------------------------------! |
---|
429 | SUBROUTINE gust_statistics( mode, sr, tn, dots_max ) |
---|
430 | |
---|
431 | |
---|
432 | IMPLICIT NONE |
---|
433 | |
---|
434 | CHARACTER (LEN=*) :: mode !< |
---|
435 | |
---|
436 | INTEGER(iwp) :: sr !< |
---|
437 | INTEGER(iwp) :: tn !< |
---|
438 | INTEGER(iwp) :: dots_max !< |
---|
439 | |
---|
440 | |
---|
441 | END SUBROUTINE gust_statistics |
---|
442 | |
---|
443 | |
---|
444 | !------------------------------------------------------------------------------! |
---|
445 | ! Description: |
---|
446 | ! ------------ |
---|
447 | !> This routine reads the respective restart data for the gust module. |
---|
448 | !------------------------------------------------------------------------------! |
---|
449 | SUBROUTINE gust_read_restart_data |
---|
450 | |
---|
451 | |
---|
452 | IMPLICIT NONE |
---|
453 | |
---|
454 | |
---|
455 | END SUBROUTINE gust_read_restart_data |
---|
456 | |
---|
457 | |
---|
458 | !------------------------------------------------------------------------------! |
---|
459 | ! Description: |
---|
460 | ! ------------ |
---|
461 | !> This routine writes the respective restart data for the gust module. |
---|
462 | !------------------------------------------------------------------------------! |
---|
463 | SUBROUTINE gust_write_restart_data |
---|
464 | |
---|
465 | |
---|
466 | IMPLICIT NONE |
---|
467 | |
---|
468 | |
---|
469 | END SUBROUTINE gust_write_restart_data |
---|
470 | |
---|
471 | |
---|
472 | |
---|
473 | END MODULE gust_mod |
---|