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