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

Last change on this file since 1433 was 1354, checked in by heinze, 11 years ago

last commit documented

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