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