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