source: palm/trunk/SOURCE/gust_mod.f90 @ 4878

Last change on this file since 4878 was 4843, checked in by raasch, 4 years ago

local namelist parameter added to switch off the module although the respective module namelist appears in the namelist file, further copyright updates

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