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