[1873] | 1 | !> @file user_module.f90 |
---|
[4497] | 2 | !--------------------------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 4 | ! |
---|
[4497] | 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. |
---|
[1036] | 8 | ! |
---|
[4497] | 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. |
---|
[1036] | 12 | ! |
---|
[4497] | 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/>. |
---|
[1036] | 15 | ! |
---|
[4828] | 16 | ! Copyright 1997-2021 Leibniz Universitaet Hannover |
---|
[4497] | 17 | !--------------------------------------------------------------------------------------------------! |
---|
[1036] | 18 | ! |
---|
[4497] | 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[211] | 21 | ! ----------------- |
---|
[4768] | 22 | ! |
---|
| 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: user_module.f90 4853 2021-01-25 07:56:09Z raasch $ |
---|
[4853] | 27 | ! array size for profiles increased |
---|
| 28 | ! |
---|
| 29 | ! 4843 2021-01-15 15:22:11Z raasch |
---|
[4843] | 30 | ! local namelist parameter added to switch off the module although the respective module namelist |
---|
| 31 | ! appears in the namelist file |
---|
| 32 | ! |
---|
| 33 | ! 4828 2021-01-05 11:21:41Z Giersch |
---|
[4768] | 34 | ! Enable 3D data output also with 64-bit precision |
---|
| 35 | ! |
---|
| 36 | ! 4535 2020-05-15 12:07:23Z raasch |
---|
[4535] | 37 | ! bugfix for restart data format query |
---|
| 38 | ! |
---|
| 39 | ! 4517 2020-05-03 14:29:30Z raasch |
---|
[4517] | 40 | ! added restart with MPI-IO for reading local arrays |
---|
| 41 | ! |
---|
| 42 | ! 4504 2020-04-20 12:11:24Z raasch |
---|
[4504] | 43 | ! hint for setting rmask arrays added |
---|
| 44 | ! |
---|
| 45 | ! 4497 2020-04-15 10:20:51Z raasch |
---|
[4497] | 46 | ! file re-formatted to follow the PALM coding standard |
---|
| 47 | ! |
---|
| 48 | ! 4495 2020-04-13 20:11:20Z raasch |
---|
[4495] | 49 | ! restart data handling with MPI-IO added |
---|
[4497] | 50 | ! |
---|
[4495] | 51 | ! 4360 2020-01-07 11:25:50Z suehring |
---|
[4497] | 52 | ! Introduction of wall_flags_total_0, which currently sets bits based on static topography |
---|
| 53 | ! information used in wall_flags_static_0 |
---|
| 54 | ! |
---|
[4346] | 55 | ! 4329 2019-12-10 15:46:36Z motisi |
---|
[4329] | 56 | ! Renamed wall_flags_0 to wall_flags_static_0 |
---|
[4497] | 57 | ! |
---|
[4329] | 58 | ! 4287 2019-11-01 14:50:20Z raasch |
---|
[4287] | 59 | ! reading of namelist file and actions in case of namelist errors revised so that statement labels |
---|
[4497] | 60 | ! and goto statements are not required any more; this revision also removes a previous bug which |
---|
| 61 | ! appeared when the namelist has been commented out in the namelist file |
---|
| 62 | ! |
---|
[4287] | 63 | ! 4182 2019-08-22 15:20:23Z scharf |
---|
[4182] | 64 | ! Corrected "Former revisions" section |
---|
[4497] | 65 | ! |
---|
[4182] | 66 | ! 3986 2019-05-20 14:08:14Z Giersch |
---|
[3986] | 67 | ! Redundant integration of control parameters in user_rrd_global removed |
---|
[4497] | 68 | ! |
---|
[3986] | 69 | ! 3911 2019-04-17 12:26:19Z knoop |
---|
[3911] | 70 | ! Bugfix: added before_prognostic_equations case in user_actions |
---|
[4497] | 71 | ! |
---|
[3911] | 72 | ! 3768 2019-02-27 14:35:58Z raasch |
---|
[3768] | 73 | ! variables commented + statements added to avoid compiler warnings about unused variables |
---|
| 74 | ! |
---|
| 75 | ! 3767 2019-02-27 08:18:02Z raasch |
---|
[3767] | 76 | ! unused variable for file index removed from rrd-subroutines parameter list |
---|
[4497] | 77 | ! |
---|
[3767] | 78 | ! 3747 2019-02-16 15:15:23Z gronemeier |
---|
[3747] | 79 | ! Add routine user_init_arrays |
---|
[4497] | 80 | ! |
---|
[3747] | 81 | ! 3703 2019-01-29 16:43:53Z knoop |
---|
[2894] | 82 | ! An example for a user defined global variable has been added (Giersch) |
---|
[1321] | 83 | ! |
---|
[4182] | 84 | ! Revision 1.1 1998/03/24 15:29:04 raasch |
---|
| 85 | ! Initial revision |
---|
| 86 | ! |
---|
| 87 | ! |
---|
[211] | 88 | ! Description: |
---|
| 89 | ! ------------ |
---|
[4497] | 90 | !> Declaration of user-defined variables. This module may only be used in the user-defined routines |
---|
| 91 | !> (contained in user_interface.f90). |
---|
| 92 | !--------------------------------------------------------------------------------------------------! |
---|
[1682] | 93 | MODULE user |
---|
[211] | 94 | |
---|
[3687] | 95 | USE arrays_3d |
---|
| 96 | |
---|
| 97 | USE control_parameters |
---|
| 98 | |
---|
| 99 | USE cpulog |
---|
| 100 | |
---|
| 101 | USE indices |
---|
| 102 | |
---|
[1320] | 103 | USE kinds |
---|
[211] | 104 | |
---|
[3687] | 105 | USE pegrid |
---|
| 106 | |
---|
| 107 | USE statistics |
---|
| 108 | |
---|
| 109 | USE surface_mod |
---|
| 110 | |
---|
[1320] | 111 | IMPLICIT NONE |
---|
| 112 | |
---|
[4497] | 113 | INTEGER(iwp) :: dots_num_palm !< |
---|
| 114 | INTEGER(iwp) :: dots_num_user = 0 !< |
---|
| 115 | INTEGER(iwp) :: user_idummy !< |
---|
[1320] | 116 | |
---|
[4497] | 117 | LOGICAL :: user_module_enabled = .FALSE. !< |
---|
| 118 | |
---|
| 119 | REAL(wp) :: user_rdummy !< |
---|
| 120 | |
---|
[211] | 121 | ! |
---|
| 122 | !-- Sample for user-defined output |
---|
[4497] | 123 | ! REAL(wp) :: global_parameter !< user defined global parameter |
---|
[2894] | 124 | ! |
---|
[4497] | 125 | ! REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u2 !< user defined array |
---|
| 126 | ! REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u2_av !< user defined array |
---|
| 127 | ! REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: ustvst !< user defined array |
---|
[211] | 128 | |
---|
| 129 | SAVE |
---|
| 130 | |
---|
[3701] | 131 | PRIVATE |
---|
[3687] | 132 | |
---|
| 133 | ! |
---|
| 134 | !- Public functions |
---|
[4497] | 135 | PUBLIC & |
---|
| 136 | user_actions, & |
---|
| 137 | user_check_data_output, & |
---|
| 138 | user_check_data_output_pr, & |
---|
| 139 | user_check_data_output_ts, & |
---|
| 140 | user_check_parameters, & |
---|
| 141 | user_data_output_2d, & |
---|
| 142 | user_data_output_3d, & |
---|
| 143 | user_define_netcdf_grid, & |
---|
| 144 | user_header, & |
---|
| 145 | user_init, & |
---|
| 146 | user_init_arrays, & |
---|
| 147 | user_last_actions, & |
---|
| 148 | user_parin, & |
---|
| 149 | user_rrd_global, & |
---|
| 150 | user_rrd_local, & |
---|
| 151 | user_statistics, & |
---|
| 152 | user_3d_data_averaging, & |
---|
| 153 | user_wrd_global, & |
---|
| 154 | user_wrd_local |
---|
[3687] | 155 | |
---|
[4497] | 156 | |
---|
[3687] | 157 | ! |
---|
| 158 | !- Public parameters, constants and initial values |
---|
[4497] | 159 | PUBLIC & |
---|
[3701] | 160 | user_module_enabled |
---|
[3687] | 161 | |
---|
| 162 | INTERFACE user_parin |
---|
| 163 | MODULE PROCEDURE user_parin |
---|
| 164 | END INTERFACE user_parin |
---|
| 165 | |
---|
| 166 | INTERFACE user_check_parameters |
---|
| 167 | MODULE PROCEDURE user_check_parameters |
---|
| 168 | END INTERFACE user_check_parameters |
---|
| 169 | |
---|
[3700] | 170 | INTERFACE user_check_data_output_ts |
---|
| 171 | MODULE PROCEDURE user_check_data_output_ts |
---|
| 172 | END INTERFACE user_check_data_output_ts |
---|
| 173 | |
---|
[3687] | 174 | INTERFACE user_check_data_output_pr |
---|
| 175 | MODULE PROCEDURE user_check_data_output_pr |
---|
| 176 | END INTERFACE user_check_data_output_pr |
---|
| 177 | |
---|
| 178 | INTERFACE user_check_data_output |
---|
| 179 | MODULE PROCEDURE user_check_data_output |
---|
| 180 | END INTERFACE user_check_data_output |
---|
| 181 | |
---|
[3701] | 182 | INTERFACE user_define_netcdf_grid |
---|
| 183 | MODULE PROCEDURE user_define_netcdf_grid |
---|
| 184 | END INTERFACE user_define_netcdf_grid |
---|
| 185 | |
---|
[3687] | 186 | INTERFACE user_init |
---|
| 187 | MODULE PROCEDURE user_init |
---|
| 188 | END INTERFACE user_init |
---|
| 189 | |
---|
[3747] | 190 | INTERFACE user_init_arrays |
---|
| 191 | MODULE PROCEDURE user_init_arrays |
---|
| 192 | END INTERFACE user_init_arrays |
---|
| 193 | |
---|
[3687] | 194 | INTERFACE user_header |
---|
| 195 | MODULE PROCEDURE user_header |
---|
| 196 | END INTERFACE user_header |
---|
| 197 | |
---|
| 198 | INTERFACE user_actions |
---|
| 199 | MODULE PROCEDURE user_actions |
---|
| 200 | MODULE PROCEDURE user_actions_ij |
---|
| 201 | END INTERFACE user_actions |
---|
| 202 | |
---|
| 203 | INTERFACE user_3d_data_averaging |
---|
| 204 | MODULE PROCEDURE user_3d_data_averaging |
---|
| 205 | END INTERFACE user_3d_data_averaging |
---|
| 206 | |
---|
| 207 | INTERFACE user_data_output_2d |
---|
| 208 | MODULE PROCEDURE user_data_output_2d |
---|
| 209 | END INTERFACE user_data_output_2d |
---|
| 210 | |
---|
| 211 | INTERFACE user_data_output_3d |
---|
| 212 | MODULE PROCEDURE user_data_output_3d |
---|
| 213 | END INTERFACE user_data_output_3d |
---|
| 214 | |
---|
| 215 | INTERFACE user_statistics |
---|
| 216 | MODULE PROCEDURE user_statistics |
---|
| 217 | END INTERFACE user_statistics |
---|
| 218 | |
---|
| 219 | INTERFACE user_rrd_global |
---|
[4495] | 220 | MODULE PROCEDURE user_rrd_global_ftn |
---|
| 221 | MODULE PROCEDURE user_rrd_global_mpi |
---|
[3687] | 222 | END INTERFACE user_rrd_global |
---|
| 223 | |
---|
| 224 | INTERFACE user_rrd_local |
---|
[4517] | 225 | MODULE PROCEDURE user_rrd_local_ftn |
---|
| 226 | MODULE PROCEDURE user_rrd_local_mpi |
---|
[3687] | 227 | END INTERFACE user_rrd_local |
---|
| 228 | |
---|
| 229 | INTERFACE user_wrd_global |
---|
| 230 | MODULE PROCEDURE user_wrd_global |
---|
| 231 | END INTERFACE user_wrd_global |
---|
| 232 | |
---|
| 233 | INTERFACE user_wrd_local |
---|
| 234 | MODULE PROCEDURE user_wrd_local |
---|
| 235 | END INTERFACE user_wrd_local |
---|
| 236 | |
---|
[3701] | 237 | INTERFACE user_last_actions |
---|
| 238 | MODULE PROCEDURE user_last_actions |
---|
| 239 | END INTERFACE user_last_actions |
---|
[3687] | 240 | |
---|
[3701] | 241 | |
---|
[3687] | 242 | CONTAINS |
---|
| 243 | |
---|
| 244 | |
---|
[4497] | 245 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 246 | ! Description: |
---|
| 247 | ! ------------ |
---|
| 248 | !> Parin for &user_parameters for user module |
---|
[4497] | 249 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 250 | SUBROUTINE user_parin |
---|
| 251 | |
---|
[4497] | 252 | CHARACTER (LEN=80) :: line !< string containing the last line read from namelist file |
---|
[3687] | 253 | |
---|
[4497] | 254 | INTEGER(iwp) :: i !< |
---|
| 255 | INTEGER(iwp) :: io_status !< status after reading the namelist file |
---|
| 256 | INTEGER(iwp) :: j !< |
---|
[3687] | 257 | |
---|
[4843] | 258 | LOGICAL :: switch_off_module = .FALSE. !< local namelist parameter to switch off the module |
---|
| 259 | !< although the respective module namelist appears in |
---|
| 260 | !< the namelist file |
---|
[3687] | 261 | |
---|
[4843] | 262 | NAMELIST /user_parameters/ data_output_masks_user, & |
---|
| 263 | data_output_pr_user, & |
---|
| 264 | data_output_user, & |
---|
| 265 | region, & |
---|
| 266 | switch_off_module |
---|
[3687] | 267 | |
---|
| 268 | ! |
---|
[3768] | 269 | !-- Next statement is to avoid compiler warnings about unused variables. Please remove in case |
---|
| 270 | !-- that you are using them. |
---|
| 271 | IF ( dots_num_palm == 0 .OR. dots_num_user == 0 .OR. user_idummy == 0 .OR. & |
---|
| 272 | user_rdummy == 0.0_wp ) CONTINUE |
---|
| 273 | |
---|
| 274 | ! |
---|
[4497] | 275 | !-- Set revision number of this default interface version. It will be checked within the main |
---|
| 276 | !-- program (palm). Please change the revision number in case that the current revision does not |
---|
| 277 | !-- match with previous revisions (e.g. if routines have been added/deleted or if parameter lists |
---|
| 278 | !-- in subroutines have been changed). |
---|
[4495] | 279 | user_interface_current_revision = 'r4495' |
---|
[3687] | 280 | |
---|
| 281 | ! |
---|
[4497] | 282 | !-- Position the namelist-file at the beginning (it has already been opened in parin), and try to |
---|
| 283 | !-- read (find) a namelist named "user_parameters". |
---|
[3687] | 284 | REWIND ( 11 ) |
---|
[4287] | 285 | READ( 11, user_parameters, IOSTAT=io_status ) |
---|
[3687] | 286 | |
---|
[4287] | 287 | ! |
---|
| 288 | !-- Actions depending on the READ status |
---|
| 289 | IF ( io_status == 0 ) THEN |
---|
| 290 | ! |
---|
| 291 | !-- User namelist found and correctly read. Set default module switch to true. This activates |
---|
| 292 | !-- calls of the user-interface subroutines. |
---|
[4843] | 293 | IF ( .NOT. switch_off_module ) user_module_enabled = .TRUE. |
---|
[3687] | 294 | |
---|
[4287] | 295 | ELSEIF ( io_status > 0 ) THEN |
---|
| 296 | ! |
---|
| 297 | !-- User namelist was found, but contained errors. Print an error message containing the line |
---|
| 298 | !-- that caused the problem |
---|
| 299 | BACKSPACE( 11 ) |
---|
| 300 | READ( 11 , '(A)') line |
---|
| 301 | CALL parin_fail_message( 'user_parameters', line ) |
---|
[3701] | 302 | |
---|
[4287] | 303 | ENDIF |
---|
[3687] | 304 | |
---|
| 305 | ! |
---|
[4497] | 306 | !-- Determine the number of user-defined profiles and append them to the standard data output |
---|
| 307 | !-- (data_output_pr) |
---|
[3701] | 308 | IF ( user_module_enabled ) THEN |
---|
[3687] | 309 | IF ( data_output_pr_user(1) /= ' ' ) THEN |
---|
| 310 | i = 1 |
---|
[4853] | 311 | DO WHILE ( data_output_pr(i) /= ' ' .AND. i <= 200 ) |
---|
[3687] | 312 | i = i + 1 |
---|
| 313 | ENDDO |
---|
| 314 | j = 1 |
---|
[4853] | 315 | DO WHILE ( data_output_pr_user(j) /= ' ' .AND. j <= 200 ) |
---|
[3687] | 316 | data_output_pr(i) = data_output_pr_user(j) |
---|
| 317 | max_pr_user_tmp = max_pr_user_tmp + 1 |
---|
| 318 | i = i + 1 |
---|
| 319 | j = j + 1 |
---|
| 320 | ENDDO |
---|
| 321 | ENDIF |
---|
| 322 | ENDIF |
---|
| 323 | |
---|
[3701] | 324 | |
---|
[3687] | 325 | END SUBROUTINE user_parin |
---|
| 326 | |
---|
| 327 | |
---|
[4497] | 328 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 329 | ! Description: |
---|
| 330 | ! ------------ |
---|
| 331 | !> Check &userpar control parameters and deduce further quantities. |
---|
[4497] | 332 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 333 | SUBROUTINE user_check_parameters |
---|
| 334 | |
---|
[4497] | 335 | ! |
---|
| 336 | !-- Here the user may add code to check the validity of further &userpar control parameters or |
---|
| 337 | !-- deduce further quantities. |
---|
[3687] | 338 | |
---|
| 339 | |
---|
| 340 | END SUBROUTINE user_check_parameters |
---|
| 341 | |
---|
| 342 | |
---|
[4497] | 343 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 344 | ! Description: |
---|
| 345 | ! ------------ |
---|
[3700] | 346 | !> Set module-specific timeseries units and labels |
---|
[4497] | 347 | !--------------------------------------------------------------------------------------------------! |
---|
[3700] | 348 | SUBROUTINE user_check_data_output_ts( dots_max, dots_num, dots_label, dots_unit ) |
---|
| 349 | |
---|
[4497] | 350 | INTEGER(iwp), INTENT(IN) :: dots_max !< |
---|
| 351 | INTEGER(iwp), INTENT(INOUT) :: dots_num !< |
---|
[3700] | 352 | |
---|
[4497] | 353 | CHARACTER(LEN=*), DIMENSION(dots_max), INTENT(INOUT) :: dots_label !< |
---|
| 354 | CHARACTER(LEN=*), DIMENSION(dots_max), INTENT(INOUT) :: dots_unit !< |
---|
[3700] | 355 | |
---|
[3768] | 356 | ! |
---|
| 357 | !-- Next line is to avoid compiler warning about unused variables. Please remove. |
---|
| 358 | IF ( dots_num == 0 .OR. dots_label(1)(1:1) == ' ' .OR. dots_unit(1)(1:1) == ' ' ) CONTINUE |
---|
[3700] | 359 | |
---|
[3768] | 360 | ! |
---|
[4497] | 361 | !-- Sample for user-defined time series: |
---|
| 362 | !-- For each time series quantity you have to give a label and a unit, which will be used for the |
---|
| 363 | !-- NetCDF file. They must not contain more than seven characters. The value of dots_num has to be |
---|
| 364 | !-- increased by the number of new time series quantities. Its old value has to be stored in |
---|
| 365 | !-- dots_num_palm. See routine user_statistics on how to calculate and output these quantities. |
---|
[3700] | 366 | |
---|
| 367 | ! dots_num_palm = dots_num |
---|
| 368 | |
---|
| 369 | ! dots_num = dots_num + 1 |
---|
| 370 | ! dots_num_user = dots_num_user + 1 |
---|
| 371 | ! dots_label(dots_num) = 'abs_umx' |
---|
| 372 | ! dots_unit(dots_num) = 'm/s' |
---|
| 373 | |
---|
| 374 | ! dots_num = dots_num + 1 |
---|
| 375 | ! dots_num_user = dots_num_user + 1 |
---|
| 376 | ! dots_label(dots_num) = 'abs_vmx' |
---|
| 377 | ! dots_unit(dots_num) = 'm/s' |
---|
| 378 | |
---|
| 379 | |
---|
| 380 | END SUBROUTINE user_check_data_output_ts |
---|
| 381 | |
---|
| 382 | |
---|
[4497] | 383 | !--------------------------------------------------------------------------------------------------! |
---|
[3700] | 384 | ! Description: |
---|
| 385 | ! ------------ |
---|
[4497] | 386 | !> Set the unit of user defined profile output quantities. For those variables not recognized by the |
---|
| 387 | !> user, the parameter unit is set to "illegal", which tells the calling routine that the |
---|
| 388 | !> output variable is not defined and leads to a program abort. |
---|
| 389 | !--------------------------------------------------------------------------------------------------! |
---|
[3700] | 390 | SUBROUTINE user_check_data_output_pr( variable, var_count, unit, dopr_unit ) |
---|
[3687] | 391 | |
---|
| 392 | |
---|
| 393 | USE profil_parameter |
---|
| 394 | |
---|
| 395 | |
---|
[4497] | 396 | CHARACTER (LEN=*) :: unit !< |
---|
| 397 | CHARACTER (LEN=*) :: variable !< |
---|
[3700] | 398 | CHARACTER (LEN=*) :: dopr_unit !< local value of dopr_unit |
---|
[3687] | 399 | |
---|
[4497] | 400 | ! INTEGER(iwp) :: user_pr_index !< |
---|
| 401 | INTEGER(iwp) :: var_count !< |
---|
[3687] | 402 | |
---|
[3768] | 403 | ! |
---|
| 404 | !-- Next line is to avoid compiler warning about unused variables. Please remove. |
---|
| 405 | IF ( unit(1:1) == ' ' .OR. dopr_unit(1:1) == ' ' .OR. var_count == 0 ) CONTINUE |
---|
| 406 | |
---|
[3687] | 407 | SELECT CASE ( TRIM( variable ) ) |
---|
| 408 | |
---|
| 409 | ! |
---|
| 410 | !-- Uncomment and extend the following lines, if necessary. |
---|
[4497] | 411 | !-- Add additional CASE statements depending on the number of quantities for which profiles are |
---|
| 412 | !-- to be calculated. The respective calculations to be performed have to be added in routine |
---|
| 413 | !-- user_statistics. The quantities are (internally) identified by a user-profile-number |
---|
| 414 | !-- (see variable "user_pr_index" below). The first user-profile must be assigned the number |
---|
| 415 | !-- "pr_palm+1", the second one "pr_palm+2", etc. The respective user-profile-numbers have also |
---|
| 416 | !-- to be used in routine user_statistics! |
---|
| 417 | ! CASE ( 'u*v*' ) ! quantity string as given in data_output_pr_user |
---|
[3687] | 418 | ! user_pr_index = pr_palm + 1 |
---|
| 419 | ! dopr_index(var_count) = user_pr_index ! quantities' user-profile-number |
---|
[3700] | 420 | ! dopr_unit = 'm2/s2' ! quantity unit |
---|
| 421 | ! unit = dopr_unit |
---|
[4497] | 422 | ! hom(:,2,user_pr_index,:) = SPREAD( zu, 2, statistic_regions+1 ) |
---|
| 423 | ! ! grid on which the quantity is defined (use zu or zw) |
---|
| 424 | ! |
---|
[3687] | 425 | |
---|
| 426 | CASE DEFAULT |
---|
| 427 | unit = 'illegal' |
---|
| 428 | |
---|
| 429 | END SELECT |
---|
| 430 | |
---|
| 431 | |
---|
| 432 | END SUBROUTINE user_check_data_output_pr |
---|
| 433 | |
---|
| 434 | |
---|
[4497] | 435 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 436 | ! Description: |
---|
| 437 | ! ------------ |
---|
[4497] | 438 | !> Set the unit of user defined output quantities. For those variables not recognized by the user, |
---|
| 439 | !> the parameter unit is set to "illegal", which tells the calling routine that the output variable |
---|
| 440 | !> is not defined and leads to a program abort. |
---|
| 441 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 442 | SUBROUTINE user_check_data_output( variable, unit ) |
---|
| 443 | |
---|
| 444 | |
---|
[4497] | 445 | CHARACTER (LEN=*) :: unit !< |
---|
| 446 | CHARACTER (LEN=*) :: variable !< |
---|
[3687] | 447 | |
---|
| 448 | |
---|
| 449 | SELECT CASE ( TRIM( variable ) ) |
---|
| 450 | |
---|
| 451 | ! |
---|
| 452 | !-- Uncomment and extend the following lines, if necessary |
---|
| 453 | ! CASE ( 'u2' ) |
---|
| 454 | ! unit = 'm2/s2' |
---|
| 455 | ! |
---|
| 456 | ! CASE ( 'u*v*' ) |
---|
| 457 | ! unit = 'm2/s2' |
---|
| 458 | ! |
---|
| 459 | CASE DEFAULT |
---|
| 460 | unit = 'illegal' |
---|
| 461 | |
---|
| 462 | END SELECT |
---|
| 463 | |
---|
| 464 | |
---|
| 465 | END SUBROUTINE user_check_data_output |
---|
| 466 | |
---|
| 467 | |
---|
[4497] | 468 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 469 | ! Description: |
---|
| 470 | ! ------------ |
---|
[3747] | 471 | !> Initialize user-defined arrays |
---|
[4497] | 472 | !--------------------------------------------------------------------------------------------------! |
---|
[3747] | 473 | SUBROUTINE user_init_arrays |
---|
| 474 | |
---|
| 475 | |
---|
[3768] | 476 | ! INTEGER(iwp) :: i !< loop index |
---|
| 477 | ! INTEGER(iwp) :: j !< loop index |
---|
| 478 | ! INTEGER(iwp) :: region !< index for loop over statistic regions |
---|
[3747] | 479 | |
---|
| 480 | ! |
---|
| 481 | !-- Allocate user-defined arrays and set flags for statistic regions. |
---|
| 482 | !-- Sample for user-defined output |
---|
| 483 | ! ALLOCATE( u2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 484 | ! ALLOCATE( ustvst(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 485 | |
---|
| 486 | ! |
---|
| 487 | !-- Example for defining a statistic region: |
---|
[4504] | 488 | !-- ATTENTION: rmask = 0 is required at the ghost boundaries to guarantee correct statistic |
---|
| 489 | !-- evaluations (otherwise ghost points would be counted twice). This setting has |
---|
| 490 | !-- already been cared for in routine init_3d_model. Please don't set the ghost points |
---|
| 491 | !-- /= 0. i.e. run the following loop only over nxl,nxr and nys,nyn. |
---|
[3747] | 492 | ! IF ( statistic_regions >= 1 ) THEN |
---|
| 493 | ! region = 1 |
---|
[4497] | 494 | ! |
---|
[3747] | 495 | ! rmask(:,:,region) = 0.0_wp |
---|
| 496 | ! DO i = nxl, nxr |
---|
| 497 | ! IF ( i >= INT( 0.25 * nx ) .AND. i <= INT( 0.75 * nx ) ) THEN |
---|
| 498 | ! DO j = nys, nyn |
---|
| 499 | ! IF ( i >= INT( 0.25 * ny ) .AND. i <= INT( 0.75 * ny ) ) THEN |
---|
| 500 | ! rmask(j,i,region) = 1.0_wp |
---|
| 501 | ! ENDIF |
---|
| 502 | ! ENDDO |
---|
| 503 | ! ENDIF |
---|
| 504 | ! ENDDO |
---|
[4497] | 505 | ! |
---|
[3747] | 506 | ! ENDIF |
---|
| 507 | |
---|
| 508 | END SUBROUTINE user_init_arrays |
---|
| 509 | |
---|
| 510 | |
---|
[4497] | 511 | !--------------------------------------------------------------------------------------------------! |
---|
[3747] | 512 | ! Description: |
---|
| 513 | ! ------------ |
---|
[3687] | 514 | !> Execution of user-defined initializing actions |
---|
[4497] | 515 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 516 | SUBROUTINE user_init |
---|
| 517 | |
---|
| 518 | |
---|
[4497] | 519 | ! CHARACTER(LEN=20) :: field_char !< |
---|
[3687] | 520 | ! |
---|
| 521 | !-- Here the user-defined initializing actions follow: |
---|
| 522 | !-- Sample for user-defined output |
---|
[3747] | 523 | ! ustvst = 0.0_wp |
---|
[3687] | 524 | |
---|
| 525 | |
---|
| 526 | END SUBROUTINE user_init |
---|
| 527 | |
---|
| 528 | |
---|
[4497] | 529 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 530 | ! Description: |
---|
| 531 | ! ------------ |
---|
[4497] | 532 | !> Set the grids on which user-defined output quantities are defined. Allowed values for grid_x are |
---|
| 533 | !> "x" and "xu", for grid_y "y" and "yv", and for grid_z "zu" and "zw". |
---|
| 534 | !--------------------------------------------------------------------------------------------------! |
---|
[3700] | 535 | SUBROUTINE user_define_netcdf_grid( variable, found, grid_x, grid_y, grid_z ) |
---|
| 536 | |
---|
| 537 | |
---|
| 538 | CHARACTER (LEN=*) :: grid_x !< |
---|
| 539 | CHARACTER (LEN=*) :: grid_y !< |
---|
| 540 | CHARACTER (LEN=*) :: grid_z !< |
---|
| 541 | CHARACTER (LEN=*) :: variable !< |
---|
| 542 | |
---|
| 543 | LOGICAL :: found !< |
---|
| 544 | |
---|
| 545 | |
---|
| 546 | SELECT CASE ( TRIM( variable ) ) |
---|
| 547 | |
---|
| 548 | ! |
---|
| 549 | !-- Uncomment and extend the following lines, if necessary |
---|
| 550 | ! CASE ( 'u2', 'u2_xy', 'u2_xz', 'u2_yz' ) |
---|
| 551 | ! found = .TRUE. |
---|
| 552 | ! grid_x = 'xu' |
---|
| 553 | ! grid_y = 'y' |
---|
| 554 | ! grid_z = 'zu' |
---|
| 555 | |
---|
| 556 | ! CASE ( 'u*v*', 'u*v*_xy', 'u*v*_xz', 'u*v*_yz' ) |
---|
| 557 | ! found = .TRUE. |
---|
| 558 | ! grid_x = 'x' |
---|
| 559 | ! grid_y = 'y' |
---|
| 560 | ! grid_z = 'zu' |
---|
| 561 | |
---|
| 562 | CASE DEFAULT |
---|
| 563 | found = .FALSE. |
---|
| 564 | grid_x = 'none' |
---|
| 565 | grid_y = 'none' |
---|
| 566 | grid_z = 'none' |
---|
| 567 | |
---|
| 568 | END SELECT |
---|
| 569 | |
---|
| 570 | |
---|
| 571 | END SUBROUTINE user_define_netcdf_grid |
---|
| 572 | |
---|
| 573 | |
---|
| 574 | |
---|
| 575 | |
---|
[4497] | 576 | !--------------------------------------------------------------------------------------------------! |
---|
[3700] | 577 | ! Description: |
---|
| 578 | ! ------------ |
---|
[3687] | 579 | !> Print a header with user-defined information. |
---|
[4497] | 580 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 581 | SUBROUTINE user_header( io ) |
---|
| 582 | |
---|
| 583 | |
---|
[4497] | 584 | INTEGER(iwp) :: i !< |
---|
| 585 | INTEGER(iwp) :: io !< |
---|
[3687] | 586 | |
---|
| 587 | ! |
---|
[4497] | 588 | !-- If no user-defined variables are read from the namelist-file, no information will be printed. |
---|
[3701] | 589 | IF ( .NOT. user_module_enabled ) THEN |
---|
[3687] | 590 | WRITE ( io, 100 ) |
---|
| 591 | RETURN |
---|
| 592 | ENDIF |
---|
| 593 | |
---|
| 594 | ! |
---|
| 595 | !-- Printing the information. |
---|
| 596 | WRITE ( io, 110 ) |
---|
| 597 | |
---|
| 598 | IF ( statistic_regions /= 0 ) THEN |
---|
| 599 | WRITE ( io, 200 ) |
---|
| 600 | DO i = 0, statistic_regions |
---|
| 601 | WRITE ( io, 201 ) i, region(i) |
---|
| 602 | ENDDO |
---|
| 603 | ENDIF |
---|
| 604 | |
---|
| 605 | ! |
---|
| 606 | !-- Format-descriptors |
---|
| 607 | 100 FORMAT (//' *** no user-defined variables found'/) |
---|
[4497] | 608 | 110 FORMAT (//1X,78('#') // ' User-defined variables and actions:' / & |
---|
| 609 | ' -----------------------------------'//) |
---|
[3687] | 610 | 200 FORMAT (' Output of profiles and time series for following regions:' /) |
---|
| 611 | 201 FORMAT (4X,'Region ',I1,': ',A) |
---|
| 612 | |
---|
| 613 | |
---|
| 614 | END SUBROUTINE user_header |
---|
| 615 | |
---|
| 616 | |
---|
[4497] | 617 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 618 | ! Description: |
---|
| 619 | ! ------------ |
---|
| 620 | !> Call for all grid points |
---|
[4497] | 621 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 622 | SUBROUTINE user_actions( location ) |
---|
| 623 | |
---|
| 624 | |
---|
[4497] | 625 | CHARACTER(LEN=*) :: location !< |
---|
[3687] | 626 | |
---|
[4497] | 627 | ! INTEGER(iwp) :: i !< |
---|
| 628 | ! INTEGER(iwp) :: j !< |
---|
| 629 | ! INTEGER(iwp) :: k !< |
---|
[3687] | 630 | |
---|
| 631 | CALL cpu_log( log_point(24), 'user_actions', 'start' ) |
---|
| 632 | |
---|
| 633 | ! |
---|
[4497] | 634 | !-- Here the user-defined actions follow. No calls for single grid points are allowed at locations |
---|
| 635 | !-- before and after the timestep, since these calls are not within an i,j-loop |
---|
[3687] | 636 | SELECT CASE ( location ) |
---|
| 637 | |
---|
| 638 | CASE ( 'before_timestep' ) |
---|
| 639 | ! |
---|
| 640 | !-- Enter actions to be done before every timestep here |
---|
| 641 | |
---|
[3911] | 642 | CASE ( 'before_prognostic_equations' ) |
---|
| 643 | ! |
---|
| 644 | !-- Enter actions to be done before all prognostic equations here |
---|
[3687] | 645 | |
---|
| 646 | CASE ( 'after_integration' ) |
---|
| 647 | ! |
---|
[4497] | 648 | !-- Enter actions to be done after every time integration (before data output) |
---|
[3687] | 649 | !-- Sample for user-defined output: |
---|
| 650 | ! DO i = nxlg, nxrg |
---|
| 651 | ! DO j = nysg, nyng |
---|
| 652 | ! DO k = nzb, nzt |
---|
| 653 | ! u2(k,j,i) = u(k,j,i)**2 |
---|
| 654 | ! ENDDO |
---|
| 655 | ! ENDDO |
---|
| 656 | ! ENDDO |
---|
| 657 | ! DO i = nxlg, nxr |
---|
| 658 | ! DO j = nysg, nyn |
---|
| 659 | ! DO k = nzb, nzt+1 |
---|
| 660 | ! ustvst(k,j,i) = & |
---|
[4497] | 661 | ! ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,0) ) * & |
---|
[3687] | 662 | ! ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,0) ) |
---|
| 663 | ! ENDDO |
---|
| 664 | ! ENDDO |
---|
| 665 | ! ENDDO |
---|
| 666 | |
---|
| 667 | |
---|
| 668 | CASE ( 'after_timestep' ) |
---|
| 669 | ! |
---|
| 670 | !-- Enter actions to be done after every timestep here |
---|
| 671 | |
---|
| 672 | |
---|
| 673 | CASE ( 'u-tendency' ) |
---|
| 674 | ! |
---|
| 675 | !-- Enter actions to be done in the u-tendency term here |
---|
| 676 | |
---|
| 677 | |
---|
| 678 | CASE ( 'v-tendency' ) |
---|
| 679 | |
---|
| 680 | |
---|
| 681 | CASE ( 'w-tendency' ) |
---|
| 682 | |
---|
| 683 | |
---|
| 684 | CASE ( 'pt-tendency' ) |
---|
| 685 | |
---|
| 686 | |
---|
| 687 | CASE ( 'sa-tendency' ) |
---|
| 688 | |
---|
| 689 | |
---|
| 690 | CASE ( 'e-tendency' ) |
---|
| 691 | |
---|
| 692 | |
---|
| 693 | CASE ( 'q-tendency' ) |
---|
| 694 | |
---|
| 695 | |
---|
| 696 | CASE ( 's-tendency' ) |
---|
| 697 | |
---|
| 698 | |
---|
| 699 | CASE DEFAULT |
---|
[3911] | 700 | CONTINUE |
---|
[3687] | 701 | |
---|
| 702 | END SELECT |
---|
| 703 | |
---|
| 704 | CALL cpu_log( log_point(24), 'user_actions', 'stop' ) |
---|
| 705 | |
---|
| 706 | END SUBROUTINE user_actions |
---|
| 707 | |
---|
| 708 | |
---|
[4497] | 709 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 710 | ! Description: |
---|
| 711 | ! ------------ |
---|
| 712 | !> Call for grid point i,j |
---|
[4497] | 713 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 714 | SUBROUTINE user_actions_ij( i, j, location ) |
---|
| 715 | |
---|
| 716 | |
---|
[4497] | 717 | CHARACTER(LEN=*) :: location !< |
---|
[3687] | 718 | |
---|
[4497] | 719 | INTEGER(iwp) :: i !< |
---|
| 720 | INTEGER(iwp) :: j !< |
---|
[3687] | 721 | |
---|
| 722 | ! |
---|
| 723 | !-- Here the user-defined actions follow |
---|
| 724 | SELECT CASE ( location ) |
---|
| 725 | |
---|
| 726 | CASE ( 'u-tendency' ) |
---|
[3768] | 727 | |
---|
[3687] | 728 | ! |
---|
[3768] | 729 | !-- Next line is to avoid compiler warning about unused variables. Please remove. |
---|
| 730 | IF ( i == 0 .OR. j == 0 ) CONTINUE |
---|
| 731 | |
---|
| 732 | ! |
---|
[3687] | 733 | !-- Enter actions to be done in the u-tendency term here |
---|
| 734 | |
---|
| 735 | |
---|
| 736 | CASE ( 'v-tendency' ) |
---|
| 737 | |
---|
| 738 | |
---|
| 739 | CASE ( 'w-tendency' ) |
---|
| 740 | |
---|
| 741 | |
---|
| 742 | CASE ( 'pt-tendency' ) |
---|
| 743 | |
---|
| 744 | |
---|
| 745 | CASE ( 'sa-tendency' ) |
---|
| 746 | |
---|
| 747 | |
---|
| 748 | CASE ( 'e-tendency' ) |
---|
| 749 | |
---|
| 750 | |
---|
| 751 | CASE ( 'q-tendency' ) |
---|
| 752 | |
---|
| 753 | |
---|
| 754 | CASE ( 's-tendency' ) |
---|
| 755 | |
---|
| 756 | |
---|
| 757 | CASE DEFAULT |
---|
[3911] | 758 | CONTINUE |
---|
[3687] | 759 | |
---|
| 760 | END SELECT |
---|
| 761 | |
---|
| 762 | END SUBROUTINE user_actions_ij |
---|
| 763 | |
---|
| 764 | |
---|
[4497] | 765 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 766 | ! Description: |
---|
| 767 | ! ------------ |
---|
[4497] | 768 | !> Sum up and time-average user-defined output quantities as well as allocate the array necessary |
---|
| 769 | !> for storing the average. |
---|
| 770 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 771 | SUBROUTINE user_3d_data_averaging( mode, variable ) |
---|
| 772 | |
---|
| 773 | |
---|
[4497] | 774 | CHARACTER(LEN=*) :: mode !< |
---|
| 775 | CHARACTER(LEN=*) :: variable !< |
---|
[3687] | 776 | |
---|
[4497] | 777 | ! INTEGER(iwp) :: i !< |
---|
| 778 | ! INTEGER(iwp) :: j !< |
---|
| 779 | ! INTEGER(iwp) :: k !< |
---|
[3687] | 780 | |
---|
| 781 | IF ( mode == 'allocate' ) THEN |
---|
| 782 | |
---|
| 783 | SELECT CASE ( TRIM( variable ) ) |
---|
| 784 | |
---|
| 785 | ! |
---|
| 786 | !-- Uncomment and extend the following lines, if necessary. |
---|
[4497] | 787 | !-- The arrays for storing the user defined quantities (here u2_av) have to be declared and |
---|
| 788 | !-- defined by the user! |
---|
[3687] | 789 | !-- Sample for user-defined output: |
---|
| 790 | ! CASE ( 'u2' ) |
---|
| 791 | ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN |
---|
| 792 | ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 793 | ! ENDIF |
---|
| 794 | ! u2_av = 0.0_wp |
---|
| 795 | |
---|
| 796 | CASE DEFAULT |
---|
| 797 | CONTINUE |
---|
| 798 | |
---|
| 799 | END SELECT |
---|
| 800 | |
---|
| 801 | ELSEIF ( mode == 'sum' ) THEN |
---|
| 802 | |
---|
| 803 | SELECT CASE ( TRIM( variable ) ) |
---|
| 804 | |
---|
| 805 | ! |
---|
| 806 | !-- Uncomment and extend the following lines, if necessary. |
---|
[4497] | 807 | !-- The arrays for storing the user defined quantities (here u2 and u2_av) have to be declared |
---|
| 808 | !-- and defined by the user! |
---|
[3687] | 809 | !-- Sample for user-defined output: |
---|
| 810 | ! CASE ( 'u2' ) |
---|
[4497] | 811 | ! IF ( ALLOCATED( u2_av ) ) THEN |
---|
[3687] | 812 | ! DO i = nxlg, nxrg |
---|
| 813 | ! DO j = nysg, nyng |
---|
| 814 | ! DO k = nzb, nzt+1 |
---|
| 815 | ! u2_av(k,j,i) = u2_av(k,j,i) + u2(k,j,i) |
---|
| 816 | ! ENDDO |
---|
| 817 | ! ENDDO |
---|
| 818 | ! ENDDO |
---|
| 819 | ! ENDIF |
---|
| 820 | |
---|
| 821 | CASE DEFAULT |
---|
| 822 | CONTINUE |
---|
| 823 | |
---|
| 824 | END SELECT |
---|
| 825 | |
---|
| 826 | ELSEIF ( mode == 'average' ) THEN |
---|
| 827 | |
---|
| 828 | SELECT CASE ( TRIM( variable ) ) |
---|
| 829 | |
---|
| 830 | ! |
---|
| 831 | !-- Uncomment and extend the following lines, if necessary. |
---|
[4497] | 832 | !-- The arrays for storing the user defined quantities (here u2_av) have to be declared and |
---|
| 833 | !-- defined by the user! |
---|
[3687] | 834 | !-- Sample for user-defined output: |
---|
| 835 | ! CASE ( 'u2' ) |
---|
[4497] | 836 | ! IF ( ALLOCATED( u2_av ) ) THEN |
---|
[3687] | 837 | ! DO i = nxlg, nxrg |
---|
| 838 | ! DO j = nysg, nyng |
---|
| 839 | ! DO k = nzb, nzt+1 |
---|
| 840 | ! u2_av(k,j,i) = u2_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
| 841 | ! ENDDO |
---|
| 842 | ! ENDDO |
---|
| 843 | ! ENDDO |
---|
| 844 | ! ENDIF |
---|
| 845 | |
---|
| 846 | END SELECT |
---|
| 847 | |
---|
| 848 | ENDIF |
---|
| 849 | |
---|
| 850 | |
---|
| 851 | END SUBROUTINE user_3d_data_averaging |
---|
| 852 | |
---|
| 853 | |
---|
[4497] | 854 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 855 | ! Description: |
---|
| 856 | ! ------------ |
---|
[4497] | 857 | !> Resorts the user-defined output quantity with indices (k,j,i) to a temporary array with indices |
---|
| 858 | !> (i,j,k) and sets the grid on which it is defined. Allowed values for grid are "zu" and "zw". |
---|
| 859 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 860 | SUBROUTINE user_data_output_2d( av, variable, found, grid, local_pf, two_d, nzb_do, nzt_do ) |
---|
| 861 | |
---|
| 862 | |
---|
[4497] | 863 | CHARACTER(LEN=*) :: grid !< |
---|
| 864 | CHARACTER(LEN=*) :: variable !< |
---|
[3687] | 865 | |
---|
[4497] | 866 | INTEGER(iwp) :: av !< flag to control data output of instantaneous or time-averaged data |
---|
| 867 | ! INTEGER(iwp) :: i !< grid index along x-direction |
---|
| 868 | ! INTEGER(iwp) :: j !< grid index along y-direction |
---|
| 869 | ! INTEGER(iwp) :: k !< grid index along z-direction |
---|
| 870 | ! INTEGER(iwp) :: m !< running index surface elements |
---|
| 871 | INTEGER(iwp) :: nzb_do !< lower limit of the domain (usually nzb) |
---|
| 872 | INTEGER(iwp) :: nzt_do !< upper limit of the domain (usually nzt+1) |
---|
[3687] | 873 | |
---|
[4497] | 874 | LOGICAL :: found !< |
---|
| 875 | LOGICAL :: two_d !< flag parameter that indicates 2D variables (horizontal cross sections) |
---|
[3687] | 876 | |
---|
[3768] | 877 | ! REAL(wp) :: fill_value = -999.0_wp !< value for the _FillValue attribute |
---|
[3687] | 878 | |
---|
[4497] | 879 | REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) :: local_pf !< |
---|
[3687] | 880 | |
---|
[3768] | 881 | ! |
---|
| 882 | !-- Next line is to avoid compiler warning about unused variables. Please remove. |
---|
| 883 | IF ( av == 0 .OR. local_pf(nxl,nys,nzb_do) == 0.0_wp .OR. two_d ) CONTINUE |
---|
[3687] | 884 | |
---|
[3768] | 885 | |
---|
[3687] | 886 | found = .TRUE. |
---|
| 887 | |
---|
| 888 | SELECT CASE ( TRIM( variable ) ) |
---|
| 889 | |
---|
| 890 | ! |
---|
| 891 | !-- Uncomment and extend the following lines, if necessary. |
---|
[4497] | 892 | !-- The arrays for storing the user defined quantities (here u2 and u2_av) have to be declared |
---|
| 893 | !-- and defined by the user! |
---|
[3687] | 894 | !-- Sample for user-defined output: |
---|
| 895 | ! CASE ( 'u2_xy', 'u2_xz', 'u2_yz' ) |
---|
| 896 | ! IF ( av == 0 ) THEN |
---|
| 897 | ! DO i = nxl, nxr |
---|
| 898 | ! DO j = nys, nyn |
---|
| 899 | ! DO k = nzb_do, nzt_do |
---|
| 900 | ! local_pf(i,j,k) = u2(k,j,i) |
---|
| 901 | ! ENDDO |
---|
| 902 | ! ENDDO |
---|
| 903 | ! ENDDO |
---|
| 904 | ! ELSE |
---|
[4497] | 905 | ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN |
---|
[3687] | 906 | ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 907 | ! u2_av = REAL( fill_value, KIND = wp ) |
---|
| 908 | ! ENDIF |
---|
| 909 | ! DO i = nxl, nxr |
---|
| 910 | ! DO j = nys, nyn |
---|
| 911 | ! DO k = nzb_do, nzt_do |
---|
| 912 | ! local_pf(i,j,k) = u2_av(k,j,i) |
---|
| 913 | ! ENDDO |
---|
| 914 | ! ENDDO |
---|
| 915 | ! ENDDO |
---|
| 916 | ! ENDIF |
---|
| 917 | ! |
---|
| 918 | ! grid = 'zu' |
---|
| 919 | ! |
---|
[4497] | 920 | !-- In case two-dimensional surface variables are output, the user has to access related |
---|
| 921 | !-- surface-type. Uncomment and extend following lines appropriately (example output of vertical |
---|
| 922 | !-- surface momentum flux of u-component). Please note, surface elements can be distributed over |
---|
| 923 | !-- several data types, depending on their respective surface properties. |
---|
[3687] | 924 | ! CASE ( 'usws_xy' ) |
---|
| 925 | ! IF ( av == 0 ) THEN |
---|
| 926 | ! |
---|
| 927 | !-- Horizontal default-type surfaces |
---|
| 928 | ! DO m = 1, surf_def_h(0)%ns |
---|
| 929 | ! i = surf_def_h(0)%i(m) |
---|
| 930 | ! j = surf_def_h(0)%j(m) |
---|
| 931 | ! local_pf(i,j,1) = surf_def_h(0)%usws(m) |
---|
| 932 | ! ENDDO |
---|
| 933 | ! |
---|
| 934 | !-- Horizontal natural-type surfaces |
---|
| 935 | ! DO m = 1, surf_lsm_h%ns |
---|
| 936 | ! i = surf_lsm_h%i(m) |
---|
| 937 | ! j = surf_lsm_h%j(m) |
---|
| 938 | ! local_pf(i,j,1) = surf_lsm_h%usws(m) |
---|
| 939 | ! ENDDO |
---|
| 940 | ! |
---|
| 941 | !-- Horizontal urban-type surfaces |
---|
| 942 | ! DO m = 1, surf_usm_h%ns |
---|
| 943 | ! i = surf_usm_h%i(m) |
---|
| 944 | ! j = surf_usm_h%j(m) |
---|
| 945 | ! local_pf(i,j,1) = surf_usm_h%usws(m) |
---|
| 946 | ! ENDDO |
---|
| 947 | ! ENDIF |
---|
| 948 | ! |
---|
| 949 | ! grid = 'zu' |
---|
[4497] | 950 | !-- |
---|
[3687] | 951 | |
---|
| 952 | |
---|
| 953 | CASE DEFAULT |
---|
| 954 | found = .FALSE. |
---|
| 955 | grid = 'none' |
---|
| 956 | |
---|
| 957 | END SELECT |
---|
| 958 | |
---|
| 959 | |
---|
| 960 | END SUBROUTINE user_data_output_2d |
---|
| 961 | |
---|
| 962 | |
---|
[4497] | 963 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 964 | ! Description: |
---|
| 965 | ! ------------ |
---|
[4497] | 966 | !> Resorts the user-defined output quantity with indices (k,j,i) to a temporary array with indices |
---|
| 967 | !> (i,j,k). |
---|
| 968 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 969 | SUBROUTINE user_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do ) |
---|
| 970 | |
---|
| 971 | |
---|
[4497] | 972 | CHARACTER(LEN=*) :: variable !< |
---|
[3687] | 973 | |
---|
[4497] | 974 | INTEGER(iwp) :: av !< |
---|
| 975 | ! INTEGER(iwp) :: i !< |
---|
| 976 | ! INTEGER(iwp) :: j !< |
---|
| 977 | ! INTEGER(iwp) :: k !< |
---|
[3687] | 978 | INTEGER(iwp) :: nzb_do !< lower limit of the data output (usually 0) |
---|
| 979 | INTEGER(iwp) :: nzt_do !< vertical upper limit of the data output (usually nz_do3d) |
---|
| 980 | |
---|
[4497] | 981 | LOGICAL :: found !< |
---|
[3687] | 982 | |
---|
[4497] | 983 | ! REAL(wp) :: fill_value = -999.0_wp !< value for the _FillValue attribute |
---|
[3687] | 984 | |
---|
[4768] | 985 | REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) :: local_pf !< |
---|
[3687] | 986 | |
---|
[3768] | 987 | ! |
---|
| 988 | !-- Next line is to avoid compiler warning about unused variables. Please remove. |
---|
| 989 | IF ( av == 0 .OR. local_pf(nxl,nys,nzb_do) == 0.0_wp ) CONTINUE |
---|
[3687] | 990 | |
---|
[3768] | 991 | |
---|
[3687] | 992 | found = .TRUE. |
---|
| 993 | |
---|
| 994 | SELECT CASE ( TRIM( variable ) ) |
---|
| 995 | |
---|
| 996 | ! |
---|
| 997 | !-- Uncomment and extend the following lines, if necessary. |
---|
[4497] | 998 | !-- The arrays for storing the user defined quantities (here u2 and u2_av) have to be declared |
---|
| 999 | !-- and defined by the user! |
---|
[3687] | 1000 | !-- Sample for user-defined output: |
---|
| 1001 | ! CASE ( 'u2' ) |
---|
| 1002 | ! IF ( av == 0 ) THEN |
---|
| 1003 | ! DO i = nxl, nxr |
---|
| 1004 | ! DO j = nys, nyn |
---|
| 1005 | ! DO k = nzb_do, nzt_do |
---|
| 1006 | ! local_pf(i,j,k) = u2(k,j,i) |
---|
| 1007 | ! ENDDO |
---|
| 1008 | ! ENDDO |
---|
| 1009 | ! ENDDO |
---|
| 1010 | ! ELSE |
---|
[4497] | 1011 | ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN |
---|
[3687] | 1012 | ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 1013 | ! u2_av = REAL( fill_value, KIND = wp ) |
---|
| 1014 | ! ENDIF |
---|
| 1015 | ! DO i = nxl, nxr |
---|
| 1016 | ! DO j = nys, nyn |
---|
| 1017 | ! DO k = nzb_do, nzt_do |
---|
| 1018 | ! local_pf(i,j,k) = u2_av(k,j,i) |
---|
| 1019 | ! ENDDO |
---|
| 1020 | ! ENDDO |
---|
| 1021 | ! ENDDO |
---|
| 1022 | ! ENDIF |
---|
| 1023 | ! |
---|
| 1024 | |
---|
| 1025 | CASE DEFAULT |
---|
| 1026 | found = .FALSE. |
---|
| 1027 | |
---|
| 1028 | END SELECT |
---|
| 1029 | |
---|
| 1030 | |
---|
| 1031 | END SUBROUTINE user_data_output_3d |
---|
| 1032 | |
---|
| 1033 | |
---|
[4497] | 1034 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 1035 | ! Description: |
---|
| 1036 | ! ------------ |
---|
[4497] | 1037 | !> Calculation of user-defined statistics, i.e. horizontally averaged profiles and time series. |
---|
| 1038 | !> This routine is called for every statistic region sr defined by the user, but at least for the |
---|
| 1039 | !> region "total domain" (sr=0). See section 3.5.4 on how to define, calculate, and output user |
---|
| 1040 | !> defined quantities. |
---|
| 1041 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 1042 | SUBROUTINE user_statistics( mode, sr, tn ) |
---|
| 1043 | |
---|
| 1044 | |
---|
[4497] | 1045 | CHARACTER(LEN=*) :: mode !< |
---|
| 1046 | ! INTEGER(iwp) :: i !< |
---|
| 1047 | ! INTEGER(iwp) :: j !< |
---|
| 1048 | ! INTEGER(iwp) :: k !< |
---|
| 1049 | INTEGER(iwp) :: sr !< |
---|
| 1050 | INTEGER(iwp) :: tn !< |
---|
[3687] | 1051 | |
---|
[4497] | 1052 | ! REAL(wp), DIMENSION(:), ALLOCATABLE :: ts_value_l !< |
---|
[3687] | 1053 | |
---|
[3768] | 1054 | ! |
---|
| 1055 | !-- Next line is to avoid compiler warning about unused variables. Please remove. |
---|
| 1056 | IF ( sr == 0 .OR. tn == 0 ) CONTINUE |
---|
| 1057 | |
---|
[3687] | 1058 | IF ( mode == 'profiles' ) THEN |
---|
| 1059 | |
---|
| 1060 | ! |
---|
[4497] | 1061 | !-- Sample on how to calculate horizontally averaged profiles of user-defined quantities. Each |
---|
| 1062 | !-- quantity is identified by the index "pr_palm+#" where "#" is an integer starting from 1. |
---|
| 1063 | !-- These user-profile-numbers must also be assigned to the respective strings given by |
---|
| 1064 | !-- data_output_pr_user in routine user_check_data_output_pr. |
---|
[3687] | 1065 | ! !$OMP DO |
---|
| 1066 | ! DO i = nxl, nxr |
---|
| 1067 | ! DO j = nys, nyn |
---|
| 1068 | ! DO k = nzb+1, nzt |
---|
| 1069 | !! |
---|
[4497] | 1070 | !!-- Sample on how to calculate the profile of the resolved-scale horizontal momentum |
---|
| 1071 | !!-- flux u*v* |
---|
| 1072 | ! sums_l(k,pr_palm+1,tn) = sums_l(k,pr_palm+1,tn) + & |
---|
| 1073 | ! ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,sr) ) * & |
---|
| 1074 | ! ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) ) * & |
---|
| 1075 | ! rmask(j,i,sr) * MERGE( 1.0_wp, 0.0_wp, & |
---|
| 1076 | ! BTEST( wall_flags_total_0(k,j,i), 0 ) ) |
---|
[3687] | 1077 | !! |
---|
[4497] | 1078 | !!-- Further profiles can be defined and calculated by increasing the second index of |
---|
| 1079 | !!-- array sums_l (replace ... appropriately) |
---|
| 1080 | ! sums_l(k,pr_palm+2,tn) = sums_l(k,pr_palm+2,tn) + ... * rmask(j,i,sr) |
---|
[3687] | 1081 | ! ENDDO |
---|
| 1082 | ! ENDDO |
---|
| 1083 | ! ENDDO |
---|
| 1084 | |
---|
| 1085 | ELSEIF ( mode == 'time_series' ) THEN |
---|
| 1086 | |
---|
[3700] | 1087 | |
---|
| 1088 | ! ALLOCATE ( ts_value_l(dots_num_user) ) |
---|
[3687] | 1089 | ! |
---|
| 1090 | !-- Sample on how to add values for the user-defined time series quantities. |
---|
[4497] | 1091 | !-- These have to be defined before in routine user_init. This sample creates two time series for |
---|
| 1092 | !-- the absolut values of the horizontal velocities u and v. |
---|
[3687] | 1093 | ! ts_value_l = 0.0_wp |
---|
[3700] | 1094 | ! ts_value_l(1) = ABS( u_max ) |
---|
| 1095 | ! ts_value_l(2) = ABS( v_max ) |
---|
[3687] | 1096 | ! |
---|
| 1097 | !-- Collect / send values to PE0, because only PE0 outputs the time series. |
---|
[4497] | 1098 | !-- CAUTION: Collection is done by taking the sum over all processors. You may have to normalize |
---|
| 1099 | !-- this sum, depending on the quantity that you like to calculate. For serial runs, |
---|
| 1100 | !-- nothing has to be done. |
---|
| 1101 | !-- HINT: If the time series value that you are calculating has the same value on all PEs, you |
---|
| 1102 | !-- can omit the MPI_ALLREDUCE call and assign ts_value(dots_num_palm+1:,sr) = ts_value_l directly. |
---|
[3687] | 1103 | !#if defined( __parallel ) |
---|
| 1104 | ! IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) |
---|
[4497] | 1105 | ! CALL MPI_ALLREDUCE( ts_value_l(1), ts_value(dots_num_palm+1,sr), dots_num_user, MPI_REAL, & |
---|
| 1106 | ! MPI_MAX, comm2d, ierr ) |
---|
[3687] | 1107 | !#else |
---|
[3700] | 1108 | ! ts_value(dots_num_palm+1:dots_num_palm+dots_num_user,sr) = ts_value_l |
---|
[3687] | 1109 | !#endif |
---|
| 1110 | |
---|
| 1111 | ENDIF |
---|
| 1112 | |
---|
| 1113 | END SUBROUTINE user_statistics |
---|
| 1114 | |
---|
| 1115 | |
---|
[4497] | 1116 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 1117 | ! Description: |
---|
| 1118 | ! ------------ |
---|
[4495] | 1119 | !> Read module-specific global restart data (Fortran binary format). |
---|
[4497] | 1120 | !--------------------------------------------------------------------------------------------------! |
---|
[4495] | 1121 | SUBROUTINE user_rrd_global_ftn( found ) |
---|
[3687] | 1122 | |
---|
| 1123 | |
---|
[4497] | 1124 | LOGICAL, INTENT(OUT) :: found !< |
---|
[3687] | 1125 | |
---|
| 1126 | |
---|
[3768] | 1127 | found = .TRUE. |
---|
[3687] | 1128 | |
---|
| 1129 | |
---|
[3768] | 1130 | SELECT CASE ( restart_string(1:length) ) |
---|
[3687] | 1131 | |
---|
[3768] | 1132 | CASE ( 'global_paramter' ) |
---|
| 1133 | ! READ ( 13 ) global_parameter |
---|
[3687] | 1134 | |
---|
[3768] | 1135 | CASE DEFAULT |
---|
[4497] | 1136 | |
---|
[3768] | 1137 | found = .FALSE. |
---|
[3687] | 1138 | |
---|
[3768] | 1139 | END SELECT |
---|
[3687] | 1140 | |
---|
| 1141 | |
---|
[4495] | 1142 | END SUBROUTINE user_rrd_global_ftn |
---|
[3687] | 1143 | |
---|
| 1144 | |
---|
[4497] | 1145 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 1146 | ! Description: |
---|
| 1147 | ! ------------ |
---|
[4495] | 1148 | !> Read module-specific global restart data (MPI-IO). |
---|
[4497] | 1149 | !--------------------------------------------------------------------------------------------------! |
---|
[4495] | 1150 | SUBROUTINE user_rrd_global_mpi |
---|
| 1151 | |
---|
[4517] | 1152 | ! USE restart_data_mpi_io_mod, & |
---|
| 1153 | ! ONLY: rrd_mpi_io |
---|
| 1154 | |
---|
[4495] | 1155 | ! CALL rrd_mpi_io( 'global_parameter', global_parameter ) |
---|
| 1156 | CONTINUE |
---|
| 1157 | |
---|
| 1158 | END SUBROUTINE user_rrd_global_mpi |
---|
| 1159 | |
---|
| 1160 | |
---|
[4497] | 1161 | !--------------------------------------------------------------------------------------------------! |
---|
[4495] | 1162 | ! Description: |
---|
| 1163 | ! ------------ |
---|
[4517] | 1164 | !> Read module-specific local restart data arrays (Fortran binary format). |
---|
| 1165 | !> Subdomain |
---|
[4497] | 1166 | !> index limits on file are given by nxl_on_file, etc. Indices nxlc, etc. indicate the range of |
---|
| 1167 | !> gridpoints to be mapped from the subdomain on file (f) to the subdomain of the current PE (c). |
---|
| 1168 | !> They have been calculated in routine rrd_local. |
---|
| 1169 | !--------------------------------------------------------------------------------------------------! |
---|
[4517] | 1170 | SUBROUTINE user_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc, nxr_on_file, nynf, nync, & |
---|
| 1171 | nyn_on_file, nysf, nysc, nys_on_file, tmp_3d, found ) |
---|
[3687] | 1172 | |
---|
| 1173 | |
---|
[3768] | 1174 | INTEGER(iwp) :: idum !< |
---|
| 1175 | INTEGER(iwp) :: k !< |
---|
| 1176 | INTEGER(iwp) :: nxlc !< |
---|
| 1177 | INTEGER(iwp) :: nxlf !< |
---|
| 1178 | INTEGER(iwp) :: nxl_on_file !< |
---|
| 1179 | INTEGER(iwp) :: nxrc !< |
---|
| 1180 | INTEGER(iwp) :: nxrf !< |
---|
| 1181 | INTEGER(iwp) :: nxr_on_file !< |
---|
| 1182 | INTEGER(iwp) :: nync !< |
---|
| 1183 | INTEGER(iwp) :: nynf !< |
---|
| 1184 | INTEGER(iwp) :: nyn_on_file !< |
---|
| 1185 | INTEGER(iwp) :: nysc !< |
---|
| 1186 | INTEGER(iwp) :: nysf !< |
---|
| 1187 | INTEGER(iwp) :: nys_on_file !< |
---|
[3687] | 1188 | |
---|
[4497] | 1189 | LOGICAL, INTENT(OUT) :: found !< |
---|
[3687] | 1190 | |
---|
[4497] | 1191 | REAL(wp), DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d !< |
---|
[3687] | 1192 | |
---|
| 1193 | ! |
---|
[3768] | 1194 | !-- Next line is to avoid compiler warning about unused variables. Please remove. |
---|
| 1195 | idum = k + nxlc + nxlf + nxrc + nxrf + nync + nynf + nysc + nysf + & |
---|
| 1196 | INT( tmp_3d(nzb,nys_on_file,nxl_on_file) ) |
---|
| 1197 | |
---|
| 1198 | ! |
---|
[3687] | 1199 | !-- Here the reading of user-defined restart data follows: |
---|
| 1200 | !-- Sample for user-defined output |
---|
| 1201 | |
---|
[3768] | 1202 | found = .TRUE. |
---|
[3687] | 1203 | |
---|
[3768] | 1204 | SELECT CASE ( restart_string(1:length) ) |
---|
[3687] | 1205 | |
---|
[3768] | 1206 | CASE ( 'u2_av' ) |
---|
[4497] | 1207 | ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN |
---|
[3768] | 1208 | ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
| 1209 | ! ENDIF |
---|
| 1210 | ! IF ( k == 1 ) READ ( 13 ) tmp_3d |
---|
[4497] | 1211 | ! u2_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & |
---|
| 1212 | ! tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) |
---|
[3687] | 1213 | ! |
---|
[3768] | 1214 | CASE DEFAULT |
---|
[3687] | 1215 | |
---|
[3768] | 1216 | found = .FALSE. |
---|
[3687] | 1217 | |
---|
[3768] | 1218 | END SELECT |
---|
[3687] | 1219 | |
---|
[4517] | 1220 | END SUBROUTINE user_rrd_local_ftn |
---|
[3687] | 1221 | |
---|
| 1222 | |
---|
[4497] | 1223 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 1224 | ! Description: |
---|
| 1225 | ! ------------ |
---|
[4517] | 1226 | !> Read module-specific local restart data arrays (MPI-IO). |
---|
| 1227 | !--------------------------------------------------------------------------------------------------! |
---|
| 1228 | SUBROUTINE user_rrd_local_mpi |
---|
| 1229 | |
---|
| 1230 | ! USE restart_data_mpi_io_mod, & |
---|
| 1231 | ! ONLY: rd_mpi_io_check_array, rrd_mpi_io |
---|
| 1232 | |
---|
| 1233 | ! CALL rd_mpi_io_check_array( 'u2_av' , found = array_found ) |
---|
| 1234 | ! IF ( array_found ) THEN |
---|
| 1235 | ! IF ( .NOT. ALLOCATED( u2_av ) ) ALLOCATE( u2_av(nysg:nyng,nxlg:nxrg) ) |
---|
| 1236 | ! CALL rrd_mpi_io( 'rad_u2_av', rad_u2_av ) |
---|
| 1237 | ! ENDIF |
---|
| 1238 | |
---|
| 1239 | CONTINUE |
---|
| 1240 | |
---|
| 1241 | END SUBROUTINE user_rrd_local_mpi |
---|
| 1242 | |
---|
| 1243 | |
---|
| 1244 | !--------------------------------------------------------------------------------------------------! |
---|
| 1245 | ! Description: |
---|
| 1246 | ! ------------ |
---|
[4497] | 1247 | !> Writes global and user-defined restart data into binary file(s) for restart runs. |
---|
| 1248 | !--------------------------------------------------------------------------------------------------! |
---|
[3768] | 1249 | SUBROUTINE user_wrd_global |
---|
[3687] | 1250 | |
---|
[4517] | 1251 | ! USE restart_data_mpi_io_mod, & |
---|
| 1252 | ! ONLY: wrd_mpi_io |
---|
| 1253 | |
---|
[4495] | 1254 | IF ( TRIM( restart_data_format_output ) == 'fortran_binary' ) THEN |
---|
[3687] | 1255 | |
---|
[4495] | 1256 | ! CALL wrd_write_string( 'global_parameter' ) |
---|
| 1257 | ! WRITE ( 14 ) global_parameter |
---|
| 1258 | |
---|
[4535] | 1259 | ELSEIF ( restart_data_format_output(1:3) == 'mpi' ) THEN |
---|
[4495] | 1260 | |
---|
| 1261 | ! CALL rrd_mpi_io( 'global_parameter', global_parameter ) |
---|
| 1262 | |
---|
| 1263 | ENDIF |
---|
| 1264 | |
---|
[3768] | 1265 | END SUBROUTINE user_wrd_global |
---|
[3687] | 1266 | |
---|
| 1267 | |
---|
[4497] | 1268 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 1269 | ! Description: |
---|
| 1270 | ! ------------ |
---|
[4497] | 1271 | !> Writes processor specific and user-defined restart data into binary file(s) for restart runs. |
---|
| 1272 | !--------------------------------------------------------------------------------------------------! |
---|
[3768] | 1273 | SUBROUTINE user_wrd_local |
---|
[3687] | 1274 | |
---|
[4517] | 1275 | ! USE restart_data_mpi_io_mod, & |
---|
| 1276 | ! ONLY: wrd_mpi_io |
---|
| 1277 | |
---|
[3687] | 1278 | ! |
---|
| 1279 | !-- Here the user-defined actions at the end of a job follow. |
---|
| 1280 | !-- Sample for user-defined output: |
---|
[4495] | 1281 | IF ( TRIM( restart_data_format_output ) == 'fortran_binary' ) THEN |
---|
[3687] | 1282 | |
---|
[4495] | 1283 | ! IF ( ALLOCATED( u2_av ) ) THEN |
---|
| 1284 | ! CALL wrd_write_string( 'u2_av' ) |
---|
| 1285 | ! WRITE ( 14 ) u2_av |
---|
| 1286 | ! ENDIF |
---|
| 1287 | |
---|
[4535] | 1288 | ELSEIF ( restart_data_format_output(1:3) == 'mpi' ) THEN |
---|
[4495] | 1289 | |
---|
| 1290 | ! IF ( ALLOCATED( u2_av ) ) CALL wrd_mpi_io( 'u2_av', u2_av ) |
---|
| 1291 | |
---|
| 1292 | ENDIF |
---|
| 1293 | |
---|
[3768] | 1294 | END SUBROUTINE user_wrd_local |
---|
[3687] | 1295 | |
---|
| 1296 | |
---|
[4497] | 1297 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 1298 | ! Description: |
---|
| 1299 | ! ------------ |
---|
| 1300 | !> Execution of user-defined actions at the end of a job. |
---|
[4497] | 1301 | !--------------------------------------------------------------------------------------------------! |
---|
[3687] | 1302 | SUBROUTINE user_last_actions |
---|
| 1303 | |
---|
| 1304 | ! |
---|
| 1305 | !-- Here the user-defined actions at the end of a job might follow. |
---|
| 1306 | |
---|
| 1307 | |
---|
| 1308 | END SUBROUTINE user_last_actions |
---|
| 1309 | |
---|
[211] | 1310 | END MODULE user |
---|