source: palm/trunk/SOURCE/user_actions_mod.f90 @ 1852

Last change on this file since 1852 was 1851, checked in by maronga, 9 years ago

last commit documented

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