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