4 SUBROUTINE thermcell_main(itap,ngrid,nlay,ptimestep &
5 & ,
pplay,pplev,pphi,debut &
7 & ,pduadj,pdvadj,pdtadj,pdoadj &
8 & ,fm0,entr0,detr0,zqta,zqla,
lmax &
9 & ,ratqscth,ratqsdiff,zqsatth &
10 & ,ale_bl,alp_bl,lalim_conv,wght_th &
11 & ,zmax0, f0,zw2,fraca,ztv &
14 & ,pbl_tke,pctsrf,omega,
airephy &
15 & ,zlcl,fraca0,w0,w_conv,therm_tke_max0,env_tke_max0 &
16 & ,n2,s2,ale_bl_stat &
17 & ,therm_tke_max,env_tke_max &
18 & ,alp_bl_det,alp_bl_fluct_m,alp_bl_fluct_tke &
19 & ,alp_bl_conv,alp_bl_stat &
67 #include "thermcell.h"
77 REAL pt(ngrid,nlay),pdtadj(ngrid,nlay)
78 REAL pu(ngrid,nlay),pduadj(ngrid,nlay)
79 REAL pv(ngrid,nlay),pdvadj(ngrid,nlay)
80 REAL po(ngrid,nlay),pdoadj(ngrid,nlay)
81 REAL pplay(ngrid,nlay),pplev(ngrid,nlay+1)
90 integer,
save :: dvdq=1,dqimpl=-1
96 integer,
save :: igout=1
98 integer,
save :: lunout1=6
100 integer,
save :: lev_out=10
103 REAL susqr2pi, reuler
105 INTEGER ig,k,
l,
ll,ierr
109 INTEGER lmix_bis(
klon)
173 real alim_star_tot(
klon)
191 real therm_tke_max0(
klon),env_tke_max0(
klon)
193 real ale_bl_stat(
klon)
195 real alp_bl_det(
klon),alp_bl_fluct_m(
klon),alp_bl_fluct_tke(
klon),alp_bl_conv(
klon),alp_bl_stat(
klon)
220 real pbl_tke_max0(
klon)
238 integer lalim_conv(
klon)
245 character (len=20) :: modname=
'thermcell_main'
246 character (len=80) :: abort_message
271 fm=0. ; entr=0. ; detr=0.
282 if (
prt_level.ge.1) print*,
'thermcell_main V4'
285 IF(ngrid.NE.
klon)
THEN
287 print*,
'STOP dans convadj'
288 print*,
'ngrid =',ngrid
294 f0(ig)=max(f0(ig),1.e-2)
295 zmax0(ig)=max(zmax0(ig),40.)
301 print*,
'th_main ig f0',ig,f0(ig)
309 & pplev,zo,zh,zl,ztv,zthl,zu,zv,zpspsk,zqsat,lev_out)
311 if (
prt_level.ge.1) print*,
'thermcell_main apres thermcell_env'
336 zlev(:,
l)=0.5*(pphi(:,
l)+pphi(:,
l-1))/
rg
339 zlev(:,nlay+1)=(2.*pphi(:,
klev)-pphi(:,
klev-1))/
rg
341 zlay(:,
l)=pphi(:,
l)/
rg
345 deltaz(:,
l)=zlev(:,
l+1)-zlev(:,
l)
353 rho(:,:)=
pplay(:,:)/(zpspsk(:,:)*rd*ztv(:,:))
356 &
'WARNING thermcell_main rhobarz(:,1)=rho(:,1)'
357 rhobarz(:,1)=rho(:,1)
360 rhobarz(:,
l)=0.5*(rho(:,
l)+rho(:,
l-1))
365 masse(:,
l)=(pplev(:,
l)-pplev(:,
l+1))/
rg
368 if (
prt_level.ge.1) print*,
'thermcell_main apres initialisation'
428 entr_star=0. ; detr_star=0. ; alim_star=0. ; alim_star_tot=0.
441 if (
prt_level.ge.1) print*,
'avant thermcell_plume ',lev_out
450 CALL thermcell_plume(
itap,ngrid,nlay,ptimestep,ztv,zthl,po,zl,rhobarz,&
451 & zlev,pplev,pphi,zpspsk,alim_star,alim_star_tot, &
452 & lalim,f0,detr_star,entr_star,f_star,csc,ztva, &
453 & ztla,zqla,zqta,zha,zw2,zw_est,ztva_est,zqsatth,lmix,lmix_bis,linter &
454 & ,lev_out,lunout1,igout)
458 CALL thermcellv1_plume(
itap,ngrid,nlay,ptimestep,ztv,zthl,po,zl,rhobarz,&
459 & zlev,pplev,pphi,zpspsk,alim_star,alim_star_tot, &
460 & lalim,f0,detr_star,entr_star,f_star,csc,ztva, &
461 & ztla,zqla,zqta,zha,zw2,zw_est,ztva_est,zqsatth,lmix,lmix_bis,linter &
462 & ,lev_out,lunout1,igout)
466 if (
prt_level.ge.1) print*,
'apres thermcell_plume ',lev_out
468 call test_ltherm(ngrid,nlay,pplev,
pplay,lalim,seuil,ztv,po,ztva,zqla,f_star,zw2,
'thermcell_plum lalim ')
469 call test_ltherm(ngrid,nlay,pplev,
pplay,lmix ,seuil,ztv,po,ztva,zqla,f_star,zw2,
'thermcell_plum lmix ')
471 if (
prt_level.ge.1) print*,
'thermcell_main apres thermcell_plume'
473 write(lunout1,*)
'Dans thermcell_main 2'
474 write(lunout1,*)
'lmin ',lmin(igout)
475 write(lunout1,*)
'lalim ',lalim(igout)
476 write(lunout1,*)
' ig l alim_star entr_star detr_star f_star '
477 write(lunout1,
'(i6,i4,4e15.5)') (igout,
l,alim_star(igout,
l),entr_star(igout,
l),detr_star(igout,
l) &
478 & ,f_star(igout,
l+1),
l=1,nint(linter(igout))+5)
486 & zlev,
lmax,zmax,zmax0,zmix,wmax,lev_out)
491 wmax_tmp(:)=max(wmax_tmp(:),zw2(:,
l))
497 call test_ltherm(ngrid,nlay,pplev,
pplay,lalim,seuil,ztv,po,ztva,zqla,f_star,zw2,
'thermcell_heig lalim ')
498 call test_ltherm(ngrid,nlay,pplev,
pplay,lmin ,seuil,ztv,po,ztva,zqla,f_star,zw2,
'thermcell_heig lmin ')
499 call test_ltherm(ngrid,nlay,pplev,
pplay,lmix ,seuil,ztv,po,ztva,zqla,f_star,zw2,
'thermcell_heig lmix ')
500 call test_ltherm(ngrid,nlay,pplev,
pplay,
lmax ,seuil,ztv,po,ztva,zqla,f_star,zw2,
'thermcell_heig lmax ')
502 if (
prt_level.ge.1) print*,
'thermcell_main apres thermcell_height'
511 & lalim,lmin,zmax_sec,wmax_sec,lev_out)
517 if (
prt_level.ge.1) print*,
'thermcell_main apres thermcell_dry'
519 write(lunout1,*)
'Dans thermcell_main 1b'
520 write(lunout1,*)
'lmin ',lmin(igout)
521 write(lunout1,*)
'lalim ',lalim(igout)
522 write(lunout1,*)
' ig l alim_star entr_star detr_star f_star '
523 write(lunout1,
'(i6,i4,e15.5)') (igout,
l,alim_star(igout,
l) &
524 & ,
l=1,lalim(igout)+4)
532 alim_star_clos(:,:)=alim_star(:,:)
533 alim_star_clos(:,:)=entr_star(:,:)+alim_star(:,:)
536 if (iflag_thermals_closure.eq.1)
then
539 & zlev,lalim,alim_star_clos,f_star,zmax_sec,wmax_sec,f,lev_out)
544 else if (iflag_thermals_closure.eq.2)
then
547 & zlev,lalim,alim_star,f_star,zmax,wmax,f,lev_out)
553 if(
prt_level.ge.1)print*,
'thermcell_closure apres thermcell_closure'
557 f0=(1.-lambda)*f+lambda*f0
563 if (.not. (f0(1).ge.0.) )
then
564 abort_message = .not..ge.
' (f0(1)0.)'
573 & lalim,
lmax,alim_star, &
574 & entr_star,detr_star,f,rhobarz,zlev,zw2,fm,entr, &
575 & detr,zqla,lev_out,lunout1,igout)
578 if (
prt_level.ge.1) print*,
'thermcell_main apres thermcell_flux'
579 call test_ltherm(ngrid,nlay,pplev,
pplay,lalim,seuil,ztv,po,ztva,zqla,f_star,zw2,
'thermcell_flux lalim ')
580 call test_ltherm(ngrid,nlay,pplev,
pplay,
lmax ,seuil,ztv,po,ztva,zqla,f_star,zw2,
'thermcell_flux lmax ')
590 fm0=(1.-lambda)*fm+lambda*fm0
591 entr0=(1.-lambda)*entr+lambda*entr0
592 detr0=(1.-lambda)*detr+lambda*detr0
603 call thermcell_dq(ngrid,nlay,dqimpl,ptimestep,fm0,entr0,masse, &
604 & zthl,zdthladj,zta,lev_out)
605 call thermcell_dq(ngrid,nlay,dqimpl,ptimestep,fm0,entr0,masse, &
606 & po,pdoadj,zoa,lev_out)
617 if (zw2(ig,
l).gt.1.e-10)
then
618 fraca(ig,
l)=fm(ig,
l)/(rhobarz(ig,
l)*zw2(ig,
l))
638 & ,zu,zv,pduadj,pdvadj,zua,zva,lev_out)
643 call thermcell_dq(ngrid,nlay,dqimpl,ptimestep,fm0,entr0,masse &
644 & ,zu,pduadj,zua,lev_out)
645 call thermcell_dq(ngrid,nlay,dqimpl,ptimestep,fm0,entr0,masse &
646 & ,zv,pdvadj,zva,lev_out)
653 pdtadj(ig,
l)=zdthladj(ig,
l)*zpspsk(ig,
l)
657 if (
prt_level.ge.1) print*,
'14 OK convect8'
664 if (
prt_level.ge.1) print*,
'14a OK convect8'
673 chi=zh(ig,1)/(1669.0-122.0*zo(ig,1)/zqsat(ig,1)-zh(ig,1))
674 pcon(ig)=
pplay(ig,1)*(zo(ig,1)/zqsat(ig,1))**chi
679 if ((pcon(ig).le.
pplay(ig,k)) &
680 & .and.(pcon(ig).gt.
pplay(ig,k+1)))
then
681 zcon2(ig)=zlay(ig,k)-(pcon(ig)-
pplay(ig,k))/(
rg*rho(ig,k))/100.
688 if (pcon(ig).le.
pplay(ig,nlay))
then
689 zcon2(ig)=zlay(ig,nlay)-(pcon(ig)-
pplay(ig,nlay))/(
rg*rho(ig,nlay))/100.
694 abort_message =
'thermcellV0_main: les thermiques vont trop haut '
698 if (
prt_level.ge.1) print*,
'14b OK convect8'
701 if (zqla(ig,k).gt.1e-10)
then
707 if (
prt_level.ge.1) print*,
'14c OK convect8'
719 if (
prt_level.ge.1) print*,
'14d OK convect8'
721 &
'WARNING thermcell_main wth2=0. si zw2 > 1.e-10'
727 thetath2(ig,
l)=zf2*(ztla(ig,
l)-zthl(ig,
l))**2
728 if(zw2(ig,
l).gt.1.e-10)
then
729 wth2(ig,
l)=zf2*(zw2(ig,
l))**2
733 wth3(ig,
l)=zf2*(1-2.*fraca(ig,
l))/(1-fraca(ig,
l)) &
734 & *zw2(ig,
l)*zw2(ig,
l)*zw2(ig,
l)
735 q2(ig,
l)=zf2*(zqta(ig,
l)*1000.-po(ig,
l)*1000.)**2
737 ratqscth(ig,
l)=sqrt(max(q2(ig,
l),1.e-6)/(po(ig,
l)*1000.))
743 wq(ig,
l)=fraca(ig,
l)*zw2(ig,
l)*(zqta(ig,
l)*1000.-po(ig,
l)*1000.)
744 wthl(ig,
l)=fraca(ig,
l)*zw2(ig,
l)*(ztla(ig,
l)-zthl(ig,
l))
745 wthv(ig,
l)=fraca(ig,
l)*zw2(ig,
l)*(ztva(ig,
l)-ztv(ig,
l))
754 & ,ale_bl,alp_bl,lalim_conv,wght_th &
757 & ,pcon,rhobarz,wth3,wmax_sec,lalim,fm,alim_star,zmax &
759 & ,pbl_tke,pctsrf,omega,
airephy &
760 & ,zlcl,fraca0,w0,w_conv,therm_tke_max0,env_tke_max0 &
761 & ,n2,s2,ale_bl_stat &
762 & ,therm_tke_max,env_tke_max &
763 & ,alp_bl_det,alp_bl_fluct_m,alp_bl_fluct_tke &
764 & ,alp_bl_conv,alp_bl_stat &
771 if (
prt_level.ge.1) print*,
'14e OK convect8'
778 if (
l<=lalim(ig))
then
779 var=
var+alim_star(ig,
l)*zqta(ig,
l)*1000.
784 if (
prt_level.ge.1) print*,
'14f OK convect8'
788 if (
l<=lalim(ig))
then
791 vardiff=vardiff+alim_star(ig,
l)*(zqta(ig,
l)*1000.-
var)**2
796 if (
prt_level.ge.1) print*,
'14g OK convect8'
799 ratqsdiff(ig,
l)=sqrt(vardiff)/(po(ig,
l)*1000.)
810 if (
prt_level.ge.1) print*,
'thermcell_main FIN OK'
817 subroutine test_ltherm(klon,klev,pplev,pplay,long,seuil,ztv,po,ztva,zqla,f_star,zw2,comment)
834 print*,
'WARNING !!! TEST ',comment
842 print*,
'WARNING ',comment,
' au point ',i,
' K= ',long(i)
843 print*,
' K P(MB) THV(K) Qenv(g/kg)THVA QLA(g/kg) F* W2'
845 write(6,
'(i3,7f10.3)') k,
pplay(i,k),ztv(i,k),1000*po(i,k),ztva(i,k),1000*zqla(i,k),f_star(i,k),zw2(i,k)
857 subroutine thermcell_tke_transport(ngrid,nlay,ptimestep,fm0,entr0, &
858 &
rg,pplev,therm_tke_max)
870 integer ngrid,nlay,
nsrf
873 real masse0(ngrid,nlay),fm0(ngrid,nlay+1),pplev(ngrid,nlay+1)
874 real entr0(ngrid,nlay),
rg
875 real therm_tke_max(ngrid,nlay)
876 real detr0(ngrid,nlay)
879 real masse(ngrid,nlay),fm(ngrid,nlay+1)
880 real entr(ngrid,nlay)
884 real qa(ngrid,nlay),detr(ngrid,nlay),wqd(ngrid,nlay+1)
895 if (
prt_level.ge.1) print*,
'Q2 THERMCEL_DQ 0'
899 detr0(:,k)=fm0(:,k)-fm0(:,k+1)+entr0(:,k)
900 masse0(:,k)=(pplev(:,k)-pplev(:,k+1))/
rg
905 masse(:,1)=0.5*masse0(:,1)
906 entr(:,1)=0.5*entr0(:,1)
907 detr(:,1)=0.5*detr0(:,1)
910 masse(:,k+1)=0.5*(masse0(:,k)+masse0(:,k+1))
911 entr(:,k+1)=0.5*(entr0(:,k)+entr0(:,k+1))
912 detr(:,k+1)=0.5*(detr0(:,k)+detr0(:,k+1))
913 fm(:,k+1)=fm(:,k)+entr(:,k)-detr(:,k)
927 q(:,:)=therm_tke_max(:,:)
937 if ((fm(ig,k+1)+detr(ig,k))*ptimestep.gt. &
938 & 1.e-5*masse(ig,k))
then
939 qa(ig,k)=(fm(ig,k)*qa(ig,k-1)+entr(ig,k)*q(ig,k)) &
940 & /(fm(ig,k+1)+detr(ig,k))
944 if (qa(ig,k).lt.0.)
then
947 if (q(ig,k).lt.0.)
then
957 wqd(ig,k)=fm(ig,k)*q(ig,k)
958 if (wqd(ig,k).lt.0.)
then
971 q(ig,k)=q(ig,k)+(detr(ig,k)*qa(ig,k)-entr(ig,k)*q(ig,k) &
972 & -wqd(ig,k)+wqd(ig,k+1)) &
973 & *ptimestep/masse(ig,k)
979 therm_tke_max(:,:)=q(:,:)
subroutine thermcell_env(ngrid, nlay, po, pt, pu, pv, pplay, pplev, zo, zh, zl, ztv, zthl, zu, zv, zpspsk, pqsat, lev_out)
subroutine thermcell_height(ngrid, nlay, lalim, lmin, linter, lmix, zw2, zlev, lmax, zmax, zmax0, zmix, wmax, lev_out)
!$Id klon initialisation mois suivants day_rain itap
c c $Id c c calculs statistiques distribution nuage ftion du regime dynamique c c Ce calcul doit etre fait a partir de valeurs mensuelles CALL nbregdyn DO kmaxm1 DO l
!$Id!c c c Common de passage de la geometrie de la dynamique a la physique real airephy(klon)
subroutine scopy(n, sx, incx, sy, incy)
subroutine thermcell_dry(ngrid, nlay, zlev, pphi, ztv, alim_star, lalim, lmin, zmax, wmax, lev_out)
!$Header!integer nvarmx s s s var
subroutine thermcell_closure(ngrid, nlay, r_aspect, ptimestep, rho, zlev, lalim, alim_star, f_star, zmax, wmax, f, lev_out)
!$Id itapm1 ENDIF!IM on interpole les champs sur les niveaux STD de pression!IM a chaque pas de temps de la physique c!positionnement de l argument logique a false c!pour ne pas recalculer deux fois la meme chose!c!a cet effet un appel a plevel_new a ete deplace c!a la fin de la serie d appels c!la boucle DO nlevSTD a ete internalisee c!dans d ou la creation de cette routine c c!CALL pplay
!FH On elimine toutes les clefs physiques dans la dynamique prt_level
!$Header!integer nvarmx parameter(nfmx=10, imx=200, jmx=150, lmx=200, nvarmx=1000) real xd(imx
!$Id itapm1 ENDIF!IM on interpole les champs sur les niveaux STD de pression!IM a chaque pas de temps de la physique c!positionnement de l argument logique a false c!pour ne pas recalculer deux fois la meme chose!c!a cet effet un appel a plevel_new a ete deplace c!a la fin de la serie d appels c!la boucle DO nlevSTD a ete internalisee c!dans d ou la creation de cette routine c c!CALL ulevSTD CALL &zphi philevSTD CALL &zx_rh rhlevSTD!DO klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon klev DO klon du jour ou toutes les read_climoz CALL true
!$Id Turb_fcg!implicit none!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc!cette routine permet d obtenir hq et ainsi de!pouvoir calculer la convergence et le cisaillement dans la physiq!cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc INTEGER klev REAL ll
subroutine thermcell_flux2(ngrid, klev, ptimestep, masse, lalim, lmax, alim_star, entr_star, detr_star, f, rhobarz, zlev, zw2, fm, entr, detr, zqla, lev_out, lunout1, igout)
nsplit_thermals!nrlmd le iflag_clos_bl tau_trig_deep real::s_trig!fin nrlmd le fact_thermals_ed_dz iflag_wake iflag_thermals_closure common ctherm1 iflag_thermals
subroutine thermcell_dq(ngrid, nlay, impl, ptimestep, fm, entr, masse, q, dq, qa, lev_out)
subroutine thermcell_alp(ngrid, nlay, ptimestep, pplay, pplev, fm0, entr0, lmax, ale_bl, alp_bl, lalim_conv, wght_th, zw2, fraca, pcon, rhobarz, wth3, wmax_sec, lalim, fm, alim_star, zmax, pbl_tke, pctsrf, omega, airephy, zlcl, fraca0, w0, w_conv, therm_tke_max0, env_tke_max0, n2, s2, ale_bl_stat, therm_tke_max, env_tke_max, alp_bl_det, alp_bl_fluct_m, alp_bl_fluct_tke, alp_bl_conv, alp_bl_stat)
nsplit_thermals!nrlmd le iflag_clos_bl tau_trig_deep real::s_trig!fin nrlmd le fact_thermals_ed_dz iflag_wake iflag_thermals_closure common ctherm1 iflag_thermals_closure common ctherm2 tau_thermals
nsplit_thermals!nrlmd le iflag_clos_bl tau_trig_deep real::s_trig!fin nrlmd le fact_thermals_ed_dz iflag_wake iflag_thermals_closure common ctherm1 iflag_thermals_closure common ctherm2 fact_thermals_ed_dz common ctherm4 iflag_wake common ctherm5 iflag_thermals_ed
subroutine abort_physic(modname, message, ierr)
INTERFACE SUBROUTINE RRTM_ECRT_140GP pt
subroutine thermcell_dv2(ngrid, nlay, ptimestep, fm, entr, masse, fraca, larga, u, v, du, dv, ua, va, lev_out)
!$Header!gestion des impressions de sorties et de débogage la sortie standard prt_level COMMON comprint lunout