[1873] | 1 | !> @file coriolis.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 | ! |
---|
[254] | 19 | ! Current revisions: |
---|
[1] | 20 | ! ----------------- |
---|
[1354] | 21 | ! |
---|
[1683] | 22 | ! |
---|
[1321] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: coriolis.f90 1874 2016-04-18 14:51:10Z hellstea $ |
---|
| 26 | ! |
---|
[1874] | 27 | ! 1873 2016-04-18 14:50:06Z maronga |
---|
| 28 | ! Module renamed (removed _mod) |
---|
| 29 | ! |
---|
| 30 | ! |
---|
[1851] | 31 | ! 1850 2016-04-08 13:29:27Z maronga |
---|
| 32 | ! Module renamed |
---|
| 33 | ! |
---|
| 34 | ! |
---|
[1683] | 35 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 36 | ! Code annotations made doxygen readable |
---|
| 37 | ! |
---|
[1354] | 38 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 39 | ! REAL constants provided with KIND-attribute |
---|
| 40 | ! |
---|
[1321] | 41 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 42 | ! ONLY-attribute added to USE-statements, |
---|
| 43 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 44 | ! kinds are defined in new module kinds, |
---|
| 45 | ! revision history before 2012 removed, |
---|
| 46 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 47 | ! all variable declaration statements |
---|
[1321] | 48 | ! |
---|
[1258] | 49 | ! 1257 2013-11-08 15:18:40Z raasch |
---|
| 50 | ! openacc loop and loop vector clauses removed |
---|
| 51 | ! |
---|
[1132] | 52 | ! 1128 2013-04-12 06:19:32Z raasch |
---|
| 53 | ! loop index bounds in accelerator version replaced by i_left, i_right, j_south, |
---|
| 54 | ! j_north |
---|
| 55 | ! |
---|
[1037] | 56 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 57 | ! code put under GPL (PALM 3.9) |
---|
| 58 | ! |
---|
[1017] | 59 | ! 1015 2012-09-27 09:23:24Z raasch |
---|
| 60 | ! accelerator version (*_acc) added |
---|
| 61 | ! |
---|
[1] | 62 | ! Revision 1.1 1997/08/29 08:57:38 raasch |
---|
| 63 | ! Initial revision |
---|
| 64 | ! |
---|
| 65 | ! |
---|
| 66 | ! Description: |
---|
| 67 | ! ------------ |
---|
[1682] | 68 | !> Computation of all Coriolis terms in the equations of motion. |
---|
[1] | 69 | !------------------------------------------------------------------------------! |
---|
[1682] | 70 | MODULE coriolis_mod |
---|
| 71 | |
---|
[1] | 72 | |
---|
| 73 | PRIVATE |
---|
[1015] | 74 | PUBLIC coriolis, coriolis_acc |
---|
[1] | 75 | |
---|
| 76 | INTERFACE coriolis |
---|
| 77 | MODULE PROCEDURE coriolis |
---|
| 78 | MODULE PROCEDURE coriolis_ij |
---|
| 79 | END INTERFACE coriolis |
---|
| 80 | |
---|
[1015] | 81 | INTERFACE coriolis_acc |
---|
| 82 | MODULE PROCEDURE coriolis_acc |
---|
| 83 | END INTERFACE coriolis_acc |
---|
| 84 | |
---|
[1] | 85 | CONTAINS |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | !------------------------------------------------------------------------------! |
---|
[1682] | 89 | ! Description: |
---|
| 90 | ! ------------ |
---|
| 91 | !> Call for all grid points |
---|
[1] | 92 | !------------------------------------------------------------------------------! |
---|
| 93 | SUBROUTINE coriolis( component ) |
---|
| 94 | |
---|
[1320] | 95 | USE arrays_3d, & |
---|
| 96 | ONLY: tend, u, ug, v, vg, w |
---|
| 97 | |
---|
| 98 | USE control_parameters, & |
---|
| 99 | ONLY: f, fs, message_string |
---|
| 100 | |
---|
| 101 | USE indices, & |
---|
| 102 | ONLY: nxl, nxlu, nxr, nyn, nys, nysv, nzb_u_inner, nzb_v_inner, & |
---|
| 103 | nzb_w_inner, nzt |
---|
| 104 | |
---|
| 105 | USE kinds |
---|
[1] | 106 | |
---|
| 107 | IMPLICIT NONE |
---|
| 108 | |
---|
[1682] | 109 | INTEGER(iwp) :: component !< |
---|
| 110 | INTEGER(iwp) :: i !< |
---|
| 111 | INTEGER(iwp) :: j !< |
---|
| 112 | INTEGER(iwp) :: k !< |
---|
[1] | 113 | |
---|
| 114 | |
---|
| 115 | ! |
---|
| 116 | !-- Compute Coriolis terms for the three velocity components |
---|
| 117 | SELECT CASE ( component ) |
---|
| 118 | |
---|
| 119 | ! |
---|
| 120 | !-- u-component |
---|
| 121 | CASE ( 1 ) |
---|
[106] | 122 | DO i = nxlu, nxr |
---|
[1] | 123 | DO j = nys, nyn |
---|
| 124 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
[1353] | 125 | tend(k,j,i) = tend(k,j,i) + f * ( 0.25_wp * & |
---|
[1320] | 126 | ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) + & |
---|
| 127 | v(k,j+1,i) ) - vg(k) ) & |
---|
[1353] | 128 | - fs * ( 0.25_wp * & |
---|
[1320] | 129 | ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + & |
---|
[1] | 130 | w(k,j,i) ) & |
---|
| 131 | ) |
---|
| 132 | ENDDO |
---|
| 133 | ENDDO |
---|
| 134 | ENDDO |
---|
| 135 | |
---|
| 136 | ! |
---|
| 137 | !-- v-component |
---|
| 138 | CASE ( 2 ) |
---|
| 139 | DO i = nxl, nxr |
---|
[106] | 140 | DO j = nysv, nyn |
---|
[1] | 141 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
[1353] | 142 | tend(k,j,i) = tend(k,j,i) - f * ( 0.25_wp * & |
---|
[1320] | 143 | ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + & |
---|
[1] | 144 | u(k,j,i+1) ) - ug(k) ) |
---|
| 145 | ENDDO |
---|
| 146 | ENDDO |
---|
| 147 | ENDDO |
---|
| 148 | |
---|
| 149 | ! |
---|
| 150 | !-- w-component |
---|
| 151 | CASE ( 3 ) |
---|
| 152 | DO i = nxl, nxr |
---|
| 153 | DO j = nys, nyn |
---|
| 154 | DO k = nzb_w_inner(j,i)+1, nzt |
---|
[1353] | 155 | tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp * & |
---|
[1320] | 156 | ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + & |
---|
[1] | 157 | u(k+1,j,i+1) ) |
---|
| 158 | ENDDO |
---|
| 159 | ENDDO |
---|
| 160 | ENDDO |
---|
| 161 | |
---|
| 162 | CASE DEFAULT |
---|
| 163 | |
---|
[254] | 164 | WRITE( message_string, * ) ' wrong component: ', component |
---|
| 165 | CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 ) |
---|
[1] | 166 | |
---|
| 167 | END SELECT |
---|
| 168 | |
---|
| 169 | END SUBROUTINE coriolis |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | !------------------------------------------------------------------------------! |
---|
[1682] | 173 | ! Description: |
---|
| 174 | ! ------------ |
---|
| 175 | !> Call for all grid points - accelerator version |
---|
[1015] | 176 | !------------------------------------------------------------------------------! |
---|
| 177 | SUBROUTINE coriolis_acc( component ) |
---|
| 178 | |
---|
[1320] | 179 | USE arrays_3d, & |
---|
| 180 | ONLY: tend, u, ug, v, vg, w |
---|
| 181 | |
---|
| 182 | USE control_parameters, & |
---|
| 183 | ONLY: f, fs, message_string |
---|
| 184 | |
---|
| 185 | USE indices, & |
---|
| 186 | ONLY: i_left, i_right, j_north, j_south, nzb_u_inner, & |
---|
| 187 | nzb_v_inner, nzb_w_inner, nzt |
---|
| 188 | |
---|
| 189 | USE kinds |
---|
[1015] | 190 | |
---|
| 191 | IMPLICIT NONE |
---|
| 192 | |
---|
[1682] | 193 | INTEGER(iwp) :: component !< |
---|
| 194 | INTEGER(iwp) :: i !< |
---|
| 195 | INTEGER(iwp) :: j !< |
---|
| 196 | INTEGER(iwp) :: k !< |
---|
[1015] | 197 | |
---|
| 198 | |
---|
| 199 | ! |
---|
| 200 | !-- Compute Coriolis terms for the three velocity components |
---|
| 201 | SELECT CASE ( component ) |
---|
| 202 | |
---|
| 203 | ! |
---|
| 204 | !-- u-component |
---|
| 205 | CASE ( 1 ) |
---|
| 206 | !$acc kernels present( nzb_u_inner, tend, v, vg, w ) |
---|
[1128] | 207 | DO i = i_left, i_right |
---|
| 208 | DO j = j_south, j_north |
---|
[1015] | 209 | DO k = 1, nzt |
---|
| 210 | IF ( k > nzb_u_inner(j,i) ) THEN |
---|
[1353] | 211 | tend(k,j,i) = tend(k,j,i) + f * ( 0.25_wp * & |
---|
[1015] | 212 | ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) + & |
---|
| 213 | v(k,j+1,i) ) - vg(k) ) & |
---|
[1353] | 214 | - fs * ( 0.25_wp * & |
---|
[1015] | 215 | ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) & |
---|
| 216 | + w(k,j,i) ) & |
---|
| 217 | ) |
---|
| 218 | ENDIF |
---|
| 219 | ENDDO |
---|
| 220 | ENDDO |
---|
| 221 | ENDDO |
---|
| 222 | !$acc end kernels |
---|
| 223 | |
---|
| 224 | ! |
---|
| 225 | !-- v-component |
---|
| 226 | CASE ( 2 ) |
---|
| 227 | !$acc kernels present( nzb_v_inner, tend, u, ug ) |
---|
[1128] | 228 | DO i = i_left, i_right |
---|
| 229 | DO j = j_south, j_north |
---|
[1015] | 230 | DO k = 1, nzt |
---|
| 231 | IF ( k > nzb_v_inner(j,i) ) THEN |
---|
[1353] | 232 | tend(k,j,i) = tend(k,j,i) - f * ( 0.25_wp * & |
---|
[1015] | 233 | ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + & |
---|
| 234 | u(k,j,i+1) ) - ug(k) ) |
---|
| 235 | ENDIF |
---|
| 236 | ENDDO |
---|
| 237 | ENDDO |
---|
| 238 | ENDDO |
---|
| 239 | !$acc end kernels |
---|
| 240 | |
---|
| 241 | ! |
---|
| 242 | !-- w-component |
---|
| 243 | CASE ( 3 ) |
---|
| 244 | !$acc kernels present( nzb_w_inner, tend, u ) |
---|
[1128] | 245 | DO i = i_left, i_right |
---|
| 246 | DO j = j_south, j_north |
---|
[1015] | 247 | DO k = 1, nzt |
---|
| 248 | IF ( k > nzb_w_inner(j,i) ) THEN |
---|
[1353] | 249 | tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp * & |
---|
[1320] | 250 | ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + & |
---|
[1015] | 251 | u(k+1,j,i+1) ) |
---|
| 252 | ENDIF |
---|
| 253 | ENDDO |
---|
| 254 | ENDDO |
---|
| 255 | ENDDO |
---|
| 256 | !$acc end kernels |
---|
| 257 | |
---|
| 258 | CASE DEFAULT |
---|
| 259 | |
---|
| 260 | WRITE( message_string, * ) ' wrong component: ', component |
---|
| 261 | CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 ) |
---|
| 262 | |
---|
| 263 | END SELECT |
---|
| 264 | |
---|
| 265 | END SUBROUTINE coriolis_acc |
---|
| 266 | |
---|
| 267 | |
---|
| 268 | !------------------------------------------------------------------------------! |
---|
[1682] | 269 | ! Description: |
---|
| 270 | ! ------------ |
---|
| 271 | !> Call for grid point i,j |
---|
[1] | 272 | !------------------------------------------------------------------------------! |
---|
| 273 | SUBROUTINE coriolis_ij( i, j, component ) |
---|
| 274 | |
---|
[1320] | 275 | USE arrays_3d, & |
---|
| 276 | ONLY: tend, u, ug, v, vg, w |
---|
| 277 | |
---|
| 278 | USE control_parameters, & |
---|
| 279 | ONLY: f, fs, message_string |
---|
| 280 | |
---|
| 281 | USE indices, & |
---|
| 282 | ONLY: nzb_u_inner, nzb_v_inner, nzb_w_inner, nzt |
---|
| 283 | |
---|
| 284 | USE kinds |
---|
| 285 | |
---|
[1] | 286 | IMPLICIT NONE |
---|
| 287 | |
---|
[1682] | 288 | INTEGER(iwp) :: component !< |
---|
| 289 | INTEGER(iwp) :: i !< |
---|
| 290 | INTEGER(iwp) :: j !< |
---|
| 291 | INTEGER(iwp) :: k !< |
---|
[1] | 292 | |
---|
| 293 | ! |
---|
| 294 | !-- Compute Coriolis terms for the three velocity components |
---|
| 295 | SELECT CASE ( component ) |
---|
| 296 | |
---|
| 297 | ! |
---|
| 298 | !-- u-component |
---|
| 299 | CASE ( 1 ) |
---|
| 300 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
[1353] | 301 | tend(k,j,i) = tend(k,j,i) + f * ( 0.25_wp * & |
---|
[1320] | 302 | ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) + & |
---|
| 303 | v(k,j+1,i) ) - vg(k) ) & |
---|
[1353] | 304 | - fs * ( 0.25_wp * & |
---|
[1320] | 305 | ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + & |
---|
| 306 | w(k,j,i) ) ) |
---|
[1] | 307 | ENDDO |
---|
| 308 | |
---|
| 309 | ! |
---|
| 310 | !-- v-component |
---|
| 311 | CASE ( 2 ) |
---|
| 312 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
[1353] | 313 | tend(k,j,i) = tend(k,j,i) - f * ( 0.25_wp * & |
---|
[1320] | 314 | ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + & |
---|
[1] | 315 | u(k,j,i+1) ) - ug(k) ) |
---|
| 316 | ENDDO |
---|
| 317 | |
---|
| 318 | ! |
---|
| 319 | !-- w-component |
---|
| 320 | CASE ( 3 ) |
---|
| 321 | DO k = nzb_w_inner(j,i)+1, nzt |
---|
[1353] | 322 | tend(k,j,i) = tend(k,j,i) + fs * 0.25_wp * & |
---|
[1320] | 323 | ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + & |
---|
[1] | 324 | u(k+1,j,i+1) ) |
---|
| 325 | ENDDO |
---|
| 326 | |
---|
| 327 | CASE DEFAULT |
---|
| 328 | |
---|
[254] | 329 | WRITE( message_string, * ) ' wrong component: ', component |
---|
| 330 | CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 ) |
---|
[1] | 331 | |
---|
| 332 | END SELECT |
---|
| 333 | |
---|
| 334 | END SUBROUTINE coriolis_ij |
---|
| 335 | |
---|
| 336 | END MODULE coriolis_mod |
---|