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

Last change on this file since 4097 was 4097, checked in by suehring, 21 months ago

Avoid overlong lines

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