source: palm/trunk/SOURCE/user_3d_data_averaging.f90 @ 1547

Last change on this file since 1547 was 1354, checked in by heinze, 11 years ago

last commit documented

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