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

Last change on this file since 1036 was 1036, checked in by raasch, 9 years ago

code has been put under the GNU General Public License (v3)

  • Property svn:keywords set to Id
File size: 3.3 KB
RevLine 
[211]1 SUBROUTINE user_3d_data_averaging( mode, variable )
2
[1036]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-2012  Leibniz University Hannover
18!--------------------------------------------------------------------------------!
19!
[484]20! Current revisions:
[211]21! -----------------
[226]22!
[211]23!
24! Former revisions:
25! -----------------
26! $Id: user_3d_data_averaging.f90 1036 2012-10-22 13:43:42Z raasch $
27!
[226]28! 211 2008-11-11 04:46:24Z raasch
29! Former file user_interface.f90 split into one file per subroutine
30!
[211]31! Description:
32! ------------
33! Sum up and time-average user-defined output quantities as well as allocate
34! the array necessary for storing the average.
35!------------------------------------------------------------------------------!
36
37    USE control_parameters
38    USE indices
39    USE user
40
41    IMPLICIT NONE
42
43    CHARACTER (LEN=*) ::  mode, variable
44
45    INTEGER ::  i, j, k
46
47
48    IF ( mode == 'allocate' )  THEN
49
50       SELECT CASE ( TRIM( variable ) )
51
52!
53!--       Uncomment and extend the following lines, if necessary.
54!--       The arrays for storing the user defined quantities (here u2_av) have
55!--       to be declared and defined by the user!
56!--       Sample for user-defined output:
57!          CASE ( 'u2' )
58!             IF ( .NOT. ALLOCATED( u2_av ) )  THEN
[667]59!                ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
[211]60!             ENDIF
61!             u2_av = 0.0
62
63          CASE DEFAULT
64             CONTINUE
65
66       END SELECT
67
68    ELSEIF ( mode == 'sum' )  THEN
69
70       SELECT CASE ( TRIM( variable ) )
71
72!
73!--       Uncomment and extend the following lines, if necessary.
74!--       The arrays for storing the user defined quantities (here u2 and
75!--       u2_av) have to be declared and defined by the user!
76!--       Sample for user-defined output:
77!          CASE ( 'u2' )
[667]78!             DO  i = nxlg, nxrg
79!                DO  j = nysg, nyng
[211]80!                   DO  k = nzb, nzt+1
81!                      u2_av(k,j,i) = u2_av(k,j,i) + u2(k,j,i)
82!                   ENDDO
83!                ENDDO
84!             ENDDO
85
86          CASE DEFAULT
87             CONTINUE
88
89       END SELECT
90
91    ELSEIF ( mode == 'average' )  THEN
92
93       SELECT CASE ( TRIM( variable ) )
94
95!
96!--       Uncomment and extend the following lines, if necessary.
97!--       The arrays for storing the user defined quantities (here u2_av) have
98!--       to be declared and defined by the user!
99!--       Sample for user-defined output:
100!          CASE ( 'u2' )
[667]101!             DO  i = nxlg, nxrg
102!                DO  j = nysg, nyng
[211]103!                   DO  k = nzb, nzt+1
104!                      u2_av(k,j,i) = u2_av(k,j,i) / REAL( average_count_3d )
105!                   ENDDO
106!                ENDDO
107!             ENDDO
108
109       END SELECT
110
111    ENDIF
112
113
114 END SUBROUTINE user_3d_data_averaging
Note: See TracBrowser for help on using the repository browser.