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

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

last commit documented

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