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

Last change on this file since 1036 was 1036, checked in by raasch, 11 years ago

code has been put under the GNU General Public License (v3)

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