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

Last change on this file since 2032 was 2001, checked in by knoop, 8 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 4.1 KB
RevLine 
[1682]1!> @file user_3d_data_averaging.f90
[2000]2!------------------------------------------------------------------------------!
[1036]3! This file is part of PALM.
4!
[2000]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.
[1036]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!
[1818]17! Copyright 1997-2016 Leibniz Universitaet Hannover
[2000]18!------------------------------------------------------------------------------!
[1036]19!
[484]20! Current revisions:
[211]21! -----------------
[1354]22!
[2001]23!
[1321]24! Former revisions:
25! -----------------
26! $Id: user_3d_data_averaging.f90 2001 2016-08-20 18:41:22Z knoop $
27!
[2001]28! 2000 2016-08-20 18:09:15Z knoop
29! Forced header and separation lines into 80 columns
30!
[1683]31! 1682 2015-10-07 23:56:08Z knoop
32! Code annotations made doxygen readable
33!
[1354]34! 1353 2014-04-08 15:21:23Z heinze
35! REAL constants provided with KIND-attribute
36!
[1323]37! 1322 2014-03-20 16:38:49Z raasch
38! REAL functions provided with KIND-attribute
39!
[1321]40! 1320 2014-03-20 08:40:49Z raasch
[1320]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
[211]46!
[1037]47! 1036 2012-10-22 13:43:42Z raasch
48! code put under GPL (PALM 3.9)
49!
[226]50! 211 2008-11-11 04:46:24Z raasch
51! Former file user_interface.f90 split into one file per subroutine
52!
[211]53! Description:
54! ------------
[1682]55!> Sum up and time-average user-defined output quantities as well as allocate
56!> the array necessary for storing the average.
[211]57!------------------------------------------------------------------------------!
[1682]58 SUBROUTINE user_3d_data_averaging( mode, variable )
59 
[211]60
61    USE control_parameters
[1320]62
[211]63    USE indices
[1320]64
65    USE kinds
66
[211]67    USE user
68
69    IMPLICIT NONE
70
[1682]71    CHARACTER (LEN=*) ::  mode    !<
72    CHARACTER (LEN=*) :: variable !<
[211]73
[1682]74    INTEGER(iwp) ::  i !<
75    INTEGER(iwp) ::  j !<
76    INTEGER(iwp) ::  k !<
[211]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
[667]89!                ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
[211]90!             ENDIF
[1353]91!             u2_av = 0.0_wp
[211]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' )
[667]108!             DO  i = nxlg, nxrg
109!                DO  j = nysg, nyng
[211]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' )
[667]131!             DO  i = nxlg, nxrg
132!                DO  j = nysg, nyng
[211]133!                   DO  k = nzb, nzt+1
[1322]134!                      u2_av(k,j,i) = u2_av(k,j,i) / REAL( average_count_3d, KIND=wp )
[211]135!                   ENDDO
136!                ENDDO
137!             ENDDO
138
139       END SELECT
140
141    ENDIF
142
143
144 END SUBROUTINE user_3d_data_averaging
Note: See TracBrowser for help on using the repository browser.