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