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

Last change on this file since 2106 was 2101, checked in by suehring, 8 years ago

last commit documented

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