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

Last change on this file since 1320 was 1320, checked in by raasch, 7 years ago

ONLY-attribute added to USE-statements,
kind-parameters added to all INTEGER and REAL declaration statements,
kinds are defined in new module kinds,
old module precision_kind is removed,
revision history before 2012 removed,
comment fields (!:) to be used for variable explanations added to all variable declaration statements

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