[1] | 1 | MODULE coriolis_mod |
---|
| 2 | |
---|
[1036] | 3 | !--------------------------------------------------------------------------------! |
---|
| 4 | ! This file is part of PALM. |
---|
| 5 | ! |
---|
| 6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 8 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 9 | ! |
---|
| 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
[1310] | 17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[254] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
| 22 | ! |
---|
[1258] | 23 | ! |
---|
[1] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
[3] | 26 | ! $Id: coriolis.f90 1310 2014-03-14 08:01:56Z heinze $ |
---|
[77] | 27 | ! |
---|
[1258] | 28 | ! 1257 2013-11-08 15:18:40Z raasch |
---|
| 29 | ! openacc loop and loop vector clauses removed |
---|
| 30 | ! |
---|
[1132] | 31 | ! 1128 2013-04-12 06:19:32Z raasch |
---|
| 32 | ! loop index bounds in accelerator version replaced by i_left, i_right, j_south, |
---|
| 33 | ! j_north |
---|
| 34 | ! |
---|
[1037] | 35 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 36 | ! code put under GPL (PALM 3.9) |
---|
| 37 | ! |
---|
[1017] | 38 | ! 1015 2012-09-27 09:23:24Z raasch |
---|
| 39 | ! accelerator version (*_acc) added |
---|
| 40 | ! |
---|
[392] | 41 | ! 254 2009-03-05 15:33:42Z heinze |
---|
| 42 | ! Output of messages replaced by message handling routine. |
---|
| 43 | ! |
---|
[110] | 44 | ! 106 2007-08-16 14:30:26Z raasch |
---|
| 45 | ! loops for u and v are starting from index nxlu, nysv, respectively (needed |
---|
| 46 | ! for non-cyclic boundary conditions) |
---|
| 47 | ! |
---|
[77] | 48 | ! 75 2007-03-22 09:54:05Z raasch |
---|
| 49 | ! uxrp, vynp eliminated |
---|
| 50 | ! |
---|
[3] | 51 | ! RCS Log replace by Id keyword, revision history cleaned up |
---|
| 52 | ! |
---|
[1] | 53 | ! Revision 1.12 2006/02/23 10:08:57 raasch |
---|
| 54 | ! nzb_2d replaced by nzb_u/v/w_inner |
---|
| 55 | ! |
---|
| 56 | ! Revision 1.1 1997/08/29 08:57:38 raasch |
---|
| 57 | ! Initial revision |
---|
| 58 | ! |
---|
| 59 | ! |
---|
| 60 | ! Description: |
---|
| 61 | ! ------------ |
---|
| 62 | ! Computation of all Coriolis terms in the equations of motion. |
---|
| 63 | !------------------------------------------------------------------------------! |
---|
| 64 | |
---|
| 65 | PRIVATE |
---|
[1015] | 66 | PUBLIC coriolis, coriolis_acc |
---|
[1] | 67 | |
---|
| 68 | INTERFACE coriolis |
---|
| 69 | MODULE PROCEDURE coriolis |
---|
| 70 | MODULE PROCEDURE coriolis_ij |
---|
| 71 | END INTERFACE coriolis |
---|
| 72 | |
---|
[1015] | 73 | INTERFACE coriolis_acc |
---|
| 74 | MODULE PROCEDURE coriolis_acc |
---|
| 75 | END INTERFACE coriolis_acc |
---|
| 76 | |
---|
[1] | 77 | CONTAINS |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | !------------------------------------------------------------------------------! |
---|
| 81 | ! Call for all grid points |
---|
| 82 | !------------------------------------------------------------------------------! |
---|
| 83 | SUBROUTINE coriolis( component ) |
---|
| 84 | |
---|
| 85 | USE arrays_3d |
---|
| 86 | USE control_parameters |
---|
| 87 | USE indices |
---|
| 88 | USE pegrid |
---|
| 89 | |
---|
| 90 | IMPLICIT NONE |
---|
| 91 | |
---|
| 92 | INTEGER :: component, i, j, k |
---|
| 93 | |
---|
| 94 | |
---|
| 95 | ! |
---|
| 96 | !-- Compute Coriolis terms for the three velocity components |
---|
| 97 | SELECT CASE ( component ) |
---|
| 98 | |
---|
| 99 | ! |
---|
| 100 | !-- u-component |
---|
| 101 | CASE ( 1 ) |
---|
[106] | 102 | DO i = nxlu, nxr |
---|
[1] | 103 | DO j = nys, nyn |
---|
| 104 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
| 105 | tend(k,j,i) = tend(k,j,i) + f * ( 0.25 * & |
---|
| 106 | ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) + & |
---|
| 107 | v(k,j+1,i) ) - vg(k) ) & |
---|
| 108 | - fs * ( 0.25 * & |
---|
| 109 | ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + & |
---|
| 110 | w(k,j,i) ) & |
---|
| 111 | ) |
---|
| 112 | ENDDO |
---|
| 113 | ENDDO |
---|
| 114 | ENDDO |
---|
| 115 | |
---|
| 116 | ! |
---|
| 117 | !-- v-component |
---|
| 118 | CASE ( 2 ) |
---|
| 119 | DO i = nxl, nxr |
---|
[106] | 120 | DO j = nysv, nyn |
---|
[1] | 121 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
| 122 | tend(k,j,i) = tend(k,j,i) - f * ( 0.25 * & |
---|
| 123 | ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + & |
---|
| 124 | u(k,j,i+1) ) - ug(k) ) |
---|
| 125 | ENDDO |
---|
| 126 | ENDDO |
---|
| 127 | ENDDO |
---|
| 128 | |
---|
| 129 | ! |
---|
| 130 | !-- w-component |
---|
| 131 | CASE ( 3 ) |
---|
| 132 | DO i = nxl, nxr |
---|
| 133 | DO j = nys, nyn |
---|
| 134 | DO k = nzb_w_inner(j,i)+1, nzt |
---|
| 135 | tend(k,j,i) = tend(k,j,i) + fs * 0.25 * & |
---|
| 136 | ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + & |
---|
| 137 | u(k+1,j,i+1) ) |
---|
| 138 | ENDDO |
---|
| 139 | ENDDO |
---|
| 140 | ENDDO |
---|
| 141 | |
---|
| 142 | CASE DEFAULT |
---|
| 143 | |
---|
[254] | 144 | WRITE( message_string, * ) ' wrong component: ', component |
---|
| 145 | CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 ) |
---|
[1] | 146 | |
---|
| 147 | END SELECT |
---|
| 148 | |
---|
| 149 | END SUBROUTINE coriolis |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | !------------------------------------------------------------------------------! |
---|
[1015] | 153 | ! Call for all grid points - accelerator version |
---|
| 154 | !------------------------------------------------------------------------------! |
---|
| 155 | SUBROUTINE coriolis_acc( component ) |
---|
| 156 | |
---|
| 157 | USE arrays_3d |
---|
| 158 | USE control_parameters |
---|
| 159 | USE indices |
---|
| 160 | USE pegrid |
---|
| 161 | |
---|
| 162 | IMPLICIT NONE |
---|
| 163 | |
---|
| 164 | INTEGER :: component, i, j, k |
---|
| 165 | |
---|
| 166 | |
---|
| 167 | ! |
---|
| 168 | !-- Compute Coriolis terms for the three velocity components |
---|
| 169 | SELECT CASE ( component ) |
---|
| 170 | |
---|
| 171 | ! |
---|
| 172 | !-- u-component |
---|
| 173 | CASE ( 1 ) |
---|
| 174 | !$acc kernels present( nzb_u_inner, tend, v, vg, w ) |
---|
[1128] | 175 | DO i = i_left, i_right |
---|
| 176 | DO j = j_south, j_north |
---|
[1015] | 177 | DO k = 1, nzt |
---|
| 178 | IF ( k > nzb_u_inner(j,i) ) THEN |
---|
| 179 | tend(k,j,i) = tend(k,j,i) + f * ( 0.25 * & |
---|
| 180 | ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) + & |
---|
| 181 | v(k,j+1,i) ) - vg(k) ) & |
---|
| 182 | - fs * ( 0.25 * & |
---|
| 183 | ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) & |
---|
| 184 | + w(k,j,i) ) & |
---|
| 185 | ) |
---|
| 186 | ENDIF |
---|
| 187 | ENDDO |
---|
| 188 | ENDDO |
---|
| 189 | ENDDO |
---|
| 190 | !$acc end kernels |
---|
| 191 | |
---|
| 192 | ! |
---|
| 193 | !-- v-component |
---|
| 194 | CASE ( 2 ) |
---|
| 195 | !$acc kernels present( nzb_v_inner, tend, u, ug ) |
---|
[1128] | 196 | DO i = i_left, i_right |
---|
| 197 | DO j = j_south, j_north |
---|
[1015] | 198 | DO k = 1, nzt |
---|
| 199 | IF ( k > nzb_v_inner(j,i) ) THEN |
---|
| 200 | tend(k,j,i) = tend(k,j,i) - f * ( 0.25 * & |
---|
| 201 | ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + & |
---|
| 202 | u(k,j,i+1) ) - ug(k) ) |
---|
| 203 | ENDIF |
---|
| 204 | ENDDO |
---|
| 205 | ENDDO |
---|
| 206 | ENDDO |
---|
| 207 | !$acc end kernels |
---|
| 208 | |
---|
| 209 | ! |
---|
| 210 | !-- w-component |
---|
| 211 | CASE ( 3 ) |
---|
| 212 | !$acc kernels present( nzb_w_inner, tend, u ) |
---|
[1128] | 213 | DO i = i_left, i_right |
---|
| 214 | DO j = j_south, j_north |
---|
[1015] | 215 | DO k = 1, nzt |
---|
| 216 | IF ( k > nzb_w_inner(j,i) ) THEN |
---|
| 217 | tend(k,j,i) = tend(k,j,i) + fs * 0.25 * & |
---|
| 218 | ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + & |
---|
| 219 | u(k+1,j,i+1) ) |
---|
| 220 | ENDIF |
---|
| 221 | ENDDO |
---|
| 222 | ENDDO |
---|
| 223 | ENDDO |
---|
| 224 | !$acc end kernels |
---|
| 225 | |
---|
| 226 | CASE DEFAULT |
---|
| 227 | |
---|
| 228 | WRITE( message_string, * ) ' wrong component: ', component |
---|
| 229 | CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 ) |
---|
| 230 | |
---|
| 231 | END SELECT |
---|
| 232 | |
---|
| 233 | END SUBROUTINE coriolis_acc |
---|
| 234 | |
---|
| 235 | |
---|
| 236 | !------------------------------------------------------------------------------! |
---|
[1] | 237 | ! Call for grid point i,j |
---|
| 238 | !------------------------------------------------------------------------------! |
---|
| 239 | SUBROUTINE coriolis_ij( i, j, component ) |
---|
| 240 | |
---|
| 241 | USE arrays_3d |
---|
| 242 | USE control_parameters |
---|
| 243 | USE indices |
---|
| 244 | USE pegrid |
---|
| 245 | |
---|
| 246 | IMPLICIT NONE |
---|
| 247 | |
---|
| 248 | INTEGER :: component, i, j, k |
---|
| 249 | |
---|
| 250 | ! |
---|
| 251 | !-- Compute Coriolis terms for the three velocity components |
---|
| 252 | SELECT CASE ( component ) |
---|
| 253 | |
---|
| 254 | ! |
---|
| 255 | !-- u-component |
---|
| 256 | CASE ( 1 ) |
---|
| 257 | DO k = nzb_u_inner(j,i)+1, nzt |
---|
| 258 | tend(k,j,i) = tend(k,j,i) + f * ( 0.25 * & |
---|
| 259 | ( v(k,j,i-1) + v(k,j,i) + v(k,j+1,i-1) + & |
---|
| 260 | v(k,j+1,i) ) - vg(k) ) & |
---|
| 261 | - fs * ( 0.25 * & |
---|
| 262 | ( w(k-1,j,i-1) + w(k-1,j,i) + w(k,j,i-1) + & |
---|
| 263 | w(k,j,i) ) & |
---|
| 264 | ) |
---|
| 265 | ENDDO |
---|
| 266 | |
---|
| 267 | ! |
---|
| 268 | !-- v-component |
---|
| 269 | CASE ( 2 ) |
---|
| 270 | DO k = nzb_v_inner(j,i)+1, nzt |
---|
| 271 | tend(k,j,i) = tend(k,j,i) - f * ( 0.25 * & |
---|
| 272 | ( u(k,j-1,i) + u(k,j,i) + u(k,j-1,i+1) + & |
---|
| 273 | u(k,j,i+1) ) - ug(k) ) |
---|
| 274 | ENDDO |
---|
| 275 | |
---|
| 276 | ! |
---|
| 277 | !-- w-component |
---|
| 278 | CASE ( 3 ) |
---|
| 279 | DO k = nzb_w_inner(j,i)+1, nzt |
---|
| 280 | tend(k,j,i) = tend(k,j,i) + fs * 0.25 * & |
---|
| 281 | ( u(k,j,i) + u(k+1,j,i) + u(k,j,i+1) + & |
---|
| 282 | u(k+1,j,i+1) ) |
---|
| 283 | ENDDO |
---|
| 284 | |
---|
| 285 | CASE DEFAULT |
---|
| 286 | |
---|
[254] | 287 | WRITE( message_string, * ) ' wrong component: ', component |
---|
| 288 | CALL message( 'coriolis', 'PA0173', 1, 2, 0, 6, 0 ) |
---|
[1] | 289 | |
---|
| 290 | END SELECT |
---|
| 291 | |
---|
| 292 | END SUBROUTINE coriolis_ij |
---|
| 293 | |
---|
| 294 | END MODULE coriolis_mod |
---|