739 & ( im,ix,levs,lsoil,lsm,ntrac,ncld,ntoz,ntcw,ntke, &
740 & ntiw,ntlnc,ntinc, &
741 & nmtvr,nrcm,ko3,lonr,latr,jcap, &
742 & num_p3d,num_p2d,npdf3d,ncnvcld3d, &
743 & kdt,lat,me,pl_coeff,nlons,ncw,flgmin,crtrh,cdmbgwd, &
744 & ccwf,dlqf,ctei_rm,clstp,cgwf,prslrd0,ral_ts,dtp,dtf,fhour, &
745 & solhr,slag,sdec,cdec,sinlat,coslat,pgr,ugrs,vgrs, &
746 & tgrs,qgrs,vvel,prsi,prsl,prslk,prsik,phii,phil, &
747 & rann,prdoz,poz,dpshc,fscav,fswtr,hprime,xlon,xlat, &
748 & h2o_phys,levh2o,h2opl,h2o_pres,h2o_coeff, &
750 & slope,shdmin,shdmax,snoalb,tg3,slmsk,vfrac, &
751 & vtype,stype,uustar,oro,oro_uf,coszen,sfcdsw,sfcnsw, &
753 & sfcnirbmd,sfcnirdfd,sfcvisbmd,sfcvisdfd, &
754 & sfcnirbmu,sfcnirdfu,sfcvisbmu,sfcvisdfu, &
755 & slimskin_cpl,ulwsfcin_cpl, &
756 & dusfcin_cpl,dvsfcin_cpl,dtsfcin_cpl,dqsfcin_cpl, &
757 & sfcdlw,tsflw,sfcemis,sfalb,swh,swhc,hlw,hlwc,hlwd,lsidea, &
758 & ras,pre_rad,ldiag3d,lgocart,lssav,lssav_cpl, &
760 & xkzm_m,xkzm_h,xkzm_s,psautco,prautco,evpco,wminco, &
761 & pdfcld,shcnvcw,sup,redrag,hybedmf,dspheat, &
762 & flipv,old_monin,cnvgwd,shal_cnv, &
763 & imfshalcnv,imfdeepcnv,cal_pre,aero_in, &
764 & mom4ice,mstrat,trans_trac,nstf_name,moist_adj, &
765 & thermodyn_id, sfcpress_id, gen_coord_hybrid,levr,adjtrc,nnp,&
766 & cscnv,nctp,do_shoc,shocaftcnv,ntot3d,ntot2d, &
768 & hice,fice,tisfc,tsea,tprcp,cv,cvb,cvt, &
769 & srflag,snwdph,weasd,sncovr,zorl,canopy, &
770 & ffmm,ffhh,f10m,srunoff,evbsa,evcwa,snohfa, &
771 & transa,sbsnoa,snowca,soilm,tmpmin,tmpmax, &
772 & dusfc,dvsfc,dtsfc,dqsfc,totprcp,gflux, &
773 & dlwsfc,ulwsfc,suntim,runoff,ep,cldwrk, &
774 & dugwd,dvgwd,psmean,cnvprcp,spfhmin,spfhmax,rain,rainc, &
776 & dt3dt,dq3dt,du3dt,dv3dt,dqdt_v,cnvqc_v,acv,acvb,acvt, &
777 & slc,smc,stc,upd_mf,dwn_mf,det_mf,phy_f3d,phy_f2d, &
779 & dusfc_cpl, dvsfc_cpl, dtsfc_cpl, dqsfc_cpl, &
780 & dlwsfc_cpl,dswsfc_cpl,dnirbm_cpl,dnirdf_cpl, &
781 & dvisbm_cpl,dvisdf_cpl,rain_cpl, nlwsfc_cpl,nswsfc_cpl, &
782 & nnirbm_cpl,nnirdf_cpl,nvisbm_cpl,nvisdf_cpl,snow_cpl, &
784 & xt,xs,xu,xv,xz,zm,xtts,xzts,d_conv,ifd,dt_cool,qrain, &
785 & tref, z_c, c_0, c_d, w_0, w_d, &
788 & gt0,gq0,gu0,gv0,t2m,q2m,u10m,v10m, &
789 & zlvl,psurf,hpbl,pwat,t1,q1,u1,v1, &
790 & chh,cmm,dlwsfci,ulwsfci,dswsfci,uswsfci,dusfci,dvsfci, &
791 & dtsfci,dqsfci,gfluxi,epi,smcwlt2,smcref2,wet1,sr, &
797 & dusfci_cpl, dvsfci_cpl, dtsfci_cpl, dqsfci_cpl, &
798 & dlwsfci_cpl, dswsfci_cpl, &
799 & dnirbmi_cpl, dnirdfi_cpl, dvisbmi_cpl, dvisdfi_cpl, &
800 & nlwsfci_cpl, nswsfci_cpl, &
801 & nnirbmi_cpl, nnirdfi_cpl, nvisbmi_cpl, nvisdfi_cpl, &
802 & t2mi_cpl, q2mi_cpl, u10mi_cpl, v10mi_cpl, &
803 & tseai_cpl, psurfi_cpl &
806 use machine
, only : kind_phys
807 use physcons
, only : con_cp, con_fvirt, con_g, con_rd, con_rv, &
808 & con_hvap, con_hfus, con_rerth, con_pi
809 &, rhc_max, dxmin, dxinv, pa2mb, rlapse
810 use module_nst_water_prop
, only: get_dtzm_2d
811 use cs_conv
, only : cs_convr
817 real(kind=kind_phys),
parameter :: hocp = con_hvap/con_cp
822 &, hsub = con_hvap+con_hfus
829 integer,
intent(in) :: ix, im, levs, lsoil, lsm, ntrac, &
830 & ncld, ntiw, ntlnc, ntinc, &
831 & ntoz, ntcw, nmtvr, nrcm, ko3, &
832 & lonr, latr, jcap, num_p3d, num_p2d, kdt, &
833 & me, pl_coeff, lat, npdf3d, ncnvcld3d, &
834 & thermodyn_id, sfcpress_id, levr, nnp, nctp,&
835 & ntke, ntot3d, ntot2d, h2o_coeff, levh2o, &
839 integer,
intent(in) :: nlons(im), ncw(2)
840 integer,
intent(in) :: nstf_name(5)
841 integer,
intent(in) :: imfshalcnv, imfdeepcnv
843 logical,
intent(in) :: ras, pre_rad, ldiag3d, flipv, &
844 & old_monin, cnvgwd, aero_in, &
845 & redrag, hybedmf, dspheat, &
846 & lssav, mom4ice, mstrat, &
847 & trans_trac, moist_adj, cal_pre, cscnv, &
848 & shal_cnv, gen_coord_hybrid, lgocart, &
849 & lsidea, lssav_cpl, pdfcld, shcnvcw, &
850 & do_shoc, shocaftcnv, h2o_phys
852 real(kind=kind_phys) :: adjtrc(ntrac)
854 real(kind=kind_phys),
dimension(im),
intent(in) :: &
855 & sinlat, coslat, pgr, dpshc, xlon, xlat, &
856 & slope, shdmin, shdmax, snoalb, tg3, slmsk, vfrac, &
857 & vtype, stype, uustar, oro, coszen, sfcnsw, sfcdsw, &
858 & sfcnirbmu, sfcnirdfu, sfcvisbmu, sfcvisdfu, &
859 & sfcnirbmd, sfcnirdfd, sfcvisbmd, sfcvisdfd, &
860 & slimskin_cpl, dusfcin_cpl, dvsfcin_cpl, &
861 & dtsfcin_cpl, dqsfcin_cpl, ulwsfcin_cpl, &
862 & sfcdlw, tsflw, sfalb, sfcemis, oro_uf
864 real(kind=kind_phys),
dimension(ix,levs),
intent(in) :: &
865 & ugrs, vgrs, tgrs, vvel, prsl, prslk, phil, swh, swhc, hlw, hlwc
868 real(kind=kind_phys),
intent(in) :: hlwd(ix,levs,6)
870 real(kind=kind_phys),
intent(inout) :: qgrs(ix,levs,ntrac)
872 real(kind=kind_phys),
dimension(ix,levs+1),
intent(in) :: &
875 real(kind=kind_phys),
intent(in) :: hprime(ix,nmtvr), &
876 & prdoz(ix,ko3,pl_coeff), rann(ix,nrcm), poz(ko3), &
877 & h2opl(ix,levh2o,h2o_coeff), h2o_pres(levh2o)
879 real(kind=kind_phys),
intent(in) :: dtp, dtf, fhour, solhr, &
880 & slag, sdec, cdec, ctei_rm(2), clstp, &
881 & ccwf(2), crtrh(3), flgmin(2), dlqf(2), cdmbgwd(2), &
882 & xkzm_m, xkzm_h, xkzm_s, psautco(2), prautco(2), &
883 & evpco, wminco(2), cgwf(2), prslrd0, sup, ral_ts
886 real(kind=kind_phys),
dimension(im),
intent(inout) :: &
887 & hice, fice, tisfc, tsea, tprcp, cv, cvb, cvt, &
888 & srflag, snwdph, weasd, sncovr, zorl, canopy, ffmm, ffhh,&
889 & f10m, srunoff, evbsa, evcwa, snohfa, transa, sbsnoa, &
890 & snowca, soilm, tmpmin, tmpmax, dusfc, dvsfc, dtsfc, &
891 & dqsfc, totprcp, gflux, dlwsfc, ulwsfc, suntim, runoff, ep,&
892 & cldwrk, dugwd, dvgwd, psmean, cnvprcp,spfhmin,spfhmax, &
893 & rain, rainc, acv, acvb, acvt
894 real(kind=kind_phys),
dimension(im),
optional,
intent(inout) :: &
896 & dusfc_cpl, dvsfc_cpl, dtsfc_cpl, dqsfc_cpl, &
897 & dlwsfc_cpl,dswsfc_cpl,rain_cpl, snow_cpl, &
898 & dnirbm_cpl,dnirdf_cpl,dvisbm_cpl,dvisdf_cpl, &
899 & nlwsfc_cpl,nswsfc_cpl, &
900 & nnirbm_cpl,nnirdf_cpl,nvisbm_cpl,nvisdf_cpl, &
902 & xt, xs, xu, xv, xz, zm, xtts, xzts, d_conv, ifd, dt_cool,
903 & qrain, tref, z_c, c_0, c_d, w_0, w_d
906 real(kind=kind_phys),
dimension(ix,lsoil),
intent(inout) :: &
909 real(kind=kind_phys),
dimension(ix,levs),
intent(inout) :: &
910 & upd_mf, dwn_mf, det_mf, dqdt_v, cnvqc_v
913 real(kind=kind_phys),
intent(inout) :: &
914 & phy_f3d(ix,levs,ntot3d), phy_f2d(ix,ntot2d), &
915 & dt3dt(ix,levs,6), du3dt(ix,levs,4), dv3dt(ix,levs,4), &
916 & dq3dt(ix,levs,5+pl_coeff)
918 real(kind=kind_phys),
intent(inout) :: &
919 & phy_fctd(ix,nctp) &
920 real(kind=kind_phys),
dimension(ntrac-ncld+2) :: fscav, fswtr
923 real(kind=kind_phys),
dimension(im),
intent(out) :: &
924 & t2m, q2m, u10m, v10m, zlvl, psurf, hpbl, &
925 & pwat, t1, q1, u1, v1, chh, cmm, &
926 & dlwsfci, ulwsfci, dswsfci, uswsfci, &
927 & dusfci, dvsfci, dtsfci, dqsfci, &
928 & gfluxi, epi, smcwlt2, smcref2, wet1, sr
930 real(kind=kind_phys),
dimension(im),
optional,
intent(out) :: &
931 & dusfci_cpl,dvsfci_cpl,dtsfci_cpl,dqsfci_cpl, &
932 & dlwsfci_cpl,dswsfci_cpl, &
933 & dnirbmi_cpl,dnirdfi_cpl,dvisbmi_cpl,dvisdfi_cpl, &
934 & nlwsfci_cpl,nswsfci_cpl, &
935 & nnirbmi_cpl,nnirdfi_cpl,nvisbmi_cpl,nvisdfi_cpl, &
936 & t2mi_cpl,q2mi_cpl, &
937 & u10mi_cpl,v10mi_cpl,tseai_cpl,psurfi_cpl, &
940 real(kind=kind_phys),
dimension(ix,levs),
intent(out) :: &
943 real(kind=kind_phys),
dimension(ix,levs,ntrac),
intent(out) :: &
949 real(kind=kind_phys),
dimension(im) :: ccwfac, garea, &
950 & dlength, xncw, cumabs, qmax, cice, zice, tice, &
952 & gflx, rain1, raincs, &
953 & snowmt, cd, cdq, qss, dusfcg, dvsfcg, dusfc1, &
954 & dvsfc1, dtsfc1, dqsfc1, rb, rhscnpy, drain, cld1d, &
955 & evap, hflx, stress, t850, ep1d, gamt, gamq, &
956 & sigmaf, oc, theta, gamma, sigma, &
957 & elvmax, wind, work1, work2, runof, xmu, &
959 & fm10, fh2, tsurf, tx1, tx2, ctei_r, flgmin_l, &
960 & evbs, evcw, trans, sbsno, snowc, frland, &
961 & adjsfcdsw, adjsfcnsw, adjsfcdlw, adjsfculw,gabsbdlw, &
962 & adjnirbmu, adjnirdfu, adjvisbmu, adjvisdfu, &
963 & adjnirbmd, adjnirdfd, adjvisbmd, adjvisdfd, &
964 & xcosz, tseal, snohf, dlqfac, work3, ctei_rml, cldf, &
965 & domr, domzr, domip, doms, psautco_l, prautco_l
967 real(kind=kind_phys),
dimension(im) :: ocalnirbm_cpl, &
968 & ocalnirdf_cpl,ocalvisbm_cpl,ocalvisdf_cpl
976 real(kind=kind_phys),
dimension(ix,levs) :: del, dtdtr
977 real(kind=kind_phys),
dimension(im,levs-1) :: dkt
979 real(kind=kind_phys),
dimension(im,levs) :: rhc, dtdt, &
980 & dudt, dvdt, gwdcu, gwdcv, dtdtc, dmdt, &
982 & qr_col, fc_ice, rainp, ud_mf, dd_mf, dt_mf, prnum
985 real(kind=kind_phys),
dimension(im,lsoil) :: smsoil, stsoil, &
986 & ai, bi, cci, rhsmc, zsoil, slsoil
988 real(kind=kind_phys) :: zsea1,zsea2
989 real(kind=kind_phys),
dimension(im) :: dtzm
991 real(kind=kind_phys) :: rhbbot, rhbtop, rhpbl, frain, f_rain, &
992 & f_ice, qi, qw, qr, wc, tem, tem1, tem2, sume, sumr, sumq, &
993 & dqdt(im,levs,ntrac), oa4(im,4), clx(im,4), albbm, xcosz_loc
994 real(kind=kind_phys),
parameter :: albdf=0.06
1001 real(kind=kind_phys),
allocatable :: clw(:,:,:), qpl(:,:),qpi(:,:)
1002 &, ncpl(:,:), ncpi(:,:)
1004 integer,
dimension(im) :: kbot, ktop, kcnv, soiltyp, vegtype, &
1005 & kpbl, slopetyp, kinver, lmh, levshc, islmsk
1007 integer :: i, nvdiff, kk, ic, k, n, ipr, lv, k1, iter, levshcm, &
1008 & tracers, trc_shft, tottracer, num2, num3 &
1009 &, nshocm, nshoc, ntk, ntln, ntin
1011 logical,
dimension(im) :: flag_iter, flag_guess, invrsn &
1014 real(kind=kind_phys),
dimension(im) :: dtsfc_cice, &
1015 & dqsfc_cice, dusfc_cice, dvsfc_cice, ulwsfc_cice, tisfc_cice, &
1016 & tsea_cice, hice_cice, fice_cice
1018 integer,
dimension(im) :: islmsk_cice
1019 logical,
dimension(im) :: flag_cice
1021 logical :: lprnt, revap
1023 real(kind=kind_phys),
allocatable :: cnvc(:,:),cnvw(:,:)
1024 real(kind=kind_phys) eng0, eng1, dtshoc
1028 real(kind=kind_phys),
parameter :: wcbmax1=2.5, wcbmax2=1.5
1030 real(kind=kind_phys) wcbmax(im)
1032 real(kind=kind_phys) tf, tcr, tcrf
1034 parameter(tf=258.16, tcr=273.16, tcrf=1.0/(tcr-tf))
1037 real(kind=kind_phys),
allocatable,
dimension(:,:) :: qlcn, qicn
1038 &, w_upi,cf_upi, cnv_mfd, cnv_prc3, cnv_dqldt,clcn,
1039 & cnv_fice,cnv_ndrop,cnv_nice
1040 real(kind=kind_phys),
allocatable,
dimension(:) :: cn_prc,cn_snr
1114 if(nint(slmsk(i)) == 1)
then 1126 if (trans_trac)
then 1128 if (ntoz < ntcw)
then 1129 trc_shft = ntcw + ncld - 1
1133 elseif (ntoz > 0)
then 1139 tracers = ntrac - trc_shft
1141 if (ntoz > 0) tottracer = tottracer + 1
1143 if (ntke > 0) ntk = ntke - trc_shft + 3
1151 skip_macro = .false.
1152 allocate ( clw(ix,levs,tottracer+2) )
1154 allocate (qpl(im,levs), qpi(im,levs)
1155 &, ncpl(im,levs), ncpi(im,levs))
1164 if (.not. ras .or. .not. cscnv)
then 1165 allocate ( cnvc(ix,levs), cnvw(ix,levs))
1170 allocate (qlcn(im,levs), qicn(im,levs), w_upi(im,levs)
1171 &, cf_upi(im,levs), cnv_mfd(im,levs),cnv_prc3(im,levs)
1172 &, cnv_dqldt(im,levs), clcn(im,levs), cnv_fice(im,levs)
1173 &, cnv_ndrop(im,levs), cnv_nice(im,levs))
1174 allocate(cn_prc(im), cn_snr(im))
1176 allocate (qlcn(1,1), qicn(1,1), w_upi(1,1)
1177 &, cf_upi(1,1), cnv_mfd(1,1),cnv_prc3(1,1)
1178 &, cnv_dqldt(1,1), clcn(1,1), cnv_fice(1,1)
1179 &, cnv_ndrop(1,1), cnv_nice(1,1))
1190 if (abs(1.0-adjtrc(n)) > 1.0e-7)
then 1193 qgrs(i,k,n) = qgrs(i,k,n) * adjtrc(n)
1200 call get_prs(im,ix,levs,ntrac,tgrs,qgrs, &
1201 & thermodyn_id, sfcpress_id, &
1202 & gen_coord_hybrid, &
1203 & prsi,prsik,prsl,prslk,phii,phil,del)
1225 sigmaf(i) = max( vfrac(i),0.01 )
1227 if (lsm == 0) sigmaf(i) = 0.5 + vfrac(i) * 0.5
1229 islmsk(i) = nint(slmsk(i))
1231 if (islmsk(i) == 2)
then 1237 if (ivegsrc == 1)
then 1239 elseif(ivegsrc == 2)
then 1244 soiltyp(i) = int( stype(i)+0.5 )
1245 vegtype(i) = int( vtype(i)+0.5 )
1246 slopetyp(i) = int( slope(i)+0.5 )
1254 islmsk_cice(i) = nint(slimskin_cpl(i))
1255 flag_cice(i) = (islmsk_cice(i) == 4)
1257 ulwsfc_cice(i) = ulwsfcin_cpl(i)
1258 dusfc_cice(i) = dusfcin_cpl(i)
1259 dvsfc_cice(i) = dvsfcin_cpl(i)
1260 dtsfc_cice(i) = dtsfcin_cpl(i)
1261 dqsfc_cice(i) = dqsfcin_cpl(i)
1262 tisfc_cice(i) = tisfc(i)
1263 tsea_cice(i) = tsea(i)
1264 fice_cice(i) = fice(i)
1265 hice_cice(i) = hice(i)
1268 work1(i) = (log(coslat(i) / (nlons(i)*latr)) - dxmin) * dxinv
1269 work1(i) = max(0.0, min(1.0,work1(i)))
1270 work2(i) = 1.0 - work1(i)
1272 work3(i) = prsik(i,1) / prslk(i,1)
1273 tem1 = con_rerth * (con_pi+con_pi)*coslat(i)/nlons(i)
1274 tem2 = con_rerth * con_pi / latr
1275 garea(i) = tem1 * tem2
1276 dlength(i) = sqrt( tem1*tem1+tem2*tem2 )
1277 cldf(i) = cgwf(1)*work1(i) + cgwf(2)*work2(i)
1278 wcbmax(i) = wcbmax1*work1(i) + wcbmax2*work2(i)
1290 smsoil(i,k) = smc(i,k)
1291 stsoil(i,k) = stc(i,k)
1292 slsoil(i,k) = slc(i,k)
1334 call dcyc2t3_pre_rad &
1336 & ( solhr,slag,sdec,cdec,sinlat,coslat, &
1337 & xlon,coszen,tsea,tgrs(1,1),tgrs(1,1), &
1338 & sfcdsw,sfcnsw,sfcdlw,swh,hlw, &
1339 & sfcnirbmu,sfcnirdfu,sfcvisbmu,sfcvisdfu, &
1340 & sfcnirbmd,sfcnirdfd,sfcvisbmd,sfcvisdfd, &
1345 & adjsfcdsw,adjsfcnsw,adjsfcdlw,adjsfculw,xmu,xcosz, &
1346 & adjnirbmu,adjnirdfu,adjvisbmu,adjvisdfu, &
1347 & adjnirbmd,adjnirdfd,adjvisbmd,adjvisdfd &
1354 & ( solhr,slag,sdec,cdec,sinlat,coslat, &
1355 & xlon,coszen,tsea,tgrs(1,1),tsflw,sfcemis, &
1356 & sfcdsw,sfcnsw,sfcdlw,swh,swhc,hlw,hlwc, &
1357 & sfcnirbmu,sfcnirdfu,sfcvisbmu,sfcvisdfu, &
1358 & sfcnirbmd,sfcnirdfd,sfcvisbmd,sfcvisdfd, &
1363 & adjsfcdsw,adjsfcnsw,adjsfcdlw,adjsfculw,xmu,xcosz, &
1364 & adjnirbmu,adjnirdfu,adjvisbmu,adjvisdfu, &
1365 & adjnirbmd,adjnirdfd,adjvisbmd,adjvisdfd &
1373 dtdtr(i,k) = dtdtr(i,k) + dtdtc(i,k)*dtf
1407 gabsbdlw(i) = sfcemis(i) * adjsfcdlw(i)
1422 if ( xcosz(i) >= czmin )
then 1423 tem1 = adjsfcdsw(i) / xcosz(i)
1425 if ( tem1 >= 120.0 )
then 1426 suntim(i) = suntim(i) + dtf
1434 dlwsfc(i) = dlwsfc(i) + adjsfcdlw(i)*dtf
1436 if (flag_cice(i)) adjsfculw(i) = ulwsfc_cice(i)
1438 ulwsfc(i) = ulwsfc(i) + adjsfculw(i)*dtf
1439 psmean(i) = psmean(i) + pgr(i)*dtf
1446 dt3dt(i,k,1) = dt3dt(i,k,1) + hlwd(i,k,1)*dtf
1447 dt3dt(i,k,2) = dt3dt(i,k,2) + hlwd(i,k,2)*dtf
1448 dt3dt(i,k,3) = dt3dt(i,k,3) + hlwd(i,k,3)*dtf
1449 dt3dt(i,k,4) = dt3dt(i,k,4) + hlwd(i,k,4)*dtf
1450 dt3dt(i,k,5) = dt3dt(i,k,5) + hlwd(i,k,5)*dtf
1451 dt3dt(i,k,6) = dt3dt(i,k,6) + hlwd(i,k,6)*dtf
1457 dt3dt(i,k,1) = dt3dt(i,k,1) + hlw(i,k)*dtf
1458 dt3dt(i,k,2) = dt3dt(i,k,2) + swh(i,k)*dtf*xmu(i)
1477 if (((imfshalcnv == 0 .and. shal_cnv) .or. old_monin) &
1478 & .and. mstrat)
then 1480 ctei_rml(i) = ctei_rm(1)*work1(i) + ctei_rm(2)*work2(i)
1484 if (prsi(i,1)-prsi(i,k+1) < 0.35*prsi(i,1) &
1485 & .and. (.not. invrsn(i)))
then 1486 tem = (tgrs(i,k+1)-tgrs(i,k)) / (prsl(i,k)-prsl(i,k+1))
1488 if ((tem > 0.00010 .and. tx1(i) < 0.0) .or.
1489 & (tem-abs(tx1(i)) > 0.0 .and. tx2(i) < 0.0))
then 1492 if (qgrs(i,k,1) > qgrs(i,k+1,1))
then 1493 tem1 = tgrs(i,k+1) + hocp*max(qgrs(i,k+1,1),qmin)
1494 tem2 = tgrs(i,k) + hocp*max(qgrs(i,k,1),qmin)
1496 tem1 = tem1 / prslk(i,k+1) - tem2 / prslk(i,k)
1499 ctei_r(i) = (1.0/hocp)*tem1/(qgrs(i,k+1,1)-qgrs(i,k,1)&
1500 & + qgrs(i,k+1,ntcw)-qgrs(i,k,ntcw))
1505 if ( ctei_rml(i) > ctei_r(i) )
then 1537 flag_guess(i) = .false.
1538 flag_iter(i) = .true.
1551 zlvl(i) = phil(i,1) / con_g
1563 call sfc_diff(im,pgr,ugrs,vgrs,tgrs,qgrs,zlvl, &
1564 & snwdph,tsea,zorl,cd,cdq,rb, &
1565 & prsl(1,1),work3,islmsk, &
1566 & stress,ffmm,ffhh, &
1567 & uustar,wind,phy_f2d(1,num_p2d),fm10,fh2, &
1568 & sigmaf,vegtype,shdmax,ivegsrc, &
1569 & tsurf, flag_iter, redrag)
1578 if (iter == 1 .and. wind(i) < 2.0)
then 1579 flag_guess(i) = .true.
1583 if ( nstf_name(1) > 0 )
then 1586 if ( islmsk(i) == 0 )
then 1587 tem = (oro(i)-oro_uf(i)) * rlapse
1588 tseal(i) = tsea(i) + tem
1589 tsurf(i) = tsurf(i) + tem
1600 & ( im,lsoil,pgr,ugrs,vgrs,tgrs,qgrs,tref,cd,cdq, &
1601 & prsl(1,1),work3,islmsk,xlon,sinlat,stress, &
1602 & sfcemis,gabsbdlw,adjsfcnsw,tprcp,dtf,kdt,solhr,xcosz, &
1603 & phy_f2d(1,num_p2d),flag_iter,flag_guess,nstf_name, &
1606 & tseal,tsurf,xt,xs,xu,xv,xz,zm,xtts,xzts,dt_cool, &
1607 & z_c,c_0,c_d,w_0,w_d,d_conv,ifd,qrain, &
1609 & qss, gflx, cmm, chh, evap, hflx, ep1d)
1616 if ( islmsk(i) == 0 )
then 1617 tsurf(i) = tsurf(i) - (oro(i)-oro_uf(i)) * rlapse
1623 if ( nstf_name(1) > 1 )
then 1624 zsea1 = 0.001*
real(nstf_name(4))
1625 zsea2 = 0.001*
real(nstf_name(5))
1626 call get_dtzm_2d(xt,xz,dt_cool,z_c,slmsk,
1627 & zsea1,zsea2,im,1,dtzm)
1629 if ( islmsk(i) == 0 )
then 1630 tsea(i) = max(271.2,tref(i) + dtzm(i))
1631 & -(oro(i)-oro_uf(i))*rlapse
1645 & ( im,pgr,ugrs,vgrs,tgrs,qgrs,tsea,cd,cdq, &
1646 & prsl(1,1),work3,islmsk,phy_f2d(1,num_p2d),flag_iter, &
1648 & qss,cmm,chh,gflx,evap,hflx,ep1d &
1668 & ( im,lsoil,pgr,ugrs,vgrs,tgrs,qgrs,soiltyp,vegtype,sigmaf, &
1669 & sfcemis,gabsbdlw,adjsfcdsw,adjsfcnsw,dtf,tg3,cd,cdq, &
1670 & prsl(1,1),work3,zlvl,islmsk,phy_f2d(1,num_p2d),slopetyp, &
1671 & shdmin,shdmax,snoalb,sfalb,flag_iter,flag_guess, &
1674 & weasd,snwdph,tsea,tprcp,srflag,smsoil,stsoil,slsoil, &
1675 & canopy,trans,tsurf,zorl, &
1677 & sncovr,qss,gflx,drain,evap,hflx,ep1d,runof, &
1678 & cmm,chh,evbs,evcw,sbsno,snowc,soilm,snohf, &
1679 & smcwlt2,smcref2,wet1 &
1689 & ( im,lsoil,pgr,ugrs,vgrs,tgrs,qgrs,smsoil,soiltyp, &
1690 & sigmaf,vegtype,sfcemis,adjsfcdlw,adjsfcnsw,dtf, &
1691 & tg3,cd,cdq,prsl(1,1),work3,islmsk, &
1693 & phy_f2d(1,num_p2d),flag_iter,flag_guess, &
1695 & weasd,tsea,tprcp,srflag,stsoil,canopy,tsurf, &
1697 & qss,snowmt,gflx,zsoil,rhscnpy,rhsmc, &
1698 & ai,bi,cci,drain,evap,hflx,ep1d,cmm,chh, &
1699 & evbs,evcw,trans,sbsno,snowc,soilm, &
1700 & snohf,smcwlt2,smcref2 &
1712 if (flag_cice(i))
then 1713 islmsk(i) = islmsk_cice(i)
1720 & ( im,lsoil,pgr,ugrs,vgrs,tgrs,qgrs,dtf, &
1721 & sfcemis,gabsbdlw,adjsfcnsw,adjsfcdsw,srflag, &
1722 & cd,cdq,prsl(1,1),work3,islmsk,phy_f2d(1,num_p2d), &
1723 & flag_iter,mom4ice,lsm, lprnt,ipr, &
1726 & zice,cice,tice,weasd,tsea,tprcp,stsoil,ep1d, &
1728 & snwdph,qss,snowmt,gflx,cmm,chh,evap,hflx &
1733 if (flag_cice(i))
then 1734 islmsk(i) = nint(slmsk(i))
1740 & ( im,ugrs,vgrs,tgrs,qgrs,cd,cdq,prsl(1,1),work3, &
1741 & islmsk_cice,phy_f2d(1,num_p2d),flag_iter, &
1742 & dqsfc_cice,dtsfc_cice, &
1744 & qss,cmm,chh,evap,hflx &
1751 flag_iter(i) = .false.
1752 flag_guess(i) = .false.
1754 if(islmsk(i) == 1 .and. iter == 1)
then 1755 if (wind(i) < 2.0) flag_iter(i) = .true.
1756 elseif (islmsk(i) == 0 .and. iter == 1 &
1757 & .and. nstf_name(1) > 0)
then 1758 if (wind(i) < 2.0) flag_iter(i) = .true.
1766 dlwsfci(i) = adjsfcdlw(i)
1767 ulwsfci(i) = adjsfculw(i)
1768 uswsfci(i) = adjsfcdsw(i) - adjsfcnsw(i)
1769 dswsfci(i) = adjsfcdsw(i)
1780 if (weasd(i) > 0.0) sncovr(i) = 1.0
1786 call sfc_diag(im,pgr,ugrs,vgrs,tgrs,qgrs, &
1787 & tsea,qss,f10m,u10m,v10m,t2m,q2m,work3, &
1788 & evap,ffmm,ffhh,fm10,fh2)
1791 phy_f2d(i,num_p2d) = 0.0
1796 dlwsfci_cpl(i) = adjsfcdlw(i)
1797 dswsfci_cpl(i) = adjsfcdsw(i)
1798 dlwsfc_cpl(i) = dlwsfc_cpl(i) + adjsfcdlw(i)*dtf
1799 dswsfc_cpl(i) = dswsfc_cpl(i) + adjsfcdsw(i)*dtf
1800 dnirbmi_cpl(i) = adjnirbmd(i)
1801 dnirdfi_cpl(i) = adjnirdfd(i)
1802 dvisbmi_cpl(i) = adjvisbmd(i)
1803 dvisdfi_cpl(i) = adjvisdfd(i)
1804 dnirbm_cpl(i) = dnirbm_cpl(i) + adjnirbmd(i)*dtf
1805 dnirdf_cpl(i) = dnirdf_cpl(i) + adjnirdfd(i)*dtf
1806 dvisbm_cpl(i) = dvisbm_cpl(i) + adjvisbmd(i)*dtf
1807 dvisdf_cpl(i) = dvisdf_cpl(i) + adjvisdfd(i)*dtf
1808 nlwsfci_cpl(i) = adjsfcdlw(i) - adjsfculw(i)
1809 nlwsfc_cpl(i) = nlwsfc_cpl(i) + nlwsfci_cpl(i)*dtf
1810 t2mi_cpl(i) = t2m(i)
1811 q2mi_cpl(i) = q2m(i)
1812 u10mi_cpl(i) = u10m(i)
1813 v10mi_cpl(i) = v10m(i)
1814 tseai_cpl(i) = tsea(i)
1815 psurfi_cpl(i) = pgr(i)
1822 if (islmsk(i) /= 1)
then 1824 xcosz_loc = max( 0.0, min( 1.0, xcosz(i) ))
1825 ocalnirdf_cpl(i) = 0.06
1826 ocalnirbm_cpl(i) = max(albdf, 0.026/(xcosz_loc**1.7+0.065) &
1827 & + 0.15 * (xcosz_loc-0.1) * (xcosz_loc-0.5) &
1828 & * (xcosz_loc-1.0))
1829 ocalvisdf_cpl(i) = 0.06
1830 ocalvisbm_cpl(i) = ocalnirbm_cpl(i)
1832 nnirbmi_cpl(i) = adjnirbmd(i)-adjnirbmd(i)*ocalnirbm_cpl(i)
1833 nnirdfi_cpl(i) = adjnirdfd(i)-adjnirdfd(i)*ocalnirdf_cpl(i)
1834 nvisbmi_cpl(i) = adjvisbmd(i)-adjvisbmd(i)*ocalvisbm_cpl(i)
1835 nvisdfi_cpl(i) = adjvisdfd(i)-adjvisdfd(i)*ocalvisdf_cpl(i)
1837 nnirbmi_cpl(i) = adjnirbmd(i) - adjnirbmu(i)
1838 nnirdfi_cpl(i) = adjnirdfd(i) - adjnirdfu(i)
1839 nvisbmi_cpl(i) = adjvisbmd(i) - adjvisbmu(i)
1840 nvisdfi_cpl(i) = adjvisdfd(i) - adjvisdfu(i)
1842 nswsfci_cpl(i) = nnirbmi_cpl(i) + nnirdfi_cpl(i) &
1843 & + nvisbmi_cpl(i) + nvisdfi_cpl(i)
1844 nswsfc_cpl(i) = nswsfc_cpl(i) + nswsfci_cpl(i)*dtf
1845 nnirbm_cpl(i) = nnirbm_cpl(i) + nnirbmi_cpl(i)*dtf
1846 nnirdf_cpl(i) = nnirdf_cpl(i) + nnirdfi_cpl(i)*dtf
1847 nvisbm_cpl(i) = nvisbm_cpl(i) + nvisbmi_cpl(i)*dtf
1848 nvisdf_cpl(i) = nvisdf_cpl(i) + nvisdfi_cpl(i)*dtf
1854 gflux(i) = gflux(i) + gflx(i) * dtf
1855 evbsa(i) = evbsa(i) + evbs(i) * dtf
1856 evcwa(i) = evcwa(i) + evcw(i) * dtf
1857 transa(i) = transa(i) + trans(i) * dtf
1858 sbsnoa(i) = sbsnoa(i) + sbsno(i) * dtf
1859 snowca(i) = snowca(i) + snowc(i) * dtf
1860 snohfa(i) = snohfa(i) + snohf(i) * dtf
1861 ep(i) = ep(i) + ep1d(i) * dtf
1863 tmpmax(i) = max(tmpmax(i),t2m(i))
1864 tmpmin(i) = min(tmpmin(i),t2m(i))
1866 spfhmax(i) = max(spfhmax(i),q2m(i))
1867 spfhmin(i) = min(spfhmin(i),q2m(i))
1898 call moninshoc(ix,im,levs,ntrac,ntcw,dvdt,dudt,dtdt,dqdt, &
1899 & ugrs,vgrs,tgrs,qgrs,phy_f3d(1,1,ntot3d-1), &
1901 & prsik(1,1),rb,zorl,u10m,v10m,ffmm,ffhh, &
1902 & tsea,hflx,evap,stress,wind,kpbl, &
1903 & prsi,del,prsl,prslk,phii,phil,dtp, &
1904 & dusfc1,dvsfc1,dtsfc1,dqsfc1,dkt,hpbl, &
1905 & kinver, xkzm_m, xkzm_h, xkzm_s, lprnt, ipr,me)
1910 call moninedmf(ix,im,levs,nvdiff,ntcw,dvdt,dudt,dtdt,dqdt, &
1911 & ugrs,vgrs,tgrs,qgrs,swh,hlw,xmu, &
1912 & prsik(1,1),rb,zorl,u10m,v10m,ffmm,ffhh, &
1913 & tsea,qss,hflx,evap,stress,wind,kpbl, &
1914 & prsi,del,prsl,prslk,phii,phil,dtp,dspheat, &
1915 & dusfc1,dvsfc1,dtsfc1,dqsfc1,hpbl,gamt,gamq,dkt, &
1916 & kinver, xkzm_m, xkzm_h, xkzm_s, lprnt, ipr)
1918 elseif (.not. old_monin)
then 1920 call moninq(ix,im,levs,nvdiff,ntcw,dvdt,dudt,dtdt,dqdt, &
1921 & ugrs,vgrs,tgrs,qgrs,swh,hlw,xmu, &
1922 & prsik(1,1),rb,ffmm,ffhh, &
1923 & tsea,qss,hflx,evap,stress,wind,kpbl, &
1924 & prsi,del,prsl,prslk,phii,phil,dtp,dspheat, &
1925 & dusfc1,dvsfc1,dtsfc1,dqsfc1,hpbl,gamt,gamq,dkt, &
1926 & kinver, xkzm_m, xkzm_h, xkzm_s, lprnt, ipr)
1931 call moninp1(ix,im,levs,nvdiff,dvdt,dudt,dtdt,dqdt, &
1932 & ugrs,vgrs,tgrs,qgrs, &
1933 & prsik(1,1),rb,ffmm,ffhh,tsea,qss,hflx,evap,stress,wind, &
1934 & kpbl,prsi,del,prsl,prslk,phii,phil,dtp, &
1935 & dusfc1,dvsfc1,dtsfc1,dqsfc1,hpbl,gamt,gamq,dkt, &
1936 & kinver, xkzm_m, xkzm_h)
1939 call moninp(ix,im,levs,nvdiff,dvdt,dudt,dtdt,dqdt, &
1940 & ugrs,vgrs,tgrs,qgrs, &
1941 & prsik(1,1),rb,ffmm,ffhh,tsea,qss,hflx,evap,stress,wind, &
1942 & kpbl,prsi,del,prsl,phii,phil,dtp, &
1943 & dusfc1,dvsfc1,dtsfc1,dqsfc1,hpbl,gamt,gamq,dkt, &
1952 if (flag_cice(i))
then 1953 cice(i) = fice_cice(i)
1954 tsea(i) = tsea_cice(i)
1955 dusfc1(i) = dusfc_cice(i)
1956 dvsfc1(i) = dvsfc_cice(i)
1957 dqsfc1(i) = dqsfc_cice(i)
1958 dtsfc1(i) = dtsfc_cice(i)
1975 dusfc_cpl(i) = dusfc_cpl(i) + dusfc1(i)*dtf
1976 dvsfc_cpl(i) = dvsfc_cpl(i) + dvsfc1(i)*dtf
1977 dtsfc_cpl(i) = dtsfc_cpl(i) + dtsfc1(i)*dtf
1978 dqsfc_cpl(i) = dqsfc_cpl(i) + dqsfc1(i)*dtf
1979 dusfci_cpl(i) = dusfc1(i)
1980 dvsfci_cpl(i) = dvsfc1(i)
1981 dtsfci_cpl(i) = dtsfc1(i)
1982 dqsfci_cpl(i) = dqsfc1(i)
1988 dusfc(i) = dusfc(i) + dusfc1(i)*dtf
1989 dvsfc(i) = dvsfc(i) + dvsfc1(i)*dtf
1990 dtsfc(i) = dtsfc(i) + dtsfc1(i)*dtf
1991 dqsfc(i) = dqsfc(i) + dqsfc1(i)*dtf
1992 dusfci(i) = dusfc1(i)
1993 dvsfci(i) = dvsfc1(i)
1994 dtsfci(i) = dtsfc1(i)
1995 dqsfci(i) = dqsfc1(i)
2007 dt3dt(i,k,3) = dt3dt(i,k,3) + dtdt(i,k)*dtf
2013 tem = dtdt(i,k) - (hlw(i,k)+swh(i,k)*xmu(i))
2014 dt3dt(i,k,3) = dt3dt(i,k,3) + tem*dtf
2020 du3dt(i,k,1) = du3dt(i,k,1) + dudt(i,k) * dtf
2021 du3dt(i,k,2) = du3dt(i,k,2) - dudt(i,k) * dtf
2022 dv3dt(i,k,1) = dv3dt(i,k,1) + dvdt(i,k) * dtf
2023 dv3dt(i,k,2) = dv3dt(i,k,2) - dvdt(i,k) * dtf
2036 tem = dqdt(i,k,1) * dtf
2037 dq3dt(i,k,1) = dq3dt(i,k,1) + tem
2044 dq3dt(i,k,5) = dq3dt(i,k,5) + dqdt(i,k,ntoz) * dtf
2056 if (nmtvr == 14)
then 2063 oa4(i,k) = hprime(i,k+2)
2064 clx(i,k) = hprime(i,k+6)
2068 theta(i) = hprime(i,11)
2069 gamma(i) = hprime(i,12)
2070 sigma(i) = hprime(i,13)
2071 elvmax(i) = hprime(i,14)
2074 elseif (nmtvr == 10)
then 2081 oa4(i,k) = hprime(i,k+2)
2082 clx(i,k) = hprime(i,k+6)
2086 elseif (nmtvr == 6)
then 2093 oa4(i,k) = hprime(i,k+2)
2100 oc = 0 ; oa4 = 0 ; clx = 0 ; theta = 0 ; gamma = 0 ; sigma = 0
2106 call gwdps(im, ix, im, levs, dvdt, dudt, dtdt, &
2107 & ugrs, vgrs, tgrs, qgrs, &
2108 & kpbl, prsi, del, prsl, prslk, &
2109 & phii, phil, dtp, &
2110 & kdt, hprime(1,1), oc, oa4, clx, &
2111 & theta,sigma,gamma,elvmax,dusfcg, dvsfcg, &
2112 & con_g,con_cp,con_rd,con_rv, lonr, nmtvr, cdmbgwd, &
2119 dugwd(i) = dugwd(i) + dusfcg(i)*dtf
2120 dvgwd(i) = dvgwd(i) + dvsfcg(i)*dtf
2129 du3dt(i,k,2) = du3dt(i,k,2) + dudt(i,k) * dtf
2130 dv3dt(i,k,2) = dv3dt(i,k,2) + dvdt(i,k) * dtf
2131 dt3dt(i,k,2) = dt3dt(i,k,2) + dtdt(i,k) * dtf
2138 if( .not. lsidea .and. ral_ts > 0.0)
then 2142 call rayleigh_damp(im, ix, im, levs, dvdt, dudt, dtdt, ugrs,
2143 & vgrs, dtp, con_cp, levr, pgr, prsl,
2154 gt0(i,k) = tgrs(i,k) + dtdt(i,k) * dtp
2155 gu0(i,k) = ugrs(i,k) + dudt(i,k) * dtp
2156 gv0(i,k) = vgrs(i,k) + dvdt(i,k) * dtp
2163 gq0(i,k,n) = qgrs(i,k,n) + dqdt(i,k,n) * dtp
2170 call ideaca_up(prsi,gt0,ix,im,levs+1)
2195 if (ntoz > 0 .and. ntrac >= ntoz)
then 2197 if (pl_coeff > 4)
then 2199 call ozphys_2015(ix,im,levs,ko3,dtp,gq0(1,1,ntoz),gq0(1,1,ntoz)&
2200 &, gt0, poz, prsl, prdoz, pl_coeff, del, ldiag3d &
2201 &, dq3dt(1,1,6), me)
2204 call ozphys(ix,im,levs,ko3,dtp,gq0(1,1,ntoz),gq0(1,1,ntoz) &
2205 &, gt0, poz, prsl, prdoz, pl_coeff, del, ldiag3d &
2206 &, dq3dt(1,1,6), me)
2214 call h2ophys(ix,im,levs,levh2o,dtp,gq0(1,1,1),gq0(1,1,1)
2215 &, h2o_pres,prsl,h2opl,h2o_coeff,ldiag3d
2216 &, dq3dt(1,1,1), me)
2251 dtdt(i,k) = gt0(i,k)
2253 dudt(i,k) = gu0(i,k)
2254 dvdt(i,k) = gv0(i,k)
2258 elseif (cnvgwd)
then 2262 dtdt(i,k) = gt0(i,k)
2268 if (ldiag3d .or. lgocart)
then 2271 dqdt(i,k,1) = gq0(i,k,1)
2276 call get_phi(im,ix,levs,ntrac,gt0,gq0, &
2277 & thermodyn_id, sfcpress_id, &
2278 & gen_coord_hybrid, &
2279 & prsi,prsik,prsl,prslk,phii,phil)
2292 if (.not. ras .or. .not. cscnv)
then 2305 if (ras .or. cscnv)
then 2306 if (tottracer > 0)
then 2311 clw(i,k,3) = gq0(i,k,ntoz)
2315 if (tracers > 0)
then 2319 clw(i,k,3+n) = gq0(i,k,n+trc_shft)
2328 clw(i,k,2+n) = gq0(i,k,n+trc_shft)
2349 tem = rhbbot - (rhbbot-rhbtop) * (1.0-prslk(i,k))
2350 tem = rhc_max * work1(i) + tem * work2(i)
2351 rhc(i,k) = max(0.0, min(1.0,tem))
2358 clw(i,k,1) = gq0(i,k,ntiw)
2359 clw(i,k,2) = gq0(i,k,ntcw)
2364 if (num_p3d == 3)
then 2374 f_ice = max(0.0, min(1.0, phy_f3d(i,k,1)))
2375 f_rain = max(0.0, min(1.0, phy_f3d(i,k,2)))
2418 elseif (num_p3d == 4)
then 2421 psautco_l(i) = psautco(1)*work1(i) + psautco(2)*work2(i)
2422 prautco_l(i) = prautco(1)*work1(i) + prautco(2)*work2(i)
2426 clw(i,k,1) = gq0(i,k,ntcw)
2436 psautco_l(i) = psautco(1)*work1(i) + psautco(2)*work2(i)
2437 prautco_l(i) = prautco(1)*work1(i) + prautco(2)*work2(i)
2449 if (do_shoc .and. .not. shocaftcnv)
then 2452 skip_macro = do_shoc
2455 clw(i,k,1) = gq0(i,k,ntiw)
2456 clw(i,k,2) = gq0(i,k,ntcw)
2457 ncpl(i,k) = gq0(i,k,ntlnc)
2458 ncpi(i,k) = gq0(i,k,ntinc)
2461 elseif (num_p3d == 4)
then 2466 tem = gq0(i,k,ntcw) &
2467 & * max(0.0, min(1.0, (tcr-gt0(i,k))*tcrf))
2469 clw(i,k,2) = gq0(i,k,ntcw) - tem
2488 call shoc(ix, im, 1, levs, levs+1, dtp, me, lat, &
2489 & prsl(1,1), phii(1,1), phil(1,1), &
2490 & gu0(1,1),gv0(1,1), vvel(1,1), gt0(1,1), gq0(1,1,1), &
2491 & clw(1,1,1), clw(1,1,2), qpi, qpl,rhc, sup, &
2492 & phy_f3d(1,1,ntot3d-2), clw(1,1,ntk), hflx, evap, &
2493 & prnum, phy_f3d(1,1,ntot3d-1), phy_f3d(1,1,ntot3d), &
2494 & lprnt, ipr, ncpl, ncpi)
2496 if (ntlnc > 0 .and. ntinc > 0 .and. ncld >=2)
then 2499 gq0(i,k,ntlnc) = ncpl(i,k)
2500 gq0(i,k,ntinc) = ncpi(i,k)
2531 if (.not. ras .and. .not. cscnv)
then 2533 if (imfdeepcnv == 1)
then 2534 call sascnvn(im,ix,levs,jcap,dtp,del,prsl,pgr,phil, &
2535 & clw,gq0,gt0,gu0,gv0,cld1d, &
2536 & rain1,kbot,ktop,kcnv,islmsk, &
2537 & vvel,ncld,ud_mf,dd_mf,dt_mf,cnvw,cnvc)
2538 elseif (imfdeepcnv == 2)
then 2539 call mfdeepcnv(im,ix,levs,dtp,del,prsl,pgr,phil, &
2540 & clw,gq0,gt0,gu0,gv0,cld1d, &
2541 & rain1,kbot,ktop,kcnv,islmsk,garea, &
2542 & vvel,ncld,ud_mf,dd_mf,dt_mf,cnvw,cnvc)
2544 elseif (imfdeepcnv == 0)
then 2545 call sascnv(im,ix,levs,jcap,dtp,del,prsl,pgr,phil, &
2546 & clw,gq0,gt0,gu0,gv0,cld1d, &
2547 & rain1,kbot,ktop,kcnv,islmsk, &
2548 & vvel,rann,ncld,ud_mf,dd_mf,dt_mf,cnvw,cnvc)
2559 & ix ,im ,levs , tottracer+3 , &
2560 & gt0 ,gq0 ,rain1 , clw , &
2564 & ud_mf ,dd_mf ,dt_mf , &
2565 & gu0 ,gv0 ,fscav, fswtr, &
2567 & phy_fctd, me, wcbmax )
2570 rain1(i) = rain1(i) * (dtp*0.001)
2575 if (ccwf(1) >= 0.0 .or. ccwf(2) >= 0 )
then 2577 ccwfac(i) = ccwf(1)*work1(i) + ccwf(2)*work2(i)
2578 dlqfac(i) = dlqf(1)*work1(i) + dlqf(2)*work2(i)
2593 call rascnv(im, ix, levs, dtp, dtf, rann &
2594 &, gt0, gq0, gu0, gv0, clw, tottracer, fscav &
2595 &, prsi, prsl, prsik, prslk, phil, phii &
2596 &, kpbl, cd, rain1, kbot, ktop, kcnv &
2597 &, phy_f2d(1,num_p2d), flipv, pa2mb &
2598 &, me, garea, lmh, ccwfac, nrcm, rhc &
2599 &, ud_mf, dd_mf, dt_mf, dlqfac, lprnt, ipr, kdt,revap&
2600 &, qlcn, qicn, w_upi,cf_upi, cnv_mfd, cnv_prc3 &
2601 &, cnv_dqldt,clcn,cnv_fice,cnv_ndrop,cnv_nice,ncld )
2613 upd_mf(i,k) = upd_mf(i,k) + ud_mf(i,k) * frain
2614 dwn_mf(i,k) = dwn_mf(i,k) + dd_mf(i,k) * frain
2615 det_mf(i,k) = det_mf(i,k) + dt_mf(i,k) * frain
2616 cnvqc_v(i,k) = cnvqc_v(i,k) + (clw(i,k,1)+clw(i,k,2)- &
2617 & gq0(i,k,ntcw)) * frain
2624 if (tottracer > 0)
then 2628 gq0(i,k,ntoz) = clw(i,k,3)
2632 if (tracers > 0)
then 2636 gq0(i,k,n+trc_shft) = clw(i,k,3+n)
2645 gq0(i,k,n+trc_shft) = clw(i,k,2+n)
2654 rainc(i) = frain * rain1(i)
2660 cldwrk(i) = cldwrk(i) + cld1d(i) * dtf
2661 cnvprcp(i) = cnvprcp(i) + rainc(i)
2667 dt3dt(i,k,4) = dt3dt(i,k,4) + (gt0(i,k)-dtdt(i,k)) * frain
2668 dq3dt(i,k,2) = dq3dt(i,k,2) + (gq0(i,k,1)-dqdt(i,k,1)) &
2670 du3dt(i,k,3) = du3dt(i,k,3) + (gu0(i,k)-dudt(i,k)) * frain
2671 dv3dt(i,k,3) = dv3dt(i,k,3) + (gv0(i,k)-dvdt(i,k)) * frain
2673 upd_mf(i,k) = upd_mf(i,k) + ud_mf(i,k) * (con_g*frain)
2674 dwn_mf(i,k) = dwn_mf(i,k) + dd_mf(i,k) * (con_g*frain)
2675 det_mf(i,k) = det_mf(i,k) + dt_mf(i,k) * (con_g*frain)
2687 dqdt_v(i,k) = (gq0(i,k,1)-dqdt(i,k,1)) * frain
2688 upd_mf(i,k) = upd_mf(i,k) + ud_mf(i,k) * frain
2689 dwn_mf(i,k) = dwn_mf(i,k) + dd_mf(i,k) * frain
2690 det_mf(i,k) = det_mf(i,k) + dt_mf(i,k) * frain
2691 cnvqc_v(i,k) = cnvqc_v(i,k) + (clw(i,k,1)+clw(i,k,2))
2697 if(npdf3d == 3 .and. num_p3d == 4)
then 2702 phy_f3d(i,k,num2) = cnvw(i,k)
2703 phy_f3d(i,k,num3) = cnvc(i,k)
2706 else if(npdf3d == 0 .and. ncnvcld3d == 1)
then 2710 phy_f3d(i,k,num2) = cnvw(i,k)
2740 if (k >= kbot(i) .and. k <= ktop(i))
then 2743 cumabs(i) = cumabs(i) + (gt0(i,k)-dtdt(i,k)) * del(i,k)
2744 work3(i) = work3(i) + del(i,k)
2749 if (work3(i) > 0.0) cumabs(i) = cumabs(i) / (dtp*work3(i))
2817 call gwdc(im, ix, im, levs, lat, ugrs, vgrs, tgrs, qgrs, &
2818 & prsl, prsi, del, cumabs, ktop, kbot, kcnv,cldf, &
2819 & con_g, con_cp, con_rd, con_fvirt, dlength, &
2820 & lprnt, ipr, fhour, gwdcu, gwdcv, dusfcg, dvsfcg)
2848 dugwd(i) = dugwd(i) + dusfcg(i)*dtf
2849 dvgwd(i) = dvgwd(i) + dvsfcg(i)*dtf
2855 du3dt(i,k,4) = du3dt(i,k,4) + gwdcu(i,k) * dtf
2856 dv3dt(i,k,4) = dv3dt(i,k,4) + gwdcv(i,k) * dtf
2868 eng0 = 0.5*(gu0(i,k)*gu0(i,k)+gv0(i,k)*gv0(i,k))
2869 gu0(i,k) = gu0(i,k) + gwdcu(i,k) * dtp
2870 gv0(i,k) = gv0(i,k) + gwdcv(i,k) * dtp
2871 eng1 = 0.5*(gu0(i,k)*gu0(i,k)+gv0(i,k)*gv0(i,k))
2872 gt0(i,k) = gt0(i,k) + (eng0-eng1)/(dtp*con_cp)
2903 dtdt(i,k) = gt0(i,k)
2908 if (ldiag3d .or. lgocart)
then 2911 dqdt(i,k,1) = gq0(i,k,1)
2919 if (.not. do_shoc)
then 2923 if (imfshalcnv == 1)
then 2925 call shalcnv(im,ix,levs,jcap,dtp,del,prsl,pgr,phil, &
2926 & clw,gq0,gt0,gu0,gv0, &
2927 & rain1,kbot,ktop,kcnv,islmsk, &
2928 & vvel,ncld,hpbl,hflx,evap,ud_mf,dt_mf, &
2931 if (shcnvcw .and. num_p3d == 4 .and. npdf3d == 3 )
then 2934 phy_f3d(i,k,num2) = cnvw(i,k)
2935 phy_f3d(i,k,num3) = cnvc(i,k)
2940 else if(npdf3d == 0 .and. ncnvcld3d == 1)
then 2944 phy_f3d(i,k,num2) = cnvw(i,k)
2949 raincs(i) = frain * rain1(i)
2950 rainc(i) = rainc(i) + raincs(i)
2954 cnvprcp(i) = cnvprcp(i) + raincs(i)
2958 elseif (imfshalcnv == 2)
then 2959 call mfshalcnv(im,ix,levs,dtp,del,prsl,pgr,phil, &
2960 & clw,gq0,gt0,gu0,gv0, &
2961 & rain1,kbot,ktop,kcnv,islmsk,garea, &
2962 & vvel,ncld,hpbl,ud_mf,dt_mf,cnvw,cnvc)
2964 if (shcnvcw .and. num_p3d == 4 .and. npdf3d == 3 )
then 2967 phy_f3d(i,k,num2) = cnvw(i,k)
2968 phy_f3d(i,k,num3) = cnvc(i,k)
2973 else if(npdf3d == 0 .and. ncnvcld3d == 1)
then 2977 phy_f3d(i,k,num2) = cnvw(i,k)
2982 raincs(i) = frain * rain1(i)
2983 rainc(i) = rainc(i) + raincs(i)
2987 cnvprcp(i) = cnvprcp(i) + raincs(i)
2991 elseif (imfshalcnv == 0)
then 2998 if (prsi(i,1)-prsi(i,k) <= dpshc(i)) levshc(i) = k
3003 levshcm = max(levshcm, levshc(i))
3010 call shalcv(im,ix,levshcm,dtp,del,prsi,prsl,prslk,kcnv, &
3011 & gq0,gt0,levshc,phil,kinver,ctei_r,ctei_rml &
3014 call shalcvt3(im,ix,levshcm,dtp,del,prsi,prsl,prslk, &
3027 tem = (gq0(i,k,1)-dqdt(i,k,1)) * frain
3028 dqdt_v(i,k) = dqdt_v(i,k) + tem
3035 dt3dt(i,k,5) = dt3dt(i,k,5) + (gt0(i,k)-dtdt(i,k))
3037 dq3dt(i,k,3) = dq3dt(i,k,3) + (gq0(i,k,1)-dqdt(i,k,1)) &
3039 dtdt(i,k) = gt0(i,k)
3040 dqdt(i,k,1) = gq0(i,k,1)
3048 if (clw(i,k,2) <= -999.0) clw(i,k,2) = 0.0
3059 elseif (shocaftcnv)
then 3061 skip_macro = do_shoc
3066 ncpl(i,k) = gq0(i,k,ntlnc)
3067 ncpi(i,k) = gq0(i,k,ntinc)
3106 call shoc(ix, im, 1, levs, levs+1, dtp, me, lat, &
3107 & prsl(1,1), phii(1,1), phil(1,1), &
3108 & gu0(1,1),gv0(1,1), vvel(1,1), gt0(1,1), gq0(1,1,1), &
3109 & clw(1,1,1), clw(1,1,2), qpi, qpl,rhc, sup, &
3110 & phy_f3d(1,1,ntot3d-2), gq0(1,1,ntke),hflx,evap, &
3111 & prnum, phy_f3d(1,1,ntot3d-1), phy_f3d(1,1,ntot3d), &
3112 & lprnt, ipr, ncpl, ncpi)
3114 if (ntlnc > 0 .and. ntinc > 0 .and. ncld >=2)
then 3117 gq0(i,k,ntlnc) = ncpl(i,k)
3118 gq0(i,k,ntinc) = ncpi(i,k)
3149 gq0(i,k,ntiw) = clw(i,k,1)
3150 gq0(i,k,ntcw) = clw(i,k,2)
3154 elseif (num_p3d == 3)
then 3166 gq0(i,k,ntcw) = qi + qw + qr_col(i,k)
3168 if (qi <= epsq)
then 3171 phy_f3d(i,k,1) = qi/gq0(i,k,ntcw)
3174 if (qr_col(i,k) <= epsq)
then 3177 phy_f3d(i,k,2) = qr_col(i,k) / (qw+qr_col(i,k))
3183 elseif (num_p3d == 4)
then 3187 gq0(i,k,ntcw) = clw(i,k,1) + clw(i,k,2)
3197 clw(i,k,1) = clw(i,k,1) + clw(i,k,2)
3205 call cnvc90(clstp, im, ix, rainc, kbot, ktop, levs, prsi, &
3206 & acv, acvb, acvt, cv, cvb, cvt)
3232 call mstcnv(im,ix,levs,dtp,gt0,gq0,prsl,del,prslk,rain1
3233 &, gq0(1,1,ntcw), rhc, lprnt,ipr)
3241 rainc(i) = rainc(i) + frain * rain1(i)
3245 cnvprcp(i) = cnvprcp(i) + rain1(i) * frain
3262 dt3dt(i,k,4) = dt3dt(i,k,4) + (gt0(i,k)-dtdt(i,k))
3264 dq3dt(i,k,2) = dq3dt(i,k,2) + (gq0(i,k,1)-dqdt(i,k,1))
3274 dtdt(i,k) = gt0(i,k)
3275 dqdt(i,k,1) = gq0(i,k,1)
3303 dqdt_v(i,k) = dqdt_v(i,k) / dtf
3313 call lrgscl(ix,im,levs,dtp,gt0,gq0,prsl,del,prslk,rain1,clw)
3315 elseif (ncld == 1)
then 3317 if (num_p3d == 3)
then 3320 xncw(i) = ncw(1) * work1(i) + ncw(2) * work2(i)
3321 flgmin_l(i) = flgmin(1)* work1(i) + flgmin(2) * work2(i)
3324 if (kdt == 1 .and. abs(xlon(1)) < 0.0001)
then 3325 write(0,*)
' xncw=',xncw(1),
' rhc=',rhc(1,1),
' work1=' &
3326 &, work1(1),
' work2=',work2(1),
' flgmin=',flgmin_l(1) &
3327 &,
' lon=',xlon(1) * 57.29578,
' lat=',lat,
' me=',me
3330 call gsmdrive(im, ix, levs, dtp, con_g, con_hvap, hsub, con_cp&
3332 &, prsl, del, rhc, xncw, flgmin_l &
3333 &, gt0, gq0(1,1,1), gq0(1,1,ntcw) &
3334 &, phy_f3d(1,1,1), phy_f3d(1,1,2) &
3335 &, phy_f3d(1,1,3), rain1, sr)
3337 elseif (num_p3d == 4)
then 3339 if (npdf3d /= 3)
then 3349 call precpd_shoc(im, ix, levs, dtp, del, prsl, &
3350 & gq0(1,1,1), gq0(1,1,ntcw), gt0, rain1, sr, &
3351 & rainp, rhc, psautco_l, prautco_l, evpco, &
3352 & wminco, phy_f3d(1,1,ntot3d-2), lprnt, ipr)
3356 call gscond(im, ix, levs, dtp, dtf, prsl, pgr, &
3357 & gq0(1,1,1), gq0(1,1,ntcw), gt0, &
3358 & phy_f3d(1,1,1), phy_f3d(1,1,2), phy_f2d(1,1), &
3359 & phy_f3d(1,1,3), phy_f3d(1,1,4), phy_f2d(1,2), &
3362 call precpd(im, ix, levs, dtp, del, prsl, &
3363 & gq0(1,1,1), gq0(1,1,ntcw), gt0, rain1, sr, &
3364 & rainp, rhc, psautco_l, prautco_l, evpco, &
3365 & wminco, lprnt, ipr)
3376 call gscondp(im, ix, levs, dtp, dtf, prsl, pgr, &
3377 & gq0(1,1,1), gq0(1,1,ntcw), gt0, &
3378 & phy_f3d(1,1,1), phy_f3d(1,1,2), phy_f2d(1,1), &
3379 & phy_f3d(1,1,3), phy_f3d(1,1,4), phy_f2d(1,2), &
3380 & rhc,phy_f3d(1,1,num_p3d+1),sup,lprnt, &
3383 call precpdp(im, ix, levs, dtp, del, prsl, pgr, &
3384 & gq0(1,1,1), gq0(1,1,ntcw), gt0, rain1,sr, &
3385 & rainp, rhc, phy_f3d(1,1,num_p3d+1), &
3386 & psautco_l, prautco_l, evpco, wminco, &
3395 elseif (ncld == 2)
then 3404 clw(i,k,1) = gq0(i,k,ntiw)
3405 clw(i,k,2) = gq0(i,k,ntcw)
3406 phy_f3d(i,k,1) = phy_f3d(i,k,ntot3d-2)
3412 clw(i,k,1) = gq0(i,k,ntiw)
3413 clw(i,k,2) = gq0(i,k,ntcw)
3414 phy_f3d(i,k,1) = min(1.0, phy_f3d(i,k,1)+cnvc(i,k))
3424 call m_micro_driver(im, ix, levs, flipv, dtp,
3425 & prsl, prsi, prslk, prsik,
3426 & vvel, clw(1,1,2), qlcn, clw(1,1,1),qicn,
3427 & hlw, swh, w_upi, cf_upi,
3428 & frland, hpbl, cnv_mfd, cnv_prc3,
3429 & cnv_dqldt, clcn, gu0, gv0,
3430 & dusfc, dvsfc, dusfc1, dvsfc1,
3431 & dusfc1, dvsfc1, cnv_fice,
3432 & cnv_ndrop, cnv_nice, gq0(1,1,1),
3433 & gq0(1,1,ntcw), gq0(1,1,ntiw), gt0,
3434 & rain1, sr, gq0(1,1,ntlnc),
3435 & gq0(1,1,ntinc), phy_f3d(1,1,1), kbot,
3436 & aero_in, skip_macro, cn_prc, cn_snr,
3447 rain(i) = rainc(i) + frain * rain1(i)
3453 call calpreciptype(kdt,nrcm,im,ix,levs,levs+1,rann,
3454 & xlat,xlon,gt0,gq0,prsl,prsi,rain,
3455 & phii,num_p3d,tsea,sr,phy_f3d(1,1,i),
3456 & domr,domzr,domip,doms)
3470 if(doms(i) >0.0 .or. domip(i)>0.0)
then 3480 totprcp(i) = totprcp(i) + rain(i)
3487 dt3dt(i,k,6) = dt3dt(i,k,6) + (gt0(i,k)-dtdt(i,k)) * frain
3488 dq3dt(i,k,4) = dq3dt(i,k,4) + (gq0(i,k,1)-dqdt(i,k,1)) &
3503 if (prsl(i,k) > p850 .and. prsl(i,k+1) <= p850)
then 3504 t850(i) = gt0(i,k) - (prsl(i,k)-p850) &
3505 & / (prsl(i,k)-prsl(i,k+1)) * (gt0(i,k)-gt0(i,k+1))
3514 tprcp(i) = max(0.0, rain(i))
3518 tprcp(i) = max(0.0, rain(i) )
3521 if (t850(i) <= 273.16)
then 3531 if (t850(i) > 273.16)
then 3532 rain_cpl(i) = rain_cpl(i) + rain(i)
3534 snow_cpl(i) = snow_cpl(i) + rain(i)
3546 if (t850(i) <= 273.16 .and. islmsk(i) /= 0)
then 3547 weasd(i) = weasd(i) + 1.e3*rain(i)
3551 call progt2(im,lsoil,rhscnpy,rhsmc,ai,bi,cci,smsoil, &
3552 & islmsk,canopy,tprcp,runof,snowmt, &
3553 & zsoil,soiltyp,sigmaf,dtf,me)
3559 if (islmsk(i) == 1)
then 3560 slsoil(i,k) = smsoil(i,k)
3571 call sfc_diag(im,pgr,gu0,gv0,gt0,gq0, &
3572 & tsea,qss,f10m,u10m,v10m,t2m,q2m,work3, &
3573 & evap,ffmm,ffhh,fm10,fh2)
3577 tmpmax(i) = max(tmpmax(i),t2m(i))
3578 tmpmin(i) = min(tmpmin(i),t2m(i))
3580 spfhmax(i) = max(spfhmax(i),q2m(i))
3581 spfhmin(i) = min(spfhmin(i),q2m(i))
3592 runoff(i) = runoff(i) + (drain(i)+runof(i)) * tem
3593 srunoff(i) = srunoff(i) + runof(i) * tem
3600 if (islmsk(i) == 2)
then 3615 smc(i,k) = smsoil(i,k)
3616 stc(i,k) = stsoil(i,k)
3617 slc(i,k) = slsoil(i,k)
3635 do ic = ntcw, ntcw+ncld-1
3637 work1(i) = work1(i) + gq0(i,k,ic)
3643 pwat(i) = pwat(i) + del(i,k)*(gq0(i,k,1)+work1(i))
3644 rqtk(i) = rqtk(i) + del(i,k)*(gq0(i,k,1)-qgrs(i,k,1))
3649 pwat(i) = pwat(i) * (1.0/con_g)
3660 deallocate (qpl, qpi, ncpl, ncpi)
3662 if (.not. ras .or. .not. cscnv)
then 3663 deallocate (cnvc, cnvw)
3672 deallocate (qlcn, qicn, w_upi
3673 &, cf_upi, cnv_mfd, cnv_prc3
3674 &, cnv_dqldt, clcn, cnv_fice
3675 &, cnv_ndrop, cnv_nice)