[362] | 1 | MODULE caldyn_kernels_base_mod |
---|
| 2 | USE icosa |
---|
| 3 | USE transfert_mod |
---|
[373] | 4 | USE disvert_mod |
---|
| 5 | USE omp_para |
---|
| 6 | USE trace |
---|
[362] | 7 | IMPLICIT NONE |
---|
| 8 | PRIVATE |
---|
| 9 | |
---|
| 10 | INTEGER, PARAMETER,PUBLIC :: energy=1, enstrophy=2 |
---|
| 11 | TYPE(t_field),POINTER,PUBLIC :: f_out_u(:), f_qu(:), f_qv(:) |
---|
| 12 | REAL(rstd),SAVE,POINTER :: out_u(:,:), p(:,:), qu(:,:) |
---|
| 13 | !$OMP THREADPRIVATE(out_u, p, qu) |
---|
| 14 | |
---|
| 15 | ! temporary shared variables for caldyn |
---|
[558] | 16 | TYPE(t_field),POINTER,PUBLIC :: f_pk(:),f_wwuu(:),f_planetvel(:), & |
---|
| 17 | f_Fel(:), f_gradPhi2(:), f_wil(:), f_Wetadot(:) |
---|
[362] | 18 | |
---|
| 19 | INTEGER, PUBLIC :: caldyn_conserv |
---|
| 20 | !$OMP THREADPRIVATE(caldyn_conserv) |
---|
| 21 | |
---|
[366] | 22 | TYPE(t_message),PUBLIC :: req_ps, req_mass, req_theta_rhodz, req_u, req_qu, req_geopot, req_w |
---|
[362] | 23 | |
---|
[373] | 24 | PUBLIC :: compute_geopot, compute_caldyn_vert, compute_caldyn_vert_nh |
---|
[362] | 25 | |
---|
| 26 | CONTAINS |
---|
| 27 | |
---|
| 28 | !**************************** Geopotential ***************************** |
---|
| 29 | |
---|
[404] | 30 | SUBROUTINE compute_geopot(rhodz,theta, ps,pk,geopot) |
---|
| 31 | REAL(rstd),INTENT(IN) :: rhodz(iim*jjm,llm) |
---|
| 32 | REAL(rstd),INTENT(IN) :: theta(iim*jjm,llm,nqdyn) ! active scalars : theta/entropy, moisture, ... |
---|
[362] | 33 | REAL(rstd),INTENT(INOUT) :: ps(iim*jjm) |
---|
| 34 | REAL(rstd),INTENT(OUT) :: pk(iim*jjm,llm) ! Exner function (compressible) /Lagrange multiplier (Boussinesq) |
---|
| 35 | REAL(rstd),INTENT(INOUT) :: geopot(iim*jjm,llm+1) ! geopotential |
---|
| 36 | |
---|
| 37 | INTEGER :: i,j,ij,l |
---|
[537] | 38 | REAL(rstd) :: Rd, p_ik, exner_ik, temp_ik, qv, chi, Rmix, gv |
---|
[362] | 39 | INTEGER :: ij_omp_begin_ext, ij_omp_end_ext |
---|
| 40 | |
---|
| 41 | CALL trace_start("compute_geopot") |
---|
| 42 | |
---|
[479] | 43 | !$OMP BARRIER |
---|
| 44 | |
---|
[362] | 45 | CALL distrib_level(ij_end_ext-ij_begin_ext+1,ij_omp_begin_ext,ij_omp_end_ext) |
---|
| 46 | ij_omp_begin_ext=ij_omp_begin_ext+ij_begin_ext-1 |
---|
| 47 | ij_omp_end_ext=ij_omp_end_ext+ij_begin_ext-1 |
---|
| 48 | |
---|
[401] | 49 | Rd = kappa*cpp |
---|
| 50 | |
---|
[562] | 51 | IF(dysl_geopot) THEN |
---|
[537] | 52 | #include "../kernels/compute_geopot.k90" |
---|
[562] | 53 | ELSE |
---|
[404] | 54 | ! Pressure is computed first top-down (temporarily stored in pk) |
---|
| 55 | ! Then Exner pressure and geopotential are computed bottom-up |
---|
| 56 | ! Works also when caldyn_eta=eta_mass |
---|
| 57 | |
---|
| 58 | IF(boussinesq) THEN ! compute geopotential and pk=Lagrange multiplier |
---|
| 59 | ! specific volume 1 = dphi/g/rhodz |
---|
| 60 | ! IF (is_omp_level_master) THEN ! no openMP on vertical due to dependency |
---|
[362] | 61 | DO l = 1,llm |
---|
| 62 | !DIR$ SIMD |
---|
[404] | 63 | DO ij=ij_omp_begin_ext,ij_omp_end_ext |
---|
| 64 | geopot(ij,l+1) = geopot(ij,l) + g*rhodz(ij,l) |
---|
[362] | 65 | ENDDO |
---|
| 66 | ENDDO |
---|
[404] | 67 | ! use hydrostatic balance with theta*rhodz to find pk (Lagrange multiplier=pressure) |
---|
| 68 | ! uppermost layer |
---|
| 69 | !DIR$ SIMD |
---|
| 70 | DO ij=ij_begin_ext,ij_end_ext |
---|
| 71 | pk(ij,llm) = ptop + (.5*g)*theta(ij,llm,1)*rhodz(ij,llm) |
---|
| 72 | END DO |
---|
| 73 | ! other layers |
---|
| 74 | DO l = llm-1, 1, -1 |
---|
| 75 | ! !$OMP DO SCHEDULE(STATIC) |
---|
[362] | 76 | !DIR$ SIMD |
---|
| 77 | DO ij=ij_begin_ext,ij_end_ext |
---|
[404] | 78 | pk(ij,l) = pk(ij,l+1) + (.5*g)*(theta(ij,l,1)*rhodz(ij,l)+theta(ij,l+1,1)*rhodz(ij,l+1)) |
---|
[362] | 79 | END DO |
---|
[404] | 80 | END DO |
---|
| 81 | ! now pk contains the Lagrange multiplier (pressure) |
---|
| 82 | ELSE ! non-Boussinesq, compute pressure, Exner pressure or temperature, then geopotential |
---|
| 83 | ! uppermost layer |
---|
| 84 | |
---|
[405] | 85 | SELECT CASE(caldyn_thermo) |
---|
| 86 | CASE(thermo_theta, thermo_entropy) |
---|
| 87 | !DIR$ SIMD |
---|
| 88 | DO ij=ij_omp_begin_ext,ij_omp_end_ext |
---|
| 89 | pk(ij,llm) = ptop + (.5*g)*rhodz(ij,llm) |
---|
| 90 | END DO |
---|
| 91 | ! other layers |
---|
| 92 | DO l = llm-1, 1, -1 |
---|
| 93 | !DIR$ SIMD |
---|
| 94 | DO ij=ij_omp_begin_ext,ij_omp_end_ext |
---|
| 95 | pk(ij,l) = pk(ij,l+1) + (.5*g)*(rhodz(ij,l)+rhodz(ij,l+1)) |
---|
| 96 | END DO |
---|
| 97 | END DO |
---|
| 98 | ! surface pressure (for diagnostics) |
---|
| 99 | IF(caldyn_eta==eta_lag) THEN |
---|
| 100 | DO ij=ij_omp_begin_ext,ij_omp_end_ext |
---|
| 101 | ps(ij) = pk(ij,1) + (.5*g)*rhodz(ij,1) |
---|
| 102 | END DO |
---|
| 103 | END IF |
---|
| 104 | CASE(thermo_moist) ! theta(ij,l,2) = qv = mv/md |
---|
| 105 | !DIR$ SIMD |
---|
| 106 | DO ij=ij_omp_begin_ext,ij_omp_end_ext |
---|
| 107 | pk(ij,llm) = ptop + (.5*g)*rhodz(ij,llm)*(1.+theta(ij,l,2)) |
---|
| 108 | END DO |
---|
| 109 | ! other layers |
---|
| 110 | DO l = llm-1, 1, -1 |
---|
| 111 | !DIR$ SIMD |
---|
| 112 | DO ij=ij_omp_begin_ext,ij_omp_end_ext |
---|
| 113 | pk(ij,l) = pk(ij,l+1) + (.5*g)*( & |
---|
| 114 | rhodz(ij,l) *(1.+theta(ij,l,2)) + & |
---|
| 115 | rhodz(ij,l+1)*(1.+theta(ij,l+1,2)) ) |
---|
| 116 | END DO |
---|
| 117 | END DO |
---|
| 118 | ! surface pressure (for diagnostics) |
---|
| 119 | IF(caldyn_eta==eta_lag) THEN |
---|
| 120 | DO ij=ij_omp_begin_ext,ij_omp_end_ext |
---|
| 121 | ps(ij) = pk(ij,1) + (.5*g)*rhodz(ij,1)*(1.+theta(ij,l,2)) |
---|
| 122 | END DO |
---|
| 123 | END IF |
---|
| 124 | END SELECT |
---|
| 125 | |
---|
[404] | 126 | DO l = 1,llm |
---|
| 127 | SELECT CASE(caldyn_thermo) |
---|
| 128 | CASE(thermo_theta) |
---|
| 129 | !DIR$ SIMD |
---|
| 130 | DO ij=ij_omp_begin_ext,ij_omp_end_ext |
---|
| 131 | p_ik = pk(ij,l) |
---|
| 132 | exner_ik = cpp * (p_ik/preff) ** kappa |
---|
| 133 | pk(ij,l) = exner_ik |
---|
| 134 | ! specific volume v = kappa*theta*pi/p = dphi/g/rhodz |
---|
| 135 | geopot(ij,l+1) = geopot(ij,l) + (g*kappa)*rhodz(ij,l)*theta(ij,l,1)*exner_ik/p_ik |
---|
| 136 | ENDDO |
---|
| 137 | CASE(thermo_entropy) ! theta is in fact entropy = cpp*log(theta/Treff) = cpp*log(T/Treff) - Rd*log(p/preff) |
---|
| 138 | !DIR$ SIMD |
---|
| 139 | DO ij=ij_omp_begin_ext,ij_omp_end_ext |
---|
| 140 | p_ik = pk(ij,l) |
---|
| 141 | temp_ik = Treff*exp((theta(ij,l,1) + Rd*log(p_ik/preff))/cpp) |
---|
| 142 | pk(ij,l) = temp_ik |
---|
| 143 | ! specific volume v = Rd*T/p = dphi/g/rhodz |
---|
| 144 | geopot(ij,l+1) = geopot(ij,l) + (g*Rd)*rhodz(ij,l)*temp_ik/p_ik |
---|
| 145 | ENDDO |
---|
[405] | 146 | CASE(thermo_moist) ! theta is moist pseudo-entropy per dry air mass |
---|
| 147 | DO ij=ij_omp_begin_ext,ij_omp_end_ext |
---|
| 148 | p_ik = pk(ij,l) |
---|
| 149 | qv = theta(ij,l,2) ! water vaper mixing ratio = mv/md |
---|
| 150 | Rmix = Rd+qv*Rv |
---|
| 151 | chi = ( theta(ij,l,1) + Rmix*log(p_ik/preff) ) / (cpp + qv*cppv) ! log(T/Treff) |
---|
| 152 | temp_ik = Treff*exp(chi) |
---|
| 153 | pk(ij,l) = temp_ik |
---|
| 154 | ! specific volume v = R*T/p = dphi/g/rhodz |
---|
| 155 | ! R = (Rd + qv.Rv)/(1+qv) |
---|
| 156 | geopot(ij,l+1) = geopot(ij,l) + g*Rmix*rhodz(ij,l)*temp_ik/(p_ik*(1+qv)) |
---|
| 157 | ENDDO |
---|
[404] | 158 | CASE DEFAULT |
---|
| 159 | STOP |
---|
| 160 | END SELECT |
---|
| 161 | ENDDO |
---|
[362] | 162 | END IF |
---|
| 163 | |
---|
[562] | 164 | END IF ! dysl |
---|
[537] | 165 | |
---|
[362] | 166 | !ym flush geopot |
---|
| 167 | !$OMP BARRIER |
---|
| 168 | |
---|
| 169 | CALL trace_end("compute_geopot") |
---|
| 170 | |
---|
| 171 | END SUBROUTINE compute_geopot |
---|
| 172 | |
---|
| 173 | SUBROUTINE compute_caldyn_vert(u,theta,rhodz,convm, wflux,wwuu, dps,dtheta_rhodz,du) |
---|
| 174 | REAL(rstd),INTENT(IN) :: u(iim*3*jjm,llm) |
---|
[405] | 175 | REAL(rstd),INTENT(IN) :: theta(iim*jjm,llm,nqdyn) |
---|
[362] | 176 | REAL(rstd),INTENT(IN) :: rhodz(iim*jjm,llm) |
---|
| 177 | REAL(rstd),INTENT(INOUT) :: convm(iim*jjm,llm) ! mass flux convergence |
---|
| 178 | |
---|
| 179 | REAL(rstd),INTENT(INOUT) :: wflux(iim*jjm,llm+1) ! vertical mass flux (kg/m2/s) |
---|
| 180 | REAL(rstd),INTENT(INOUT) :: wwuu(iim*3*jjm,llm+1) |
---|
| 181 | REAL(rstd),INTENT(INOUT) :: du(iim*3*jjm,llm) |
---|
[405] | 182 | REAL(rstd),INTENT(INOUT) :: dtheta_rhodz(iim*jjm,llm,nqdyn) |
---|
[362] | 183 | REAL(rstd),INTENT(OUT) :: dps(iim*jjm) |
---|
| 184 | |
---|
| 185 | ! temporary variable |
---|
[405] | 186 | INTEGER :: i,j,ij,l,iq |
---|
[362] | 187 | REAL(rstd) :: p_ik, exner_ik |
---|
| 188 | INTEGER :: ij_omp_begin, ij_omp_end |
---|
| 189 | |
---|
| 190 | CALL trace_start("compute_caldyn_vert") |
---|
| 191 | |
---|
| 192 | CALL distrib_level(ij_end-ij_begin+1,ij_omp_begin,ij_omp_end) |
---|
| 193 | ij_omp_begin=ij_omp_begin+ij_begin-1 |
---|
| 194 | ij_omp_end=ij_omp_end+ij_begin-1 |
---|
| 195 | |
---|
| 196 | ! REAL(rstd) :: wwuu(iim*3*jjm,llm+1) ! tmp var, don't know why but gain 30% on the whole code in opemp |
---|
| 197 | ! need to be understood |
---|
| 198 | |
---|
| 199 | ! wwuu=wwuu_out |
---|
| 200 | CALL trace_start("compute_caldyn_vert") |
---|
| 201 | |
---|
| 202 | !$OMP BARRIER |
---|
| 203 | !!! cumulate mass flux convergence from top to bottom |
---|
| 204 | ! IF (is_omp_level_master) THEN |
---|
| 205 | DO l = llm-1, 1, -1 |
---|
| 206 | ! IF (caldyn_conserv==energy) CALL test_message(req_qu) |
---|
| 207 | |
---|
| 208 | !!$OMP DO SCHEDULE(STATIC) |
---|
| 209 | !DIR$ SIMD |
---|
| 210 | DO ij=ij_omp_begin,ij_omp_end |
---|
| 211 | convm(ij,l) = convm(ij,l) + convm(ij,l+1) |
---|
| 212 | ENDDO |
---|
| 213 | ENDDO |
---|
| 214 | ! ENDIF |
---|
| 215 | |
---|
| 216 | !$OMP BARRIER |
---|
| 217 | ! FLUSH on convm |
---|
| 218 | !!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 219 | |
---|
| 220 | ! compute dps |
---|
| 221 | IF (is_omp_first_level) THEN |
---|
| 222 | !DIR$ SIMD |
---|
| 223 | DO ij=ij_begin,ij_end |
---|
| 224 | ! dps/dt = -int(div flux)dz |
---|
[529] | 225 | dps(ij) = convm(ij,1) |
---|
[362] | 226 | ENDDO |
---|
| 227 | ENDIF |
---|
| 228 | |
---|
| 229 | !!! Compute vertical mass flux (l=1,llm+1 done by caldyn_BC) |
---|
| 230 | DO l=ll_beginp1,ll_end |
---|
| 231 | ! IF (caldyn_conserv==energy) CALL test_message(req_qu) |
---|
| 232 | !DIR$ SIMD |
---|
| 233 | DO ij=ij_begin,ij_end |
---|
| 234 | ! w = int(z,ztop,div(flux)dz) + B(eta)dps/dt |
---|
| 235 | ! => w>0 for upward transport |
---|
| 236 | wflux( ij, l ) = bp(l) * convm( ij, 1 ) - convm( ij, l ) |
---|
| 237 | ENDDO |
---|
| 238 | ENDDO |
---|
| 239 | |
---|
| 240 | !--> flush wflux |
---|
| 241 | !$OMP BARRIER |
---|
| 242 | |
---|
[405] | 243 | DO iq=1,nqdyn |
---|
| 244 | DO l=ll_begin,ll_endm1 |
---|
[362] | 245 | !DIR$ SIMD |
---|
[405] | 246 | DO ij=ij_begin,ij_end |
---|
| 247 | dtheta_rhodz(ij, l, iq) = dtheta_rhodz(ij, l, iq) - 0.5 * & |
---|
| 248 | ( wflux(ij,l+1) * (theta(ij,l,iq) + theta(ij,l+1,iq))) |
---|
| 249 | END DO |
---|
| 250 | END DO |
---|
| 251 | DO l=ll_beginp1,ll_end |
---|
| 252 | !DIR$ SIMD |
---|
| 253 | DO ij=ij_begin,ij_end |
---|
| 254 | dtheta_rhodz(ij, l, iq) = dtheta_rhodz(ij, l, iq) + 0.5 * & |
---|
| 255 | ( wflux(ij,l) * (theta(ij,l-1,iq) + theta(ij,l,iq) ) ) |
---|
| 256 | END DO |
---|
| 257 | END DO |
---|
| 258 | END DO |
---|
[362] | 259 | |
---|
| 260 | ! Compute vertical transport |
---|
| 261 | DO l=ll_beginp1,ll_end |
---|
| 262 | !DIR$ SIMD |
---|
| 263 | DO ij=ij_begin,ij_end |
---|
| 264 | wwuu(ij+u_right,l) = 0.5*( wflux(ij,l) + wflux(ij+t_right,l)) * (u(ij+u_right,l) - u(ij+u_right,l-1)) |
---|
| 265 | wwuu(ij+u_lup,l) = 0.5* ( wflux(ij,l) + wflux(ij+t_lup,l)) * (u(ij+u_lup,l) - u(ij+u_lup,l-1)) |
---|
| 266 | wwuu(ij+u_ldown,l) = 0.5*( wflux(ij,l) + wflux(ij+t_ldown,l)) * (u(ij+u_ldown,l) - u(ij+u_ldown,l-1)) |
---|
| 267 | ENDDO |
---|
| 268 | ENDDO |
---|
| 269 | |
---|
| 270 | !--> flush wwuu |
---|
| 271 | !$OMP BARRIER |
---|
| 272 | |
---|
| 273 | ! Add vertical transport to du |
---|
| 274 | DO l=ll_begin,ll_end |
---|
| 275 | !DIR$ SIMD |
---|
| 276 | DO ij=ij_begin,ij_end |
---|
| 277 | du(ij+u_right, l ) = du(ij+u_right,l) - (wwuu(ij+u_right,l+1)+ wwuu(ij+u_right,l)) / (rhodz(ij,l)+rhodz(ij+t_right,l)) |
---|
| 278 | du(ij+u_lup, l ) = du(ij+u_lup,l) - (wwuu(ij+u_lup,l+1) + wwuu(ij+u_lup,l)) / (rhodz(ij,l)+rhodz(ij+t_lup,l)) |
---|
| 279 | du(ij+u_ldown, l ) = du(ij+u_ldown,l) - (wwuu(ij+u_ldown,l+1)+ wwuu(ij+u_ldown,l)) / (rhodz(ij,l)+rhodz(ij+t_ldown,l)) |
---|
| 280 | ENDDO |
---|
| 281 | ENDDO |
---|
| 282 | |
---|
| 283 | ! DO l=ll_beginp1,ll_end |
---|
| 284 | !!DIR$ SIMD |
---|
| 285 | ! DO ij=ij_begin,ij_end |
---|
| 286 | ! wwuu_out(ij+u_right,l) = wwuu(ij+u_right,l) |
---|
| 287 | ! wwuu_out(ij+u_lup,l) = wwuu(ij+u_lup,l) |
---|
| 288 | ! wwuu_out(ij+u_ldown,l) = wwuu(ij+u_ldown,l) |
---|
| 289 | ! ENDDO |
---|
| 290 | ! ENDDO |
---|
| 291 | |
---|
| 292 | CALL trace_end("compute_caldyn_vert") |
---|
| 293 | |
---|
| 294 | END SUBROUTINE compute_caldyn_vert |
---|
| 295 | |
---|
[558] | 296 | SUBROUTINE compute_caldyn_vert_NH(mass,geopot,W,wflux, W_etadot, du,dPhi,dW) |
---|
[373] | 297 | REAL(rstd),INTENT(IN) :: mass(iim*jjm,llm) |
---|
| 298 | REAL(rstd),INTENT(IN) :: geopot(iim*jjm,llm+1) |
---|
| 299 | REAL(rstd),INTENT(IN) :: W(iim*jjm,llm+1) |
---|
| 300 | REAL(rstd),INTENT(IN) :: wflux(iim*jjm,llm+1) |
---|
| 301 | REAL(rstd),INTENT(INOUT) :: du(iim*3*jjm,llm) |
---|
| 302 | REAL(rstd),INTENT(INOUT) :: dPhi(iim*jjm,llm+1) |
---|
| 303 | REAL(rstd),INTENT(INOUT) :: dW(iim*jjm,llm+1) |
---|
[558] | 304 | REAL(rstd) :: W_etadot(iim*jjm,llm) ! vertical flux of vertical momentum |
---|
[373] | 305 | ! local arrays |
---|
[538] | 306 | REAL(rstd) :: eta_dot(iim*jjm, llm) ! eta_dot in full layers |
---|
| 307 | REAL(rstd) :: wcov(iim*jjm,llm) ! covariant vertical momentum in full layers |
---|
[373] | 308 | ! indices and temporary values |
---|
| 309 | INTEGER :: ij, l |
---|
| 310 | REAL(rstd) :: wflux_ij, w_ij |
---|
| 311 | |
---|
| 312 | CALL trace_start("compute_caldyn_vert_nh") |
---|
| 313 | |
---|
[573] | 314 | IF(dysl) THEN |
---|
[558] | 315 | !$OMP BARRIER |
---|
[538] | 316 | #include "../kernels/caldyn_vert_NH.k90" |
---|
[558] | 317 | !$OMP BARRIER |
---|
[573] | 318 | ELSE |
---|
[538] | 319 | #define ETA_DOT(ij) eta_dot(ij,1) |
---|
| 320 | #define WCOV(ij) wcov(ij,1) |
---|
| 321 | |
---|
[373] | 322 | DO l=ll_begin,ll_end |
---|
| 323 | ! compute the local arrays |
---|
| 324 | !DIR$ SIMD |
---|
| 325 | DO ij=ij_begin_ext,ij_end_ext |
---|
| 326 | wflux_ij = .5*(wflux(ij,l)+wflux(ij,l+1)) |
---|
| 327 | w_ij = .5*(W(ij,l)+W(ij,l+1))/mass(ij,l) |
---|
| 328 | W_etadot(ij,l) = wflux_ij*w_ij |
---|
[538] | 329 | ETA_DOT(ij) = wflux_ij / mass(ij,l) |
---|
| 330 | WCOV(ij) = w_ij*(geopot(ij,l+1)-geopot(ij,l)) |
---|
[373] | 331 | ENDDO |
---|
| 332 | ! add NH term to du |
---|
| 333 | !DIR$ SIMD |
---|
| 334 | DO ij=ij_begin,ij_end |
---|
| 335 | du(ij+u_right,l) = du(ij+u_right,l) & |
---|
[538] | 336 | - .5*(WCOV(ij+t_right)+WCOV(ij)) & |
---|
| 337 | *ne_right*(ETA_DOT(ij+t_right)-ETA_DOT(ij)) |
---|
[373] | 338 | du(ij+u_lup,l) = du(ij+u_lup,l) & |
---|
[538] | 339 | - .5*(WCOV(ij+t_lup)+WCOV(ij)) & |
---|
| 340 | *ne_lup*(ETA_DOT(ij+t_lup)-ETA_DOT(ij)) |
---|
[373] | 341 | du(ij+u_ldown,l) = du(ij+u_ldown,l) & |
---|
[538] | 342 | - .5*(WCOV(ij+t_ldown)+WCOV(ij)) & |
---|
| 343 | *ne_ldown*(ETA_DOT(ij+t_ldown)-ETA_DOT(ij)) |
---|
[373] | 344 | END DO |
---|
| 345 | ENDDO |
---|
| 346 | ! add NH terms to dW, dPhi |
---|
| 347 | ! FIXME : TODO top and bottom |
---|
| 348 | DO l=ll_beginp1,ll_end ! inner interfaces only |
---|
| 349 | !DIR$ SIMD |
---|
| 350 | DO ij=ij_begin,ij_end |
---|
| 351 | dPhi(ij,l) = dPhi(ij,l) - wflux(ij,l) & |
---|
| 352 | * (geopot(ij,l+1)-geopot(ij,l-1))/(mass(ij,l-1)+mass(ij,l)) |
---|
| 353 | END DO |
---|
| 354 | END DO |
---|
[377] | 355 | DO l=ll_begin,ll_end |
---|
| 356 | !DIR$ SIMD |
---|
| 357 | DO ij=ij_begin,ij_end |
---|
| 358 | dW(ij,l+1) = dW(ij,l+1) + W_etadot(ij,l) ! update inner+top interfaces |
---|
| 359 | dW(ij,l) = dW(ij,l) - W_etadot(ij,l) ! update bottom+inner interfaces |
---|
| 360 | END DO |
---|
| 361 | END DO |
---|
[538] | 362 | |
---|
| 363 | #undef ETA_DOT |
---|
| 364 | #undef WCOV |
---|
| 365 | |
---|
[573] | 366 | END IF ! dysl |
---|
[373] | 367 | CALL trace_end("compute_caldyn_vert_nh") |
---|
| 368 | |
---|
| 369 | END SUBROUTINE compute_caldyn_vert_NH |
---|
[362] | 370 | END MODULE caldyn_kernels_base_mod |
---|