1 !WRF:MODEL_LAYER:PHYSICS
4 MODULE module_cu_gf_wrfdrv
5 use module_gfs_physcons, g => con_g, &
9 use module_cu_gf_deep, only: cup_gf,neg_check,autoconv,aeroevap
10 use module_cu_gf_sh, only: cup_gf_sh
12 use module_cu_gf_ctrans, only: neg_check_chem
14 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16 ! This convective parameterization is build to attempt !
17 ! a smooth transition to cloud resolving scales as proposed!
18 ! by Arakawa et al (2011, ACP). It currently does not use !
19 ! subsidencespreading as in G3. Difference and details !
20 ! will be described in a forthcoming paper by !
21 ! Grell and Freitas (2013). The parameterization also !
22 ! offers options to couple with aerosols. Both, the smooth !
23 ! transition part as well as the aerosol coupling are !
24 ! experimental. While the smooth transition part is turned !
25 ! on, nd has been tested dow to a resolution of about 3km !
26 ! the aerosol coupling is turned off. !
27 ! More clean-up as well as a direct coupling to chemistry !
28 ! will follow for V3.5.1 !
30 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
32 !Isidora J. stochastic parameter perturbation added to closures
37 !-------------------------------------------------------------
38 SUBROUTINE GFDRV(spp_conv,pattern_spp_conv,field_conv, &
43 ,htop,hbot,ktop_deep &
45 ,GDC,GDC2 ,kpbl,k22_shallow,kbcon_shallow &
46 ,ktop_shallow,xmb_shallow &
47 ,ichoice,ishallow_g3 &
48 ,ids,ide, jds,jde, kds,kde &
49 ,ims,ime, jms,jme, kms,kme &
50 ,its,ite, jts,jte, kts,kte &
51 ,periodic_x,periodic_y &
52 ,RQVCUTEN,RQCCUTEN,RQICUTEN &
53 ,RQVFTEN,RTHFTEN,RTHCUTEN,RTHRATEN &
56 #if ( WRF_DFI_RADAR == 1 )
57 ! Optional CAP suppress option
58 ,do_capsuppress,cap_suppress_loc &
62 ,num_chem,chemopt,num_tracer,traceropt &
63 ,conv_tr_wetscav,conv_tr_aqchem,chem_conv_tr &
66 !-------------------------------------------------------------
68 integer, parameter :: ideep=1
69 integer, parameter :: imid_gf=0
70 integer, parameter :: ichoicem=0 ! 0 1 2 8 11 GG
71 integer, parameter :: ichoice_s=0 ! 0 1 2 3
72 integer, parameter :: dicycle=1 !- diurnal cycle flag
73 integer, parameter :: dicycle_m=0 !- diurnal cycle flag
74 real, parameter :: aodccn=0.1
75 !-------------------------------------------------------------
76 INTEGER, INTENT(IN ) :: &
77 ids,ide, jds,jde, kds,kde, &
78 ims,ime, jms,jme, kms,kme, &
79 its,ite, jts,jte, kts,kte
80 LOGICAL periodic_x,periodic_y
81 integer, intent (in ) :: ichoice
83 INTEGER, INTENT(IN ) :: ishallow_g3
85 REAL, DIMENSION( ims:ime , kms:kme , jms:jme ) , &
97 REAL, DIMENSION( ims:ime , kms:kme , jms:jme ) , &
102 REAL, DIMENSION( ims:ime , jms:jme ),INTENT(IN) :: hfx,qfx,HT,XLAND
103 INTEGER, DIMENSION( ims:ime , jms:jme ),INTENT(IN) :: KPBL
104 INTEGER, DIMENSION( ims:ime , jms:jme ), &
106 INTENT(INOUT) :: k22_shallow,kbcon_shallow,ktop_shallow
107 REAL, DIMENSION( ims:ime, jms:jme ),INTENT(INOUT ), &
108 OPTIONAL :: xmb_shallow
110 REAL, INTENT(IN ) :: DT, DX
113 REAL, DIMENSION( ims:ime , jms:jme ), &
114 INTENT(INOUT) :: pratec,RAINCV,htop,hbot
116 ! REAL, DIMENSION( ims:ime , jms:jme ) :: & !, INTENT(INOUT) :: &
117 ! HTOP, &! highest model layer penetrated by cumulus since last reset in radiation_driver
118 ! HBOT ! lowest model layer penetrated by cumulus since last reset in radiation_driver
119 ! ! HBOT>HTOP follow physics leveling convention
121 INTEGER, DIMENSION( ims:ime, jms:jme ), &
123 INTENT( OUT) :: ktop_deep
125 REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
127 INTENT(INOUT) :: RTHFTEN, &
130 REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
140 REAL, DIMENSION( ims:ime , kms:kme , jms:jme ), &
142 INTENT(INOUT) :: DUDT_PHY, &
145 #if ( WRF_CHEM == 1 )
146 INTEGER,INTENT(IN ) :: &
147 numgas,chemopt,traceropt, &
148 num_tracer,num_chem, &
149 conv_tr_wetscav,conv_tr_aqchem,&
151 REAL,DIMENSION( ims:ime , kms:kme , jms:jme, num_chem ), &
154 REAL,DIMENSION( ims:ime , kms:kme , jms:jme, num_tracer ), &
158 REAL,DIMENSION( its:ite , kts:kte , num_chem ):: &
159 chem2d,outchemts,outchemtm, &
161 REAL,DIMENSION( its:ite , kts:kte , num_tracer ):: &
162 tracer2d,outtracerts,outtracertm, &
163 outtracert,tottracert
169 REAL, DIMENSION( ims:ime, kms:kme, jms:jme ),OPTIONAL ::pattern_spp_conv,field_conv
170 REAL, DIMENSION( its:ite, 4 ) :: rstochcol !,fieldcol_conv
171 ! Stochastiv required by GF
172 REAL, DIMENSION( its:ite ) :: rand_mom,rand_vmas
173 REAL, DIMENSION( its:ite,4 ) :: rand_clos
176 ! Flags relating to the optional tendency arrays declared above
177 ! Models that carry the optional tendencies will provdide the
178 ! optional arguments at compile time; these flags all the model
179 ! to determine at run-time whether a particular tracer is in
185 #if ( WRF_DFI_RADAR == 1 )
187 ! option of cap suppress:
188 ! do_capsuppress = 1 do
189 ! do_capsuppress = other don't
192 INTEGER, INTENT(IN ) ,OPTIONAL :: do_capsuppress
193 REAL, DIMENSION( ims:ime, jms:jme ),INTENT(IN ),OPTIONAL :: cap_suppress_loc
194 REAL, DIMENSION( its:ite ) :: cap_suppress_j
197 real, dimension (its:ite,kts:kte) :: &
199 real, dimension (its:ite,kts:kte) :: &
200 OUTT,OUTQ,OUTQC,cupclw,outu,outv,cnvwt
201 real, dimension (its:ite,kts:kte) :: &
202 OUTTs,OUTQs,OUTQCs,cupclws,outus,outvs,cnvwts
203 real, dimension (its:ite,kts:kte) :: &
204 OUTTm,OUTQm,OUTQCm,cupclwm,outum,outvm,cnvwtm
205 real, dimension (its:ite) :: &
206 pret, prets,pretm,ter11, aa0, xlandi
207 real, dimension (its:ite) :: &
210 integer, dimension (its:ite) :: &
212 integer, dimension (its:ite) :: &
213 kbcon, kbcons, kbconm, &
214 ktop, ktops, ktopm, &
215 kpbli, k22, k22s, k22m
217 integer :: ibegc,iendc,jbegc,jendc
219 integer, dimension (its:ite) :: jmin,jminm
222 ! basic environmental input includes moisture convergence (mconv)
223 ! omega (omeg), windspeed (us,vs)
225 real, dimension (its:ite,kts:kte) :: &
226 zo,T2d,q2d,PO,P2d,US,VS,rhoi,tn,qo,tshall,qshall
227 ! output from cup routines, can be used for diagnostics
228 real, dimension (its:ite,kts:kte) :: &
230 real, dimension (its:ite,kts:kte) :: &
232 real, dimension (its:ite) :: &
233 ccn,Z1,PSUR,cuten,cutens,cutenm, &
234 umean,vmean,pmean,xmb,xmbs, &
235 xmbm,xmb_out,tau_ecmwf_out,xmb_dumm
236 real, dimension (its:ite) :: &
239 INTEGER :: i,j,k,ICLDCK,ipr,jpr,n
241 INTEGER :: itf,jtf,ktf,iss,jss,nbegin,nend
242 REAL :: rkbcon,rktop !-lxz
243 character*50 :: ierrc(its:ite)
244 character*50 :: ierrcs(its:ite)
245 character*50 :: ierrcm(its:ite)
247 real, dimension (its:ite,kts:kte) :: hco,hcdo,zdo
248 real, dimension (its:ite,10) :: forcing,forcing2
250 integer, dimension (its:ite) :: cactiv
251 real, dimension (its:ite,kts:kte) :: qcheck
253 #if ( WRF_CHEM == 1 )
264 IF ( periodic_x ) THEN
271 IF ( periodic_y ) THEN
278 IF(PRESENT(k22_shallow)) THEN
298 IF(PRESENT(RQCCUTEN))rqccuten(i,k,j)=0.
299 IF(PRESENT(RQICUTEN))rqicuten(i,k,j)=0.
310 if (spp_conv==1) then
312 rstochcol(i,n)= pattern_spp_conv(i,n,j)
313 if (pattern_spp_conv(i,n,j) .le. -1.0) then
316 if (pattern_spp_conv(i,n,j) .ge. 1.0) then
331 if(ishallow_g3.eq.0)cutens(i)=0.
362 tau_ecmwf_out(i) = 0.
385 PSUR(I)=p8w(I,1,J)*.01
386 ! PSUR(I)=p(I,1,J)*.01
387 TER11(I)=max(0.,HT(i,j))
396 zo(i,kts)=ter11(i)+.5*dz8w(i,1,j)
398 zo(i,k)=zo(i,k-1)+.5*(dz8w(i,k-1,j)+dz8w(i,k,j))
401 ! if(j.eq.jpr .and. (ipr.gt.its .and. ipr.lt.itf))write(0,*)psur(ipr),ter11(ipr),kpbli(ipr)
411 IF(Q2d(I,K).LT.1.E-08)Q2d(I,K)=1.E-08
412 TN(I,K)=t2d(i,k)+(RTHFTEN(i,k,j)+RTHRATEN(i,k,j)+RTHBLTEN(i,k,j)) &
414 QO(I,K)=q2d(i,k)+(RQVFTEN(i,k,j)+RQVBLTEN(i,k,j))*dt
415 TSHALL(I,K)=t2d(i,k)+RTHBLTEN(i,k,j)*pi(i,k,j)*dt
416 DHDT(I,K)=cp*RTHBLTEN(i,k,j)*pi(i,k,j)+ XLV*RQVBLTEN(i,k,j)
417 QSHALL(I,K)=q2d(i,k)+RQVBLTEN(i,k,j)*dt
418 IF(TN(I,K).LT.200.)TN(I,K)=T2d(I,K)
419 IF(QO(I,K).LT.1.E-08)QO(I,K)=1.E-08
439 #if ( WRF_CHEM == 1 )
444 chem2d(I,K,nv)=max(epsilc,chem(i,k,j,nv))
447 outtracerts(I,K,nv)=0.
448 outtracertm(I,K,nv)=0.
449 outtracert(I,K,nv)=0.
450 tracer2d(I,K,nv)=max(epsilc,tracer(i,k,j,nv))
456 ! for NMM, tendencies have already been added to T,Q, and total tendencies
457 ! are stored in *FTEN variables
460 TN(I,K)=t2d(i,k) + RTHFTEN(i,k,j)*pi(i,k,j)*dt
461 QO(I,K)=q2d(i,k) + RQVFTEN(i,k,j)*dt
462 IF(TN(I,K).LT.200.)TN(I,K)=T2d(I,K)
463 IF(QO(I,K).LT.1.E-08)QO(I,K)=1.E-08
467 ! for EM_CORE, tendencies have not yet been added to T,Q, and *FTEN variables
468 ! contain advective forcing only
471 omeg(I,K)= -g*rho(i,k,j)*w(i,k,j)
476 if((p2d(i,1)-p2d(i,k)).gt.150.and.p2d(i,k).gt.300)then
477 dp=-.5*(p2d(i,k+1)-p2d(i,k-1))
478 umean(i)=umean(i)+us(i,k)*dp
479 vmean(i)=vmean(i)+vs(i,k)*dp
486 dq=(q2d(i,k+1)-q2d(i,k))
487 mconv(i)=mconv(i)+omeg(i,k)*dq/g
491 if(mconv(i).lt.0.)mconv(i)=0.
494 !---- CALL CUMULUS PARAMETERIZATION
496 #if ( WRF_DFI_RADAR == 1 )
497 if(do_capsuppress == 1 ) then
499 cap_suppress_j(i)=cap_suppress_loc(i,j)
504 if(ishallow_g3 == 1 )then
507 ! input variables, must be supplied
508 zo,t2d,q2d,ter11,tshall,qshall,p2d,psur,dhdt,kpbli, &
509 rhoi,hfxi,qfxi,xlandi,ichoice_s,tcrit,dt, &
510 ! input variables. Ierr should be initialized to zero or larger than zero for
511 ! turning off shallow convection for grid points
512 zus,xmbs,kbcons,ktops,k22s,ierrs,ierrcs, &
514 outts,outqs,outqcs,cnvwt,prets,cupclws, &
515 #if ( WRF_CHEM == 1 )
516 num_chem,chem2d,outchemts, &
517 num_tracer,tracer2d,outtracerts, &
518 numgas,chemopt,traceropt, &
519 conv_tr_wetscav,conv_tr_aqchem, &
522 ! dimesnional variables
523 itf,ktf,its,ite, kts,kte,ipr)
525 if(xmbs(i).le.0.)cutens(i)=0.
527 CALL neg_check('shallow',ipr,dt,q2d,outqs,outts,outus,outvs, &
528 outqcs,prets,its,ite,kts,kte,itf,ktf)
531 ! Mid-level convection
536 itf,ktf,its,ite, kts,kte &
586 ! the following should be set to zero if not available
587 ,rand_mom & ! for stochastics mom, if temporal and spatial patterns exist
588 ,rand_vmas & ! for stochastics vertmass, if temporal and spatial patterns exist
589 ,rand_clos & ! for stochastics closures, if temporal and spatial patterns exist
590 ,0 & ! flag to what you want perturbed
591 ! 1 = momentum transport
592 ! 2 = normalized vertical mass flux profile
594 ! more is possible, talk to developer or
595 ! implement yourself. pattern is expected to be
597 #if ( WRF_DFI_RADAR == 1 )
598 ,do_capsuppress,cap_suppress_j &
600 #if ( WRF_CHEM == 1 )
601 ,num_chem,chem2d,outchemtm &
602 ,num_tracer,tracer2d,outtracertm &
603 ,numgas,chemopt,traceropt &
604 ,conv_tr_wetscav,conv_tr_aqchem &
612 qcheck(i,k)=q2d(i,k) +outqs(i,k)*dt
615 CALL neg_check('mid',ipr,dt,qcheck,outqm,outtm,outum,outvm, &
616 outqcm,pretm,its,ite,kts,kte,itf,ktf)
619 #if ( WRF_DFI_RADAR == 1 )
620 if(do_capsuppress == 1 ) then
622 cap_suppress_j(i)=cap_suppress_loc(i,j)
628 itf,ktf,its,ite, kts,kte &
678 ! the following should be set to zero if not available
679 ,rand_mom & ! for stochastics mom, if temporal and spatial patterns exist
680 ,rand_vmas & ! for stochastics vertmass, if temporal and spatial patterns exist
681 ,rand_clos & ! for stochastics closures, if temporal and spatial patterns exist
682 ,0 & ! flag to what you want perturbed
683 ! 1 = momentum transport
684 ! 2 = normalized vertical mass flux profile
686 ! more is possible, talk to developer or
687 ! implement yourself. pattern is expected to be
689 #if ( WRF_DFI_RADAR == 1 )
690 ,do_capsuppress,cap_suppress_j &
692 #if ( WRF_CHEM == 1 )
693 ,num_chem,chem2d,outchemt &
694 ,num_tracer,tracer2d,outtracert &
695 ,numgas,chemopt,traceropt &
696 ,conv_tr_wetscav,conv_tr_aqchem &
705 qcheck(i,k)=q2d(i,k) +(outqs(i,k)+outqm(i,k))*dt
708 CALL neg_check('deep',ipr,dt,qcheck,outq,outt,outu,outv, &
709 outqc,pret,its,ite,kts,kte,itf,ktf)
712 if(j.lt.jbegc.or.j.gt.jendc)go to 100
713 IF(PRESENT(k22_shallow)) THEN
714 if(ishallow_g3.eq.1)then
716 xmb_shallow(i,j)=xmbs(i)
717 k22_shallow(i,j)=k22s(i)
718 kbcon_shallow(i,j)=kbcons(i)
719 ktop_shallow(i,j)=ktops(i)
720 ktop_deep(i,j) = ktop(i)
726 ktop_deep(i,j) = ktop(i)
727 if(pret(i).gt.0.)then
734 if(pretm(i).gt.0.)then
745 RTHCUTEN(I,K,J)= (cutens(i)*outts(i,k)+ &
746 cutenm(i)*outtm(i,k)+ &
747 cuten(i)* outt(i,k) )/pi(i,k,j)
748 RQVCUTEN(I,K,J)= cuten(i)*outq(i,k) + &
749 cutens(i)*outqs(i,k)+ &
751 DUDT_PHY(I,K,J)=outum(i,k)*cutenm(i)+outu(i,k)*cuten(i)
752 DVDT_PHY(I,K,J)=outvm(i,k)*cutenm(i)+outv(i,k)*cuten(i)
755 #if ( WRF_CHEM == 1 )
758 if ((chemopt>0) .and. (chem_conv_tr>0)) then
760 totchemt(i,k,nv)=outchemts(i,k,nv)*cutens(i)+ &
761 outchemtm(i,k,nv)*cutenm(i)+ &
762 outchemt(i,k,nv)*cuten(i)
765 if ((traceropt>0) .and. (chem_conv_tr>0)) then
767 tottracert(I,K,nv)=outtracerts(i,k,nv)*cutens(i)+ &
768 outtracertm(i,k,nv)*cutenm(i)+ &
769 outtracert(i,k,nv)*cuten(i)
775 if ((chemopt>0) .and. (chem_conv_tr>0)) then
776 call neg_check_chem(ktop,dt,chem2d,totchemt,iopt,num_chem, &
781 chem(I,K,J,nv)=max(epsilc,chem(i,k,j,nv)+totchemt(i,k,nv)*dt)
786 if ((traceropt>0) .and. (chem_conv_tr>0)) then
787 call neg_check_chem(ktop,dt,tracer2d,tottracert,iopt,num_chem, &
792 tracer(I,K,J,nv)=max(epsilc,tracer(i,k,j,nv)+tottracert(i,k,nv)*dt)
800 if(pret(i).gt.0. .or. pretm(i).gt.0. .or. prets(i).gt.0.)then
801 pratec(i,j)=cuten(i)*pret(i)+cutenm(i)*pretm(i)+cutens(i)*prets(i)
802 raincv(i,j)=pratec(i,j)*dt
803 rkbcon = kte+kts - kbcon(i)
804 rktop = kte+kts - ktop(i)
805 if (ktop(i) > HTOP(i,j)) HTOP(i,j) = ktop(i)+.001
806 if (kbcon(i) < HBOT(i,j)) HBOT(i,j) = kbcon(i)+.001
810 IF(PRESENT(RQCCUTEN)) THEN
813 RQCCUTEN(I,K,J)=outqcm(i,k)+outqcs(i,k)+outqc(I,K)*cuten(i)
814 IF ( PRESENT( GDC ) ) GDC(I,K,J)=cupclwm(i,k)+cupclws(i,k)+CUPCLW(I,K)*cuten(i)
815 IF ( PRESENT( GDC2 ) ) GDC2(I,K,J)=0.
820 IF(PRESENT(RQICUTEN).AND.PRESENT(RQCCUTEN))THEN
823 if(t2d(i,k).lt.258.)then
824 RQICUTEN(I,K,J)=outqcm(i,k)+outqcs(i,k)+outqc(I,K)*cuten(i)
826 IF ( PRESENT( GDC2 ) ) THEN
827 GDC2(I,K,J)=cupclwm(i,k)+cupclws(i,k)+CUPCLW(I,K)*cuten(i)
832 RQCCUTEN(I,K,J)=outqcm(i,k)+outqcs(i,k)+outqc(I,K)*cuten(i)
833 IF ( PRESENT( GDC ) ) THEN
834 GDC(I,K,J)=cupclwm(i,k)+cupclws(i,k)+CUPCLW(I,K)*cuten(i)
844 END MODULE MODULE_CU_GF_WRFDRV