1 !-----------------------------------------------------------------------
3 !wrf:model_layer:physics
5 !####################tiedtke scheme#########################
6 ! m.tiedtke e.c.m.w.f. 1989
8 !--------------------------------------------
10 ! C. zhang & Yuqing Wang 2011-2017
12 ! modified from IPRC IRAM - yuqing wang, university of hawaii
15 ! The current version is stable. There are many updates to the old Tiedtke scheme (cu_physics=6)
17 ! the new Tiedtke scheme is similar to the Tiedtke scheme used in REGCM4 and ECMWF cy40r1.
18 ! the major differences to the old Tiedtke (cu_physics=6) scheme are,
19 ! (a) New trigger functions for deep and shallow convections (Jakob and Siebesma 2003;
20 ! Bechtold et al. 2004, 2008, 2014).
21 ! (b) Non-equilibrium situations are considered in the closure for deep convection
22 ! (Bechtold et al. 2014).
23 ! (c) New convection time scale for the deep convection closure (Bechtold et al. 2008).
24 ! (d) New entrainment and detrainment rates for all convection types (Bechtold et al. 2008).
25 ! (e) New formula for the conversion from cloud water/ice to rain/snow (Sundqvist 1978).
26 ! (f) Different way to include cloud scale pressure gradients (Gregory et al. 1997;
29 ! other refenrence: tiedtke (1989, mwr, 117, 1779-1800)
30 ! IFS documentation - cy33r1, cy37r2, cy38r1, cy40r1
32 !===========================================================
33 ! Note for climate simulation of Tropical Cyclones
34 ! This version of Tiedtke scheme was tested with YSU PBL scheme, RRTMG radation
35 ! schemes, and WSM6 microphysics schemes, at horizontal resolution around 20 km
37 ! pgcoef = 0.7 to 1.0 is good depends on the basin
39 !===========================================================
40 ! Note for the diurnal simulation of precipitaton
41 ! When nonequil = .true., the CAPE is relaxed toward to a value from PBL
42 ! It can improve the diurnal precipitation over land.
43 !===========================================================
44 !###########################################################
46 module module_cu_ntiedtke
48 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
50 use mpas_atmphys_constants, only: rd=>R_d, rv=>R_v, &
51 & cpd=>cp, alv=>xlv, als=>xls, alf=>xlf, g=>gravity
53 use module_model_constants, only:rd=>r_d, rv=>r_v, &
54 & cpd=>cp, alv=>xlv, als=>xls, alf=>xlf, g
58 real,private :: t13,rcpd,vtmpc1,tmelt, &
59 c1es,c2es,c3les,c3ies,c4les,c4ies,c5les,c5ies,zrg
61 real,private :: r5alvcp,r5alscp,ralvdcp,ralsdcp,ralfdcp,rtwat,rtber,rtice
62 real,private :: entrdd,cmfcmax,cmfcmin,cmfdeps,zdnoprc,cprcon,pgcoef
63 integer,private :: momtrans
76 c5les=c3les*(tmelt-c4les), &
77 c5ies=c3ies*(tmelt-c4ies), &
78 r5alvcp=c5les*alv*rcpd, &
79 r5alscp=c5ies*als*rcpd, &
88 ! entrdd: average entrainment & detrainment rate for downdrafts
91 parameter(entrdd = 2.0e-4)
93 ! cmfcmax: maximum massflux value allowed for updrafts etc
96 parameter(cmfcmax = 1.0)
98 ! cmfcmin: minimum massflux value (for safety)
101 parameter(cmfcmin = 1.e-10)
103 ! cmfdeps: fractional massflux for downdrafts at lfs
106 parameter(cmfdeps = 0.30)
108 ! zdnoprc: deep cloud is thicker than this height (Unit:Pa)
110 parameter(zdnoprc = 2.0e4)
113 ! cprcon: coefficient from cloud water to rain water
115 parameter(cprcon = 1.4e-3)
118 ! momtrans: momentum transport method
119 ! ( 1 = IFS40r1 method; 2 = new method )
121 parameter(momtrans = 2 )
124 ! coefficient for pressure gradient intensity
125 ! (0.7 - 1.0 is recommended in this vesion of Tiedtke scheme)
126 parameter(pgcoef=0.7)
130 ! nonequil: representing equilibrium and nonequilibrium convection
131 ! ( .false. [equilibrium: removing all CAPE]; .true. [nonequilibrium: relaxing CAPE toward CAPE from PBL].
132 ! Ref. Bechtold et al. 2014 JAS )
134 parameter(nonequil = .true. )
136 !--------------------
137 ! switches for deep, mid, shallow convections, downdraft, and momentum transport
139 logical :: lmfpen,lmfmid,lmfscv,lmfdd,lmfdudv
140 parameter(lmfpen=.true.,lmfmid=.true.,lmfscv=.true.,lmfdd=.true.,lmfdudv=.true.)
141 !--------------------
142 !#################### end of variables definition##########################
143 !-----------------------------------------------------------------------
146 !-----------------------------------------------------------------------
147 subroutine cu_ntiedtke( &
148 dt,itimestep,stepcu &
149 ,raincv,pratec,qfx,hfx &
150 ,u3d,v3d,w,t3d,qv3d,qc3d,qi3d,pi3d,rho3d &
152 ,dz8w,pcps,p8w,xland,cu_act_flag,dx &
153 ,ids,ide, jds,jde, kds,kde &
154 ,ims,ime, jms,jme, kms,kme &
155 ,its,ite, jts,jte, kts,kte &
156 ,rthcuten,rqvcuten,rqccuten,rqicuten &
158 ,f_qv ,f_qc ,f_qr ,f_qi ,f_qs &
160 !-------------------------------------------------------------------
162 !-------------------------------------------------------------------
163 !-- u3d 3d u-velocity interpolated to theta points (m/s)
164 !-- v3d 3d v-velocity interpolated to theta points (m/s)
165 !-- th3d 3d potential temperature (k)
166 !-- t3d temperature (k)
167 !-- qv3d 3d water vapor mixing ratio (kg/kg)
168 !-- qc3d 3d cloud mixing ratio (kg/kg)
169 !-- qi3d 3d ice mixing ratio (kg/kg)
170 !-- rho3d 3d air density (kg/m^3)
171 !-- p8w 3d hydrostatic pressure at full levels (pa)
172 !-- pcps 3d hydrostatic pressure at half levels (pa)
173 !-- pi3d 3d exner function (dimensionless)
174 !-- qvften 3d total advective + PBL moisture tendency (kg kg-1 s-1)
175 !-- thften 3d total advective + PBL + radiative temperature tendency (k s-1)
176 !-- rthcuten theta tendency due to
177 ! cumulus scheme precipitation (k/s)
178 !-- rucuten u wind tendency due to
179 ! cumulus scheme precipitation (k/s)
180 !-- rvcuten v wind tendency due to
181 ! cumulus scheme precipitation (k/s)
182 !-- rqvcuten qv tendency due to
183 ! cumulus scheme precipitation (kg/kg/s)
184 !-- rqccuten qc tendency due to
185 ! cumulus scheme precipitation (kg/kg/s)
186 !-- rqicuten qi tendency due to
187 ! cumulus scheme precipitation (kg/kg/s)
188 !-- rainc accumulated total cumulus scheme precipitation (mm)
189 !-- raincv cumulus scheme precipitation (mm)
190 !-- pratec precipitiation rate from cumulus scheme (mm/s)
191 !-- dz8w dz between full levels (m)
192 !-- qfx upward moisture flux at the surface (kg/m^2/s)
193 !-- hfx upward heat flux at the surface (w/m^2)
195 !-- ids start index for i in domain
196 !-- ide end index for i in domain
197 !-- jds start index for j in domain
198 !-- jde end index for j in domain
199 !-- kds start index for k in domain
200 !-- kde end index for k in domain
201 !-- ims start index for i in memory
202 !-- ime end index for i in memory
203 !-- jms start index for j in memory
204 !-- jme end index for j in memory
205 !-- kms start index for k in memory
206 !-- kme end index for k in memory
207 !-- its start index for i in tile
208 !-- ite end index for i in tile
209 !-- jts start index for j in tile
210 !-- jte end index for j in tile
211 !-- kts start index for k in tile
212 !-- kte end index for k in tile
213 !-------------------------------------------------------------------
214 integer, intent(in) :: ids,ide, jds,jde, kds,kde, &
215 ims,ime, jms,jme, kms,kme, &
216 its,ite, jts,jte, kts,kte, &
220 real, intent(in) :: &
222 real, dimension(ims:ime, jms:jme), intent(in) :: &
225 real, dimension(ims:ime, jms:jme), intent(in) :: &
228 real, dimension(ims:ime, jms:jme), intent(inout) :: &
231 logical, dimension(ims:ime,jms:jme), intent(inout) :: &
234 real, dimension(ims:ime, kms:kme, jms:jme), intent(in) :: &
249 real, dimension(ims:ime, jms:jme) :: &
253 !--------------------------- optional vars ----------------------------
255 real, dimension(ims:ime, kms:kme, jms:jme), &
256 optional, intent(inout) :: &
265 ! flags relating to the optional tendency arrays declared above
266 ! models that carry the optional tendencies will provdide the
267 ! optional arguments at compile time; these flags all the model
268 ! to determine at run-time whether a particular tracer is in
271 logical, optional :: &
278 !--------------------------- local vars ------------------------------
283 real , dimension(its:ite) :: &
290 integer , dimension(its:ite) :: slimsk
293 real , dimension(its:ite, kts:kte+1) :: &
298 real , dimension(its:ite, kts:kte) :: &
315 integer, dimension(its:ite) :: &
329 !-------other local variables----
331 !-----------------------------------------------------------------------
334 !*** check to see if this is a convection timestep
337 !-----------------------------------------------------------------------
340 cu_act_flag(i,j)=.true.
350 !------------- j loop (outer) --------------------------------------------------
354 ! --------------- compute zi and zl -----------------------------------------
361 zi(i,k+1)=zi(i,k)+dz8w(i,k,j)
367 zl(i,k)=0.5*(zi(i,k)+zi(i,k+1))
371 ! --------------- end compute zi and zl -------------------------------------
373 slimsk(i)=int(abs(xland(i,j)-2.))
383 dot(i,k)=-0.5*g*rho3d(i,k,j)*(w(i,k,j)+w(i,kp,j))
395 if(itimestep == 1) then
399 q1b(i,zz)=qvften(i,k,j)
400 t1b(i,zz)=thften(i,k,j)
406 prsl(i,zz) = pcps(i,k,j)
416 prsi(i,zz) = p8w(i,k,j)
423 heatflux(i)= hfx(i,j)
426 !########################################################################
427 call tiecnvn(u1,v1,t1,q1,q2,q3,q1b,t1b,ghtl,ghti,omg,prsl,prsi,evap,heatflux, &
428 rn,slimsk,im,kx,kx1,delt,dx2d)
431 raincv(i,j)=rn(i)/stepcu
432 pratec(i,j)=rn(i)/(stepcu * dt)
439 rthcuten(i,k,j)=(t1(i,zz)-t3d(i,k,j))/pi3d(i,k,j)*rdelt
440 rqvcuten(i,k,j)=(q1(i,zz)-qv3d(i,k,j))*rdelt
441 rucuten(i,k,j) =(u1(i,zz)-u3d(i,k,j))*rdelt
442 rvcuten(i,k,j) =(v1(i,zz)-v3d(i,k,j))*rdelt
447 if(present(rqccuten))then
453 rqccuten(i,k,j)=(q2(i,zz)-qc3d(i,k,j))*rdelt
460 if(present(rqicuten))then
466 rqicuten(i,k,j)=(q3(i,zz)-qi3d(i,k,j))*rdelt
476 end subroutine cu_ntiedtke
478 !====================================================================
479 subroutine ntiedtkeinit(rthcuten,rqvcuten,rqccuten,rqicuten, &
480 rucuten,rvcuten,rthften,rqvften, &
481 restart,p_qc,p_qi,p_first_scalar, &
483 ids, ide, jds, jde, kds, kde, &
484 ims, ime, jms, jme, kms, kme, &
485 its, ite, jts, jte, kts, kte)
486 !--------------------------------------------------------------------
488 !--------------------------------------------------------------------
489 logical , intent(in) :: allowed_to_read,restart
490 integer , intent(in) :: ids, ide, jds, jde, kds, kde, &
491 ims, ime, jms, jme, kms, kme, &
492 its, ite, jts, jte, kts, kte
493 integer , intent(in) :: p_first_scalar, p_qi, p_qc
495 real, dimension( ims:ime , kms:kme , jms:jme ) , intent(out) :: &
503 integer :: i, j, k, itf, jtf, ktf
530 if (p_qc .ge. p_first_scalar) then
540 if (p_qi .ge. p_first_scalar) then
551 end subroutine ntiedtkeinit
553 !-----------------------------------------------------------------
554 ! level 1 subroutine 'tiecnvn'
555 !-----------------------------------------------------------------
556 subroutine tiecnvn(pu,pv,pt,pqv,pqc,pqi,pqvf,ptf,poz,pzz,pomg, &
557 & pap,paph,evap,hfx,zprecc,lndj,lq,km,km1,dt,dx)
558 !-----------------------------------------------------------------
559 ! this is the interface between the model and the mass
560 ! flux convection module
561 !-----------------------------------------------------------------
564 real pu(lq,km), pv(lq,km), pt(lq,km), pqv(lq,km)
565 real poz(lq,km), pomg(lq,km), evap(lq), zprecc(lq)
568 real pum1(lq,km), pvm1(lq,km), ztt(lq,km), &
569 & ptte(lq,km), pqte(lq,km), pvom(lq,km), pvol(lq,km), &
570 & pverv(lq,km), pgeo(lq,km), pap(lq,km), paph(lq,km1)
571 real pqhfl(lq), zqq(lq,km), &
572 & prsfc(lq), pssfc(lq), pcte(lq,km), &
573 & phhfl(lq), hfx(lq), pgeoh(lq,km1)
574 real ztp1(lq,km), zqp1(lq,km), ztu(lq,km), zqu(lq,km), &
575 & zlu(lq,km), zlude(lq,km), zmfu(lq,km), zmfd(lq,km), &
576 & zqsat(lq,km), pqc(lq,km), pqi(lq,km), zrain(lq)
577 real pqvf(lq,km), ptf(lq,km)
580 integer icbot(lq), ictop(lq), ktype(lq), lndj(lq)
583 real ztmst,fliq,fice,ztc,zalf,tt
584 integer i,j,k,lq,km,km1
587 real scale_fac(lq), scale_fac2(lq), dxref
589 ! set scale-dependency factor when dx is < 15 km
593 if (dx(j).lt.dxref) then
594 scale_fac(j) = (1.06133+log(dxref/dx(j)))**3
595 scale_fac2(j) = scale_fac(j)**0.5
597 scale_fac(j) = 1.+1.33e-5*dx(j)
604 ! masv flux diagnostics.
613 pgeoh(j,km1)=g*pzz(j,km1)
616 ! convert model variables for mflux scheme
624 zqp1(j,k)=pqv(j,k)/(1.0+pqv(j,k))
629 pgeoh(j,k)=g*pzz(j,k)
634 zcor = 1./(1.-vtmpc1*zqs)
643 !-----------------------------------------------------------------------
644 !* 2. call 'cumastrn'(master-routine for cumulus parameterization)
647 & (lq, km, km1, km-1, ztp1, &
648 & zqp1, pum1, pvm1, pverv, zqsat,&
649 & pqhfl, ztmst, pap, paph, pgeo, &
650 & ptte, pqte, pvom, pvol, prsfc,&
652 & ktype, icbot, ictop, ztu, zqu, &
653 & zlu, zlude, zmfu, zmfd, zrain,&
654 & pcte, phhfl, lndj, pgeoh, dx, &
655 & scale_fac, scale_fac2)
657 ! to include the cloud water and cloud ice detrained from convection
661 if(pcte(j,k).gt.0.) then
662 fliq=foealfa(ztp1(j,k))
664 pqc(j,k)=pqc(j,k)+fliq*pcte(j,k)*ztmst
665 pqi(j,k)=pqi(j,k)+fice*pcte(j,k)*ztmst
672 pt(j,k)= ztp1(j,k)+(ptte(j,k)-ztt(j,k))*ztmst
673 zqp1(j,k)=zqp1(j,k)+(pqte(j,k)-zqq(j,k))*ztmst
674 pqv(j,k)=zqp1(j,k)/(1.0-zqp1(j,k))
679 zprecc(j)=amax1(0.0,(prsfc(j)+pssfc(j))*ztmst)
685 pu(j,k)=pu(j,k)+pvom(j,k)*ztmst
686 pv(j,k)=pv(j,k)+pvol(j,k)*ztmst
692 end subroutine tiecnvn
694 !#############################################################
696 ! level 2 subroutines
698 !#############################################################
699 !***********************************************************
700 ! subroutine cumastrn
701 !***********************************************************
702 subroutine cumastrn &
703 & (klon, klev, klevp1, klevm1, pten, &
704 & pqen, puen, pven, pverv, pqsen,&
705 & pqhfl, ztmst, pap, paph, pgeo, &
706 & ptte, pqte, pvom, pvol, prsfc,&
708 & ktype, kcbot, kctop, ptu, pqu,&
709 & plu, plude, pmfu, pmfd, prain,&
710 & pcte, phhfl, lndj, zgeoh, dx, &
711 & scale_fac, scale_fac2)
714 !***cumastrn* master routine for cumulus massflux-scheme
715 ! m.tiedtke e.c.m.w.f. 1986/1987/1989
717 ! y.wang i.p.r.c 2001
721 ! this routine computes the physical tendencies of the
722 ! prognostic variables t,q,u and v due to convective processes.
723 ! processes considered are: convective fluxes, formation of
724 ! precipitation, evaporation of falling rain below cloud base,
725 ! saturated cumulus downdrafts.
728 ! parameterization is done using a massflux-scheme.
729 ! (1) define constants and parameters
730 ! (2) specify values (t,q,qs...) at half levels and
731 ! initialize updraft- and downdraft-values in 'cuinin'
732 ! (3) calculate cloud base in 'cutypen', calculate cloud types in cutypen,
733 ! and specify cloud base massflux
734 ! (4) do cloud ascent in 'cuascn' in absence of downdrafts
735 ! (5) do downdraft calculations:
736 ! (a) determine values at lfs in 'cudlfsn'
737 ! (b) determine moist descent in 'cuddrafn'
738 ! (c) recalculate cloud base massflux considering the
739 ! effect of cu-downdrafts
740 ! (6) do final adjusments to convective fluxes in 'cuflxn',
741 ! do evaporation in subcloud layer
742 ! (7) calculate increments of t and q in 'cudtdqn'
743 ! (8) calculate increments of u and v in 'cududvn'
746 ! cuinin: initializes values at vertical grid used in cu-parametr.
747 ! cutypen: cloud bypes, 1: deep cumulus 2: shallow cumulus
748 ! cuascn: cloud ascent for entraining plume
749 ! cudlfsn: determines values at lfs for downdrafts
750 ! cuddrafn:does moist descent for cumulus downdrafts
751 ! cuflxn: final adjustments to convective fluxes (also in pbl)
752 ! cudqdtn: updates tendencies for t and q
753 ! cududvn: updates tendencies for u and v
756 ! lmfmid=.t. midlevel convection is switched on
757 ! lmfdd=.t. cumulus downdrafts switched on
758 ! lmfdudv=.t. cumulus friction switched on
760 ! model parameters (defined in subroutine cuparam)
761 ! ------------------------------------------------
762 ! entrdd entrainment rate for cumulus downdrafts
763 ! cmfcmax maximum massflux value allowed for
764 ! cmfcmin minimum massflux value (for safety)
765 ! cmfdeps fractional massflux for downdrafts at lfs
766 ! cprcon coefficient for conversion from cloud water to rain
769 ! paper on massflux scheme (tiedtke,1989)
770 !-----------------------------------------------------------------
771 integer klev,klon,klevp1,klevm1
772 real pten(klon,klev), pqen(klon,klev),&
773 & puen(klon,klev), pven(klon,klev),&
774 & ptte(klon,klev), pqte(klon,klev),&
775 & pvom(klon,klev), pvol(klon,klev),&
776 & pqsen(klon,klev), pgeo(klon,klev),&
777 & pap(klon,klev), paph(klon,klevp1),&
778 & pverv(klon,klev), pqhfl(klon),&
780 real ptu(klon,klev), pqu(klon,klev),&
781 & plu(klon,klev), plude(klon,klev),&
782 & pmfu(klon,klev), pmfd(klon,klev),&
784 & prsfc(klon), pssfc(klon)
785 real ztenh(klon,klev), zqenh(klon,klev),&
786 & zgeoh(klon,klevp1), zqsenh(klon,klev),&
787 & ztd(klon,klev), zqd(klon,klev),&
788 & zmfus(klon,klev), zmfds(klon,klev),&
789 & zmfuq(klon,klev), zmfdq(klon,klev),&
790 & zdmfup(klon,klev), zdmfdp(klon,klev),&
791 & zmful(klon,klev), zrfl(klon),&
792 & zuu(klon,klev), zvu(klon,klev),&
793 & zud(klon,klev), zvd(klon,klev),&
795 real pmflxr(klon,klevp1), pmflxs(klon,klevp1)
797 & zmfub(klon), zmfub1(klon),&
799 real zsfl(klon), zdpmel(klon,klev),&
800 & pcte(klon,klev), zcape(klon),&
801 & zcape1(klon), zcape2(klon),&
802 & ztauc(klon), ztaubl(klon),&
804 real wup(klon), zdqcv(klon)
805 real wbase(klon), zmfuub(klon)
808 real pmfude_rate(klon,klev), pmfdde_rate(klon,klev)
809 real zmfuus(klon,klev), zmfdus(klon,klev)
810 real zuv2(klon,klev),ztenu(klon,klev),ztenv(klon,klev)
811 real zmfuvb(klon),zsum12(klon),zsum22(klon)
812 integer ilab(klon,klev), idtop(klon),&
813 & ictop0(klon), ilwmin(klon)
815 integer kcbot(klon), kctop(klon),&
816 & ktype(klon), lndj(klon)
818 logical loddraf(klon), llo1, llo2(klon)
819 real scale_fac(klon), scale_fac2(klon)
822 real zcons,zcons2,zqumqe,zdqmin,zdh,zmfmax
823 real zalfaw,zalv,zqalv,zc5ldcp,zc4les,zhsat,zgam,zzz,zhhat
824 real zpbmpt,zro,zdz,zdp,zeps,zfac,wspeed
826 integer ikb,ikt,icum,itopm2
827 real ztmst,ztau,zerate,zderate,zmfa
828 real zmfs(klon),pmean(klev),zlon
829 real zduten,zdvten,ztdis,pgf_u,pgf_v
830 !-------------------------------------------
831 ! 1. specify constants and parameters
832 !-------------------------------------------
836 !--------------------------------------------------------------
837 !* 2. initialize values at vertical grid points in 'cuini'
838 !--------------------------------------------------------------
840 & (klon, klev, klevp1, klevm1, pten, &
841 & pqen, pqsen, puen, pven, pverv,&
842 & pgeo, paph, zgeoh, ztenh, zqenh,&
843 & zqsenh, ilwmin, ptu, pqu, ztd, &
844 & zqd, zuu, zvu, zud, zvd, &
845 & pmfu, pmfd, zmfus, zmfds, zmfuq,&
846 & zmfdq, zdmfup, zdmfdp, zdpmel, plu, &
849 !----------------------------------
850 !* 3.0 cloud base calculations
851 !----------------------------------
852 !* (a) determine cloud base values in 'cutypen',
853 ! and the cumulus type 1 or 2
854 ! -------------------------------------------
856 & ( klon, klev, klevp1, klevm1, pqen,&
857 & ztenh, zqenh, zqsenh, zgeoh, paph,&
858 & phhfl, pqhfl, pgeo, pqsen, pap,&
859 & pten, lndj, ptu, pqu, ilab,&
860 & ldcum, kcbot, ictop0, ktype, wbase, plu, kdpl)
862 !* (b) assign the first guess mass flux at cloud base
863 ! ------------------------------------------
872 if(jk.ge.kcbot(jl) .and. ldcum(jl)) then
873 zdhpbl(jl)=zdhpbl(jl)+(alv*pqte(jl,jk)+cpd*ptte(jl,jk))&
874 & *(paph(jl,jk+1)-paph(jl,jk))
875 if(lndj(jl) .eq. 0) then
876 wspeed = sqrt(puen(jl,jk)**2 + pven(jl,jk)**2)
877 upbl(jl) = upbl(jl) + wspeed*(paph(jl,jk+1)-paph(jl,jk))
886 zmfmax = (paph(jl,ikb)-paph(jl,ikb-1))*zcons2
887 if(ktype(jl) == 1) then
888 zmfub(jl)= 0.1*zmfmax
889 else if ( ktype(jl) == 2 ) then
890 zqumqe = pqu(jl,ikb) + plu(jl,ikb) - zqenh(jl,ikb)
891 zdqmin = max(0.01*zqenh(jl,ikb),1.e-10)
892 zdh = cpd*(ptu(jl,ikb)-ztenh(jl,ikb)) + alv*zqumqe
893 zdh = g*max(zdh,1.e5*zdqmin)
894 if ( zdhpbl(jl) > 0. ) then
895 zmfub(jl) = zdhpbl(jl)/zdh
896 zmfub(jl) = min(zmfub(jl),zmfmax)
898 zmfub(jl) = 0.1*zmfmax
906 !------------------------------------------------------
907 !* 4.0 determine cloud ascent for entraining plume
908 !------------------------------------------------------
909 !* (a) do ascent in 'cuasc'in absence of downdrafts
910 !----------------------------------------------------------
912 & (klon, klev, klevp1, klevm1, ztenh,&
913 & zqenh, puen, pven, pten, pqen,&
914 & pqsen, pgeo, zgeoh, pap, paph,&
915 & pqte, pverv, ilwmin, ldcum, zhcbase,&
916 & ktype, ilab, ptu, pqu, plu,&
917 & zuu, zvu, pmfu, zmfub,&
918 & zmfus, zmfuq, zmful, plude, zdmfup,&
919 & kcbot, kctop, ictop0, icum, ztmst,&
920 & zqsenh, zlglac, lndj, wup, wbase, kdpl, pmfude_rate)
922 !* (b) check cloud depth and change entrainment rate accordingly
923 ! calculate precipitation rate (for downdraft calculation)
924 !------------------------------------------------------------------
926 if ( ldcum(jl) ) then
929 zpbmpt = paph(jl,ikb) - paph(jl,itopm2)
930 if ( ktype(jl) == 1 .and. zpbmpt < zdnoprc ) ktype(jl) = 2
931 if ( ktype(jl) == 2 .and. zpbmpt >= zdnoprc ) ktype(jl) = 1
932 ictop0(jl) = kctop(jl)
934 zrfl(jl)=zdmfup(jl,1)
939 zrfl(jl)=zrfl(jl)+zdmfup(jl,jk)
953 !-----------------------------------------
954 !* 6.0 cumulus downdraft calculations
955 !-----------------------------------------
957 !* (a) determine lfs in 'cudlfsn'
958 !--------------------------------------
961 & kcbot, kctop, lndj, ldcum, &
962 & ztenh, zqenh, puen, pven, &
963 & pten, pqsen, pgeo, &
964 & zgeoh, paph, ptu, pqu, plu, &
965 & zuu, zvu, zmfub, zrfl, &
966 & ztd, zqd, zud, zvd, &
967 & pmfd, zmfds, zmfdq, zdmfdp, &
969 !* (b) determine downdraft t,q and fluxes in 'cuddrafn'
970 !------------------------------------------------------------
972 & ( klon, klev, loddraf, &
973 & ztenh, zqenh, puen, pven, &
974 & pgeo, zgeoh, paph, zrfl, &
975 & ztd, zqd, zud, zvd, pmfu, &
976 & pmfd, zmfds, zmfdq, zdmfdp, pmfdde_rate )
977 !-----------------------------------------------------------
980 !-----------------------------------------------------------------------
981 !* 6.0 closure and clean work
983 !-- 6.1 recalculate cloud base massflux from a cape closure
984 ! for deep convection (ktype=1)
987 if(ldcum(jl) .and. ktype(jl) .eq. 1) then
996 ztauc(jl) = (zgeoh(jl,ikt)-zgeoh(jl,ikb)) / &
997 ((2.+ min(15.0,wup(jl)))*g)
998 if(lndj(jl) .eq. 0) then
999 upbl(jl) = 2.+ upbl(jl)/(paph(jl,klev+1)-paph(jl,ikb))
1000 ztaubl(jl) = (zgeoh(jl,ikb)-zgeoh(jl,klev+1))/(g*upbl(jl))
1001 ztaubl(jl) = min(300., ztaubl(jl))
1003 ztaubl(jl) = ztauc(jl)
1010 llo1 = ldcum(jl) .and. ktype(jl) .eq. 1
1011 if ( llo1 .and. jk <= kcbot(jl) .and. jk > kctop(jl) ) then
1013 zdz = pgeo(jl,jk-1)-pgeo(jl,jk)
1014 zdp = pap(jl,jk)-pap(jl,jk-1)
1015 zheat(jl) = zheat(jl) + ((pten(jl,jk-1)-pten(jl,jk)+zdz*rcpd) / &
1016 ztenh(jl,jk)+vtmpc1*(pqen(jl,jk-1)-pqen(jl,jk))) * &
1017 (g*(pmfu(jl,jk)+pmfd(jl,jk)))
1018 zcape1(jl) = zcape1(jl) + ((ptu(jl,jk)-ztenh(jl,jk))/ztenh(jl,jk) + &
1019 vtmpc1*(pqu(jl,jk)-zqenh(jl,jk))-plu(jl,jk))*zdp
1022 if ( llo1 .and. jk >= kcbot(jl) ) then
1023 if((paph(jl,klev+1)-paph(jl,kdpl(jl)))<50.e2) then
1024 zdp = paph(jl,jk+1)-paph(jl,jk)
1025 zcape2(jl) = zcape2(jl) + ztaubl(jl)* &
1026 ((1.+vtmpc1*pqen(jl,jk))*ptte(jl,jk)+vtmpc1*pten(jl,jk)*pqte(jl,jk))*zdp
1033 if(ldcum(jl).and.ktype(jl).eq.1) then
1036 ztauc(jl) = max(ztmst,ztauc(jl))
1037 ztauc(jl) = max(360.,ztauc(jl))
1038 ztauc(jl) = min(10800.,ztauc(jl))
1039 ztau = ztauc(jl) * scale_fac(jl)
1041 zcape2(jl)= max(0.,zcape2(jl))
1042 zcape(jl) = max(0.,min(zcape1(jl)-zcape2(jl),5000.))
1044 zcape(jl) = max(0.,min(zcape1(jl),5000.))
1046 zheat(jl) = max(1.e-4,zheat(jl))
1047 zmfub1(jl) = (zcape(jl)*zmfub(jl))/(zheat(jl)*ztau)
1048 zmfub1(jl) = max(zmfub1(jl),0.001)
1049 zmfmax=(paph(jl,ikb)-paph(jl,ikb-1))*zcons2
1050 zmfub1(jl)=min(zmfub1(jl),zmfmax)
1054 !* 6.2 recalculate convective fluxes due to effect of
1055 ! downdrafts on boundary layer moist static energy budget (ktype=2)
1056 !--------------------------------------------------------
1058 if(ldcum(jl) .and. ktype(jl) .eq. 2) then
1060 if(pmfd(jl,ikb).lt.0.0 .and. loddraf(jl)) then
1061 zeps=-pmfd(jl,ikb)/max(zmfub(jl),cmfcmin)
1065 zqumqe=pqu(jl,ikb)+plu(jl,ikb)- &
1066 & zeps*zqd(jl,ikb)-(1.-zeps)*zqenh(jl,ikb)
1067 zdqmin=max(0.01*zqenh(jl,ikb),cmfcmin)
1068 zmfmax=(paph(jl,ikb)-paph(jl,ikb-1))*zcons2
1069 ! using moist static engergy closure instead of moisture closure
1070 zdh=cpd*(ptu(jl,ikb)-zeps*ztd(jl,ikb)- &
1071 & (1.-zeps)*ztenh(jl,ikb))+alv*zqumqe
1072 zdh=g*max(zdh,1.e5*zdqmin)
1073 if(zdhpbl(jl).gt.0.)then
1074 zmfub1(jl)=zdhpbl(jl)/zdh
1076 zmfub1(jl) = zmfub(jl)
1078 zmfub1(jl) = zmfub1(jl)/scale_fac2(jl)
1079 zmfub1(jl) = min(zmfub1(jl),zmfmax)
1082 !* 6.3 mid-level convection - nothing special
1083 !---------------------------------------------------------
1084 if(ldcum(jl) .and. ktype(jl) .eq. 3 ) then
1085 zmfub1(jl) = zmfub(jl)
1090 !* 6.4 scaling the downdraft mass flux
1091 !---------------------------------------------------------
1094 if( ldcum(jl) ) then
1095 zfac=zmfub1(jl)/max(zmfub(jl),cmfcmin)
1096 pmfd(jl,jk)=pmfd(jl,jk)*zfac
1097 zmfds(jl,jk)=zmfds(jl,jk)*zfac
1098 zmfdq(jl,jk)=zmfdq(jl,jk)*zfac
1099 zdmfdp(jl,jk)=zdmfdp(jl,jk)*zfac
1100 pmfdde_rate(jl,jk) = pmfdde_rate(jl,jk)*zfac
1105 !* 6.5 scaling the updraft mass flux
1106 ! --------------------------------------------------------
1108 if ( ldcum(jl) ) zmfs(jl) = zmfub1(jl)/max(cmfcmin,zmfub(jl))
1112 if ( ldcum(jl) .and. jk >= kctop(jl)-1 ) then
1115 zdz = ((paph(jl,klev+1)-paph(jl,jk))/(paph(jl,klev+1)-paph(jl,ikb)))
1116 pmfu(jl,jk) = pmfu(jl,ikb)*zdz
1118 zmfmax = (paph(jl,jk)-paph(jl,jk-1))*zcons2
1119 if ( pmfu(jl,jk)*zmfs(jl) > zmfmax ) then
1120 zmfs(jl) = min(zmfs(jl),zmfmax/pmfu(jl,jk))
1127 if ( ldcum(jl) .and. jk <= kcbot(jl) .and. jk >= kctop(jl)-1 ) then
1128 pmfu(jl,jk) = pmfu(jl,jk)*zmfs(jl)
1129 zmfus(jl,jk) = zmfus(jl,jk)*zmfs(jl)
1130 zmfuq(jl,jk) = zmfuq(jl,jk)*zmfs(jl)
1131 zmful(jl,jk) = zmful(jl,jk)*zmfs(jl)
1132 zdmfup(jl,jk) = zdmfup(jl,jk)*zmfs(jl)
1133 plude(jl,jk) = plude(jl,jk)*zmfs(jl)
1134 pmfude_rate(jl,jk) = pmfude_rate(jl,jk)*zmfs(jl)
1139 !* 6.6 if ktype = 2, kcbot=kctop is not allowed
1140 ! ---------------------------------------------------
1142 if ( ktype(jl) == 2 .and. &
1143 kcbot(jl) == kctop(jl) .and. kcbot(jl) >= klev-1 ) then
1149 if ( .not. lmfscv .or. .not. lmfpen ) then
1152 if ( (.not. lmfscv .and. ktype(jl) == 2) .or. &
1153 (.not. lmfpen .and. ktype(jl) == 1) ) then
1160 !* 6.7 set downdraft mass fluxes to zero above cloud top
1161 !----------------------------------------------------
1163 if ( loddraf(jl) .and. idtop(jl) <= kctop(jl) ) then
1164 idtop(jl) = kctop(jl) + 1
1169 if ( loddraf(jl) ) then
1170 if ( jk < idtop(jl) ) then
1174 pmfdde_rate(jl,jk) = 0.
1176 else if ( jk == idtop(jl) ) then
1177 pmfdde_rate(jl,jk) = 0.
1182 !----------------------------------------------------------
1183 !* 7.0 determine final convective fluxes in 'cuflx'
1184 !----------------------------------------------------------
1186 & ( klon, klev, ztmst &
1187 & , pten, pqen, pqsen, ztenh, zqenh &
1188 & , paph, pap, zgeoh, lndj, ldcum &
1189 & , kcbot, kctop, idtop, itopm2 &
1190 & , ktype, loddraf &
1191 & , pmfu, pmfd, zmfus, zmfds &
1192 & , zmfuq, zmfdq, zmful, plude &
1193 & , zdmfup, zdmfdp, zdpmel, zlglac &
1194 & , prain, pmfdde_rate, pmflxr, pmflxs )
1196 ! some adjustments needed
1203 if ( loddraf(jl) .and. jk >= idtop(jl)-1 ) then
1204 zmfmax = pmfu(jl,jk)*0.98
1205 if ( pmfd(jl,jk)+zmfmax+1.e-15 < 0. ) then
1206 zmfs(jl) = min(zmfs(jl),-zmfmax/pmfd(jl,jk))
1214 if ( zmfs(jl) < 1. .and. jk >= idtop(jl)-1 ) then
1215 pmfd(jl,jk) = pmfd(jl,jk)*zmfs(jl)
1216 zmfds(jl,jk) = zmfds(jl,jk)*zmfs(jl)
1217 zmfdq(jl,jk) = zmfdq(jl,jk)*zmfs(jl)
1218 pmfdde_rate(jl,jk) = pmfdde_rate(jl,jk)*zmfs(jl)
1219 zmfuub(jl) = zmfuub(jl) - (1.-zmfs(jl))*zdmfdp(jl,jk)
1220 pmflxr(jl,jk+1) = pmflxr(jl,jk+1) + zmfuub(jl)
1221 zdmfdp(jl,jk) = zdmfdp(jl,jk)*zmfs(jl)
1226 do jk = 2 , klev - 1
1228 if ( loddraf(jl) .and. jk >= idtop(jl)-1 ) then
1229 zerate = -pmfd(jl,jk) + pmfd(jl,jk-1) + pmfdde_rate(jl,jk)
1230 if ( zerate < 0. ) then
1231 pmfdde_rate(jl,jk) = pmfdde_rate(jl,jk) - zerate
1234 if ( ldcum(jl) .and. jk >= kctop(jl)-1 ) then
1235 zerate = pmfu(jl,jk) - pmfu(jl,jk+1) + pmfude_rate(jl,jk)
1236 if ( zerate < 0. ) then
1237 pmfude_rate(jl,jk) = pmfude_rate(jl,jk) - zerate
1239 zdmfup(jl,jk) = pmflxr(jl,jk+1) + pmflxs(jl,jk+1) - &
1240 pmflxr(jl,jk) - pmflxs(jl,jk)
1246 ! avoid negative humidities at ddraught top
1248 if ( loddraf(jl) ) then
1251 if ( zmfdq(jl,jk) < 0.3*zmfdq(jl,ik) ) then
1252 zmfdq(jl,jk) = 0.3*zmfdq(jl,ik)
1257 ! avoid negative humidities near cloud top because gradient of precip flux
1258 ! and detrainment / liquid water flux are too large
1261 if ( ldcum(jl) .and. jk >= kctop(jl)-1 .and. jk < kcbot(jl) ) then
1262 zdz = ztmst*g/(paph(jl,jk+1)-paph(jl,jk))
1263 zmfa = zmfuq(jl,jk+1) + zmfdq(jl,jk+1) - &
1264 zmfuq(jl,jk) - zmfdq(jl,jk) + &
1265 zmful(jl,jk+1) - zmful(jl,jk) + zdmfup(jl,jk)
1266 zmfa = (zmfa-plude(jl,jk))*zdz
1267 if ( pqen(jl,jk)+zmfa < 0. ) then
1268 plude(jl,jk) = plude(jl,jk) + 2.*(pqen(jl,jk)+zmfa)/zdz
1270 if ( plude(jl,jk) < 0. ) plude(jl,jk) = 0.
1272 if ( .not. ldcum(jl) ) pmfude_rate(jl,jk) = 0.
1273 if ( abs(pmfd(jl,jk-1)) < 1.0e-20 ) pmfdde_rate(jl,jk) = 0.
1278 prsfc(jl) = pmflxr(jl,klev+1)
1279 pssfc(jl) = pmflxs(jl,klev+1)
1282 !----------------------------------------------------------------
1283 !* 8.0 update tendencies for t and q in subroutine cudtdq
1284 !----------------------------------------------------------------
1285 call cudtdqn(klon,klev,itopm2,kctop,idtop,ldcum,loddraf, &
1286 ztmst,paph,zgeoh,pgeo,pten,ztenh,pqen,zqenh,pqsen, &
1287 zlglac,plude,pmfu,pmfd,zmfus,zmfds,zmfuq,zmfdq,zmful, &
1288 zdmfup,zdmfdp,zdpmel,ptte,pqte,pcte)
1289 !----------------------------------------------------------------
1290 !* 9.0 update tendencies for u and u in subroutine cududv
1291 !----------------------------------------------------------------
1293 do jk = klev-1 , 2 , -1
1296 if ( ldcum(jl) ) then
1297 if ( jk == kcbot(jl) .and. ktype(jl) < 3 ) then
1299 zuu(jl,jk) = puen(jl,ikb-1)
1300 zvu(jl,jk) = pven(jl,ikb-1)
1301 else if ( jk == kcbot(jl) .and. ktype(jl) == 3 ) then
1302 zuu(jl,jk) = puen(jl,jk-1)
1303 zvu(jl,jk) = pven(jl,jk-1)
1305 if ( jk < kcbot(jl) .and. jk >= kctop(jl) ) then
1306 if(momtrans .eq. 1)then
1308 if ( ktype(jl) == 1 .or. ktype(jl) == 3 ) zfac = 2.
1309 if ( ktype(jl) == 1 .and. jk <= kctop(jl)+2 ) zfac = 3.
1310 zerate = pmfu(jl,jk) - pmfu(jl,ik) + &
1311 (1.+zfac)*pmfude_rate(jl,jk)
1312 zderate = (1.+zfac)*pmfude_rate(jl,jk)
1313 zmfa = 1./max(cmfcmin,pmfu(jl,jk))
1314 zuu(jl,jk) = (zuu(jl,ik)*pmfu(jl,ik) + &
1315 zerate*puen(jl,jk)-zderate*zuu(jl,ik))*zmfa
1316 zvu(jl,jk) = (zvu(jl,ik)*pmfu(jl,ik) + &
1317 zerate*pven(jl,jk)-zderate*zvu(jl,ik))*zmfa
1319 pgf_u = -pgcoef*0.5*(pmfu(jl,ik)*(puen(jl,ik)-puen(jl,jk))+&
1320 pmfu(jl,jk)*(puen(jl,jk)-puen(jl,jk-1)))
1321 pgf_v = -pgcoef*0.5*(pmfu(jl,ik)*(pven(jl,ik)-pven(jl,jk))+&
1322 pmfu(jl,jk)*(pven(jl,jk)-pven(jl,jk-1)))
1323 zerate = pmfu(jl,jk) - pmfu(jl,ik) + pmfude_rate(jl,jk)
1324 zderate = pmfude_rate(jl,jk)
1325 zmfa = 1./max(cmfcmin,pmfu(jl,jk))
1326 zuu(jl,jk) = (zuu(jl,ik)*pmfu(jl,ik) + &
1327 zerate*puen(jl,jk)-zderate*zuu(jl,ik)+pgf_u)*zmfa
1328 zvu(jl,jk) = (zvu(jl,ik)*pmfu(jl,ik) + &
1329 zerate*pven(jl,jk)-zderate*zvu(jl,ik)+pgf_v)*zmfa
1340 if ( ldcum(jl) ) then
1341 if ( jk == idtop(jl) ) then
1342 zud(jl,jk) = 0.5*(zuu(jl,jk)+puen(jl,ik))
1343 zvd(jl,jk) = 0.5*(zvu(jl,jk)+pven(jl,ik))
1344 else if ( jk > idtop(jl) ) then
1345 zerate = -pmfd(jl,jk) + pmfd(jl,ik) + pmfdde_rate(jl,jk)
1346 zmfa = 1./min(-cmfcmin,pmfd(jl,jk))
1347 zud(jl,jk) = (zud(jl,ik)*pmfd(jl,ik) - &
1348 zerate*puen(jl,ik)+pmfdde_rate(jl,jk)*zud(jl,ik))*zmfa
1349 zvd(jl,jk) = (zvd(jl,ik)*pmfd(jl,ik) - &
1350 zerate*pven(jl,ik)+pmfdde_rate(jl,jk)*zvd(jl,ik))*zmfa
1356 ! --------------------------------------------------
1357 ! rescale massfluxes for stability in Momentum
1358 !------------------------------------------------------------------------
1362 if ( ldcum(jl) .and. jk >= kctop(jl)-1 ) then
1363 zmfmax = (paph(jl,jk)-paph(jl,jk-1))*zcons
1364 if ( pmfu(jl,jk) > zmfmax .and. jk >= kctop(jl) ) then
1365 zmfs(jl) = min(zmfs(jl),zmfmax/pmfu(jl,jk))
1372 zmfuus(jl,jk) = pmfu(jl,jk)
1373 zmfdus(jl,jk) = pmfd(jl,jk)
1374 if ( ldcum(jl) .and. jk >= kctop(jl)-1 ) then
1375 zmfuus(jl,jk) = pmfu(jl,jk)*zmfs(jl)
1376 zmfdus(jl,jk) = pmfd(jl,jk)*zmfs(jl)
1380 !* 9.1 update u and v in subroutine cududvn
1381 !-------------------------------------------------------------------
1384 ztenu(jl,jk) = pvom(jl,jk)
1385 ztenv(jl,jk) = pvol(jl,jk)
1389 call cududvn(klon,klev,itopm2,ktype,kcbot,kctop, &
1390 ldcum,ztmst,paph,puen,pven,zmfuus,zmfdus,zuu, &
1391 zud,zvu,zvd,pvom,pvol)
1393 ! calculate KE dissipation
1401 if ( ldcum(jl) .and. jk >= kctop(jl)-1 ) then
1402 zdz = (paph(jl,jk+1)-paph(jl,jk))
1403 zduten = pvom(jl,jk) - ztenu(jl,jk)
1404 zdvten = pvol(jl,jk) - ztenv(jl,jk)
1405 zuv2(jl,jk) = sqrt(zduten**2+zdvten**2)
1406 zsum22(jl) = zsum22(jl) + zuv2(jl,jk)*zdz
1407 zsum12(jl) = zsum12(jl) - &
1408 (puen(jl,jk)*zduten+pven(jl,jk)*zdvten)*zdz
1414 if ( ldcum(jl) .and. jk>=kctop(jl)-1 ) then
1415 ztdis = rcpd*zsum12(jl)*zuv2(jl,jk)/max(1.e-15,zsum22(jl))
1416 ptte(jl,jk) = ptte(jl,jk) + ztdis
1423 !----------------------------------------------------------------------
1424 !* 10. IN CASE THAT EITHER DEEP OR SHALLOW IS SWITCHED OFF
1425 ! NEED TO SET SOME VARIABLES A POSTERIORI TO ZERO
1426 ! ---------------------------------------------------
1427 if ( .not. lmfscv .or. .not. lmfpen ) then
1430 if ( llo2(jl) .and. jk >= kctop(jl)-1 ) then
1431 ptu(jl,jk) = pten(jl,jk)
1432 pqu(jl,jk) = pqen(jl,jk)
1434 pmfude_rate(jl,jk) = 0.
1435 pmfdde_rate(jl,jk) = 0.
1440 if ( llo2(jl) ) then
1441 kctop(jl) = klev - 1
1442 kcbot(jl) = klev - 1
1448 end subroutine cumastrn
1450 !**********************************************
1451 ! level 3 subroutine cuinin
1452 !**********************************************
1455 & (klon, klev, klevp1, klevm1, pten,&
1456 & pqen, pqsen, puen, pven, pverv,&
1457 & pgeo, paph, pgeoh, ptenh, pqenh,&
1458 & pqsenh, klwmin, ptu, pqu, ptd,&
1459 & pqd, puu, pvu, pud, pvd,&
1460 & pmfu, pmfd, pmfus, pmfds, pmfuq,&
1461 & pmfdq, pdmfup, pdmfdp, pdpmel, plu,&
1464 ! m.tiedtke e.c.m.w.f. 12/89
1467 ! this routine interpolates large-scale fields of t,q etc.
1468 ! to half levels (i.e. grid for massflux scheme),
1469 ! and initializes values for updrafts and downdrafts
1472 ! this routine is called from *cumastr*.
1475 ! for extrapolation to half levels see tiedtke(1989)
1478 ! *cuadjtq* to specify qs at half levels
1479 ! ----------------------------------------------------------------
1480 integer klon,klev,klevp1,klevm1
1481 real pten(klon,klev), pqen(klon,klev),&
1482 & puen(klon,klev), pven(klon,klev),&
1483 & pqsen(klon,klev), pverv(klon,klev),&
1484 & pgeo(klon,klev), pgeoh(klon,klevp1),&
1485 & paph(klon,klevp1), ptenh(klon,klev),&
1486 & pqenh(klon,klev), pqsenh(klon,klev)
1487 real ptu(klon,klev), pqu(klon,klev),&
1488 & ptd(klon,klev), pqd(klon,klev),&
1489 & puu(klon,klev), pud(klon,klev),&
1490 & pvu(klon,klev), pvd(klon,klev),&
1491 & pmfu(klon,klev), pmfd(klon,klev),&
1492 & pmfus(klon,klev), pmfds(klon,klev),&
1493 & pmfuq(klon,klev), pmfdq(klon,klev),&
1494 & pdmfup(klon,klev), pdmfdp(klon,klev),&
1495 & plu(klon,klev), plude(klon,klev)
1496 real zwmax(klon), zph(klon), &
1498 integer klab(klon,klev), klwmin(klon)
1499 logical loflag(klon)
1504 !------------------------------------------------------------
1505 !* 1. specify large scale parameters at half levels
1506 !* adjust temperature fields if staticly unstable
1507 !* find level of maximum vertical velocity
1508 ! -----------------------------------------------------------
1511 ptenh(jl,jk)=(max(cpd*pten(jl,jk-1)+pgeo(jl,jk-1), &
1512 & cpd*pten(jl,jk)+pgeo(jl,jk))-pgeoh(jl,jk))*rcpd
1513 pqenh(jl,jk) = pqen(jl,jk-1)
1514 pqsenh(jl,jk)= pqsen(jl,jk-1)
1519 if ( jk >= klev-1 .or. jk < 2 ) cycle
1522 call cuadjtqn(klon,klev,ik,zph,ptenh,pqsenh,loflag,icall)
1524 pqenh(jl,jk)=min(pqen(jl,jk-1),pqsen(jl,jk-1)) &
1525 & +(pqsenh(jl,jk)-pqsen(jl,jk-1))
1526 pqenh(jl,jk)=max(pqenh(jl,jk),0.)
1531 ptenh(jl,klev)=(cpd*pten(jl,klev)+pgeo(jl,klev)- &
1532 & pgeoh(jl,klev))*rcpd
1533 pqenh(jl,klev)=pqen(jl,klev)
1534 ptenh(jl,1)=pten(jl,1)
1535 pqenh(jl,1)=pqen(jl,1)
1542 zzs=max(cpd*ptenh(jl,jk)+pgeoh(jl,jk), &
1543 & cpd*ptenh(jl,jk+1)+pgeoh(jl,jk+1))
1544 ptenh(jl,jk)=(zzs-pgeoh(jl,jk))*rcpd
1550 if(pverv(jl,jk).lt.zwmax(jl)) then
1551 zwmax(jl)=pverv(jl,jk)
1556 !-----------------------------------------------------------
1557 !* 2.0 initialize values for updrafts and downdrafts
1558 !-----------------------------------------------------------
1563 ptu(jl,jk)=ptenh(jl,jk)
1564 ptd(jl,jk)=ptenh(jl,jk)
1565 pqu(jl,jk)=pqenh(jl,jk)
1566 pqd(jl,jk)=pqenh(jl,jk)
1568 puu(jl,jk)=puen(jl,ik)
1569 pud(jl,jk)=puen(jl,ik)
1570 pvu(jl,jk)=pven(jl,ik)
1571 pvd(jl,jk)=pven(jl,ik)
1576 end subroutine cuinin
1578 !---------------------------------------------------------
1579 ! level 3 souroutines
1580 !--------------------------------------------------------
1581 subroutine cutypen &
1582 & ( klon, klev, klevp1, klevm1, pqen,&
1583 & ptenh, pqenh, pqsenh, pgeoh, paph,&
1584 & hfx, qfx, pgeo, pqsen, pap,&
1585 & pten, lndj, cutu, cuqu, culab,&
1586 & ldcum, cubot, cutop, ktype, wbase, culu, kdpl )
1587 ! zhang & wang iprc 2011-2013
1590 ! to produce first guess updraught for cu-parameterizations
1591 ! calculates condensation level, and sets updraught base variables and
1592 ! first guess cloud type
1595 ! this routine is called from *cumastr*.
1596 ! input are environm. values of t,q,p,phi at half levels.
1597 ! it returns cloud types as follows;
1598 ! ktype=1 for deep cumulus
1599 ! ktype=2 for shallow cumulus
1602 ! based on a simplified updraught equation
1603 ! partial(hup)/partial(z)=eta(h - hup)
1604 ! eta is the entrainment rate for test parcel
1605 ! h stands for dry static energy or the total water specific humidity
1606 ! references: christian jakob, 2003: a new subcloud model for
1607 ! mass-flux convection schemes
1608 ! influence on triggering, updraft properties, and model
1609 ! climate, mon.wea.rev.
1612 ! ifs documentation - cy36r1,cy38r1
1613 !***input variables:
1614 ! ptenh [ztenh] - environment temperature on half levels. (cuini)
1615 ! pqenh [zqenh] - env. specific humidity on half levels. (cuini)
1616 ! pgeoh [zgeoh] - geopotential on half levels, (mssflx)
1617 ! paph - pressure of half levels. (mssflx)
1618 ! rho - density of the lowest model level
1619 ! qfx - net upward moisture flux at the surface (kg/m^2/s)
1620 ! hfx - net upward heat flux at the surface (w/m^2)
1621 !***variables output by cutype:
1622 ! ktype - convection type - 1: penetrative (cumastr)
1623 ! 2: stratocumulus (cumastr)
1624 ! 3: mid-level (cuasc)
1625 ! information for updraft parcel (ptu,pqu,plu,kcbot,klab,kdpl...)
1626 ! ----------------------------------------------------------------
1627 !-------------------------------------------------------------------
1629 !-------------------------------------------------------------------
1630 integer klon, klev, klevp1, klevm1
1631 real ptenh(klon,klev), pqenh(klon,klev),&
1632 & pqsen(klon,klev), pqsenh(klon,klev),&
1633 & pgeoh(klon,klevp1), paph(klon,klevp1),&
1634 & pap(klon,klev), pqen(klon,klev)
1635 real pten(klon,klev)
1636 real ptu(klon,klev),pqu(klon,klev),plu(klon,klev)
1637 real pgeo(klon,klev)
1638 integer klab(klon,klev)
1639 integer kctop(klon),kcbot(klon)
1641 real qfx(klon),hfx(klon)
1644 logical loflag(klon), deepflag(klon), resetflag(klon)
1647 real cutu(klon,klev), cuqu(klon,klev), culu(klon,klev)
1648 integer culab(klon,klev)
1650 integer ktype(klon),cubot(klon),cutop(klon),kdpl(klon)
1655 real rho, part1, part2, root, conw, deltt, deltq
1656 real eta(klon),dz(klon),coef(klon)
1657 real dhen(klon,klev), dh(klon,klev)
1658 real plude(klon,klev)
1660 real vptu(klon,klev),vten(klon,klev)
1661 real zbuo(klon,klev),abuoy(klon,klev)
1664 real fscale,crirh1,pp
1665 real atop1,atop2,abot
1666 real tmix,zmix,qmix,pmix
1668 integer nk,is,ikb,ikt
1670 real zqsu,zcor,zdp,zesdp,zalfaw,zfacw,zfaci,zfac,zdsdp,zdqsdt,zdtdp
1671 real zpdifftop, zpdiffbot
1672 integer zcbase(klon), itoppacel(klon)
1673 integer jl,jk,ik,icall,levels
1674 logical needreset, lldcum(klon)
1675 !--------------------------------------------------------------
1685 !-----------------------------------------------------------
1686 ! let's do test,and check the shallow convection first
1687 ! the first level is klev
1688 ! define deltat and deltaq
1689 !-----------------------------------------------------------
1692 plu(jl,jk)=culu(jl,jk) ! parcel liquid water
1693 ptu(jl,jk)=cutu(jl,jk) ! parcel temperature
1694 pqu(jl,jk)=cuqu(jl,jk) ! parcel specific humidity
1695 klab(jl,jk)=culab(jl,jk)
1696 dh(jl,jk)=0.0 ! parcel dry static energy
1697 dhen(jl,jk)=0.0 ! environment dry static energy
1698 kup(jl,jk)=0.0 ! updraught kinetic energy for parcel
1699 vptu(jl,jk)=0.0 ! parcel virtual temperature considering water-loading
1700 vten(jl,jk)=0.0 ! environment virtual temperature
1701 zbuo(jl,jk)=0.0 ! parcel buoyancy
1708 lldcum(jl) = .false.
1712 ! check the levels from lowest level to second top level
1715 ! define the variables at the first level
1716 if(jk .eq. klevm1) then
1719 & (rd*(pten(jl,klev)*(1.+vtmpc1*pqen(jl,klev))))
1720 part1 = 1.5*0.4*pgeo(jl,klev)/ &
1721 & (rho*pten(jl,klev))
1722 part2 = -hfx(jl)*rcpd-vtmpc1*pten(jl,klev)*qfx(jl)
1723 root = 0.001-part1*part2
1724 if(part2 .lt. 0.) then
1725 conw = 1.2*(root)**t13
1726 deltt = max(1.5*hfx(jl)/(rho*cpd*conw),0.)
1727 deltq = max(1.5*qfx(jl)/(rho*conw),0.)
1728 kup(jl,klev) = 0.5*(conw**2)
1729 pqu(jl,klev)= pqenh(jl,klev) + deltq
1730 dhen(jl,klev)= pgeoh(jl,klev) + ptenh(jl,klev)*cpd
1731 dh(jl,klev) = dhen(jl,klev) + deltt*cpd
1732 ptu(jl,klev) = (dh(jl,klev)-pgeoh(jl,klev))*rcpd
1733 vptu(jl,klev)=ptu(jl,klev)*(1.+vtmpc1*pqu(jl,klev))
1734 vten(jl,klev)=ptenh(jl,klev)*(1.+vtmpc1*pqenh(jl,klev))
1735 zbuo(jl,klev)=(vptu(jl,klev)-vten(jl,klev))/vten(jl,klev)
1738 loflag(jl) = .false.
1751 ! the next levels, we use the variables at the first level as initial values
1754 eta(jl) = 0.8/(pgeo(jl,jk)*zrg)+2.e-4
1755 dz(jl) = (pgeoh(jl,jk)-pgeoh(jl,jk+1))*zrg
1756 coef(jl)= 0.5*eta(jl)*dz(jl)
1757 dhen(jl,jk) = pgeoh(jl,jk) + cpd*ptenh(jl,jk)
1758 dh(jl,jk) = (coef(jl)*(dhen(jl,jk+1)+dhen(jl,jk))&
1759 & +(1.-coef(jl))*dh(jl,jk+1))/(1.+coef(jl))
1760 pqu(jl,jk) =(coef(jl)*(pqenh(jl,jk+1)+pqenh(jl,jk))&
1761 & +(1.-coef(jl))*pqu(jl,jk+1))/(1.+coef(jl))
1762 ptu(jl,jk) = (dh(jl,jk)-pgeoh(jl,jk))*rcpd
1763 zqold(jl) = pqu(jl,jk)
1767 ! check if the parcel is saturated
1770 call cuadjtqn(klon,klev,ik,zph,ptu,pqu,loflag,icall)
1772 if( loflag(jl) ) then
1773 zdq = max((zqold(jl) - pqu(jl,jk)),0.)
1774 plu(jl,jk) = plu(jl,jk+1) + zdq
1775 zlglac=zdq*((1.-foealfa(ptu(jl,jk))) - &
1776 (1.-foealfa(ptu(jl,jk+1))))
1777 plu(jl,jk) = min(plu(jl,jk),5.e-3)
1778 dh(jl,jk) = pgeoh(jl,jk) + cpd*(ptu(jl,jk)+ralfdcp*zlglac)
1779 ! compute the updraft speed
1780 vptu(jl,jk) = ptu(jl,jk)*(1.+vtmpc1*pqu(jl,jk)-plu(jl,jk))+&
1782 vten(jl,jk) = ptenh(jl,jk)*(1.+vtmpc1*pqenh(jl,jk))
1783 zbuo(jl,jk) = (vptu(jl,jk) - vten(jl,jk))/vten(jl,jk)
1784 abuoy(jl,jk)=(zbuo(jl,jk)+zbuo(jl,jk+1))*0.5*g
1785 atop1 = 1.0 - 2.*coef(jl)
1786 atop2 = 2.0*dz(jl)*abuoy(jl,jk)
1787 abot = 1.0 + 2.*coef(jl)
1788 kup(jl,jk) = (atop1*kup(jl,jk+1) + atop2) / abot
1790 ! let's find the exact cloud base
1791 if ( plu(jl,jk) > 0. .and. klab(jl,jk+1) == 1 ) then
1793 zqsu = foeewm(ptu(jl,ik))/paph(jl,ik)
1794 zqsu = min(0.5,zqsu)
1795 zcor = 1./(1.-vtmpc1*zqsu)
1797 zdq = min(0.,pqu(jl,ik)-zqsu)
1798 zalfaw = foealfa(ptu(jl,ik))
1799 zfacw = c5les/((ptu(jl,ik)-c4les)**2)
1800 zfaci = c5ies/((ptu(jl,ik)-c4ies)**2)
1801 zfac = zalfaw*zfacw + (1.-zalfaw)*zfaci
1802 zesdp = foeewm(ptu(jl,ik))/paph(jl,ik)
1803 zcor = 1./(1.-vtmpc1*zesdp)
1804 zdqsdt = zfac*zcor*zqsu
1805 zdtdp = rd*ptu(jl,ik)/(cpd*paph(jl,ik))
1806 zdp = zdq/(zdqsdt*zdtdp)
1807 zcbase(jl) = paph(jl,ik) + zdp
1808 ! chose nearest half level as cloud base (jk or jk+1)
1809 zpdifftop = zcbase(jl) - paph(jl,jk)
1810 zpdiffbot = paph(jl,jk+1) - zcbase(jl)
1811 if ( zpdifftop > zpdiffbot .and. kup(jl,jk+1) > 0. ) then
1812 ikb = min(klev-1,jk+1)
1816 plu(jl,jk+1) = 1.0e-8
1817 else if ( zpdifftop <= zpdiffbot .and.kup(jl,jk) > 0. ) then
1823 if(kup(jl,jk) .lt. 0.)then
1824 loflag(jl) = .false.
1825 if(plu(jl,jk+1) .gt. 0.) then
1829 lldcum(jl) = .false.
1832 if(plu(jl,jk) .gt. 0.)then
1841 end do ! end all the levels
1846 if(paph(jl,ikb) - paph(jl,ikt) > zdnoprc) lldcum(jl) = .false.
1850 wbase(jl) = sqrt(max(2.*kup(jl,ikb),0.))
1867 culab(jl,jk) = klab(jl,jk)
1868 cutu(jl,jk) = ptu(jl,jk)
1869 cuqu(jl,jk) = pqu(jl,jk)
1870 culu(jl,jk) = plu(jl,jk)
1875 !-----------------------------------------------------------
1876 ! next, let's check the deep convection
1877 ! the first level is klevm1-1
1878 ! define deltat and deltaq
1879 !----------------------------------------------------------
1880 ! we check the parcel starting level by level
1881 ! assume the mix-layer is 60hPa
1885 deepflag(jl) = .false.
1890 if((paph(jl,klev+1)-paph(jl,jk)) .lt. 350.e2) itoppacel(jl) = jk
1894 do levels=klevm1-1,klev/2+1,-1 ! loop starts
1897 plu(jl,jk)=0.0 ! parcel liquid water
1898 ptu(jl,jk)=0.0 ! parcel temperature
1899 pqu(jl,jk)=0.0 ! parcel specific humidity
1900 dh(jl,jk)=0.0 ! parcel dry static energy
1901 dhen(jl,jk)=0.0 ! environment dry static energy
1902 kup(jl,jk)=0.0 ! updraught kinetic energy for parcel
1903 vptu(jl,jk)=0.0 ! parcel virtual temperature consideringwater-loading
1904 vten(jl,jk)=0.0 ! environment virtual temperature
1915 lldcum(jl) = .false.
1916 resetflag(jl)= .false.
1917 loflag(jl) = (.not. deepflag(jl)) .and. (levels.ge.itoppacel(jl))
1920 ! start the inner loop to search the deep convection points
1930 ! define the variables at the departure level
1931 if(jk .eq. levels) then
1934 if((paph(jl,klev+1)-paph(jl,jk)) < 60.e2) then
1940 if(pmix < 50.e2) then
1941 dp = paph(jl,nk) - paph(jl,nk-1)
1942 tmix=tmix+dp*ptenh(jl,nk)
1943 qmix=qmix+dp*pqenh(jl,nk)
1944 zmix=zmix+dp*pgeoh(jl,nk)
1957 pqu(jl,jk+1) = qmix + deltq
1958 dhen(jl,jk+1)= zmix + tmix*cpd
1959 dh(jl,jk+1) = dhen(jl,jk+1) + deltt*cpd
1960 ptu(jl,jk+1) = (dh(jl,jk+1)-pgeoh(jl,jk+1))*rcpd
1963 vptu(jl,jk+1)=ptu(jl,jk+1)*(1.+vtmpc1*pqu(jl,jk+1))
1964 vten(jl,jk+1)=ptenh(jl,jk+1)*(1.+vtmpc1*pqenh(jl,jk+1))
1965 zbuo(jl,jk+1)=(vptu(jl,jk+1)-vten(jl,jk+1))/vten(jl,jk+1)
1970 ! the next levels, we use the variables at the first level as initial values
1974 fscale = min(1.,(pqsen(jl,jk)/pqsen(jl,levels))**3)
1975 eta(jl) = 1.75e-3*fscale
1976 dz(jl) = (pgeoh(jl,jk)-pgeoh(jl,jk+1))*zrg
1977 coef(jl)= 0.5*eta(jl)*dz(jl)
1978 dhen(jl,jk) = pgeoh(jl,jk) + cpd*ptenh(jl,jk)
1979 dh(jl,jk) = (coef(jl)*(dhen(jl,jk+1)+dhen(jl,jk))&
1980 & +(1.-coef(jl))*dh(jl,jk+1))/(1.+coef(jl))
1981 pqu(jl,jk) =(coef(jl)*(pqenh(jl,jk+1)+pqenh(jl,jk))&
1982 & +(1.-coef(jl))*pqu(jl,jk+1))/(1.+coef(jl))
1983 ptu(jl,jk) = (dh(jl,jk)-pgeoh(jl,jk))*rcpd
1984 zqold(jl) = pqu(jl,jk)
1988 ! check if the parcel is saturated
1991 call cuadjtqn(klon,klev,ik,zph,ptu,pqu,loflag,icall)
1994 if( loflag(jl) ) then
1995 zdq = max((zqold(jl) - pqu(jl,jk)),0.)
1996 plu(jl,jk) = plu(jl,jk+1) + zdq
1997 zlglac=zdq*((1.-foealfa(ptu(jl,jk))) - &
1998 (1.-foealfa(ptu(jl,jk+1))))
1999 plu(jl,jk) = 0.5*plu(jl,jk)
2000 dh(jl,jk) = pgeoh(jl,jk) + cpd*(ptu(jl,jk)+ralfdcp*zlglac)
2001 ! compute the updraft speed
2002 vptu(jl,jk) = ptu(jl,jk)*(1.+vtmpc1*pqu(jl,jk)-plu(jl,jk))+&
2004 vten(jl,jk) = ptenh(jl,jk)*(1.+vtmpc1*pqenh(jl,jk))
2005 zbuo(jl,jk) = (vptu(jl,jk) - vten(jl,jk))/vten(jl,jk)
2006 abuoy(jl,jk)=(zbuo(jl,jk)+zbuo(jl,jk+1))*0.5*g
2007 atop1 = 1.0 - 2.*coef(jl)
2008 atop2 = 2.0*dz(jl)*abuoy(jl,jk)
2009 abot = 1.0 + 2.*coef(jl)
2010 kup(jl,jk) = (atop1*kup(jl,jk+1) + atop2) / abot
2011 ! let's find the exact cloud base
2012 if ( plu(jl,jk) > 0. .and. klab(jl,jk+1) == 1 ) then
2014 zqsu = foeewm(ptu(jl,ik))/paph(jl,ik)
2015 zqsu = min(0.5,zqsu)
2016 zcor = 1./(1.-vtmpc1*zqsu)
2018 zdq = min(0.,pqu(jl,ik)-zqsu)
2019 zalfaw = foealfa(ptu(jl,ik))
2020 zfacw = c5les/((ptu(jl,ik)-c4les)**2)
2021 zfaci = c5ies/((ptu(jl,ik)-c4ies)**2)
2022 zfac = zalfaw*zfacw + (1.-zalfaw)*zfaci
2023 zesdp = foeewm(ptu(jl,ik))/paph(jl,ik)
2024 zcor = 1./(1.-vtmpc1*zesdp)
2025 zdqsdt = zfac*zcor*zqsu
2026 zdtdp = rd*ptu(jl,ik)/(cpd*paph(jl,ik))
2027 zdp = zdq/(zdqsdt*zdtdp)
2028 zcbase(jl) = paph(jl,ik) + zdp
2029 ! chose nearest half level as cloud base (jk or jk+1)
2030 zpdifftop = zcbase(jl) - paph(jl,jk)
2031 zpdiffbot = paph(jl,jk+1) - zcbase(jl)
2032 if ( zpdifftop > zpdiffbot .and. kup(jl,jk+1) > 0. ) then
2033 ikb = min(klev-1,jk+1)
2037 plu(jl,jk+1) = 1.0e-8
2038 else if ( zpdifftop <= zpdiffbot .and.kup(jl,jk) > 0. ) then
2044 if(kup(jl,jk) .lt. 0.)then
2045 loflag(jl) = .false.
2046 if(plu(jl,jk+1) .gt. 0.) then
2050 lldcum(jl) = .false.
2053 if(plu(jl,jk) .gt. 0.)then
2062 end do ! end all the levels
2068 if(paph(jl,ikb) - paph(jl,ikt) < zdnoprc) lldcum(jl) = .false.
2072 deepflag(jl) = .true.
2073 wbase(jl) = sqrt(max(2.*kup(jl,ikb),0.))
2078 resetflag(jl)= .true.
2085 if(resetflag(jl)) then
2088 if(jk .le. ikb .and. jk .ge. ikt )then
2089 culab(jl,jk) = klab(jl,jk)
2090 cutu(jl,jk) = ptu(jl,jk)
2091 cuqu(jl,jk) = pqu(jl,jk)
2092 culu(jl,jk) = plu(jl,jk)
2095 cutu(jl,jk) = ptenh(jl,jk)
2096 cuqu(jl,jk) = pqenh(jl,jk)
2099 if ( jk .lt. ikt ) culab(jl,jk) = 0
2105 end do ! end all cycles
2108 end subroutine cutypen
2110 !-----------------------------------------------------------------
2111 ! level 3 subroutines 'cuascn'
2112 !-----------------------------------------------------------------
2114 & (klon, klev, klevp1, klevm1, ptenh,&
2115 & pqenh, puen, pven, pten, pqen,&
2116 & pqsen, pgeo, pgeoh, pap, paph,&
2117 & pqte, pverv, klwmin, ldcum, phcbase,&
2118 & ktype, klab, ptu, pqu, plu,&
2119 & puu, pvu, pmfu, pmfub, &
2120 & pmfus, pmfuq, pmful, plude, pdmfup,&
2121 & kcbot, kctop, kctop0, kcum, ztmst,&
2122 & pqsenh, plglac, lndj, wup, wbase, kdpl, pmfude_rate)
2124 ! this routine does the calculations for cloud ascents
2125 ! for cumulus parameterization
2126 ! m.tiedtke e.c.m.w.f. 7/86 modif. 12/89
2127 ! y.wang iprc 11/01 modif.
2128 ! c.zhang iprc 05/12 modif.
2131 ! to produce cloud ascents for cu-parametrization
2132 ! (vertical profiles of t,q,l,u and v and corresponding
2133 ! fluxes as well as precipitation rates)
2136 ! this routine is called from *cumastr*.
2139 ! lift surface air dry-adiabatically to cloud base
2140 ! and then calculate moist ascent for
2141 ! entraining/detraining plume.
2142 ! entrainment and detrainment rates differ for
2143 ! shallow and deep cumulus convection.
2144 ! in case there is no penetrative or shallow convection
2145 ! check for possibility of mid level convection
2146 ! (cloud base values calculated in *cubasmc*)
2149 ! *cuadjtqn* adjust t and q due to condensation in ascent
2150 ! *cuentrn* calculate entrainment/detrainment rates
2151 ! *cubasmcn* calculate cloud base values for midlevel convection
2155 !***input variables:
2156 ! ptenh [ztenh] - environ temperature on half levels. (cuini)
2157 ! pqenh [zqenh] - env. specific humidity on half levels. (cuini)
2158 ! puen - environment wind u-component. (mssflx)
2159 ! pven - environment wind v-component. (mssflx)
2160 ! pten - environment temperature. (mssflx)
2161 ! pqen - environment specific humidity. (mssflx)
2162 ! pqsen - environment saturation specific humidity. (mssflx)
2163 ! pgeo - geopotential. (mssflx)
2164 ! pgeoh [zgeoh] - geopotential on half levels, (mssflx)
2165 ! pap - pressure in pa. (mssflx)
2166 ! paph - pressure of half levels. (mssflx)
2167 ! pqte - moisture convergence (delta q/delta t). (mssflx)
2168 ! pverv - large scale vertical velocity (omega). (mssflx)
2169 ! klwmin [ilwmin] - level of minimum omega. (cuini)
2170 ! klab [ilab] - level label - 1: sub-cloud layer.
2171 ! 2: condensation level (cloud base)
2172 ! pmfub [zmfub] - updraft mass flux at cloud base. (cumastr)
2173 !***variables modified by cuasc:
2174 ! ldcum - logical denoting profiles. (cubase)
2175 ! ktype - convection type - 1: penetrative (cumastr)
2176 ! 2: stratocumulus (cumastr)
2177 ! 3: mid-level (cuasc)
2178 ! ptu - cloud temperature.
2179 ! pqu - cloud specific humidity.
2180 ! plu - cloud liquid water (moisture condensed out)
2181 ! puu [zuu] - cloud momentum u-component.
2182 ! pvu [zvu] - cloud momentum v-component.
2183 ! pmfu - updraft mass flux.
2184 ! pmfus [zmfus] - updraft flux of dry static energy. (cubasmc)
2185 ! pmfuq [zmfuq] - updraft flux of specific humidity.
2186 ! pmful [zmful] - updraft flux of cloud liquid water.
2187 ! plude - liquid water returned to environment by detrainment.
2189 ! kcbot - cloud base level. (cubase)
2190 ! kctop - cloud top level
2191 ! kctop0 [ictop0] - estimate of cloud top. (cumastr)
2192 ! kcum [icum] - flag to control the call
2194 integer klev,klon,klevp1,klevm1
2195 real ptenh(klon,klev), pqenh(klon,klev), &
2196 & puen(klon,klev), pven(klon,klev),&
2197 & pten(klon,klev), pqen(klon,klev),&
2198 & pgeo(klon,klev), pgeoh(klon,klevp1),&
2199 & pap(klon,klev), paph(klon,klevp1),&
2200 & pqsen(klon,klev), pqte(klon,klev),&
2201 & pverv(klon,klev), pqsenh(klon,klev)
2202 real ptu(klon,klev), pqu(klon,klev),&
2203 & puu(klon,klev), pvu(klon,klev),&
2204 & pmfu(klon,klev), zph(klon),&
2206 & pmfus(klon,klev), pmfuq(klon,klev),&
2207 & plu(klon,klev), plude(klon,klev),&
2208 & pmful(klon,klev), pdmfup(klon,klev)
2209 real zdmfen(klon), zdmfde(klon),&
2210 & zmfuu(klon), zmfuv(klon),&
2211 & zpbase(klon), zqold(klon)
2212 real phcbase(klon), zluold(klon)
2213 real zprecip(klon), zlrain(klon,klev)
2214 real zbuo(klon,klev), kup(klon,klev)
2216 real wbase(klon), zodetr(klon,klev)
2217 real plglac(klon,klev)
2219 real eta(klon),dz(klon)
2221 integer klwmin(klon), ktype(klon),&
2222 & klab(klon,klev), kcbot(klon),&
2223 & kctop(klon), kctop0(klon)
2225 logical ldcum(klon), loflag(klon)
2226 logical llo2,llo3, llo1(klon)
2229 real zoentr(klon), zdpmean(klon)
2230 real pdmfen(klon,klev), pmfude_rate(klon,klev)
2233 integer ikb,icum,itopm2,ik,icall,is,kcum,jlm,jll
2235 real ztmst,zcons2,zfacbuo,zprcdgw,z_cwdrag,z_cldmax,z_cwifrac,z_cprc2
2236 real zmftest,zmfmax,zqeen,zseen,zscde,zqude
2237 real zmfusk,zmfuqk,zmfulk
2238 real zbc,zbe,zkedke,zmfun,zwu,zprcon,zdt,zcbf,zzco
2239 real zlcrit,zdfi,zc,zd,zint,zlnew,zvw,zvi,zalfaw,zrold
2240 real zrnew,zz,zdmfeu,zdmfdu,dp
2241 real zfac,zbuoc,zdkbuo,zdken,zvv,zarg,zchange,zxe,zxs,zdshrd
2242 real atop1,atop2,abot
2243 !--------------------------------
2244 !* 1. specify parameters
2245 !--------------------------------
2247 zfacbuo = 0.5/(1.+0.5)
2248 zprcdgw = cprcon*zrg
2252 z_cwdrag = (3.0/8.0)*0.506/0.2
2253 !---------------------------------
2254 ! 2. set default values
2255 !---------------------------------
2262 if(.not.ldcum(jl)) then
2270 ! initialize variout quantities
2273 if(jk.ne.kcbot(jl)) plu(jl,jk)=0.
2285 pmfude_rate(jl,jk) = 0.
2286 if(.not.ldcum(jl).or.ktype(jl).eq.3) klab(jl,jk)=0
2287 if(.not.ldcum(jl).and.paph(jl,jk).lt.4.e4) kctop0(jl)=jk
2292 if ( ktype(jl) == 3 ) ldcum(jl) = .false.
2294 !------------------------------------------------
2295 ! 3.0 initialize values at cloud base level
2296 !------------------------------------------------
2301 kup(jl,ikb) = 0.5*wbase(jl)**2
2302 pmfu(jl,ikb) = pmfub(jl)
2303 pmfus(jl,ikb) = pmfub(jl)*(cpd*ptu(jl,ikb)+pgeoh(jl,ikb))
2304 pmfuq(jl,ikb) = pmfub(jl)*pqu(jl,ikb)
2305 pmful(jl,ikb) = pmfub(jl)*plu(jl,ikb)
2309 !-----------------------------------------------------------------
2310 ! 4. do ascent: subcloud layer (klab=1) ,clouds (klab=2)
2311 ! by doing first dry-adiabatic ascent and then
2312 ! by adjusting t,q and l accordingly in *cuadjtqn*,
2313 ! then check for buoyancy and set flags accordingly
2314 !-----------------------------------------------------------------
2317 ! specify cloud base values for midlevel convection
2318 ! in *cubasmc* in case there is not already convection
2319 ! ---------------------------------------------------------------------
2322 & (klon, klev, klevm1, ik, pten,&
2323 & pqen, pqsen, puen, pven, pverv,&
2324 & pgeo, pgeoh, ldcum, ktype, klab, zlrain,&
2325 & pmfu, pmfub, kcbot, ptu,&
2326 & pqu, plu, puu, pvu, pmfus,&
2327 & pmfuq, pmful, pdmfup )
2331 loflag(jl) = .false.
2334 is = is + klab(jl,jk+1)
2335 if ( klab(jl,jk+1) == 0 ) klab(jl,jk) = 0
2336 if ( (ldcum(jl) .and. klab(jl,jk+1) == 2) .or. &
2337 (ktype(jl) == 3 .and. klab(jl,jk+1) == 1) ) then
2342 zph(jl) = paph(jl,jk)
2343 if ( ktype(jl) == 3 .and. jk == kcbot(jl) ) then
2344 zmfmax = (paph(jl,jk)-paph(jl,jk-1))*zcons2
2345 if ( pmfub(jl) > zmfmax ) then
2346 zfac = zmfmax/pmfub(jl)
2347 pmfu(jl,jk+1) = pmfu(jl,jk+1)*zfac
2348 pmfus(jl,jk+1) = pmfus(jl,jk+1)*zfac
2349 pmfuq(jl,jk+1) = pmfuq(jl,jk+1)*zfac
2352 pmfub(jl)=min(pmfub(jl),zmfmax)
2356 if(is.gt.0) llo3 = .true.
2358 !* specify entrainment rates in *cuentr*
2359 ! -------------------------------------
2361 call cuentrn(klon,klev,ik,kcbot,ldcum,llo3, &
2362 pgeoh,pmfu,zdmfen,zdmfde)
2364 ! do adiabatic ascent for entraining/detraining plume
2366 ! -------------------------------------------------------
2373 zdmfde(jl) = min(zdmfde(jl),0.75*pmfu(jl,jk+1))
2374 if ( jk == kcbot(jl) ) then
2375 zoentr(jl) = -1.75e-3*(min(1.,pqen(jl,jk)/pqsen(jl,jk)) - &
2376 1.)*(pgeoh(jl,jk)-pgeoh(jl,jk+1))*zrg
2377 zoentr(jl) = min(0.4,zoentr(jl))*pmfu(jl,jk+1)
2379 if ( jk < kcbot(jl) ) then
2380 zmfmax = (paph(jl,jk)-paph(jl,jk-1))*zcons2
2381 zxs = max(pmfu(jl,jk+1)-zmfmax,0.)
2382 wup(jl) = wup(jl) + kup(jl,jk+1)*(pap(jl,jk+1)-pap(jl,jk))
2383 zdpmean(jl) = zdpmean(jl) + pap(jl,jk+1) - pap(jl,jk)
2384 zdmfen(jl) = zoentr(jl)
2385 if ( ktype(jl) >= 2 ) then
2386 zdmfen(jl) = 2.0*zdmfen(jl)
2387 zdmfde(jl) = zdmfen(jl)
2389 zdmfde(jl) = zdmfde(jl) * &
2390 (1.6-min(1.,pqen(jl,jk)/pqsen(jl,jk)))
2391 zmftest = pmfu(jl,jk+1) + zdmfen(jl) - zdmfde(jl)
2392 zchange = max(zmftest-zmfmax,0.)
2393 zxe = max(zchange-zxs,0.)
2394 zdmfen(jl) = zdmfen(jl) - zxe
2395 zchange = zchange - zxe
2396 zdmfde(jl) = zdmfde(jl) + zchange
2398 pdmfen(jl,jk) = zdmfen(jl) - zdmfde(jl)
2399 pmfu(jl,jk) = pmfu(jl,jk+1) + zdmfen(jl) - zdmfde(jl)
2400 zqeen = pqenh(jl,jk+1)*zdmfen(jl)
2401 zseen = (cpd*ptenh(jl,jk+1)+pgeoh(jl,jk+1))*zdmfen(jl)
2402 zscde = (cpd*ptu(jl,jk+1)+pgeoh(jl,jk+1))*zdmfde(jl)
2403 zqude = pqu(jl,jk+1)*zdmfde(jl)
2404 plude(jl,jk) = plu(jl,jk+1)*zdmfde(jl)
2405 zmfusk = pmfus(jl,jk+1) + zseen - zscde
2406 zmfuqk = pmfuq(jl,jk+1) + zqeen - zqude
2407 zmfulk = pmful(jl,jk+1) - plude(jl,jk)
2408 plu(jl,jk) = zmfulk*(1./max(cmfcmin,pmfu(jl,jk)))
2409 pqu(jl,jk) = zmfuqk*(1./max(cmfcmin,pmfu(jl,jk)))
2410 ptu(jl,jk) = (zmfusk * &
2411 (1./max(cmfcmin,pmfu(jl,jk)))-pgeoh(jl,jk))*rcpd
2412 ptu(jl,jk) = max(100.,ptu(jl,jk))
2413 ptu(jl,jk) = min(400.,ptu(jl,jk))
2414 zqold(jl) = pqu(jl,jk)
2415 zlrain(jl,jk) = zlrain(jl,jk+1)*(pmfu(jl,jk+1)-zdmfde(jl)) * &
2416 (1./max(cmfcmin,pmfu(jl,jk)))
2417 zluold(jl) = plu(jl,jk)
2419 ! reset to environmental values if below departure level
2421 if ( jk > kdpl(jl) ) then
2422 ptu(jl,jk) = ptenh(jl,jk)
2423 pqu(jl,jk) = pqenh(jl,jk)
2425 zluold(jl) = plu(jl,jk)
2428 !* do corrections for moist ascent
2429 !* by adjusting t,q and l in *cuadjtq*
2430 !------------------------------------------------
2435 call cuadjtqn(klon,klev,ik,zph,ptu,pqu,loflag,icall)
2437 ! compute the upfraft speed in cloud layer
2440 if ( pqu(jl,jk) /= zqold(jl) ) then
2441 plglac(jl,jk) = plu(jl,jk) * &
2442 ((1.-foealfa(ptu(jl,jk)))- &
2443 (1.-foealfa(ptu(jl,jk+1))))
2444 ptu(jl,jk) = ptu(jl,jk) + ralfdcp*plglac(jl,jk)
2449 if ( pqu(jl,jk) /= zqold(jl) ) then
2451 plu(jl,jk) = plu(jl,jk) + zqold(jl) - pqu(jl,jk)
2452 zbc = ptu(jl,jk)*(1.+vtmpc1*pqu(jl,jk)-plu(jl,jk+1) - &
2454 zbe = ptenh(jl,jk)*(1.+vtmpc1*pqenh(jl,jk))
2455 zbuo(jl,jk) = zbc - zbe
2456 ! set flags for the case of midlevel convection
2457 if ( ktype(jl) == 3 .and. klab(jl,jk+1) == 1 ) then
2458 if ( zbuo(jl,jk) > -0.5 ) then
2469 if ( klab(jl,jk+1) == 2 ) then
2470 if ( zbuo(jl,jk) < 0. ) then
2471 ptenh(jl,jk) = 0.5*(pten(jl,jk)+pten(jl,jk-1))
2472 pqenh(jl,jk) = 0.5*(pqen(jl,jk)+pqen(jl,jk-1))
2473 zbuo(jl,jk) = zbc - ptenh(jl,jk)*(1.+vtmpc1*pqenh(jl,jk))
2475 zbuoc = (zbuo(jl,jk) / &
2476 (ptenh(jl,jk)*(1.+vtmpc1*pqenh(jl,jk)))+zbuo(jl,jk+1) / &
2477 (ptenh(jl,jk+1)*(1.+vtmpc1*pqenh(jl,jk+1))))*0.5
2478 zdkbuo = (pgeoh(jl,jk)-pgeoh(jl,jk+1))*zfacbuo*zbuoc
2479 ! mixing and "pressure" gradient term in upper troposphere
2480 if ( zdmfen(jl) > 0. ) then
2481 zdken = min(1.,(1.+z_cwdrag)*zdmfen(jl) / &
2482 max(cmfcmin,pmfu(jl,jk+1)))
2484 zdken = min(1.,(1.+z_cwdrag)*zdmfde(jl) / &
2485 max(cmfcmin,pmfu(jl,jk+1)))
2487 kup(jl,jk) = (kup(jl,jk+1)*(1.-zdken)+zdkbuo) / &
2489 if ( zbuo(jl,jk) < 0. ) then
2490 zkedke = kup(jl,jk)/max(1.e-10,kup(jl,jk+1))
2491 zkedke = max(0.,min(1.,zkedke))
2492 zmfun = sqrt(zkedke)*pmfu(jl,jk+1)
2493 zdmfde(jl) = max(zdmfde(jl),pmfu(jl,jk+1)-zmfun)
2494 plude(jl,jk) = plu(jl,jk+1)*zdmfde(jl)
2495 pmfu(jl,jk) = pmfu(jl,jk+1) + zdmfen(jl) - zdmfde(jl)
2497 if ( zbuo(jl,jk) > -0.2 ) then
2499 zoentr(jl) = 1.75e-3*(0.3-(min(1.,pqen(jl,jk-1) / &
2500 pqsen(jl,jk-1))-1.))*(pgeoh(jl,jk-1)-pgeoh(jl,jk)) * &
2501 zrg*min(1.,pqsen(jl,jk)/pqsen(jl,ikb))**3
2502 zoentr(jl) = min(0.4,zoentr(jl))*pmfu(jl,jk)
2506 ! erase values if below departure level
2507 if ( jk > kdpl(jl) ) then
2508 pmfu(jl,jk) = pmfu(jl,jk+1)
2511 if ( kup(jl,jk) > 0. .and. pmfu(jl,jk) > 0. ) then
2518 zdmfde(jl) = pmfu(jl,jk+1)
2519 plude(jl,jk) = plu(jl,jk+1)*zdmfde(jl)
2521 ! save detrainment rates for updraught
2522 if ( pmfu(jl,jk+1) > 0. ) pmfude_rate(jl,jk) = zdmfde(jl)
2524 else if ( ktype(jl) == 2 .and. pqu(jl,jk) == zqold(jl) ) then
2528 zdmfde(jl) = pmfu(jl,jk+1)
2529 plude(jl,jk) = plu(jl,jk+1)*zdmfde(jl)
2530 pmfude_rate(jl,jk) = zdmfde(jl)
2535 if ( llo1(jl) ) then
2536 ! conversions only proceeds if plu is greater than a threshold liquid water
2537 ! content of 0.3 g/kg over water and 0.5 g/kg over land to prevent precipitation
2538 ! generation from small water contents.
2539 if ( lndj(jl).eq.1 ) then
2545 if ( plu(jl,jk) > zdshrd )then
2546 zwu = min(15.0,sqrt(2.*max(0.1,kup(jl,jk+1))))
2547 zprcon = zprcdgw/(0.75*zwu)
2548 ! PARAMETERS FOR BERGERON-FINDEISEN PROCESS (T < -5C)
2549 zdt = min(rtber-rtice,max(rtber-ptu(jl,jk),0.))
2550 zcbf = 1. + z_cprc2*sqrt(zdt)
2552 zlcrit = zdshrd/zcbf
2553 zdfi = pgeoh(jl,jk) - pgeoh(jl,jk+1)
2554 zc = (plu(jl,jk)-zluold(jl))
2555 zarg = (plu(jl,jk)/zlcrit)**2
2556 if ( zarg < 25.0 ) then
2557 zd = zzco*(1.-exp(-zarg))*zdfi
2562 zlnew = zluold(jl)*zint + zc/zd*(1.-zint)
2563 zlnew = max(0.,min(plu(jl,jk),zlnew))
2564 zlnew = min(z_cldmax,zlnew)
2565 zprecip(jl) = max(0.,zluold(jl)+zc-zlnew)
2566 pdmfup(jl,jk) = zprecip(jl)*pmfu(jl,jk)
2567 zlrain(jl,jk) = zlrain(jl,jk) + zprecip(jl)
2573 if ( llo1(jl) ) then
2574 if ( zlrain(jl,jk) > 0. ) then
2575 zvw = 21.18*zlrain(jl,jk)**0.2
2577 zalfaw = foealfa(ptu(jl,jk))
2578 zvv = zalfaw*zvw + (1.-zalfaw)*zvi
2579 zrold = zlrain(jl,jk) - zprecip(jl)
2581 zwu = min(15.0,sqrt(2.*max(0.1,kup(jl,jk))))
2584 zrnew = zrold*zint + zc/zd*(1.-zint)
2585 zrnew = max(0.,min(zlrain(jl,jk),zrnew))
2586 zlrain(jl,jk) = zrnew
2592 pmful(jl,jk) = plu(jl,jk)*pmfu(jl,jk)
2593 pmfus(jl,jk) = (cpd*ptu(jl,jk)+pgeoh(jl,jk))*pmfu(jl,jk)
2594 pmfuq(jl,jk) = pqu(jl,jk)*pmfu(jl,jk)
2598 !----------------------------------------------------------------------
2599 ! 5. final calculations
2600 ! ------------------
2602 if ( kctop(jl) == -1 ) ldcum(jl) = .false.
2603 kcbot(jl) = max(kcbot(jl),kctop(jl))
2604 if ( ldcum(jl) ) then
2605 wup(jl) = max(1.e-2,wup(jl)/max(1.,zdpmean(jl)))
2606 wup(jl) = sqrt(2.*wup(jl))
2611 end subroutine cuascn
2612 !---------------------------------------------------------
2613 ! level 3 souroutines
2614 !--------------------------------------------------------
2615 subroutine cudlfsn &
2617 & kcbot, kctop, lndj, ldcum, &
2618 & ptenh, pqenh, puen, pven, &
2619 & pten, pqsen, pgeo, &
2620 & pgeoh, paph, ptu, pqu, plu,&
2621 & puu, pvu, pmfub, prfl, &
2622 & ptd, pqd, pud, pvd, &
2623 & pmfd, pmfds, pmfdq, pdmfdp, &
2626 ! this routine calculates level of free sinking for
2627 ! cumulus downdrafts and specifies t,q,u and v values
2629 ! m.tiedtke e.c.m.w.f. 12/86 modif. 12/89
2633 ! to produce lfs-values for cumulus downdrafts
2634 ! for massflux cumulus parameterization
2638 ! this routine is called from *cumastr*.
2639 ! input are environmental values of t,q,u,v,p,phi
2640 ! and updraft values t,q,u and v and also
2641 ! cloud base massflux and cu-precipitation rate.
2642 ! it returns t,q,u and v values and massflux at lfs.
2646 ! check for negative buoyancy of air of equal parts of
2647 ! moist environmental air and cloud air.
2649 ! parameter description units
2650 ! --------- ----------- -----
2651 ! input parameters (integer):
2653 ! *klon* number of grid points per packet
2654 ! *klev* number of levels
2655 ! *kcbot* cloud base level
2656 ! *kctop* cloud top level
2658 ! input parameters (logical):
2660 ! *lndj* land sea mask (1 for land)
2661 ! *ldcum* flag: .true. for convective points
2663 ! input parameters (real):
2665 ! *ptenh* env. temperature (t+1) on half levels k
2666 ! *pqenh* env. spec. humidity (t+1) on half levels kg/kg
2667 ! *puen* provisional environment u-velocity (t+1) m/s
2668 ! *pven* provisional environment v-velocity (t+1) m/s
2669 ! *pten* provisional environment temperature (t+1) k
2670 ! *pqsen* environment spec. saturation humidity (t+1) kg/kg
2671 ! *pgeo* geopotential m2/s2
2672 ! *pgeoh* geopotential on half levels m2/s2
2673 ! *paph* provisional pressure on half levels pa
2674 ! *ptu* temperature in updrafts k
2675 ! *pqu* spec. humidity in updrafts kg/kg
2676 ! *plu* liquid water content in updrafts kg/kg
2677 ! *puu* u-velocity in updrafts m/s
2678 ! *pvu* v-velocity in updrafts m/s
2679 ! *pmfub* massflux in updrafts at cloud base kg/(m2*s)
2681 ! updated parameters (real):
2683 ! *prfl* precipitation rate kg/(m2*s)
2685 ! output parameters (real):
2687 ! *ptd* temperature in downdrafts k
2688 ! *pqd* spec. humidity in downdrafts kg/kg
2689 ! *pud* u-velocity in downdrafts m/s
2690 ! *pvd* v-velocity in downdrafts m/s
2691 ! *pmfd* massflux in downdrafts kg/(m2*s)
2692 ! *pmfds* flux of dry static energy in downdrafts j/(m2*s)
2693 ! *pmfdq* flux of spec. humidity in downdrafts kg/(m2*s)
2694 ! *pdmfdp* flux difference of precip. in downdrafts kg/(m2*s)
2696 ! output parameters (integer):
2698 ! *kdtop* top level of downdrafts
2700 ! output parameters (logical):
2702 ! *lddraf* .true. if downdrafts exist
2706 ! *cuadjtq* for calculating wet bulb t and q at lfs
2707 !----------------------------------------------------------------------
2711 real ptenh(klon,klev), pqenh(klon,klev), &
2712 & puen(klon,klev), pven(klon,klev), &
2713 & pten(klon,klev), pqsen(klon,klev), &
2714 & pgeo(klon,klev), &
2715 & pgeoh(klon,klev+1), paph(klon,klev+1),&
2716 & ptu(klon,klev), pqu(klon,klev), &
2717 & puu(klon,klev), pvu(klon,klev), &
2719 & pmfub(klon), prfl(klon)
2721 real ptd(klon,klev), pqd(klon,klev), &
2722 & pud(klon,klev), pvd(klon,klev), &
2723 & pmfd(klon,klev), pmfds(klon,klev), &
2724 & pmfdq(klon,klev), pdmfdp(klon,klev)
2725 integer kcbot(klon), kctop(klon), &
2726 & kdtop(klon), ikhsmin(klon)
2727 logical ldcum(klon), &
2731 real ztenwb(klon,klev), zqenwb(klon,klev), &
2732 & zcond(klon), zph(klon), &
2737 integer is,ik,icall,ike
2738 real zhsk,zttest,zqtest,zbuo,zmftop
2740 !----------------------------------------------------------------------
2742 ! 1. set default values for downdrafts
2743 ! ---------------------------------
2750 !----------------------------------------------------------------------
2752 ! 2. determine level of free sinking:
2753 ! downdrafts shall start at model level of minimum
2754 ! of saturation moist static energy or below
2757 ! for every point and proceed as follows:
2759 ! (1) determine level of minimum of hs
2760 ! (2) determine wet bulb environmental t and q
2761 ! (3) do mixing with cumulus cloud air
2762 ! (4) check for negative buoyancy
2763 ! (5) if buoyancy>0 repeat (2) to (4) for next
2766 ! the assumption is that air of downdrafts is mixture
2767 ! of 50% cloud air + 50% environmental air at wet bulb
2768 ! temperature (i.e. which became saturated due to
2769 ! evaporation of rain and cloud water)
2770 ! ----------------------------------------------------
2773 zhsk=cpd*pten(jl,jk)+pgeo(jl,jk) + &
2774 & foelhm(pten(jl,jk))*pqsen(jl,jk)
2775 if(zhsk .lt. zhsmin(jl)) then
2786 ! 2.1 calculate wet-bulb temperature and moisture
2787 ! for environmental air in *cuadjtq*
2788 ! -------------------------------------------
2791 ztenwb(jl,jk)=ptenh(jl,jk)
2792 zqenwb(jl,jk)=pqenh(jl,jk)
2794 llo2(jl)=ldcum(jl).and.prfl(jl).gt.0..and..not.lddraf(jl).and. &
2795 & (jk.lt.kcbot(jl).and.jk.gt.kctop(jl)).and. jk.ge.ikhsmin(jl)
2805 & ( klon, klev, ik, zph, ztenwb, zqenwb, llo2, icall)
2807 ! 2.2 do mixing of cumulus and environmental air
2808 ! and check for negative buoyancy.
2809 ! then set values for downdraft at lfs.
2810 ! ----------------------------------------
2813 zttest=0.5*(ptu(jl,jk)+ztenwb(jl,jk))
2814 zqtest=0.5*(pqu(jl,jk)+zqenwb(jl,jk))
2815 zbuo=zttest*(1.+vtmpc1 *zqtest)- &
2816 & ptenh(jl,jk)*(1.+vtmpc1 *pqenh(jl,jk))
2817 zcond(jl)=pqenh(jl,jk)-zqenwb(jl,jk)
2818 zmftop=-cmfdeps*pmfub(jl)
2819 if(zbuo.lt.0..and.prfl(jl).gt.10.*zmftop*zcond(jl)) then
2825 pmfds(jl,jk)=pmfd(jl,jk)*(cpd*ptd(jl,jk)+pgeoh(jl,jk))
2826 pmfdq(jl,jk)=pmfd(jl,jk)*pqd(jl,jk)
2827 pdmfdp(jl,jk-1)=-0.5*pmfd(jl,jk)*zcond(jl)
2828 prfl(jl)=prfl(jl)+pdmfdp(jl,jk-1)
2836 end subroutine cudlfsn
2838 !---------------------------------------------------------
2839 ! level 3 souroutines
2840 !--------------------------------------------------------
2841 !**********************************************
2842 ! subroutine cuddrafn
2843 !**********************************************
2844 subroutine cuddrafn &
2845 & ( klon, klev, lddraf &
2846 & , ptenh, pqenh, puen, pven &
2847 & , pgeo, pgeoh, paph, prfl &
2848 & , ptd, pqd, pud, pvd, pmfu &
2849 & , pmfd, pmfds, pmfdq, pdmfdp, pmfdde_rate )
2851 ! this routine calculates cumulus downdraft descent
2853 ! m.tiedtke e.c.m.w.f. 12/86 modif. 12/89
2857 ! to produce the vertical profiles for cumulus downdrafts
2858 ! (i.e. t,q,u and v and fluxes)
2863 ! this routine is called from *cumastr*.
2864 ! input is t,q,p,phi,u,v at half levels.
2865 ! it returns fluxes of s,q and evaporation rate
2866 ! and u,v at levels where downdraft occurs
2870 ! calculate moist descent for entraining/detraining plume by
2871 ! a) moving air dry-adiabatically to next level below and
2872 ! b) correcting for evaporation to obtain saturated state.
2874 ! parameter description units
2875 ! --------- ----------- -----
2876 ! input parameters (integer):
2878 ! *klon* number of grid points per packet
2879 ! *klev* number of levels
2881 ! input parameters (logical):
2883 ! *lddraf* .true. if downdrafts exist
2885 ! input parameters (real):
2887 ! *ptenh* env. temperature (t+1) on half levels k
2888 ! *pqenh* env. spec. humidity (t+1) on half levels kg/kg
2889 ! *puen* provisional environment u-velocity (t+1) m/s
2890 ! *pven* provisional environment v-velocity (t+1) m/s
2891 ! *pgeo* geopotential m2/s2
2892 ! *pgeoh* geopotential on half levels m2/s2
2893 ! *paph* provisional pressure on half levels pa
2894 ! *pmfu* massflux updrafts kg/(m2*s)
2896 ! updated parameters (real):
2898 ! *prfl* precipitation rate kg/(m2*s)
2900 ! output parameters (real):
2902 ! *ptd* temperature in downdrafts k
2903 ! *pqd* spec. humidity in downdrafts kg/kg
2904 ! *pud* u-velocity in downdrafts m/s
2905 ! *pvd* v-velocity in downdrafts m/s
2906 ! *pmfd* massflux in downdrafts kg/(m2*s)
2907 ! *pmfds* flux of dry static energy in downdrafts j/(m2*s)
2908 ! *pmfdq* flux of spec. humidity in downdrafts kg/(m2*s)
2909 ! *pdmfdp* flux difference of precip. in downdrafts kg/(m2*s)
2913 ! *cuadjtq* for adjusting t and q due to evaporation in
2915 !----------------------------------------------------------------------
2919 real ptenh(klon,klev), pqenh(klon,klev), &
2920 & puen(klon,klev), pven(klon,klev), &
2921 & pgeoh(klon,klev+1), paph(klon,klev+1), &
2922 & pgeo(klon,klev), pmfu(klon,klev)
2924 real ptd(klon,klev), pqd(klon,klev), &
2925 & pud(klon,klev), pvd(klon,klev), &
2926 & pmfd(klon,klev), pmfds(klon,klev), &
2927 & pmfdq(klon,klev), pdmfdp(klon,klev), &
2929 real pmfdde_rate(klon,klev)
2930 logical lddraf(klon)
2932 real zdmfen(klon), zdmfde(klon), &
2933 & zcond(klon), zoentr(klon), &
2940 integer is,ik,icall,ike, itopde(klon)
2941 real zentr,zdz,zzentr,zseen,zqeen,zsdde,zqdde,zdmfdp
2942 real zmfdsk,zmfdqk,zbuo,zrain,zbuoyz,zmfduk,zmfdvk
2944 !----------------------------------------------------------------------
2945 ! 1. calculate moist descent for cumulus downdraft by
2946 ! (a) calculating entrainment/detrainment rates,
2947 ! including organized entrainment dependent on
2948 ! negative buoyancy and assuming
2949 ! linear decrease of massflux in pbl
2950 ! (b) doing moist descent - evaporative cooling
2951 ! and moistening is calculated in *cuadjtq*
2952 ! (c) checking for negative buoyancy and
2953 ! specifying final t,q,u,v and downward fluxes
2954 ! -------------------------------------------------
2964 pmfdde_rate(jl,jk) = 0.
2965 if((paph(jl,klev+1)-paph(jl,jk)).lt. 60.e2) itopde(jl) = jk
2973 llo2(jl)=lddraf(jl).and.pmfd(jl,jk-1).lt.0.
2982 zentr = entrdd*pmfd(jl,jk-1)*(pgeoh(jl,jk-1)-pgeoh(jl,jk))*zrg
2990 if(jk.gt.itopde(jl)) then
2992 zdmfde(jl)=pmfd(jl,itopde(jl))* &
2993 & (paph(jl,jk)-paph(jl,jk-1))/ &
2994 & (paph(jl,klev+1)-paph(jl,itopde(jl)))
3001 if(jk.le.itopde(jl)) then
3002 zdz=-(pgeoh(jl,jk-1)-pgeoh(jl,jk))*zrg
3003 zzentr=zoentr(jl)*zdz*pmfd(jl,jk-1)
3004 zdmfen(jl)=zdmfen(jl)+zzentr
3005 zdmfen(jl)=max(zdmfen(jl),0.3*pmfd(jl,jk-1))
3006 zdmfen(jl)=max(zdmfen(jl),-0.75*pmfu(jl,jk)- &
3007 & (pmfd(jl,jk-1)-zdmfde(jl)))
3008 zdmfen(jl)=min(zdmfen(jl),0.)
3015 pmfd(jl,jk)=pmfd(jl,jk-1)+zdmfen(jl)-zdmfde(jl)
3016 zseen=(cpd*ptenh(jl,jk-1)+pgeoh(jl,jk-1))*zdmfen(jl)
3017 zqeen=pqenh(jl,jk-1)*zdmfen(jl)
3018 zsdde=(cpd*ptd(jl,jk-1)+pgeoh(jl,jk-1))*zdmfde(jl)
3019 zqdde=pqd(jl,jk-1)*zdmfde(jl)
3020 zmfdsk=pmfds(jl,jk-1)+zseen-zsdde
3021 zmfdqk=pmfdq(jl,jk-1)+zqeen-zqdde
3022 pqd(jl,jk)=zmfdqk*(1./min(-cmfcmin,pmfd(jl,jk)))
3023 ptd(jl,jk)=(zmfdsk*(1./min(-cmfcmin,pmfd(jl,jk)))-&
3024 & pgeoh(jl,jk))*rcpd
3025 ptd(jl,jk)=min(400.,ptd(jl,jk))
3026 ptd(jl,jk)=max(100.,ptd(jl,jk))
3027 zcond(jl)=pqd(jl,jk)
3033 call cuadjtqn(klon, klev, ik, zph, ptd, pqd, llo2, icall )
3037 zcond(jl)=zcond(jl)-pqd(jl,jk)
3038 zbuo=ptd(jl,jk)*(1.+vtmpc1 *pqd(jl,jk))- &
3039 & ptenh(jl,jk)*(1.+vtmpc1 *pqenh(jl,jk))
3040 if(prfl(jl).gt.0..and.pmfu(jl,jk).gt.0.) then
3041 zrain=prfl(jl)/pmfu(jl,jk)
3042 zbuo=zbuo-ptd(jl,jk)*zrain
3044 if(zbuo.ge.0 .or. prfl(jl).le.(pmfd(jl,jk)*zcond(jl))) then
3048 pmfds(jl,jk)=(cpd*ptd(jl,jk)+pgeoh(jl,jk))*pmfd(jl,jk)
3049 pmfdq(jl,jk)=pqd(jl,jk)*pmfd(jl,jk)
3050 zdmfdp=-pmfd(jl,jk)*zcond(jl)
3051 pdmfdp(jl,jk-1)=zdmfdp
3052 prfl(jl)=prfl(jl)+zdmfdp
3054 ! compute organized entrainment for use at next level
3055 zbuoyz=zbuo/ptenh(jl,jk)
3056 zbuoyz=min(zbuoyz,0.0)
3057 zdz=-(pgeo(jl,jk-1)-pgeo(jl,jk))
3058 zbuoy(jl)=zbuoy(jl)+zbuoyz*zdz
3059 zoentr(jl)=g*zbuoyz*0.5/(1.+zbuoy(jl))
3060 pmfdde_rate(jl,jk) = -zdmfde(jl)
3067 end subroutine cuddrafn
3068 !---------------------------------------------------------
3069 ! level 3 souroutines
3070 !--------------------------------------------------------
3072 & ( klon, klev, ztmst &
3073 & , pten, pqen, pqsen, ptenh, pqenh &
3074 & , paph, pap, pgeoh, lndj, ldcum &
3075 & , kcbot, kctop, kdtop, ktopm2 &
3077 & , pmfu, pmfd, pmfus, pmfds &
3078 & , pmfuq, pmfdq, pmful, plude &
3079 & , pdmfup, pdmfdp, pdpmel, plglac &
3080 & , prain, pmfdde_rate, pmflxr, pmflxs )
3082 ! m.tiedtke e.c.m.w.f. 7/86 modif. 12/89
3087 ! this routine does the final calculation of convective
3088 ! fluxes in the cloud layer and in the subcloud layer
3092 ! this routine is called from *cumastr*.
3095 ! parameter description units
3096 ! --------- ----------- -----
3097 ! input parameters (integer):
3099 ! *klon* number of grid points per packet
3100 ! *klev* number of levels
3101 ! *kcbot* cloud base level
3102 ! *kctop* cloud top level
3103 ! *kdtop* top level of downdrafts
3105 ! input parameters (logical):
3107 ! *lndj* land sea mask (1 for land)
3108 ! *ldcum* flag: .true. for convective points
3110 ! input parameters (real):
3112 ! *ptsphy* time step for the physics s
3113 ! *pten* provisional environment temperature (t+1) k
3114 ! *pqen* provisional environment spec. humidity (t+1) kg/kg
3115 ! *pqsen* environment spec. saturation humidity (t+1) kg/kg
3116 ! *ptenh* env. temperature (t+1) on half levels k
3117 ! *pqenh* env. spec. humidity (t+1) on half levels kg/kg
3118 ! *paph* provisional pressure on half levels pa
3119 ! *pap* provisional pressure on full levels pa
3120 ! *pgeoh* geopotential on half levels m2/s2
3122 ! updated parameters (integer):
3124 ! *ktype* set to zero if ldcum=.false.
3126 ! updated parameters (logical):
3128 ! *lddraf* set to .false. if ldcum=.false. or kdtop<kctop
3130 ! updated parameters (real):
3132 ! *pmfu* massflux in updrafts kg/(m2*s)
3133 ! *pmfd* massflux in downdrafts kg/(m2*s)
3134 ! *pmfus* flux of dry static energy in updrafts j/(m2*s)
3135 ! *pmfds* flux of dry static energy in downdrafts j/(m2*s)
3136 ! *pmfuq* flux of spec. humidity in updrafts kg/(m2*s)
3137 ! *pmfdq* flux of spec. humidity in downdrafts kg/(m2*s)
3138 ! *pmful* flux of liquid water in updrafts kg/(m2*s)
3139 ! *plude* detrained liquid water kg/(m3*s)
3140 ! *pdmfup* flux difference of precip. in updrafts kg/(m2*s)
3141 ! *pdmfdp* flux difference of precip. in downdrafts kg/(m2*s)
3143 ! output parameters (real):
3145 ! *pdpmel* change in precip.-fluxes due to melting kg/(m2*s)
3146 ! *plglac* flux of frozen cloud water in updrafts kg/(m2*s)
3147 ! *pmflxr* convective rain flux kg/(m2*s)
3148 ! *pmflxs* convective snow flux kg/(m2*s)
3149 ! *prain* total precip. produced in conv. updrafts kg/(m2*s)
3150 ! (no evaporation in downdrafts)
3155 !----------------------------------------------------------------------
3158 integer klev,klon,ktopm2
3159 real pten(klon,klev), ptenh(klon,klev), &
3160 & pqen(klon,klev), pqsen(klon,klev), &
3161 & pqenh(klon,klev), pap(klon,klev), &
3162 & paph(klon,klev+1), pgeoh(klon,klev+1), &
3165 real pmfu(klon,klev), pmfd(klon,klev), &
3166 & pmfus(klon,klev), pmfds(klon,klev), &
3167 & pmfuq(klon,klev), pmfdq(klon,klev), &
3168 & pdmfup(klon,klev), pdmfdp(klon,klev), &
3169 & pdpmel(klon,klev), prain(klon), &
3170 & pmful(klon,klev), plude(klon,klev), &
3171 & pmflxr(klon,klev+1), pmflxs(klon,klev+1)
3172 real pmfdde_rate(klon,klev)
3173 integer kcbot(klon), kctop(klon), &
3174 & kdtop(klon), ktype(klon)
3175 logical lddraf(klon), &
3180 integer is,ik,icall,ike,ikb
3181 real ztmst,ztaumel,zcons1a,zcons1,zcons2,zcucov,zcpecons
3182 real zalfaw,zrfl,zdrfl1,zrnew,zrmin,zrfln,zdrfl,zdenom
3183 real zpdr,zpds,zzp,zfac,zsnmlt
3187 !--------------------------------------------------------------------
3188 !* specify constants
3191 zcons1a=cpd/(alf*g*ztaumel)
3196 !* 1.0 determine final convective fluxes
3197 ! ---------------------------------
3200 if(.not.ldcum(jl).or.kdtop(jl).lt.kctop(jl)) lddraf(jl)=.false.
3201 if(.not.ldcum(jl)) ktype(jl)=0
3203 if(lndj(jl) .eq. 1) then
3212 ikb = min(jk+1,klev)
3217 if(ldcum(jl).and.jk.ge.kctop(jl)) then
3218 pmfus(jl,jk)=pmfus(jl,jk)-pmfu(jl,jk)* &
3219 & (cpd*ptenh(jl,jk)+pgeoh(jl,jk))
3220 pmfuq(jl,jk)=pmfuq(jl,jk)-pmfu(jl,jk)*pqenh(jl,jk)
3221 plglac(jl,jk)=pmfu(jl,jk)*plglac(jl,jk)
3222 llddraf = lddraf(jl) .and. jk >= kdtop(jl)
3223 if ( llddraf .and.jk.ge.kdtop(jl)) then
3224 pmfds(jl,jk) = pmfds(jl,jk)-pmfd(jl,jk) * &
3225 (cpd*ptenh(jl,jk)+pgeoh(jl,jk))
3226 pmfdq(jl,jk) = pmfdq(jl,jk)-pmfd(jl,jk)*pqenh(jl,jk)
3231 pdmfdp(jl,jk-1) = 0.
3233 if ( llddraf .and. pmfd(jl,jk) < 0. .and. &
3234 abs(pmfd(jl,ikb)) < 1.e-20 ) then
3254 pmflxr(jl,klev+1) = 0.
3255 pmflxs(jl,klev+1) = 0.
3261 zzp=((paph(jl,klev+1)-paph(jl,ik))/ &
3262 & (paph(jl,klev+1)-paph(jl,ikb)))
3263 if(ktype(jl).eq.3) then
3266 pmfu(jl,ik)=pmfu(jl,ikb)*zzp
3267 pmfus(jl,ik)=(pmfus(jl,ikb)- &
3268 & foelhm(ptenh(jl,ikb))*pmful(jl,ikb))*zzp
3269 pmfuq(jl,ik)=(pmfuq(jl,ikb)+pmful(jl,ikb))*zzp
3276 if(ldcum(jl).and.jk.gt.kcbot(jl)+1) then
3278 zzp=((paph(jl,klev+1)-paph(jl,jk))/ &
3279 & (paph(jl,klev+1)-paph(jl,ikb)))
3280 if(ktype(jl).eq.3) then
3283 pmfu(jl,jk)=pmfu(jl,ikb)*zzp
3284 pmfus(jl,jk)=pmfus(jl,ikb)*zzp
3285 pmfuq(jl,jk)=pmfuq(jl,ikb)*zzp
3289 llddraf = lddraf(jl) .and. jk > ik .and. ik < klev
3290 if ( llddraf .and. ik == kcbot(jl)+1 ) then
3291 zzp = ((paph(jl,klev+1)-paph(jl,jk))/(paph(jl,klev+1)-paph(jl,ik)))
3292 if ( ktype(jl) == 3 ) zzp = zzp*zzp
3293 pmfd(jl,jk) = pmfd(jl,ik)*zzp
3294 pmfds(jl,jk) = pmfds(jl,ik)*zzp
3295 pmfdq(jl,jk) = pmfdq(jl,ik)*zzp
3296 pmfdde_rate(jl,jk) = -(pmfd(jl,jk-1)-pmfd(jl,jk))
3297 else if ( llddraf .and. ik /= kcbot(jl)+1 .and. jk == ik+1 ) then
3298 pmfdde_rate(jl,jk) = -(pmfd(jl,jk-1)-pmfd(jl,jk))
3302 !* 2. calculate rain/snow fall rates
3303 !* calculate melting of snow
3304 !* calculate evaporation of precip
3305 ! -------------------------------
3309 if(ldcum(jl) .and. jk >=kctop(jl)-1 ) then
3310 prain(jl)=prain(jl)+pdmfup(jl,jk)
3311 if(pmflxs(jl,jk).gt.0..and.pten(jl,jk).gt.tmelt) then
3312 zcons1=zcons1a*(1.+0.5*(pten(jl,jk)-tmelt))
3313 zfac=zcons1*(paph(jl,jk+1)-paph(jl,jk))
3314 zsnmlt=min(pmflxs(jl,jk),zfac*(pten(jl,jk)-tmelt))
3315 pdpmel(jl,jk)=zsnmlt
3316 pqsen(jl,jk)=foeewm(pten(jl,jk)-zsnmlt/zfac)/pap(jl,jk)
3318 zalfaw=foealfa(pten(jl,jk))
3320 ! No liquid precipitation above melting level
3322 if ( pten(jl,jk) < tmelt .and. zalfaw > 0. ) then
3323 plglac(jl,jk) = plglac(jl,jk)+zalfaw*(pdmfup(jl,jk)+pdmfdp(jl,jk))
3326 pmflxr(jl,jk+1)=pmflxr(jl,jk)+zalfaw* &
3327 & (pdmfup(jl,jk)+pdmfdp(jl,jk))+pdpmel(jl,jk)
3328 pmflxs(jl,jk+1)=pmflxs(jl,jk)+(1.-zalfaw)* &
3329 & (pdmfup(jl,jk)+pdmfdp(jl,jk))-pdpmel(jl,jk)
3330 if(pmflxr(jl,jk+1)+pmflxs(jl,jk+1).lt.0.0) then
3331 pdmfdp(jl,jk)=-(pmflxr(jl,jk)+pmflxs(jl,jk)+pdmfup(jl,jk))
3335 else if ( pmflxr(jl,jk+1) < 0. ) then
3336 pmflxs(jl,jk+1) = pmflxs(jl,jk+1)+pmflxr(jl,jk+1)
3337 pmflxr(jl,jk+1) = 0.
3338 else if ( pmflxs(jl,jk+1) < 0. ) then
3339 pmflxr(jl,jk+1) = pmflxr(jl,jk+1)+pmflxs(jl,jk+1)
3340 pmflxs(jl,jk+1) = 0.
3347 if(ldcum(jl).and.jk.ge.kcbot(jl)) then
3348 zrfl=pmflxr(jl,jk)+pmflxs(jl,jk)
3349 if(zrfl.gt.1.e-20) then
3350 zdrfl1=zcpecons*max(0.,pqsen(jl,jk)-pqen(jl,jk))*zcucov* &
3351 & (sqrt(paph(jl,jk)/paph(jl,klev+1))/5.09e-3* &
3352 & zrfl/zcucov)**0.5777* &
3353 & (paph(jl,jk+1)-paph(jl,jk))
3355 zrmin=zrfl-zcucov*max(0.,rhevap(jl)*pqsen(jl,jk) &
3356 & -pqen(jl,jk)) *zcons2*(paph(jl,jk+1)-paph(jl,jk))
3357 zrnew=max(zrnew,zrmin)
3359 zdrfl=min(0.,zrfln-zrfl)
3360 zdenom=1./max(1.e-20,pmflxr(jl,jk)+pmflxs(jl,jk))
3361 zalfaw=foealfa(pten(jl,jk))
3362 if ( pten(jl,jk) < tmelt ) zalfaw = 0.
3363 zpdr=zalfaw*pdmfdp(jl,jk)
3364 zpds=(1.-zalfaw)*pdmfdp(jl,jk)
3365 pmflxr(jl,jk+1)=pmflxr(jl,jk)+zpdr &
3366 & +pdpmel(jl,jk)+zdrfl*pmflxr(jl,jk)*zdenom
3367 pmflxs(jl,jk+1)=pmflxs(jl,jk)+zpds &
3368 & -pdpmel(jl,jk)+zdrfl*pmflxs(jl,jk)*zdenom
3369 pdmfup(jl,jk)=pdmfup(jl,jk)+zdrfl
3370 if ( pmflxr(jl,jk+1)+pmflxs(jl,jk+1) < 0. ) then
3371 pdmfup(jl,jk) = pdmfup(jl,jk)-(pmflxr(jl,jk+1)+pmflxs(jl,jk+1))
3372 pmflxr(jl,jk+1) = 0.
3373 pmflxs(jl,jk+1) = 0.
3375 else if ( pmflxr(jl,jk+1) < 0. ) then
3376 pmflxs(jl,jk+1) = pmflxs(jl,jk+1)+pmflxr(jl,jk+1)
3377 pmflxr(jl,jk+1) = 0.
3378 else if ( pmflxs(jl,jk+1) < 0. ) then
3379 pmflxr(jl,jk+1) = pmflxr(jl,jk+1)+pmflxs(jl,jk+1)
3380 pmflxs(jl,jk+1) = 0.
3393 end subroutine cuflxn
3394 !---------------------------------------------------------
3395 ! level 3 souroutines
3396 !--------------------------------------------------------
3397 subroutine cudtdqn(klon,klev,ktopm2,kctop,kdtop,ldcum, &
3398 lddraf,ztmst,paph,pgeoh,pgeo,pten,ptenh,pqen, &
3399 pqenh,pqsen,plglac,plude,pmfu,pmfd,pmfus,pmfds, &
3400 pmfuq,pmfdq,pmful,pdmfup,pdmfdp,pdpmel,ptent,ptenq,pcte)
3402 integer klon,klev,ktopm2
3403 integer kctop(klon), kdtop(klon)
3404 logical ldcum(klon), lddraf(klon)
3406 real paph(klon,klev+1), pgeoh(klon,klev+1)
3407 real pgeo(klon,klev), pten(klon,klev), &
3408 pqen(klon,klev), ptenh(klon,klev),&
3409 pqenh(klon,klev), pqsen(klon,klev),&
3410 plglac(klon,klev), plude(klon,klev)
3411 real pmfu(klon,klev), pmfd(klon,klev),&
3412 pmfus(klon,klev), pmfds(klon,klev),&
3413 pmfuq(klon,klev), pmfdq(klon,klev),&
3414 pmful(klon,klev), pdmfup(klon,klev),&
3415 pdpmel(klon,klev), pdmfdp(klon,klev)
3416 real ptent(klon,klev), ptenq(klon,klev)
3417 real pcte(klon,klev)
3420 integer jk , ik , jl
3422 real zdtdt(klon,klev) , zdqdt(klon,klev) , zdp(klon,klev)
3423 !* 1.0 SETUP AND INITIALIZATIONS
3424 ! -------------------------
3427 if ( ldcum(jl) ) then
3428 zdp(jl,jk) = g/(paph(jl,jk+1)-paph(jl,jk))
3432 !-----------------------------------------------------------------------
3433 !* 2.0 COMPUTE TENDENCIES
3434 ! ------------------
3435 do jk = ktopm2 , klev
3436 if ( jk < klev ) then
3438 if ( ldcum(jl) ) then
3439 zalv = foelhm(pten(jl,jk))
3440 zdtdt(jl,jk) = zdp(jl,jk)*rcpd * &
3441 (pmfus(jl,jk+1)-pmfus(jl,jk)+pmfds(jl,jk+1) - &
3442 pmfds(jl,jk)+alf*plglac(jl,jk)-alf*pdpmel(jl,jk) - &
3443 zalv*(pmful(jl,jk+1)-pmful(jl,jk)-plude(jl,jk)-pdmfup(jl,jk)-pdmfdp(jl,jk)))
3444 zdqdt(jl,jk) = zdp(jl,jk)*(pmfuq(jl,jk+1) - &
3445 pmfuq(jl,jk)+pmfdq(jl,jk+1)-pmfdq(jl,jk)+pmful(jl,jk+1) - &
3446 pmful(jl,jk)-plude(jl,jk)-pdmfup(jl,jk)-pdmfdp(jl,jk))
3451 if ( ldcum(jl) ) then
3452 zalv = foelhm(pten(jl,jk))
3453 zdtdt(jl,jk) = -zdp(jl,jk)*rcpd * &
3454 (pmfus(jl,jk)+pmfds(jl,jk)+alf*pdpmel(jl,jk) - &
3455 zalv*(pmful(jl,jk)+pdmfup(jl,jk)+pdmfdp(jl,jk)+plude(jl,jk)))
3456 zdqdt(jl,jk) = -zdp(jl,jk)*(pmfuq(jl,jk) + plude(jl,jk) + &
3457 pmfdq(jl,jk)+(pmful(jl,jk)+pdmfup(jl,jk)+pdmfdp(jl,jk)))
3462 !---------------------------------------------------------------
3463 !* 3.0 UPDATE TENDENCIES
3465 do jk = ktopm2 , klev
3467 if ( ldcum(jl) ) then
3468 ptent(jl,jk) = ptent(jl,jk) + zdtdt(jl,jk)
3469 ptenq(jl,jk) = ptenq(jl,jk) + zdqdt(jl,jk)
3470 pcte(jl,jk) = zdp(jl,jk)*plude(jl,jk)
3476 end subroutine cudtdqn
3477 !---------------------------------------------------------
3478 ! level 3 souroutines
3479 !--------------------------------------------------------
3480 subroutine cududvn(klon,klev,ktopm2,ktype,kcbot,kctop,ldcum, &
3481 ztmst,paph,puen,pven,pmfu,pmfd,puu,pud,pvu,pvd,ptenu, &
3484 integer klon,klev,ktopm2
3485 integer ktype(klon), kcbot(klon), kctop(klon)
3488 real paph(klon,klev+1)
3489 real puen(klon,klev), pven(klon,klev),&
3490 pmfu(klon,klev), pmfd(klon,klev),&
3491 puu(klon,klev), pud(klon,klev),&
3492 pvu(klon,klev), pvd(klon,klev)
3493 real ptenu(klon,klev), ptenv(klon,klev)
3496 real zuen(klon,klev) , zven(klon,klev) , zmfuu(klon,klev), &
3497 zmfdu(klon,klev), zmfuv(klon,klev), zmfdv(klon,klev)
3499 integer ik , ikb , jk , jl
3502 real zdudt(klon,klev), zdvdt(klon,klev), zdp(klon,klev)
3506 if ( ldcum(jl) ) then
3507 zuen(jl,jk) = puen(jl,jk)
3508 zven(jl,jk) = pven(jl,jk)
3509 zdp(jl,jk) = g/(paph(jl,jk+1)-paph(jl,jk))
3513 !----------------------------------------------------------------------
3514 !* 1.0 CALCULATE FLUXES AND UPDATE U AND V TENDENCIES
3515 ! ----------------------------------------------
3516 do jk = ktopm2 , klev
3519 if ( ldcum(jl) ) then
3520 zmfuu(jl,jk) = pmfu(jl,jk)*(puu(jl,jk)-zuen(jl,ik))
3521 zmfuv(jl,jk) = pmfu(jl,jk)*(pvu(jl,jk)-zven(jl,ik))
3522 zmfdu(jl,jk) = pmfd(jl,jk)*(pud(jl,jk)-zuen(jl,ik))
3523 zmfdv(jl,jk) = pmfd(jl,jk)*(pvd(jl,jk)-zven(jl,ik))
3527 ! linear fluxes below cloud
3528 do jk = ktopm2 , klev
3530 if ( ldcum(jl) .and. jk > kcbot(jl) ) then
3532 zzp = ((paph(jl,klev+1)-paph(jl,jk))/(paph(jl,klev+1)-paph(jl,ikb)))
3533 if ( ktype(jl) == 3 ) zzp = zzp*zzp
3534 zmfuu(jl,jk) = zmfuu(jl,ikb)*zzp
3535 zmfuv(jl,jk) = zmfuv(jl,ikb)*zzp
3536 zmfdu(jl,jk) = zmfdu(jl,ikb)*zzp
3537 zmfdv(jl,jk) = zmfdv(jl,ikb)*zzp
3541 !----------------------------------------------------------------------
3542 !* 2.0 COMPUTE TENDENCIES
3543 ! ------------------
3544 do jk = ktopm2 , klev
3545 if ( jk < klev ) then
3548 if ( ldcum(jl) ) then
3549 zdudt(jl,jk) = zdp(jl,jk) * &
3550 (zmfuu(jl,ik)-zmfuu(jl,jk)+zmfdu(jl,ik)-zmfdu(jl,jk))
3551 zdvdt(jl,jk) = zdp(jl,jk) * &
3552 (zmfuv(jl,ik)-zmfuv(jl,jk)+zmfdv(jl,ik)-zmfdv(jl,jk))
3557 if ( ldcum(jl) ) then
3558 zdudt(jl,jk) = -zdp(jl,jk)*(zmfuu(jl,jk)+zmfdu(jl,jk))
3559 zdvdt(jl,jk) = -zdp(jl,jk)*(zmfuv(jl,jk)+zmfdv(jl,jk))
3564 !---------------------------------------------------------------------
3565 !* 3.0 UPDATE TENDENCIES
3567 do jk = ktopm2 , klev
3569 if ( ldcum(jl) ) then
3570 ptenu(jl,jk) = ptenu(jl,jk) + zdudt(jl,jk)
3571 ptenv(jl,jk) = ptenv(jl,jk) + zdvdt(jl,jk)
3575 !----------------------------------------------------------------------
3577 end subroutine cududvn
3578 !---------------------------------------------------------
3579 ! level 3 souroutines
3580 !--------------------------------------------------------
3581 subroutine cuadjtqn &
3582 & (klon, klev, kk, psp, pt, pq, ldflag, kcall)
3583 ! m.tiedtke e.c.m.w.f. 12/89
3586 ! to produce t,q and l values for cloud ascent
3590 ! this routine is called from subroutines:
3591 ! *cond* (t and q at condensation level)
3592 ! *cubase* (t and q at condensation level)
3593 ! *cuasc* (t and q at cloud levels)
3594 ! *cuini* (environmental t and qs values at half levels)
3595 ! input are unadjusted t and q values,
3596 ! it returns adjusted values of t and q
3598 ! parameter description units
3599 ! --------- ----------- -----
3600 ! input parameters (integer):
3602 ! *klon* number of grid points per packet
3603 ! *klev* number of levels
3605 ! *kcall* defines calculation as
3606 ! kcall=0 env. t and qs in*cuini*
3607 ! kcall=1 condensation in updrafts (e.g. cubase, cuasc)
3608 ! kcall=2 evaporation in downdrafts (e.g. cudlfs,cuddraf)
3609 ! input parameters (real):
3613 ! updated parameters (real):
3615 ! *pt* temperature k
3616 ! *pq* specific humidity kg/kg
3619 ! for condensation calculations.
3620 ! the tables are initialised in *suphec*.
3622 !----------------------------------------------------------------------
3627 real pt(klon,klev), pq(klon,klev), &
3629 logical ldflag(klon)
3632 integer isum,kcall,kk
3633 real zqmax,zqsat,zcor,zqp,zcond,zcond1,zl,zi,zf
3634 !----------------------------------------------------------------------
3635 ! 1. define constants
3639 ! 2. calculate condensation and adjust t and q accordingly
3640 ! -----------------------------------------------------
3642 if ( kcall == 1 ) then
3644 if ( ldflag(jl) ) then
3646 zl = 1./(pt(jl,kk)-c4les)
3647 zi = 1./(pt(jl,kk)-c4ies)
3648 zqsat = c2es*(foealfa(pt(jl,kk))*exp(c3les*(pt(jl,kk)-tmelt)*zl) + &
3649 (1.-foealfa(pt(jl,kk)))*exp(c3ies*(pt(jl,kk)-tmelt)*zi))
3651 zqsat = min(0.5,zqsat)
3652 zcor = 1. - vtmpc1*zqsat
3653 zf = foealfa(pt(jl,kk))*r5alvcp*zl**2 + &
3654 (1.-foealfa(pt(jl,kk)))*r5alscp*zi**2
3655 zcond = (pq(jl,kk)*zcor**2-zqsat*zcor)/(zcor**2+zqsat*zf)
3656 if ( zcond > 0. ) then
3657 pt(jl,kk) = pt(jl,kk) + foeldcpm(pt(jl,kk))*zcond
3658 pq(jl,kk) = pq(jl,kk) - zcond
3659 zl = 1./(pt(jl,kk)-c4les)
3660 zi = 1./(pt(jl,kk)-c4ies)
3661 zqsat = c2es*(foealfa(pt(jl,kk)) * &
3662 exp(c3les*(pt(jl,kk)-tmelt)*zl)+(1.-foealfa(pt(jl,kk))) * &
3663 exp(c3ies*(pt(jl,kk)-tmelt)*zi))
3665 zqsat = min(0.5,zqsat)
3666 zcor = 1. - vtmpc1*zqsat
3667 zf = foealfa(pt(jl,kk))*r5alvcp*zl**2 + &
3668 (1.-foealfa(pt(jl,kk)))*r5alscp*zi**2
3669 zcond1 = (pq(jl,kk)*zcor**2-zqsat*zcor)/(zcor**2+zqsat*zf)
3670 if ( abs(zcond) < 1.e-20 ) zcond1 = 0.
3671 pt(jl,kk) = pt(jl,kk) + foeldcpm(pt(jl,kk))*zcond1
3672 pq(jl,kk) = pq(jl,kk) - zcond1
3676 elseif ( kcall == 2 ) then
3678 if ( ldflag(jl) ) then
3680 zqsat = foeewm(pt(jl,kk))*zqp
3681 zqsat = min(0.5,zqsat)
3682 zcor = 1./(1.-vtmpc1*zqsat)
3684 zcond = (pq(jl,kk)-zqsat)/(1.+zqsat*zcor*foedem(pt(jl,kk)))
3685 zcond = min(zcond,0.)
3686 pt(jl,kk) = pt(jl,kk) + foeldcpm(pt(jl,kk))*zcond
3687 pq(jl,kk) = pq(jl,kk) - zcond
3688 zqsat = foeewm(pt(jl,kk))*zqp
3689 zqsat = min(0.5,zqsat)
3690 zcor = 1./(1.-vtmpc1*zqsat)
3692 zcond1 = (pq(jl,kk)-zqsat)/(1.+zqsat*zcor*foedem(pt(jl,kk)))
3693 if ( abs(zcond) < 1.e-20 ) zcond1 = min(zcond1,0.)
3694 pt(jl,kk) = pt(jl,kk) + foeldcpm(pt(jl,kk))*zcond1
3695 pq(jl,kk) = pq(jl,kk) - zcond1
3698 else if ( kcall == 0 ) then
3701 zqsat = foeewm(pt(jl,kk))*zqp
3702 zqsat = min(0.5,zqsat)
3703 zcor = 1./(1.-vtmpc1*zqsat)
3705 zcond1 = (pq(jl,kk)-zqsat)/(1.+zqsat*zcor*foedem(pt(jl,kk)))
3706 pt(jl,kk) = pt(jl,kk) + foeldcpm(pt(jl,kk))*zcond1
3707 pq(jl,kk) = pq(jl,kk) - zcond1
3708 zqsat = foeewm(pt(jl,kk))*zqp
3709 zqsat = min(0.5,zqsat)
3710 zcor = 1./(1.-vtmpc1*zqsat)
3712 zcond1 = (pq(jl,kk)-zqsat)/(1.+zqsat*zcor*foedem(pt(jl,kk)))
3713 pt(jl,kk) = pt(jl,kk) + foeldcpm(pt(jl,kk))*zcond1
3714 pq(jl,kk) = pq(jl,kk) - zcond1
3719 end subroutine cuadjtqn
3720 !---------------------------------------------------------
3721 ! level 4 souroutines
3722 !--------------------------------------------------------
3723 subroutine cubasmcn &
3724 & (klon, klev, klevm1, kk, pten,&
3725 & pqen, pqsen, puen, pven, pverv,&
3726 & pgeo, pgeoh, ldcum, ktype, klab, plrain,&
3727 & pmfu, pmfub, kcbot, ptu,&
3728 & pqu, plu, puu, pvu, pmfus,&
3729 & pmfuq, pmful, pdmfup )
3731 ! m.tiedtke e.c.m.w.f. 12/89
3732 ! c.zhang iprc 05/2012
3735 ! this routine calculates cloud base values
3736 ! for midlevel convection
3739 ! this routine is called from *cuasc*.
3740 ! input are environmental values t,q etc
3741 ! it returns cloudbase values for midlevel convection
3748 ! ----------------------------------------------------------------
3749 real pten(klon,klev), pqen(klon,klev),&
3750 & puen(klon,klev), pven(klon,klev),&
3751 & pqsen(klon,klev), pverv(klon,klev),&
3752 & pgeo(klon,klev), pgeoh(klon,klev+1)
3753 real ptu(klon,klev), pqu(klon,klev),&
3754 & puu(klon,klev), pvu(klon,klev),&
3755 & plu(klon,klev), pmfu(klon,klev),&
3757 & pmfus(klon,klev), pmfuq(klon,klev),&
3758 & pmful(klon,klev), pdmfup(klon,klev),&
3760 integer ktype(klon), kcbot(klon),&
3764 integer jl,kk,klev,klon,klevp1,klevm1
3766 !--------------------------------------------------------
3767 !* 1. calculate entrainment and detrainment rates
3768 ! -------------------------------------------------------
3770 if(.not.ldcum(jl) .and. klab(jl,kk+1).eq.0) then
3771 if(lmfmid .and. pqen(jl,kk) .gt. 0.80*pqsen(jl,kk).and. &
3772 pgeo(jl,kk)*zrg .gt. 5.0e2 .and. &
3773 & pgeo(jl,kk)*zrg .lt. 1.0e4 ) then
3774 ptu(jl,kk+1)=(cpd*pten(jl,kk)+pgeo(jl,kk)-pgeoh(jl,kk+1))&
3776 pqu(jl,kk+1)=pqen(jl,kk)
3778 zzzmb=max(cmfcmin,-pverv(jl,kk)*zrg)
3779 zzzmb=min(zzzmb,cmfcmax)
3781 pmfu(jl,kk+1)=pmfub(jl)
3782 pmfus(jl,kk+1)=pmfub(jl)*(cpd*ptu(jl,kk+1)+pgeoh(jl,kk+1))
3783 pmfuq(jl,kk+1)=pmfub(jl)*pqu(jl,kk+1)
3794 end subroutine cubasmcn
3795 !---------------------------------------------------------
3796 ! level 4 souroutines
3797 !---------------------------------------------------------
3798 subroutine cuentrn(klon,klev,kk,kcbot,ldcum,ldwork, &
3799 pgeoh,pmfu,pdmfen,pdmfde)
3801 integer klon,klev,kk
3805 real pgeoh(klon,klev+1)
3806 real pmfu(klon,klev)
3814 !* 1. CALCULATE ENTRAINMENT AND DETRAINMENT RATES
3815 ! -------------------------------------------
3823 !* 1.1 SPECIFY ENTRAINMENT RATES
3824 ! -------------------------
3826 if ( ldcum(jl) ) then
3827 zdz = (pgeoh(jl,kk)-pgeoh(jl,kk+1))*zrg
3828 zmf = pmfu(jl,kk+1)*zdz
3829 llo1 = kk < kcbot(jl)
3831 pdmfen(jl) = zentr(jl)*zmf
3832 pdmfde(jl) = 0.75e-4*zmf
3837 end subroutine cuentrn
3838 !--------------------------------------------------------
3839 ! external functions
3840 !------------------------------------------------------
3841 real function foealfa(tt)
3842 ! foealfa is calculated to distinguish the three cases:
3844 ! foealfa=1 water phase
3845 ! foealfa=0 ice phase
3846 ! 0 < foealfa < 1 mixed phase
3848 ! input : tt = temperature
3852 foealfa = min(1.,((max(rtice,min(rtwat,tt))-rtice) &
3853 & /(rtwat-rtice))**2)
3856 end function foealfa
3858 real function foelhm(tt)
3861 foelhm = foealfa(tt)*alv + (1.-foealfa(tt))*als
3865 real function foeewm(tt)
3869 & (foealfa(tt)*exp(c3les*(tt-tmelt)/(tt-c4les))+ &
3870 & (1.-foealfa(tt))*exp(c3ies*(tt-tmelt)/(tt-c4ies)))
3874 real function foedem(tt)
3877 foedem = foealfa(tt)*r5alvcp*(1./(tt-c4les)**2)+ &
3878 & (1.-foealfa(tt))*r5alscp*(1./(tt-c4ies)**2)
3882 real function foeldcpm(tt)
3885 foeldcpm = foealfa(tt)*ralvdcp+ &
3886 & (1.-foealfa(tt))*ralsdcp
3888 end function foeldcpm
3890 end module module_cu_ntiedtke