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