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