source: palm/trunk/SOURCE/user_statistics.f90 @ 2000

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

Forced header and separation lines into 80 columns

  • Property svn:keywords set to Id
File size: 5.7 KB
Line 
1!> @file user_statistics.f90
2!------------------------------------------------------------------------------!
3! This file is part of PALM.
4!
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.
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-2016 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22! Forced header and separation lines into 80 columns
23!
24! Former revisions:
25! -----------------
26! $Id: user_statistics.f90 2000 2016-08-20 18:09:15Z knoop $
27!
28! 1804 2016-04-05 16:30:18Z maronga
29! Removed code for parameter file check (__check)
30!
31! 1783 2016-03-06 18:36:17Z raasch
32! netcdf module name changed + related changes
33!
34! 1682 2015-10-07 23:56:08Z knoop
35! Code annotations made doxygen readable
36!
37! 1353 2014-04-08 15:21:23Z heinze
38! REAL constants provided with KIND-attribute
39!
40! 1320 2014-03-20 08:40:49Z raasch
41! kind-parameters added to all INTEGER and REAL declaration statements,
42! kinds are defined in new module kinds,
43! old module precision_kind is removed,
44! revision history before 2012 removed,
45! comment fields (!:) to be used for variable explanations added to
46! all variable declaration statements
47!
48! 1046 2012-11-09 14:38:45Z maronga
49! added preprocessor directive for parameter file check
50!
51! 1036 2012-10-22 13:43:42Z raasch
52! code put under GPL (PALM 3.9)
53!
54! 211 2008-11-11 04:46:24Z raasch
55! Former file user_interface.f90 split into one file per subroutine
56!
57! Description:
58! ------------
59!> Calculation of user-defined statistics, i.e. horizontally averaged profiles
60!> and time series.
61!> This routine is called for every statistic region sr defined by the user,
62!> but at least for the region "total domain" (sr=0).
63!> See section 3.5.4 on how to define, calculate, and output user defined
64!> quantities.
65!------------------------------------------------------------------------------!
66 SUBROUTINE user_statistics( mode, sr, tn )
67 
68
69    USE arrays_3d
70   
71    USE indices
72   
73    USE kinds
74   
75    USE netcdf_interface,                                                      &
76        ONLY:  dots_max
77
78    USE pegrid
79   
80    USE statistics
81   
82    USE user
83
84    IMPLICIT NONE
85
86    CHARACTER (LEN=*) ::  mode   !<
87
88    INTEGER(iwp) ::  i    !<
89    INTEGER(iwp) ::  j    !<
90    INTEGER(iwp) ::  k    !<
91    INTEGER(iwp) ::  sr   !<
92    INTEGER(iwp) ::  tn   !<
93
94    REAL(wp),                                                                  &
95       DIMENSION(dots_num_palm+1:dots_max) ::                                  &
96          ts_value_l   !<
97
98
99    IF ( mode == 'profiles' )  THEN
100
101!
102!--    Sample on how to calculate horizontally averaged profiles of user-
103!--    defined quantities. Each quantity is identified by the index
104!--    "pr_palm+#" where "#" is an integer starting from 1. These
105!--    user-profile-numbers must also be assigned to the respective strings
106!--    given by data_output_pr_user in routine user_check_data_output_pr.
107!       !$OMP DO
108!       DO  i = nxl, nxr
109!          DO  j = nys, nyn
110!             DO  k = nzb_s_inner(j,i)+1, nzt
111!!
112!!--             Sample on how to calculate the profile of the resolved-scale
113!!--             horizontal momentum flux u*v*
114!                sums_l(k,pr_palm+1,tn) = sums_l(k,pr_palm+1,tn) +               &
115!                      ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,sr) ) *     &
116!                      ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) )       &
117!                                                 * rmask(j,i,sr)
118!!
119!!--             Further profiles can be defined and calculated by increasing
120!!--             the second index of array sums_l (replace ... appropriately)
121!                sums_l(k,pr_palm+2,tn) = sums_l(k,pr_palm+2,tn) + ...           &
122!                                         * rmask(j,i,sr)
123!             ENDDO
124!          ENDDO
125!       ENDDO
126
127    ELSEIF ( mode == 'time_series' )  THEN
128
129!
130!--    Sample on how to add values for the user-defined time series quantities.
131!--    These have to be defined before in routine user_init. This sample
132!--    creates two time series for the absolut values of the horizontal
133!--    velocities u and v.
134!       ts_value_l = 0.0_wp
135!       ts_value_l(dots_num_palm+1) = ABS( u_max )
136!       ts_value_l(dots_num_palm+2) = ABS( v_max )
137!
138!--     Collect / send values to PE0, because only PE0 outputs the time series.
139!--     CAUTION: Collection is done by taking the sum over all processors.
140!--              You may have to normalize this sum, depending on the quantity
141!--              that you like to calculate. For serial runs, nothing has to be
142!--              done.
143!--     HINT: If the time series value that you are calculating has the same
144!--           value on all PEs, you can omit the MPI_ALLREDUCE call and
145!--           assign ts_value(dots_num_palm+1:,sr) = ts_value_l directly.
146!#if defined( __parallel )
147!       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
148!       CALL MPI_ALLREDUCE( ts_value_l(dots_num_palm+1),                         &
149!                           ts_value(dots_num_palm+1,sr),                        &
150!                           dots_max-dots_num_palm, MPI_REAL, MPI_SUM, comm2d,   &
151!                           ierr )
152!#else
153!       ts_value(dots_num_palm+1:,sr) = ts_value_l
154!#endif
155
156    ENDIF
157
158 END SUBROUTINE user_statistics
159
Note: See TracBrowser for help on using the repository browser.