Changeset 4525 for palm/trunk/TUTORIALS
- Timestamp:
- May 10, 2020 5:05:07 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/TUTORIALS/cases/dispersion_eulerian_and_lpm_extended/USER_CODE/user_module.f90
r4370 r4525 1 1 !> @file user_module.f90 2 !------------------------------------------------------------------------------ !2 !--------------------------------------------------------------------------------------------------! 3 3 ! This file is part of the PALM model system. 4 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/>. 5 ! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General 6 ! Public License as published by the Free Software Foundation, either version 3 of the License, or 7 ! (at your option) any later version. 8 ! 9 ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 10 ! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 11 ! Public License for more details. 12 ! 13 ! You should have received a copy of the GNU General Public License along with PALM. If not, see 14 ! <http://www.gnu.org/licenses/>. 16 15 ! 17 16 ! Copyright 1997-2020 Leibniz Universitaet Hannover 18 !------------------------------------------------------------------------------! 17 !--------------------------------------------------------------------------------------------------! 18 ! 19 19 ! 20 20 ! Current revisions: … … 24 24 ! Former revisions: 25 25 ! ----------------- 26 ! $Id: user_module.f90 3986 2019-05-20 14:08:14Z Giersch $ 26 ! $Id: user_module.f90 4517 2020-05-03 14:29:30Z raasch $ 27 ! Modified user-interface has been adapted to r4521 28 ! 29 ! 4517 2020-05-03 14:29:30Z raasch 30 ! added restart with MPI-IO for reading local arrays 31 ! 32 ! 4504 2020-04-20 12:11:24Z raasch 33 ! hint for setting rmask arrays added 34 ! 35 ! 4497 2020-04-15 10:20:51Z raasch 36 ! file re-formatted to follow the PALM coding standard 37 ! 38 ! 4495 2020-04-13 20:11:20Z raasch 39 ! restart data handling with MPI-IO added 40 ! 41 ! 4360 2020-01-07 11:25:50Z suehring 42 ! Introduction of wall_flags_total_0, which currently sets bits based on static topography 43 ! information used in wall_flags_static_0 44 ! 45 ! 4329 2019-12-10 15:46:36Z motisi 46 ! Renamed wall_flags_0 to wall_flags_static_0 47 ! 48 ! 4287 2019-11-01 14:50:20Z raasch 49 ! reading of namelist file and actions in case of namelist errors revised so that statement labels 50 ! and goto statements are not required any more; this revision also removes a previous bug which 51 ! appeared when the namelist has been commented out in the namelist file 52 ! 53 ! 4182 2019-08-22 15:20:23Z scharf 54 ! Corrected "Former revisions" section 55 ! 56 ! 3986 2019-05-20 14:08:14Z Giersch 27 57 ! Redundant integration of control parameters in user_rrd_global removed 28 ! 58 ! 29 59 ! 3911 2019-04-17 12:26:19Z knoop 30 60 ! Bugfix: added before_prognostic_equations case in user_actions 31 ! 61 ! 32 62 ! 3768 2019-02-27 14:35:58Z raasch 33 63 ! variables commented + statements added to avoid compiler warnings about unused variables … … 35 65 ! 3767 2019-02-27 08:18:02Z raasch 36 66 ! unused variable for file index removed from rrd-subroutines parameter list 37 ! 67 ! 38 68 ! 3747 2019-02-16 15:15:23Z gronemeier 39 69 ! Add routine user_init_arrays 40 ! 70 ! 41 71 ! 3703 2019-01-29 16:43:53Z knoop 42 72 ! An example for a user defined global variable has been added (Giersch) 43 !44 ! 2718 2018-01-02 08:49:38Z suehring45 ! Corrected "Former revisions" section46 !47 ! 2696 2017-12-14 17:12:51Z kanani48 ! Change in file header (GPL part)49 !50 ! 2101 2017-01-05 16:42:31Z suehring51 !52 ! 2000 2016-08-20 18:09:15Z knoop53 ! Forced header and separation lines into 80 columns54 !55 ! 1873 2016-04-18 14:50:06Z maronga56 ! Module renamed (removed _mod)57 !58 !59 ! 1850 2016-04-08 13:29:27Z maronga60 ! Module renamed61 !62 !63 ! 1682 2015-10-07 23:56:08Z knoop64 ! Code annotations made doxygen readable65 !66 ! 1320 2014-03-20 08:40:49Z raasch67 ! kind-parameters added to all INTEGER and REAL declaration statements,68 ! kinds are defined in new module kinds,69 ! old module precision_kind is removed,70 ! revision history before 2012 removed,71 ! comment fields (!:) to be used for variable explanations added to72 ! all variable declaration statements73 !74 ! 1036 2012-10-22 13:43:42Z raasch75 ! code put under GPL (PALM 3.9)76 73 ! 77 74 ! Revision 1.1 1998/03/24 15:29:04 raasch … … 81 78 ! Description: 82 79 ! ------------ 83 !> Declaration of user-defined variables. This module may only be used 84 !> in the user-defined routines(contained in user_interface.f90).85 !------------------------------------------------------------------------------ !80 !> Declaration of user-defined variables. This module may only be used in the user-defined routines 81 !> (contained in user_interface.f90). 82 !--------------------------------------------------------------------------------------------------! 86 83 MODULE user 87 84 88 89 85 USE arrays_3d 90 86 … … 105 101 IMPLICIT NONE 106 102 107 INTEGER(iwp) :: dots_num_palm !<108 INTEGER(iwp) :: dots_num_user = 0 !< 109 INTEGER(iwp) :: user_idummy !<110 111 LOGICAL :: user_module_enabled = .FALSE. !<112 113 REAL(wp) :: user_rdummy !<103 INTEGER(iwp) :: dots_num_palm !< 104 INTEGER(iwp) :: dots_num_user = 0 !< 105 INTEGER(iwp) :: user_idummy !< 106 107 LOGICAL :: user_module_enabled = .FALSE. !< 108 109 REAL(wp) :: user_rdummy !< 114 110 115 111 ! 116 112 !-- Sample for user-defined output 117 ! REAL(wp) :: global_parameter !< user defined global parameter 118 ! 119 ! REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u2 !< user defined array 120 ! REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u2_av !< user defined array 121 ! REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: ustvst !< user defined array 122 113 ! REAL(wp) :: global_parameter !< user defined global parameter 114 ! 115 ! REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u2 !< user defined array 116 ! REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: u2_av !< user defined array 117 ! REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: ustvst !< user defined array 118 119 ! 123 120 !-- User-defined parameters 124 121 INTEGER(iwp), DIMENSION(1:3) :: s_ts_pos_x_ind = 0 … … 130 127 REAL(wp), DIMENSION(1:3) :: s_ts_pos_x = 0.0 131 128 REAL(wp), DIMENSION(1:3) :: s_ts_pos_y = 0.0 132 133 129 SAVE 134 130 … … 137 133 ! 138 134 !- Public functions 139 PUBLIC & 140 user_parin, & 141 user_check_parameters, & 142 user_check_data_output_ts, & 143 user_check_data_output_pr, & 144 user_check_data_output, & 145 user_define_netcdf_grid, & 146 user_init, & 147 user_init_arrays, & 148 user_header, & 149 user_actions, & 150 user_3d_data_averaging, & 151 user_data_output_2d, & 152 user_data_output_3d, & 153 user_statistics, & 154 user_rrd_global, & 155 user_rrd_local, & 156 user_wrd_global, & 157 user_wrd_local, & 158 user_last_actions 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 155 159 156 160 157 ! 161 158 !- Public parameters, constants and initial values 162 PUBLIC &159 PUBLIC & 163 160 user_module_enabled 164 161 … … 221 218 222 219 INTERFACE user_rrd_global 223 MODULE PROCEDURE user_rrd_global 220 MODULE PROCEDURE user_rrd_global_ftn 221 MODULE PROCEDURE user_rrd_global_mpi 224 222 END INTERFACE user_rrd_global 225 223 226 224 INTERFACE user_rrd_local 227 MODULE PROCEDURE user_rrd_local 225 MODULE PROCEDURE user_rrd_local_ftn 226 MODULE PROCEDURE user_rrd_local_mpi 228 227 END INTERFACE user_rrd_local 229 228 … … 244 243 245 244 246 !------------------------------------------------------------------------------ !245 !--------------------------------------------------------------------------------------------------! 247 246 ! Description: 248 247 ! ------------ 249 248 !> Parin for &user_parameters for user module 250 !------------------------------------------------------------------------------ !249 !--------------------------------------------------------------------------------------------------! 251 250 SUBROUTINE user_parin 252 251 253 254 CHARACTER (LEN=80) :: line !< 255 256 INTEGER(iwp) :: i !< 257 INTEGER(iwp) :: j !< 258 259 260 NAMELIST /user_parameters/ & 261 user_module_enabled, & 262 data_output_pr_user, & 263 data_output_user, & 264 region, & 265 data_output_masks_user, & 266 emission_stripe_orig_y, emission_stripe_width_y, & 267 s_ts_pos_x, s_ts_pos_y 252 CHARACTER (LEN=80) :: line !< string containing the last line read from namelist file 253 254 INTEGER(iwp) :: i !< 255 INTEGER(iwp) :: io_status !< status after reading the namelist file 256 INTEGER(iwp) :: j !< 257 258 259 NAMELIST /user_parameters/ & 260 data_output_masks_user, & 261 data_output_pr_user, & 262 data_output_user, & 263 region, & 264 emission_stripe_orig_y, & 265 emission_stripe_width_y, & 266 s_ts_pos_x, & 267 s_ts_pos_y 268 268 269 269 270 ! … … 274 275 275 276 ! 276 !-- Set revision number of this default interface version. It will be checked within 277 !-- the main program (palm). Please change the revision number in case that the 278 !-- current revision does not match with previous revisions (e.g. if routines 279 !-- have been added/deleted or if parameter lists in subroutines have been changed). 280 user_interface_current_revision = 'r3703' 281 282 ! 283 !-- Position the namelist-file at the beginning (it was already opened in 284 !-- parin), search for user-defined namelist-group ("userpar", but any other 285 !-- name can be choosed) and position the file at this line. 277 !-- Set revision number of this default interface version. It will be checked within the main 278 !-- program (palm). Please change the revision number in case that the current revision does not 279 !-- match with previous revisions (e.g. if routines have been added/deleted or if parameter lists 280 !-- in subroutines have been changed). 281 user_interface_current_revision = 'r4495' 282 283 ! 284 !-- Position the namelist-file at the beginning (it has already been opened in parin), and try to 285 !-- read (find) a namelist named "user_parameters". 286 286 REWIND ( 11 ) 287 288 line = ' ' 289 DO WHILE ( INDEX( line, '&user_parameters' ) == 0 ) 290 READ ( 11, '(A)', END=12 ) line 291 ENDDO 292 BACKSPACE ( 11 ) 293 294 !-- Set default module switch to true 295 user_module_enabled = .TRUE. 296 297 !-- Read user-defined namelist 298 READ ( 11, user_parameters, ERR = 10 ) 299 300 GOTO 12 301 302 10 BACKSPACE( 11 ) 303 READ( 11 , '(A)') line 304 CALL parin_fail_message( 'user_parameters', line ) 305 306 12 CONTINUE 307 308 ! 309 !-- Determine the number of user-defined profiles and append them to the 310 !-- standard data output (data_output_pr) 287 READ( 11, user_parameters, IOSTAT=io_status ) 288 289 ! 290 !-- Actions depending on the READ status 291 IF ( io_status == 0 ) THEN 292 ! 293 !-- User namelist found and correctly read. Set default module switch to true. This activates 294 !-- calls of the user-interface subroutines. 295 user_module_enabled = .TRUE. 296 297 ELSEIF ( io_status > 0 ) THEN 298 ! 299 !-- User namelist was found, but contained errors. Print an error message containing the line 300 !-- that caused the problem 301 BACKSPACE( 11 ) 302 READ( 11 , '(A)') line 303 CALL parin_fail_message( 'user_parameters', line ) 304 305 ENDIF 306 307 ! 308 !-- Determine the number of user-defined profiles and append them to the standard data output 309 !-- (data_output_pr) 311 310 IF ( user_module_enabled ) THEN 312 311 IF ( data_output_pr_user(1) /= ' ' ) THEN … … 329 328 330 329 331 !------------------------------------------------------------------------------ !330 !--------------------------------------------------------------------------------------------------! 332 331 ! Description: 333 332 ! ------------ 334 333 !> Check &userpar control parameters and deduce further quantities. 335 !------------------------------------------------------------------------------ !334 !--------------------------------------------------------------------------------------------------! 336 335 SUBROUTINE user_check_parameters 337 336 338 339 !-- Here the user may add code to check the validity of further &userpar 340 !-- control parameters ordeduce further quantities.337 ! 338 !-- Here the user may add code to check the validity of further &userpar control parameters or 339 !-- deduce further quantities. 341 340 342 341 … … 344 343 345 344 346 !------------------------------------------------------------------------------ !345 !--------------------------------------------------------------------------------------------------! 347 346 ! Description: 348 347 ! ------------ 349 348 !> Set module-specific timeseries units and labels 350 !------------------------------------------------------------------------------ !349 !--------------------------------------------------------------------------------------------------! 351 350 SUBROUTINE user_check_data_output_ts( dots_max, dots_num, dots_label, dots_unit ) 352 351 352 INTEGER(iwp), INTENT(IN) :: dots_max !< 353 INTEGER(iwp), INTENT(INOUT) :: dots_num !< 354 355 CHARACTER(LEN=*), DIMENSION(dots_max), INTENT(INOUT) :: dots_label !< 356 CHARACTER(LEN=*), DIMENSION(dots_max), INTENT(INOUT) :: dots_unit !< 353 357 354 358 INTEGER(iwp) :: i 355 356 INTEGER(iwp), INTENT(IN) :: dots_max357 INTEGER(iwp), INTENT(INOUT) :: dots_num358 359 359 CHARACTER(LEN=7) :: i_char = '' 360 CHARACTER (LEN=*), DIMENSION(dots_max), INTENT(INOUT) :: dots_label361 CHARACTER (LEN=*), DIMENSION(dots_max), INTENT(INOUT) :: dots_unit362 363 360 364 361 ! … … 367 364 368 365 ! 369 !-- Sample for user-defined time series 370 !-- For each time series quantity you have to give a label and a unit, 371 !-- which will be used for the NetCDF file. They must not contain more than 372 !-- seven characters. The value of dots_num has to be increased by the 373 !-- number of new time series quantities. Its old value has to be store in 374 !-- dots_num_palm. See routine user_statistics on how to output calculate 375 !-- and output these quantities. 366 !-- Sample for user-defined time series: 367 !-- For each time series quantity you have to give a label and a unit, which will be used for the 368 !-- NetCDF file. They must not contain more than seven characters. The value of dots_num has to be 369 !-- increased by the number of new time series quantities. Its old value has to be stored in 370 !-- dots_num_palm. See routine user_statistics on how to calculate and output these quantities. 376 371 377 372 ! dots_num_palm = dots_num … … 387 382 ! dots_unit(dots_num) = 'm/s' 388 383 384 ! 389 385 !-- Additional timeseries output 390 386 size_of_pos_array = SIZE(s_ts_pos_x) … … 399 395 dots_num = dots_num + size_of_pos_array 400 396 401 402 397 END SUBROUTINE user_check_data_output_ts 403 398 404 399 405 !------------------------------------------------------------------------------! 406 ! Description: 407 ! ------------ 408 !> Set the unit of user defined profile output quantities. For those variables 409 !> not recognized by the user, the parameter unit is set to "illegal", which 410 !> tells the calling routine that the output variable is not defined and leads 411 !> to a program abort. 412 !------------------------------------------------------------------------------! 400 !--------------------------------------------------------------------------------------------------! 401 ! Description: 402 ! ------------ 403 !> Set the unit of user defined profile output quantities. For those variables not recognized by the 404 !> user, the parameter unit is set to "illegal", which tells the calling routine that the 405 !> output variable is not defined and leads to a program abort. 406 !--------------------------------------------------------------------------------------------------! 413 407 SUBROUTINE user_check_data_output_pr( variable, var_count, unit, dopr_unit ) 414 408 … … 417 411 418 412 419 CHARACTER (LEN=*) :: unit !<420 CHARACTER (LEN=*) :: variable !<413 CHARACTER (LEN=*) :: unit !< 414 CHARACTER (LEN=*) :: variable !< 421 415 CHARACTER (LEN=*) :: dopr_unit !< local value of dopr_unit 422 416 423 ! INTEGER(iwp) :: user_pr_index !<424 INTEGER(iwp) :: var_count !<417 ! INTEGER(iwp) :: user_pr_index !< 418 INTEGER(iwp) :: var_count !< 425 419 426 420 ! … … 432 426 ! 433 427 !-- Uncomment and extend the following lines, if necessary. 434 !-- Add additional CASE statements depending on the number of quantities 435 !-- for which profiles are to be calculated. The respective calculations 436 !-- to be performed have to be added in routine user_statistics. 437 !-- The quantities are (internally) identified by a user-profile-number 438 !-- (see variable "user_pr_index" below). The first user-profile must be assigned 439 !-- the number "pr_palm+1", the second one "pr_palm+2", etc. The respective 440 !-- user-profile-numbers have also to be used in routine user_statistics! 441 ! CASE ( 'u*v*' ) ! quantity string as given in 442 ! ! data_output_pr_user 428 !-- Add additional CASE statements depending on the number of quantities for which profiles are 429 !-- to be calculated. The respective calculations to be performed have to be added in routine 430 !-- user_statistics. The quantities are (internally) identified by a user-profile-number 431 !-- (see variable "user_pr_index" below). The first user-profile must be assigned the number 432 !-- "pr_palm+1", the second one "pr_palm+2", etc. The respective user-profile-numbers have also 433 !-- to be used in routine user_statistics! 434 ! CASE ( 'u*v*' ) ! quantity string as given in data_output_pr_user 443 435 ! user_pr_index = pr_palm + 1 444 436 ! dopr_index(var_count) = user_pr_index ! quantities' user-profile-number 445 437 ! dopr_unit = 'm2/s2' ! quantity unit 446 438 ! unit = dopr_unit 447 ! hom(:,2,user_pr_index,:) 448 ! ! grid on which the quantity is 449 ! ! defined (use zu or zw)439 ! hom(:,2,user_pr_index,:) = SPREAD( zu, 2, statistic_regions+1 ) 440 ! ! grid on which the quantity is defined (use zu or zw) 441 ! 450 442 451 443 CASE DEFAULT … … 458 450 459 451 460 !------------------------------------------------------------------------------! 461 ! Description: 462 ! ------------ 463 !> Set the unit of user defined output quantities. For those variables 464 !> not recognized by the user, the parameter unit is set to "illegal", which 465 !> tells the calling routine that the output variable is not defined and leads 466 !> to a program abort. 467 !------------------------------------------------------------------------------! 452 !--------------------------------------------------------------------------------------------------! 453 ! Description: 454 ! ------------ 455 !> Set the unit of user defined output quantities. For those variables not recognized by the user, 456 !> the parameter unit is set to "illegal", which tells the calling routine that the output variable 457 !> is not defined and leads to a program abort. 458 !--------------------------------------------------------------------------------------------------! 468 459 SUBROUTINE user_check_data_output( variable, unit ) 469 460 470 461 471 CHARACTER (LEN=*) :: unit !<472 CHARACTER (LEN=*) :: variable !<462 CHARACTER (LEN=*) :: unit !< 463 CHARACTER (LEN=*) :: variable !< 473 464 474 465 … … 492 483 493 484 494 !------------------------------------------------------------------------------ !485 !--------------------------------------------------------------------------------------------------! 495 486 ! Description: 496 487 ! ------------ 497 488 !> Initialize user-defined arrays 498 !------------------------------------------------------------------------------ !489 !--------------------------------------------------------------------------------------------------! 499 490 SUBROUTINE user_init_arrays 500 491 … … 512 503 ! 513 504 !-- Example for defining a statistic region: 505 !-- ATTENTION: rmask = 0 is required at the ghost boundaries to guarantee correct statistic 506 !-- evaluations (otherwise ghost points would be counted twice). This setting has 507 !-- already been cared for in routine init_3d_model. Please don't set the ghost points 508 !-- /= 0. i.e. run the following loop only over nxl,nxr and nys,nyn. 514 509 ! IF ( statistic_regions >= 1 ) THEN 515 510 ! region = 1 516 ! 511 ! 517 512 ! rmask(:,:,region) = 0.0_wp 518 513 ! DO i = nxl, nxr … … 525 520 ! ENDIF 526 521 ! ENDDO 527 ! 522 ! 528 523 ! ENDIF 529 524 … … 531 526 532 527 533 !------------------------------------------------------------------------------ !528 !--------------------------------------------------------------------------------------------------! 534 529 ! Description: 535 530 ! ------------ 536 531 !> Execution of user-defined initializing actions 537 !------------------------------------------------------------------------------ !532 !--------------------------------------------------------------------------------------------------! 538 533 SUBROUTINE user_init 539 534 540 541 535 USE grid_variables 542 536 543 ! CHARACTER (LEN=20) :: field_char!<544 545 537 ! CHARACTER(LEN=20) :: field_char !< 538 539 INTEGER(iwp), DIMENSION(1:2) :: eso_ind !< index values of emission_stripe_orig 546 540 INTEGER(iwp) :: esw_ind !< index value of emission_stripe_width 547 541 INTEGER(iwp) :: i, j, m !< running index … … 578 572 ENDDO 579 573 ENDDO 580 581 574 582 575 END SUBROUTINE user_init 583 576 584 577 585 !------------------------------------------------------------------------------! 586 ! Description: 587 ! ------------ 588 !> Set the grids on which user-defined output quantities are defined. 589 !> Allowed values for grid_x are "x" and "xu", for grid_y "y" and "yv", and 590 !> for grid_z "zu" and "zw". 591 !------------------------------------------------------------------------------! 578 !--------------------------------------------------------------------------------------------------! 579 ! Description: 580 ! ------------ 581 !> Set the grids on which user-defined output quantities are defined. Allowed values for grid_x are 582 !> "x" and "xu", for grid_y "y" and "yv", and for grid_z "zu" and "zw". 583 !--------------------------------------------------------------------------------------------------! 592 584 SUBROUTINE user_define_netcdf_grid( variable, found, grid_x, grid_y, grid_z ) 593 585 … … 631 623 632 624 633 !------------------------------------------------------------------------------ !625 !--------------------------------------------------------------------------------------------------! 634 626 ! Description: 635 627 ! ------------ 636 628 !> Print a header with user-defined information. 637 !------------------------------------------------------------------------------ !629 !--------------------------------------------------------------------------------------------------! 638 630 SUBROUTINE user_header( io ) 639 631 640 632 641 INTEGER(iwp) :: i !< 642 INTEGER(iwp) :: io !< 643 644 ! 645 !-- If no user-defined variables are read from the namelist-file, no 646 !-- information will be printed. 633 INTEGER(iwp) :: i !< 634 INTEGER(iwp) :: io !< 635 636 ! 637 !-- If no user-defined variables are read from the namelist-file, no information will be printed. 647 638 IF ( .NOT. user_module_enabled ) THEN 648 639 WRITE ( io, 100 ) … … 663 654 WRITE ( io, 122 ) 664 655 WRITE ( io, 123 ) s_ts_pos_x, s_ts_pos_y 665 666 656 667 657 IF ( statistic_regions /= 0 ) THEN … … 675 665 !-- Format-descriptors 676 666 100 FORMAT (//' *** no user-defined variables found'/) 677 110 FORMAT (//1X,78('#') & 678 //' User-defined variables and actions:'/ & 679 ' -----------------------------------'//) 667 110 FORMAT (//1X,78('#') // ' User-defined variables and actions:' / & 668 ' -----------------------------------'//) 680 669 120 FORMAT (' Parameters for traffic emission:' /) 681 670 121 FORMAT ('stripe origin(s) in y-direction (in m): ',F5.1,', ',F5.1,' , stripe width in y-direction (in m): ',F5.1) … … 689 678 690 679 691 !------------------------------------------------------------------------------ !680 !--------------------------------------------------------------------------------------------------! 692 681 ! Description: 693 682 ! ------------ 694 683 !> Call for all grid points 695 !------------------------------------------------------------------------------ !684 !--------------------------------------------------------------------------------------------------! 696 685 SUBROUTINE user_actions( location ) 697 686 698 687 699 CHARACTER (LEN=*) :: location !<700 701 ! INTEGER(iwp) :: i !<702 ! INTEGER(iwp) :: j !<703 ! INTEGER(iwp) :: k !<688 CHARACTER(LEN=*) :: location !< 689 690 ! INTEGER(iwp) :: i !< 691 ! INTEGER(iwp) :: j !< 692 ! INTEGER(iwp) :: k !< 704 693 705 694 CALL cpu_log( log_point(24), 'user_actions', 'start' ) 706 695 707 696 ! 708 !-- Here the user-defined actions follow 709 !-- No calls for single grid points are allowed at locations before and 710 !-- after the timestep, since these calls are not within an i,j-loop 697 !-- Here the user-defined actions follow. No calls for single grid points are allowed at locations 698 !-- before and after the timestep, since these calls are not within an i,j-loop 711 699 SELECT CASE ( location ) 712 700 … … 721 709 CASE ( 'after_integration' ) 722 710 ! 723 !-- Enter actions to be done after every time integration (before 724 !-- data output) 711 !-- Enter actions to be done after every time integration (before data output) 725 712 !-- Sample for user-defined output: 726 713 ! DO i = nxlg, nxrg … … 735 722 ! DO k = nzb, nzt+1 736 723 ! ustvst(k,j,i) = & 737 ! ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,0) ) * &724 ! ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,0) ) * & 738 725 ! ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,0) ) 739 726 ! ENDDO … … 783 770 784 771 785 !------------------------------------------------------------------------------ !772 !--------------------------------------------------------------------------------------------------! 786 773 ! Description: 787 774 ! ------------ 788 775 !> Call for grid point i,j 789 !------------------------------------------------------------------------------ !776 !--------------------------------------------------------------------------------------------------! 790 777 SUBROUTINE user_actions_ij( i, j, location ) 791 778 792 779 793 CHARACTER (LEN=*) :: location794 795 INTEGER(iwp) :: i 796 INTEGER(iwp) :: j 780 CHARACTER(LEN=*) :: location !< 781 782 INTEGER(iwp) :: i !< 783 INTEGER(iwp) :: j !< 797 784 798 785 ! … … 839 826 840 827 841 !------------------------------------------------------------------------------ !842 ! Description: 843 ! ------------ 844 !> Sum up and time-average user-defined output quantities as well as allocate 845 !> the array necessaryfor storing the average.846 !------------------------------------------------------------------------------ !828 !--------------------------------------------------------------------------------------------------! 829 ! Description: 830 ! ------------ 831 !> Sum up and time-average user-defined output quantities as well as allocate the array necessary 832 !> for storing the average. 833 !--------------------------------------------------------------------------------------------------! 847 834 SUBROUTINE user_3d_data_averaging( mode, variable ) 848 835 849 836 850 CHARACTER (LEN=*) :: mode !<851 CHARACTER (LEN=*) :: variable !<852 853 ! INTEGER(iwp) :: i !<854 ! INTEGER(iwp) :: j !<855 ! INTEGER(iwp) :: k !<837 CHARACTER(LEN=*) :: mode !< 838 CHARACTER(LEN=*) :: variable !< 839 840 ! INTEGER(iwp) :: i !< 841 ! INTEGER(iwp) :: j !< 842 ! INTEGER(iwp) :: k !< 856 843 857 844 IF ( mode == 'allocate' ) THEN … … 861 848 ! 862 849 !-- Uncomment and extend the following lines, if necessary. 863 !-- The arrays for storing the user defined quantities (here u2_av) have 864 !-- to be declared anddefined by the user!850 !-- The arrays for storing the user defined quantities (here u2_av) have to be declared and 851 !-- defined by the user! 865 852 !-- Sample for user-defined output: 866 853 ! CASE ( 'u2' ) … … 881 868 ! 882 869 !-- Uncomment and extend the following lines, if necessary. 883 !-- The arrays for storing the user defined quantities (here u2 and 884 !-- u2_av) have to be declaredand defined by the user!870 !-- The arrays for storing the user defined quantities (here u2 and u2_av) have to be declared 871 !-- and defined by the user! 885 872 !-- Sample for user-defined output: 886 873 ! CASE ( 'u2' ) 887 ! IF ( ALLOCATED( u2_av ) ) THEN874 ! IF ( ALLOCATED( u2_av ) ) THEN 888 875 ! DO i = nxlg, nxrg 889 876 ! DO j = nysg, nyng … … 906 893 ! 907 894 !-- Uncomment and extend the following lines, if necessary. 908 !-- The arrays for storing the user defined quantities (here u2_av) have 909 !-- to be declared anddefined by the user!895 !-- The arrays for storing the user defined quantities (here u2_av) have to be declared and 896 !-- defined by the user! 910 897 !-- Sample for user-defined output: 911 898 ! CASE ( 'u2' ) 912 ! IF ( ALLOCATED( u2_av ) ) THEN899 ! IF ( ALLOCATED( u2_av ) ) THEN 913 900 ! DO i = nxlg, nxrg 914 901 ! DO j = nysg, nyng … … 928 915 929 916 930 !------------------------------------------------------------------------------! 931 ! Description: 932 ! ------------ 933 !> Resorts the user-defined output quantity with indices (k,j,i) to a 934 !> temporary array with indices (i,j,k) and sets the grid on which it is defined. 935 !> Allowed values for grid are "zu" and "zw". 936 !------------------------------------------------------------------------------! 917 !--------------------------------------------------------------------------------------------------! 918 ! Description: 919 ! ------------ 920 !> Resorts the user-defined output quantity with indices (k,j,i) to a temporary array with indices 921 !> (i,j,k) and sets the grid on which it is defined. Allowed values for grid are "zu" and "zw". 922 !--------------------------------------------------------------------------------------------------! 937 923 SUBROUTINE user_data_output_2d( av, variable, found, grid, local_pf, two_d, nzb_do, nzt_do ) 938 924 939 925 940 CHARACTER (LEN=*) :: grid !<941 CHARACTER (LEN=*) :: variable !<942 943 INTEGER(iwp) :: av !< flag to control data output of instantaneous or time-averaged data944 ! INTEGER(iwp) :: i !< grid index along x-direction945 ! INTEGER(iwp) :: j !< grid index along y-direction946 ! INTEGER(iwp) :: k !< grid index along z-direction947 ! INTEGER(iwp) :: m !< running index surface elements948 INTEGER(iwp) :: nzb_do !< lower limit of the domain (usually nzb)949 INTEGER(iwp) :: nzt_do !< upper limit of the domain (usually nzt+1)950 951 LOGICAL :: found !<952 LOGICAL :: two_d !< flag parameter that indicates 2D variables (horizontal cross sections)926 CHARACTER(LEN=*) :: grid !< 927 CHARACTER(LEN=*) :: variable !< 928 929 INTEGER(iwp) :: av !< flag to control data output of instantaneous or time-averaged data 930 ! INTEGER(iwp) :: i !< grid index along x-direction 931 ! INTEGER(iwp) :: j !< grid index along y-direction 932 ! INTEGER(iwp) :: k !< grid index along z-direction 933 ! INTEGER(iwp) :: m !< running index surface elements 934 INTEGER(iwp) :: nzb_do !< lower limit of the domain (usually nzb) 935 INTEGER(iwp) :: nzt_do !< upper limit of the domain (usually nzt+1) 936 937 LOGICAL :: found !< 938 LOGICAL :: two_d !< flag parameter that indicates 2D variables (horizontal cross sections) 953 939 954 940 ! REAL(wp) :: fill_value = -999.0_wp !< value for the _FillValue attribute 955 941 956 REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) :: local_pf !<942 REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) :: local_pf !< 957 943 958 944 ! … … 967 953 ! 968 954 !-- Uncomment and extend the following lines, if necessary. 969 !-- The arrays for storing the user defined quantities (here u2 and u2_av) 970 !-- have to be declaredand defined by the user!955 !-- The arrays for storing the user defined quantities (here u2 and u2_av) have to be declared 956 !-- and defined by the user! 971 957 !-- Sample for user-defined output: 972 958 ! CASE ( 'u2_xy', 'u2_xz', 'u2_yz' ) … … 980 966 ! ENDDO 981 967 ! ELSE 982 ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN968 ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN 983 969 ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) 984 970 ! u2_av = REAL( fill_value, KIND = wp ) … … 995 981 ! grid = 'zu' 996 982 ! 997 !-- In case two-dimensional surface variables are output, the user 998 !-- has to access related surface-type. Uncomment and extend following lines 999 !-- appropriately (example output of vertical surface momentum flux of u- 1000 !-- component). Please note, surface elements can be distributed over 1001 !-- several data type, depending on their respective surface properties. 983 !-- In case two-dimensional surface variables are output, the user has to access related 984 !-- surface-type. Uncomment and extend following lines appropriately (example output of vertical 985 !-- surface momentum flux of u-component). Please note, surface elements can be distributed over 986 !-- several data types, depending on their respective surface properties. 1002 987 ! CASE ( 'usws_xy' ) 1003 988 ! IF ( av == 0 ) THEN … … 1026 1011 ! 1027 1012 ! grid = 'zu' 1028 !-- 1013 !-- 1029 1014 1030 1015 … … 1039 1024 1040 1025 1041 !------------------------------------------------------------------------------ !1042 ! Description: 1043 ! ------------ 1044 !> Resorts the user-defined output quantity with indices (k,j,i) to a 1045 !> temporary array with indices(i,j,k).1046 !------------------------------------------------------------------------------ !1026 !--------------------------------------------------------------------------------------------------! 1027 ! Description: 1028 ! ------------ 1029 !> Resorts the user-defined output quantity with indices (k,j,i) to a temporary array with indices 1030 !> (i,j,k). 1031 !--------------------------------------------------------------------------------------------------! 1047 1032 SUBROUTINE user_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do ) 1048 1033 1049 1034 1050 CHARACTER (LEN=*) :: variable !<1051 1052 INTEGER(iwp) :: av !<1053 ! INTEGER(iwp) :: i !<1054 ! INTEGER(iwp) :: j !<1055 ! INTEGER(iwp) :: k !<1035 CHARACTER(LEN=*) :: variable !< 1036 1037 INTEGER(iwp) :: av !< 1038 ! INTEGER(iwp) :: i !< 1039 ! INTEGER(iwp) :: j !< 1040 ! INTEGER(iwp) :: k !< 1056 1041 INTEGER(iwp) :: nzb_do !< lower limit of the data output (usually 0) 1057 1042 INTEGER(iwp) :: nzt_do !< vertical upper limit of the data output (usually nz_do3d) 1058 1043 1059 LOGICAL :: found !<1060 1061 ! REAL(wp) :: fill_value = -999.0_wp 1062 1063 REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) :: local_pf !<1044 LOGICAL :: found !< 1045 1046 ! REAL(wp) :: fill_value = -999.0_wp !< value for the _FillValue attribute 1047 1048 REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) :: local_pf !< 1064 1049 1065 1050 ! … … 1074 1059 ! 1075 1060 !-- Uncomment and extend the following lines, if necessary. 1076 !-- The arrays for storing the user defined quantities (here u2 and u2_av) 1077 !-- have to be declaredand defined by the user!1061 !-- The arrays for storing the user defined quantities (here u2 and u2_av) have to be declared 1062 !-- and defined by the user! 1078 1063 !-- Sample for user-defined output: 1079 1064 ! CASE ( 'u2' ) … … 1087 1072 ! ENDDO 1088 1073 ! ELSE 1089 ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN1074 ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN 1090 1075 ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) 1091 1076 ! u2_av = REAL( fill_value, KIND = wp ) … … 1110 1095 1111 1096 1112 !------------------------------------------------------------------------------! 1113 ! Description: 1114 ! ------------ 1115 !> Calculation of user-defined statistics, i.e. horizontally averaged profiles 1116 !> and time series. 1117 !> This routine is called for every statistic region sr defined by the user, 1118 !> but at least for the region "total domain" (sr=0). 1119 !> See section 3.5.4 on how to define, calculate, and output user defined 1120 !> quantities. 1121 !------------------------------------------------------------------------------! 1097 !--------------------------------------------------------------------------------------------------! 1098 ! Description: 1099 ! ------------ 1100 !> Calculation of user-defined statistics, i.e. horizontally averaged profiles and time series. 1101 !> This routine is called for every statistic region sr defined by the user, but at least for the 1102 !> region "total domain" (sr=0). See section 3.5.4 on how to define, calculate, and output user 1103 !> defined quantities. 1104 !--------------------------------------------------------------------------------------------------! 1122 1105 SUBROUTINE user_statistics( mode, sr, tn ) 1123 1124 1106 1125 1107 USE netcdf_interface, & 1126 1108 ONLY: dots_max 1127 1128 CHARACTER (LEN=*) :: mode !<1129 INTEGER(iwp) :: i 1130 ! INTEGER(iwp) :: j 1131 ! INTEGER(iwp) :: k 1132 INTEGER(iwp) :: sr !<1133 INTEGER(iwp) :: tn !<1134 1135 ! REAL(wp), DIMENSION(:), ALLOCATABLE :: ts_value_l 1109 1110 CHARACTER(LEN=*) :: mode !< 1111 INTEGER(iwp) :: i !< 1112 ! INTEGER(iwp) :: j !< 1113 ! INTEGER(iwp) :: k !< 1114 INTEGER(iwp) :: sr !< 1115 INTEGER(iwp) :: tn !< 1116 1117 ! REAL(wp), DIMENSION(:), ALLOCATABLE :: ts_value_l !< 1136 1118 REAL(wp), DIMENSION(dots_num_palm+1:dots_max) :: ts_value_l !< 1137 1119 … … 1143 1125 1144 1126 ! 1145 !-- Sample on how to calculate horizontally averaged profiles of user- 1146 !-- defined quantities. Each quantity is identified by the index 1147 !-- "pr_palm+#" where "#" is an integer starting from 1. These 1148 !-- user-profile-numbers must also be assigned to the respective strings 1149 !-- given by data_output_pr_user in routine user_check_data_output_pr. 1127 !-- Sample on how to calculate horizontally averaged profiles of user-defined quantities. Each 1128 !-- quantity is identified by the index "pr_palm+#" where "#" is an integer starting from 1. 1129 !-- These user-profile-numbers must also be assigned to the respective strings given by 1130 !-- data_output_pr_user in routine user_check_data_output_pr. 1150 1131 ! !$OMP DO 1151 1132 ! DO i = nxl, nxr … … 1153 1134 ! DO k = nzb+1, nzt 1154 1135 !! 1155 !!-- Sample on how to calculate the profile of the resolved-scale 1156 !!-- horizontal momentum flux u*v* 1157 ! sums_l(k,pr_palm+1,tn) = sums_l(k,pr_palm+1,tn) + & 1158 ! ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,sr) ) *& 1159 ! ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) ) & 1160 ! * rmask(j,i,sr) & 1161 ! * MERGE( 1.0_wp, 0.0_wp, & 1162 ! BTEST( wall_flags_0(k,j,i), 0 ) ) 1136 !!-- Sample on how to calculate the profile of the resolved-scale horizontal momentum 1137 !!-- flux u*v* 1138 ! sums_l(k,pr_palm+1,tn) = sums_l(k,pr_palm+1,tn) + & 1139 ! ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,sr) ) * & 1140 ! ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) ) * & 1141 ! rmask(j,i,sr) * MERGE( 1.0_wp, 0.0_wp, & 1142 ! BTEST( wall_flags_total_0(k,j,i), 0 ) ) 1163 1143 !! 1164 !!-- Further profiles can be defined and calculated by increasing 1165 !!-- the second index of array sums_l (replace ... appropriately) 1166 ! sums_l(k,pr_palm+2,tn) = sums_l(k,pr_palm+2,tn) + ... & 1167 ! * rmask(j,i,sr) 1144 !!-- Further profiles can be defined and calculated by increasing the second index of 1145 !!-- array sums_l (replace ... appropriately) 1146 ! sums_l(k,pr_palm+2,tn) = sums_l(k,pr_palm+2,tn) + ... * rmask(j,i,sr) 1168 1147 ! ENDDO 1169 1148 ! ENDDO … … 1176 1155 ! 1177 1156 !-- Sample on how to add values for the user-defined time series quantities. 1178 !-- These have to be defined before in routine user_init. This sample 1179 !-- creates two time series for the absolut values of the horizontal 1180 !-- velocities u and v. 1157 !-- These have to be defined before in routine user_init. This sample creates two time series for 1158 !-- the absolut values of the horizontal velocities u and v. 1181 1159 ! ts_value_l = 0.0_wp 1182 1160 ! ts_value_l(1) = ABS( u_max ) … … 1184 1162 ! 1185 1163 !-- Collect / send values to PE0, because only PE0 outputs the time series. 1186 !-- CAUTION: Collection is done by taking the sum over all processors. 1187 !-- You may have to normalize this sum, depending on the quantity 1188 !-- that you like to calculate. For serial runs, nothing has to be 1189 !-- done. 1190 !-- HINT: If the time series value that you are calculating has the same 1191 !-- value on all PEs, you can omit the MPI_ALLREDUCE call and 1192 !-- assign ts_value(dots_num_palm+1:,sr) = ts_value_l directly. 1164 !-- CAUTION: Collection is done by taking the sum over all processors. You may have to normalize 1165 !-- this sum, depending on the quantity that you like to calculate. For serial runs, 1166 !-- nothing has to be done. 1167 !-- HINT: If the time series value that you are calculating has the same value on all PEs, you 1168 !-- can omit the MPI_ALLREDUCE call and assign ts_value(dots_num_palm+1:,sr) = ts_value_l directly. 1193 1169 !#if defined( __parallel ) 1194 1170 ! IF ( collective_wait ) CALL MPI_BARRIER( comm2d, ierr ) 1195 ! CALL MPI_ALLREDUCE( ts_value_l(1), & 1196 ! ts_value(dots_num_palm+1,sr), & 1197 ! dots_num_user, MPI_REAL, MPI_MAX, comm2d, & 1198 ! ierr ) 1171 ! CALL MPI_ALLREDUCE( ts_value_l(1), ts_value(dots_num_palm+1,sr), dots_num_user, MPI_REAL, & 1172 ! MPI_MAX, comm2d, ierr ) 1199 1173 !#else 1200 1174 ! ts_value(dots_num_palm+1:dots_num_palm+dots_num_user,sr) = ts_value_l 1201 1175 !#endif 1202 1203 1176 1204 1177 ts_value_l = 0.0_wp … … 1239 1212 1240 1213 1241 !------------------------------------------------------------------------------ !1242 ! Description: 1243 ! ------------ 1244 !> Read ing global restart data that has been defined by the user.1245 !------------------------------------------------------------------------------ !1246 SUBROUTINE user_rrd_global ( found )1247 1248 1249 LOGICAL, INTENT(OUT) :: found 1214 !--------------------------------------------------------------------------------------------------! 1215 ! Description: 1216 ! ------------ 1217 !> Read module-specific global restart data (Fortran binary format). 1218 !--------------------------------------------------------------------------------------------------! 1219 SUBROUTINE user_rrd_global_ftn( found ) 1220 1221 1222 LOGICAL, INTENT(OUT) :: found !< 1250 1223 1251 1224 … … 1259 1232 1260 1233 CASE DEFAULT 1261 1234 1262 1235 found = .FALSE. 1263 1236 … … 1265 1238 1266 1239 1267 END SUBROUTINE user_rrd_global 1268 1269 1270 !------------------------------------------------------------------------------! 1271 ! Description: 1272 ! ------------ 1273 !> Reading processor specific restart data from file(s) that has been defined 1274 !> by the user. 1275 !> Subdomain index limits on file are given by nxl_on_file, etc. 1276 !> Indices nxlc, etc. indicate the range of gridpoints to be mapped from the 1277 !> subdomain on file (f) to the subdomain of the current PE (c). They have been 1278 !> calculated in routine rrd_local. 1279 !------------------------------------------------------------------------------! 1280 SUBROUTINE user_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc, & 1281 nxr_on_file, nynf, nync, nyn_on_file, nysf, & 1282 nysc, nys_on_file, tmp_3d, found ) 1240 END SUBROUTINE user_rrd_global_ftn 1241 1242 1243 !--------------------------------------------------------------------------------------------------! 1244 ! Description: 1245 ! ------------ 1246 !> Read module-specific global restart data (MPI-IO). 1247 !--------------------------------------------------------------------------------------------------! 1248 SUBROUTINE user_rrd_global_mpi 1249 1250 ! USE restart_data_mpi_io_mod, & 1251 ! ONLY: rrd_mpi_io 1252 1253 ! CALL rrd_mpi_io( 'global_parameter', global_parameter ) 1254 CONTINUE 1255 1256 END SUBROUTINE user_rrd_global_mpi 1257 1258 1259 !--------------------------------------------------------------------------------------------------! 1260 ! Description: 1261 ! ------------ 1262 !> Read module-specific local restart data arrays (Fortran binary format). 1263 !> Subdomain 1264 !> index limits on file are given by nxl_on_file, etc. Indices nxlc, etc. indicate the range of 1265 !> gridpoints to be mapped from the subdomain on file (f) to the subdomain of the current PE (c). 1266 !> They have been calculated in routine rrd_local. 1267 !--------------------------------------------------------------------------------------------------! 1268 SUBROUTINE user_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc, nxr_on_file, nynf, nync, & 1269 nyn_on_file, nysf, nysc, nys_on_file, tmp_3d, found ) 1283 1270 1284 1271 … … 1298 1285 INTEGER(iwp) :: nys_on_file !< 1299 1286 1300 LOGICAL, INTENT(OUT) :: found 1301 1302 REAL(wp), DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d 1287 LOGICAL, INTENT(OUT) :: found !< 1288 1289 REAL(wp), DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d !< 1303 1290 1304 1291 ! … … 1316 1303 1317 1304 CASE ( 'u2_av' ) 1318 ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN1305 ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN 1319 1306 ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) 1320 1307 ! ENDIF 1321 1308 ! IF ( k == 1 ) READ ( 13 ) tmp_3d 1322 ! u2_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = &1323 ! 1309 ! u2_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) = & 1310 ! tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp) 1324 1311 ! 1325 1312 CASE DEFAULT … … 1329 1316 END SELECT 1330 1317 1331 END SUBROUTINE user_rrd_local 1332 1333 1334 !------------------------------------------------------------------------------! 1335 ! Description: 1336 ! ------------ 1337 !> Writes global and user-defined restart data into binary file(s) for restart 1338 !> runs. 1339 !------------------------------------------------------------------------------! 1318 END SUBROUTINE user_rrd_local_ftn 1319 1320 1321 !--------------------------------------------------------------------------------------------------! 1322 ! Description: 1323 ! ------------ 1324 !> Read module-specific local restart data arrays (MPI-IO). 1325 !--------------------------------------------------------------------------------------------------! 1326 SUBROUTINE user_rrd_local_mpi 1327 1328 ! USE restart_data_mpi_io_mod, & 1329 ! ONLY: rd_mpi_io_check_array, rrd_mpi_io 1330 1331 ! CALL rd_mpi_io_check_array( 'u2_av' , found = array_found ) 1332 ! IF ( array_found ) THEN 1333 ! IF ( .NOT. ALLOCATED( u2_av ) ) ALLOCATE( u2_av(nysg:nyng,nxlg:nxrg) ) 1334 ! CALL rrd_mpi_io( 'rad_u2_av', rad_u2_av ) 1335 ! ENDIF 1336 1337 CONTINUE 1338 1339 END SUBROUTINE user_rrd_local_mpi 1340 1341 1342 !--------------------------------------------------------------------------------------------------! 1343 ! Description: 1344 ! ------------ 1345 !> Writes global and user-defined restart data into binary file(s) for restart runs. 1346 !--------------------------------------------------------------------------------------------------! 1340 1347 SUBROUTINE user_wrd_global 1341 1348 1342 ! CALL wrd_write_string( 'global_parameter' ) 1343 ! WRITE ( 14 ) global_parameter 1349 ! USE restart_data_mpi_io_mod, & 1350 ! ONLY: wrd_mpi_io 1351 1352 IF ( TRIM( restart_data_format_output ) == 'fortran_binary' ) THEN 1353 1354 ! CALL wrd_write_string( 'global_parameter' ) 1355 ! WRITE ( 14 ) global_parameter 1356 1357 ELSEIF ( TRIM( restart_data_format_output ) == 'mpi' ) THEN 1358 1359 ! CALL rrd_mpi_io( 'global_parameter', global_parameter ) 1360 1361 ENDIF 1344 1362 1345 1363 END SUBROUTINE user_wrd_global 1346 1364 1347 1365 1348 !------------------------------------------------------------------------------! 1349 ! Description: 1350 ! ------------ 1351 !> Writes processor specific and user-defined restart data into binary file(s) 1352 !> for restart runs. 1353 !------------------------------------------------------------------------------! 1366 !--------------------------------------------------------------------------------------------------! 1367 ! Description: 1368 ! ------------ 1369 !> Writes processor specific and user-defined restart data into binary file(s) for restart runs. 1370 !--------------------------------------------------------------------------------------------------! 1354 1371 SUBROUTINE user_wrd_local 1372 1373 ! USE restart_data_mpi_io_mod, & 1374 ! ONLY: wrd_mpi_io 1355 1375 1356 1376 ! 1357 1377 !-- Here the user-defined actions at the end of a job follow. 1358 1378 !-- Sample for user-defined output: 1359 ! IF ( ALLOCATED( u2_av ) ) THEN 1360 ! CALL wrd_write_string( 'u2_av' ) 1361 ! WRITE ( 14 ) u2_av 1362 ! ENDIF 1379 IF ( TRIM( restart_data_format_output ) == 'fortran_binary' ) THEN 1380 1381 ! IF ( ALLOCATED( u2_av ) ) THEN 1382 ! CALL wrd_write_string( 'u2_av' ) 1383 ! WRITE ( 14 ) u2_av 1384 ! ENDIF 1385 1386 ELSEIF ( TRIM( restart_data_format_output ) == 'mpi' ) THEN 1387 1388 ! IF ( ALLOCATED( u2_av ) ) CALL wrd_mpi_io( 'u2_av', u2_av ) 1389 1390 ENDIF 1363 1391 1364 1392 END SUBROUTINE user_wrd_local 1365 1393 1366 1394 1367 !------------------------------------------------------------------------------ !1395 !--------------------------------------------------------------------------------------------------! 1368 1396 ! Description: 1369 1397 ! ------------ 1370 1398 !> Execution of user-defined actions at the end of a job. 1371 !------------------------------------------------------------------------------ !1399 !--------------------------------------------------------------------------------------------------! 1372 1400 SUBROUTINE user_last_actions 1373 1401
Note: See TracChangeset
for help on using the changeset viewer.