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