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