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-2016 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: user_3d_data_averaging.f90 1818 2016-04-06 15:53:27Z raasch $ |
---|
26 | ! |
---|
27 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
28 | ! Code annotations made doxygen readable |
---|
29 | ! |
---|
30 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
31 | ! REAL constants provided with KIND-attribute |
---|
32 | ! |
---|
33 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
34 | ! REAL functions provided with KIND-attribute |
---|
35 | ! |
---|
36 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
37 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
38 | ! kinds are defined in new module kinds, |
---|
39 | ! revision history before 2012 removed, |
---|
40 | ! comment fields (!:) to be used for variable explanations added to |
---|
41 | ! all variable declaration statements |
---|
42 | ! |
---|
43 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
44 | ! code put under GPL (PALM 3.9) |
---|
45 | ! |
---|
46 | ! 211 2008-11-11 04:46:24Z raasch |
---|
47 | ! Former file user_interface.f90 split into one file per subroutine |
---|
48 | ! |
---|
49 | ! Description: |
---|
50 | ! ------------ |
---|
51 | !> Sum up and time-average user-defined output quantities as well as allocate |
---|
52 | !> the array necessary for storing the average. |
---|
53 | !------------------------------------------------------------------------------! |
---|
54 | SUBROUTINE user_3d_data_averaging( mode, variable ) |
---|
55 | |
---|
56 | |
---|
57 | USE control_parameters |
---|
58 | |
---|
59 | USE indices |
---|
60 | |
---|
61 | USE kinds |
---|
62 | |
---|
63 | USE user |
---|
64 | |
---|
65 | IMPLICIT NONE |
---|
66 | |
---|
67 | CHARACTER (LEN=*) :: mode !< |
---|
68 | CHARACTER (LEN=*) :: variable !< |
---|
69 | |
---|
70 | INTEGER(iwp) :: i !< |
---|
71 | INTEGER(iwp) :: j !< |
---|
72 | INTEGER(iwp) :: k !< |
---|
73 | |
---|
74 | IF ( mode == 'allocate' ) THEN |
---|
75 | |
---|
76 | SELECT CASE ( TRIM( variable ) ) |
---|
77 | |
---|
78 | ! |
---|
79 | !-- Uncomment and extend the following lines, if necessary. |
---|
80 | !-- The arrays for storing the user defined quantities (here u2_av) have |
---|
81 | !-- to be declared and defined by the user! |
---|
82 | !-- Sample for user-defined output: |
---|
83 | ! CASE ( 'u2' ) |
---|
84 | ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN |
---|
85 | ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
86 | ! ENDIF |
---|
87 | ! u2_av = 0.0_wp |
---|
88 | |
---|
89 | CASE DEFAULT |
---|
90 | CONTINUE |
---|
91 | |
---|
92 | END SELECT |
---|
93 | |
---|
94 | ELSEIF ( mode == 'sum' ) THEN |
---|
95 | |
---|
96 | SELECT CASE ( TRIM( variable ) ) |
---|
97 | |
---|
98 | ! |
---|
99 | !-- Uncomment and extend the following lines, if necessary. |
---|
100 | !-- The arrays for storing the user defined quantities (here u2 and |
---|
101 | !-- u2_av) have to be declared and defined by the user! |
---|
102 | !-- Sample for user-defined output: |
---|
103 | ! CASE ( 'u2' ) |
---|
104 | ! DO i = nxlg, nxrg |
---|
105 | ! DO j = nysg, nyng |
---|
106 | ! DO k = nzb, nzt+1 |
---|
107 | ! u2_av(k,j,i) = u2_av(k,j,i) + u2(k,j,i) |
---|
108 | ! ENDDO |
---|
109 | ! ENDDO |
---|
110 | ! ENDDO |
---|
111 | |
---|
112 | CASE DEFAULT |
---|
113 | CONTINUE |
---|
114 | |
---|
115 | END SELECT |
---|
116 | |
---|
117 | ELSEIF ( mode == 'average' ) THEN |
---|
118 | |
---|
119 | SELECT CASE ( TRIM( variable ) ) |
---|
120 | |
---|
121 | ! |
---|
122 | !-- Uncomment and extend the following lines, if necessary. |
---|
123 | !-- The arrays for storing the user defined quantities (here u2_av) have |
---|
124 | !-- to be declared and defined by the user! |
---|
125 | !-- Sample for user-defined output: |
---|
126 | ! CASE ( 'u2' ) |
---|
127 | ! DO i = nxlg, nxrg |
---|
128 | ! DO j = nysg, nyng |
---|
129 | ! DO k = nzb, nzt+1 |
---|
130 | ! u2_av(k,j,i) = u2_av(k,j,i) / REAL( average_count_3d, KIND=wp ) |
---|
131 | ! ENDDO |
---|
132 | ! ENDDO |
---|
133 | ! ENDDO |
---|
134 | |
---|
135 | END SELECT |
---|
136 | |
---|
137 | ENDIF |
---|
138 | |
---|
139 | |
---|
140 | END SUBROUTINE user_3d_data_averaging |
---|