1 | !> @file user_actions.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 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 | ! |
---|
16 | ! Copyright 1997-2016 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ------------------ |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: user_actions.f90 1961 2016-07-12 16:37:58Z gronemeier $ |
---|
26 | ! |
---|
27 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
28 | ! New CASE statement for scalar tendency |
---|
29 | ! |
---|
30 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
31 | ! Module renamed (removed _mod) |
---|
32 | ! |
---|
33 | ! |
---|
34 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
35 | ! Module renamed |
---|
36 | ! |
---|
37 | ! |
---|
38 | ! 1822 2016-04-07 07:49:42Z hoffmann |
---|
39 | ! qr/nr-tendency removed. |
---|
40 | ! |
---|
41 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
42 | ! Code annotations made doxygen readable |
---|
43 | ! |
---|
44 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
45 | ! REAL constants provided with KIND-attribute |
---|
46 | ! |
---|
47 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
48 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
49 | ! kinds are defined in new module kinds, |
---|
50 | ! revision history before 2012 removed, |
---|
51 | ! comment fields (!:) to be used for variable explanations added to |
---|
52 | ! all variable declaration statements |
---|
53 | ! |
---|
54 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
55 | ! module interfaces removed |
---|
56 | ! |
---|
57 | ! 1053 2012-11-13 17:11:03Z hoffmann |
---|
58 | ! +qr-tendency, nr-tendency |
---|
59 | ! |
---|
60 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
61 | ! code put under GPL (PALM 3.9) |
---|
62 | ! |
---|
63 | ! 211 2008-11-11 04:46:24Z raasch |
---|
64 | ! Former file user_interface.f90 split into one file per subroutine |
---|
65 | ! |
---|
66 | ! Description: |
---|
67 | ! ------------ |
---|
68 | !> Execution of user-defined actions before or after single timesteps |
---|
69 | !------------------------------------------------------------------------------! |
---|
70 | MODULE user_actions_mod |
---|
71 | |
---|
72 | |
---|
73 | PRIVATE |
---|
74 | PUBLIC user_actions |
---|
75 | |
---|
76 | INTERFACE user_actions |
---|
77 | MODULE PROCEDURE user_actions |
---|
78 | MODULE PROCEDURE user_actions_ij |
---|
79 | END INTERFACE user_actions |
---|
80 | |
---|
81 | CONTAINS |
---|
82 | |
---|
83 | |
---|
84 | !------------------------------------------------------------------------------! |
---|
85 | ! Description: |
---|
86 | ! ------------ |
---|
87 | !> Call for all grid points |
---|
88 | !------------------------------------------------------------------------------! |
---|
89 | SUBROUTINE user_actions( location ) |
---|
90 | |
---|
91 | USE control_parameters |
---|
92 | |
---|
93 | USE cpulog |
---|
94 | |
---|
95 | USE indices |
---|
96 | |
---|
97 | USE kinds |
---|
98 | |
---|
99 | USE pegrid |
---|
100 | |
---|
101 | USE user |
---|
102 | |
---|
103 | USE arrays_3d |
---|
104 | |
---|
105 | IMPLICIT NONE |
---|
106 | |
---|
107 | CHARACTER (LEN=*) :: location !< |
---|
108 | |
---|
109 | INTEGER(iwp) :: i !< |
---|
110 | INTEGER(iwp) :: j !< |
---|
111 | INTEGER(iwp) :: k !< |
---|
112 | |
---|
113 | CALL cpu_log( log_point(24), 'user_actions', 'start' ) |
---|
114 | |
---|
115 | ! |
---|
116 | !-- Here the user-defined actions follow |
---|
117 | !-- No calls for single grid points are allowed at locations before and |
---|
118 | !-- after the timestep, since these calls are not within an i,j-loop |
---|
119 | SELECT CASE ( location ) |
---|
120 | |
---|
121 | CASE ( 'before_timestep' ) |
---|
122 | ! |
---|
123 | !-- Enter actions to be done before every timestep here |
---|
124 | |
---|
125 | |
---|
126 | CASE ( 'after_integration' ) |
---|
127 | ! |
---|
128 | !-- Enter actions to be done after every time integration (before |
---|
129 | !-- data output) |
---|
130 | !-- Sample for user-defined output: |
---|
131 | ! DO i = nxlg, nxrg |
---|
132 | ! DO j = nysg, nyng |
---|
133 | ! DO k = nzb, nzt |
---|
134 | ! u2(k,j,i) = u(k,j,i)**2 |
---|
135 | ! ENDDO |
---|
136 | ! ENDDO |
---|
137 | ! ENDDO |
---|
138 | ! DO i = nxlg, nxr |
---|
139 | ! DO j = nysg, nyn |
---|
140 | ! DO k = nzb, nzt+1 |
---|
141 | ! ustvst(k,j,i) = & |
---|
142 | ! ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,0) ) * & |
---|
143 | ! ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,0) ) |
---|
144 | ! ENDDO |
---|
145 | ! ENDDO |
---|
146 | ! ENDDO |
---|
147 | |
---|
148 | |
---|
149 | CASE ( 'after_timestep' ) |
---|
150 | ! |
---|
151 | !-- Enter actions to be done after every timestep here |
---|
152 | |
---|
153 | |
---|
154 | CASE ( 'u-tendency' ) |
---|
155 | ! |
---|
156 | !-- Enter actions to be done in the u-tendency term here |
---|
157 | |
---|
158 | |
---|
159 | CASE ( 'v-tendency' ) |
---|
160 | |
---|
161 | |
---|
162 | CASE ( 'w-tendency' ) |
---|
163 | |
---|
164 | |
---|
165 | CASE ( 'pt-tendency' ) |
---|
166 | |
---|
167 | |
---|
168 | CASE ( 'sa-tendency' ) |
---|
169 | |
---|
170 | |
---|
171 | CASE ( 'e-tendency' ) |
---|
172 | |
---|
173 | |
---|
174 | CASE ( 'q-tendency' ) |
---|
175 | |
---|
176 | |
---|
177 | CASE ( 's-tendency' ) |
---|
178 | |
---|
179 | |
---|
180 | CASE DEFAULT |
---|
181 | message_string = 'unknown location "' // location // '"' |
---|
182 | CALL message( 'user_actions', 'UI0001', 1, 2, 0, 6, 0 ) |
---|
183 | |
---|
184 | END SELECT |
---|
185 | |
---|
186 | CALL cpu_log( log_point(24), 'user_actions', 'stop' ) |
---|
187 | |
---|
188 | END SUBROUTINE user_actions |
---|
189 | |
---|
190 | |
---|
191 | !------------------------------------------------------------------------------! |
---|
192 | ! Description: |
---|
193 | ! ------------ |
---|
194 | !> Call for grid point i,j |
---|
195 | !------------------------------------------------------------------------------! |
---|
196 | SUBROUTINE user_actions_ij( i, j, location ) |
---|
197 | |
---|
198 | USE control_parameters |
---|
199 | USE kinds |
---|
200 | USE pegrid |
---|
201 | USE user |
---|
202 | |
---|
203 | IMPLICIT NONE |
---|
204 | |
---|
205 | CHARACTER (LEN=*) :: location |
---|
206 | |
---|
207 | INTEGER(iwp) :: i |
---|
208 | INTEGER(iwp) :: idum |
---|
209 | INTEGER(iwp) :: j |
---|
210 | |
---|
211 | ! |
---|
212 | !-- Here the user-defined actions follow |
---|
213 | SELECT CASE ( location ) |
---|
214 | |
---|
215 | CASE ( 'u-tendency' ) |
---|
216 | ! |
---|
217 | !-- Enter actions to be done in the u-tendency term here |
---|
218 | |
---|
219 | |
---|
220 | CASE ( 'v-tendency' ) |
---|
221 | |
---|
222 | |
---|
223 | CASE ( 'w-tendency' ) |
---|
224 | |
---|
225 | |
---|
226 | CASE ( 'pt-tendency' ) |
---|
227 | |
---|
228 | |
---|
229 | CASE ( 'sa-tendency' ) |
---|
230 | |
---|
231 | |
---|
232 | CASE ( 'e-tendency' ) |
---|
233 | |
---|
234 | |
---|
235 | CASE ( 'q-tendency' ) |
---|
236 | |
---|
237 | |
---|
238 | CASE ( 's-tendency' ) |
---|
239 | |
---|
240 | |
---|
241 | CASE ( 'before_timestep', 'after_integration', 'after_timestep' ) |
---|
242 | message_string = 'location "' // location // '" is not ' // & |
---|
243 | 'allowed to be called with parameters "i" and "j"' |
---|
244 | CALL message( 'user_actions', 'UI0002', 1, 2, 0, 6, 0 ) |
---|
245 | |
---|
246 | |
---|
247 | CASE DEFAULT |
---|
248 | message_string = 'unknown location "' // location // '"' |
---|
249 | CALL message( 'user_actions', 'UI0001', 1, 2, 0, 6, 0 ) |
---|
250 | |
---|
251 | |
---|
252 | END SELECT |
---|
253 | |
---|
254 | END SUBROUTINE user_actions_ij |
---|
255 | |
---|
256 | END MODULE user_actions_mod |
---|