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