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

Last change on this file since 1876 was 1818, checked in by maronga, 9 years ago

last commit documented / copyright update

  • Property svn:keywords set to Id
File size: 4.1 KB
RevLine 
[1682]1!> @file user_3d_data_averaging.f90
[1036]2!--------------------------------------------------------------------------------!
3! This file is part of PALM.
4!
5! PALM is free software: you can redistribute it and/or modify it under the terms
6! of the GNU General Public License as published by the Free Software Foundation,
7! either version 3 of the License, or (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
10! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with
14! PALM. If not, see <http://www.gnu.org/licenses/>.
15!
[1818]16! Copyright 1997-2016 Leibniz Universitaet Hannover
[1036]17!--------------------------------------------------------------------------------!
18!
[484]19! Current revisions:
[211]20! -----------------
[1354]21!
[1683]22!
[1321]23! Former revisions:
24! -----------------
25! $Id: user_3d_data_averaging.f90 1818 2016-04-06 15:53:27Z raasch $
26!
[1683]27! 1682 2015-10-07 23:56:08Z knoop
28! Code annotations made doxygen readable
29!
[1354]30! 1353 2014-04-08 15:21:23Z heinze
31! REAL constants provided with KIND-attribute
32!
[1323]33! 1322 2014-03-20 16:38:49Z raasch
34! REAL functions provided with KIND-attribute
35!
[1321]36! 1320 2014-03-20 08:40:49Z raasch
[1320]37! kind-parameters added to all INTEGER and REAL declaration statements,
38! kinds are defined in new module kinds,
39! revision history before 2012 removed,
40! comment fields (!:) to be used for variable explanations added to
41! all variable declaration statements
[211]42!
[1037]43! 1036 2012-10-22 13:43:42Z raasch
44! code put under GPL (PALM 3.9)
45!
[226]46! 211 2008-11-11 04:46:24Z raasch
47! Former file user_interface.f90 split into one file per subroutine
48!
[211]49! Description:
50! ------------
[1682]51!> Sum up and time-average user-defined output quantities as well as allocate
52!> the array necessary for storing the average.
[211]53!------------------------------------------------------------------------------!
[1682]54 SUBROUTINE user_3d_data_averaging( mode, variable )
55 
[211]56
57    USE control_parameters
[1320]58
[211]59    USE indices
[1320]60
61    USE kinds
62
[211]63    USE user
64
65    IMPLICIT NONE
66
[1682]67    CHARACTER (LEN=*) ::  mode    !<
68    CHARACTER (LEN=*) :: variable !<
[211]69
[1682]70    INTEGER(iwp) ::  i !<
71    INTEGER(iwp) ::  j !<
72    INTEGER(iwp) ::  k !<
[211]73
74    IF ( mode == 'allocate' )  THEN
75
76       SELECT CASE ( TRIM( variable ) )
77
78!
79!--       Uncomment and extend the following lines, if necessary.
80!--       The arrays for storing the user defined quantities (here u2_av) have
81!--       to be declared and defined by the user!
82!--       Sample for user-defined output:
83!          CASE ( 'u2' )
84!             IF ( .NOT. ALLOCATED( u2_av ) )  THEN
[667]85!                ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
[211]86!             ENDIF
[1353]87!             u2_av = 0.0_wp
[211]88
89          CASE DEFAULT
90             CONTINUE
91
92       END SELECT
93
94    ELSEIF ( mode == 'sum' )  THEN
95
96       SELECT CASE ( TRIM( variable ) )
97
98!
99!--       Uncomment and extend the following lines, if necessary.
100!--       The arrays for storing the user defined quantities (here u2 and
101!--       u2_av) have to be declared and defined by the user!
102!--       Sample for user-defined output:
103!          CASE ( 'u2' )
[667]104!             DO  i = nxlg, nxrg
105!                DO  j = nysg, nyng
[211]106!                   DO  k = nzb, nzt+1
107!                      u2_av(k,j,i) = u2_av(k,j,i) + u2(k,j,i)
108!                   ENDDO
109!                ENDDO
110!             ENDDO
111
112          CASE DEFAULT
113             CONTINUE
114
115       END SELECT
116
117    ELSEIF ( mode == 'average' )  THEN
118
119       SELECT CASE ( TRIM( variable ) )
120
121!
122!--       Uncomment and extend the following lines, if necessary.
123!--       The arrays for storing the user defined quantities (here u2_av) have
124!--       to be declared and defined by the user!
125!--       Sample for user-defined output:
126!          CASE ( 'u2' )
[667]127!             DO  i = nxlg, nxrg
128!                DO  j = nysg, nyng
[211]129!                   DO  k = nzb, nzt+1
[1322]130!                      u2_av(k,j,i) = u2_av(k,j,i) / REAL( average_count_3d, KIND=wp )
[211]131!                   ENDDO
132!                ENDDO
133!             ENDDO
134
135       END SELECT
136
137    ENDIF
138
139
140 END SUBROUTINE user_3d_data_averaging
Note: See TracBrowser for help on using the repository browser.