source: palm/trunk/SOURCE/dynamics_mod.f90 @ 4091

Last change on this file since 4091 was 4047, checked in by knoop, 5 years ago

Initial introduction of the dynamics module with only dynamics_swap_timelevel implemented

  • Property svn:keywords set to Id
File size: 28.2 KB
Line 
1!> @file dynamics_mod.f90
2!--------------------------------------------------------------------------------------------------!
3! This file is part of the PALM model system.
4!
5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! version.
9!
10! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
11! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13!
14! You should have received a copy of the GNU General Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
17! Copyright 1997-2019 Leibniz Universitaet Hannover
18!--------------------------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: dynamics_mod.f90 4047 2019-06-21 18:58:09Z knoop $
27! Initial introduction of the dynamics module with only dynamics_swap_timelevel implemented
28!
29!
30! Description:
31! ------------
32!> This module contains the dynamics of PALM.
33!--------------------------------------------------------------------------------------------------!
34 MODULE dynamics_mod
35
36
37    USE arrays_3d, &
38        ONLY:  pt, pt_1, pt_2, pt_p, &
39               q, q_1, q_2, q_p, &
40               s, s_1, s_2, s_p, &
41               u, u_1, u_2, u_p, &
42               v, v_1, v_2, v_p, &
43               w, w_1, w_2, w_p
44
45    USE control_parameters, &
46        ONLY:  length, &
47               restart_string, &
48               humidity, &
49               neutral, &
50               passive_scalar
51
52    USE indices, &
53        ONLY:  nbgp, &
54               nxl, &
55               nxr, &
56               nys, &
57               nyn, &
58               nzb, &
59               nzt
60
61    USE kinds
62
63    IMPLICIT NONE
64
65    LOGICAL ::  dynamics_module_enabled = .FALSE.   !<
66
67    SAVE
68
69    PRIVATE
70
71!
72!-- Public functions
73    PUBLIC &
74       dynamics_parin, &
75       dynamics_check_parameters, &
76       dynamics_check_data_output_ts, &
77       dynamics_check_data_output_pr, &
78       dynamics_check_data_output, &
79       dynamics_init_masks, &
80       dynamics_define_netcdf_grid, &
81       dynamics_init_arrays, &
82       dynamics_init, &
83       dynamics_init_checks, &
84       dynamics_header, &
85       dynamics_actions, &
86       dynamics_non_advective_processes, &
87       dynamics_exchange_horiz, &
88       dynamics_prognostic_equations, &
89       dynamics_swap_timelevel, &
90       dynamics_3d_data_averaging, &
91       dynamics_data_output_2d, &
92       dynamics_data_output_3d, &
93       dynamics_statistics, &
94       dynamics_rrd_global, &
95       dynamics_rrd_local, &
96       dynamics_wrd_global, &
97       dynamics_wrd_local, &
98       dynamics_last_actions
99
100!
101!-- Public parameters, constants and initial values
102    PUBLIC &
103       dynamics_module_enabled
104
105    INTERFACE dynamics_parin
106       MODULE PROCEDURE dynamics_parin
107    END INTERFACE dynamics_parin
108
109    INTERFACE dynamics_check_parameters
110       MODULE PROCEDURE dynamics_check_parameters
111    END INTERFACE dynamics_check_parameters
112
113    INTERFACE dynamics_check_data_output_ts
114       MODULE PROCEDURE dynamics_check_data_output_ts
115    END INTERFACE dynamics_check_data_output_ts
116
117    INTERFACE dynamics_check_data_output_pr
118       MODULE PROCEDURE dynamics_check_data_output_pr
119    END INTERFACE dynamics_check_data_output_pr
120
121    INTERFACE dynamics_check_data_output
122       MODULE PROCEDURE dynamics_check_data_output
123    END INTERFACE dynamics_check_data_output
124
125    INTERFACE dynamics_init_masks
126       MODULE PROCEDURE dynamics_init_masks
127    END INTERFACE dynamics_init_masks
128
129    INTERFACE dynamics_define_netcdf_grid
130       MODULE PROCEDURE dynamics_define_netcdf_grid
131    END INTERFACE dynamics_define_netcdf_grid
132
133    INTERFACE dynamics_init_arrays
134       MODULE PROCEDURE dynamics_init_arrays
135    END INTERFACE dynamics_init_arrays
136
137    INTERFACE dynamics_init
138       MODULE PROCEDURE dynamics_init
139    END INTERFACE dynamics_init
140
141    INTERFACE dynamics_init_checks
142       MODULE PROCEDURE dynamics_init_checks
143    END INTERFACE dynamics_init_checks
144
145    INTERFACE dynamics_header
146       MODULE PROCEDURE dynamics_header
147    END INTERFACE dynamics_header
148
149    INTERFACE dynamics_actions
150       MODULE PROCEDURE dynamics_actions
151       MODULE PROCEDURE dynamics_actions_ij
152    END INTERFACE dynamics_actions
153
154    INTERFACE dynamics_non_advective_processes
155       MODULE PROCEDURE dynamics_non_advective_processes
156       MODULE PROCEDURE dynamics_non_advective_processes_ij
157    END INTERFACE dynamics_non_advective_processes
158
159    INTERFACE dynamics_exchange_horiz
160       MODULE PROCEDURE dynamics_exchange_horiz
161    END INTERFACE dynamics_exchange_horiz
162
163    INTERFACE dynamics_prognostic_equations
164       MODULE PROCEDURE dynamics_prognostic_equations
165       MODULE PROCEDURE dynamics_prognostic_equations_ij
166    END INTERFACE dynamics_prognostic_equations
167
168    INTERFACE dynamics_swap_timelevel
169       MODULE PROCEDURE dynamics_swap_timelevel
170    END INTERFACE dynamics_swap_timelevel
171
172    INTERFACE dynamics_3d_data_averaging
173       MODULE PROCEDURE dynamics_3d_data_averaging
174    END INTERFACE dynamics_3d_data_averaging
175
176    INTERFACE dynamics_data_output_2d
177       MODULE PROCEDURE dynamics_data_output_2d
178    END INTERFACE dynamics_data_output_2d
179
180    INTERFACE dynamics_data_output_3d
181       MODULE PROCEDURE dynamics_data_output_3d
182    END INTERFACE dynamics_data_output_3d
183
184    INTERFACE dynamics_statistics
185       MODULE PROCEDURE dynamics_statistics
186    END INTERFACE dynamics_statistics
187
188    INTERFACE dynamics_rrd_global
189       MODULE PROCEDURE dynamics_rrd_global
190    END INTERFACE dynamics_rrd_global
191
192    INTERFACE dynamics_rrd_local
193       MODULE PROCEDURE dynamics_rrd_local
194    END INTERFACE dynamics_rrd_local
195
196    INTERFACE dynamics_wrd_global
197       MODULE PROCEDURE dynamics_wrd_global
198    END INTERFACE dynamics_wrd_global
199
200    INTERFACE dynamics_wrd_local
201       MODULE PROCEDURE dynamics_wrd_local
202    END INTERFACE dynamics_wrd_local
203
204    INTERFACE dynamics_last_actions
205       MODULE PROCEDURE dynamics_last_actions
206    END INTERFACE dynamics_last_actions
207
208
209 CONTAINS
210
211
212!--------------------------------------------------------------------------------------------------!
213! Description:
214! ------------
215!> Read module-specific namelist
216!--------------------------------------------------------------------------------------------------!
217 SUBROUTINE dynamics_parin
218
219
220    CHARACTER (LEN=80)  ::  line  !< dummy string that contains the current line of the parameter file
221
222    NAMELIST /dynamics_parameters/  &
223       dynamics_module_enabled
224
225    line = ' '
226!
227!-- Try to find module-specific namelist
228    REWIND ( 11 )
229    line = ' '
230    DO   WHILE ( INDEX( line, '&dynamics_parameters' ) == 0 )
231       READ ( 11, '(A)', END=12 )  line
232    ENDDO
233    BACKSPACE ( 11 )
234
235!-- Set default module switch to true
236    dynamics_module_enabled = .TRUE.
237
238!-- Read user-defined namelist
239    READ ( 11, dynamics_parameters, ERR = 10 )
240
241    GOTO 12
242
24310  BACKSPACE( 11 )
244    READ( 11 , '(A)') line
245    CALL parin_fail_message( 'dynamics_parameters', line )
246
24712  CONTINUE
248
249 END SUBROUTINE dynamics_parin
250
251
252!--------------------------------------------------------------------------------------------------!
253! Description:
254! ------------
255!> Check control parameters and deduce further quantities.
256!--------------------------------------------------------------------------------------------------!
257 SUBROUTINE dynamics_check_parameters
258
259
260 END SUBROUTINE dynamics_check_parameters
261
262
263!--------------------------------------------------------------------------------------------------!
264! Description:
265! ------------
266!> Set module-specific timeseries units and labels
267!--------------------------------------------------------------------------------------------------!
268 SUBROUTINE dynamics_check_data_output_ts( dots_max, dots_num, dots_label, dots_unit )
269
270
271    INTEGER(iwp),      INTENT(IN)     ::  dots_max
272    INTEGER(iwp),      INTENT(INOUT)  ::  dots_num
273    CHARACTER (LEN=*), DIMENSION(dots_max), INTENT(INOUT)  :: dots_label
274    CHARACTER (LEN=*), DIMENSION(dots_max), INTENT(INOUT)  :: dots_unit
275
276!
277!-- Next line is to avoid compiler warning about unused variables. Please remove.
278    IF ( dots_num == 0  .OR.  dots_label(1)(1:1) == ' '  .OR.  dots_unit(1)(1:1) == ' ' )  CONTINUE
279
280
281 END SUBROUTINE dynamics_check_data_output_ts
282
283
284!--------------------------------------------------------------------------------------------------!
285! Description:
286! ------------
287!> Set the unit of module-specific profile output quantities. For those variables not recognized,
288!> the parameter unit is set to "illegal", which tells the calling routine that the output variable
289!> is not defined and leads to a program abort.
290!--------------------------------------------------------------------------------------------------!
291 SUBROUTINE dynamics_check_data_output_pr( variable, var_count, unit, dopr_unit )
292
293
294    CHARACTER (LEN=*) ::  unit     !<
295    CHARACTER (LEN=*) ::  variable !<
296    CHARACTER (LEN=*) ::  dopr_unit !< local value of dopr_unit
297
298    INTEGER(iwp) ::  var_count     !<
299
300!
301!-- Next line is to avoid compiler warning about unused variables. Please remove.
302    IF ( unit(1:1) == ' '  .OR.  dopr_unit(1:1) == ' '  .OR.  var_count == 0 )  CONTINUE
303
304    SELECT CASE ( TRIM( variable ) )
305
306!       CASE ( 'var_name' )
307
308       CASE DEFAULT
309          unit = 'illegal'
310
311    END SELECT
312
313
314 END SUBROUTINE dynamics_check_data_output_pr
315
316
317!--------------------------------------------------------------------------------------------------!
318! Description:
319! ------------
320!> Set the unit of module-specific output quantities. For those variables not recognized,
321!> the parameter unit is set to "illegal", which tells the calling routine that the output variable
322!< is not defined and leads to a program abort.
323!--------------------------------------------------------------------------------------------------!
324 SUBROUTINE dynamics_check_data_output( variable, unit )
325
326
327    CHARACTER (LEN=*) ::  unit     !<
328    CHARACTER (LEN=*) ::  variable !<
329
330    SELECT CASE ( TRIM( variable ) )
331
332!       CASE ( 'u2' )
333
334       CASE DEFAULT
335          unit = 'illegal'
336
337    END SELECT
338
339
340 END SUBROUTINE dynamics_check_data_output
341
342
343!------------------------------------------------------------------------------!
344!
345! Description:
346! ------------
347!> Initialize module-specific masked output
348!------------------------------------------------------------------------------!
349 SUBROUTINE dynamics_init_masks( variable, unit )
350
351
352    CHARACTER (LEN=*) ::  unit     !<
353    CHARACTER (LEN=*) ::  variable !<
354
355
356    SELECT CASE ( TRIM( variable ) )
357
358!       CASE ( 'u2' )
359
360       CASE DEFAULT
361          unit = 'illegal'
362
363    END SELECT
364
365
366 END SUBROUTINE dynamics_init_masks
367
368
369!--------------------------------------------------------------------------------------------------!
370! Description:
371! ------------
372!> Initialize module-specific arrays
373!--------------------------------------------------------------------------------------------------!
374 SUBROUTINE dynamics_init_arrays
375
376
377 END SUBROUTINE dynamics_init_arrays
378
379
380!--------------------------------------------------------------------------------------------------!
381! Description:
382! ------------
383!> Execution of module-specific initializing actions
384!--------------------------------------------------------------------------------------------------!
385 SUBROUTINE dynamics_init
386
387
388 END SUBROUTINE dynamics_init
389
390
391!--------------------------------------------------------------------------------------------------!
392! Description:
393! ------------
394!> Perform module-specific post-initialization checks
395!--------------------------------------------------------------------------------------------------!
396 SUBROUTINE dynamics_init_checks
397
398
399 END SUBROUTINE dynamics_init_checks
400
401
402!--------------------------------------------------------------------------------------------------!
403! Description:
404! ------------
405!> Set the grids on which module-specific output quantities are defined. Allowed values for
406!> grid_x are "x" and "xu", for grid_y "y" and "yv", and for grid_z "zu" and "zw".
407!--------------------------------------------------------------------------------------------------!
408 SUBROUTINE dynamics_define_netcdf_grid( variable, found, grid_x, grid_y, grid_z )
409
410
411    CHARACTER (LEN=*) ::  grid_x     !<
412    CHARACTER (LEN=*) ::  grid_y     !<
413    CHARACTER (LEN=*) ::  grid_z     !<
414    CHARACTER (LEN=*) ::  variable   !<
415
416    LOGICAL ::  found   !<
417
418
419    SELECT CASE ( TRIM( variable ) )
420
421!       CASE ( 'u2' )
422
423       CASE DEFAULT
424          found  = .FALSE.
425          grid_x = 'none'
426          grid_y = 'none'
427          grid_z = 'none'
428
429    END SELECT
430
431
432 END SUBROUTINE dynamics_define_netcdf_grid
433
434
435!--------------------------------------------------------------------------------------------------!
436! Description:
437! ------------
438!> Print a header with module-specific information.
439!--------------------------------------------------------------------------------------------------!
440 SUBROUTINE dynamics_header( io )
441
442
443    INTEGER(iwp) ::  io   !<
444
445!
446!-- If no module-specific variables are read from the namelist-file, no information will be printed.
447    IF ( .NOT. dynamics_module_enabled )  THEN
448       WRITE ( io, 100 )
449       RETURN
450    ENDIF
451
452!
453!-- Printing the information.
454    WRITE ( io, 110 )
455
456!
457!-- Format-descriptors
458100 FORMAT (//' *** dynamic module disabled'/)
459110 FORMAT (//1X,78('#')                                                       &
460            //' User-defined variables and actions:'/                          &
461              ' -----------------------------------'//)
462
463 END SUBROUTINE dynamics_header
464
465
466!--------------------------------------------------------------------------------------------------!
467! Description:
468! ------------
469!> Execute module-specific actions for all grid points
470!--------------------------------------------------------------------------------------------------!
471 SUBROUTINE dynamics_actions( location )
472
473
474    CHARACTER (LEN=*) ::  location !<
475
476!    INTEGER(iwp) ::  i !<
477!    INTEGER(iwp) ::  j !<
478!    INTEGER(iwp) ::  k !<
479
480!
481!-- Here the user-defined actions follow
482!-- No calls for single grid points are allowed at locations before and
483!-- after the timestep, since these calls are not within an i,j-loop
484    SELECT CASE ( location )
485
486       CASE ( 'before_timestep' )
487
488
489       CASE ( 'before_prognostic_equations' )
490
491
492       CASE ( 'after_integration' )
493
494
495       CASE ( 'after_timestep' )
496
497
498       CASE ( 'u-tendency' )
499
500
501       CASE ( 'v-tendency' )
502
503
504       CASE ( 'w-tendency' )
505
506
507       CASE ( 'pt-tendency' )
508
509
510       CASE ( 'sa-tendency' )
511
512
513       CASE ( 'e-tendency' )
514
515
516       CASE ( 'q-tendency' )
517
518
519       CASE ( 's-tendency' )
520
521
522       CASE DEFAULT
523          CONTINUE
524
525    END SELECT
526
527 END SUBROUTINE dynamics_actions
528
529
530!--------------------------------------------------------------------------------------------------!
531! Description:
532! ------------
533!> Execute module-specific actions for grid point i,j
534!--------------------------------------------------------------------------------------------------!
535 SUBROUTINE dynamics_actions_ij( i, j, location )
536
537
538    CHARACTER (LEN=*) ::  location
539
540    INTEGER(iwp) ::  i
541    INTEGER(iwp) ::  j
542
543!
544!-- Here the user-defined actions follow
545    SELECT CASE ( location )
546
547       CASE ( 'u-tendency' )
548
549!--       Next line is to avoid compiler warning about unused variables. Please remove.
550          IF ( i +  j < 0 )  CONTINUE
551
552       CASE ( 'v-tendency' )
553
554
555       CASE ( 'w-tendency' )
556
557
558       CASE ( 'pt-tendency' )
559
560
561       CASE ( 'sa-tendency' )
562
563
564       CASE ( 'e-tendency' )
565
566
567       CASE ( 'q-tendency' )
568
569
570       CASE ( 's-tendency' )
571
572
573       CASE DEFAULT
574          CONTINUE
575
576    END SELECT
577
578 END SUBROUTINE dynamics_actions_ij
579
580
581!--------------------------------------------------------------------------------------------------!
582! Description:
583! ------------
584!> Compute module-specific non-advective processes for all grid points
585!--------------------------------------------------------------------------------------------------!
586 SUBROUTINE dynamics_non_advective_processes
587
588
589
590 END SUBROUTINE dynamics_non_advective_processes
591
592
593!--------------------------------------------------------------------------------------------------!
594! Description:
595! ------------
596!> Compute module-specific non-advective processes for grid points i,j
597!--------------------------------------------------------------------------------------------------!
598 SUBROUTINE dynamics_non_advective_processes_ij( i, j )
599
600
601    INTEGER(iwp) ::  i                 !<
602    INTEGER(iwp) ::  j                 !<
603
604!
605!--    Next line is just to avoid compiler warnings about unused variables. You may remove it.
606       IF ( i + j < 0 )  CONTINUE
607
608
609 END SUBROUTINE dynamics_non_advective_processes_ij
610
611
612!--------------------------------------------------------------------------------------------------!
613! Description:
614! ------------
615!> Perform module-specific horizontal boundary exchange
616!--------------------------------------------------------------------------------------------------!
617 SUBROUTINE dynamics_exchange_horiz
618
619
620
621 END SUBROUTINE dynamics_exchange_horiz
622
623
624!--------------------------------------------------------------------------------------------------!
625! Description:
626! ------------
627!> Compute module-specific prognostic equations for all grid points
628!--------------------------------------------------------------------------------------------------!
629 SUBROUTINE dynamics_prognostic_equations
630
631
632
633 END SUBROUTINE dynamics_prognostic_equations
634
635
636!--------------------------------------------------------------------------------------------------!
637! Description:
638! ------------
639!> Compute module-specific prognostic equations for grid point i,j
640!--------------------------------------------------------------------------------------------------!
641 SUBROUTINE dynamics_prognostic_equations_ij( i, j, i_omp_start, tn )
642
643
644    INTEGER(iwp), INTENT(IN) ::  i            !< grid index in x-direction
645    INTEGER(iwp), INTENT(IN) ::  j            !< grid index in y-direction
646    INTEGER(iwp), INTENT(IN) ::  i_omp_start  !< first loop index of i-loop in prognostic_equations
647    INTEGER(iwp), INTENT(IN) ::  tn           !< task number of openmp task
648
649!
650!-- Next line is just to avoid compiler warnings about unused variables. You may remove it.
651    IF ( i + j + i_omp_start + tn < 0 )  CONTINUE
652
653 END SUBROUTINE dynamics_prognostic_equations_ij
654
655
656!------------------------------------------------------------------------------!
657! Description:
658! ------------
659!> Swap timelevels of module-specific array pointers
660!------------------------------------------------------------------------------!
661 SUBROUTINE dynamics_swap_timelevel ( mod_count )
662
663
664    INTEGER, INTENT(IN) :: mod_count
665
666
667    SELECT CASE ( mod_count )
668
669       CASE ( 0 )
670
671          u  => u_1;   u_p  => u_2
672          v  => v_1;   v_p  => v_2
673          w  => w_1;   w_p  => w_2
674          IF ( .NOT. neutral )  THEN
675             pt => pt_1;  pt_p => pt_2
676          ENDIF
677          IF ( humidity )  THEN
678             q => q_1;    q_p => q_2
679          ENDIF
680          IF ( passive_scalar )  THEN
681             s => s_1;    s_p => s_2
682          ENDIF
683
684       CASE ( 1 )
685
686          u  => u_2;   u_p  => u_1
687          v  => v_2;   v_p  => v_1
688          w  => w_2;   w_p  => w_1
689          IF ( .NOT. neutral )  THEN
690             pt => pt_2;  pt_p => pt_1
691          ENDIF
692          IF ( humidity )  THEN
693             q => q_2;    q_p => q_1
694          ENDIF
695          IF ( passive_scalar )  THEN
696             s => s_2;    s_p => s_1
697          ENDIF
698
699    END SELECT
700
701 END SUBROUTINE dynamics_swap_timelevel
702
703
704!--------------------------------------------------------------------------------------------------!
705! Description:
706! ------------
707!> Sum up and time-average module-specific output quantities
708!> as well as allocate the array necessary for storing the average.
709!--------------------------------------------------------------------------------------------------!
710 SUBROUTINE dynamics_3d_data_averaging( mode, variable )
711
712
713    CHARACTER (LEN=*) ::  mode    !<
714    CHARACTER (LEN=*) :: variable !<
715
716
717    IF ( mode == 'allocate' )  THEN
718
719       SELECT CASE ( TRIM( variable ) )
720
721!          CASE ( 'u2' )
722
723          CASE DEFAULT
724             CONTINUE
725
726       END SELECT
727
728    ELSEIF ( mode == 'sum' )  THEN
729
730       SELECT CASE ( TRIM( variable ) )
731
732!          CASE ( 'u2' )
733
734          CASE DEFAULT
735             CONTINUE
736
737       END SELECT
738
739    ELSEIF ( mode == 'average' )  THEN
740
741       SELECT CASE ( TRIM( variable ) )
742
743!          CASE ( 'u2' )
744
745       END SELECT
746
747    ENDIF
748
749
750 END SUBROUTINE dynamics_3d_data_averaging
751
752
753!--------------------------------------------------------------------------------------------------!
754! Description:
755! ------------
756!> Resorts the module-specific output quantity with indices (k,j,i) to a
757!> temporary array with indices (i,j,k) and sets the grid on which it is defined.
758!> Allowed values for grid are "zu" and "zw".
759!--------------------------------------------------------------------------------------------------!
760 SUBROUTINE dynamics_data_output_2d( av, variable, found, grid, mode, local_pf, &
761                                     two_d, nzb_do, nzt_do, fill_value )
762
763
764    CHARACTER (LEN=*) ::  grid     !<
765    CHARACTER (LEN=*), INTENT(IN) ::  mode       !< either 'xy', 'xz' or 'yz'
766    CHARACTER (LEN=*) ::  variable !<
767
768    INTEGER(iwp) ::  av     !< flag to control data output of instantaneous or time-averaged data
769!    INTEGER(iwp) ::  i      !< grid index along x-direction
770!    INTEGER(iwp) ::  j      !< grid index along y-direction
771!    INTEGER(iwp) ::  k      !< grid index along z-direction
772!    INTEGER(iwp) ::  m      !< running index surface elements
773    INTEGER(iwp) ::  nzb_do !< lower limit of the domain (usually nzb)
774    INTEGER(iwp) ::  nzt_do !< upper limit of the domain (usually nzt+1)
775
776    LOGICAL      ::  found !<
777    LOGICAL      ::  two_d !< flag parameter that indicates 2D variables (horizontal cross sections)
778
779    REAL(wp), INTENT(IN) ::  fill_value
780
781    REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf !<
782
783!
784!-- Next line is just to avoid compiler warnings about unused variables. You may remove it.
785    IF ( two_d .AND. av + LEN( mode ) + local_pf(nxl,nys,nzb_do) + fill_value < 0.0 )  CONTINUE
786
787    found = .TRUE.
788
789    SELECT CASE ( TRIM( variable ) )
790
791!       CASE ( 'u2_xy', 'u2_xz', 'u2_yz' )
792
793       CASE DEFAULT
794          found = .FALSE.
795          grid  = 'none'
796
797    END SELECT
798
799
800 END SUBROUTINE dynamics_data_output_2d
801
802
803!--------------------------------------------------------------------------------------------------!
804! Description:
805! ------------
806!> Resorts the module-specific output quantity with indices (k,j,i)
807!> to a temporary array with indices (i,j,k).
808!--------------------------------------------------------------------------------------------------!
809 SUBROUTINE dynamics_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
810
811
812    CHARACTER (LEN=*) ::  variable !<
813
814    INTEGER(iwp) ::  av    !<
815!    INTEGER(iwp) ::  i     !<
816!    INTEGER(iwp) ::  j     !<
817!    INTEGER(iwp) ::  k     !<
818    INTEGER(iwp) ::  nzb_do !< lower limit of the data output (usually 0)
819    INTEGER(iwp) ::  nzt_do !< vertical upper limit of the data output (usually nz_do3d)
820
821    LOGICAL      ::  found !<
822
823    REAL(wp), INTENT(IN) ::  fill_value    !< value for the _FillValue attribute
824
825    REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf !<
826
827!
828!-- Next line is to avoid compiler warning about unused variables. Please remove.
829    IF ( av + local_pf(nxl,nys,nzb_do) + fill_value < 0.0 )  CONTINUE
830
831
832    found = .TRUE.
833
834    SELECT CASE ( TRIM( variable ) )
835
836!       CASE ( 'u2' )
837
838       CASE DEFAULT
839          found = .FALSE.
840
841    END SELECT
842
843
844 END SUBROUTINE dynamics_data_output_3d
845
846
847!--------------------------------------------------------------------------------------------------!
848! Description:
849! ------------
850!> Calculation of module-specific statistics, i.e. horizontally averaged profiles and time series.
851!> This is called for every statistic region sr, but at least for the region "total domain" (sr=0).
852!--------------------------------------------------------------------------------------------------!
853 SUBROUTINE dynamics_statistics( mode, sr, tn )
854
855
856    CHARACTER (LEN=*) ::  mode   !<
857!    INTEGER(iwp) ::  i    !<
858!    INTEGER(iwp) ::  j    !<
859!    INTEGER(iwp) ::  k    !<
860    INTEGER(iwp) ::  sr   !<
861    INTEGER(iwp) ::  tn   !<
862
863!
864!-- Next line is to avoid compiler warning about unused variables. Please remove.
865    IF ( sr == 0  .OR.  tn == 0 )  CONTINUE
866
867    IF ( mode == 'profiles' )  THEN
868
869    ELSEIF ( mode == 'time_series' )  THEN
870
871    ENDIF
872
873 END SUBROUTINE dynamics_statistics
874
875
876!--------------------------------------------------------------------------------------------------!
877! Description:
878! ------------
879!> Read module-specific global restart data.
880!--------------------------------------------------------------------------------------------------!
881 SUBROUTINE dynamics_rrd_global( found )
882
883
884    LOGICAL, INTENT(OUT)  ::  found
885
886
887    found = .TRUE.
888
889
890    SELECT CASE ( restart_string(1:length) )
891
892       CASE ( 'global_paramter' )
893!          READ ( 13 )  global_parameter
894
895       CASE DEFAULT
896
897          found = .FALSE.
898
899    END SELECT
900
901
902 END SUBROUTINE dynamics_rrd_global
903
904
905!--------------------------------------------------------------------------------------------------!
906! Description:
907! ------------
908!> Read module-specific processor specific restart data from file(s).
909!> Subdomain index limits on file are given by nxl_on_file, etc.
910!> Indices nxlc, etc. indicate the range of gridpoints to be mapped from the subdomain on file (f)
911!> to the subdomain of the current PE (c). They have been calculated in routine rrd_local.
912!--------------------------------------------------------------------------------------------------!
913 SUBROUTINE dynamics_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc, nxr_on_file, nynf, nync,   &
914                                nyn_on_file, nysf, nysc, nys_on_file, tmp_2d, tmp_3d, found )
915
916
917    INTEGER(iwp) ::  k               !<
918    INTEGER(iwp) ::  nxlc            !<
919    INTEGER(iwp) ::  nxlf            !<
920    INTEGER(iwp) ::  nxl_on_file     !<
921    INTEGER(iwp) ::  nxrc            !<
922    INTEGER(iwp) ::  nxrf            !<
923    INTEGER(iwp) ::  nxr_on_file     !<
924    INTEGER(iwp) ::  nync            !<
925    INTEGER(iwp) ::  nynf            !<
926    INTEGER(iwp) ::  nyn_on_file     !<
927    INTEGER(iwp) ::  nysc            !<
928    INTEGER(iwp) ::  nysf            !<
929    INTEGER(iwp) ::  nys_on_file     !<
930
931    LOGICAL, INTENT(OUT)  ::  found
932
933    REAL(wp), DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_2d   !<
934    REAL(wp), DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d   !<
935
936!
937!-- Next line is to avoid compiler warning about unused variables. Please remove.
938    IF ( k + nxlc + nxlf + nxrc + nxrf + nync + nynf + nysc + nysf + tmp_2d(nys_on_file,nxl_on_file) + tmp_3d(nzb,nys_on_file,nxl_on_file) < 0.0 )  CONTINUE
939!
940!-- Here the reading of user-defined restart data follows:
941!-- Sample for user-defined output
942
943    found = .TRUE.
944
945    SELECT CASE ( restart_string(1:length) )
946
947!       CASE ( 'u2_av' )
948
949       CASE DEFAULT
950
951          found = .FALSE.
952
953    END SELECT
954
955 END SUBROUTINE dynamics_rrd_local
956
957
958!--------------------------------------------------------------------------------------------------!
959! Description:
960! ------------
961!> Writes global module-specific restart data into binary file(s) for restart runs.
962!--------------------------------------------------------------------------------------------------!
963 SUBROUTINE dynamics_wrd_global
964
965
966 END SUBROUTINE dynamics_wrd_global
967
968
969!--------------------------------------------------------------------------------------------------!
970! Description:
971! ------------
972!> Writes processor specific and module-specific restart data into binary file(s) for restart runs.
973!--------------------------------------------------------------------------------------------------!
974 SUBROUTINE dynamics_wrd_local
975
976
977 END SUBROUTINE dynamics_wrd_local
978
979
980!--------------------------------------------------------------------------------------------------!
981! Description:
982! ------------
983!> Execute module-specific actions at the very end of the program.
984!--------------------------------------------------------------------------------------------------!
985 SUBROUTINE dynamics_last_actions
986
987
988 END SUBROUTINE dynamics_last_actions
989
990 END MODULE dynamics_mod
Note: See TracBrowser for help on using the repository browser.