71 do_ca,progsigma,cactiv,cactiv_m,g,cp,fv,r_d,xlv,r_v,forcet, &
72 forceqv_spechum,phil,delp,raincv,tmf,qmicro,sigmain, &
73 betascu,betamcu,betadcu,qv_spechum,t,cld1d,us,vs,t2di,w, &
74 qv2di_spechum,p2di,psuri, &
75 hbot,htop,kcnv,xland,hfx2,qfx2,aod_gf,cliw,clcw,ca_deep,rainevap,&
76 pbl,ud_mf,dd_mf,dt_mf,cnvw_moist,cnvc,imfshalcnv, &
77 flag_for_scnv_generic_tend,flag_for_dcnv_generic_tend, &
78 dtend,dtidx,ntqv,ntiw,ntcw,index_of_temperature,index_of_x_wind, &
79 index_of_y_wind,index_of_process_scnv,index_of_process_dcnv, &
80 fhour,fh_dfi_radar,ix_dfi_radar,num_dfi_radar,cap_suppress, &
81 dfi_radar_max_intervals,ldiag3d,qci_conv,do_cap_suppress, &
82 sigmaout,maxupmf,maxMF,do_mynnedmf,ichoice_in,ichoicem_in, &
83 ichoice_s_in,errmsg,errflg)
86 integer,
parameter :: maxiens=1
87 integer,
parameter :: maxens=1
88 integer,
parameter :: maxens2=1
89 integer,
parameter :: maxens3=16
90 integer,
parameter :: ensdim=16
92 integer,
parameter :: ideep=1
94 integer :: ichoicem=13
95 integer :: ichoice_s=3
97 logical,
intent(in) :: do_cap_suppress
98 real(kind=kind_phys),
parameter :: aodc0=0.14
99 real(kind=kind_phys),
parameter :: aodreturn=30.
100 real(kind=kind_phys) :: dts,fpi,fp
101 integer,
parameter :: dicycle=0
102 integer,
parameter :: dicycle_m=0
103 integer :: ishallow_g3
105 integer :: its,ite, jts,jte, kts,kte
106 integer,
intent(in ) :: im,km,ntracer
107 integer,
intent(in ) :: ichoice_in,ichoicem_in,ichoice_s_in
108 logical,
intent(in ) :: flag_init, flag_restart, do_mynnedmf
109 logical,
intent(in ) :: flag_for_scnv_generic_tend,flag_for_dcnv_generic_tend, &
111 real (kind=kind_phys),
intent(in) :: g,cp,fv,r_d,xlv,r_v,betascu,betamcu,betadcu
112 logical,
intent(in ) :: ldiag3d
114 real(kind=kind_phys),
intent(inout),
optional :: dtend(:,:,:)
116 integer,
intent(in) :: dtidx(:,:), &
117 index_of_x_wind, index_of_y_wind, index_of_temperature, &
118 index_of_process_scnv, index_of_process_dcnv, ntqv, ntcw, ntiw
120 real(kind=kind_phys),
dimension( : , : ),
intent(in ),
optional :: forcet,forceqv_spechum
121 real(kind=kind_phys),
dimension( : , : ),
intent(in ) :: w,phil,delp
122 real(kind=kind_phys),
dimension ( : , : ),
intent(in ),
optional :: sigmain,qmicro
123 real(kind=kind_phys),
dimension( : , : ),
intent(inout ) :: t,us,vs
124 real(kind=kind_phys),
dimension( : , : ),
intent(inout ),
optional :: qci_conv
125 real(kind=kind_phys),
dimension( : , : ),
intent(out ) :: cnvw_moist,cnvc
126 real(kind=kind_phys),
dimension ( : , : ),
intent(out ),
optional :: sigmaout
127 real(kind=kind_phys),
dimension( : , : ),
intent(inout ) :: cliw, clcw
128 real(kind=kind_phys),
dimension ( : , : , :),
intent(in ) :: tmf
133 real(kind=kind_phys),
allocatable :: clcw_save(:,:), cliw_save(:,:)
135 integer,
intent(in) :: dfi_radar_max_intervals
136 real(kind=kind_phys),
intent(in) :: fhour, fh_dfi_radar(:)
137 integer,
intent(in) :: num_dfi_radar, ix_dfi_radar(:)
138 real(kind=kind_phys),
intent(in),
optional :: cap_suppress(:,:)
141 integer,
dimension (:),
intent(out) :: hbot,htop,kcnv
142 integer,
dimension (:),
intent(in) :: xland
143 real(kind=kind_phys),
dimension (:),
intent(in) :: pbl
144 real(kind=kind_phys),
dimension (:),
intent(in),
optional :: maxmf
147 integer,
dimension (im) :: tropics
150 real(kind=kind_phys),
dimension (:),
intent(in) :: hfx2,qfx2,psuri
151 real(kind=kind_phys),
dimension (:),
intent(in),
optional :: ca_deep
152 real(kind=kind_phys),
dimension (:,:),
intent(out),
optional :: ud_mf
153 real(kind=kind_phys),
dimension (:,:),
intent(out) :: dd_mf,dt_mf
154 real(kind=kind_phys),
dimension (:),
intent(out) :: raincv,cld1d,rainevap
155 real(kind=kind_phys),
dimension (:),
intent(out),
optional :: maxupmf
156 real(kind=kind_phys),
dimension (:,:),
intent(in) :: t2di,p2di
160 real(kind=kind_phys),
dimension (:,:),
intent(in) :: qv2di_spechum
161 real(kind=kind_phys),
dimension (:,:),
intent(inout) :: qv_spechum
162 real(kind=kind_phys),
dimension (:),
intent(inout),
optional :: aod_gf
165 real(kind=kind_phys),
dimension (im,km) :: qv2di, qv, forceqv, cnvw
168 real(kind=kind_phys),
dimension(:),
intent(in) :: garea
170 real(kind=kind_phys),
intent(in ) :: dt
172 integer,
intent(in ) :: imfshalcnv
173 integer,
dimension(:),
intent(inout),
optional :: cactiv,cactiv_m
176 character(len=*),
intent(out) :: errmsg
177 integer,
intent(out) :: errflg
180 integer,
dimension(im) :: k22_shallow,kbcon_shallow,ktop_shallow
181 real(kind=kind_phys),
dimension (im) :: rand_mom,rand_vmas
182 real(kind=kind_phys),
dimension (im,4) :: rand_clos
183 real(kind=kind_phys),
dimension (im,km,11) :: gdc,gdc2
184 real(kind=kind_phys),
dimension (im) :: ht
185 real(kind=kind_phys),
dimension (im) :: ccn_gf,ccn_m
186 real(kind=kind_phys) :: ccnclean
187 real(kind=kind_phys),
dimension (im) :: dx
188 real(kind=kind_phys),
dimension (im) :: frhm,frhd
189 real(kind=kind_phys),
dimension (im,km) :: outt,outq,outqc,phh,subm,cupclw,cupclws
190 real(kind=kind_phys),
dimension (im,km) :: dhdt,zu,zus,zd,phf,zum,zdm,outum,outvm
191 real(kind=kind_phys),
dimension (im,km) :: outts,outqs,outqcs,outu,outv,outus,outvs
192 real(kind=kind_phys),
dimension (im,km) :: outtm,outqm,outqcm,submm,cupclwm
193 real(kind=kind_phys),
dimension (im,km) :: cnvwt,cnvwts,cnvwtm
194 real(kind=kind_phys),
dimension (im,km) :: hco,hcdo,zdo,zdd,hcom,hcdom,zdom,tmfq
195 real(kind=kind_phys),
dimension (km) :: zh
196 real(kind=kind_phys),
dimension (im) :: tau_ecmwf,edt,edtm,edtd,ter11,aa0,xlandi
197 real(kind=kind_phys),
dimension (im) :: pret,prets,pretm,hexec
198 real(kind=kind_phys),
dimension (im,10) :: forcing,forcing2
200 integer,
dimension (im) :: kbcon, ktop,ierr,ierrs,ierrm,kpbli
201 integer,
dimension (im) :: k22s,kbcons,ktops,k22,jmin,jminm
202 integer,
dimension (im) :: kbconm,ktopm,k22m
215 integer :: iens,ibeg,iend,jbeg,jend,n
216 integer :: ibegh,iendh,jbegh,jendh
217 integer :: ibegc,iendc,jbegc,jendc,kstop
218 real(kind=kind_phys),
dimension(im,km) :: rho_dryar
220 real(kind=kind_phys) :: pten,pqen,paph,zrho,pahfs,pqhfl,zkhvfl,pgeoh
221 integer,
parameter :: ipn = 0
228 real(kind=kind_phys),
dimension (im,km) :: qcheck,zo,t2d,q2d,po,p2d,rhoi,clw_ten
229 real(kind=kind_phys),
dimension (im,km) :: tn,qo,tshall,qshall,dz8w,omeg
230 real(kind=kind_phys),
dimension (im) :: z1,psur,cuten,cutens,cutenm
231 real(kind=kind_phys),
dimension (im) :: umean,vmean,pmean
232 real(kind=kind_phys),
dimension (im) :: xmbs,xmbs2,xmb,xmbm,xmb_dumm,mconv
237 integer :: i,j,k,icldck,ipr,jpr,jpr_deep,ipr_deep,uidx,vidx,tidx,qidx
238 integer :: itf,jtf,ktf,iss,jss,nbegin,nend,cliw_idx,clcw_idx
239 integer :: high_resolution
240 real(kind=kind_phys) :: clwtot,clwtot1,excess,tcrit,tscl_kf,dp,dq,sub_spread,subcenter
241 real(kind=kind_phys) :: dsubclw,dsubclws,dsubclwm,dtime_max,ztm,ztq,hfm,qfm,rkbcon,rktop
242 real(kind=kind_phys),
dimension(km) :: massflx,trcflx_in1,clw_in1,po_cup
244 real(kind=kind_phys),
dimension (im) :: flux_tun,tun_rad_mid,tun_rad_shall,tun_rad_deep
246 character*50 :: ierrc(im),ierrcm(im)
247 character*50 :: ierrcs(im)
252 real(kind=kind_phys),
dimension (im) :: hfx,qfx
254 real(kind=kind_phys) tem,tem1,tf,tcr,tcrf,psum
255 real(kind=kind_phys) :: cliw_shal,clcw_shal,tem_shal, cliw_both, weight_sum
256 real(kind=kind_phys) :: cliw_deep,clcw_deep,tem_deep, clcw_both
257 integer :: cliw_deep_idx, clcw_deep_idx, cliw_shal_idx, clcw_shal_idx
259 real(kind=kind_phys) :: cap_suppress_j(im)
261 integer :: itime, do_cap_suppress_here
267 parameter(tf=258.16, tcr=273.16, tcrf=1.0/(tcr-tf))
273 ichoicem = ichoicem_in
274 ichoice_s = ichoice_s_in
276 if(do_cap_suppress)
then
278 do itime=1,num_dfi_radar
279 if(ix_dfi_radar(itime)<1) cycle
280 if(fhour<fh_dfi_radar(itime)) cycle
281 if(fhour>=fh_dfi_radar(itime+1)) cycle
286 if(do_cap_suppress .and. itime<=num_dfi_radar)
then
287 do_cap_suppress_here = 1
289 cap_suppress_j(:) = cap_suppress(:,itime)
292 do_cap_suppress_here = 0
294 cap_suppress_j(:) = 0
299 if(flag_for_dcnv_generic_tend)
then
303 cliw_deep_idx=dtidx(100+ntiw,index_of_process_dcnv)
304 clcw_deep_idx=dtidx(100+ntcw,index_of_process_dcnv)
306 if(flag_for_scnv_generic_tend)
then
310 cliw_shal_idx=dtidx(100+ntiw,index_of_process_scnv)
311 clcw_shal_idx=dtidx(100+ntcw,index_of_process_scnv)
313 if(cliw_deep_idx>=1 .or. clcw_deep_idx>=1 .or. &
314 cliw_shal_idx>=1 .or. clcw_shal_idx>=1)
then
315 allocate(clcw_save(im,km), cliw_save(im,km))
318 clcw_save(:,:)=clcw(:,:)
319 cliw_save(:,:)=cliw(:,:)
329 qv2di = qv2di_spechum/(1.0_kind_phys-qv2di_spechum)
331 forceqv = forceqv_spechum/(1.0_kind_phys-qv2di_spechum)
333 qv = qv_spechum/(1.0_kind_phys-qv_spechum)
359 tun_rad_shall(:)=.012
370 if (imfshalcnv == 5)
then
409 dz8w(i,1)=zo(i,2)-zo(i,1)
413 dz8w(i,k)=zo(i,k+1)-zo(i,k)
417 zh(k)=zh(k-1)+dz8w(i,k-1)
418 if(zh(k).gt.pbl(i))
then
434 if (flag_init .and. .not.flag_restart)
then
437 if((cactiv(i).eq.0) .and. (cactiv_m(i).eq.0))
then
438 if(aodc0>aod_gf(i)) aod_gf(i)=aod_gf(i)+((aodc0-aod_gf(i))*(dt/(aodreturn*60)))
439 if(aod_gf(i)>aodc0) aod_gf(i)=aodc0
443 ccn_gf(i)=max(5., (aod_gf(i)/0.0027)**(1/0.640))
446 ccnclean=max(5., (aodc0/0.0027)**(1/0.640))
451 xlandi(i)=real(xland(i))
469 psur(:)=0.01*psuri(:)
471 ter11(i)=max(0.,ht(i))
576 p2d(i,k)=0.01*p2di(i,k)
578 rhoi(i,k) = 100.*p2d(i,k)/(287.04*(t2di(i,k)*(1.+0.608*qv2di(i,k))))
581 qo(i,k)=max(1.e-16,qv(i,k))
582 t2d(i,k)=t2di(i,k)-forcet(i,k)*dt
583 q2d(i,k)=max(1.e-16,qv2di(i,k)-forceqv(i,k)*dt)
584 if(qo(i,k).lt.1.e-16)qo(i,k)=1.e-16
590123
format(1x,i2,1x,2(1x,f8.0),1x,2(1x,f8.3),3(1x,e13.5))
595 qshall(i,k)=max(1.e-16,qv(i,k))
603 hfx(i)=hfx2(i)*cp*rhoi(i,1)
604 qfx(i)=qfx2(i)*xlv*rhoi(i,1)
605 dx(i) = sqrt(garea(i))
611 qo(i,k)=max(1.e-16,qv(i,k))
618 dhdt(i,k)=cp*(forcet(i,k)+(t(i,k)-t2di(i,k))/dt) + &
619 xlv*(forceqv(i,k)+(qv(i,k)-qv2di(i,k))/dt)
627 if((p2d(i,1)-p2d(i,k)).gt.150.and.p2d(i,k).gt.300)
then
628 dp=-.5*(p2d(i,k+1)-p2d(i,k-1))
630 umean(i)=umean(i)+us(i,k)*dp
632 vmean(i)=vmean(i)+vs(i,k)*dp
641 if (clcw(i,k) .gt. -999.0 .and. clcw(i,k+1) .gt. -999.0 )
then
642 dp=(p2d(i,k)-p2d(i,k+1))
644 clwtot = cliw(i,k) + clcw(i,k)
645 if(clwtot.lt.1.e-32)clwtot=0.
646 forcing(i,7)=forcing(i,7)+clwtot*dp
649 if(psum.gt.0)forcing(i,7)=forcing(i,7)/psum
650 forcing2(i,7)=forcing(i,7)
658 if(mconv(i).lt.0.)mconv(i)=0.
659 if((dx(i)<6500.).and.do_mynnedmf.and.(maxmf(i).gt.0.))ierr(i)=555
662 if (dx(its)<6500.)
then
668 if(ishallow_g3.eq.1)
then
681 zo,t2d,q2d,ter11,tshall,qshall,p2d,psur,dhdt,kpbli, &
682 rhoi,hfx,qfx,xlandi,ichoice_s,tcrit,dt, &
685 zus,xmbs,kbcons,ktops,k22s,ierrs,ierrcs, &
687 flag_init, flag_restart,fv,r_d,delp,tmfq,qmicro, &
688 forceqv_spechum,betascu,betamcu,betadcu,sigmain, &
691 outts,outqs,outqcs,outus,outvs,cnvwt,prets,cupclws, &
693 itf,ktf,its,ite, kts,kte,ipr,tropics)
697 if(xmbs(i).gt.0.)
then
703 call neg_check(
'shallow',ipn,dt,qcheck,outqs,outts,outus,outvs, &
704 outqcs,prets,its,ite,kts,kte,itf,ktf,ktops)
712 itf,ktf,its,ite, kts,kte &
789 ,do_cap_suppress_here,cap_suppress_j &
795 qcheck(i,k)=qv(i,k) +outqs(i,k)*dt
800 call neg_check(
'mid',ipn,dt,qcheck,outqm,outtm,outum,outvm, &
801 outqcm,pretm,its,ite,kts,kte,itf,ktf,ktopm)
806 itf,ktf,its,ite, kts,kte &
883 ,do_cap_suppress_here,cap_suppress_j &
891 qcheck(i,k)=qv(i,k) +(outqs(i,k)+outqm(i,k))*dt
896 call neg_check(
'deep',ipn,dt,qcheck,outq,outt,outu,outv, &
897 outqc,pret,its,ite,kts,kte,itf,ktf,ktop)
903 if(pretm(i).gt.0.)
then
912 if(pret(i).gt.0.)
then
937 if(ktopm(i).gt.kts .or. ktop(i).gt.kts)kstop=max(ktopm(i),ktop(i))
938 if(ktops(i).gt.kts)kstop=max(kstop,ktops(i))
941 if(kbcon(i).gt.2 .or. kbconm(i).gt.2)
then
942 hbot(i)=max(kbconm(i),kbcon(i))
948 cnvc(i,k) = 0.04 * log(1. + 675. * zu(i,k) * xmb(i)) + &
949 0.04 * log(1. + 675. * zum(i,k) * xmbm(i)) + &
950 0.04 * log(1. + 675. * zus(i,k) * xmbs(i))
951 cnvc(i,k) = min(cnvc(i,k), 0.6)
952 cnvc(i,k) = max(cnvc(i,k), 0.0)
953 cnvw(i,k)=cnvwt(i,k)*xmb(i)*dt+cnvwts(i,k)*xmbs(i)*dt+cnvwtm(i,k)*xmbm(i)*dt
954 ud_mf(i,k)=cuten(i)*zu(i,k)*xmb(i)*dt
955 dd_mf(i,k)=cuten(i)*zd(i,k)*edt(i)*xmb(i)*dt
956 t(i,k)=t(i,k)+dt*(cutens(i)*outts(i,k)+cutenm(i)*outtm(i,k)+outt(i,k)*cuten(i))
957 qv(i,k)=max(1.e-16,qv(i,k)+dt*(cutens(i)*outqs(i,k)+cutenm(i)*outqm(i,k)+outq(i,k)*cuten(i)))
958 gdc(i,k,7)=sqrt(us(i,k)**2 +vs(i,k)**2)
959 us(i,k)=us(i,k)+outu(i,k)*cuten(i)*dt +outum(i,k)*cutenm(i)*dt +outus(i,k)*cutens(i)*dt
960 vs(i,k)=vs(i,k)+outv(i,k)*cuten(i)*dt +outvm(i,k)*cutenm(i)*dt +outvs(i,k)*cutens(i)*dt
962 gdc(i,k,1)= max(0.,tun_rad_shall(i)*cupclws(i,k)*cutens(i))
964 gdc2(i,k,1)=max(0.,tun_rad_mid(i)*cupclwm(i,k)*cutenm(i)+tun_rad_deep(i)*cupclw(i,k)*cuten(i)+tun_rad_shall(i)*cupclws(i,k)*cutens(i))
966 qci_conv(i,k)=gdc2(i,k,1)
967 gdc(i,k,2)=(outt(i,k))*86400.
968 gdc(i,k,3)=(outtm(i,k))*86400.
969 gdc(i,k,4)=(outts(i,k))*86400.
970 gdc(i,k,7)=-(gdc(i,k,7)-sqrt(us(i,k)**2 +vs(i,k)**2))/dt
972 gdc(i,k,8)=(outqm(i,k)+outqs(i,k)+outq(i,k))*86400.*xlv/cp
973 gdc(i,k,9)=gdc(i,k,2)+gdc(i,k,3)+gdc(i,k,4)
976 dp=100.*(p2d(i,k)-p2d(i,k+1))
977 dtime_max=min(dtime_max,.5*dp)
978 po_cup(k)=.5*(p2d(i,k)+p2d(i,k+1))
979 if (clcw(i,k) .gt. -999.0 .and. clcw(i,k+1) .gt. -999.0 )
then
980 clwtot = cliw(i,k) + clcw(i,k)
981 if(clwtot.lt.1.e-32)clwtot=0.
982 clwtot1= cliw(i,k+1) + clcw(i,k+1)
983 if(clwtot1.lt.1.e-32)clwtot1=0.
985 massflx(k)=-(xmb(i) *( zu(i,k)- edt(i)* zd(i,k))) &
986 -(xmbm(i)*(zdm(i,k)-edtm(i)*zdm(i,k))) &
988 trcflx_in1(k)=massflx(k)*.5*(clwtot+clwtot1)
989 forcing2(i,3)=forcing2(i,3)+clwtot
995 call fct1d3 (kstop,kte,dtime_max,po_cup, &
996 clw_in1,massflx,trcflx_in1,clw_ten(i,:),g)
999 tem = dt*(outqcs(i,k)*cutens(i)+outqc(i,k)*cuten(i) &
1000 +outqcm(i,k)*cutenm(i) &
1003 tem1 = max(0.0, min(1.0, (tcr-t(i,k))*tcrf))
1004 if (clcw(i,k) .gt. -999.0)
then
1005 cliw(i,k) = max(0.,cliw(i,k) + tem * tem1)
1006 clcw(i,k) = max(0.,clcw(i,k) + tem *(1.0-tem1))
1008 cliw(i,k) = max(0.,cliw(i,k) + tem)
1013 gdc(i,1,10)=forcing(i,1)
1014 gdc(i,2,10)=forcing(i,2)
1015 gdc(i,3,10)=forcing(i,3)
1016 gdc(i,4,10)=forcing(i,4)
1017 gdc(i,5,10)=forcing(i,5)
1018 gdc(i,6,10)=forcing(i,6)
1019 gdc(i,7,10)=forcing(i,7)
1020 gdc(i,8,10)=forcing(i,8)
1022 gdc(i,11,10)=xmbm(i)
1023 gdc(i,12,10)=xmbs(i)
1026 gdc(i,16,10)=pret(i)*3600.
1029 if(forcing2(i,6).gt.0.)
then
1030 maxupmf(i)=maxval(xmb(i)*zu(i,kts:ktf)/forcing2(i,6))
1033 if(ktop(i).gt.2 .and.pret(i).gt.0.)dt_mf(i,ktop(i)-1)=ud_mf(i,ktop(i))
1039 if(pret(i).gt.0.)
then
1041 raincv(i)=.001*(cutenm(i)*pretm(i)+cutens(i)*prets(i)+cuten(i)*pret(i))*dt
1044 if(pretm(i).gt.0)raincv(i)=.001*cutenm(i)*pretm(i)*dt
1047 if(pretm(i).gt.0)
then
1054 if(ccn_m(i).lt.ccn_gf(i))
then
1058 if(ccn_gf(i)<0) ccn_gf(i)=0
1061 aod_gf(i)=0.0027*(ccn_gf(i)**0.64)
1062 if(aod_gf(i)<0.007)
then
1064 ccn_gf(i)=(aod_gf(i)/0.0027)**(1/0.640)
1065 elseif(aod_gf(i)>aodc0)
then
1067 ccn_gf(i)=(aod_gf(i)/0.0027)**(1/0.640)
1076 qv_spechum = qv/(1.0_kind_phys+qv)
1077 cnvw_moist = cnvw/(1.0_kind_phys+qv)
1083 if(ishallow_g3.eq.1 .and. .not.flag_for_scnv_generic_tend)
then
1084 uidx=dtidx(index_of_x_wind,index_of_process_scnv)
1085 vidx=dtidx(index_of_y_wind,index_of_process_scnv)
1086 tidx=dtidx(index_of_temperature,index_of_process_scnv)
1087 qidx=dtidx(100+ntqv,index_of_process_scnv)
1091 dtend(:,k,uidx) = dtend(:,k,uidx) + cutens(:)*outus(:,k) * dt
1098 dtend(:,k,vidx) = dtend(:,k,vidx) + cutens(:)*outvs(:,k) * dt
1105 dtend(:,k,tidx) = dtend(:,k,tidx) + cutens(:)*outts(:,k) * dt
1113 tem = cutens(i)*outqs(i,k)* dt
1114 tem = tem/(1.0_kind_phys+tem)
1115 dtend(i,k,qidx) = dtend(i,k,qidx) + tem
1121 if((ideep.eq.1. .or. imid_gf.eq.1) .and. .not.flag_for_dcnv_generic_tend)
then
1122 uidx=dtidx(index_of_x_wind,index_of_process_dcnv)
1123 vidx=dtidx(index_of_y_wind,index_of_process_dcnv)
1124 tidx=dtidx(index_of_temperature,index_of_process_dcnv)
1128 dtend(:,k,uidx) = dtend(:,k,uidx) + (cuten*outu(:,k)+cutenm*outum(:,k)) * dt
1135 dtend(:,k,vidx) = dtend(:,k,vidx) + (cuten*outv(:,k)+cutenm*outvm(:,k)) * dt
1142 dtend(:,k,tidx) = dtend(:,k,tidx) + (cuten*outt(:,k)+cutenm*outtm(:,k)) * dt
1147 qidx=dtidx(100+ntqv,index_of_process_dcnv)
1152 tem = (cuten(i)*outq(i,k) + cutenm(i)*outqm(i,k))* dt
1153 tem = tem/(1.0_kind_phys+tem)
1154 dtend(i,k,qidx) = dtend(i,k,qidx) + tem
1160 if(
allocated(clcw_save))
then
1164 tem_shal = dt*(outqcs(i,k)*cutens(i)+outqcm(i,k)*cutenm(i))
1165 tem_deep = dt*(outqc(i,k)*cuten(i)+clw_ten(i,k))
1166 tem = tem_shal+tem_deep
1167 tem1 = max(0.0, min(1.0, (tcr-t(i,k))*tcrf))
1168 weight_sum = abs(tem_shal)+abs(tem_deep)
1169 if(weight_sum<1e-12)
then
1173 if (clcw_save(i,k) .gt. -999.0)
then
1174 cliw_both = max(0.,cliw_save(i,k) + tem * tem1) - cliw_save(i,k)
1175 clcw_both = max(0.,clcw_save(i,k) + tem) - clcw_save(i,k)
1176 else if(cliw_idx>=1)
then
1177 cliw_both = max(0.,cliw_save(i,k) + tem) - cliw_save(i,k)
1180 if(cliw_deep_idx>=1)
then
1181 dtend(i,k,cliw_deep_idx) = dtend(i,k,cliw_deep_idx) + abs(tem_deep)/weight_sum*cliw_both
1183 if(clcw_deep_idx>=1)
then
1184 dtend(i,k,clcw_deep_idx) = dtend(i,k,clcw_deep_idx) + abs(tem_deep)/weight_sum*clcw_both
1186 if(cliw_shal_idx>=1)
then
1187 dtend(i,k,cliw_shal_idx) = dtend(i,k,cliw_shal_idx) + abs(tem_shal)/weight_sum*cliw_both
1189 if(clcw_shal_idx>=1)
then
1190 dtend(i,k,clcw_shal_idx) = dtend(i,k,clcw_shal_idx) + abs(tem_shal)/weight_sum*clcw_both