source: palm/trunk/SOURCE/user_actions.f90 @ 1805

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

last commit documented

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