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