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

Last change on this file since 1850 was 1850, checked in by maronga, 6 years ago

added _mod string to several filenames to meet the naming convection for modules

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