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

Last change on this file since 1682 was 1682, checked in by knoop, 9 years ago

Code annotations made doxygen readable

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