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

Last change on this file since 1319 was 1319, checked in by raasch, 10 years ago

last commit documented

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