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