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

Last change on this file since 4598 was 4535, checked in by raasch, 12 months ago

bugfix for restart data format query

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