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

Last change on this file since 1320 was 1320, checked in by raasch, 7 years ago

ONLY-attribute added to USE-statements,
kind-parameters added to all INTEGER and REAL declaration statements,
kinds are defined in new module kinds,
old module precision_kind is removed,
revision history before 2012 removed,
comment fields (!:) to be used for variable explanations added to all variable declaration statements

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