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