1 | !> @file user_3d_data_averaging.f90 |
---|
2 | !--------------------------------------------------------------------------------! |
---|
3 | ! This file is part of PALM. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
7 | ! either version 3 of the License, or (at your option) any later version. |
---|
8 | ! |
---|
9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
12 | ! |
---|
13 | ! You should have received a copy of the GNU General Public License along with |
---|
14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
15 | ! |
---|
16 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! Code annotations made doxygen readable |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: user_3d_data_averaging.f90 1682 2015-10-07 23:56:08Z knoop $ |
---|
26 | ! |
---|
27 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
28 | ! REAL constants provided with KIND-attribute |
---|
29 | ! |
---|
30 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
31 | ! REAL functions provided with KIND-attribute |
---|
32 | ! |
---|
33 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
34 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
35 | ! kinds are defined in new module kinds, |
---|
36 | ! revision history before 2012 removed, |
---|
37 | ! comment fields (!:) to be used for variable explanations added to |
---|
38 | ! all variable declaration statements |
---|
39 | ! |
---|
40 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
41 | ! code put under GPL (PALM 3.9) |
---|
42 | ! |
---|
43 | ! 211 2008-11-11 04:46:24Z raasch |
---|
44 | ! Former file user_interface.f90 split into one file per subroutine |
---|
45 | ! |
---|
46 | ! Description: |
---|
47 | ! ------------ |
---|
48 | !> Sum up and time-average user-defined output quantities as well as allocate |
---|
49 | !> the array necessary for storing the average. |
---|
50 | !------------------------------------------------------------------------------! |
---|
51 | SUBROUTINE user_3d_data_averaging( mode, variable ) |
---|
52 | |
---|
53 | |
---|
54 | USE control_parameters |
---|
55 | |
---|
56 | USE indices |
---|
57 | |
---|
58 | USE kinds |
---|
59 | |
---|
60 | USE user |
---|
61 | |
---|
62 | IMPLICIT NONE |
---|
63 | |
---|
64 | CHARACTER (LEN=*) :: mode !< |
---|
65 | CHARACTER (LEN=*) :: variable !< |
---|
66 | |
---|
67 | INTEGER(iwp) :: i !< |
---|
68 | INTEGER(iwp) :: j !< |
---|
69 | INTEGER(iwp) :: k !< |
---|
70 | |
---|
71 | IF ( mode == 'allocate' ) THEN |
---|
72 | |
---|
73 | SELECT CASE ( TRIM( variable ) ) |
---|
74 | |
---|
75 | ! |
---|
76 | !-- Uncomment and extend the following lines, if necessary. |
---|
77 | !-- The arrays for storing the user defined quantities (here u2_av) have |
---|
78 | !-- to be declared and defined by the user! |
---|
79 | !-- Sample for user-defined output: |
---|
80 | ! CASE ( 'u2' ) |
---|
81 | ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN |
---|
82 | ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
83 | ! ENDIF |
---|
84 | ! u2_av = 0.0_wp |
---|
85 | |
---|
86 | CASE DEFAULT |
---|
87 | CONTINUE |
---|
88 | |
---|
89 | END SELECT |
---|
90 | |
---|
91 | ELSEIF ( mode == 'sum' ) THEN |
---|
92 | |
---|
93 | SELECT CASE ( TRIM( variable ) ) |
---|
94 | |
---|
95 | ! |
---|
96 | !-- Uncomment and extend the following lines, if necessary. |
---|
97 | !-- The arrays for storing the user defined quantities (here u2 and |
---|
98 | !-- u2_av) have to be declared and defined by the user! |
---|
99 | !-- Sample for user-defined output: |
---|
100 | ! CASE ( 'u2' ) |
---|
101 | ! DO i = nxlg, nxrg |
---|
102 | ! DO j = nysg, nyng |
---|
103 | ! DO k = nzb, nzt+1 |
---|
104 | ! u2_av(k,j,i) = u2_av(k,j,i) + u2(k,j,i) |
---|
105 | ! ENDDO |
---|
106 | ! ENDDO |
---|
107 | ! ENDDO |
---|
108 | |
---|
109 | CASE DEFAULT |
---|
110 | CONTINUE |
---|
111 | |
---|
112 | END SELECT |
---|
113 | |
---|
114 | ELSEIF ( mode == 'average' ) THEN |
---|
115 | |
---|
116 | SELECT CASE ( TRIM( variable ) ) |
---|
117 | |
---|
118 | ! |
---|
119 | !-- Uncomment and extend the following lines, if necessary. |
---|
120 | !-- The arrays for storing the user defined quantities (here u2_av) have |
---|
121 | !-- to be declared and defined by the user! |
---|
122 | !-- Sample for user-defined output: |
---|
123 | ! CASE ( 'u2' ) |
---|
124 | ! DO i = nxlg, nxrg |
---|
125 | ! DO j = nysg, nyng |
---|
126 | ! DO k = nzb, nzt+1 |
---|
127 | ! u2_av(k,j,i) = u2_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
128 | ! ENDDO |
---|
129 | ! ENDDO |
---|
130 | ! ENDDO |
---|
131 | |
---|
132 | END SELECT |
---|
133 | |
---|
134 | ENDIF |
---|
135 | |
---|
136 | |
---|
137 | END SUBROUTINE user_3d_data_averaging |
---|