1 | SUBROUTINE user_3d_data_averaging( mode, variable ) |
---|
2 | |
---|
3 | !--------------------------------------------------------------------------------! |
---|
4 | ! This file is part of PALM. |
---|
5 | ! |
---|
6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
8 | ! either version 3 of the License, or (at your option) any later 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-2014 Leibniz Universitaet Hannover |
---|
18 | !--------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: user_3d_data_averaging.f90 1321 2014-03-20 09:40:40Z raasch $ |
---|
27 | ! |
---|
28 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
29 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
30 | ! kinds are defined in new module kinds, |
---|
31 | ! revision history before 2012 removed, |
---|
32 | ! comment fields (!:) to be used for variable explanations added to |
---|
33 | ! all variable declaration statements |
---|
34 | ! |
---|
35 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
36 | ! code put under GPL (PALM 3.9) |
---|
37 | ! |
---|
38 | ! 211 2008-11-11 04:46:24Z raasch |
---|
39 | ! Former file user_interface.f90 split into one file per subroutine |
---|
40 | ! |
---|
41 | ! Description: |
---|
42 | ! ------------ |
---|
43 | ! Sum up and time-average user-defined output quantities as well as allocate |
---|
44 | ! the array necessary for storing the average. |
---|
45 | !------------------------------------------------------------------------------! |
---|
46 | |
---|
47 | USE control_parameters |
---|
48 | |
---|
49 | USE indices |
---|
50 | |
---|
51 | USE kinds |
---|
52 | |
---|
53 | USE user |
---|
54 | |
---|
55 | IMPLICIT NONE |
---|
56 | |
---|
57 | CHARACTER (LEN=*) :: mode !: |
---|
58 | CHARACTER (LEN=*) :: variable !: |
---|
59 | |
---|
60 | INTEGER(iwp) :: i !: |
---|
61 | INTEGER(iwp) :: j !: |
---|
62 | INTEGER(iwp) :: k !: |
---|
63 | |
---|
64 | IF ( mode == 'allocate' ) THEN |
---|
65 | |
---|
66 | SELECT CASE ( TRIM( variable ) ) |
---|
67 | |
---|
68 | ! |
---|
69 | !-- Uncomment and extend the following lines, if necessary. |
---|
70 | !-- The arrays for storing the user defined quantities (here u2_av) have |
---|
71 | !-- to be declared and defined by the user! |
---|
72 | !-- Sample for user-defined output: |
---|
73 | ! CASE ( 'u2' ) |
---|
74 | ! IF ( .NOT. ALLOCATED( u2_av ) ) THEN |
---|
75 | ! ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ) |
---|
76 | ! ENDIF |
---|
77 | ! u2_av = 0.0 |
---|
78 | |
---|
79 | CASE DEFAULT |
---|
80 | CONTINUE |
---|
81 | |
---|
82 | END SELECT |
---|
83 | |
---|
84 | ELSEIF ( mode == 'sum' ) 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 and |
---|
91 | !-- u2_av) have to be declared and defined by the user! |
---|
92 | !-- Sample for user-defined output: |
---|
93 | ! CASE ( 'u2' ) |
---|
94 | ! DO i = nxlg, nxrg |
---|
95 | ! DO j = nysg, nyng |
---|
96 | ! DO k = nzb, nzt+1 |
---|
97 | ! u2_av(k,j,i) = u2_av(k,j,i) + u2(k,j,i) |
---|
98 | ! ENDDO |
---|
99 | ! ENDDO |
---|
100 | ! ENDDO |
---|
101 | |
---|
102 | CASE DEFAULT |
---|
103 | CONTINUE |
---|
104 | |
---|
105 | END SELECT |
---|
106 | |
---|
107 | ELSEIF ( mode == 'average' ) THEN |
---|
108 | |
---|
109 | SELECT CASE ( TRIM( variable ) ) |
---|
110 | |
---|
111 | ! |
---|
112 | !-- Uncomment and extend the following lines, if necessary. |
---|
113 | !-- The arrays for storing the user defined quantities (here u2_av) have |
---|
114 | !-- to be declared and defined by the user! |
---|
115 | !-- Sample for user-defined output: |
---|
116 | ! CASE ( 'u2' ) |
---|
117 | ! DO i = nxlg, nxrg |
---|
118 | ! DO j = nysg, nyng |
---|
119 | ! DO k = nzb, nzt+1 |
---|
120 | ! u2_av(k,j,i) = u2_av(k,j,i) / REAL( average_count_3d ) |
---|
121 | ! ENDDO |
---|
122 | ! ENDDO |
---|
123 | ! ENDDO |
---|
124 | |
---|
125 | END SELECT |
---|
126 | |
---|
127 | ENDIF |
---|
128 | |
---|
129 | |
---|
130 | END SUBROUTINE user_3d_data_averaging |
---|