source: palm/trunk/SOURCE/user_module.f90 @ 4860

Last change on this file since 4860 was 4856, checked in by raasch, 4 years ago

array sizes for output profiles increased from 400 to 500

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