- Timestamp:
- Jul 26, 2023, 10:59:36 PM (16 months ago)
- Location:
- LMDZ6/trunk/libf/phylmd
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/phylmd/atke_exchange_coeff_mod.F90
r4632 r4644 6 6 7 7 subroutine atke_compute_km_kh(ngrid,nlay,dtime, & 8 wind_u,wind_v,temp,play,pinterf, &8 wind_u,wind_v,temp,play,pinterf,cdrag_uv, & 9 9 tke,Km_out,Kh_out) 10 10 … … 26 26 27 27 28 USE atke_turbulence_ini_mod, ONLY : iflag_atke, kappa, l0, ric, cinf, rpi, rcpd 29 USE atke_turbulence_ini_mod, ONLY : cepsilon, pr_slope, pr_asym, pr_neut, rg, rd30 USE atke_turbulence_ini_mod, ONLY : viscom, viscoh, clmix, iflag_atke_lmix, lmin 28 USE atke_turbulence_ini_mod, ONLY : iflag_atke, kappa, l0, ric, cinf, rpi, rcpd, ok_vdiff_tke 29 USE atke_turbulence_ini_mod, ONLY : cepsilon, pr_slope, pr_asym, pr_neut, ctkes,rg, rd 30 USE atke_turbulence_ini_mod, ONLY : viscom, viscoh, clmix, iflag_atke_lmix, lmin, smmin 31 31 32 32 implicit none … … 45 45 REAL, DIMENSION(ngrid,nlay), INTENT(IN) :: play ! pressure (Pa) 46 46 REAL, DIMENSION(ngrid,nlay+1), INTENT(IN) :: pinterf ! pressure at interfaces(Pa) 47 47 REAL, DIMENSION(ngrid), INTENT(IN) :: cdrag_uv ! surface drag coefficient for momentum 48 48 49 49 REAL, DIMENSION(ngrid,nlay+1), INTENT(INOUT) :: tke ! turbulent kinetic energy at interface between layers … … 78 78 REAL :: lstrat ! mixing length depending on local stratification 79 79 REAL :: taustrat ! caracteristic timescale for turbulence in very stable conditions 80 REAL :: netloss ! net loss term of tke 81 REAL :: netsource ! net source term of tke 82 REAL :: ustar ! friction velocity estimation 80 83 81 84 ! Initializations: … … 142 145 Prandtl(igrid,ilay) = -2./rpi * (pr_asym - pr_neut) * atan(Ri(igrid,ilay)/Ri1) + pr_neut 143 146 ELSE ! stable cases 144 Sm(igrid,ilay) = max( 0.,cn*(1.-Ri(igrid,ilay)/Ric))147 Sm(igrid,ilay) = max(smmin,cn*(1.-Ri(igrid,ilay)/Ric)) 145 148 Prandtl(igrid,ilay) = pr_neut + Ri(igrid,ilay) * pr_slope 146 149 IF (Ri(igrid,ilay) .GE. Prandtl(igrid,ilay)) THEN … … 182 185 l_exchange(igrid,ilay) = kappa*l0*z_interf(igrid,ilay) / (kappa*z_interf(igrid,ilay) + l0) 183 186 IF (N2(igrid,ilay) .GT. 0.) THEN 184 lstrat=clmix*sqrt(tke(igrid,ilay))/(2.*max(sqrt(shear2(igrid,ilay)),1 E-10)*(1.+sqrt(Ri(igrid,ilay))/2.))187 lstrat=clmix*sqrt(tke(igrid,ilay))/(2.*max(sqrt(shear2(igrid,ilay)),1.E-10)*(1.+sqrt(Ri(igrid,ilay))/2.)) 185 188 IF (lstrat .LT. l_exchange(igrid,ilay)) THEN 186 189 l_exchange(igrid,ilay)=max(lstrat,lmin) … … 204 207 205 208 206 ! Computing the TKE :207 !=================== 209 ! Computing the TKE k>=2: 210 !======================== 208 211 IF (iflag_atke == 0) THEN 212 213 ! stationary solution (dtke/dt=0) 209 214 210 215 DO ilay=2,nlay … … 221 226 DO ilay=2,nlay 222 227 DO igrid=1,ngrid 223 qq= sqrt(2.*tke(igrid,ilay))228 qq=max(sqrt(2.*tke(igrid,ilay)),1.e-10) 224 229 delta=1.+4.*dtime/cepsilon/l_exchange(igrid,ilay)/(2.**(3/2)) * & 225 230 (qq+dtime*l_exchange(igrid,ilay)/sqrt(2.)*Sm(igrid,ilay)*shear2(igrid,ilay) & … … 230 235 ENDDO 231 236 237 232 238 ELSE IF (iflag_atke == 2) THEN 233 239 234 ! full implicit scheme resolved with a second order polynomial equation 235 ! + exact resolution for very stable cases (iflag_atke_lmix=1) 240 ! semi implicit scheme when l does not depend on tke 241 ! positive-guaranteed if pr slope in stable condition >1 242 243 DO ilay=2,nlay 244 DO igrid=1,ngrid 245 qq=max(sqrt(2.*tke(igrid,ilay)),1.e-10) 246 qq=(qq+l_exchange(igrid,ilay)*Sm(igrid,ilay)*dtime/sqrt(2.) & 247 *shear2(igrid,ilay)*(1.-Ri(igrid,ilay)/Prandtl(igrid,ilay))) & 248 /(1.+qq*dtime/(cepsilon*l_exchange(igrid,ilay)*2.*sqrt(2.))) 249 tke(igrid,ilay)=0.5*(qq**2) 250 ENDDO 251 ENDDO 252 253 254 ELSE IF (iflag_atke == 3) THEN 255 ! numerical resolution adapted from that in MAR (Deleersnijder 1992) 256 ! positively defined by construction 257 236 258 DO ilay=2,nlay 237 259 DO igrid=1,ngrid 238 qq=sqrt(2.*tke(igrid,ilay)) 239 IF (switch_num(igrid,ilay)) THEN 240 taustrat=clmix/2./sqrt(N2(igrid,ilay))*Sm(igrid,ilay)*shear2(igrid,ilay)*(1.-Ri(igrid,ilay)/Prandtl(igrid,ilay)) & 241 - sqrt(N2(igrid,ilay))/2./cepsilon/clmix 242 taustrat=-1./taustrat 243 qq=qq*exp(-dtime/taustrat) 260 qq=max(sqrt(2.*tke(igrid,ilay)),1.e-10) 261 IF (Ri(igrid,ilay) .LT. 0.) THEN 262 netloss=qq/(2.*sqrt(2.)*cepsilon*l_exchange(igrid,ilay)) 263 netsource=l_exchange(igrid,ilay)*Sm(igrid,ilay)/sqrt(2.)*shear2(igrid,ilay)*(1.-Ri(igrid,ilay)/Prandtl(igrid,ilay)) 244 264 ELSE 245 delta=1.+4.*dtime/cepsilon/l_exchange(igrid,ilay)/(2.**(3/2)) * & 246 (qq+dtime*l_exchange(igrid,ilay)/sqrt(2.)*Sm(igrid,ilay) * shear2(igrid,ilay) & 247 *(1.-Ri(igrid,ilay)/Prandtl(igrid,ilay))) 248 qq=(-1. + sqrt(delta))/dtime*cepsilon*sqrt(2.)*l_exchange(igrid,ilay) 265 netloss=qq/(2.*sqrt(2.)*cepsilon*l_exchange(igrid,ilay))+ & 266 l_exchange(igrid,ilay)*Sm(igrid,ilay)/sqrt(2.)*N2(igrid,ilay)/Prandtl(igrid,ilay) 267 netsource=l_exchange(igrid,ilay)*Sm(igrid,ilay)/sqrt(2.)*shear2(igrid,ilay) 249 268 ENDIF 269 qq=((qq**2)/dtime+qq*netsource)/(qq/dtime+netloss) 250 270 tke(igrid,ilay)=0.5*(qq**2) 251 271 ENDDO 252 272 ENDDO 253 273 254 255 256 ELSE IF (iflag_atke == 3) THEN 257 258 ! semi implicit scheme when l does not depend on tke 259 ! positive-guaranteed if pr slope in stable condition >1 274 ELSE IF (iflag_atke == 4) THEN 275 ! semi implicit scheme from Arpege (V. Masson methodology with 276 ! Taylor expansion of the dissipation term) 260 277 DO ilay=2,nlay 261 278 DO igrid=1,ngrid 262 qq=sqrt(2.*tke(igrid,ilay)) 263 qq=(qq+dtime*l_exchange(igrid,ilay)/sqrt(2.)*Sm(igrid,ilay)*(1.-Ri(igrid,ilay)/Prandtl(igrid,ilay))) & 264 /(1.+dtime*qq/cepsilon/l_exchange(igrid,ilay)/(2.**(3/2))) 265 tke(igrid,ilay)=0.5*(qq**2) 279 qq=max(sqrt(2.*tke(igrid,ilay)),1.e-10) 280 qq=(l_exchange(igrid,ilay)*Sm(igrid,ilay)/sqrt(2.)*shear2(igrid,ilay)*(1.-Ri(igrid,ilay)/Prandtl(igrid,ilay)) & 281 +qq*(1.+dtime*qq/(cepsilon*l_exchange(igrid,ilay)*2.*sqrt(2.)))) & 282 /(1.+2.*qq*dtime/(cepsilon*l_exchange(igrid,ilay)*2.*sqrt(2.))) 283 qq=max(0.,qq) 284 tke(igrid,ilay)=0.5*(qq**2) 266 285 ENDDO 267 286 ENDDO … … 273 292 274 293 END IF 294 295 ! We impose a 0 tke at nlay+1 296 !============================== 297 298 DO igrid=1,ngrid 299 tke(igrid,nlay+1)=0. 300 END DO 301 302 303 ! Calculation of surface TKE (k=1) 304 !================================= 305 ! surface TKE calculation inspired from what is done in Arpege (see E. Bazile note) 306 DO igrid=1,ngrid 307 ustar=sqrt(cdrag_uv(igrid)*(wind_u(igrid,1)**2+wind_v(igrid,1)**2)) 308 tke(igrid,1)=ctkes*(ustar**2) 309 END DO 310 311 312 ! vertical diffusion of TKE 313 !========================== 314 IF (ok_vdiff_tke) THEN 315 CALL atke_vdiff_tke(ngrid,nlay,dtime,z_lay,z_interf,temp,play,l_exchange,Sm,tke) 316 ENDIF 275 317 276 318 … … 292 334 end subroutine atke_compute_km_kh 293 335 336 !=============================================================================================== 337 subroutine atke_vdiff_tke(ngrid,nlay,dtime,z_lay,z_interf,temp,play,l_exchange,Sm,tke) 338 339 ! routine that computes the vertical diffusion of TKE by the turbulence 340 ! using an implicit resolution (See note by Dufresne and Ghattas 341 ! E Vignon, July 2023 342 343 USE atke_turbulence_ini_mod, ONLY : rd, cke, viscom 344 345 346 INTEGER, INTENT(IN) :: ngrid ! number of horizontal index (flat grid) 347 INTEGER, INTENT(IN) :: nlay ! number of vertical index 348 349 REAL, INTENT(IN) :: dtime ! physics time step (s) 350 REAL, DIMENSION(ngrid,nlay), INTENT(IN) :: z_lay ! altitude of mid-layers (m) 351 REAL, DIMENSION(ngrid,nlay+1), INTENT(IN) :: z_interf ! altitude of bottom interfaces (m) 352 REAL, DIMENSION(ngrid,nlay), INTENT(IN) :: temp ! temperature (K) 353 REAL, DIMENSION(ngrid,nlay), INTENT(IN) :: play ! pressure (Pa) 354 REAL, DIMENSION(ngrid,nlay+1), INTENT(IN) :: l_exchange ! mixing length at interfaces between layers 355 REAL, DIMENSION(ngrid,nlay+1), INTENT(IN) :: Sm ! stability function for eddy diffusivity for momentum at interface between layers 356 357 REAL, DIMENSION(ngrid,nlay+1), INTENT(INOUT) :: tke ! turbulent kinetic energy at interface between layers 358 359 360 361 INTEGER :: igrid,ilay 362 REAL, DIMENSION(ngrid,nlay+1) :: Ke ! eddy diffusivity for TKE 363 REAL, DIMENSION(ngrid,nlay+1) :: dtke 364 REAL, DIMENSION(ngrid,nlay+1) :: ak, bk, ck, CCK, DDK 365 REAL :: gammak,Kem,KKb,KKt 366 367 368 ! Few initialisations 369 CCK(:,:)=0. 370 DDK(:,:)=0. 371 dtke(:,:)=0. 372 373 374 ! Eddy diffusivity for TKE 375 376 DO ilay=2,nlay 377 DO igrid=1,ngrid 378 Ke(igrid,ilay)=(viscom+l_exchange(igrid,ilay)*Sm(igrid,ilay)*sqrt(tke(igrid,ilay)))*cke 379 ENDDO 380 ENDDO 381 ! at the top of the atmosphere set to 0 382 Ke(:,nlay+1)=0. 383 ! at the surface, set it equal to that at the first model level 384 Ke(:,1)=Ke(:,2) 385 386 387 ! calculate intermediary variables 388 389 DO ilay=2,nlay 390 DO igrid=1,ngrid 391 Kem=0.5*(Ke(igrid,ilay+1)+Ke(igrid,ilay)) 392 KKt=Kem*play(igrid,ilay)/rd/temp(igrid,ilay)/(z_interf(igrid,ilay+1)-z_interf(igrid,ilay)) 393 Kem=0.5*(Ke(igrid,ilay)+Ke(igrid,ilay-1)) 394 KKb=Kem*play(igrid,ilay-1)/rd/temp(igrid,ilay-1)/(z_interf(igrid,ilay)-z_interf(igrid,ilay-1)) 395 gammak=1./(z_lay(igrid,ilay)-z_lay(igrid,ilay-1)) 396 ak(igrid,ilay)=-gammak*dtime*KKb 397 ck(igrid,ilay)=-gammak*dtime*KKt 398 bk(igrid,ilay)=1.+gammak*dtime*(KKt+KKb) 399 ENDDO 400 ENDDO 401 402 ! calculate CCK and DDK coefficients 403 ! downhill phase 404 405 DO igrid=1,ngrid 406 CCK(igrid,nlay)=tke(igrid,nlay)/bk(igrid,nlay) 407 DDK(igrid,nlay)=-ak(igrid,nlay)/bk(igrid,nlay) 408 ENDDO 409 410 411 DO ilay=nlay-1,2,-1 412 DO igrid=1,ngrid 413 CCK(igrid,ilay)=(tke(igrid,ilay)/bk(igrid,ilay)-ck(igrid,ilay)/bk(igrid,ilay)*CCK(igrid,ilay+1)) & 414 / (1.+ck(igrid,ilay)/bk(igrid,ilay)*DDK(igrid,ilay+1)) 415 DDK(igrid,ilay)=-ak(igrid,ilay)/bk(igrid,ilay)/(1+ck(igrid,ilay)/bk(igrid,ilay)*DDK(igrid,ilay+1)) 416 ENDDO 417 ENDDO 418 419 ! calculate TKE 420 ! uphill phase 421 422 DO ilay=2,nlay+1 423 DO igrid=1,ngrid 424 dtke(igrid,ilay)=CCK(igrid,ilay)+DDK(igrid,ilay)*tke(igrid,ilay-1)-tke(igrid,ilay) 425 ENDDO 426 ENDDO 427 428 ! update TKE 429 tke(:,:)=tke(:,:)+dtke(:,:) 430 431 432 end subroutine atke_vdiff_tke 433 434 294 435 295 436 end module atke_exchange_coeff_mod -
LMDZ6/trunk/libf/phylmd/atke_turbulence_ini_mod.F90
r4632 r4644 9 9 real :: kappa = 0.4 ! Von Karman constant 10 10 !$OMP THREADPRIVATE(kappa) 11 real :: l0, ric, ri0, cinf, cepsilon, pr_slope, pr_asym, pr_neut, clmix 12 !$OMP THREADPRIVATE(l0, ric, cinf, cepsilon, pr_slope, pr_asym, pr_neut, clmix)11 real :: l0, ric, ri0, cinf, cepsilon, pr_slope, pr_asym, pr_neut, clmix, smmin, ctkes,cke 12 !$OMP THREADPRIVATE(l0,ric,cinf,cepsilon,pr_slope,pr_asym,pr_neut,clmix,smmin,ctkes,cke) 13 13 integer :: lunout,prt_level 14 14 !$OMP THREADPRIVATE(lunout,prt_level) … … 19 19 !$OMP THREADPRIVATE(viscom,viscoh) 20 20 21 real :: lmin=0.0 01 ! minimum mixing length21 real :: lmin=0.01 ! minimum mixing length 22 22 !$OMP THREADPRIVATE(lmin) 23 23 24 logical :: ok_vdiff_tke 25 !$OMP THREADPRIVATE(ok_vdiff_tke) 24 26 25 27 CONTAINS … … 56 58 endif 57 59 60 ! activate vertical diffusion of TKE or not 61 ok_vdiff_tke=.false. 62 CALL getin_p('atke_ok_vdiff_tke',ok_vdiff_tke) 58 63 59 64 ! flag that controls the numerical treatment of diffusion coeffiient calculation … … 99 104 clmix=0.5 100 105 CALL getin_p('atke_clmix',clmix) 101 106 107 ! minimum anisotropy coefficient (defined here as minsqrt(Ez/Ek)) at large Ri. 108 ! From Zilitinkevich et al. 2013, it equals sqrt(0.03)~0.17 109 110 smmin=0.17 111 CALL getin_p('atke_smmin',smmin) 112 113 ! coefficient for surface TKE (default value from Arpege, see E. Bazile note) 114 ctkes=3.75 115 CALL getin_p('atke_ctkes',ctkes) 116 117 ! ratio between the eddy diffusivity coeff for tke wrt that for momentum 118 ! default value from Lenderink et al. 2004 119 cke=2. 120 CALL getin_p('atke_cke',cke) 121 102 122 RETURN 103 123 -
LMDZ6/trunk/libf/phylmd/call_atke_mod.F90
r4631 r4644 55 55 56 56 call atke_compute_km_kh(ngrid,nlay,dtime,& 57 wind_u,wind_v,temp,play,pinterf, &57 wind_u,wind_v,temp,play,pinterf, cdrag_uv,& 58 58 tke,Km_out,Kh_out) 59 59 60 61 60 62 if (iflag_num_atke .EQ. 1) then 61 63 !! In this case, we make an explicit prediction of the wind shear to calculate the tke in a 64 !! forward backward way 62 65 !! pay attention that the treatment of the TKE 63 66 !! has to be adapted when solving the TKE with a prognostic equation … … 71 74 72 75 call atke_compute_km_kh(ngrid,nlay,dtime,& 73 wind_u_predict,wind_v_predict,temp,play,pinterf, &76 wind_u_predict,wind_v_predict,temp,play,pinterf,cdrag_uv, & 74 77 tke,Km_out,Kh_out) 75 78 76 79 end if 80 81 82 83 84 77 85 78 86 end subroutine call_atke
Note: See TracChangeset
for help on using the changeset viewer.