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