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