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