59 subroutine cu_gf_driver_run(ntracer,garea,im,km,dt,flag_init,flag_restart, gf_coldstart, &
60 cactiv,cactiv_m,g,cp,xlv,r_v,forcet,forceqv_spechum,phil,raincv, &
61 qv_spechum,t,cld1d,us,vs,t2di,w,qv2di_spechum,p2di,psuri, &
62 hbot,htop,kcnv,xland,hfx2,qfx2,aod_gf,cliw,clcw, &
63 pbl,ud_mf,dd_mf,dt_mf,cnvw_moist,cnvc,imfshalcnv, &
64 flag_for_scnv_generic_tend,flag_for_dcnv_generic_tend, &
65 dtend,dtidx,ntqv,ntiw,ntcw,index_of_temperature,index_of_x_wind, &
66 index_of_y_wind,index_of_process_scnv,index_of_process_dcnv, &
67 fhour,fh_dfi_radar,ix_dfi_radar,num_dfi_radar,cap_suppress, &
68 dfi_radar_max_intervals,ldiag3d,qci_conv,do_cap_suppress, &
69 maxupmf,maxMF,do_mynnedmf,ichoice_in,ichoicem_in,ichoice_s_in, &
70 spp_cu_deep,spp_wts_cu_deep,nchem,chem3d,fscav,wetdpc_deep, &
71 do_smoke_transport,kdt,ten_t,ten_u,ten_v,ten_q,dcliw,dclcw,errmsg,errflg)
74 integer,
parameter :: maxiens=1
75 integer,
parameter :: maxens=1
76 integer,
parameter :: maxens2=1
77 integer,
parameter :: maxens3=16
78 integer,
parameter :: ensdim=16
80 integer,
parameter :: ideep=1
82 integer :: ichoicem=13
83 integer :: ichoice_s=3
84 integer,
intent(in) :: spp_cu_deep
85 real(kind_phys),
dimension(:,:),
optional,
intent(in) :: &
87 real(kind=kind_phys) :: spp_wts_cu_deep_tmp
89 logical,
intent(in) :: do_cap_suppress, do_smoke_transport
90 real(kind=kind_phys),
parameter :: aodc0=0.14
91 real(kind=kind_phys),
parameter :: aodreturn=30.
92 real(kind=kind_phys) :: dts,fpi,fp
93 integer,
parameter :: dicycle=0
94 integer,
parameter :: dicycle_m=0
95 integer :: ishallow_g3
97 integer :: its,ite, jts,jte, kts,kte
98 integer,
intent(in ) :: im,km,ntracer,nchem,kdt
99 integer,
intent(in ) :: ichoice_in,ichoicem_in,ichoice_s_in
100 logical,
intent(in ) :: flag_init, flag_restart, do_mynnedmf, gf_coldstart
101 logical,
intent(in ) :: flag_for_scnv_generic_tend,flag_for_dcnv_generic_tend
102 real (kind=kind_phys),
intent(in) :: g,cp,xlv,r_v
103 logical,
intent(in ) :: ldiag3d
105 real(kind=kind_phys),
intent(inout),
optional :: dtend(:,:,:)
107 integer,
intent(in) :: dtidx(:,:), &
108 index_of_x_wind, index_of_y_wind, index_of_temperature, &
109 index_of_process_scnv, index_of_process_dcnv, ntqv, ntcw, ntiw
111 real(kind=kind_phys),
dimension( : , : ),
intent(in ),
optional :: forcet,forceqv_spechum
112 real(kind=kind_phys),
dimension( : , : ),
intent(in ) :: w,phil
113 real(kind=kind_phys),
dimension( : , : ),
intent(in ) :: t,us,vs
114 real(kind=kind_phys),
dimension( : , : ),
intent(inout ),
optional :: qci_conv
115 real(kind=kind_phys),
dimension( : , : ),
intent(out ) :: cnvw_moist,cnvc
116 real(kind=kind_phys),
dimension( : , : ),
intent(in ) :: cliw, clcw
121 real(kind=kind_phys),
allocatable :: clcw_save(:,:), cliw_save(:,:)
123 integer,
intent(in) :: dfi_radar_max_intervals
124 real(kind=kind_phys),
intent(in) :: fhour, fh_dfi_radar(:)
125 integer,
intent(in) :: num_dfi_radar, ix_dfi_radar(:)
126 real(kind=kind_phys),
intent(in),
optional :: cap_suppress(:,:)
129 integer,
dimension (:),
intent(out) :: hbot,htop,kcnv
130 integer,
dimension (:),
intent(in) :: xland
131 real(kind=kind_phys),
dimension (:),
intent(in) :: pbl
132 real(kind=kind_phys),
dimension (:),
intent(in) :: maxmf
135 integer,
dimension (im) :: tropics
138 real(kind=kind_phys),
dimension (:),
intent(in) :: hfx2,qfx2,psuri
139 real(kind=kind_phys),
dimension (:,:),
intent(out) :: dd_mf,dt_mf
140 real(kind=kind_phys),
dimension (:,:),
intent(out),
optional :: ud_mf
141 real(kind=kind_phys),
dimension (:),
intent(out) :: raincv,cld1d
142 real(kind=kind_phys),
dimension (:),
intent(out),
optional :: maxupmf
143 real(kind=kind_phys),
dimension (:,:),
intent(in) :: t2di,p2di
147 real(kind=kind_phys),
dimension (:,:),
intent(in) :: qv2di_spechum
148 real(kind=kind_phys),
dimension (:,:),
intent(in) :: qv_spechum
149 real(kind=kind_phys),
dimension (:),
intent(inout),
optional :: aod_gf
152 real(kind=kind_phys),
dimension (im,km) :: qv2di, qv, forceqv, cnvw
155 real(kind=kind_phys),
dimension(:),
intent(in) :: garea
157 real(kind=kind_phys),
intent(in ) :: dt
159 integer,
intent(in ) :: imfshalcnv
160 integer,
dimension(:),
intent(inout),
optional :: cactiv,cactiv_m
161 real(kind_phys),
dimension(:),
intent(in) :: fscav
163 real(kind_phys),
dimension(:,:,:),
intent(inout),
optional :: chem3d
164 real(kind_phys),
dimension(:,:),
intent(inout),
optional :: wetdpc_deep
166 real(kind_phys),
dimension(:,:),
intent(out) :: ten_t, ten_u, ten_v, dcliw, dclcw
167 real(kind_phys),
dimension(:,:,:),
intent(out) :: ten_q
169 character(len=*),
intent(out) :: errmsg
170 integer,
intent(out) :: errflg
173 integer,
dimension(im) :: k22_shallow,kbcon_shallow,ktop_shallow
174 real(kind=kind_phys),
dimension (im) :: rand_mom,rand_vmas
175 real(kind=kind_phys),
dimension (im,4) :: rand_clos
176 real(kind=kind_phys),
dimension (im,km,11) :: gdc,gdc2
177 real(kind=kind_phys),
dimension (im) :: ht
178 real(kind=kind_phys),
dimension (im) :: ccn_gf,ccn_m
179 real(kind=kind_phys) :: ccnclean
180 real(kind=kind_phys),
dimension (im) :: dx
181 real(kind=kind_phys),
dimension (im) :: frhm,frhd
182 real(kind=kind_phys),
dimension (im,km) :: outt,outq,outqc,phh,subm,cupclw,cupclws
183 real(kind=kind_phys),
dimension (im,km) :: dhdt,zu,zus,zd,phf,zum,zdm,outum,outvm
184 real(kind=kind_phys),
dimension (im,km) :: outts,outqs,outqcs,outu,outv,outus,outvs
185 real(kind=kind_phys),
dimension (im,km) :: outtm,outqm,outqcm,submm,cupclwm
186 real(kind=kind_phys),
dimension (im,km) :: cnvwt,cnvwts,cnvwtm
187 real(kind=kind_phys),
dimension (im,km) :: hco,hcdo,zdo,zdd,hcom,hcdom,zdom
188 real(kind=kind_phys),
dimension (km) :: zh
189 real(kind=kind_phys),
dimension (im) :: tau_ecmwf,edt,edtm,edtd,ter11,aa0,xlandi
190 real(kind=kind_phys),
dimension (im) :: pret,prets,pretm,hexec
191 real(kind=kind_phys),
dimension (im,10) :: forcing,forcing2
192 real(kind=kind_phys),
dimension (im,nchem) :: wetdpc_mid
194 integer,
dimension (im) :: kbcon, ktop,ierr,ierrs,ierrm,kpbli
195 integer,
dimension (im) :: k22s,kbcons,ktops,k22,jmin,jminm
196 integer,
dimension (im) :: kbconm,ktopm,k22m
209 integer :: iens,ibeg,iend,jbeg,jend,n
210 integer :: ibegh,iendh,jbegh,jendh
211 integer :: ibegc,iendc,jbegc,jendc,kstop
212 real(kind=kind_phys),
dimension(im,km) :: rho_dryar
214 real(kind=kind_phys) :: pten,pqen,paph,zrho,pahfs,pqhfl,zkhvfl,pgeoh
215 integer,
parameter :: ipn = 0
222 real(kind=kind_phys),
dimension (im,km) :: qcheck,zo,t2d,q2d,po,p2d,rhoi,clw_ten,new_qv_spechum,new_cliw,new_clcw
223 real(kind=kind_phys),
dimension (im,km) :: tn,qo,tshall,qshall,dz8w,omeg
224 real(kind=kind_phys),
dimension (im) :: z1,psur,cuten,cutens,cutenm
225 real(kind=kind_phys),
dimension (im) :: umean,vmean,pmean,mc_thresh
226 real(kind=kind_phys),
dimension (im) :: xmbs,xmbs2,xmb,xmbm,xmb_dumm,mconv
231 integer :: i,j,k,icldck,ipr,jpr,jpr_deep,ipr_deep,uidx,vidx,tidx,qidx
232 integer :: itf,jtf,ktf,iss,jss,nbegin,nend,cliw_idx,clcw_idx
233 integer :: high_resolution
234 real(kind=kind_phys) :: clwtot,clwtot1,excess,tcrit,tscl_kf,dp,dq,sub_spread,subcenter
235 real(kind=kind_phys) :: dsubclw,dsubclws,dsubclwm,dtime_max,ztm,ztq,hfm,qfm,rkbcon,rktop
236 real(kind=kind_phys),
dimension(km) :: massflx,trcflx_in1,clw_in1,po_cup
238 real(kind=kind_phys),
dimension (im) :: flux_tun,tun_rad_mid,tun_rad_shall,tun_rad_deep
240 character*50 :: ierrc(im),ierrcm(im)
241 character*50 :: ierrcs(im)
246 real(kind=kind_phys),
dimension (im) :: hfx,qfx
248 real(kind=kind_phys) tem,tem1,tf,tcr,tcrf,psum
249 real(kind=kind_phys) :: cliw_shal,clcw_shal,tem_shal, cliw_both, weight_sum
250 real(kind=kind_phys) :: cliw_deep,clcw_deep,tem_deep, clcw_both
251 integer :: cliw_deep_idx, clcw_deep_idx, cliw_shal_idx, clcw_shal_idx
253 real(kind=kind_phys) :: cap_suppress_j(im)
255 integer :: itime, do_cap_suppress_here
261 parameter(tf=258.16, tcr=273.16, tcrf=1.0/(tcr-tf))
276 ichoicem = ichoicem_in
277 ichoice_s = ichoice_s_in
278 if(do_cap_suppress)
then
280 do itime=1,num_dfi_radar
281 if(ix_dfi_radar(itime)<1) cycle
282 if(fhour<fh_dfi_radar(itime)) cycle
283 if(fhour>=fh_dfi_radar(itime+1)) cycle
288 if(do_cap_suppress .and. itime<=num_dfi_radar)
then
289 do_cap_suppress_here = 1
291 cap_suppress_j(:) = cap_suppress(:,itime)
294 do_cap_suppress_here = 0
296 cap_suppress_j(:) = 0
301 if(flag_for_dcnv_generic_tend)
then
305 cliw_deep_idx=dtidx(100+ntiw,index_of_process_dcnv)
306 clcw_deep_idx=dtidx(100+ntcw,index_of_process_dcnv)
308 if(flag_for_scnv_generic_tend)
then
312 cliw_shal_idx=dtidx(100+ntiw,index_of_process_scnv)
313 clcw_shal_idx=dtidx(100+ntcw,index_of_process_scnv)
315 if(cliw_deep_idx>=1 .or. clcw_deep_idx>=1 .or. &
316 cliw_shal_idx>=1 .or. clcw_shal_idx>=1)
then
317 allocate(clcw_save(im,km), cliw_save(im,km))
320 clcw_save(:,:)=clcw(:,:)
321 cliw_save(:,:)=cliw(:,:)
331 qv2di = qv2di_spechum/(1.0_kind_phys-qv2di_spechum)
333 forceqv = forceqv_spechum/(1.0_kind_phys-qv2di_spechum)
335 qv = qv_spechum/(1.0_kind_phys-qv_spechum)
341 if (spp_cu_deep == 0)
then
347 spp_wts_cu_deep_tmp=min(max(-1.0_kind_phys, spp_wts_cu_deep(i,1)),1.0_kind_phys)
348 rand_mom(i) = spp_wts_cu_deep_tmp
349 rand_vmas(i) = spp_wts_cu_deep_tmp
350 rand_clos(i,:) = spp_wts_cu_deep_tmp
381 if (imfshalcnv == 3)
then
420 dz8w(i,1)=zo(i,2)-zo(i,1)
424 dz8w(i,k)=zo(i,k+1)-zo(i,k)
428 zh(k)=zh(k-1)+dz8w(i,k-1)
429 if(zh(k).gt.pbl(i))
then
445 if ((flag_init .and. .not.flag_restart) .or. gf_coldstart)
then
448 if((cactiv(i).eq.0) .and. (cactiv_m(i).eq.0))
then
449 if(aodc0>aod_gf(i)) aod_gf(i)=aod_gf(i)+((aodc0-aod_gf(i))*(dt/(aodreturn*60)))
450 if(aod_gf(i)>aodc0) aod_gf(i)=aodc0
454 ccn_gf(i)=max(5., (aod_gf(i)/0.0027)**(1/0.640))
457 ccnclean=max(5., (aodc0/0.0027)**(1/0.640))
462 xlandi(i)=real(xland(i))
480 psur(:)=0.01*psuri(:)
482 ter11(i)=max(0.,ht(i))
580 p2d(i,k)=0.01*p2di(i,k)
582 rhoi(i,k) = 100.*p2d(i,k)/(287.04*(t2di(i,k)*(1.+0.608*qv2di(i,k))))
585 qo(i,k)=max(1.e-16,qv(i,k))
586 t2d(i,k)=t2di(i,k)-forcet(i,k)*dt
587 q2d(i,k)=max(1.e-16,qv2di(i,k)-forceqv(i,k)*dt)
588 if(qo(i,k).lt.1.e-16)qo(i,k)=1.e-16
594123
format(1x,i2,1x,2(1x,f8.0),1x,2(1x,f8.3),3(1x,e13.5))
599 qshall(i,k)=max(1.e-16,qv(i,k))
607 hfx(i)=hfx2(i)*cp*rhoi(i,1)
608 qfx(i)=qfx2(i)*xlv*rhoi(i,1)
609 dx(i) = sqrt(garea(i))
610 mc_thresh(i)=3.25/dx(i)
616 qo(i,k)=max(1.e-16,qv(i,k))
623 dhdt(i,k)=cp*(forcet(i,k)+(t(i,k)-t2di(i,k))/dt) + &
624 xlv*(forceqv(i,k)+(qv(i,k)-qv2di(i,k))/dt)
632 if((p2d(i,1)-p2d(i,k)).gt.150.and.p2d(i,k).gt.300)
then
633 dp=-.5*(p2d(i,k+1)-p2d(i,k-1))
635 umean(i)=umean(i)+us(i,k)*dp
637 vmean(i)=vmean(i)+vs(i,k)*dp
646 if (clcw(i,k) .gt. -999.0 .and. clcw(i,k+1) .gt. -999.0 )
then
647 dp=(p2d(i,k)-p2d(i,k+1))
649 clwtot = cliw(i,k) + clcw(i,k)
650 if(clwtot.lt.1.e-32)clwtot=0.
651 forcing(i,7)=forcing(i,7)+clwtot*dp
654 if(psum.gt.0)forcing(i,7)=forcing(i,7)/psum
655 forcing2(i,7)=forcing(i,7)
663 if(mconv(i).lt.0.)mconv(i)=0.
664 if((dx(i)<6500.).and.do_mynnedmf.and.(maxmf(i).gt.0.))ierr(i)=555
667 if (dx(its)<6500.)
then
673 if(ishallow_g3.eq.1)
then
686 zo,t2d,q2d,ter11,tshall,qshall,p2d,psur,dhdt,kpbli, &
687 rhoi,hfx,qfx,xlandi,ichoice_s,tcrit,dt, &
690 zus,xmbs,kbcons,ktops,k22s,ierrs,ierrcs, &
692 outts,outqs,outqcs,outus,outvs,cnvwt,prets,cupclws, &
694 itf,ktf,its,ite, kts,kte,ipr,tropics)
698 if(xmbs(i).gt.0.)
then
700 if (dx(i)<6500.)
then
708 call neg_check(
'shallow',ipn,dt,qcheck,outqs,outts,outus,outvs, &
709 outqcs,prets,its,ite,kts,kte,itf,ktf,ktops)
717 itf,ktf,its,ite, kts,kte &
771 ,do_smoke_transport &
783 ,do_cap_suppress_here,cap_suppress_j &
785 ,jminm,kdt,mc_thresh)
789 qcheck(i,k)=qv(i,k) +outqs(i,k)*dt
794 call neg_check(
'mid',ipn,dt,qcheck,outqm,outtm,outum,outvm, &
795 outqcm,pretm,its,ite,kts,kte,itf,ktf,ktopm)
800 itf,ktf,its,ite, kts,kte &
857 ,do_smoke_transport &
869 ,do_cap_suppress_here,cap_suppress_j &
877 qcheck(i,k)=qv(i,k) +(outqs(i,k)+outqm(i,k))*dt
882 call neg_check(
'deep',ipn,dt,qcheck,outq,outt,outu,outv, &
883 outqc,pret,its,ite,kts,kte,itf,ktf,ktop)
889 if(pretm(i).gt.0.)
then
899 if(forcing2(i,6).gt.0.)
then
900 maxupmf(i)=maxval(xmb(i)*zu(i,kts:ktf)/forcing2(i,6))
903 if((maxupmf(i).lt.0.1) .or. (pret(i)*3600.lt.0.05)) pret(i)=0.
905 if(pret(i).gt.0.)
then
930 if(ktopm(i).gt.kts .or. ktop(i).gt.kts)kstop=max(ktopm(i),ktop(i))
931 if(ktops(i).gt.kts)kstop=max(kstop,ktops(i))
934 if(kbcon(i).gt.2 .or. kbconm(i).gt.2)
then
935 hbot(i)=max(kbconm(i),kbcon(i))
941 cnvc(i,k) = 0.04 * log(1. + 675. * zu(i,k) * xmb(i)) + &
942 0.04 * log(1. + 675. * zum(i,k) * xmbm(i)) + &
943 0.04 * log(1. + 675. * zus(i,k) * xmbs(i))
944 cnvc(i,k) = min(cnvc(i,k), 0.6)
945 cnvc(i,k) = max(cnvc(i,k), 0.0)
946 cnvw(i,k)=cnvwt(i,k)*xmb(i)*dt+cnvwts(i,k)*xmbs(i)*dt+cnvwtm(i,k)*xmbm(i)*dt
947 ud_mf(i,k)=cuten(i)*zu(i,k)*xmb(i)*dt
948 dd_mf(i,k)=cuten(i)*zd(i,k)*edt(i)*xmb(i)*dt
950 ten_t(i,k) = (cutens(i)*outts(i,k)+cutenm(i)*outtm(i,k)+outt(i,k)*cuten(i))
951 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)))
952 gdc(i,k,7)=sqrt(us(i,k)**2 +vs(i,k)**2)
953 ten_u(i,k) = outu(i,k)*cuten(i) +outum(i,k)*cutenm(i) +outus(i,k)*cutens(i)
954 ten_v(i,k) = outv(i,k)*cuten(i) +outvm(i,k)*cutenm(i) +outvs(i,k)*cutens(i)
956 gdc(i,k,1)= max(0.,tun_rad_shall(i)*cupclws(i,k)*cutens(i))
958 gdc2(i,k,1)=max(0.,tun_rad_mid(i)*cupclwm(i,k)*cutenm(i)+frhd(i)*cupclw(i,k)*cuten(i)+tun_rad_shall(i)*cupclws(i,k)*cutens(i))
960 qci_conv(i,k)=gdc2(i,k,1)
961 gdc(i,k,2)=(outt(i,k))*86400.
962 gdc(i,k,3)=(outtm(i,k))*86400.
963 gdc(i,k,4)=(outts(i,k))*86400.
964 gdc(i,k,7)=-(gdc(i,k,7)-sqrt(us(i,k)**2 +vs(i,k)**2))/dt
966 gdc(i,k,8)=(outqm(i,k)+outqs(i,k)+outq(i,k))*86400.*xlv/cp
967 gdc(i,k,9)=gdc(i,k,2)+gdc(i,k,3)+gdc(i,k,4)
970 dp=100.*(p2d(i,k)-p2d(i,k+1))
971 dtime_max=min(dtime_max,.5*dp)
972 po_cup(k)=.5*(p2d(i,k)+p2d(i,k+1))
973 if (clcw(i,k) .gt. -999.0 .and. clcw(i,k+1) .gt. -999.0 )
then
974 clwtot = cliw(i,k) + clcw(i,k)
975 if(clwtot.lt.1.e-32)clwtot=0.
976 clwtot1= cliw(i,k+1) + clcw(i,k+1)
977 if(clwtot1.lt.1.e-32)clwtot1=0.
979 massflx(k)=-(xmb(i) *( zu(i,k)- edt(i)* zd(i,k))) &
980 -(xmbm(i)*(zdm(i,k)-edtm(i)*zdm(i,k))) &
982 trcflx_in1(k)=massflx(k)*.5*(clwtot+clwtot1)
983 forcing2(i,3)=forcing2(i,3)+clwtot
989 call fct1d3 (kstop,kte,dtime_max,po_cup, &
990 clw_in1,massflx,trcflx_in1,clw_ten(i,:),g)
993 tem = dt*(outqcs(i,k)*cutens(i)+outqc(i,k)*cuten(i) &
994 +outqcm(i,k)*cutenm(i) &
997 tem1 = max(0.0, min(1.0, (tcr-t(i,k))*tcrf))
998 if (clcw(i,k) .gt. -999.0)
then
999 new_cliw(i,k) = max(0.,cliw(i,k) + tem * tem1)
1000 new_clcw(i,k) = max(0.,clcw(i,k) + tem *(1.0-tem1))
1001 dcliw(i,k) = (new_cliw(i,k) - cliw(i,k))/dt
1002 dclcw(i,k) = (new_clcw(i,k) - clcw(i,k))/dt
1004 new_cliw(i,k) = max(0.,cliw(i,k) + tem)
1005 dcliw(i,k) = (new_cliw(i,k) - cliw(i,k))/dt
1010 gdc(i,1,10)=forcing(i,1)
1011 gdc(i,2,10)=forcing(i,2)
1012 gdc(i,3,10)=forcing(i,3)
1013 gdc(i,4,10)=forcing(i,4)
1014 gdc(i,5,10)=forcing(i,5)
1015 gdc(i,6,10)=forcing(i,6)
1016 gdc(i,7,10)=forcing(i,7)
1017 gdc(i,8,10)=forcing(i,8)
1019 gdc(i,11,10)=xmbm(i)
1020 gdc(i,12,10)=xmbs(i)
1023 gdc(i,16,10)=pret(i)*3600.
1026 if(ktop(i).gt.2 .and.pret(i).gt.0.)dt_mf(i,ktop(i)-1)=ud_mf(i,ktop(i))
1032 if(pret(i).gt.0.)
then
1034 raincv(i)=.001*(cutenm(i)*pretm(i)+cutens(i)*prets(i)+cuten(i)*pret(i))*dt
1037 if(pretm(i).gt.0)raincv(i)=.001*cutenm(i)*pretm(i)*dt
1040 if(pretm(i).gt.0)
then
1047 if(ccn_m(i).lt.ccn_gf(i))
then
1051 if(ccn_gf(i)<0) ccn_gf(i)=0
1054 aod_gf(i)=0.0027*(ccn_gf(i)**0.64)
1055 if(aod_gf(i)<0.007)
then
1057 ccn_gf(i)=(aod_gf(i)/0.0027)**(1/0.640)
1058 elseif(aod_gf(i)>aodc0)
then
1060 ccn_gf(i)=(aod_gf(i)/0.0027)**(1/0.640)
1069 new_qv_spechum = qv/(1.0_kind_phys+qv)
1070 cnvw_moist = cnvw/(1.0_kind_phys+qv)
1074 ten_q(i,k,ntqv) = (new_qv_spechum(i,k) - qv_spechum(i,k))/dt
1081 if(ishallow_g3.eq.1 .and. .not.flag_for_scnv_generic_tend)
then
1082 uidx=dtidx(index_of_x_wind,index_of_process_scnv)
1083 vidx=dtidx(index_of_y_wind,index_of_process_scnv)
1084 tidx=dtidx(index_of_temperature,index_of_process_scnv)
1085 qidx=dtidx(100+ntqv,index_of_process_scnv)
1089 dtend(:,k,uidx) = dtend(:,k,uidx) + cutens(:)*outus(:,k) * dt
1096 dtend(:,k,vidx) = dtend(:,k,vidx) + cutens(:)*outvs(:,k) * dt
1103 dtend(:,k,tidx) = dtend(:,k,tidx) + cutens(:)*outts(:,k) * dt
1111 tem = cutens(i)*outqs(i,k)* dt
1112 tem = tem/(1.0_kind_phys+tem)
1113 dtend(i,k,qidx) = dtend(i,k,qidx) + tem
1119 if((ideep.eq.1. .or. imid_gf.eq.1) .and. .not.flag_for_dcnv_generic_tend)
then
1120 uidx=dtidx(index_of_x_wind,index_of_process_dcnv)
1121 vidx=dtidx(index_of_y_wind,index_of_process_dcnv)
1122 tidx=dtidx(index_of_temperature,index_of_process_dcnv)
1126 dtend(:,k,uidx) = dtend(:,k,uidx) + (cuten*outu(:,k)+cutenm*outum(:,k)) * dt
1133 dtend(:,k,vidx) = dtend(:,k,vidx) + (cuten*outv(:,k)+cutenm*outvm(:,k)) * dt
1140 dtend(:,k,tidx) = dtend(:,k,tidx) + (cuten*outt(:,k)+cutenm*outtm(:,k)) * dt
1145 qidx=dtidx(100+ntqv,index_of_process_dcnv)
1150 tem = (cuten(i)*outq(i,k) + cutenm(i)*outqm(i,k))* dt
1151 tem = tem/(1.0_kind_phys+tem)
1152 dtend(i,k,qidx) = dtend(i,k,qidx) + tem
1158 if(
allocated(clcw_save))
then
1162 tem_shal = dt*(outqcs(i,k)*cutens(i)+outqcm(i,k)*cutenm(i))
1163 tem_deep = dt*(outqc(i,k)*cuten(i)+clw_ten(i,k))
1164 tem = tem_shal+tem_deep
1165 tem1 = max(0.0, min(1.0, (tcr-t(i,k))*tcrf))
1166 weight_sum = abs(tem_shal)+abs(tem_deep)
1167 if(weight_sum<1e-12)
then
1171 if (clcw_save(i,k) .gt. -999.0)
then
1172 cliw_both = max(0.,cliw_save(i,k) + tem * tem1) - cliw_save(i,k)
1173 clcw_both = max(0.,clcw_save(i,k) + tem) - clcw_save(i,k)
1174 else if(cliw_idx>=1)
then
1175 cliw_both = max(0.,cliw_save(i,k) + tem) - cliw_save(i,k)
1178 if(cliw_deep_idx>=1)
then
1179 dtend(i,k,cliw_deep_idx) = dtend(i,k,cliw_deep_idx) + abs(tem_deep)/weight_sum*cliw_both
1181 if(clcw_deep_idx>=1)
then
1182 dtend(i,k,clcw_deep_idx) = dtend(i,k,clcw_deep_idx) + abs(tem_deep)/weight_sum*clcw_both
1184 if(cliw_shal_idx>=1)
then
1185 dtend(i,k,cliw_shal_idx) = dtend(i,k,cliw_shal_idx) + abs(tem_shal)/weight_sum*cliw_both
1187 if(clcw_shal_idx>=1)
then
1188 dtend(i,k,clcw_shal_idx) = dtend(i,k,clcw_shal_idx) + abs(tem_shal)/weight_sum*clcw_both