Changeset 2232 for trunk/LMDZ.GENERIC/libf/phystd/thermcell_main.F90
- Timestamp:
- Jan 30, 2020, 10:36:35 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/libf/phystd/thermcell_main.F90
r2229 r2232 6 6 pu,pv,pt,pq, & 7 7 pduadj,pdvadj,pdtadj,pdqadj, & 8 f0,fm0,entr0,detr0,zw2,fraca, & 9 zqta,zqla,ztv,ztva,zhla,zhl,zqsa, & 10 lmin,lmix,lmax) 8 fm_tot,entr_tot,detr_tot,zw2_tot,fraca) 11 9 12 10 … … 43 41 ! lmin can be greater than 1 44 42 ! Mix every tracer 43 ! Can stack verticaly multiple plumes (it makes thermcell_dv2 unusable for the moment) 45 44 ! 46 45 !=============================================================================== … … 67 66 REAL, INTENT(in) :: pplev(ngrid,nlay+1) ! Level pressure 68 67 REAL, INTENT(in) :: pphi(ngrid,nlay) ! Geopotential 68 REAL, INTENT(in) :: zpopsk(ngrid,nlay) ! Exner function 69 69 70 70 REAL, INTENT(in) :: pu(ngrid,nlay) ! Zonal wind … … 78 78 ! -------- 79 79 80 INTEGER, INTENT(out) :: lmax(ngrid) ! Highest layer reached by the plume81 INTEGER, INTENT(out) :: lmix(ngrid) ! Layer in which plume vertical speed is maximal82 INTEGER, INTENT(out) :: lmin(ngrid) ! First unstable layer83 84 80 REAL, INTENT(out) :: pduadj(ngrid,nlay) ! u convective variations 85 81 REAL, INTENT(out) :: pdvadj(ngrid,nlay) ! v convective variations … … 87 83 REAL, INTENT(out) :: pdqadj(ngrid,nlay,nq) ! q convective variations 88 84 89 REAL, INTENT(inout) :: f0(ngrid) ! mass flux norm (after possible time relaxation) 90 REAL, INTENT(inout) :: fm0(ngrid,nlay+1) ! mass flux (after possible time relaxation) 91 REAL, INTENT(inout) :: entr0(ngrid,nlay) ! entrainment (after possible time relaxation) 92 REAL, INTENT(inout) :: detr0(ngrid,nlay) ! detrainment (after possible time relaxation) 85 REAL, INTENT(inout) :: fm_tot(ngrid,nlay+1) ! Total mass flux 86 REAL, INTENT(inout) :: entr_tot(ngrid,nlay) ! Total entrainment 87 REAL, INTENT(inout) :: detr_tot(ngrid,nlay) ! Total detrainment 88 89 REAL, INTENT(out) :: fraca(ngrid,nlay+1) ! Updraft fraction 90 REAL, INTENT(out) :: zw2_tot(ngrid,nlay+1) ! Total plume vertical speed 93 91 94 92 ! Local: … … 96 94 97 95 INTEGER ig, k, l, iq 96 INTEGER lmax(ngrid) ! Highest layer reached by the plume 97 INTEGER lmix(ngrid) ! Layer in which plume vertical speed is maximal 98 INTEGER lmin(ngrid) ! First unstable layer 98 99 99 100 REAL zmix(ngrid) ! Altitude of maximal vertical speed … … 106 107 REAL rhobarz(ngrid,nlay) ! Levels densities 107 108 REAL masse(ngrid,nlay) ! Layers masses 108 REAL zpopsk(ngrid,nlay) ! Exner function109 109 110 110 REAL zu(ngrid,nlay) ! u environment … … 128 128 129 129 REAL f_star(ngrid,nlay+1) ! Normalized mass flux 130 REAL entr_star(ngrid,nlay) ! Normalized entrainment (E* = e* dz) 131 REAL detr_star(ngrid,nlay) ! Normalized detrainment (D* = d* dz) 132 130 REAL entr_star(ngrid,nlay) ! Normalized entrainment 131 REAL detr_star(ngrid,nlay) ! Normalized detrainment 132 133 REAL f(ngrid) ! Mass flux norm 133 134 REAL fm(ngrid,nlay+1) ! Mass flux 134 REAL entr(ngrid,nlay) ! Entrainment (E = e dz) 135 REAL detr(ngrid,nlay) ! Detrainment (D = d dz) 136 137 REAL f(ngrid) ! Mass flux norm 138 REAL lambda ! Time relaxation coefficent 139 REAL fraca(ngrid,nlay+1) ! Updraft fraction 135 REAL entr(ngrid,nlay) ! Entrainment 136 REAL detr(ngrid,nlay) ! Detrainment 137 138 REAL zw2(ngrid,nlay+1) ! Plume vertical speed 140 139 REAL wmax(ngrid) ! Maximal vertical speed 141 REAL zw2(ngrid,nlay+1) ! Plume vertical speed142 140 REAL zdthladj(ngrid,nlay) ! Potential temperature variations 143 141 REAL dummy(ngrid,nlay) ! Dummy argument for thermcell_dq() 144 142 143 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 144 INTEGER lbot(ngrid) 145 LOGICAL re_tpm 146 INTEGER while_loop_counter 147 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 148 145 149 !=============================================================================== 146 150 ! Initialization 147 151 !=============================================================================== 148 152 149 IF (firstcall) THEN 150 fm0(:,:) = 0. 151 entr0(:,:) = 0. 152 detr0(:,:) = 0. 153 ENDIF 154 155 DO ig=1,ngrid 156 ! AB: Minimal f0 value is set to 0. (instead of 1.e-2 in Earth version) 157 f0(ig) = MAX(f0(ig), 0.) 158 ENDDO 153 fm_tot(:,:) = 0. 154 entr_tot(:,:) = 0. 155 detr_tot(:,:) = 0. 156 zw2_tot(:,:) = 0. 159 157 160 158 pduadj(:,:) = 0.0 … … 164 162 165 163 zdthladj(:,:) = 0.0 164 165 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 166 re_tpm = .true. 167 lbot(:) = linf 168 while_loop_counter = 0. 169 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 166 170 167 171 !=============================================================================== … … 243 247 ! --------------------------- | 244 248 ! | 245 ! --------------------------- rhobarz, f_star, fm, fm0,zw2, fraca249 ! --------------------------- rhobarz, f_star, fm, zw2, fraca 246 250 ! zt, zu, zv, zo, rho | 247 251 ! --------------------------- | … … 287 291 !=============================================================================== 288 292 289 !------------------------------------------------------------------------------- 290 ! Thermal plumes speeds, fluxes, tracers and temperatures 291 !------------------------------------------------------------------------------- 292 293 CALL thermcell_plume(ngrid,nlay,nq,ptimestep, & 294 & ztv,zhl,zqt,zql,zlev,pplev,zpopsk, & 295 & detr_star,entr_star,f_star, & 296 & ztva,zhla,zqta,zqla,zqsa, & 297 & zw2,lmin) 298 293 DO WHILE (re_tpm.and.(while_loop_counter<nlay)) 294 while_loop_counter = while_loop_counter + 1 295 296 !------------------------------------------------------------------------------- 297 ! Thermal plumes speeds, normalized fluxes, tracers and temperatures 298 !------------------------------------------------------------------------------- 299 300 CALL thermcell_plume(ngrid,nlay,nq,ptimestep, & 301 & ztv,zhl,zqt,zql,zlev,pplev,zpopsk, & 302 & detr_star,entr_star,f_star, & 303 & ztva,zhla,zqta,zqla,zqsa, & 304 & zw2,lbot,lmin) 305 299 306 !------------------------------------------------------------------------------- 300 307 ! Thermal plumes characteristics: zmax, zmix, wmax 301 308 !------------------------------------------------------------------------------- 302 309 303 310 ! AB: Careful, zw2 became its square root in thermcell_height! 304 CALL thermcell_height(ngrid,nlay,lmin,lmix,lmax,zlev, & 305 & zmin,zmix,zmax,zw2,wmax,f_star) 306 307 !=============================================================================== 308 ! Closure and mass fluxes computation 309 !=============================================================================== 310 311 CALL thermcell_height(ngrid,nlay,lmin,lmix,lmax, & 312 & zlev,zmin,zmix,zmax,zw2,wmax,f_star) 313 311 314 !------------------------------------------------------------------------------- 312 315 ! Closure 313 316 !------------------------------------------------------------------------------- 314 315 CALL thermcell_closure(ngrid,nlay,ptimestep,rho,zlev, & 316 & lmax,entr_star,zmin,zmax,wmax,f) 317 318 IF (tau_thermals>1.) THEN 319 lambda = exp(-ptimestep/tau_thermals) 320 f0(:) = (1.-lambda) * f(:) + lambda * f0(:) 321 ELSE 322 f0(:) = f(:) 323 ENDIF 324 317 318 CALL thermcell_closure(ngrid,nlay,ptimestep,rho,zlev, & 319 & lmax,entr_star,zmin,zmax,wmax,f) 320 325 321 ! FH: Test valable seulement en 1D mais pas genant 326 IF (.not. (f0(1).ge.0.) ) THEN327 print *, 'ERROR: mass flux norm is not positive!'328 print *, 'f0 =', f0(1)329 CALL abort330 ENDIF331 322 IF (.not. (f(1).ge.0.) ) THEN 323 print *, 'ERROR: mass flux norm is not positive!' 324 print *, 'f =', f(1) 325 CALL abort 326 ENDIF 327 332 328 !------------------------------------------------------------------------------- 333 329 ! Mass fluxes 334 330 !------------------------------------------------------------------------------- 335 336 CALL thermcell_flux(ngrid,nlay,ptimestep,masse, & 337 & lmin,lmax,entr_star,detr_star, & 338 & f,rhobarz,zlev,zw2,fm,entr,detr,zqla) 339 340 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 341 ! On ne prend pas directement les profils issus des calculs precedents mais on 342 ! s'autorise genereusement une relaxation vers ceci avec une constante de temps 343 ! tau_thermals (typiquement 1800s sur Terre). 344 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 345 346 IF (tau_thermals>1.) THEN 347 lambda = exp(-ptimestep/tau_thermals) 348 fm0 = (1.-lambda) * fm + lambda * fm0 349 entr0 = (1.-lambda) * entr + lambda * entr0 350 detr0 = (1.-lambda) * detr + lambda * detr0 351 ELSE 352 fm0(:,:) = fm(:,:) 353 entr0(:,:) = entr(:,:) 354 detr0(:,:) = detr(:,:) 355 ENDIF 356 357 !------------------------------------------------------------------------------- 331 332 CALL thermcell_flux(ngrid,nlay,ptimestep,masse, & 333 & lmin,lmax,entr_star,detr_star, & 334 & f,rhobarz,zlev,zw2,fm,entr,detr) 335 336 !------------------------------------------------------------------------------- 337 ! 338 !------------------------------------------------------------------------------- 339 340 re_tpm = .false. 341 DO ig=1,ngrid 342 IF(lmax(ig) > lmin(ig)) THEN 343 lbot(ig) = lmax(ig) 344 re_tpm = .true. 345 ELSE 346 lbot(ig) = nlay 347 ENDIF 348 ENDDO 349 350 !------------------------------------------------------------------------------- 351 ! Thermal plumes stacking 352 !------------------------------------------------------------------------------- 353 354 zw2_tot(:,:) = zw2_tot(:,:) + zw2(:,:) 355 entr_tot(:,:) = entr_tot(:,:) + entr(:,:) 356 detr_tot(:,:) = detr_tot(:,:) + detr(:,:) 357 fm_tot(:,:) = fm_tot(:,:) + fm(:,:) 358 359 ENDDO 360 361 !=============================================================================== 358 362 ! Updraft fraction 359 ! -------------------------------------------------------------------------------363 !=============================================================================== 360 364 361 365 DO ig=1,ngrid … … 366 370 DO l=2,nlay 367 371 DO ig=1,ngrid 368 IF (zw2 (ig,l) > 0.) THEN369 fraca(ig,l) = fm (ig,l) / (rhobarz(ig,l) * zw2(ig,l))372 IF (zw2_tot(ig,l) > 0.) THEN 373 fraca(ig,l) = fm_tot(ig,l) / (rhobarz(ig,l) * zw2_tot(ig,l)) 370 374 ELSE 371 375 fraca(ig,l) = 0. … … 375 379 376 380 !=============================================================================== 377 ! Transport vertical381 ! Vertical transport 378 382 !=============================================================================== 379 383 … … 382 386 !------------------------------------------------------------------------------- 383 387 384 CALL thermcell_dq(ngrid,nlay,ptimestep,fm 0,entr0,detr0,masse,&385 & zhl,zdthladj,dummy)388 CALL thermcell_dq(ngrid,nlay,ptimestep,fm_tot,entr_tot,detr_tot, & 389 & masse,zhl,zdthladj,dummy) 386 390 387 391 DO l=1,nlay … … 396 400 397 401 DO iq=1,nq 398 CALL thermcell_dq(ngrid,nlay,ptimestep,fm 0,entr0,detr0,masse,&399 & pq(:,:,iq),pdqadj(:,:,iq),zqa(:,:,iq))402 CALL thermcell_dq(ngrid,nlay,ptimestep,fm_tot,entr_tot,detr_tot, & 403 & masse,pq(:,:,iq),pdqadj(:,:,iq),zqa(:,:,iq)) 400 404 ENDDO 401 405 … … 404 408 !------------------------------------------------------------------------------- 405 409 410 ! AB: Careful, thermcell_dv2 wasn't checked! It is not sure that it works 411 ! correctly with the plumes stacking (zmin, wmax doesn't make sense). 406 412 IF (dvimpl) THEN 407 CALL thermcell_dv2(ngrid,nlay,ptimestep,fm 0,entr0,detr0,masse,fraca, &408 & zmax,zmin,pu,pv,pduadj,pdvadj,zua,zva)413 CALL thermcell_dv2(ngrid,nlay,ptimestep,fm_tot,entr_tot,detr_tot, & 414 & masse,fraca,zmax,zmin,pu,pv,pduadj,pdvadj,zua,zva) 409 415 ELSE 410 CALL thermcell_dq(ngrid,nlay,ptimestep,fm 0,entr0,detr0,masse,&411 & zu,pduadj,zua)412 CALL thermcell_dq(ngrid,nlay,ptimestep,fm 0,entr0,detr0,masse,&413 & zv,pdvadj,zva)416 CALL thermcell_dq(ngrid,nlay,ptimestep,fm_tot,entr_tot,detr_tot, & 417 & masse,zu,pduadj,zua) 418 CALL thermcell_dq(ngrid,nlay,ptimestep,fm_tot,entr_tot,detr_tot, & 419 & masse,zv,pdvadj,zva) 414 420 ENDIF 415 421
Note: See TracChangeset
for help on using the changeset viewer.