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