!----------------------------------------------------------------------- ! !WRF:MODEL_LAYER:PHYSICS ! !----------------------------------------------------------------------- ! MODULE MODULE_CU_BMJ ! !----------------------------------------------------------------------- USE MODULE_MODEL_CONSTANTS !----------------------------------------------------------------------- ! REAL,PARAMETER :: & & DSPC=-3000. & & ,DTTOP=0.,EFIFC=5.0,EFIMN=0.20,EFMNT=0.70 & & ,ELIVW=2.72E6,ENPLO=20000.,ENPUP=15000. & & ,EPSDN=1.05,EPSDT=0. & & ,EPSNTP=.0001,EPSNTT=.0001,EPSPR=1.E-7 & & ,EPSUP=1.00 & & ,FR=1.00,FSL=0.85,FSS=0.85 & & ,FUP=0. & & ,PBM=13000.,PFRZ=15000.,PNO=1000. & & ,PONE=2500.,PQM=20000. & & ,PSH=20000.,PSHU=45000. & & ,RENDP=1./(ENPLO-ENPUP) & & ,RHLSC=0.00,RHHSC=1.10 & & ,ROW=1.E3 & & ,STABDF=0.90,STABDS=0.90 & & ,STABS=1.0,STRESH=1.10 & & ,TREL=2400. REAL,PARAMETER :: DSPBFL=-3875.*FR & & ,DSP0FL=-5875.*FR & & ,DSPTFL=-1875.*FR & & ,DSPBFS=-3875. & & ,DSP0FS=-5875. & & ,DSPTFS=-1875. ! REAL,PARAMETER :: PL=2500.,PLQ=70000.,PH=105000. & & ,THL=210.,THH=365.,THHQ=325. ! INTEGER,PARAMETER :: ITB=76,JTB=134,ITBQ=152,JTBQ=440 ! INTEGER,PARAMETER :: ITREFI_MAX=3 ! !*** ARRAYS FOR LOOKUP TABLES ! REAL,DIMENSION(ITB),PRIVATE,SAVE :: STHE,THE0 REAL,DIMENSION(JTB),PRIVATE,SAVE :: QS0,SQS REAL,DIMENSION(ITBQ),PRIVATE,SAVE :: STHEQ,THE0Q REAL,DIMENSION(ITB,JTB),PRIVATE,SAVE :: PTBL REAL,DIMENSION(JTB,ITB),PRIVATE,SAVE :: TTBL REAL,DIMENSION(JTBQ,ITBQ),PRIVATE,SAVE :: TTBLQ !*** SHARE COPIES FOR MODULE_BL_MYJPBL ! REAL,DIMENSION(JTB) :: QS0_EXP,SQS_EXP REAL,DIMENSION(ITB,JTB) :: PTBL_EXP ! REAL,PARAMETER :: RDP=(ITB-1.)/(PH-PL),RDPQ=(ITBQ-1.)/(PH-PLQ) & & ,RDQ=ITB-1,RDTH=(JTB-1.)/(THH-THL) & & ,RDTHE=JTB-1.,RDTHEQ=JTBQ-1. & & ,RSFCP=1./101300. ! REAL,PARAMETER :: AVGEFI=(EFIMN+1.)*0.5 !----------------------------------------------------------------------- ! CONTAINS ! !----------------------------------------------------------------------- SUBROUTINE BMJDRV( & & IDS,IDE,JDS,JDE,KDS,KDE & & ,IMS,IME,JMS,JME,KMS,KME & & ,ITS,ITE,JTS,JTE,KTS,KTE & & ,DT,ITIMESTEP,STEPCU & & ,RAINCV,CUTOP,CUBOT,KPBL & & ,TH,T,QV & & ,PINT,PMID,PI,RHO,DZ8W & & ,CP,R,ELWV,ELIV,G,TFRZ,D608 & & ,CLDEFI,LOWLYR,XLAND,CU_ACT_FLAG & ! optional & ,RTHCUTEN, RQVCUTEN & & ) !----------------------------------------------------------------------- IMPLICIT NONE !----------------------------------------------------------------------- INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE & & ,IMS,IME,JMS,JME,KMS,KME & & ,ITS,ITE,JTS,JTE,KTS,KTE ! INTEGER,INTENT(IN) :: ITIMESTEP,STEPCU ! INTEGER,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: KPBL,LOWLYR ! REAL,INTENT(IN) :: CP,DT,ELIV,ELWV,G,R,TFRZ,D608 ! REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: XLAND ! REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(IN) :: DZ8W & & ,PI,PINT & & ,PMID,QV & & ,RHO,T,TH ! REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME) & & ,OPTIONAL & & ,INTENT(INOUT) :: RQVCUTEN,RTHCUTEN ! REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(INOUT) :: CLDEFI,RAINCV ! REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(OUT) :: CUBOT,CUTOP ! LOGICAL,DIMENSION(IMS:IME,JMS:JME),INTENT(INOUT) :: CU_ACT_FLAG ! !----------------------------------------------------------------------- !*** !*** LOCAL VARIABLES !*** !----------------------------------------------------------------------- INTEGER :: LBOT,LPBL,LTOP ! REAL :: DTCNVC,LANDMASK,PCPCOL,PSFC,PTOP ! REAL,DIMENSION(KTS:KTE) :: DPCOL,DQDT,DTDT,PCOL,QCOL,TCOL ! INTEGER :: I,J,K,KFLIP,ICLDCK,LMH ! !*** Begin debugging convection REAL :: DELQ,DELT,PLYR INTEGER :: IMD,JMD LOGICAL :: PRINT_DIAG !*** End debugging convection ! !----------------------------------------------------------------------- !*********************************************************************** !----------------------------------------------------------------------- ! !*** PREPARE TO CALL BMJ CONVECTION SCHEME ! !----------------------------------------------------------------------- ! !*** CHECK TO SEE IF THIS IS A CONVECTION TIMESTEP ! ICLDCK=MOD(ITIMESTEP,STEPCU) !----------------------------------------------------------------------- ! !*** COMPUTE CONVECTION EVERY STEPCU*DT/60.0 MINUTES ! !*** Begin debugging convection IMD=(IMS+IME)/2 JMD=(JMS+JME)/2 PRINT_DIAG=.FALSE. !*** End debugging convection IF(ICLDCK==0.OR.ITIMESTEP==0)THEN ! DO J=JTS,JTE DO I=ITS,ITE CU_ACT_FLAG(I,J)=.TRUE. ENDDO ENDDO ! DTCNVC=DT*STEPCU ! DO J=JTS,JTE DO I=ITS,ITE ! DO K=KTS,KTE DQDT(K)=0. DTDT(K)=0. ENDDO ! RAINCV(I,J)=0. PCPCOL=0. PSFC=PINT(I,LOWLYR(I,J),J) PTOP=PINT(I,KTE+1,J) ! KTE+1=KME ! !*** CONVERT TO BMJ LAND MASK (1.0 FOR SEA; 0.0 FOR LAND) ! LANDMASK=XLAND(I,J)-1. ! !*** FILL 1-D VERTICAL ARRAYS !*** AND FLIP DIRECTION SINCE BMJ SCHEME !*** COUNTS DOWNWARD FROM THE DOMAIN'S TOP ! DO K=KTS,KTE KFLIP=KTE+1-K ! !*** CONVERT FROM MIXING RATIO TO SPECIFIC HUMIDITY ! QCOL(K)=MAX(EPSQ,QV(I,KFLIP,J)/(1.+QV(I,KFLIP,J))) TCOL(K)=T(I,KFLIP,J) PCOL(K)=PMID(I,KFLIP,J) ! DPCOL(K)=PINT(I,KFLIP,J)-PINT(I,KFLIP+1,J) DPCOL(K)=RHO(I,KFLIP,J)*G*DZ8W(I,KFLIP,J) ENDDO ! !*** LOWEST LAYER ABOVE GROUND MUST ALSO BE FLIPPED ! LMH=KTE+1-LOWLYR(I,J) LPBL=KTE+1-KPBL(I,J) !----------------------------------------------------------------------- !*** !*** CALL CONVECTION !*** !----------------------------------------------------------------------- !*** Begin debugging convection ! PRINT_DIAG=.FALSE. ! IF(I==IMD.AND.J==JMD)PRINT_DIAG=.TRUE. !*** End debugging convection !----------------------------------------------------------------------- CALL BMJ(ITIMESTEP,I,J,DTCNVC,LMH,LANDMASK,CLDEFI(I,J) & & ,DPCOL,PCOL,QCOL,TCOL,PSFC,PTOP & & ,DQDT,DTDT,PCPCOL,LBOT,LTOP,LPBL & & ,CP,R,ELWV,ELIV,G,TFRZ,D608 & & ,PRINT_DIAG & & ,IDS,IDE,JDS,JDE,KDS,KDE & & ,IMS,IME,JMS,JME,KMS,KME & & ,ITS,ITE,JTS,JTE,KTS,KTE) !----------------------------------------------------------------------- ! !*** COMPUTE HEATING AND MOISTENING TENDENCIES ! IF ( PRESENT( RTHCUTEN ) .AND. PRESENT( RQVCUTEN )) THEN DO K=KTS,KTE KFLIP=KTE+1-K RTHCUTEN(I,K,J)=DTDT(KFLIP)/PI(I,K,J) ! !*** CONVERT FROM SPECIFIC HUMIDTY BACK TO MIXING RATIO ! RQVCUTEN(I,K,J)=DQDT(KFLIP)/(1.-QCOL(KFLIP))**2 ENDDO ENDIF ! !*** ALL UNITS IN BMJ SCHEME ARE MKS, THUS CONVERT PRECIP FROM METERS !*** TO MILLIMETERS PER STEP FOR OUTPUT. ! RAINCV(I,J)=PCPCOL*1.E3/STEPCU ! !*** CONVECTIVE CLOUD TOP AND BOTTOM FROM THIS CALL ! CUTOP(I,J)=REAL(KTE+1-LTOP) CUBOT(I,J)=REAL(KTE+1-LBOT) ! !----------------------------------------------------------------------- !*** Begin debugging convection IF(PRINT_DIAG)THEN DELT=0. DELQ=0. PLYR=0. IF(LBOT>0.AND.LTOP