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

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