COMPARE CLTEND.F
DONE CLTEND.F
COMPARE CUCNVC.F
9d8
<      &                 ,OMGALF,U,V,VTM,W0AVG                            &
12c11
<      &                 ,AVCNVC,ACUTIM,ZERO_3D,IHE,IHW                   &
---
>      &                 ,AVCNVC,ACUTIM,ZERO_3D                           &
38c37
<       USE MODULE_MODEL_CONSTANTS
---
>       USE module_model_constants
40,41c39,40
<       USE MODULE_CU_BMJ_NMM
<       USE MODULE_CUMULUS_DRIVER
---
>       USE MODULE_CU_BMJ_nmm
>       USE module_cumulus_driver
53,54d51
<       INTEGER, DIMENSION(JMS:JME),INTENT(IN) :: IHE,IHW
< !
72,73c69
<      &                                                        ,TCUCN    &
<      &                                                        ,W0AVG
---
>      &                                                        ,TCUCN
75,77c71,72
<       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(IN) :: OMGALF      &
<      &                                                     ,PINT,U,V    &
<      &                                                     ,VTM,ZERO_3D
---
>       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(IN) :: PINT
>       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(INOUT) :: ZERO_3D
88a84
>       REAL, DIMENSION(IMS:IME,JMS:JME)   :: NCA
90,91c86
<       REAL :: CAPA,DPL,DQDT,DTCNVC,DTDT,PCPCOL,PDSL,PLYR,RDTCNVC        &
<      &       ,RWMSK,WMSK
---
>       REAL :: CAPA,DPL,DQDT,DTCNVC,DTDT,PCPCOL,PDSL,PLYR,RDTCNVC
95,96c90
<       REAL,DIMENSION(IMS:IME,JMS:JME) :: CUBOT,CUTOP,NCA,RAINC,RAINCV   &
<      &                                  ,XLAND
---
>       REAL,DIMENSION(IMS:IME,JMS:JME) :: CUBOT,CUTOP,RAINC,RAINCV,XLAND
98,99d91
<       REAL,DIMENSION(IMS:IME,KMS:KME) :: WMID
< !
103,104c95
<      &                                          ,T_PHY,TH_PHY           &
<      &                                          ,U_PHY,V_PHY,WINT
---
>      &                                          ,T_PHY,TH_PHY
106,107d96
<       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME) :: DUMMY1
< !
112c101,102
<       integer :: isee=59,jsee=056,ksee=1
---
>       integer,save :: imax,jmax
>       real,save :: cuprec_max
120,124d109
< !
<       MYIS_P1 =MAX(IDS  ,ITS-1)
<       MYIE_P1 =MIN(IDE  ,ITE+1)
<       MYJS1_P1=MAX(JDS+1,JTS-1)
<       MYJE1_P1=MIN(JDE-1,JTE+1)
126d110
<       IF(CONFIG_FLAGS%CU_PHYSICS.EQ.KFETASCHEME)THEN
128,133c112
<         DO J=MYJS2,MYJE2
<         DO I=MYIS1,MYIE1
<           WINT(I,1,J)=0.
<           WINT(I,KTE+1,J)=0.
<         ENDDO
<         ENDDO
---
> !***  INITIALIZE
135,138c114
<         DO J=MYJS2,MYJE2
<           DO I=MYIS1,MYIE1
<             WMID(I,KTS)=-OMGALF(I,KTS,J)*CP/(G*DT)
<           ENDDO
---
>       RESTART=RESTRT
140,146c116,122
<           DO K=KTS+1,KTE
<           DO I=MYIS1,MYIE1
<             WMID(I,K)=-OMGALF(I,K,J)*CP/(G*DT)
<             WINT(I,K,J)=0.5*(WMID(I,K-1)+WMID(I,K))
<           ENDDO
<           ENDDO
<         ENDDO
---
>       IF(NTSD.EQ.0)THEN
>         RESTART=.FALSE.
>         CALL BMJINIT(RTHCUTEN,RQVCUTEN,RQCCUTEN,RQRCUTEN                &
>      &              ,CLDEFI,LOWLYR,CP,R_D,RESTART                       &
>      &              ,IDS,IDE,JDS,JDE,KDS,KDE                            &
>      &              ,IMS,IME,JMS,JME,KMS,KME                            &
>      &              ,ITS,ITE,JTS,JTE,KTS,KTE)
148,157d123
<         IF(.NOT.RESTART.AND.NTSD.EQ.0)THEN
<           DO J=JTS,JTE
<           DO K=KTS,KTE
<           DO I=ITS,ITE
<             W0AVG(I,K,J)=0.
<           ENDDO
<           ENDDO
<           ENDDO
<         ENDIF
< !
159d124
< !
161,162d125
< !***  DO PREPARATION IF THIS IS A CONVECTION STEP 
< !-----------------------------------------------------------------------
164c127,128
<       IF(MOD(NTSD,NCNVC).EQ.0)THEN
---
>       AVCNVC=AVCNVC+1.
>       ACUTIM=ACUTIM+1.
165a130,132
>       DTCNVC=NCNVC*DT
>       RDTCNVC=1./DTCNVC
>       CAPA=R_D/CP
167d133
<         RESTART=RESTRT
169,170c135,136
<         AVCNVC=AVCNVC+1.
<         ACUTIM=ACUTIM+1.
---
>       DO J=MYJS2,MYJE2
>       DO I=MYIS1,MYIE1
172,174c138,144
<         DTCNVC=NCNVC*DT
<         RDTCNVC=1./DTCNVC
<         CAPA=R_D/CP
---
>         PDSL=PD(I,J)*RES(I,J)
>         RAINCV(I,J)=0.
>         RAINC(I,J)=0.
>         P8W(I,KTS,J)=PD(I,J)+PDTOP+PT
>         LOWLYR(I,J)=KTE+1-LMH(I,J)
>         XLAND(I,J)=SM(I,J)+1.
>         NCA(I,J)=0
176,177c146
<         DO J=MYJS2,MYJE2
<         DO I=MYIS1,MYIE1
---
> !***  FILL THE INPUT ARRAYS.
179,185c148,152
<           PDSL=PD(I,J)*RES(I,J)
<           RAINCV(I,J)=0.
<           RAINC(I,J)=0.
<           P8W(I,KTS,J)=PD(I,J)+PDTOP+PT
<           LOWLYR(I,J)=KTE+1-LMH(I,J)
<           XLAND(I,J)=SM(I,J)+1.
<           NCA(I,J)=0.
---
>         DO K=KTS,KTE
>           DPL=DETA1(K)*PDTOP+DETA2(K)*PDSL
>           QL(K)=AMAX1(Q(I,K,J),EPSQ)
>           PLYR=AETA1(K)*PDTOP+AETA2(K)*PDSL+PT
>           TL(K)=T(I,K,J)
187,191c154,164
<           DO K=KTS,KTE
<             DPL=DETA1(K)*PDTOP+DETA2(K)*PDSL
<             QL(K)=AMAX1(Q(I,K,J),EPSQ)
<             PLYR=AETA1(K)*PDTOP+AETA2(K)*PDSL+PT
<             TL(K)=T(I,K,J)
---
>           RR(I,K,J)=PLYR/(R_D*TL(K)*(P608*QL(K)+1.))
>           T_PHY(I,K,J)=TL(K)
>           WATER(I,K,J,P_QV)=QL(K)/(1.-QL(K))
>           TH_PHY(I,K,J)=TL(K)*(1.E5/PLYR)**CAPA
> !!!       P8W(I,KFLIP,J)=PINT(I,K+1,J)
>           P8W(I,K+1,J)=ETA1(K+1)*PDTOP+ETA2(K+1)*PDSL+PT
>           P_PHY(I,K,J)=PLYR
>           PI_PHY(I,K,J)=(PLYR*1.E-5)**CAPA
>           DZ(I,K,J)=TL(K)*(P608*QL(K)+1.)*R_D                          &
>      &                 *(P8W(I,K,J)-P8W(I,K+1,J))                      &
>      &                 /(P_PHY(I,K,J)*G)
193,210c166,169
<             RR(I,K,J)=PLYR/(R_D*TL(K)*(P608*QL(K)+1.))
<             T_PHY(I,K,J)=TL(K)
<             WATER(I,K,J,P_QV)=QL(K)/(1.-QL(K))
<             TH_PHY(I,K,J)=TL(K)*(1.E5/PLYR)**CAPA
< !!!         P8W(I,KFLIP,J)=PINT(I,K+1,J)
<             P8W(I,K+1,J)=ETA1(K+1)*PDTOP+ETA2(K+1)*PDSL+PT
<             P_PHY(I,K,J)=PLYR
<             PI_PHY(I,K,J)=(PLYR*1.E-5)**CAPA
<             DZ(I,K,J)=TL(K)*(P608*QL(K)+1.)*R_D                        &
<      &                   *(P8W(I,K,J)-P8W(I,K+1,J))                    &
<      &                   /(P_PHY(I,K,J)*G)
< !
<             RTHCUTEN(I,K,J)=0.
<             RQVCUTEN(I,K,J)=0.
<             RQCCUTEN(I,K,J)=0.
<             RQRCUTEN(I,K,J)=0.
<           ENDDO
< !
---
>           RTHCUTEN(I,K,J)=0.
>           RQVCUTEN(I,K,J)=0.
>           RQCCUTEN(I,K,J)=0.
>           RQRCUTEN(I,K,J)=0.
212d170
<         ENDDO
213a172,173
>       ENDDO
>       ENDDO
215,216d174
< !***  COMPUTE VELOCITY COMPONENTS AT MASS POINTS
< !-----------------------------------------------------------------------
218,246d175
<         DO J=MYJS1_P1,MYJE1_P1
< !
<           DO K=KTS,KTE
<           DO I=MYIS_P1,MYIE_P1
<             WMSK=VTM(I+IHE(J),K,J)+VTM(I+IHW(J),K,J)                    &
<      &          +VTM(I,K,J+1)+VTM(I,K,J-1)
<             IF(WMSK.GT.0.)THEN
<               RWMSK=1./WMSK
<               U_PHY(I,K,J)=(U(I+IHE(J),K,J)*VTM(I+IHE(J),K,J)           &
<      &                         +U(I+IHW(J),K,J)*VTM(I+IHW(J),K,J)       &
<      &                         +U(I,K,J+1)*VTM(I,K,J+1)                 &
<      &                         +U(I,K,J-1)*VTM(I,K,J-1))*RWMSK
<               V_PHY(I,K,J)=(V(I+IHE(J),K,J)*VTM(I+IHE(J),K,J)           &
<      &                         +V(I+IHW(J),K,J)*VTM(I+IHW(J),K,J)       &
<      &                         +V(I,K,J+1)*VTM(I,K,J+1)                 &
<      &                         +V(I,K,J-1)*VTM(I,K,J-1))*RWMSK
<             ELSE
<               U_PHY(I,K,J)=0.
<               V_PHY(I,K,J)=0.
<             ENDIF
<           ENDDO
<           ENDDO
< !
<         ENDDO
< !
< !-----------------------------------------------------------------------
<       ENDIF  ! End of convection preparation
< !-----------------------------------------------------------------------
< !
249a179
>       NCA=0
252,254c182,184
<      &                   ,RTHCUTEN,RQVCUTEN,RQCCUTEN,RQRCUTEN           &
<      &                   ,DUMMY1,DUMMY1,RAINC,RAINCV,NCA                &
<      &                   ,U_PHY,V_PHY,TH_PHY,T_PHY,WINT,WATER           &
---
>      &                   ,RTHCUTEN,RQVCUTEN,ZERO_3D,ZERO_3D             &
>      &                   ,ZERO_3D,ZERO_3D,RAINC,RAINCV,NCA              &
>      &                   ,ZERO_3D,ZERO_3D,TH_PHY,T_PHY,ZERO_3D,WATER    &
256c186
<      &                   ,CONFIG_FLAGS,W0AVG,RR,NCNVC                   &
---
>      &                   ,CONFIG_FLAGS,ZERO_3D,RR,NCNVC                 &
261c191
<      &                   ,LBOT=LBOT,LTOP=LTOP,LPBL=LPBL                )  !optional arguments
---
>      &                   ,LBOT=LBOT,LTOP=LTOP,LPBL=LPBL                 )  !optional arguments
264,265d193
<       IF(MOD(NTSD,NCNVC).NE.0)RETURN
< !-----------------------------------------------------------------------
266a195,202
>       if(ntsd.eq.1.and.mype.eq.16)then
>           cuprec_max=0.
>           imax=0
>           jmax=0
>       endif
>       if(mype.eq.16)then
>         write(0,*)' CUCNVC before loop ntsd=',ntsd
>       endif
298a235,239
>       if(cuprec(i,j).gt.cuprec_max)then
>         imax=i
>         jmax=j
>         cuprec_max=cuprec(i,j)
>       endif
313a255,258
>       if(mype.eq.16)then
>         write(0,*)' CUCNVC after loop ntsd=',ntsd
>         write(0,*)' cuprec_max(',imax,',',jmax,')=',cuprec_max
>       endif
DONE CUCNVC.F
COMPARE GSMDRIVE.F
DONE GSMDRIVE.F
COMPARE RADIATION.F
9d8
<      &                    ,F_ICE,F_RAIN                                 &
77,78d75
<       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(IN) :: F_ICE,F_RAIN
< !
112c109
<       REAL :: CAPA,DPL,FICE,FRAIN,GMT,PDSL,PLYR,PSFC,QI,QR,QW,RADT,WC
---
>       REAL :: CAPA,DPL,GMT,PDSL,PLYR,PSFC,RADT
120c117
<      &                                          ,RR,T8W,THRATEN         &
---
>      &                                          ,RR,THRATEN             &
135d131
<       RADT=DT*NRADS/60.
145,153d140
<       DO J=MYJS,MYJE
<       DO K=KTS,KTE
<       DO I=MYIS,MYIE
<         WATER(I,K,J,P_QS)=0.
<         WATER(I,K,J,P_QG)=0.
<       ENDDO
<       ENDDO
<       ENDDO
< !-----------------------------------------------------------------------
166d152
<         T8W(I,1,J)=TSFC(I,J)
179a166
>           WATER(I,K,J,P_QC)=CWM(I,K,J)
193,224d179
< !
< !***  DECOMPOSE CLOUDS TO CLOUD LIQUID, RAIN, AND CLOUD ICE + SNOW.
< !
<           WC=CWM(I,K,J)
<           QI=0.
<           QR=0.
<           QW=0.
<           FICE=F_ICE(I,K,J)
<           FRAIN=F_RAIN(I,K,J)
< !
<           IF(FICE.GE.1.)THEN
<             QI=WC
<           ELSEIF(FICE.LE.0.)THEN
<             QW=WC
<           ELSE
<             QI=FICE*WC
<             QW=WC-QI
<           ENDIF
< !
<           IF(QW.GT.0..AND.FRAIN.GT.0.)THEN
<             IF(FRAIN.GE.1.)THEN
<               QR=QW
<               QW=0.
<             ELSE
<               QR=FRAIN*QW
<               QW=QW-QR
<             ENDIF
<           ENDIF
< !
<           WATER(I,K,J,P_QC)=QW
<           WATER(I,K,J,P_QR)=QR
<           WATER(I,K,J,P_QI)=QI
227,231d181
<         DO K=KTS+1,KTE
<           T8W(I,K,J)=0.5*(TL(K-1)+TL(K))
<         ENDDO
<         T8W(I,KTE+1,J)=-1.E20
< !
234a185
>       RADT=999.
258c209
<      &                     ,P8W,P_PHY,ZERO_3D,PI_PHY,DZ,T_PHY,T8W       &
---
>      &                     ,P8W,P_PHY,ZERO_3D,PI_PHY,DZ,T_PHY,ZERO_3D   &
290,293d240
<             IF(CONFIG_FLAGS%RA_SW_PHYSICS.NE.GFDLSWSCHEME)THEN
<               TOTSWDN(I,J)=SWNETDN(I,J)/(1.-ALBEDO(I,J))  !!Comment out for GFDL
<             ENDIF
< !
323d269
<                totlwdn(i,j)=glw(i,j)
DONE RADIATION.F
COMPARE RDTEMP.F
DONE RDTEMP.F
COMPARE TURBL.F
13c13
<      &                ,THZ0,QZ0,UZ0,VZ0,QS,QSTAR                        &
---
>      &                ,THZ0,QZ0,UZ0,VZ0,QS                              &
96,97c96
<       REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(INOUT) :: ALBASE,MXSNAL    &
<      &                                                ,QSTAR
---
>       REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(INOUT) :: ALBASE,MXSNAL
172,175d170
< !***  THIS NEEDS CHECKING.  HOL IS IN REGISTRY AS AN I1 VARIABLE.
<       REAL,DIMENSION(IMS:IME,JMS:JME) :: HOL
< !
< !
408d402
<       write(0,*)' TURBL before call to PBL_DRIVER ntsd=',ntsd
415c409
<      &               ,USTAR,HOL,QSTAR,PBLH,ZERO_2D,ZERO_2D              &
---
>      &               ,USTAR,ZERO_2D,ZERO_2D,PBLH,     ZERO_2D,ZERO_2D   &
418,420c412,414
<      &               ,IVGTYP,ISLTYP,VGFRCK,SFCEVPx,GRNFLX               &
<      &               ,SFCEXC,ACSNOW,ACSNOM,ALBEDO,SICE                  &
<      &               ,TH2X,TSHLTR,QSHLTR,SMC,SNOW,CMC                   &
---
>      &               ,IVGTYP,ISLTYP,VGFRCK,SFCEVPx,       GRNFLX        &
>      &               ,SFCEXC,ACSNOW,ACSNOM,ALBEDO,       SICE           &
>      &               ,TH2X,ZERO_2D,Q2X,SMC,SNOW,CMC                     &
428,429c422
< !!tlb&               ,U10,V10,TSHLTR,TH10,QSHLTR,Q10                    &
<      &               ,U10,V10,TH10,Q10                                  &
---
>      &               ,U10,V10,TSHLTR,TH10,QSHLTR,Q10                    &
524,531c517,521
< !!!       RHOD=P_PHY(I,K,J)/(R_D*T(I,K,J))
< !!!       RHODI=1./RHOD
< !!!       DTDT=RTHBLTEN(I,K,J)*PI_PHY(I,K,J)*RHODI
< !!!       DQDT=RQVBLTEN(I,K,J)*RHODI   !Mixing ratio tendency
< !!!       DCDT=RQCBLTEN(I,K,J)*RHODI
<           DTDT=RTHBLTEN(I,K,J)*PI_PHY(I,K,J)
<           DQDT=RQVBLTEN(I,K,J)         !Mixing ratio tendency
<           DCDT=RQCBLTEN(I,K,J)      
---
>           RHOD=P_PHY(I,K,J)/(R_D*T(I,K,J))
>           RHODI=1./RHOD
>           DTDT=RTHBLTEN(I,K,J)*PI_PHY(I,K,J)*RHODI
>           DQDT=RQVBLTEN(I,K,J)*RHODI   !Mixing ratio tendency
>           DCDT=RQCBLTEN(I,K,J)*RHODI
550,555c540,543
< !!!       RHOD=P_PHY(I,K,J)/(R_D*TOLD(I,K,J))
< !!!       RHODI=1./RHOD
< !!!       DUDT(I,K,J)=DUDT(I,K,J)*RHODI
< !!!       DVDT(I,K,J)=DVDT(I,K,J)*RHODI
<           DUDT(I,K,J)=DUDT(I,K,J)
<           DVDT(I,K,J)=DVDT(I,K,J)
---
>           RHOD=P_PHY(I,K,J)/(R_D*TOLD(I,K,J))
>           RHODI=1./RHOD
>           DUDT(I,K,J)=DUDT(I,K,J)*RHODI
>           DVDT(I,K,J)=DVDT(I,K,J)*RHODI
DONE TURBL.F
COMPARE init_modules_nmm.F
DONE init_modules_nmm.F
COMPARE module_ADVECTION.F
27,42c27,42
< !*********************************************************************** 
<       SUBROUTINE ADVE(NTSD,DT,DETA1,DETA2,PDTOP                         &
<      &               ,CURV,F,FAD,F4D,EM_LOC,EMT_LOC,EN,ENT,DX,DY        &
<      &               ,HTM,HBM2,VTM,VBM2                                 &
<      &               ,T,U,V,PDSLO,TOLD,UOLD,VOLD                        &
<      &               ,PETDT,UPSTRM                                      &
<      &               ,FEW,FNS,FNE,FSE                                   &
<      &               ,ADT,ADU,ADV                                       &
<      &               ,N_IUP_H,N_IUP_V                                   &
<      &               ,N_IUP_ADH,N_IUP_ADV                               &
<      &               ,IUP_H,IUP_V,IUP_ADH,IUP_ADV                       &
<      &               ,IHE,IHW,IVE,IVW,INDX3_WRK                         &
<      &               ,IDS,IDE,JDS,JDE,KDS,KDE                           &
<      &               ,IMS,IME,JMS,JME,KMS,KME                           &
<      &               ,ITS,ITE,JTS,JTE,KTS,KTE)
< !***********************************************************************
---
> !********************************************************************** 
>       SUBROUTINE ADVE(NTSD,DT,DETA1,DETA2,PDTOP                        &
>                      ,CURV,F,FAD,F4D,EM_LOC,EMT_LOC,EN,ENT,DX,DY       &
>                      ,HTM,HBM2,VTM,VBM2                                &
>                      ,T,U,V,PDSLO,TOLD,UOLD,VOLD                       &
>                      ,PETDT,UPSTRM                                     &
>                      ,FEW,FNS,FNE,FSE                                  &
>                      ,ADT,ADU,ADV                                      &
>                      ,N_IUP_H,N_IUP_V                                  &
>                      ,N_IUP_ADH,N_IUP_ADV                              &
>                      ,IUP_H,IUP_V,IUP_ADH,IUP_ADV                      &
>                      ,IHE,IHW,IVE,IVW,INDX3_WRK                        &
>                      ,IDS,IDE,JDS,JDE,KDS,KDE                          &
>                      ,IMS,IME,JMS,JME,KMS,KME                          &
>                      ,ITS,ITE,JTS,JTE,KTS,KTE)
> !**********************************************************************
95,97c95,97
<       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                     &
<      &                     ,IMS,IME,JMS,JME,KMS,KME                     &
<      &                     ,ITS,ITE,JTS,JTE,KTS,KTE
---
>       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                    &
>                            ,IMS,IME,JMS,JME,KMS,KME                    &
>                            ,ITS,ITE,JTS,JTE,KTS,KTE
100,103c100,103
<       INTEGER, DIMENSION(JMS:JME),INTENT(IN) :: N_IUP_H,N_IUP_V         &
<      &                                         ,N_IUP_ADH,N_IUP_ADV
<       INTEGER, DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: IUP_H,IUP_V     &
<      &                                                 ,IUP_ADH,IUP_ADV
---
>       INTEGER, DIMENSION(JMS:JME),INTENT(IN) :: N_IUP_H,N_IUP_V        &
>                                                ,N_IUP_ADH,N_IUP_ADV
>       INTEGER, DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: IUP_H,IUP_V    &
>                                                        ,IUP_ADH,IUP_ADV
118,119c118,119
<       REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: CURV,DX,F,FAD,HBM2  &
<      &                                             ,PDSLO,VBM2
---
>       REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: CURV,DX,F,FAD,HBM2 &
>                                                    ,PDSLO,VBM2
125,127c125,127
<       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(INOUT) :: T,TOLD   &
<      &                                                        ,U,UOLD   &
<      &                                                        ,V,VOLD
---
>       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(INOUT) :: T,TOLD  &
>                                                               ,U,UOLD  &
>                                                               ,V,VOLD
129,132c129,132
<       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(OUT) :: ADT,ADU    &
<      &                                                      ,ADV        &
<      &                                                      ,FEW,FNE    &
<      &                                                      ,FNS,FSE
---
>       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(OUT) :: ADT,ADU   &
>                                                             ,ADV       &
>                                                             ,FEW,FNE   &
>                                                             ,FNS,FSE
140,144c140,144
<       INTEGER :: I,IEND,IFP,IFQ,II,IPQ,ISP,ISQ,ISTART                   &
<      &          ,IUP_ADH_J,IVH,IVL                                      &
<      &          ,J,J1,JA,JAK,JEND,JGLOBAL,JJ,JKNT,JP2,JSTART            &
<      &          ,K,KNTI_ADH,KSTART,KSTOP                                &
<      &          ,N,N_IUPH_J,N_IUPADH_J,N_IUPADV_J
---
>       INTEGER :: I,IEND,IFP,IFQ,II,IPQ,ISP,ISQ,ISTART                  &
>                 ,IUP_ADH_J,IVH,IVL                                     &
>                 ,J,J1,JA,JAK,JEND,JGLOBAL,JJ,JKNT,JP2,JSTART           &
>                 ,K,KNTI_ADH,KSTART,KSTOP                               &
>                 ,N,N_IUPH_J,N_IUPADH_J,N_IUPADV_J
148,150c148,150
<       INTEGER :: J0_P3,J0_P2,J0_P1,J0_00,J0_M1,J1_P2,J1_P1,J1_00,J1_M1  &
<      &          ,J2_P1,J2_00,J2_M1,J3_P2,J3_P1,J3_00                    &
<      &          ,J4_P1,J4_00,J4_M1,J5_00,J5_M1,J6_P1,J6_00
---
>       INTEGER :: J0_P3,J0_P2,J0_P1,J0_00,J0_M1,J1_P2,J1_P1,J1_00,J1_M1 &
>                 ,J2_P1,J2_00,J2_M1,J3_P2,J3_P1,J3_00                   &
>                 ,J4_P1,J4_00,J4_M1,J5_00,J5_M1,J6_P1,J6_00
152,154c152,154
<       INTEGER,DIMENSION(ITS-5:ITE+5) :: KBOT_CFL_T,KTOP_CFL_T           &
<      &                                 ,KBOT_CFL_U,KTOP_CFL_U           &
<      &                                 ,KBOT_CFL_V,KTOP_CFL_V
---
>       INTEGER,DIMENSION(ITS-5:ITE+5) :: KBOT_CFL_T,KTOP_CFL_T          &
>                                        ,KBOT_CFL_U,KTOP_CFL_U          &
>                                        ,KBOT_CFL_V,KTOP_CFL_V
158,161c158,161
<       REAL :: ARRAY3_X,CFL,DPDE_P3,F0,F1,F2,F3                          &
<      &       ,FEW_00,FEW_P1,FNE_X,FNS_P1,FNS_X,FPP,FSE_X                &
<      &       ,HM,PP,QP,RDPD,RDPDX,RDPDY,T_UP,TEMPA,TEMPB,TTA,TTB        &
<      &       ,U_UP,UDY_P1,UDY_X,VXD_X,VDX_P2,V_UP,VDX_X,VM,VTA,VUA,VVA
---
>       REAL :: ARRAY3_X,CFL,DPDE_P3,F0,F1,F2,F3                         &
>              ,FEW_00,FEW_P1,FNE_X,FNS_P1,FNS_X,FPP,FSE_X               &
>              ,HM,PP,QP,RDPD,RDPDX,RDPDY,T_UP,TEMPA,TEMPB,TTA,TTB       &
>              ,U_UP,UDY_P1,UDY_X,VXD_X,VDX_P2,V_UP,VDX_X,VM,VTA,VUA,VVA
163,166c163,166
<       REAL,DIMENSION(ITS-5:ITE+5,KTS:KTE) :: ARRAY0,ARRAY1              &
<      &                                      ,ARRAY2,ARRAY3              &
<      &                                      ,VAD_TEND_T,VAD_TEND_U      &
<      &                                      ,VAD_TEND_V
---
>       REAL,DIMENSION(ITS-5:ITE+5,KTS:KTE) :: ARRAY0,ARRAY1             &
>                                             ,ARRAY2,ARRAY3             &
>                                             ,VAD_TEND_T,VAD_TEND_U     &
>                                             ,VAD_TEND_V
382,383c382,383
<           TEMPA=(UDY(I+IHE(JJ),K,J)+VDX(I+IHE(JJ),K,J))                 &
<      &         +(UDY(I,K,J+1)      +VDX(I,K,J+1))
---
>           TEMPA=(UDY(I+IHE(JJ),K,J)+VDX(I+IHE(JJ),K,J))                &
>                +(UDY(I,K,J+1)      +VDX(I,K,J+1))
396,397c396,397
<           TEMPB=(UDY(I+IHE(JJ),K,J)-VDX(I+IHE(JJ),K,J))                 &
<      &         +(UDY(I,K,J-1)      -VDX(I,K,J-1))
---
>           TEMPB=(UDY(I+IHE(JJ),K,J)-VDX(I+IHE(JJ),K,J))                &
>                +(UDY(I,K,J-1)      -VDX(I,K,J-1))
420,423c420,423
<           UNS(I,K,J)=(FNS(I+IHW(JJ),K,JJ)+FNS(I+IHE(JJ),K,JJ))          &
<      &              *(UST(I,K,J+1)-UST(I,K,J-1))
<           VNS(I,K,J)=(FNS(I,K,JJ-1)+FNS(I,K,JJ+1))                      &
<      &              *(VST(I,K,J+1)-VST(I,K,J-1))
---
>           UNS(I,K,J)=(FNS(I+IHW(JJ),K,JJ)+FNS(I+IHE(JJ),K,JJ))         &
>                     *(UST(I,K,J+1)-UST(I,K,J-1))
>           VNS(I,K,J)=(FNS(I,K,JJ-1)+FNS(I,K,JJ+1))                     &
>                     *(VST(I,K,J+1)-VST(I,K,J-1))
440,447c440,447
<         UNE(I,K,-1)=(FNE(I+IVW(JJ),K,JJ)+FNE(I+IVE(JJ),K,JJ))           &
<      &             *(UST(I+IVE(JJ),K,0)-UST(I,K,-1))
<         USE(I,K,0)=(FSE(I+IVW(JJ+1),K,JJ+1)+FSE(I+IVE(JJ+1),K,JJ+1))    &
<      &            *(UST(I+IVE(JJ+1),K,-1)-UST(I,K,0))
<         VNE(I,K,-1)=(FNE(I,K,JJ-1)+FNE(I,K,JJ+1))                       &
<      &             *(VST(I+IVE(JJ),K,0)-VST(I,K,-1))
<         VSE(I,K,0)=(FSE(I,K,JJ)+FSE(I,K,JJ+2))                          &
<      &            *(VST(I+IVE(JJ+1),K,-1)-VST(I,K,0))
---
>         UNE(I,K,-1)=(FNE(I+IVW(JJ),K,JJ)+FNE(I+IVE(JJ),K,JJ))          &
>                    *(UST(I+IVE(JJ),K,0)-UST(I,K,-1))
>         USE(I,K,0)=(FSE(I+IVW(JJ+1),K,JJ+1)+FSE(I+IVE(JJ+1),K,JJ+1))   &
>                   *(UST(I+IVE(JJ+1),K,-1)-UST(I,K,0))
>         VNE(I,K,-1)=(FNE(I,K,JJ-1)+FNE(I,K,JJ+1))                      &
>                    *(VST(I+IVE(JJ),K,0)-VST(I,K,-1))
>         VSE(I,K,0)=(FSE(I,K,JJ)+FSE(I,K,JJ+2))                         &
>                   *(VST(I+IVE(JJ+1),K,-1)-VST(I,K,0))
550,551c550,551
<         TEMPA=(UDY(I+IHE(J+1),K,J1_P1)+VDX(I+IHE(J+1),K,J1_P1))         &
<      &       +(UDY(I,K,J1_P2)         +VDX(I,K,J1_P2))
---
>         TEMPA=(UDY(I+IHE(J+1),K,J1_P1)+VDX(I+IHE(J+1),K,J1_P1))       &
>              +(UDY(I,K,J1_P2)         +VDX(I,K,J1_P2))
555,556c555,556
<         TEMPB=(UDY(I+IHE(J+2),K,J1_P2)-VDX(I+IHE(J+2),K,J1_P2))         &
<      &       +(UDY(I,K,J1_P1)         -VDX(I,K,J1_P1))
---
>         TEMPB=(UDY(I+IHE(J+2),K,J1_P2)-VDX(I+IHE(J+2),K,J1_P2))        &
>              +(UDY(I,K,J1_P1)         -VDX(I,K,J1_P1))
565,566c565,566
<         FEW(I,K,J+1)=UDY_P1*(DPDE(I+IVW(J+1),K,J0_P1)                   &
<      &                        +DPDE(I+IVE(J+1),K,J0_P1))
---
>         FEW(I,K,J+1)=UDY_P1*(DPDE(I+IVW(J+1),K,J0_P1)                  &
>                               +DPDE(I+IVE(J+1),K,J0_P1))
592,600c592,600
<         UEW(I,K)=(FEW(I+IHW(J),K,J)+FEW(I+IHE(J),K,J))                  &
<      &          *(UST(I+IHE(J),K,J1_00)-UST(I+IHW(J),K,J1_00))
<         UNS(I,K,J4_P1)=(FNS(I+IHW(J+1),K,J+1)                           &
<      &                 +FNS(I+IHE(J+1),K,J+1))                          &
<      &                *(UST(I,K,J1_P2)-UST(I,K,J1_00))
<         VEW(I,K)=(FEW(I,K,J-1)+FEW(I,K,J+1))                            &
<      &          *(VST(I+IHE(J),K,J1_00)-VST(I+IHW(J),K,J1_00))
<         VNS(I,K,J4_P1)=(FNS(I,K,J)+FNS(I,K,J+2))                        &
<      &                *(VST(I,K,J1_P2)-VST(I,K,J1_00))
---
>         UEW(I,K)=(FEW(I+IHW(J),K,J)+FEW(I+IHE(J),K,J))                 &
>                 *(UST(I+IHE(J),K,J1_00)-UST(I+IHW(J),K,J1_00))
>         UNS(I,K,J4_P1)=(FNS(I+IHW(J+1),K,J+1)                          &
>                        +FNS(I+IHE(J+1),K,J+1))                         &
>                       *(UST(I,K,J1_P2)-UST(I,K,J1_00))
>         VEW(I,K)=(FEW(I,K,J-1)+FEW(I,K,J+1))                           &
>                 *(VST(I+IHE(J),K,J1_00)-VST(I+IHW(J),K,J1_00))
>         VNS(I,K,J4_P1)=(FNS(I,K,J)+FNS(I,K,J+2))                       &
>                       *(VST(I,K,J1_P2)-VST(I,K,J1_00))
607,615c607,615
<         UNE(I,K,J5_00)=(FNE(I+IVW(J),K,J)+FNE(I+IVE(J),K,J))            &
<      &                *(UST(I+IVE(J),K,J1_P1)-UST(I,K,J1_00))
<         USE(I,K,J6_P1)=(FSE(I+IVW(J+1),K,J+1)                           &
<      &                 +FSE(I+IVE(J+1),K,J+1))                          &
<      &                *(UST(I+IVE(J+1),K,J1_00)-UST(I,K,J1_P1))
<         VNE(I,K,J5_00)=(FNE(I,K,J-1)+FNE(I,K,J+1))                      &
<      &                *(VST(I+IVE(J),K,J1_P1)-VST(I,K,J1_00))
<         VSE(I,K,J6_P1)=(FSE(I,K,J)+FSE(I,K,J+2))                        &
<      &                *(VST(I+IVE(J+1),K,J1_00)-VST(I,K,J1_P1))
---
>         UNE(I,K,J5_00)=(FNE(I+IVW(J),K,J)+FNE(I+IVE(J),K,J))           &
>                       *(UST(I+IVE(J),K,J1_P1)-UST(I,K,J1_00))
>         USE(I,K,J6_P1)=(FSE(I+IVW(J+1),K,J+1)                          &
>                        +FSE(I+IVE(J+1),K,J+1))                         &
>                       *(UST(I+IVE(J+1),K,J1_00)-UST(I,K,J1_P1))
>         VNE(I,K,J5_00)=(FNE(I,K,J-1)+FNE(I,K,J+1))                     &
>                       *(VST(I+IVE(J),K,J1_P1)-VST(I,K,J1_00))
>         VSE(I,K,J6_P1)=(FSE(I,K,J)+FSE(I,K,J+2))                       &
>                       *(VST(I+IVE(J+1),K,J1_00)-VST(I,K,J1_P1))
638,642c638,642
<           ADT(I,K,J)=(TEW(I+IHW(J),K)+TEW(I+IHE(J),K)                   &
<      &               +TNS(I,K,J4_M1)+TNS(I,K,J4_P1)                     &
<      &               +TNE(I+IHW(J),K,J5_M1)+TNE(I,K,J5_00)              &
<      &               +TSE(I,K,J6_00)+TSE(I+IHW(J),K,J6_P1))             &
<      &               *RDPD*FAD(I,J)
---
>           ADT(I,K,J)=(TEW(I+IHW(J),K)+TEW(I+IHE(J),K)                  &
>                      +TNS(I,K,J4_M1)+TNS(I,K,J4_P1)                    &
>                      +TNE(I+IHW(J),K,J5_M1)+TNE(I,K,J5_00)             &
>                      +TSE(I,K,J6_00)+TSE(I+IHW(J),K,J6_P1))            &
>                      *RDPD*FAD(I,J)
659,663c659,663
<           ADU(I,K,J)=(UEW(I+IVW(J),K)+UEW(I+IVE(J),K)                   &
<      &               +UNS(I,K,J4_M1)+UNS(I,K,J4_P1)                     &
<      &               +UNE(I+IVW(J),K,J5_M1)+UNE(I,K,J5_00)              &
<      &               +USE(I,K,J6_00)+USE(I+IVW(J),K,J6_P1))             &
<      &               *RDPDX*FAD(I+IVW(J),J)
---
>           ADU(I,K,J)=(UEW(I+IVW(J),K)+UEW(I+IVE(J),K)                  &
>                      +UNS(I,K,J4_M1)+UNS(I,K,J4_P1)                    &
>                      +UNE(I+IVW(J),K,J5_M1)+UNE(I,K,J5_00)             &
>                      +USE(I,K,J6_00)+USE(I+IVW(J),K,J6_P1))            &
>                      *RDPDX*FAD(I+IVW(J),J)
665,669c665,669
<           ADV(I,K,J)=(VEW(I+IVW(J),K)+VEW(I+IVE(J),K)                   &
<      &               +VNS(I,K,J4_M1)+VNS(I,K,J4_P1)                     &
<      &               +VNE(I+IVW(J),K,J5_M1)+VNE(I,K,J5_00)              &
<      &               +VSE(I,K,J6_00)+VSE(I+IVW(J),K,J6_P1))             &
<      &               *RDPDY*FAD(I+IVW(J),J)
---
>           ADV(I,K,J)=(VEW(I+IVW(J),K)+VEW(I+IVE(J),K)                  &
>                      +VNS(I,K,J4_M1)+VNS(I,K,J4_P1)                    &
>                      +VNE(I+IVW(J),K,J5_M1)+VNE(I,K,J5_00)             &
>                      +VSE(I,K,J6_00)+VSE(I+IVW(J),K,J6_P1))            &
>                      *RDPDY*FAD(I+IVW(J),J)
701,704c701,704
<               TTA=EMT_LOC(J)*(UST(I,K,J1_M1)+UST(I+IHW(J),K,J1_00)      &
<      &                       +UST(I+IHE(J),K,J1_00)+UST(I,K,J1_P1))
<               TTB=ENT       *(VST(I,K,J1_M1)+VST(I+IHW(J),K,J1_00)      &
<      &                       +VST(I+IHE(J),K,J1_00)+VST(I,K,J1_P1))
---
>               TTA=EMT_LOC(J)*(UST(I,K,J1_M1)+UST(I+IHW(J),K,J1_00)     &
>                              +UST(I+IHE(J),K,J1_00)+UST(I,K,J1_P1))
>               TTB=ENT       *(VST(I,K,J1_M1)+VST(I+IHW(J),K,J1_00)     &
>                              +VST(I+IHE(J),K,J1_00)+VST(I,K,J1_P1))
748,750c748,750
<               IF(HTM(I+IHE(J)+IFP,K,J+ISP)                              &
<      &          *HTM(I+IHE(J)+IFQ,K,J+ISQ)                              &
<      &          *HTM(I+IPQ,K,J+ISP+ISQ).GT.0.1)THEN
---
>               IF(HTM(I+IHE(J)+IFP,K,J+ISP)                             &
>                 *HTM(I+IHE(J)+IFQ,K,J+ISQ)                             &
>                 *HTM(I+IPQ,K,J+ISP+ISQ).GT.0.1)THEN
754,756c754,756
<               IF(HTM(I+IHE(J)+IFP,K,J+ISP)                              &
<      &          +HTM(I+IHE(J)+IFQ,K,J+ISQ)                              &
<      &          +HTM(I+IPQ,K,J+ISP+ISQ).LT.0.1)THEN 
---
>               IF(HTM(I+IHE(J)+IFP,K,J+ISP)                             &
>                 +HTM(I+IHE(J)+IFQ,K,J+ISQ)                             &
>                 +HTM(I+IPQ,K,J+ISP+ISQ).LT.0.1)THEN 
762,764c762,764
<               ELSEIF                                                    &
<      &        (HTM(I+IHE(J)+IFP,K,J+ISP)+HTM(I+IPQ,K,J+ISP+ISQ)         &
<      &        .LT.0.99)THEN
---
>               ELSEIF                                                   &
>               (HTM(I+IHE(J)+IFP,K,J+ISP)+HTM(I+IPQ,K,J+ISP+ISQ)        &
>               .LT.0.99)THEN
769,770c769,770
<               ELSEIF                                                    &
<      &        (HTM(I+IHE(J)+IFQ,K,J+ISQ)+HTM(I+IPQ,K,J+ISP+ISQ)         &
---
>               ELSEIF                                                   &
>               (HTM(I+IHE(J)+IFQ,K,J+ISQ)+HTM(I+IPQ,K,J+ISP+ISQ)        &
776,780c776,780
<               ELSEIF                                                    &
<      &        (HTM(I+IHE(J)+IFP,K,J+ISP)                                &
<      &        +HTM(I+IHE(J)+IFQ,K,J+ISQ).LT.0.99)THEN
<                 T(I+IHE(J)+IFP,K,J+ISP)=0.5*(T(I,K,J)                   &
<      &                                      +T(I+IPQ,K,J+ISP+ISQ))
---
>               ELSEIF                                                   &
>               (HTM(I+IHE(J)+IFP,K,J+ISP)                               &
>               +HTM(I+IHE(J)+IFQ,K,J+ISQ).LT.0.99)THEN
>                 T(I+IHE(J)+IFP,K,J+ISP)=0.5*(T(I,K,J)                  &
>                                             +T(I+IPQ,K,J+ISP+ISQ))
784,786c784,786
<                 T(I+IHE(J)+IFP,K,J+ISP)=T(I,K,J)                        &
<      &                                 +T(I+IPQ,K,J+ISP+ISQ)            &
<      &                                 -T(I+IHE(J)+IFQ,K,J+ISQ)
---
>                 T(I+IHE(J)+IFP,K,J+ISP)=T(I,K,J)                       &
>                                        +T(I+IPQ,K,J+ISP+ISQ)           &
>                                        -T(I+IHE(J)+IFQ,K,J+ISQ)
789,791c789,791
<                 T(I+IHE(J)+IFQ,K,J+ISQ)=T(I,K,J)                        &
<      &                                 +T(I+IPQ,K,J+ISP+ISQ)            &
<      &                                 -T(I+IHE(J)+IFP,K,J+ISP)
---
>                 T(I+IHE(J)+IFQ,K,J+ISQ)=T(I,K,J)                       &
>                                        +T(I+IPQ,K,J+ISP+ISQ)           &
>                                        -T(I+IHE(J)+IFP,K,J+ISP)
794,796c794,796
<                 T(I+IPQ,K,J+ISP+ISQ)=T(I+IHE(J)+IFP,K,J+ISP)            &
<      &                              +T(I+IHE(J)+IFQ,K,J+ISQ)            &
<      &                              -T(I,K,J)
---
>                 T(I+IPQ,K,J+ISP+ISQ)=T(I+IHE(J)+IFP,K,J+ISP)           &
>                                     +T(I+IHE(J)+IFQ,K,J+ISQ)           &
>                                     -T(I,K,J)
817,819c817,819
<                 ADT(I,K,J)=F0*T(I,K,J)                                  &
<      &                    +F1*T(I+IHE(J)+IFP,K,J+ISP)                   &
<      &                    +F2*T(I+IHE(J)+IFQ,K,J+ISQ)                   &
---
>                 ADT(I,K,J)=F0*T(I,K,J)                                 &
>                           +F1*T(I+IHE(J)+IFP,K,J+ISP)                  &
>                           +F2*T(I+IHE(J)+IFQ,K,J+ISQ)                  &
875,878c875,878
<               ADU(I,K,J)=F0*U(I,K,J)                                    &
<      &                  +F1*U(I+IVE(J)+IFP,K,J+ISP)                     &
<      &                  +F2*U(I+IVE(J)+IFQ,K,J+ISQ)                     &
<      &                  +F3*U(I+IPQ,K,J+ISP+ISQ)
---
>               ADU(I,K,J)=F0*U(I,K,J)                                   &
>                         +F1*U(I+IVE(J)+IFP,K,J+ISP)                    &
>                         +F2*U(I+IVE(J)+IFQ,K,J+ISQ)                    &
>                         +F3*U(I+IPQ,K,J+ISP+ISQ)
880,883c880,883
<               ADV(I,K,J)=F0*V(I,K,J)                                    &
<      &                  +F1*V(I+IVE(J)+IFP,K,J+ISP)                     &
<      &                  +F2*V(I+IVE(J)+IFQ,K,J+ISQ)                     &
<      &                  +F3*V(I+IPQ,K,J+ISP+ISQ)
---
>               ADV(I,K,J)=F0*V(I,K,J)                                   &
>                         +F1*V(I+IVE(J)+IFP,K,J+ISP)                    &
>                         +F2*V(I+IVE(J)+IFQ,K,J+ISQ)                    &
>                         +F3*V(I+IPQ,K,J+ISP+ISQ)
924c924
<      &     /(0.5*(DPDE(I,K+1,J0_00)+DPDE(I,K,J0_00)))
---
>            /(0.5*(DPDE(I,K+1,J0_00)+DPDE(I,K,J0_00)))
933,935c933,935
<         CFL=(PETDT(I+IVW(J),K,J)+PETDT(I+IVE(J),K,J))*DT*VBM2(I,J)      &
<      &     /((DPDE(I+IVW(J),K+1,J0_00)+DPDE(I+IVE(J),K+1,J0_00)         &
<      &       +DPDE(I+IVW(J),K  ,J0_00)+DPDE(I+IVE(J),K  ,J0_00))*0.5)
---
>         CFL=(PETDT(I+IVW(J),K,J)+PETDT(I+IVE(J),K,J))*DT*VBM2(I,J)     &
>            /((DPDE(I+IVW(J),K+1,J0_00)+DPDE(I+IVE(J),K+1,J0_00)        &
>              +DPDE(I+IVW(J),K  ,J0_00)+DPDE(I+IVE(J),K  ,J0_00))*0.5)
944,946c944,946
<         CFL=(PETDT(I,K,J-1)+PETDT(I,K,J+1))*DT*VBM2(I,J)                &
<      &     /((DPDE(I,K+1,J0_M1)+DPDE(I,K+1,J0_P1)                       &
<      &       +DPDE(I,K  ,J0_M1)+DPDE(I,K  ,J0_P1))*0.5)
---
>         CFL=(PETDT(I,K,J-1)+PETDT(I,K,J+1))*DT*VBM2(I,J)               &
>            /((DPDE(I,K+1,J0_M1)+DPDE(I,K+1,J0_P1)                      &
>              +DPDE(I,K  ,J0_M1)+DPDE(I,K  ,J0_P1))*0.5)
998,1002c998,1002
<         VUA=(UDN(I)-U_UP)                                               &
<      &     *(PETDTK(I+IVW(J),0)+PETDTK(I+IVE(J),0))*F4D                   
<         VAD_TEND_U(I,K)=(VUA+VUB(I))                                    &
<      &                 /(DPDE(I+IVW(J),K,J0_00)                         &
<      &                  +DPDE(I+IVE(J),K,J0_00))+U_UP
---
>         VUA=(UDN(I)-U_UP)                                              &
>            *(PETDTK(I+IVW(J),0)+PETDTK(I+IVE(J),0))*F4D                   
>         VAD_TEND_U(I,K)=(VUA+VUB(I))                                   &
>                        /(DPDE(I+IVW(J),K,J0_00)                        &
>                         +DPDE(I+IVE(J),K,J0_00))+U_UP
1008,1011c1008,1011
<         VVA=(VDN(I)-V_UP)                                               &
<      &     *(PETDTK(I,-1)+PETDTK(I,1))*F4D  
<         VAD_TEND_V(I,K)=(VVA+VVB(I))                                    &
<      &                 /(DPDE(I,K,J0_M1)+DPDE(I,K,J0_P1))+V_UP
---
>         VVA=(VDN(I)-V_UP)                                              &
>            *(PETDTK(I,-1)+PETDTK(I,1))*F4D  
>         VAD_TEND_V(I,K)=(VVA+VVB(I))                                   &
>                        /(DPDE(I,K,J0_M1)+DPDE(I,K,J0_P1))+V_UP
1051,1055c1051,1055
<           VUA=(UDN(I)-U_UP)                                             &
<      &       *(PETDTK(I+IVW(J),0)+PETDTK(I+IVE(J),0))*F4D
<           VAD_TEND_U(I,K)=(VUA+VUB(I))                                  &
<      &                   /(DPDE(I+IVW(J),K,J0_00)                       &
<      &                    +DPDE(I+IVE(J),K,J0_00))
---
>           VUA=(UDN(I)-U_UP)                                            &
>              *(PETDTK(I+IVW(J),0)+PETDTK(I+IVE(J),0))*F4D
>           VAD_TEND_U(I,K)=(VUA+VUB(I))                                 &
>                          /(DPDE(I+IVW(J),K,J0_00)                      &
>                           +DPDE(I+IVE(J),K,J0_00))
1061,1064c1061,1064
<           VVA=(VDN(I)-V_UP)                                             &
<      &       *(PETDTK(I,-1)+PETDTK(I,1))*F4D
<           VAD_TEND_V(I,K)=(VVA+VVB(I))                                  &
<      &                   /(DPDE(I,K,J0_M1)+DPDE(I,K,J0_P1))
---
>           VVA=(VDN(I)-V_UP)                                            &
>              *(PETDTK(I,-1)+PETDTK(I,1))*F4D
>           VAD_TEND_V(I,K)=(VVA+VVB(I))                                 &
>                          /(DPDE(I,K,J0_M1)+DPDE(I,K,J0_P1))
1087c1087
<      &                    +2.*VAD_TEND_T(I,K))*0.25
---
>                           +2.*VAD_TEND_T(I,K))*0.25
1107,1108c1107,1108
<             VAD_TNDX_U(K)=(VAD_TEND_U(I,K+1)+VAD_TEND_U(I,K-1)          &
<      &                    +2.*VAD_TEND_U(I,K))*0.25
---
>             VAD_TNDX_U(K)=(VAD_TEND_U(I,K+1)+VAD_TEND_U(I,K-1)         &
>                           +2.*VAD_TEND_U(I,K))*0.25
1126,1127c1126,1127
<             VAD_TNDX_V(K)=(VAD_TEND_V(I,K+1)+VAD_TEND_V(I,K-1)          &
<      &                    +2.*VAD_TEND_V(I,K))*0.25
---
>             VAD_TNDX_V(K)=(VAD_TEND_V(I,K+1)+VAD_TEND_V(I,K-1)         &
>                           +2.*VAD_TEND_V(I,K))*0.25
1150,1153c1150,1153
<         ADU(I,K,J)=(VAD_TEND_U(I,K)+2.*ADU(I,K,J)+VST(I,K,J1_00)*FPP)   &
<      &             *VM
<         ADV(I,K,J)=(VAD_TEND_V(I,K)+2.*ADV(I,K,J)-UST(I,K,J1_00)*FPP)   &
<      &             *VM
---
>         ADU(I,K,J)=(VAD_TEND_U(I,K)+2.*ADU(I,K,J)+VST(I,K,J1_00)*FPP)  &
>                    *VM
>         ADV(I,K,J)=(VAD_TEND_V(I,K)+2.*ADV(I,K,J)-UST(I,K,J1_00)*FPP)  &
>                    *VM
1195,1207c1195,1207
< !***********************************************************************
<       SUBROUTINE VAD2(NTSD,DT,IDTAD,DX,DY                               &
<      &               ,AETA1,AETA2,DETA1,DETA2,PDSL,PDTOP                &
<      &               ,HBM2,LMH                                          &
<      &               ,Q,Q2,CWM,PETDT                                    &
<      &               ,N_IUP_H,N_IUP_V                                   &
<      &               ,N_IUP_ADH,N_IUP_ADV                               &
<      &               ,IUP_H,IUP_V,IUP_ADH,IUP_ADV                       &
<      &               ,IHE,IHW,IVE,IVW,INDX3_WRK                         &
<      &               ,IDS,IDE,JDS,JDE,KDS,KDE                           &
<      &               ,IMS,IME,JMS,JME,KMS,KME                           &
<      &               ,ITS,ITE,JTS,JTE,KTS,KTE)
< !***********************************************************************
---
> !**********************************************************************
>       SUBROUTINE VAD2(NTSD,DT,IDTAD,DX,DY                              &
>                      ,AETA1,AETA2,DETA1,DETA2,PDSL,PDTOP               &
>                      ,HBM2,LMH                                         &
>                      ,Q,Q2,CWM,PETDT                                   &
>                      ,N_IUP_H,N_IUP_V                                  &
>                      ,N_IUP_ADH,N_IUP_ADV                              &
>                      ,IUP_H,IUP_V,IUP_ADH,IUP_ADV                      &
>                      ,IHE,IHW,IVE,IVW,INDX3_WRK                        &
>                      ,IDS,IDE,JDS,JDE,KDS,KDE                          &
>                      ,IMS,IME,JMS,JME,KMS,KME                          &
>                      ,ITS,ITE,JTS,JTE,KTS,KTE)
> !**********************************************************************
1249,1250c1249,1250
<       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                     &
<      &                     ,IMS,IME,JMS,JME,KMS,KME                     &
---
>       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                    &
>                            ,IMS,IME,JMS,JME,KMS,KME                    &
1254,1257c1254,1257
<       INTEGER,DIMENSION(JMS:JME),INTENT(IN) :: N_IUP_H,N_IUP_V          &
<      &                                        ,N_IUP_ADH,N_IUP_ADV
<       INTEGER,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: IUP_H,IUP_V      &
<      &                                                ,IUP_ADH,IUP_ADV
---
>       INTEGER,DIMENSION(JMS:JME),INTENT(IN) :: N_IUP_H,N_IUP_V         &
>                                               ,N_IUP_ADH,N_IUP_ADV
>       INTEGER,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: IUP_H,IUP_V     &
>                                                       ,IUP_ADH,IUP_ADV
1288,1293c1288,1293
<       REAL*8 :: ADDT,AFRP,D2PQE,D2PQQ,D2PQW,DEP,DETAP,DPDN,DPUP,DQP     &
<      &       ,DWP,E00,E4P,EP,EP0,HADDT,HBM2IJ                           &
<      &       ,Q00,Q4P,QP,QP0                                            &
<      &       ,RFACEK,RFACQK,RFACWK,RFC,RR                               &
<      &       ,SUMNE,SUMNQ,SUMNW,SUMPE,SUMPQ,SUMPW                       &
<      &       ,W00,W4P,WP,WP0
---
>       REAL*8 :: ADDT,AFRP,D2PQE,D2PQQ,D2PQW,DEP,DETAP,DPDN,DPUP,DQP    &
>              ,DWP,E00,E4P,EP,EP0,HADDT,HBM2IJ                          &
>              ,Q00,Q4P,QP,QP0                                           &
>              ,RFACEK,RFACQK,RFACWK,RFC,RR                              &
>              ,SUMNE,SUMNQ,SUMNW,SUMPE,SUMPQ,SUMPW                      &
>              ,W00,W4P,WP,WP0
1295,1296c1295,1296
<       REAL,DIMENSION(KTS:KTE) :: AFR,DEL,DQL,DWL,E3,E4,PETDTK           &
<      &                          ,RFACE,RFACQ,RFACW,Q3,Q4,W3,W4
---
>       REAL,DIMENSION(KTS:KTE) :: AFR,DEL,DQL,DWL,E3,E4,PETDTK          &
>                                 ,RFACE,RFACQ,RFACW,Q3,Q4,W3,W4
1357,1358c1357,1358
<             RR=ABS(RR/((AETA1(LLAP)-AETA1(K))*PDTOP                     &
<      &                +(AETA2(LLAP)-AETA2(K))*PDSL(I,J)))
---
>             RR=ABS(RR/((AETA1(LLAP)-AETA1(K))*PDTOP                    &
>                       +(AETA2(LLAP)-AETA2(K))*PDSL(I,J)))
1381,1382c1381,1382
<             RFC=(DETA1(KTE-1)*PDTOP+DETA2(KTE-1)*PDSL(I,J))             &
<      &         /(DETA1(KTE  )*PDTOP+DETA2(KTE  )*PDSL(I,J))
---
>             RFC=(DETA1(KTE-1)*PDTOP+DETA2(KTE-1)*PDSL(I,J))            &
>                /(DETA1(KTE  )*PDTOP+DETA2(KTE  )*PDSL(I,J))
1391,1392c1391,1392
<             RFC=(DETA1(KOFF+2)*PDTOP+DETA2(KOFF+2)*PDSL(I,J))           &
<      &         /(DETA1(KOFF+1)*PDTOP+DETA2(KOFF+1)*PDSL(I,J))
---
>             RFC=(DETA1(KOFF+2)*PDTOP+DETA2(KOFF+2)*PDSL(I,J))          &
>                /(DETA1(KOFF+1)*PDTOP+DETA2(KOFF+1)*PDSL(I,J))
1427,1430c1427,1430
<           DPDN=(AETA1(K+LAP)-AETA1(K))*PDTOP                            &
<      &        +(AETA2(K+LAP)-AETA2(K))*PDSL(I,J)
<           DPUP=(AETA1(K)-AETA1(K-LAP))*PDTOP                            &
<      &        +(AETA2(K)-AETA2(K-LAP))*PDSL(I,J)
---
>           DPDN=(AETA1(K+LAP)-AETA1(K))*PDTOP                           &
>               +(AETA2(K+LAP)-AETA2(K))*PDSL(I,J)
>           DPUP=(AETA1(K)-AETA1(K-LAP))*PDTOP                           &
>               +(AETA2(K)-AETA2(K-LAP))*PDSL(I,J)
1433,1438c1433,1438
<           D2PQQ=((Q4(K+LAP)-Q4P)/DPDN                                   &
<      &          -(Q4P-Q4(K-LAP))/DPUP)*AFRP
<           D2PQW=((W4(K+LAP)-W4P)/DPDN                                   &
<      &          -(W4P-W4(K-LAP))/DPUP)*AFRP
<           D2PQE=((E4(K+LAP)-E4P)/DPDN                                   &
<      &          -(E4P-E4(K-LAP))/DPUP)*AFRP
---
>           D2PQQ=((Q4(K+LAP)-Q4P)/DPDN                                  &
>                 -(Q4P-Q4(K-LAP))/DPUP)*AFRP
>           D2PQW=((W4(K+LAP)-W4P)/DPDN                                  &
>                 -(W4P-W4(K-LAP))/DPUP)*AFRP
>           D2PQE=((E4(K+LAP)-E4P)/DPDN                                  &
>                 -(E4P-E4(K-LAP))/DPUP)*AFRP
1552,1553c1552,1553
<         Q2(I,KTE,J)=MAX(E3(KTE)+E3(KTE)-EPSQ2,EPSQ2)*HBM2IJ             &
<      &             +Q2(I,KTE,J)*(1.-HBM2IJ)
---
>         Q2(I,KTE,J)=MAX(E3(KTE)+E3(KTE)-EPSQ2,EPSQ2)*HBM2IJ            &
>                    +Q2(I,KTE,J)*(1.-HBM2IJ)
1555,1556c1555,1556
<           Q2(I,K,J)=MAX(E3(K)+E3(K)-Q2(I,K+1,J),EPSQ2)*HBM2IJ           &
<      &             +Q2(I,K,J)*(1.-HBM2IJ)
---
>           Q2(I,K,J)=MAX(E3(K)+E3(K)-Q2(I,K+1,J),EPSQ2)*HBM2IJ          &
>                    +Q2(I,K,J)*(1.-HBM2IJ)
1568,1569c1568,1569
< !***********************************************************************
<       SUBROUTINE HAD2(                                                  &
---
> !**********************************************************************
>       SUBROUTINE HAD2(                                                 &
1571c1571
<      &                domdesc ,                                         &
---
>                       domdesc ,                                        &
1573,1584c1573,1584
<      &                NTSD,DT,IDTAD,DX,DY                               &
<      &               ,AETA1,AETA2,DETA1,DETA2,PDSL,PDTOP                &
<      &               ,HTM,HBM2,HBM3,LMH                                 &
<      &               ,Q,Q2,CWM,U,V,Z,HYDRO                              &
<      &               ,N_IUP_H,N_IUP_V                                   &
<      &               ,N_IUP_ADH,N_IUP_ADV                               &
<      &               ,IUP_H,IUP_V,IUP_ADH,IUP_ADV                       &
<      &               ,IHE,IHW,IVE,IVW,INDX3_WRK                         &
<      &               ,IDS,IDE,JDS,JDE,KDS,KDE                           &
<      &               ,IMS,IME,JMS,JME,KMS,KME                           &
<      &               ,ITS,ITE,JTS,JTE,KTS,KTE)
< !***********************************************************************
---
>                       NTSD,DT,IDTAD,DX,DY                              &
>                      ,AETA1,AETA2,DETA1,DETA2,PDSL,PDTOP               &
>                      ,HTM,HBM2,HBM3,LMH                                &
>                      ,Q,Q2,CWM,U,V,Z,HYDRO                             &
>                      ,N_IUP_H,N_IUP_V                                  &
>                      ,N_IUP_ADH,N_IUP_ADV                              &
>                      ,IUP_H,IUP_V,IUP_ADH,IUP_ADV                      &
>                      ,IHE,IHW,IVE,IVW,INDX3_WRK                        &
>                      ,IDS,IDE,JDS,JDE,KDS,KDE                          &
>                      ,IMS,IME,JMS,JME,KMS,KME                          &
>                      ,ITS,ITE,JTS,JTE,KTS,KTE)
> !**********************************************************************
1627,1629c1627,1629
<       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                     &
<      &                     ,IMS,IME,JMS,JME,KMS,KME                     &
<      &                     ,ITS,ITE,JTS,JTE,KTS,KTE
---
>       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                    &
>                            ,IMS,IME,JMS,JME,KMS,KME                    &
>                            ,ITS,ITE,JTS,JTE,KTS,KTE
1632,1635c1632,1635
<       INTEGER,DIMENSION(JMS:JME),INTENT(IN) :: N_IUP_H,N_IUP_V          &
<      &                                        ,N_IUP_ADH,N_IUP_ADV
<       INTEGER,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: IUP_H,IUP_V      &
<      &                                                ,IUP_ADH,IUP_ADV
---
>       INTEGER,DIMENSION(JMS:JME),INTENT(IN) :: N_IUP_H,N_IUP_V         &
>                                               ,N_IUP_ADH,N_IUP_ADV
>       INTEGER,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: IUP_H,IUP_V     &
>                                                       ,IUP_ADH,IUP_ADV
1675,1678c1675,1678
<       INTEGER,DIMENSION(IMS:IME,KMS:KME,JMS:JME) :: IFPA,IFPF           &
<      &                                             ,IFQA,IFQF           &
<      &                                             ,JFPA,JFPF           &
<      &                                             ,JFQA,JFQF
---
>       INTEGER,DIMENSION(IMS:IME,KMS:KME,JMS:JME) :: IFPA,IFPF          &
>                                                    ,IFQA,IFQF          &
>                                                    ,JFPA,JFPF          &
>                                                    ,JFQA,JFQF
1680,1686c1680,1686
<       REAL :: ADDT,AFRP,CRIT,D2PQE,D2PQQ,D2PQW,DEP,DESTIJ,DQP,DQSTIJ    &
<      &       ,DVOLP,DWP,DWSTIJ,DZA,DZB,E00,E0Q,E1X,E2IJ,E4P,ENH,EP,EP0  &
<      &       ,ESTIJ,FPQ,HAFP,HAFQ,HBM2IJ,HM,HTMIKJ,PP,PPQ00,Q00,Q0Q     &
<      &       ,Q1IJ,Q4P,QP,QP0,QSTIJ,RDY,RFACEK,RFACQK,RFACWK,RFC        &
<      &       ,RFEIJ,RFQIJ,RFWIJ,RR,SLOPAC,SPP,SQP,SSA,SSB,SUMNE,SUMNQ   &
<      &       ,SUMNW,SUMPE,SUMPQ,SUMPW,TTA,TTB,W00,W0Q,W1IJ,W4P,WP,WP0   &
<      &       ,WSTIJ
---
>       REAL :: ADDT,AFRP,CRIT,D2PQE,D2PQQ,D2PQW,DEP,DESTIJ,DQP,DQSTIJ   &
>              ,DVOLP,DWP,DWSTIJ,DZA,DZB,E00,E0Q,E1X,E2IJ,E4P,ENH,EP,EP0 &
>              ,ESTIJ,FPQ,HAFP,HAFQ,HBM2IJ,HM,HTMIKJ,PP,PPQ00,Q00,Q0Q    &
>              ,Q1IJ,Q4P,QP,QP0,QSTIJ,RDY,RFACEK,RFACQK,RFACWK,RFC       &
>              ,RFEIJ,RFQIJ,RFWIJ,RR,SLOPAC,SPP,SQP,SSA,SSB,SUMNE,SUMNQ  &
>              ,SUMNW,SUMPE,SUMPQ,SUMPW,TTA,TTB,W00,W0Q,W1IJ,W4P,WP,WP0  &
>              ,WSTIJ
1690,1691c1690,1691
<       REAL,DIMENSION(KTS:KTE) :: AFR,DEL,DQL,DWL,E3,E4                  &
<      &                          ,RFACE,RFACQ,RFACW,Q3,Q4,W3,W4
---
>       REAL,DIMENSION(KTS:KTE) :: AFR,DEL,DQL,DWL,E3,E4                 &
>                                 ,RFACE,RFACQ,RFACW,Q3,Q4,W3,W4
1695,1697c1695,1697
<       REAL,DIMENSION(ITS-5:ITE+5,KTS:KTE,JTS-5:JTE+5) :: AFP,AFQ,DEST   &
<      &                                                  ,DQST,DVOL,DWST &
<      &                                                  ,E1,E2,Q1,W1
---
>       REAL,DIMENSION(ITS-5:ITE+5,KTS:KTE,JTS-5:JTE+5) :: AFP,AFQ,DEST,DQST     &
>                                                 ,DVOL,DWST,E1,E2       &
>                                                 ,Q1,W1
1769,1772c1769,1772
<         TTA=(U(I,K,J-1)+U(I+IHW(J),K,J)+U(I+IHE(J),K,J)+U(I,K,J+1))     &
<      &      *EMH(I,J)*HBM2(I,J)
<         TTB=(V(I,K,J-1)+V(I+IHW(J),K,J)+V(I+IHE(J),K,J)+V(I,K,J+1))     &
<      &      *ENH*HBM2(I,J)
---
>         TTA=(U(I,K,J-1)+U(I+IHW(J),K,J)+U(I+IHE(J),K,J)+U(I,K,J+1))    &
>             *EMH(I,J)*HBM2(I,J)
>         TTB=(V(I,K,J-1)+V(I+IHW(J),K,J)+V(I+IHE(J),K,J)+V(I,K,J+1))    &
>             *ENH*HBM2(I,J)
1824c1824
<      &             *HTM(I+1,K,J)*HTM(I,K,J+2)*0.25
---
>                    *HTM(I+1,K,J)*HTM(I,K,J+2)*0.25
1831,1835c1831,1835
<         Q1(I,K,J)=(Q  (IFPA(I,K,J),K,JFPA(I,K,J))-Q  (I,K,J))*PP        &
<      &           +(Q  (IFQA(I,K,J),K,JFQA(I,K,J))-Q  (I,K,J))*QP        &
<      &           +(Q  (I,K,J-2)+Q  (I,K,J+2)                            &
<      &            -Q  (I-1,K,J)-Q  (I+1,K,J))*FPQ                       &
<      &           +Q(I,K,J)
---
>         Q1(I,K,J)=(Q  (IFPA(I,K,J),K,JFPA(I,K,J))-Q  (I,K,J))*PP       &
>                  +(Q  (IFQA(I,K,J),K,JFQA(I,K,J))-Q  (I,K,J))*QP       &
>                  +(Q  (I,K,J-2)+Q  (I,K,J+2)                           &
>                   -Q  (I-1,K,J)-Q  (I+1,K,J))*FPQ                      &
>                  +Q(I,K,J)
1837,1841c1837,1841
<         W1(I,K,J)=(CWM(IFPA(I,K,J),K,JFPA(I,K,J))-CWM(I,K,J))*PP        &
<      &           +(CWM(IFQA(I,K,J),K,JFQA(I,K,J))-CWM(I,K,J))*QP        &
<      &           +(CWM(I,K,J-2)+CWM(I,K,J+2)                            &
<      &            -CWM(I-1,K,J)-CWM(I+1,K,J))*FPQ                       &
<      &           +CWM(I,K,J)
---
>         W1(I,K,J)=(CWM(IFPA(I,K,J),K,JFPA(I,K,J))-CWM(I,K,J))*PP       &
>                  +(CWM(IFQA(I,K,J),K,JFQA(I,K,J))-CWM(I,K,J))*QP       &
>                  +(CWM(I,K,J-2)+CWM(I,K,J+2)                           &
>                   -CWM(I-1,K,J)-CWM(I+1,K,J))*FPQ                      &
>                  +CWM(I,K,J)
1843,1847c1843,1847
<         E2(I,K,J)=(E1 (IFPA(I,K,J),K,JFPA(I,K,J))-E1 (I,K,J))*PP        &
<      &           +(E1 (IFQA(I,K,J),K,JFQA(I,K,J))-E1 (I,K,J))*QP        &
<      &           +(E1 (I,K,J-2)+E1 (I,K,J+2)                            &
<      &            -E1 (I-1,K,J)-E1 (I+1,K,J))*FPQ                       &
<      &           +E1(I,K,J)
---
>         E2(I,K,J)=(E1 (IFPA(I,K,J),K,JFPA(I,K,J))-E1 (I,K,J))*PP       &
>                  +(E1 (IFQA(I,K,J),K,JFQA(I,K,J))-E1 (I,K,J))*QP       &
>                  +(E1 (I,K,J-2)+E1 (I,K,J+2)                           &
>                   -E1 (I-1,K,J)-E1 (I+1,K,J))*FPQ                      &
>                  +E1(I,K,J)
1884,1889c1884,1889
<       D2PQQ=(Q1(IFPA(I,K,J),K,JFPA(I,K,J))-Q1IJ                         &
<      &      -Q1IJ+Q1(IFPF(I,K,J),K,JFPF(I,K,J)))                        &
<      &      *HAFP                                                       &
<      &     +(Q1(IFQA(I,K,J),K,JFQA(I,K,J))-Q1IJ                         &
<      &      -Q1IJ+Q1(IFQF(I,K,J),K,JFQF(I,K,J)))                        &
<      &      *HAFQ
---
>       D2PQQ=(Q1(IFPA(I,K,J),K,JFPA(I,K,J))-Q1IJ                        &
>             -Q1IJ+Q1(IFPF(I,K,J),K,JFPF(I,K,J)))                       &
>             *HAFP                                                      &
>            +(Q1(IFQA(I,K,J),K,JFQA(I,K,J))-Q1IJ                        &
>             -Q1IJ+Q1(IFQF(I,K,J),K,JFQF(I,K,J)))                       &
>             *HAFQ
1891,1896c1891,1896
<       D2PQW=(W1(IFPA(I,K,J),K,JFPA(I,K,J))-W1IJ                         &
<      &      -W1IJ+W1(IFPF(I,K,J),K,JFPF(I,K,J)))                        &
<      &      *HAFP                                                       &
<      &     +(W1(IFQA(I,K,J),K,JFQA(I,K,J))-W1IJ                         &
<      &      -W1IJ+W1(IFQF(I,K,J),K,JFQF(I,K,J)))                        &
<      &      *HAFQ
---
>       D2PQW=(W1(IFPA(I,K,J),K,JFPA(I,K,J))-W1IJ                        &
>             -W1IJ+W1(IFPF(I,K,J),K,JFPF(I,K,J)))                       &
>             *HAFP                                                      &
>            +(W1(IFQA(I,K,J),K,JFQA(I,K,J))-W1IJ                        &
>             -W1IJ+W1(IFQF(I,K,J),K,JFQF(I,K,J)))                       &
>             *HAFQ
1898,1903c1898,1903
<       D2PQE=(E2(IFPA(I,K,J),K,JFPA(I,K,J))-E2IJ                         &
<      &      -E2IJ+E2(IFPF(I,K,J),K,JFPF(I,K,J)))                        &
<      &      *HAFP                                                       &
<      &     +(E2(IFQA(I,K,J),K,JFQA(I,K,J))-E2IJ                         &
<      &      -E2IJ+E2(IFQF(I,K,J),K,JFQF(I,K,J)))                        &
<      &      *HAFQ
---
>       D2PQE=(E2(IFPA(I,K,J),K,JFPA(I,K,J))-E2IJ                        &
>             -E2IJ+E2(IFPF(I,K,J),K,JFPF(I,K,J)))                       &
>             *HAFP                                                      &
>            +(E2(IFQA(I,K,J),K,JFQA(I,K,J))-E2IJ                        &
>             -E2IJ+E2(IFQF(I,K,J),K,JFQF(I,K,J)))                       &
>             *HAFQ
1983,1989c1983,1989
<       DO II=1,6
<         CALL WRF_PATCH_TO_GLOBAL_REAL( XSUMS_L(IMS,KMS,JMS,II),         &
<      &                                 XSUMS_G(1,1,1,ii), domdesc,      & 
<      &                                'xyz','xzy',                      &
<      &                                 IDS,IDE,KDS,KDE,JDS,JDE,         &    
<      &                                 IMS,IME,KMS,KME,JMS,JME,         &
<      &                                 ITS,ITE,KTS,KTE,JTS,JTE )
---
>       DO II = 1,6
>         CALL WRF_PATCH_TO_GLOBAL_REAL( XSUMS_L(IMS,KMS,JMS,II),        &
>                                        XSUMS_G(1,1,1,ii), domdesc,     & 
>                                       'xyz','xzy',                     &
>                                        IDS,IDE,KDS,KDE,JDS,JDE,        &    
>                                        IMS,IME,KMS,KME,JMS,JME,        &
>                                        ITS,ITE,KTS,KTE,JTS,JTE )
1992c1992
<       GSUMS=0.
---
>       GSUMS = 0.
1994,2002c1994,1999
<       IF(WRF_DM_ON_MONITOR())THEN
<         DO II=1,6
<           DO J =JDS,JDE
<           DO K =KDS,KDE
<           DO I =IDS,IDE
<             GSUMS(II,K)=GSUMS(II,K)+XSUMS_G(I,K,J,II)
<           ENDDO
<           ENDDO
<           ENDDO
---
>       IF ( WRF_DM_ON_MONITOR() ) THEN
>         DO II = 1,6
>         DO J = JDS,JDE
>         DO K = KDS,KDE
>         DO I = IDS,IDE
>           GSUMS(II,K) = GSUMS(II,K) + xsums_g(I,K,J,II)
2003a2001,2003
>         ENDDO
>         ENDDO
>         ENDDO
2006c2006
<       CALL WRF_DM_BCAST_BYTES(GSUMS,2*RWORDSIZE*6*(KDE-KDS+1) )
---
>       CALL WRF_DM_BCAST_BYTES( GSUMS, 2*RWORDSIZE*6*(KDE-KDS+1) )
2017,2019c2017,2019
<       CALL MPI_ALLREDUCE(XSUMS,GSUMS,6*(KTE-KTS+1)                      &
<      &                  ,MPI_DOUBLE_PRECISION,MPI_SUM                   &
<      &                  ,MPI_COMM_COMP,IRECV)
---
>       CALL MPI_ALLREDUCE(XSUMS,GSUMS,6*(KTE-KTS+1)                     &
>                         ,MPI_DOUBLE_PRECISION,MPI_SUM                  &
>                         ,MPI_COMM_COMP,IRECV)
2021c2021
<       GSUMS=XSUMS
---
>       GSUMS = XSUMS
2081c2081
< !     if(mype.eq.0.and.ntsd.eq.181)close(nunit)
---
>       if(mype.eq.0.and.ntsd.eq.181)close(nunit)
2160,2161c2160,2161
<         Q2(I,KTE,J)=MAX(E1(I,KTE,J)+E1(I,KTE,J)-EPSQ2,EPSQ2)            &
<      &             *HTM(I,KTE,J)
---
>         Q2(I,KTE,J)=MAX(E1(I,KTE,J)+E1(I,KTE,J)-EPSQ2,EPSQ2)           &
>                    *HTM(I,KTE,J)
2170,2171c2170,2171
<           Q2(I,K,J)=MAX(E1(I,K,J)+E1(I,K,J)-Q2(I,K+1,J),EPSQ2)          &
<      &             *HTM(I,K,J)
---
>           Q2(I,K,J)=MAX(E1(I,K,J)+E1(I,K,J)-Q2(I,K+1,J),EPSQ2)         &
>                    *HTM(I,K,J)
2181,2193c2181,2193
< !***********************************************************************
<       SUBROUTINE VAD2_DRY(NTSD,DT,IDTAD,DX,DY                           &
<      &                   ,AETA1,AETA2,DETA1,DETA2,PDSL,PDTOP            &
<      &                   ,HBM2,LMH                                      &
<      &                   ,Q2,PETDT                                      &
<      &                   ,N_IUP_H,N_IUP_V                               &
<      &                   ,N_IUP_ADH,N_IUP_ADV                           &
<      &                   ,IUP_H,IUP_V,IUP_ADH,IUP_ADV                   &
<      &                   ,IHE,IHW,IVE,IVW,INDX3_WRK                     &
<      &                   ,IDS,IDE,JDS,JDE,KDS,KDE                       &
<      &                   ,IMS,IME,JMS,JME,KMS,KME                       &
<      &                   ,ITS,ITE,JTS,JTE,KTS,KTE)
< !***********************************************************************
---
> !**********************************************************************
>       SUBROUTINE VAD2_DRY(NTSD,DT,IDTAD,DX,DY                          &
>                          ,AETA1,AETA2,DETA1,DETA2,PDSL,PDTOP           &
>                          ,HBM2,LMH                                     &
>                          ,Q2,PETDT                                     &
>                          ,N_IUP_H,N_IUP_V                              &
>                          ,N_IUP_ADH,N_IUP_ADV                          &
>                          ,IUP_H,IUP_V,IUP_ADH,IUP_ADV                  &
>                          ,IHE,IHW,IVE,IVW,INDX3_WRK                    &
>                          ,IDS,IDE,JDS,JDE,KDS,KDE                      &
>                          ,IMS,IME,JMS,JME,KMS,KME                      &
>                          ,ITS,ITE,JTS,JTE,KTS,KTE)
> !**********************************************************************
2235,2237c2235,2237
<       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                     &
<      &                     ,IMS,IME,JMS,JME,KMS,KME                     &
<      &                     ,ITS,ITE,JTS,JTE,KTS,KTE
---
>       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                    &
>                            ,IMS,IME,JMS,JME,KMS,KME                    &
>                            ,ITS,ITE,JTS,JTE,KTS,KTE
2240,2243c2240,2243
<       INTEGER,DIMENSION(JMS:JME),INTENT(IN) :: N_IUP_H,N_IUP_V          &
<      &                                        ,N_IUP_ADH,N_IUP_ADV
<       INTEGER,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: IUP_H,IUP_V      &
<      &                                                ,IUP_ADH,IUP_ADV
---
>       INTEGER,DIMENSION(JMS:JME),INTENT(IN) :: N_IUP_H,N_IUP_V         &
>                                               ,N_IUP_ADH,N_IUP_ADV
>       INTEGER,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: IUP_H,IUP_V     &
>                                                       ,IUP_ADH,IUP_ADV
2274,2276c2274,2276
<       REAL :: ADDT,AFRP,D2PQE,DEP,DETAP,DPDN,DPUP,DQP                   &
<      &       ,DWP,E00,E4P,EP,EP0,HADDT,HBM2IJ                           &
<      &       ,RFACEK,RFC,RR,SUMNE,SUMPE
---
>       REAL :: ADDT,AFRP,D2PQE,DEP,DETAP,DPDN,DPUP,DQP                  &
>              ,DWP,E00,E4P,EP,EP0,HADDT,HBM2IJ                          &
>              ,RFACEK,RFC,RR,SUMNE,SUMPE
2336,2337c2336,2337
<             RR=ABS(RR/((AETA1(LLAP)-AETA1(K))*PDTOP                     &
<      &                +(AETA2(LLAP)-AETA2(K))*PDSL(I,J)))
---
>             RR=ABS(RR/((AETA1(LLAP)-AETA1(K))*PDTOP                    &
>                       +(AETA2(LLAP)-AETA2(K))*PDSL(I,J)))
2354,2355c2354,2355
<             RFC=(DETA1(KTE-1)*PDTOP+DETA2(KTE-1)*PDSL(I,J))             &
<      &         /(DETA1(KTE  )*PDTOP+DETA2(KTE  )*PDSL(I,J))
---
>             RFC=(DETA1(KTE-1)*PDTOP+DETA2(KTE-1)*PDSL(I,J))            &
>                /(DETA1(KTE  )*PDTOP+DETA2(KTE  )*PDSL(I,J))
2362,2363c2362,2363
<             RFC=(DETA1(KOFF+2)*PDTOP+DETA2(KOFF+2)*PDSL(I,J))           &
<      &         /(DETA1(KOFF+1)*PDTOP+DETA2(KOFF+1)*PDSL(I,J))
---
>             RFC=(DETA1(KOFF+2)*PDTOP+DETA2(KOFF+2)*PDSL(I,J))          &
>                /(DETA1(KOFF+1)*PDTOP+DETA2(KOFF+1)*PDSL(I,J))
2388,2391c2388,2391
<           DPDN=(AETA1(K+LAP)-AETA1(K))*PDTOP                            &
<      &        +(AETA2(K+LAP)-AETA2(K))*PDSL(I,J)
<           DPUP=(AETA1(K)-AETA1(K-LAP))*PDTOP                            &
<      &        +(AETA2(K)-AETA2(K-LAP))*PDSL(I,J)
---
>           DPDN=(AETA1(K+LAP)-AETA1(K))*PDTOP                           &
>               +(AETA2(K+LAP)-AETA2(K))*PDSL(I,J)
>           DPUP=(AETA1(K)-AETA1(K-LAP))*PDTOP                           &
>               +(AETA2(K)-AETA2(K-LAP))*PDSL(I,J)
2394,2395c2394,2395
<           D2PQE=((E4(K+LAP)-E4P)/DPDN                                   &
<      &          -(E4P-E4(K-LAP))/DPUP)*AFRP
---
>           D2PQE=((E4(K+LAP)-E4P)/DPDN                                  &
>                 -(E4P-E4(K-LAP))/DPUP)*AFRP
2447,2448c2447,2448
<         Q2(I,KTE,J)=MAX(E3(KTE)+E3(KTE)-EPSQ2,EPSQ2)*HBM2IJ             &
<      &             +Q2(I,KTE,J)*(1.-HBM2IJ)
---
>         Q2(I,KTE,J)=MAX(E3(KTE)+E3(KTE)-EPSQ2,EPSQ2)*HBM2IJ            &
>                    +Q2(I,KTE,J)*(1.-HBM2IJ)
2450,2451c2450,2451
<           Q2(I,K,J)=MAX(E3(K)+E3(K)-Q2(I,K+1,J),EPSQ2)*HBM2IJ           &
<      &             +Q2(I,K,J)*(1.-HBM2IJ)
---
>           Q2(I,K,J)=MAX(E3(K)+E3(K)-Q2(I,K+1,J),EPSQ2)*HBM2IJ          &
>                    +Q2(I,K,J)*(1.-HBM2IJ)
2463,2475c2463,2475
< !***********************************************************************
<       SUBROUTINE HAD2_DRY(NTSD,DT,IDTAD,DX,DY                           &
<      &                   ,AETA1,AETA2,DETA1,DETA2,PDSL,PDTOP            &
<      &                   ,HTM,HBM2,HBM3,LMH                             &
<      &                   ,Q2,U,V,Z,HYDRO                                &
<      &                   ,N_IUP_H,N_IUP_V                               &
<      &                   ,N_IUP_ADH,N_IUP_ADV                           &
<      &                   ,IUP_H,IUP_V,IUP_ADH,IUP_ADV                   &
<      &                   ,IHE,IHW,IVE,IVW,INDX3_WRK                     &
<      &                   ,IDS,IDE,JDS,JDE,KDS,KDE                       &
<      &                   ,IMS,IME,JMS,JME,KMS,KME                       &
<      &                   ,ITS,ITE,JTS,JTE,KTS,KTE)
< !***********************************************************************
---
> !**********************************************************************
>       SUBROUTINE HAD2_DRY(NTSD,DT,IDTAD,DX,DY                          &
>                          ,AETA1,AETA2,DETA1,DETA2,PDSL,PDTOP           &
>                          ,HTM,HBM2,HBM3,LMH                            &
>                          ,Q2,U,V,Z,HYDRO                               &
>                          ,N_IUP_H,N_IUP_V                              &
>                          ,N_IUP_ADH,N_IUP_ADV                          &
>                          ,IUP_H,IUP_V,IUP_ADH,IUP_ADV                  &
>                          ,IHE,IHW,IVE,IVW,INDX3_WRK                    &
>                          ,IDS,IDE,JDS,JDE,KDS,KDE                      &
>                          ,IMS,IME,JMS,JME,KMS,KME                      &
>                          ,ITS,ITE,JTS,JTE,KTS,KTE)
> !**********************************************************************
2518,2520c2518,2520
<       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                     &
<      &                     ,IMS,IME,JMS,JME,KMS,KME                     &
<      &                     ,ITS,ITE,JTS,JTE,KTS,KTE
---
>       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                    &
>                            ,IMS,IME,JMS,JME,KMS,KME                    &
>                            ,ITS,ITE,JTS,JTE,KTS,KTE
2523,2526c2523,2526
<       INTEGER,DIMENSION(JMS:JME),INTENT(IN) :: N_IUP_H,N_IUP_V          &
<      &                                        ,N_IUP_ADH,N_IUP_ADV
<       INTEGER,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: IUP_H,IUP_V      &
<      &                                                ,IUP_ADH,IUP_ADV
---
>       INTEGER,DIMENSION(JMS:JME),INTENT(IN) :: N_IUP_H,N_IUP_V         &
>                                               ,N_IUP_ADH,N_IUP_ADV
>       INTEGER,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: IUP_H,IUP_V     &
>                                                       ,IUP_ADH,IUP_ADV
2557,2560c2557,2560
<       INTEGER,DIMENSION(IMS:IME,KMS:KME,JMS:JME) :: IFPA,IFPF           &
<      &                                             ,IFQA,IFQF           &
<      &                                             ,JFPA,JFPF           &
<      &                                             ,JFQA,JFQF
---
>       INTEGER,DIMENSION(IMS:IME,KMS:KME,JMS:JME) :: IFPA,IFPF          &
>                                                    ,IFQA,IFQF          &
>                                                    ,JFPA,JFPF          &
>                                                    ,JFQA,JFQF
2562,2566c2562,2566
<       REAL :: ADDT,AFRP,CRIT,D2PQE,DEP,DESTIJ,DVOLP,DZA,DZB             &
<      &       ,E00,E0Q,E2IJ,E4P,ENH,EP,EP0,ESTIJ,FPQ                     &
<      &       ,HAFP,HAFQ,HBM2IJ,HM,HTMIKJ,PP,PPQ00                       &
<      &       ,QP,RDY,RFACEK,RFC,RFEIJ,RR                                &
<      &       ,SLOPAC,SPP,SQP,SSA,SSB,SUMNE,SUMPE,TTA,TTB
---
>       REAL :: ADDT,AFRP,CRIT,D2PQE,DEP,DESTIJ,DVOLP,DZA,DZB            &
>              ,E00,E0Q,E2IJ,E4P,ENH,EP,EP0,ESTIJ,FPQ                    &
>              ,HAFP,HAFQ,HBM2IJ,HM,HTMIKJ,PP,PPQ00                      &
>              ,QP,RDY,RFACEK,RFC,RFEIJ,RR                               &
>              ,SLOPAC,SPP,SQP,SSA,SSB,SUMNE,SUMPE,TTA,TTB
2574,2575c2574,2575
<       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME) :: AFP,AFQ,DEST,DVOL      &
<      &                                          ,E1,E2  
---
>       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME) :: AFP,AFQ,DEST,DVOL     &
>                                                 ,E1,E2  
2639,2642c2639,2642
<         TTA=(U(I,K,J-1)+U(I+IHW(J),K,J)+U(I+IHE(J),K,J)+U(I,K,J+1))     &
<      &      *EMH(I,J)*HBM2(I,J)
<         TTB=(V(I,K,J-1)+V(I+IHW(J),K,J)+V(I+IHE(J),K,J)+V(I,K,J+1))     &
<      &      *ENH*HBM2(I,J)
---
>         TTA=(U(I,K,J-1)+U(I+IHW(J),K,J)+U(I+IHE(J),K,J)+U(I,K,J+1))    &
>             *EMH(I,J)*HBM2(I,J)
>         TTB=(V(I,K,J-1)+V(I+IHW(J),K,J)+V(I+IHE(J),K,J)+V(I,K,J+1))    &
>             *ENH*HBM2(I,J)
2693,2694c2693,2694
<         FPQ=SPP*SQP*HTM(I,K,J-2)*HTM(I-1,K,J)                           &
<      &             *HTM(I+1,K,J)*HTM(I,K,J+2)*0.25
---
>         FPQ=SPP*SQP*HTM(I,K,J-2)*HTM(I-1,K,J)                &
>                    *HTM(I+1,K,J)*HTM(I,K,J+2)*0.25
2701,2705c2701,2705
<         E2(I,K,J)=(E1 (IFPA(I,K,J),K,JFPA(I,K,J))-E1 (I,K,J))*PP        &
<      &           +(E1 (IFQA(I,K,J),K,JFQA(I,K,J))-E1 (I,K,J))*QP        &
<      &           +(E1 (I,K,J-2)+E1 (I,K,J+2)                            &
<      &            -E1 (I-1,K,J)-E1 (I+1,K,J))*FPQ                       &
<      &           +E1(I,K,J)
---
>         E2(I,K,J)=(E1 (IFPA(I,K,J),K,JFPA(I,K,J))-E1 (I,K,J))*PP       &
>                  +(E1 (IFQA(I,K,J),K,JFQA(I,K,J))-E1 (I,K,J))*QP       &
>                  +(E1 (I,K,J-2)+E1 (I,K,J+2)                           &
>                   -E1 (I-1,K,J)-E1 (I+1,K,J))*FPQ                      &
>                  +E1(I,K,J)
2732,2737c2732,2737
<       D2PQE=(E2(IFPA(I,K,J),K,JFPA(I,K,J))-E2IJ                         &
<      &      -E2IJ+E2(IFPF(I,K,J),K,JFPF(I,K,J)))                        &
<      &      *HAFP                                                       &
<      &     +(E2(IFQA(I,K,J),K,JFQA(I,K,J))-E2IJ                         &
<      &      -E2IJ+E2(IFQF(I,K,J),K,JFQF(I,K,J)))                        &
<      &      *HAFQ
---
>       D2PQE=(E2(IFPA(I,K,J),K,JFPA(I,K,J))-E2IJ                        &
>             -E2IJ+E2(IFPF(I,K,J),K,JFPF(I,K,J)))                       &
>             *HAFP                                                      &
>            +(E2(IFQA(I,K,J),K,JFQA(I,K,J))-E2IJ                        &
>             -E2IJ+E2(IFQF(I,K,J),K,JFQF(I,K,J)))                       &
>             *HAFQ
2767,2769c2767,2769
<       CALL WRF_GET_DM_COMMUNICATOR ( MPI_COMM_COMP )
<       CALL MPI_ALLREDUCE(XSUMS,GSUMS,2*(KTE-KTS+1),MPI_REAL,MPI_SUM     &
<      &                  ,MPI_COMM_COMP,IRECV)
---
>       CALL wrf_get_dm_communicator ( mpi_comm_comp )
>       CALL MPI_ALLREDUCE(XSUMS,GSUMS,2*(KTE-KTS+1),MPI_REAL,MPI_SUM    &
>                         ,MPI_COMM_COMP,IRECV)
2771c2771
<       GSUMS=XSUMS
---
>       GSUMS = XSUMS
2826,2827c2826,2827
<         Q2(I,KTE,J)=MAX(E1(I,KTE,J)+E1(I,KTE,J)-EPSQ2,EPSQ2)            &
<      &             *HTM(I,KTE,J)
---
>         Q2(I,KTE,J)=MAX(E1(I,KTE,J)+E1(I,KTE,J)-EPSQ2,EPSQ2)           &
>                    *HTM(I,KTE,J)
2836,2837c2836,2837
<           Q2(I,K,J)=MAX(E1(I,K,J)+E1(I,K,J)-Q2(I,K+1,J),EPSQ2)          &
<      &             *HTM(I,K,J)
---
>           Q2(I,K,J)=MAX(E1(I,K,J)+E1(I,K,J)-Q2(I,K+1,J),EPSQ2)         &
>                    *HTM(I,K,J)
DONE module_ADVECTION.F
COMPARE module_BC_NMM.F
DONE module_BC_NMM.F
COMPARE module_BNDRY_COND.F
DONE module_BNDRY_COND.F
COMPARE module_CLDWTR.F
DONE module_CLDWTR.F
COMPARE module_CTLBLK.F
DONE module_CTLBLK.F
COMPARE module_DIFFUSION_NMM.F
20,28c20,28
< !***********************************************************************
<       SUBROUTINE HDIFF(NTSD,DT,FIS,DY,HDAC,HDACV                        &
<      &                ,HTM,HBM2,VTM,DETA1,SIGMA                         &
<      &                ,T,Q,U,V,Q2,Z                                     &
<      &                ,IHE,IHW,IVE,IVW,INDX3_WRK                        &
<      &                ,IDS,IDE,JDS,JDE,KDS,KDE                          &
<      &                ,IMS,IME,JMS,JME,KMS,KME                          &
<      &                ,ITS,ITE,JTS,JTE,KTS,KTE)
< !***********************************************************************
---
> !**********************************************************************
>       SUBROUTINE HDIFF(NTSD,DT,FIS,DY,HDAC,HDACV                       &
>                       ,HTM,HBM2,VTM,DETA1,SIGMA                        &
>                       ,T,Q,U,V,Q2,Z                                    &
>                       ,IHE,IHW,IVE,IVW,INDX3_WRK                       &
>                       ,IDS,IDE,JDS,JDE,KDS,KDE                         &
>                       ,IMS,IME,JMS,JME,KMS,KME                         &
>                       ,ITS,ITE,JTS,JTE,KTS,KTE)
> !**********************************************************************
79,81c79,81
<       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                     &
<      &                     ,IMS,IME,JMS,JME,KMS,KME                     &
<      &                     ,ITS,ITE,JTS,JTE,KTS,KTE
---
>       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                    &
>                            ,IMS,IME,JMS,JME,KMS,KME                    &
>                            ,ITS,ITE,JTS,JTE,KTS,KTE
89,90c89,90
<       REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: FIS,HBM2            &
<      &                                             ,HDAC,HDACV
---
>       REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: FIS,HBM2           &
>                                                    ,HDAC,HDACV
94,95c94,95
<       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(INOUT) :: T,Q,Q2   &
<      &                                                        ,U,V
---
>       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(INOUT) :: T,Q,Q2  &
>                                                               ,U,V
110,111c110,111
<       INTEGER :: I,J,J1_P1,J1_P2,J2_00,J2_M1,J2_P1,J3_00,J3_P1,J3_P2    &
<      &          ,J4_00,J4_M1,J4_M2,J4_P1,J4_P2,JJ,JKNT,JSTART,K,KS
---
>       INTEGER :: I,J,J1_P1,J1_P2,J2_00,J2_M1,J2_P1,J3_00,J3_P1,J3_P2   &
>                 ,J4_00,J4_M1,J4_M2,J4_P1,J4_P2,JJ,JKNT,JSTART,K,KS
113,114c113,114
<       REAL :: DEF_J,DEFSK,DEFTK,HKNE_J,HKSE_J,Q2L,RDY,SLOP,SLOPHC       &
<      &       ,UTK,VKNE_J,VKSE_J,VTK
---
>       REAL :: DEF_J,DEFSK,DEFTK,HKNE_J,HKSE_J,Q2L,RDY,SLOP,SLOPHC      &
>              ,UTK,VKNE_J,VKSE_J,VTK
124,125c124,125
<       REAL,DIMENSION(ITS-5:ITE+5,KTS:KTE,-2:1) :: HKNE,QNE,Q2NE,TNE     &
<      &                                           ,UNE,VKNE,VNE
---
>       REAL,DIMENSION(ITS-5:ITE+5,KTS:KTE,-2:1) :: HKNE,QNE,Q2NE,TNE    &
>                                                  ,UNE,VKNE,VNE
129,130c129,130
<       REAL,DIMENSION(ITS-5:ITE+5,KTS:KTE,-1:2) :: HKSE,QSE,Q2SE,TSE     &
<      &                                           ,USE,VKSE,VSE
---
>       REAL,DIMENSION(ITS-5:ITE+5,KTS:KTE,-1:2) :: HKSE,QSE,Q2SE,TSE    &
>                                                  ,USE,VKSE,VSE
134,135c134,135
<       REAL,DIMENSION(ITS-5:ITE+5,KTS:KTE,-1:1) :: CKE,QDIF,Q2DIF        &
<      &                                           ,TDIF,UDIF,VDIF
---
>       REAL,DIMENSION(ITS-5:ITE+5,KTS:KTE,-1:1) :: CKE,QDIF,Q2DIF       &
>                                                  ,TDIF,UDIF,VDIF
192,195c192,195
<           DEFTK=U(I+IHE(JJ),K,JJ)-U(I+IHW(JJ),K,JJ)                     &
<      &         -V(I,K,JJ+1)+V(I,K,JJ-1)
<           DEFSK=U(I,K,JJ+1)-U(I,K,JJ-1)                                 &
<      &         +V(I+IHE(JJ),K,JJ)-V(I+IHW(JJ),K,JJ)
---
>           DEFTK=U(I+IHE(JJ),K,JJ)-U(I+IHW(JJ),K,JJ)                    &
>                -V(I,K,JJ+1)+V(I,K,JJ-1)
>           DEFSK=U(I,K,JJ+1)-U(I,K,JJ-1)                                &
>                +V(I+IHE(JJ),K,JJ)-V(I+IHW(JJ),K,JJ)
241,242c241,242
<           HKNE_J=(DEF(I,K,J)+DEF(I+IHE(JJ),K,J+1))                      &
<      &           *HTM(I,K,JJ)*HTM(I+IHE(JJ),K,JJ+1)*SNE(I,K)
---
>           HKNE_J=(DEF(I,K,J)+DEF(I+IHE(JJ),K,J+1))                     &
>                  *HTM(I,K,JJ)*HTM(I+IHE(JJ),K,JJ+1)*SNE(I,K)
248,249c248,249
<           VKNE_J=(DEF(I+IVE(JJ),K,J)+DEF(I,K,J+1))                      &
<      &           *VTM(I,K,JJ)*VTM(I+IVE(JJ),K,JJ+1)
---
>           VKNE_J=(DEF(I+IVE(JJ),K,J)+DEF(I,K,J+1))                     &
>                  *VTM(I,K,JJ)*VTM(I+IVE(JJ),K,JJ+1)
291,292c291,292
<           HKSE_J=(DEF(I+IHE(JJ),K,J-1)+DEF(I,K,J))                      &
<      &           *HTM(I+IHE(JJ),K,JJ-1)*HTM(I,K,JJ)*SSE(I,K)
---
>           HKSE_J=(DEF(I+IHE(JJ),K,J-1)+DEF(I,K,J))                     &
>                  *HTM(I+IHE(JJ),K,JJ-1)*HTM(I,K,JJ)*SSE(I,K)
298,299c298,299
<           VKSE_J=(DEF(I,K,J-1)+DEF(I+IVE(JJ),K,J))                      &
<      &           *VTM(I+IVE(JJ),K,JJ-1)*VTM(I,K,JJ)
---
>           VKSE_J=(DEF(I,K,J-1)+DEF(I+IVE(JJ),K,J))                     &
>                  *VTM(I+IVE(JJ),K,JJ-1)*VTM(I,K,JJ)
313,321c313,321
<           TDIF (I,K,J)=(TNE (I,K,J)-TNE (I+IHW(JJ),K,J-1)               &
<      &                 +TSE (I,K,J)-TSE (I+IHW(JJ),K,J+1))              &
<      &                 *HDAC(I,JJ)
<           QDIF (I,K,J)=(QNE (I,K,J)-QNE (I+IHW(JJ),K,J-1)               &
<      &                 +QSE (I,K,J)-QSE (I+IHW(JJ),K,J+1))              &
<      &                 *HDAC(I,JJ)*FCDIF
<           Q2DIF(I,K,J)=(Q2NE(I,K,J)-Q2NE(I+IHW(JJ),K,J-1)               &
<      &                 +Q2SE(I,K,J)-Q2SE(I+IHW(JJ),K,J+1))              &
<      &                 *HDAC(I,JJ)
---
>           TDIF (I,K,J)=(TNE (I,K,J)-TNE (I+IHW(JJ),K,J-1)              &
>                        +TSE (I,K,J)-TSE (I+IHW(JJ),K,J+1))             &
>                        *HDAC(I,JJ)
>           QDIF (I,K,J)=(QNE (I,K,J)-QNE (I+IHW(JJ),K,J-1)              &
>                        +QSE (I,K,J)-QSE (I+IHW(JJ),K,J+1))             &
>                        *HDAC(I,JJ)*FCDIF
>           Q2DIF(I,K,J)=(Q2NE(I,K,J)-Q2NE(I+IHW(JJ),K,J-1)              &
>                        +Q2SE(I,K,J)-Q2SE(I+IHW(JJ),K,J+1))             &
>                        *HDAC(I,JJ)
323,328c323,328
<           UDIF (I,K,J)=(UNE (I,K,J)-UNE (I+IVW(JJ),K,J-1)               &
<      &                 +USE (I,K,J)-USE (I+IVW(JJ),K,J+1))              &
<      &                 *HDACV(I,JJ)
<           VDIF (I,K,J)=(VNE (I,K,J)-VNE (I+IVW(JJ),K,J-1)               &
<      &                 +VSE (I,K,J)-VSE (I+IVW(JJ),K,J+1))              &
<      &                 *HDACV(I,JJ)
---
>           UDIF (I,K,J)=(UNE (I,K,J)-UNE (I+IVW(JJ),K,J-1)              &
>                        +USE (I,K,J)-USE (I+IVW(JJ),K,J+1))             &
>                        *HDACV(I,JJ)
>           VDIF (I,K,J)=(VNE (I,K,J)-VNE (I+IVW(JJ),K,J-1)              &
>                        +VSE (I,K,J)-VSE (I+IVW(JJ),K,J+1))             &
>                        *HDACV(I,JJ)
420,423c420,423
<         DEFTK=U(I+IHE(J+2),K,J+2)-U(I+IHW(J+2),K,J+2)                   &
<      &       -V(I,K,J+3)+V(I,K,J+1)
<         DEFSK=U(I,K,J+3)-U(I,K,J+1)                                     &
<      &       +V(I+IHE(J+2),K,J+2)-V(I+IHW(J+2),K,J+2)
---
>         DEFTK=U(I+IHE(J+2),K,J+2)-U(I+IHW(J+2),K,J+2)                  &
>              -V(I,K,J+3)+V(I,K,J+1)
>         DEFSK=U(I,K,J+3)-U(I,K,J+1)                                    &
>              +V(I+IHE(J+2),K,J+2)-V(I+IHW(J+2),K,J+2)
439,440c439,440
<         HKNE_J=(DEF(I,K,J1_P1)+DEF(I+IHE(J+1),K,J1_P2))                 &
<      &         *HTM(I,K,J+1)*HTM(I+IHE(J+1),K,J+2)*SNE(I,K)
---
>         HKNE_J=(DEF(I,K,J1_P1)+DEF(I+IHE(J+1),K,J1_P2))                &
>                *HTM(I,K,J+1)*HTM(I+IHE(J+1),K,J+2)*SNE(I,K)
446,447c446,447
<         VKNE_J=(DEF(I+IVE(J+1),K,J1_P1)+DEF(I,K,J1_P2))                 &
<      &         *VTM(I,K,J+1)*VTM(I+IVE(J+1),K,J+2)
---
>         VKNE_J=(DEF(I+IVE(J+1),K,J1_P1)+DEF(I,K,J1_P2))                &
>                *VTM(I,K,J+1)*VTM(I+IVE(J+1),K,J+2)
452,453c452,453
<         HKSE_J=(DEF(I+IHE(J+2),K,J1_P1)+DEF(I,K,J1_P2))                 &
<      &         *HTM(I+IHE(J+2),K,J+1)*HTM(I,K,J+2)*SSE(I,K)
---
>         HKSE_J=(DEF(I+IHE(J+2),K,J1_P1)+DEF(I,K,J1_P2))                &
>                *HTM(I+IHE(J+2),K,J+1)*HTM(I,K,J+2)*SSE(I,K)
459,460c459,460
<         VKSE_J=(DEF(I,K,J1_P1)+DEF(I+IVE(J+2),K,J1_P2))                 &
<      &         *VTM(I+IVE(J+2),K,J+1)*VTM(I,K,J+2)
---
>         VKSE_J=(DEF(I,K,J1_P1)+DEF(I+IVE(J+2),K,J1_P2))                &
>                *VTM(I+IVE(J+2),K,J+1)*VTM(I,K,J+2)
470,478c470,478
<         TDIF (I,K,J4_P1)=(TNE (I,K,J2_P1)-TNE (I+IHW(J+1),K,J2_00)      &
<      &                   +TSE (I,K,J3_P1)-TSE (I+IHW(J+1),K,J3_P2))     &
<      &                   *HDAC(I,J+1)
<         QDIF (I,K,J4_P1)=(QNE (I,K,J2_P1)-QNE (I+IHW(J+1),K,J2_00)      &
<      &                   +QSE (I,K,J3_P1)-QSE (I+IHW(J+1),K,J3_P2))     &
<      &                   *HDAC(I,J+1)*FCDIF
<         Q2DIF(I,K,J4_P1)=(Q2NE(I,K,J2_P1)-Q2NE(I+IHW(J+1),K,J2_00)      &
<      &                   +Q2SE(I,K,J3_P1)-Q2SE(I+IHW(J+1),K,J3_P2))     &
<      &                   *HDAC(I,J+1)
---
>         TDIF (I,K,J4_P1)=(TNE (I,K,J2_P1)-TNE (I+IHW(J+1),K,J2_00)     &
>                          +TSE (I,K,J3_P1)-TSE (I+IHW(J+1),K,J3_P2))    &
>                          *HDAC(I,J+1)
>         QDIF (I,K,J4_P1)=(QNE (I,K,J2_P1)-QNE (I+IHW(J+1),K,J2_00)     &
>                          +QSE (I,K,J3_P1)-QSE (I+IHW(J+1),K,J3_P2))    &
>                          *HDAC(I,J+1)*FCDIF
>         Q2DIF(I,K,J4_P1)=(Q2NE(I,K,J2_P1)-Q2NE(I+IHW(J+1),K,J2_00)     &
>                          +Q2SE(I,K,J3_P1)-Q2SE(I+IHW(J+1),K,J3_P2))    &
>                          *HDAC(I,J+1)
480,485c480,485
<         UDIF (I,K,J4_P1)=(UNE (I,K,J2_P1)-UNE (I+IVW(J+1),K,J2_00)      &
<      &                   +USE (I,K,J3_P1)-USE (I+IVW(J+1),K,J3_P2))     &
<      &                   *HDACV(I,J+1)
<         VDIF (I,K,J4_P1)=(VNE (I,K,J2_P1)-VNE (I+IVW(J+1),K,J2_00)      &
<      &                   +VSE (I,K,J3_P1)-VSE (I+IVW(J+1),K,J3_P2))     &
<      &                   *HDACV(I,J+1)
---
>         UDIF (I,K,J4_P1)=(UNE (I,K,J2_P1)-UNE (I+IVW(J+1),K,J2_00)     &
>                          +USE (I,K,J3_P1)-USE (I+IVW(J+1),K,J3_P2))    &
>                          *HDACV(I,J+1)
>         VDIF (I,K,J4_P1)=(VNE (I,K,J2_P1)-VNE (I+IVW(J+1),K,J2_00)     &
>                          +VSE (I,K,J3_P1)-VSE (I+IVW(J+1),K,J3_P2))    &
>                          *HDACV(I,J+1)
520,525c520,525
<           TNE (I,K,J2_00)=(TDIF (I+IHE(J),K,J4_P1)-TDIF (I,K,J4_00))    &
<      &                    *HKNE_J
<           QNE (I,K,J2_00)=(QDIF (I+IHE(J),K,J4_P1)-QDIF (I,K,J4_00))    &
<      &                    *HKNE_J
<           Q2NE(I,K,J2_00)=(Q2DIF(I+IHE(J),K,J4_P1)-Q2DIF(I,K,J4_00))    &
<      &                    *HKNE_J
---
>           TNE (I,K,J2_00)=(TDIF (I+IHE(J),K,J4_P1)-TDIF (I,K,J4_00))   &
>                           *HKNE_J
>           QNE (I,K,J2_00)=(QDIF (I+IHE(J),K,J4_P1)-QDIF (I,K,J4_00))   &
>                           *HKNE_J
>           Q2NE(I,K,J2_00)=(Q2DIF(I+IHE(J),K,J4_P1)-Q2DIF(I,K,J4_00))   &
>                           *HKNE_J
528,531c528,531
<           UNE (I,K,J2_00)=(UDIF (I+IVE(J),K,J4_P1)-UDIF (I,K,J4_00))    &
<      &                    *VKNE_J
<           VNE (I,K,J2_00)=(VDIF (I+IVE(J),K,J4_P1)-VDIF (I,K,J4_00))    &
<      &                    *VKNE_J
---
>           UNE (I,K,J2_00)=(UDIF (I+IVE(J),K,J4_P1)-UDIF (I,K,J4_00))   &
>                           *VKNE_J
>           VNE (I,K,J2_00)=(VDIF (I+IVE(J),K,J4_P1)-VDIF (I,K,J4_00))   &
>                           *VKNE_J
534,539c534,539
<           TSE (I,K,J3_P1)=(TDIF (I+IHE(J+1),K,J4_00)                    &
<      &                    -TDIF (I         ,K,J4_P1))*HKSE_J
<           QSE (I,K,J3_P1)=(QDIF (I+IHE(J+1),K,J4_00)                    &
<      &                    -QDIF (I         ,K,J4_P1))*HKSE_J
<           Q2SE(I,K,J3_P1)=(Q2DIF(I+IHE(J+1),K,J4_00)                    &
<      &                    -Q2DIF(I         ,K,J4_P1))*HKSE_J
---
>           TSE (I,K,J3_P1)=(TDIF (I+IHE(J+1),K,J4_00)                   &
>                           -TDIF (I         ,K,J4_P1))*HKSE_J
>           QSE (I,K,J3_P1)=(QDIF (I+IHE(J+1),K,J4_00)                   &
>                           -QDIF (I         ,K,J4_P1))*HKSE_J
>           Q2SE(I,K,J3_P1)=(Q2DIF(I+IHE(J+1),K,J4_00)                   &
>                           -Q2DIF(I         ,K,J4_P1))*HKSE_J
543,546c543,546
<           USE (I,K,J3_P1)=(UDIF (I+IVE(J+1),K,J4_00)                    &
<      &                    -UDIF (I         ,K,J4_P1))*VKSE_J
<           VSE (I,K,J3_P1)=(VDIF (I+IVE(J+1),K,J4_00)                    &
<      &                    -VDIF (I         ,K,J4_P1))*VKSE_J
---
>           USE (I,K,J3_P1)=(UDIF (I+IVE(J+1),K,J4_00)                   &
>                           -UDIF (I         ,K,J4_P1))*VKSE_J
>           VSE (I,K,J3_P1)=(VDIF (I+IVE(J+1),K,J4_00)                   &
>                           -VDIF (I         ,K,J4_P1))*VKSE_J
554,559c554,559
<             TNE (I,K,J2_M1)=(TDIF (I+IHE(J-1),K,J4_00)                  &
<      &                      -TDIF (I         ,K,J4_M1))*HKNE_J
<             QNE (I,K,J2_M1)=(QDIF (I+IHE(J-1),K,J4_00)                  &
<      &                      -QDIF (I         ,K,J4_M1))*HKNE_J
<             Q2NE(I,K,J2_M1)=(Q2DIF(I+IHE(J-1),K,J4_00)                  &
<      &                      -Q2DIF(I         ,K,J4_M1))*HKNE_J
---
>             TNE (I,K,J2_M1)=(TDIF (I+IHE(J-1),K,J4_00)                 &
>                             -TDIF (I         ,K,J4_M1))*HKNE_J
>             QNE (I,K,J2_M1)=(QDIF (I+IHE(J-1),K,J4_00)                 &
>                             -QDIF (I         ,K,J4_M1))*HKNE_J
>             Q2NE(I,K,J2_M1)=(Q2DIF(I+IHE(J-1),K,J4_00)                 &
>                             -Q2DIF(I         ,K,J4_M1))*HKNE_J
562,565c562,565
<             UNE (I,K,J2_M1)=(UDIF (I+IVE(J-1),K,J4_00)                  &
<      &                      -UDIF (I         ,K,J4_M1))*VKNE_J
<             VNE (I,K,J2_M1)=(VDIF (I+IVE(J-1),K,J4_00)                  &
<      &                      -VDIF (I         ,K,J4_M1))*VKNE_J
---
>             UNE (I,K,J2_M1)=(UDIF (I+IVE(J-1),K,J4_00)                 &
>                             -UDIF (I         ,K,J4_M1))*VKNE_J
>             VNE (I,K,J2_M1)=(VDIF (I+IVE(J-1),K,J4_00)                 &
>                             -VDIF (I         ,K,J4_M1))*VKNE_J
568,573c568,573
<             TSE (I,K,J3_00)=(TDIF (I+IHE(J),K,J4_M1)                    &
<      &                      -TDIF (I       ,K,J4_00))*HKSE_J
<             QSE (I,K,J3_00)=(QDIF (I+IHE(J),K,J4_M1)                    &
<      &                      -QDIF (I       ,K,J4_00))*HKSE_J
<             Q2SE(I,K,J3_00)=(Q2DIF(I+IHE(J),K,J4_M1)                    &
<      &                      -Q2DIF(I       ,K,J4_00))*HKSE_J
---
>             TSE (I,K,J3_00)=(TDIF (I+IHE(J),K,J4_M1)                   &
>                             -TDIF (I       ,K,J4_00))*HKSE_J
>             QSE (I,K,J3_00)=(QDIF (I+IHE(J),K,J4_M1)                   &
>                             -QDIF (I       ,K,J4_00))*HKSE_J
>             Q2SE(I,K,J3_00)=(Q2DIF(I+IHE(J),K,J4_M1)                   &
>                             -Q2DIF(I       ,K,J4_00))*HKSE_J
577,580c577,580
<             USE (I,K,J3_00)=(UDIF (I+IVE(J),K,J4_M1)                    &
<      &                      -UDIF (I       ,K,J4_00))*VKSE_J
<             VSE (I,K,J3_00)=(VDIF (I+IVE(J),K,J4_M1)                    &
<      &                      -VDIF (I       ,K,J4_00))*VKSE_J
---
>             USE (I,K,J3_00)=(UDIF (I+IVE(J),K,J4_M1)                   &
>                             -UDIF (I       ,K,J4_00))*VKSE_J
>             VSE (I,K,J3_00)=(VDIF (I+IVE(J),K,J4_M1)                   &
>                             -VDIF (I       ,K,J4_00))*VKSE_J
603,608c603,608
<           T(I,K,J)=T(I,K,J)-(TNE (I,K,J2_00)-TNE (I+IHW(J),K,J2_M1)     &
<      &                      +TSE (I,K,J3_00)-TSE (I+IHW(J),K,J3_P1))    &
<      &                      *HDAC(I,J)
<           Q(I,K,J)=Q(I,K,J)-(QNE (I,K,J2_00)-QNE (I+IHW(J),K,J2_M1)     &
<      &                      +QSE (I,K,J3_00)-QSE (I+IHW(J),K,J3_P1))    &
<      &                      *HDAC(I,J)*FCDIF
---
>           T(I,K,J)=T(I,K,J)-(TNE (I,K,J2_00)-TNE (I+IHW(J),K,J2_M1)    &
>                             +TSE (I,K,J3_00)-TSE (I+IHW(J),K,J3_P1))   &
>                             *HDAC(I,J)
>           Q(I,K,J)=Q(I,K,J)-(QNE (I,K,J2_00)-QNE (I+IHW(J),K,J2_M1)    &
>                             +QSE (I,K,J3_00)-QSE (I+IHW(J),K,J3_P1))   &
>                             *HDAC(I,J)*FCDIF
612,619c612,619
<           U(I,K,J)=U(I,K,J)-(UNE (I,K,J2_00)-UNE (I+IVW(J),K,J2_M1)     &
<      &                      +USE (I,K,J3_00)-USE (I+IVW(J),K,J3_P1))    &
<      &                      *HDACV(I,J)
<           V(I,K,J)=V(I,K,J)-(VNE (I,K,J2_00)-VNE (I+IVW(J),K,J2_M1)     &
<      &                      +VSE (I,K,J3_00)-VSE (I+IVW(J),K,J3_P1))    &
<      &                      *HDACV(I,J)
<           CKE(I,K,J4_00)=0.5*(U(I,K,J)*U(I,K,J)-UTK*UTK                 &
<      &                       +V(I,K,J)*V(I,K,J)-VTK*VTK)
---
>           U(I,K,J)=U(I,K,J)-(UNE (I,K,J2_00)-UNE (I+IVW(J),K,J2_M1)    &
>                             +USE (I,K,J3_00)-USE (I+IVW(J),K,J3_P1))   &
>                             *HDACV(I,J)
>           V(I,K,J)=V(I,K,J)-(VNE (I,K,J2_00)-VNE (I+IVW(J),K,J2_M1)    &
>                             +VSE (I,K,J3_00)-VSE (I+IVW(J),K,J3_P1))   &
>                             *HDACV(I,J)
>           CKE(I,K,J4_00)=0.5*(U(I,K,J)*U(I,K,J)-UTK*UTK                &
>                              +V(I,K,J)*V(I,K,J)-VTK*VTK)
627,629c627,629
<           Q2(I,K,J)=Q2(I,K,J)-(Q2NE(I,K,J2_00)-Q2NE(I+IHW(J),K,J2_M1)   &
<      &                        +Q2SE(I,K,J3_00)-Q2SE(I+IHW(J),K,J3_P1))  &
<      &                        *HDAC(I,J)*HTM(I,K+1,J)
---
>           Q2(I,K,J)=Q2(I,K,J)-(Q2NE(I,K,J2_00)-Q2NE(I+IHW(J),K,J2_M1)  &
>                               +Q2SE(I,K,J3_00)-Q2SE(I+IHW(J),K,J3_P1)) &
>                               *HDAC(I,J)*HTM(I,K+1,J)
DONE module_DIFFUSION_NMM.F
COMPARE module_IGWAVE_ADJUST.F
88,90c88,90
<       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                     &
<      &                     ,IMS,IME,JMS,JME,KMS,KME                     &
<      &                     ,ITS,ITE,JTS,JTE,KTS,KTE
---
>       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                    &
>                            ,IMS,IME,JMS,JME,KMS,KME                    &
>                            ,ITS,ITE,JTS,JTE,KTS,KTE
108,110c108,110
<       REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: CPGFU,DX,FCP,FDIV   &
<      &                                             ,PD,FIS,RES,WPDAR    &
<      &                                             ,HBM2,VBM2,VBM3
---
>       REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: CPGFU,DX,FCP,FDIV  &
>                                                    ,PD,FIS,RES,WPDAR   &
>                                                    ,HBM2,VBM2,VBM3
112,113c112,113
<       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(IN) :: CWM,DWDT    &
<      &                                                     ,Q,HTM,VTM
---
>       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(IN) :: CWM,DWDT   &
>                                                            ,Q,HTM,VTM
117,120c117,120
<       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(INOUT) :: DIV      &
<      &                                                        ,OMGALF   &
<      &                                                        ,RTOP,T   &
<      &                                                        ,U,V
---
>       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(INOUT) :: DIV     &
>                                                               ,OMGALF  &
>                                                               ,RTOP,T  &
>                                                               ,U,V
122,123c122,123
<       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(OUT) :: FEW,FNS    &
<      &                                                      ,FNE,FSE
---
>       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(OUT) :: FEW,FNS   &
>                                                             ,FNE,FSE
147,149c147,149
<       REAL :: ADPDNE,ADPDSE,ADPDX,ADPDY,APELP,DFI,DCNEK,DCSEK           &
<      &       ,DPFEW,DPFNS,DPFNEK,DPFSEK,DPNEK,DPSEK,EDIV,FIUP           &
<      &       ,HM,PCEW,PCNS,PEW,PNS,PVNEK,PVSEK,RTOPP,VM
---
>       REAL :: ADPDNE,ADPDSE,ADPDX,ADPDY,APELP,DFI,DCNEK,DCSEK          &
>              ,DPFEW,DPFNS,DPFNEK,DPFSEK,DPNEK,DPSEK,EDIV,FIUP          &
>              ,HM,PCEW,PCNS,PEW,PNS,PVNEK,PVSEK,RTOPP,VM
175a176
>           integer myproc
239a241
>         call wrf_get_myproc(myproc)
323,330c325,333
<           CNE(I,K,J)=(DFDZ(I+IHE(JJ),K,J+1)+DFDZ(I,K,J))*2.             &
<      &              *(APEL(I+IHE(JJ),K,J+1)-APEL(I,K,J))
<           CSE(I,K,J+1)=(DFDZ(I+IHE(JJ+1),K,J)+DFDZ(I,K,J+1))*2.         &
<      &                *(APEL(I+IHE(JJ+1),K,J)-APEL(I,K,J+1))
<           PNE(I,K,J)=(FIM(I+IHE(JJ),K,JJ+1)-FIM(I,K,JJ))                &
<      &              *(DWDT(I+IHE(JJ),K,JJ+1)+DWDT(I,K,JJ))
<           PSE(I,K,J+1)=(FIM(I+IHE(JJ+1),K,JJ)-FIM(I,K,JJ+1))            &                
<      &                *(DWDT(I+IHE(JJ+1),K,JJ)+DWDT(I,K,JJ+1))
---
>              ! 20030508, bit for bit agreement on different P; JM
>           CNE(I,K,J)=(DFDZ(I+IHE(JJ),K,J+1)+DFDZ(I,K,J))*2.            &
>                     *(APEL(I+IHE(JJ),K,J+1)-APEL(I,K,J))
>           CSE(I,K,J+1)=(DFDZ(I+IHE(JJ+1),K,J)+DFDZ(I,K,J+1))*2.        &
>                       *(APEL(I+IHE(JJ+1),K,J)-APEL(I,K,J+1))
>           PNE(I,K,J)=(FIM(I+IHE(JJ),K,JJ+1)-FIM(I,K,JJ))               &
>                     *(DWDT(I+IHE(JJ),K,JJ+1)+DWDT(I,K,JJ))
>           PSE(I,K,J+1)=(FIM(I+IHE(JJ+1),K,JJ)-FIM(I,K,JJ+1))           &                
>                       *(DWDT(I+IHE(JJ+1),K,JJ)+DWDT(I,K,JJ+1))
347,350c350,353
<           DPFNEK=((PPNE(I+IVW(JJ),K,J)+PPNE(I,K,J-1))                   &
<      &           +(PCNE(I+IVW(JJ),K,J)+PCNE(I,K,J-1)))*2.
<           DPFSEK=((PPSE(I+IVW(JJ),K,J)+PPSE(I,K,J+1))                   &
<      &           +(PCSE(I+IVW(JJ),K,J)+PCSE(I,K,J+1)))*2.
---
>           DPFNEK=((PPNE(I+IVW(JJ),K,J)+PPNE(I,K,J-1))                  &
>                  +(PCNE(I+IVW(JJ),K,J)+PCNE(I,K,J-1)))*2.
>           DPFSEK=((PPSE(I+IVW(JJ),K,J)+PPSE(I,K,J+1))                  &
>                  +(PCSE(I+IVW(JJ),K,J)+PCSE(I,K,J+1)))*2.
382,386c385,389
<           PCXC(I,K,J)=(PNE(I+IVW(JJ),K,J)-PNE(I,K,J-1)                  &
<      &                +CNE(I+IVW(JJ),K,J)-CNE(I,K,J-1)                  &
<      &                +PSE(I+IVW(JJ),K,J)-PSE(I,K,J+1)                  &
<      &                +CSE(I+IVW(JJ),K,J)-CSE(I,K,J+1))                 &
<      &                *VBM3(I,JJ)*VTM(I,K,JJ)
---
>           PCXC(I,K,J)=(PNE(I+IVW(JJ),K,J)-PNE(I,K,J-1)                 &
>                       +CNE(I+IVW(JJ),K,J)-CNE(I,K,J-1)                 &
>                       +PSE(I+IVW(JJ),K,J)-PSE(I,K,J+1)                 &
>                       +CSE(I+IVW(JJ),K,J)-CSE(I,K,J+1))                &
>                       *VBM3(I,JJ)*VTM(I,K,JJ)
396,397c399,400
<         PVNEK=(UDY(I+IHE(JJ-1),K,-1)+VDX(I+IHE(JJ-1),K,-1))             &
<      &       +(UDY(I,K,0)          +VDX(I,K,0))
---
>         PVNEK=(UDY(I+IHE(JJ-1),K,-1)+VDX(I+IHE(JJ-1),K,-1))            &
>              +(UDY(I,K,0)          +VDX(I,K,0))
407,408c410,411
<         PVSEK=(UDY(I+IHE(JJ),K,0)-VDX(I+IHE(JJ),K,0))                   &
<      &       +(UDY(I,K,-1)      -VDX(I,K,-1))
---
>         PVSEK=(UDY(I+IHE(JJ),K,0)-VDX(I+IHE(JJ),K,0))                  &
>              +(UDY(I,K,-1)      -VDX(I,K,-1))
479c482
< !
---
> 
481c484
<      &                *(APEL(I+IHE(J+1),K,J1_P2)-APEL(I,K,J1_P1))
---
>                       *(APEL(I+IHE(J+1),K,J1_P2)-APEL(I,K,J1_P1))
483c486
<      &                *(APEL(I+IHE(J+2),K,J1_P1)-APEL(I,K,J1_P2))
---
>                       *(APEL(I+IHE(J+2),K,J1_P1)-APEL(I,K,J1_P2))
486c489
<      &                *(DWDT(I+IHE(J+1),K,J+2)+DWDT(I,K,J+1))
---
>                       *(DWDT(I+IHE(J+1),K,J+2)+DWDT(I,K,J+1))
488c491
<      &                *(DWDT(I+IHE(J+2),K,J+1)+DWDT(I,K,J+2))
---
>                       *(DWDT(I+IHE(J+2),K,J+1)+DWDT(I,K,J+2))
505,513c508,516
<         PCXC(I,K,J4_P1)=(PNE(I+IVW(J+1),K,J2_P1)                        &
<      &                  +CNE(I+IVW(J+1),K,J2_P1)                        &
<      &                  +PSE(I+IVW(J+1),K,J3_P1)                        &
<      &                  +CSE(I+IVW(J+1),K,J3_P1)                        &
<      &                  -PNE(I,K,J2_00)                                 &
<      &                  -CNE(I,K,J2_00)                                 &
<      &                  -PSE(I,K,J3_P2)                                 &
<      &                  -CSE(I,K,J3_P2))                                &
<      &                  *VBM3(I,J+1)*VTM(I,K,J+1)
---
>         PCXC(I,K,J4_P1)=(PNE(I+IVW(J+1),K,J2_P1)                       &
>                         +CNE(I+IVW(J+1),K,J2_P1)                       &
>                         +PSE(I+IVW(J+1),K,J3_P1)                       &
>                         +CSE(I+IVW(J+1),K,J3_P1)                       &
>                         -PNE(I,K,J2_00)                                &
>                         -CNE(I,K,J2_00)                                &
>                         -PSE(I,K,J3_P2)                                &
>                         -CSE(I,K,J3_P2))                               &
>                         *VBM3(I,J+1)*VTM(I,K,J+1)
521,523c524,526
<         DIVL(I,K)=(DETA1(K)*PDTOP/(SLP_STD-PT)                          &
<      &            +DETA2(K)*(1.-PDTOP/(SLP_STD-PT)))*WPDAR(I,J)         &
<      &           *(PCXC(I+IHE(J),K,J4_00)-PCXC(I,K,J4_P1)               &
---
>         DIVL(I,K)=(DETA1(K)*PDTOP/(SLP_STD-PT)                         &
>                   +DETA2(K)*(1.-PDTOP/(SLP_STD-PT)))*WPDAR(I,J)        &
>                  *(PCXC(I+IHE(J),K,J4_00)-PCXC(I,K,J4_P1)              &
550,553c553,556
<           DPFNEK=((PPNE(I+IVW(J+1),K,J2_P1)+PPNE(I,K,J2_00))            &
<      &           +(PCNE(I+IVW(J+1),K,J2_P1)+PCNE(I,K,J2_00)))*2.
<           DPFSEK=((PPSE(I+IVW(J+1),K,J3_P1)+PPSE(I,K,J3_P2))            &
<      &           +(PCSE(I+IVW(J+1),K,J3_P1)+PCSE(I,K,J3_P2)))*2.
---
>           DPFNEK=((PPNE(I+IVW(J+1),K,J2_P1)+PPNE(I,K,J2_00))           &
>                  +(PCNE(I+IVW(J+1),K,J2_P1)+PCNE(I,K,J2_00)))*2.
>           DPFSEK=((PPSE(I+IVW(J+1),K,J3_P1)+PPSE(I,K,J3_P2))           &
>                  +(PCSE(I+IVW(J+1),K,J3_P1)+PCSE(I,K,J3_P2)))*2.
562,565c565,568
<           U(I,K,J+1)=(((DPFEW+PCEW)/ADPDX+PEW)*CPGFU(I,J+1))*VM         &
<      &              +U(I,K,J+1) 
<           V(I,K,J+1)=(((DPFNS+PCNS)/ADPDY+PNS)*CPGFV       )*VM         &
<      &              +V(I,K,J+1)
---
>           U(I,K,J+1)=(((DPFEW+PCEW)/ADPDX+PEW)*CPGFU(I,J+1))*VM        &
>                     +U(I,K,J+1) 
>           V(I,K,J+1)=(((DPFNS+PCNS)/ADPDY+PNS)*CPGFV       )*VM        &
>                     +V(I,K,J+1)
608,609c611,612
<           PVNEK=(UDY(I+IHE(J),K,J4_00)+VDX(I+IHE(J),K,J4_00))           &
<      &         +(UDY(I,K,J4_P1)       +VDX(I,K,J4_P1))
---
>           PVNEK=(UDY(I+IHE(J),K,J4_00)+VDX(I+IHE(J),K,J4_00))          &
>                +(UDY(I,K,J4_P1)       +VDX(I,K,J4_P1))
614,615c617,618
<           PVSEK=(UDY(I+IHE(J+1),K,J4_P1)-VDX(I+IHE(J+1),K,J4_P1))       &
<      &         +(UDY(I,K,J4_00)         -VDX(I,K,J4_00))
---
>           PVSEK=(UDY(I+IHE(J+1),K,J4_P1)-VDX(I+IHE(J+1),K,J4_P1))      &
>                +(UDY(I,K,J4_00)         -VDX(I,K,J4_00))
628,632c631,635
<           OMGALF(I,K,J)=(TEW(I+IHE(J),K)+TEW(I+IHW(J),K)                &
<      &                  +TNS(I,K,J4_P1) +TNS(I,K,J4_M1)                 &
<      &                  +TNE(I,K,J5_00) +TNE(I+IHW(J),K,J5_M1)          &
<      &                  +TSE(I,K,J6_00)+TSE(I+IHW(J),K,J6_P1))          &
<      &                  /DPDE(I,K,J1_00)*FCP(I,J)*HM
---
>           OMGALF(I,K,J)=(TEW(I+IHE(J),K)+TEW(I+IHW(J),K)               &
>                         +TNS(I,K,J4_P1) +TNS(I,K,J4_M1)                &
>                         +TNE(I,K,J5_00) +TNE(I+IHW(J),K,J5_M1)         &
>                         +TSE(I,K,J6_00)+TSE(I+IHW(J),K,J6_P1))         &
>                         /DPDE(I,K,J1_00)*FCP(I,J)*HM
634,637c637,640
<           EDIV=(FEW(I+IHE(J),K,J)+FNS(I,K,J+1)                          &
<      &         +FNE(I,K,J)+FSE(I,K,J)                                   &
<      &        -(FEW(I+IHW(J),K,J)+FNS(I,K,J-1)                          &
<      &         +FNE(I+IHW(J),K,J-1)+FSE(I+IHW(J),K,J+1)))*FDIV(I,J)
---
>           EDIV=(FEW(I+IHE(J),K,J)+FNS(I,K,J+1)                         &
>                +FNE(I,K,J)+FSE(I,K,J)                                  &
>               -(FEW(I+IHW(J),K,J)+FNS(I,K,J-1)                         &
>                +FNE(I+IHW(J),K,J-1)+FSE(I+IHW(J),K,J+1)))*FDIV(I,J)
653,656c656,658
< !-----------------------------------------------------------------------
< !***********************************************************************
< !-----------------------------------------------------------------------
<       SUBROUTINE PDTEDT(                                                &
---
> !----------------------------------------------------------------------
> !**********************************************************************
>       SUBROUTINE PDTEDT(                                               &
658c660
<      &                  grid,                                           &
---
>                         grid,                                          &
660,668c662,670
<      &                  NTSD,DT,PT,ETA2,RES,HYDRO                       &
<      &                 ,HTM,HBM2,EF4T                                   &
<      &                 ,PD,PDSL,PDSLO,T,DWDT,RTOP,OMGALF                &
<      &                 ,PETDT,PINT,DIV,PSDT                             &
<      &                 ,IHE,IHW,IVE,IVW,INDX3_WRK                       &                 
<      &                 ,IDS,IDE,JDS,JDE,KDS,KDE                         &
<      &                 ,IMS,IME,JMS,JME,KMS,KME                         &
<      &                 ,ITS,ITE,JTS,JTE,KTS,KTE)
< !***********************************************************************
---
>                         NTSD,DT,PT,ETA2,RES,HYDRO                      &
>                        ,HTM,HBM2,EF4T                                  &
>                        ,PD,PDSL,PDSLO,T,DWDT,RTOP,OMGALF               &
>                        ,PETDT,PINT,DIV,PSDT                            &
>                        ,IHE,IHW,IVE,IVW,INDX3_WRK                      &                 
>                        ,IDS,IDE,JDS,JDE,KDS,KDE                        &
>                        ,IMS,IME,JMS,JME,KMS,KME                        &
>                        ,ITS,ITE,JTS,JTE,KTS,KTE)
> !**********************************************************************
747,748c749,750
<      &                                                        ,OMGALF   &
<      &                                                        ,RTOP,T
---
>                                                               ,OMGALF   &
>                                                               ,RTOP,T
772a775,779
>       real(8) :: timef
>       real :: btimp,btimq
>       real,save :: tloop0_tim,tloop1_tim,tloop2_tim,tloop3_tim          &
>      &,            tloop4_tim,tloop5_tim,tloop6_tim                     &
>      &,            tloop7_tim,tloop8_tim,routine_tim
775a783,796
>       if(ntsd.eq.0)then
>         tloop0_tim=0.
>         tloop1_tim=0.
>         tloop2_tim=0.
>         tloop3_tim=0.
>         tloop4_tim=0.
>         tloop5_tim=0.
>         tloop6_tim=0.
>         tloop7_tim=0.
>         tloop8_tim=0.
>         routine_tim=0.
>       endif
>       btimq=timef()
>       btimp=timef()
776a798
> !jw   CALL ZERO(PDSLO,IMS,IME,JMS,JME)
802a825
>       tloop0_tim=tloop0_tim+timef()-btimp
806a830
>       btimp=timef()
813a838
>       tloop1_tim=tloop1_tim+timef()-btimp
814a840
>       btimp=timef()
822a849
>       tloop2_tim=tloop2_tim+timef()-btimp
823a851
>       btimp=timef()
834a863
>       tloop3_tim=tloop3_tim+timef()-btimp
837a867
>       btimp=timef()
841,842c871,872
<           PETDT(I,K,J)=-(PRET(I,J)*ETA2(K+1)+DIV(I,K+1,J))              &
<      &                  *HTM(I,K,J)*HBM2(I,J)
---
>           PETDT(I,K,J)=-(PRET(I,J)*ETA2(K+1)+DIV(I,K+1,J))             &
>                         *HTM(I,K,J)*HBM2(I,J)
845a876
>       tloop4_tim=tloop4_tim+timef()-btimp
848a880
>       btimp=timef()
857,858c889,890
<         PINT(I,KTE,J)=PRET(I,J)*(ETA2(KTE+1)+ETA2(KTE))*DWDTP*DT        &
<      &             +TPM(I,J)-PINT(I,KTE+1,J)
---
>         PINT(I,KTE,J)=PRET(I,J)*(ETA2(KTE+1)+ETA2(KTE))*DWDTP*DT       &
>                    +TPM(I,J)-PINT(I,KTE+1,J)
862a895
>       tloop5_tim=tloop5_tim+timef()-btimp
863a897
>       btimp=timef()
870,871c904,905
<           RHS=-(DIV(I,K+1,J)+DIV(I,K,J))*RTOP(I,K,J)*HTM(I,K,J)*DWDTP   &
<      &         *EF4T
---
>           RHS=-(DIV(I,K+1,J)+DIV(I,K,J))*RTOP(I,K,J)*HTM(I,K,J)*DWDTP  &
>                *EF4T
874,875c908,909
<           PINT(I,K,J)=PRET(I,J)*(ETA2(K+1)+ETA2(K))*DWDTP*DT            &
<      &               +TPM(I,J)-PINT(I,K+1,J)
---
>           PINT(I,K,J)=PRET(I,J)*(ETA2(K+1)+ETA2(K))*DWDTP*DT           &
>                      +TPM(I,J)-PINT(I,K+1,J)
880a915
>       tloop6_tim=tloop6_tim+timef()-btimp
881a917
>       btimp=timef()
887,888c923,924
<         RHS=-(DIV(I,KTS+1,J)+DIV(I,KTS,J))*RTOP(I,KTS,J)*HTM(I,KTS,J)   &
<      &       *DWDTP*EF4T
---
>         RHS=-(DIV(I,KTS+1,J)+DIV(I,KTS,J))*RTOP(I,KTS,J)*HTM(I,KTS,J)  &
>              *DWDTP*EF4T
891,892c927,928
<         PINT(I,KTS,J)=PRET(I,J)*(ETA2(KTS+1)+ETA2(KTS))*DWDTP*DT        &
<      &                 +TPM(I,J)-PINT(I,KTS+1,J)
---
>         PINT(I,KTS,J)=PRET(I,J)*(ETA2(KTS+1)+ETA2(KTS))*DWDTP*DT       &
>                        +TPM(I,J)-PINT(I,KTS+1,J)
894a931
>       tloop7_tim=tloop7_tim+timef()-btimp
897a935
>       btimp=timef()
942,943c980,981
<             PNE(I,K,-1)=(PETDT(I+IHE(JJ),K,JJ+1)-PETDT(I,K,JJ))         &
<      &                  *HTM(I,K,JJ)*HTM(I+IHE(JJ),K,JJ+1)
---
>             PNE(I,K,-1)=(PETDT(I+IHE(JJ),K,JJ+1)-PETDT(I,K,JJ))        &
>                         *HTM(I,K,JJ)*HTM(I+IHE(JJ),K,JJ+1)
949,950c987,988
<             PSE(I,K,0)=(PETDT(I+IHE(JJ+1),K,JJ)-PETDT(I,K,JJ+1))        &
<      &                 *HTM(I+IHE(JJ+1),K,JJ)*HTM(I,K,JJ+1)
---
>             PSE(I,K,0)=(PETDT(I+IHE(JJ+1),K,JJ)-PETDT(I,K,JJ+1))       &
>                        *HTM(I+IHE(JJ+1),K,JJ)*HTM(I,K,JJ+1)
972,973c1010,1011
<               PNE(I,K,J1_00)=(PETDT(I+IHE(J),K,J+1)-PETDT(I,K,J))       &
<      &                       *HTM(I,K+1,J)*HTM(I+IHE(J),K+1,J+1)
---
>               PNE(I,K,J1_00)=(PETDT(I+IHE(J),K,J+1)-PETDT(I,K,J))      &
>                              *HTM(I,K+1,J)*HTM(I+IHE(J),K+1,J+1)
979,980c1017,1018
<               PSE(I,K,J2_P1)=(PETDT(I+IHE(J+1),K,J)-PETDT(I,K,J+1))     &
<      &                       *HTM(I+IHE(J+1),K+1,J)*HTM(I,K+1,J+1)
---
>               PSE(I,K,J2_P1)=(PETDT(I+IHE(J+1),K,J)-PETDT(I,K,J+1))    &
>                              *HTM(I+IHE(J+1),K+1,J)*HTM(I,K+1,J+1)
986,987c1024,1025
<               PETDTL=(PNE(I,K,J1_00)-PNE(I+IHW(J),K,J1_M1)              &
<      &               +PSE(I,K,J2_00)-PSE(I+IHW(J),K,J2_P1))*HBM2(I,J)
---
>               PETDTL=(PNE(I,K,J1_00)-PNE(I+IHW(J),K,J1_M1)             &
>                      +PSE(I,K,J2_00)-PSE(I+IHW(J),K,J2_P1))*HBM2(I,J)
994a1033,1041
> !jm          btim=timef()
> !jw need to add the following arrays to HALO:
> !jw     3D - PETDT
> !jw stencil needs to go at least 2 point in the x-dir and 2 in y
> !jw       CALL EXCH(PETDT,KTE-1,2,2,IMS,IME,JMS,JME,KMS,KME) 
> !jw#         include "HALO_NMM_E.inc" not now -- need to move this 
> !jw                                   to the mediation layer
> !jm          exch_tim=exch_tim+timef()-btim
> 
995a1043,1044
> 
> 
996a1046,1047
> 
> 
1002a1054,1055
>       tloop8_tim=tloop8_tim+timef()-btimp
>       routine_tim=routine_tim+timef()-btimq
1003a1057,1066
> !      write(0,*)' tloop0_tim=',tloop0_tim*1.e-3
> !      write(0,*)' tloop1_tim=',tloop1_tim*1.e-3
> !      write(0,*)' tloop2_tim=',tloop2_tim*1.e-3
> !      write(0,*)' tloop3_tim=',tloop3_tim*1.e-3
> !      write(0,*)' tloop4_tim=',tloop4_tim*1.e-3
> !      write(0,*)' tloop5_tim=',tloop5_tim*1.e-3
> !      write(0,*)' tloop6_tim=',tloop6_tim*1.e-3
> !      write(0,*)' tloop7_tim=',tloop7_tim*1.e-3
> !      write(0,*)' tloop8_tim=',tloop8_tim*1.e-3
> !      write(0,*)' routine_tim=',routine_tim*1.e-3
1007,1012c1070,1075
<       SUBROUTINE DDAMP(NTSD,DT,DETA1,DETA2,PDSL,PDTOP,DIV,HBM2,VTM      &
<      &                ,T,U,V,DDMPU,DDMPV                                &
<      &                ,IHE,IHW,IVE,IVW,INDX3_WRK                        &              
<      &                ,IDS,IDE,JDS,JDE,KDS,KDE                          &
<      &                ,IMS,IME,JMS,JME,KMS,KME                          &
<      &                ,ITS,ITE,JTS,JTE,KTS,KTE)
---
>       SUBROUTINE DDAMP(NTSD,DT,DETA1,DETA2,PDSL,PDTOP,DIV,HBM2,VTM     &
>                       ,T,U,V,DDMPU,DDMPV                               &
>                       ,IHE,IHW,IVE,IVW,INDX3_WRK                       &              
>                       ,IDS,IDE,JDS,JDE,KDS,KDE                         &
>                       ,IMS,IME,JMS,JME,KMS,KME                         &
>                       ,ITS,ITE,JTS,JTE,KTS,KTE)
1054,1056c1117,1119
<       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                     &
<      &                     ,IMS,IME,JMS,JME,KMS,KME                     &
<      &                     ,ITS,ITE,JTS,JTE,KTS,KTE
---
>       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                    &
>                            ,IMS,IME,JMS,JME,KMS,KME                    &
>                            ,ITS,ITE,JTS,JTE,KTS,KTE
1071,1072c1134,1135
<       REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: DDMPU,DDMPV         &
<      &                                             ,HBM2,PDSL
---
>       REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: DDMPU,DDMPV        &
>                                                    ,HBM2,PDSL
1076,1077c1139,1140
<       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(INOUT) :: DIV,T    &
<      &                                                        ,U,V
---
>       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(INOUT) :: DIV,T   &
>                                                               ,U,V
1154,1157c1217,1220
<         RDPDX=VTM(I,K,J)/(DPDE(I+IVW(J),K,J4_00)                        &
<      &                   +DPDE(I+IVE(J),K,J4_00))
<         U(I,K,J)=U(I,K,J)+(DIV(I+IVE(J),K,J)-DIV(I+IVW(J),K,J))         &
<      &                    *RDPDX*DDMPU(I,J)
---
>         RDPDX=VTM(I,K,J)/(DPDE(I+IVW(J),K,J4_00)                       &
>                          +DPDE(I+IVE(J),K,J4_00))
>         U(I,K,J)=U(I,K,J)+(DIV(I+IVE(J),K,J)-DIV(I+IVW(J),K,J))        &
>                           *RDPDX*DDMPU(I,J)
1160,1161c1223,1224
<         V(I,K,J)=V(I,K,J)+(DIV(I,K,J+1)-DIV(I,K,J-1))                   &
<      &                    *RDPDY*DDMPV(I,J)
---
>         V(I,K,J)=V(I,K,J)+(DIV(I,K,J+1)-DIV(I,K,J-1))                  &
>                           *RDPDY*DDMPV(I,J)
DONE module_IGWAVE_ADJUST.F
COMPARE module_INDX.F
DONE module_INDX.F
COMPARE module_MPP.F
DONE module_MPP.F
COMPARE module_MPPINIT.F
DONE module_MPPINIT.F
COMPARE module_NMM_CONSTANTS.F
DONE module_NMM_CONSTANTS.F
COMPARE module_NONHY_DYNAM.F
487a488,495
> !     if(i.eq.61.and.j.eq.55.and.k.eq.50)then
> !       write(0,33711)t_k(k),rtop_k(k),dptl,koff
> !       write(0,33712)chi(k),pstr(k),pint_k(k)
> !       write(0,33713)chi(k-1),pstr(k-1),pint_k(k-1)
> 33711   format(' t_k=',z8,' rtop_k=',z8,' dptl=',z8,' koff=',i2)
> 33712   format(' chi=',z8,' pstr=',z8,' pint_k=',z8)
> 33713   format(' chi-=',z8,' pstr-=',z8,' pint_k-=',z8)
> !     endif
649a658,663
> !     if(i.eq.61.and.j.eq.55.and.k.eq.49)then
> !       write(0,77401)dz,rtop(i,k,j),rg,w(i,k,j)
> !       write(0,77402)deta1(k),deta2(k),pdtop,pdslo(i,j)
> 77401   format(' 1 dz=',z8,' rtop=',z8,' rg=',z8,' w=',z8)
> 77402   format(' deta1=',z8,' deta2=',z8,' pdtop=',z8,' pdslo=',z8)
> !     endif
664a679,682
> !     if(i.eq.61.and.j.eq.55.and.k.eq.50)then
> !       write(0,77411)w(i,k+1,j),w(i,k,j),rdt
> 77411   format(' 2 w=',2(1x,z8),' rdt=',z8)
> !     endif
680a699,704
> !     if(i.eq.61.and.j.eq.55.and.k.eq.50)then
> !       write(0,77421)w(i,k,j),z(i,k-1,j),z(i,k,j),petdt(i,k-1,j)
> !       write(0,77422)z(i,k+1,j),petdt(i,k,j)
> 77421   format(' 3 w=',z8,' z=',2(1x,z8),' petdt-=',z8)
> 77422   format(' z+=',z8,' petdt=',z8)
> !     endif
930a955,960
> !     if(i.eq.61.and.j.eq.55.and.k.eq.50)then
> !       write(0,77451)zew(i,k),ive(j),ivw(j),Z(I+IVE(J),K,J),Z(I+IVW(J),K,J)
> !       write(0,77452)UDY_00(I,K),DPDE(I+IVW(J),K,J1_00),DPDE(I+IVE(J),K,J1_00)
> 77451   format(' zew=',z8,' ive=',i2,' ivw=',i2,' z=',2(1x,z8))
> 77452   format(' udy=',z8,' dpde=',2(1x,z8))
> !     endif
965a996,1005
> !     if(i.eq.61.and.j.eq.55.and.k.eq.50)then
> !       write(0,72851)w(i,k,j),ihe(j),ihw(j),dpde(i,k,j1_00),fad(i,j)
> !       write(0,72852)ZEW(I+IHW(J),K),ZEW(I+IHE(J),K) &
> !                    ,ZNS(I,K,J4_M1),ZNS(I,K,J4_P1)
> !       write(0,72853)ZNE(I+IHW(J),K,J5_M1),ZNE(I,K,J5_00) &
> !                    ,ZSE(I,K,J6_00),ZSE(I+IHW(J),K,J6_P1)
> 72851   format(' w=',z8,' ihe=',i2,' ihw=',i2,' dpde=',z8,' fad=',z8)
> 72852   format(' zew=',2(1x,z8),' zns=',2(1x,z8))
> 72853   format(' zne=',2(1x,z8),' zse=',2(1x,z8))
> !     endif
DONE module_NONHY_DYNAM.F
COMPARE module_PHYS.F
DONE module_PHYS.F
COMPARE module_TIMERS.F
DONE module_TIMERS.F
COMPARE module_ZEROX.F
DONE module_ZEROX.F
COMPARE read_nmm.F
606c606
<    READ(NFCST)(((hold(I,J,N),I=IDS,IDE),J=JDS,JDE),N=1,NSOIL)
---
> !  READ(NFCST)(((hold(I,J,N),I=IDS,IDE),J=JDS,JDE),N=1,NSOIL)
610,611c610,611
<        sh2o(i,k,j)=hold(i,j,k)
< !      sh2o(i,k,j)=0.05
---
> !      sh2o(i,k,j)=hold(i,j,k)
>        sh2o(i,k,j)=0.05
DONE read_nmm.F
COMPARE solve_nmm.F
27a28,29
> !JM_EXP      USE MODULE_BC_NMM
> !!    USE MODULE_MICROPHYSICS
29a32,38
> !jm      USE MODULE_CTLBLK
> !jm      USE MODULE_LOOPS
> !jm      USE MODULE_MASKS
> !jm      USE MODULE_VRBLS
> !jm      USE MODULE_CONTIN
> !jm      USE MODULE_DYNAM
> !jm      USE MODULE_PVRBLS
30a40,42
> !jm      USE MODULE_CLDWTR
> !jm      USE MODULE_SOIL
> !jm      USE MODULE_NHYDRO
35a48
> !!!!!tlb
36a50
> !!!!!tlb
39a54,60
> !jw      INTERFACE EXCH
> !jw        MODULE PROCEDURE EXCH0,EXCH00,EXCH01,EXCH011,EXCH0001111       &
> !jw                        ,EXCH1,EXCH11,EXCH111,EXCH1111,EXCH11111       &
> !jw                        ,EXCH111111,EXCH1111111,IEXCH
> !jw      END INTERFACE
> !----------------------------------------------------------------------
> !***  PHYSICS DRIVERS
40a62,67
> !!    INTERFACE
> !!      INCLUDE 'physics_drive.int'
> !!    END INTERFACE
> !----------------------------------------------------------------------
> !----------------------------------------------------------------------
> !
76a104,109
> !  REAL,DIMENSION(grid%sm31:grid%em31,grid%sm33:grid%em33) :: PBLH     &
> !                                                            ,TOTLWDN  &
> !                                                            ,TOTSWDN
> !  REAL,DIMENSION(grid%sm31:grid%em31,grid%sm32:grid%em32,             &
> !    &            grid%sm33:grid%em33) :: W0AVG
> !  real,save,dimension(-5:96,-5:150) :: savswdn,savlwdn
82c115
<       integer :: iret,nlen
---
>       integer :: nlen
91c124
<       real :: btim,btimx
---
>       real :: btim,btimx,t_in,t_dif
243a277,281
> !      write(0,*)' grid%=',grid%sm31,grid%em31,grid%sm33,grid%em33
> !      write(0,11088)totswdn(isee,jsee),ntsd
> 11088 format(' enter solv totswdn=',z8,' ntsd=',i5)
> !      write(0,*)' solve idtad=',idtad,' nrads=',nrads,' nradl=',nradl
> !      write(0,*)' enter solve z0=',z0(isee,jsee)
262a301,326
> 
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = 1,kde
> write(0,*) 'entering solve '
> write(0,*) 'entering solve T ',k, k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'entering solve U ',k, k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'entering solve V ',k, k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'entering solve W ',k, k, W(IDEBUG,k,JDEBUG)
> write(0,*) 'entering solve Q ',k, k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'entering solve Q2 ',k, k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'entering solve PINT ',k, k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'entering solve CWM ',k, k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'entering solve DIV ',k, DIV(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
> 
> !
> !      write(0,*)' ids=',ids,' jds=',jds,' kds=',kds
> !      write(0,*)' ide=',ide,' jde=',jde,' kde=',kde
> !      write(0,*)' ims=',ims,' jms=',jms,' kms=',kms
> !      write(0,*)' ime=',ime,' jme=',jme,' kme=',kme
> !      write(0,*)' its=',its,' jts=',jts,' kts=',kts
> !      write(0,*)' ite=',ite,' jte=',jte,' kte=',kte
265a330,332
>       if(mype.eq.2)then
> !        write(0,*)' ntsd=',ntsd,' t(15,58)=',t(60,1,58),' t(13,68)=',t(58,1,68)
>       endif
266a334,348
> !jw   btim=timef()
> !jw need to add the following array to HALO:
> !jw     2D - PD
> !jw stencil needs to go at least 1 point in the x-dir and 2 in y
> !jw   CALL EXCH(PD,1,1,2                                               &
> !jw            ,IMS,IME,JMS,JME,KMS,KME)
> !!!!!!!!!!!!!!!!!#ifdef DM_PARALLEL
> !!!!!!!!!!!!!!!!!#     include "HALO_NMM_D.inc"
> !!!!!!!!!!!!!!!!!#endif
> !jw   exch_tim=exch_tim+timef()-btim
> !
> !     PDTEDT contains a call to EXCH
> !
> !jw   btim=timef()
> 
274,275c356,357
<       if(mype.eq.n_t)then
<         t_in=t(i_t,1,j_t)
---
>       if(mype.eq.2)then
>         t_in=t(58,1,68)
291a374,377
>       if(mype.eq.2)then
>         t_dif=t(58,1,68)-t_in
>         write(71)t_dif
>       endif
292a379,383
> !     if(mype.eq.2)then
> !       write(0,21234)t(isee,ksee,jsee) &
> !    &,             pint(isee,ksee+1,jsee),pint(isee,ksee,jsee)
> 21234 format(' after PDTEDT t=',z8,' pint=',2(1x,z8))
> !     endif
321a413,432
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = 1,kde
> write(0,*) '9469: '
> write(0,*) '469: T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) '469: U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) '469: V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) '469: W ',k, W(IDEBUG,k,JDEBUG)
> write(0,*) '469: Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) '469: Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) '469: PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) '469: CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) '469: PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> write(0,*) '469: DIV   ',k, DIV(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
> 
> 
323a435,437
>       if(mype.eq.2)then
>         t_in=t(58,1,68)
>       endif
339a454,457
>       if(mype.eq.2)then
>         t_dif=t(58,1,68)-t_in
>         write(72)t_dif
>       endif
341a460
> !jw   adve_tim=adve_tim+timef()-btim
342a462,484
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = kds,kde
> write(0,*) '500: '
> write(0,*) '500: T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) '500: U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) '500: V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) '500: W ',k, W(IDEBUG,k,JDEBUG)
> write(0,*) '500: Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) '500: Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) '500: PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) '500: CWM ',k, CWM(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
> !     if(mype.eq.2)then
> !        write(0,20235)t(isee,ksee,jsee),u(isee,ksee,jsee) &
> !     &,                               v(isee,ksee,jsee)
> 20235 format(' after ADVE t=',z8,' u=',z8,' v=',z8)
> !     endif
> 
> !
361a504,521
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = kds,kde
> write(0,*) '532: '
> write(0,*) '532: T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) '532: U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) '532: V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) '532: W ',k, W(IDEBUG,k,JDEBUG)
> write(0,*) '532: Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) '532: Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) '532: PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) '532: CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) '532: PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
> 
366a527,539
> !jw   btim=timef()
> !jw need to add the following arrays to HALO:
> !jw     3D - U,V,Z
> !jw stencil needs to go at least 1 point in the x-dir and 2 in y
> !jw   CALL EXCH(U,LM,V,LM,Z,LM+1,1,2                                   &
> !jw            ,IMS,IME,JMS,JME,KMS,KME)
> !!!!!!!!!!!!!!!!#ifdef DM_PARALLEL
> !!!!!!!!!!!!!!!!#     include "HALO_NMM_G.inc"
> !!!!!!!!!!!!!!!!#endif
> !jw   exch_tim=exch_tim+timef()-btim
> !
> !jw   btim=timef()
> 
386a560
> !jw   hadz_tim=hadz_tim+timef()-btim
387a562,579
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = kds,kde
> write(0,*) '580: '
> write(0,*) '580: T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) '580: U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) '580: V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) '580: W ',k, W(IDEBUG,k,JDEBUG)
> write(0,*) '580: Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) '580: Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) '580: PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) '580: CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) '580: PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
> 
392a585,597
> !jw   btim=timef()
> !jw need to add the following array to HALO:
> !jw     3D - W
> !jw stencil needs to go at least 1 point in the x-dir and 2 in y
> !jw   CALL EXCH(W,LM+1,1,2                                             &
> !jw            ,IMS,IME,JMS,JME,KMS,KME)
> !!!!!!!!!!!!!!!!!!#ifdef DM_PARALLEL
> !!!!!!!!!!!!!!!!!!#     include "HALO_NMM_H.inc"
> !!!!!!!!!!!!!!!!!!#endif
> !jw   exch_tim=exch_tim+timef()-btim
> !
> !jw   btim=timef()
> 
399,400c604,605
<       if(mype.eq.n_t)then
<         t_in=t(i_t,1,j_t)
---
>       if(mype.eq.2)then
>         t_in=t(58,1,68)
415a621,624
>       if(mype.eq.2)then
>         t_dif=t(58,1,68)-t_in
>         write(73)t_dif
>       endif
417a627
> !jw   eps_tim=eps_tim+timef()-btim
423a634,662
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> write(0,*) '635: DT,DY,PDTOP ',DT,DY_NMM,PDTOP
> write(0,*) '635: DX ', DX_NMM(IDEBUG,JDEBUG)
> write(0,*) '635: HBM2 ', HBM2(IDEBUG,JDEBUG)
> write(0,*) '635: PDSL ', PDSL(IDEBUG,JDEBUG)
> write(0,*) '635: LMH ', LMH(IDEBUG,JDEBUG)
> do k = kds,kde
> write(0,*) '635: '
> write(0,*) '635: T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) '635: U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) '635: V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) '635: W ',k, W(IDEBUG,k,JDEBUG)
> write(0,*) '635: Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) '635: Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) '635: PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) '635: CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) '635: PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> write(0,*) '635: CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) '635: Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) '635: AETA1 ',k, AETA1(k)
> write(0,*) '635: AETA2 ',k, AETA2(k)
> write(0,*) '635: DETA1 ',k, DETA1(k)
> write(0,*) '635: DETA2 ',k, DETA2(k)
> enddo
> endif
> #endif
> 
424a664,666
> !     write(0,21235)q(isee,ksee,jsee),cwm(isee,ksee,jsee) &
> !    &,            q2(isee,ksee+1,jsee)
> 21235 format(' before VAD2 q=',z8,' cwm=',z8,' q2=',z8)
439a682,699
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = kds,kde
> write(0,*) 'after vad2: '
> write(0,*) 'after vad2: T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'after vad2: U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'after vad2: V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'after vad2: W ',k, W(IDEBUG,k,JDEBUG)
> write(0,*) 'after vad2: Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'after vad2: Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'after vad2: PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'after vad2: CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'after vad2: PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
> 
440a701,705
> !     if(mype.eq.2)then
> !        write(0,21236)q(isee,ksee,jsee),cwm(isee,ksee,jsee) &
> !     &,              q2(isee,ksee+1,jsee)
> 21236 format(' after VAD2 q=',z8,' cwm=',z8,' q2=',z8)
> !     endif
443a709,720
> !jw     btim=timef()
> !jw need to add the following arrays to HALO:
> !jw     3D - Q,Q2,CWM
> !jw stencil needs to go at least 2 points in the x-dir and 3 in y
> !jw     CALL EXCH(Q,LM,Q2,LM,CWM,LM,2,3                                &
> !jw              ,IMS,IME,JMS,JME,KMS,KME)
> !!!!!!!!!!!!!!!!!!#ifdef DM_PARALLEL
> !!!!!!!!!!!!!!!!!!#       include "HALO_NMM_I.inc"
> !!!!!!!!!!!!!!!!!!#endif
> !jw     exch_tim=exch_tim+timef()-btim
> !
> !jw     btim=timef()
469a747,753
> !jw     had2_tim=had2_tim+timef()-btim
> !     if(mype.eq.2)then
> !       write(0,21237)q(isee,ksee,jsee),cwm(isee,ksee,jsee) &
> !    &,              q2(isee,ksee+1,jsee),q2(isee,ksee,jsee)
> 21237 format(' after HAD2 q=',z8,' cwm=',z8,' q2=',2(z8,1x))
> !     write(0,*)' after HAD2 z=',z(isee,jsee,ksee)
> !     endif
471a756,816
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = kds,kde
> write(0,*) 'after had2 '
> write(0,*) 'after had2 T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'after had2 U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'after had2 V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'after had2 Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'after had2 Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'after had2 PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'after had2 CWM  ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'after had2 PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> write(0,*) 'after had2 RLWTT ',k, RLWTT(IDEBUG,k,JDEBUG)
> write(0,*) 'after had2 RSWTT ',k, RSWTT(IDEBUG,k,JDEBUG)
> write(0,*) 'after had2 PINT ',k, PINT(IDEBUG,k,JDEBUG)
> enddo
> write(0,*) 'after had2 ALBEDO ', ALBEDO(IDEBUG,JDEBUG)
> write(0,*) 'after had2 EPSR ', EPSR(IDEBUG,JDEBUG)
> write(0,*) 'after had2 GLAT ', GLAT(IDEBUG,JDEBUG)
> write(0,*) 'after had2 GLON ', GLON(IDEBUG,JDEBUG)
> write(0,*) 'after had2 HBM2 ', HBM2(IDEBUG,JDEBUG)
> write(0,*) 'after had2 PD ', PD(IDEBUG,JDEBUG)
> write(0,*) 'after had2 RES ', RES(IDEBUG,JDEBUG)
> write(0,*) 'after had2 SM ', SM(IDEBUG,JDEBUG)
> write(0,*) 'after had2 SNOW ', SNOW(IDEBUG,JDEBUG)
> write(0,*) 'after had2 THS ', THS(IDEBUG,JDEBUG)
> write(0,*) 'after had2 VEGFRC ', VEGFRC(IDEBUG,JDEBUG)
> write(0,*) 'after had2 ACFRCV ', ACFRCV(IDEBUG,JDEBUG)
> write(0,*) 'after had2 ACFRST ', ACFRST(IDEBUG,JDEBUG)
> write(0,*) 'after had2 HBOT ', HBOT(IDEBUG,JDEBUG)
> write(0,*) 'after had2 HTOP ', HTOP(IDEBUG,JDEBUG)
> write(0,*) 'after had2 RLWIN ', RLWIN(IDEBUG,JDEBUG)
> write(0,*) 'after had2 RLWTOA ', RLWTOA(IDEBUG,JDEBUG)
> write(0,*) 'after had2 RSWIN ', RSWIN(IDEBUG,JDEBUG)
> write(0,*) 'after had2 RSWOUT ', RSWOUT(IDEBUG,JDEBUG)
> write(0,*) 'after had2 RSWTOA ', RSWTOA(IDEBUG,JDEBUG)
> write(0,*) 'after had2 CFRACH ', CFRACH(IDEBUG,JDEBUG)
> write(0,*) 'after had2 CFRACM ', CFRACM(IDEBUG,JDEBUG)
> write(0,*) 'after had2 CZMEAN ', CZMEAN(IDEBUG,JDEBUG)
> write(0,*) 'after had2 SIGT4 ', SIGT4(IDEBUG,JDEBUG)
> write(0,*) 'after had2 TOTLWDN ', TOTLWDN(IDEBUG,JDEBUG)
> write(0,*) 'after had2 TOTSWDN ', TOTSWDN(IDEBUG,JDEBUG)
> write(0,*) 'after had2 RESTRT ', RESTRT
> write(0,*) 'after had2 LMH ', LMH(IDEBUG,JDEBUG)
> write(0,*) 'after had2 NCFRCV ',NCFRCV(IDEBUG,JDEBUG)
> write(0,*) 'after had2 NCFRST ',NCFRST(IDEBUG,JDEBUG)
> write(0,*) 'after had2 CUPPT ',CUPPT(IDEBUG,JDEBUG)
> write(0,*) 'after had2 DT,PDTOP,PT ',DT,PDTOP,PT
> write(0,*) 'after had2 NTSD,DT,JULDAY,JULYR,IHRST ',NTSD,DT,JULDAY,JULYR,IHRST
> do k = kts,kte
> write(0,*) 'after had2 k,ETA1 ',ETA1(k)
> write(0,*) 'after had2 k,ETA2 ',ETA2(k)
> write(0,*) 'after had2 k,AETA1 ',AETA1(k)
> write(0,*) 'after had2 k,AETA2 ',AETA2(k)
> write(0,*) 'after had2 k,DETA1 ',DETA1(k)
> write(0,*) 'after had2 k,DETA2 ',DETA2(k)
> enddo
> endif
> #endif
> 
477a823,826
> !jw     btim=timef()
> !jw  commenting call out for dry run -- however, if we uncomment it we
> !jw  either have to resolve the differences between this radiation driver
> !jw  and the one under subdirectory phys
484d832
<      &                ,F_ICE,F_RAIN                                    &
496a845,878
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = 1, kde
> write(0,*) 'after RADIATION '
> write(0,*) 'after RADIATION T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'after RADIATION U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'after RADIATION V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'after RADIATION Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'after RADIATION Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'after RADIATION PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'after RADIATION CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'after RADIATION PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> write(0,*) 'after RADIATION RLWTT ',k, RLWTT(IDEBUG,k,JDEBUG)
> write(0,*) 'after RADIATION RSWTT ',k, RLWTT(IDEBUG,k,JDEBUG)
> enddo
> write(0,*) 'after RADIATION CZMEAN ', CZMEAN(IDEBUG,JDEBUG)
> write(0,*) 'after RADIATION GLAT ', GLAT(IDEBUG,JDEBUG)
> write(0,*) 'after RADIATION GLON ', GLON(IDEBUG,JDEBUG)
> write(0,*) 'after RADIATION HBM2 ', HBM2(IDEBUG,JDEBUG)
> write(0,*) 'after RADIATION NTSD,DT,JULDAY,JULYR,IHRST ',NTSD,DT,JULDAY,JULYR,IHRST
> endif
> #endif
> !     if(mype.eq.2)then
> !        write(0,47822)cuppt(isee,jsee)
> 47822 format(' after RADIATION cuppt=',z8)
> !     endif
> !!!     do j=jms,jme
> !!!     do i=ims,ime
> !!!       savswdn(i,j)=totswdn(i,j)
> !!!       savlwdn(i,j)=totlwdn(i,j)
> !!!     enddo
> !!!     enddo
>       ENDIF
501a884,886
> !     if(mype.eq.2)then
> !       t_in=t(58,1,68)
> !     endif
508a894,897
> !     if(mype.eq.2)then
> !       t_dif=t(58,1,68)-t_in
> !       write(74)t_dif
> !     endif
509a899,928
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = 1,kde
> write(0,*) 'after RDTEMP '
> write(0,*) 'after RDTEMP T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'after RDTEMP U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'after RDTEMP V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'after RDTEMP Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'after RDTEMP Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'after RDTEMP PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'after RDTEMP CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'after RDTEMP PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> write(0,*) 'after RDTEMP RLWTT ',k, RLWTT(IDEBUG,k,JDEBUG)
> write(0,*) 'after RDTEMP RSWTT ',k, RLWTT(IDEBUG,k,JDEBUG)
> enddo
> write(0,*) 'after RDTEMP CZEN ', CZEN(IDEBUG,JDEBUG)
> endif
> #endif
> 
> !!!   do j=jms,jme
> !!!   do i=ims,ime
> !!!     totswdn(i,j)=savswdn(i,j)
> !!!     totlwdn(i,j)=savlwdn(i,j)
> !!!   enddo
> !!!   enddo
> !     if(mype.eq.2)then
> !       write(0,21238)t(isee,ksee,jsee),totswdn(isee,jsee),ntsd
> 21238 format(' after RDTEMP t=',z8,' totswdn=',z8,' ntsd=',i5)
> !     endif
514a934,937
> !tlb  IF(MOD(NTSD-1,NPHS).EQ.0)THEN
> !     if(mype.eq.2)then
> !       t_in=t(58,1,68)
> !     endif
515a939,952
> !jw     btim=timef()
> !jw need to add the following arrays to HALO:
> !jw     2D - PD,UZ0,VZ0
> !jw     3D - T,Q,CWM
> !jw stencil needs to go at least 1 point in the x-dir and 1 in y
> !jw     CALL EXCH(PD,1,T,LM,1,1                                        &
> !jw              ,IMS,IME,JMS,JME,KMS,KME)
> !jw     CALL EXCH(Q,LM,CWM,LM,1,1                                      &
> !jw              ,IMS,IME,JMS,JME,KMS,KME)
> !jw     CALL EXCH(UZ0,1,VZ0,1,1,1                                      &
> !jw              ,IMS,IME,JMS,JME,KMS,KME)
> !!!!!!!!!!!!!!!!!!!!!!!#ifdef DM_PARALLEL
> !!!!!!!!!!!!!!!!!!!!!!!#       include "HALO_NMM_J.inc"
> !!!!!!!!!!!!!!!!!!!!!!!#endif
527c964
<      &            ,THZ0,QZ0,UZ0,VZ0,QS,MOL                             &
---
>      &            ,THZ0,QZ0,UZ0,VZ0,QS                                 &
545,548d981
<       call exit('turbl',t,q,u,v,q2,cwm,htm,vtm,iret &
<      &         ,ids,ide,jds,jde,kds,kde             &
<      &         ,ims,ime,jms,jme,kms,kme             &
<      &         ,its,ite,jts,jte,kts,kte)
549a983,999
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = 1, kde
> write(0,*) 'after TURBL '
> write(0,*) 'after TURBL T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'after TURBL U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'after TURBL V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'after TURBL Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'after TURBL Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'after TURBL PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'after TURBL CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'after TURBL PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
> 
552a1003,1018
> !     if(mype.eq.2)then
> !        write(0,22238)t(isee,ksee,jsee),q(isee,ksee,jsee),ntsd
> !        write(0,22339)q2(isee,ksee+1,jsee),q2(isee,ksee,jsee)
> !        write(0,23238)u(isee,ksee,jsee),v(isee,ksee,jsee)
> 22238 format(' after TURBL t=',z8,' q=',z8,' ntsd=',i5)
> 22339 format(' after TURBL q2=',2(z8,1x))
> 23238 format(' after TURBL u=',z8,' v=',z8)
> !     endif
> !     if(ntsd.eq.0)then
> !       do j=jts,jte
> !       do i=its,ite
> !         write(0,*)' i=',i,' j=',j,' t=',t(i,1,j),' q=',q(i,1,j) &
> !    &             ,' u=',u(i,1,j),' v=',v(i,1,j)
> !       enddo
> !       enddo
> !     endif
555a1022
> !jw     btim=timef()
562a1030
> 
570a1039,1054
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = 1,kde
> write(0,*) 'after 0th CLTEND '
> write(0,*) 'after 0th CLTEND T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'after 0th CLTEND U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'after 0th CLTEND V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'after 0th CLTEND Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'after 0th CLTEND Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'after 0th CLTEND PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'after 0th CLTEND CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'after 0th CLTEND PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
571a1056
> !jw     cltend_tim=cltend_tim+timef()-btim
572a1058,1061
>       if(mype.eq.2)then
>         t_dif=t(58,1,68)-t_in
>         write(75)t_dif
>       endif
584c1073
<      &             ,OMGALF,U,V,VTM,W0AVG                               & !for K-F
---
> !!!  &             ,OMGALF,U,V,VTM,W0AVG                               & !for K-F
587,588c1076,1077
<      &             ,AVCNVC,ACUTIM,ZERO_3D,IHE,IHW                      & !for K-F
< !!!  &             ,AVCNVC,ACUTIM,ZERO_3D                              & !for BMJ
---
> !!!  &             ,AVCNVC,ACUTIM,ZERO_3D,IHE,IHW                      & !for K-F
>      &             ,AVCNVC,ACUTIM,ZERO_3D                              & !for BMJ
593a1083,1098
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = 1,kde
> write(0,*) 'after CUCNVC '
> write(0,*) 'after CUCNVC T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'after CUCNVC U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'after CUCNVC V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'after CUCNVC Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'after CUCNVC Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'after CUCNVC PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'after CUCNVC CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'after CUCNVC PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
596a1102,1109
> !     if(mype.eq.2)then
> !        write(0,24238)t(isee,ksee,jsee),q(isee,ksee,jsee)
> 24238 format(' after CUCNVC t=',z8,' q=',z8)
> !        write(0,20239)cuppt(isee,jsee),cuprec(isee,jsee) &
> !    &,             acprec(isee,jsee),prec(isee,jsee)
> 20239 format(' after CUCNVC cuppt=',z8,' cuprec=',z8,' acprec=',z8 &
>      &,        ' prec=',z8)
> !     endif
601a1115
> !tlb  IF(MOD(NTSD-1,NPHS).EQ.0)THEN
614a1129,1151
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = 1,kde
> write(0,*) 'after GSMDRIVE '
> write(0,*) 'after GSMDRIVE T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'after GSMDRIVE U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'after GSMDRIVE V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'after GSMDRIVE Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'after GSMDRIVE Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'after GSMDRIVE PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'after GSMDRIVE CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'after GSMDRIVE PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
> !       gsmdrive_tim=gsmdrive_tim+timef()-btim
> !     if(mype.eq.2)then
> !        write(0,22338)t(isee,ksee,jsee),ntsd
> !        write(0,23338)q(isee,ksee,jsee),cwm(isee,ksee,jsee)
> 22338 format(' after GSMDRIVE t=',z8,' ntsd=',i5)
> 23338 format(' after GSMDRIVE q=',z8,' cwm=',z8)
> !     endif
626a1164,1179
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = 1,kde
> write(0,*) 'after 1st CLTEND '
> write(0,*) 'after 1st CLTEND T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'after 1st CLTEND U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'after 1st CLTEND V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'after 1st CLTEND Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'after 1st CLTEND Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'after 1st CLTEND PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'after 1st CLTEND CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'after 1st CLTEND PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
627a1181
> !       cltend_tim=cltend_tim+timef()-btim
628a1183
> !     write(0,*)' pe',mype,' before CLTEND 1 ntsd=',ntsd
633a1189
> !jw   btim=timef()
641a1198,1271
> !     if(mype.eq.2)then
> !        write(0,21231)t(isee,ksee,jsee)
> 21231 format(' after CLTEND1 t=',z8)
> !     endif
> !!!!tlb  for 3-D check
> !     if(mod(ntsd,180).eq.0.or. &
> !    &   mod(ntsd-1,180).eq.0.or.  &
> !    &   mod(ntsd+1,180).eq.0)then
> !       call wrf_get_dm_communicator(MPI_COMM_COMP)
> !       call wrf_get_nproc(npes)
> !     write(0,*)' mype=',mype,' ims=',ims,' ime=',ime &
> !    &,         ' jms=',jms,' jme=',jme,' kms=',kms,' kme=',kme
> !     write(0,*)' mype=',mype,' ids=',ids,' ide=',ide &
> !    &,         ' jds=',jds,' jde=',jde,' kds=',kds,' kde=',kde
> !     write(0,*)' mype=',mype,' its=',its,' ite=',ite &
> !    &,         ' jts=',jts,' jte=',jte,' kts=',kts,' kte=',kte
> !     write(0,*)' mype=',mype,' ips=',ips,' ipe=',ipe &
> !    &,         ' jps=',jps,' jpe=',jpe,' kps=',kps,' kpe=',kpe
> !       call twr(t,0,'t',ntsd,mype,npes,MPI_COMM_COMP &
> !    &          ,ids,ide,jds,jde,kds,kde   &
> !    &          ,ims,ime,jms,jme,kms,kme   &
> !    &          ,its,ite,jts,jte,kts,kte)
> !     call mpi_barrier(MPI_COMM_COMP,irtn)
> !       call twr(q,0,'q',ntsd,mype,npes,MPI_COMM_COMP &
> !    &          ,ids,ide,jds,jde,kds,kde   &
> !    &          ,ims,ime,jms,jme,kms,kme   &
> !    &          ,its,ite,jts,jte,kts,kte)
> !     call mpi_barrier(MPI_COMM_COMP,irtn)
> !       call vwr(u,'u',ntsd,mype,npes,MPI_COMM_COMP &
> !    &          ,ids,ide,jds,jde,kds,kde   &
> !    &          ,ims,ime,jms,jme,kms,kme   &
> !    &          ,its,ite,jts,jte,kts,kte)
> !     call mpi_barrier(MPI_COMM_COMP,irtn)
> !       call vwr(v,'v',ntsd,mype,npes,MPI_COMM_COMP &
> !    &          ,ids,ide,jds,jde,kds,kde   &
> !    &          ,ims,ime,jms,jme,kms,kme   &
> !    &          ,its,ite,jts,jte,kts,kte)
> !     call mpi_barrier(MPI_COMM_COMP,irtn)
> !     endif
> !!!!tlb  for 3-D check
> !!!!tlb for visualization
> !     if(mod(ntsd,180).eq.0.and.ntsd.gt.0)then
> !       call wrf_get_dm_communicator(MPI_COMM_COMP)
> !       call wrf_get_nproc(npes)
> !       call twr2d(acprec,'bmj_acprec',ntsd,mype,npes,MPI_COMM_COMP &
> !    &            ,ids,ide,jds,jde,kds,kde   &
> !    &            ,ims,ime,jms,jme,kms,kme   &
> !    &            ,its,ite,jts,jte,kts,kte)
> !     call mpi_barrier(MPI_COMM_COMP,irtn)
> !
> !       call twr2d(cuprec,'bmj_cuprec',ntsd,mype,npes,MPI_COMM_COMP &
> !    &            ,ids,ide,jds,jde,kds,kde   &
> !    &            ,ims,ime,jms,jme,kms,kme   &
> !    &            ,its,ite,jts,jte,kts,kte)
> !     call mpi_barrier(MPI_COMM_COMP,irtn)
> !
> !     endif
> !!!!tlb for visualization
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k =1,kde
> write(0,*) 'after 2nd CLTEND '
> write(0,*) 'after 2nd CLTEND T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'after 2nd CLTEND U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'after 2nd CLTEND V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'after 2nd CLTEND Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'after 2nd CLTEND Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'after 2nd CLTEND PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'after 2nd CLTEND CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'after 2nd CLTEND PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
642a1273
> !jw   cltend_tim=cltend_tim+timef()-btim
647a1279,1294
> !jw   btim=timef()
> !jw need to add the following arrays to HALO:
> !jw     3D - T,U,V,Q,Q2
> !jw stencil needs to go at least 2 points in the x-dir and 2 in y
> !jw               except Q2      1 point  in the x-dir and 1 in y
> !jw   CALL EXCH(T,LM,U,LM,V,LM,Q,LM,2,2                                &
> !jw            ,IMS,IME,JMS,JME,KMS,KME)
> !jw   CALL EXCH(Q2,LM,1,1                                              &
> !jw            ,IMS,IME,JMS,JME,KMS,KME)
> !!!!!!!!!!!!!!!!!!!!!!!!#ifdef DM_PARALLEL
> !!!!!!!!!!!!!!!!!!!!!!!!#     include "HALO_NMM_K.inc"
> !!!!!!!!!!!!!!!!!!!!!!!!#endif
> !jw   exch_tim=exch_tim+timef()-btim
> !
> !jw   btim=timef()
> 
653a1301,1316
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = 1,kde
> write(0,*) 'before hdiff '
> write(0,*) 'before hdiff T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'before hdiff U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'before hdiff V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'before hdiff Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'before hdiff Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'before hdiff PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'before hdiff CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'before hdiff PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
654a1318,1320
>       if(mype.eq.2)then
>         t_in=t(58,1,68)
>       endif
663a1330,1333
>       if(mype.eq.2)then
> !        t_dif=t(58,1,68)-t_in
> !        write(76)t_dif
>       endif
664a1335,1341
> !jw   hdiff_tim=hdiff_tim+timef()-btim
> !     if(mype.eq.2)then
> !     write(0,21232)t(isee,ksee,jsee),q(isee,ksee,jsee)
> !     write(0,20232)u(isee,ksee,jsee),v(isee,ksee,jsee)
> 21232 format(' after HDIFF t=',z8,' q=',z8)
> 20232 format(' after HDIFF u=',z8,' v=',z8)
> !     endif
669a1347,1361
> !jw   btim=timef()
> !jw need to add the following arrays to HALO:
> !jw     2D - PD
> !jw     3D - T,Q,CWM,Q2
> !jw stencil needs to go at least 1 point in the x-dir and 1 in y
> !jw   CALL EXCH(PD,1,1,1                                               &
> !jw            ,IMS,IME,JMS,JME,KMS,KME)
> !jw   CALL EXCH(T,LM,Q,LM,CWM,LM,Q2,LM,1,1                             &
> !jw            ,IMS,IME,JMS,JME,KMS,KME)
> !!!!!!!!!!!!!!!!!!!!!!!#ifdef DM_PARALLEL
> !!!!!!!!!!!!!!!!!!!!!!!#     include "HALO_NMM_L.inc"
> !!!!!!!!!!!!!!!!!!!!!!!#endif
> !jw   exch_tim=exch_tim+timef()-btim
> !
> !jw   btim=timef()
678a1371,1387
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = 1,kde
> write(0,*) 'before bocoh '
> write(0,*) 'before bocoh T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'before bocoh U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'before bocoh V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'before bocoh Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'before bocoh Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'before bocoh PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'before bocoh CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'before bocoh PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
> 
691c1400,1404
< !
---
> !     if(ntsd.ge.179)then
> !       write(0,*)' ntsd=',ntsd
> !       write(0,12971)t(1,1,19),t(2,1,19),t(3,1,19),t(4,1,19)
> 12971   format(' MESO BOCOH t=',4(z8,1x))
> !     endif
692a1406,1422
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> write(0,*) 'after bocoh '
> do k = 1,kde
> write(0,*) 'after bocoh T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'after bocoh U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'after bocoh V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'after bocoh Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'after bocoh Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'after bocoh PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'after bocoh CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'after bocoh PETDT ',k, k,PETDT(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
> 
693a1424
> !jw   bocoh_tim=bocoh_tim+timef()-btim
700a1432,1441
> !jm      IF(NTSD.EQ.0.OR.NTSD.GT.NSTART+1.OR.                             &
> !jm         NTSD.GT.1.AND.NTSD-1.EQ.NSTART+1)THEN
> !jm        btim=timef()
> !jm        CALL CHKOUT(IDS,idf,JDS,jdf,KDS,KDE                            &
> !jm                   ,IMS,IME,JMS,JME,KMS,KME                            &
> !jm                   ,ITS,ITE,JTS,JTE,KTS,KTE)
> !jm        chkout_tim=chkout_tim+timef()-btim
> !jm      ENDIF
> !
> 
701a1443
> ! jm moved from bottom to here
704a1447,1465
> !     write(0,38921)t(isee,ksee,jsee),t(isee,ksee,jsee),mype
> 38921 format(' before PFDHT t=',z8,1x,e12.5,' mype=',i2)
> !      IF(NTSD.GT.0)THEN
> !jw     btim=timef()
> !jw need to add the following arrays to HALO:
> !jw     2D - PD
> !jw     3D - T,U,V,Q,CWM,DWDT,PINT
> !jw stencil needs to go at least 1 point in the x-dir and 2 in y
> !jw     CALL EXCH(PD,1,1,2                                             &
> !jw              ,IMS,IME,JMS,JME,KMS,KME)
> !jw     CALL EXCH(T,LM,U,LM,V,LM,Q,LM,CWM,LM,DWDT,LM,PINT,LM+1,1,2     &
> !jw              ,IMS,IME,JMS,JME,KMS,KME)
> !!!!!!!!!!!!!!#ifdef DM_PARALLEL
> !!!!!!!!!!!!!!#       include "HALO_NMM_A.inc"
> !!!!!!!!!!!!!!#endif
> !jw     exch_tim=exch_tim+timef()-btim
> !
> !jw   btim=timef()
> 
708a1470
> !      ENDIF
710a1473,1511
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> write(0,*) 'after HALO_NMM_A NTSD, CPGFV,DY,PDTOP,PT ',NTSD, CPGFV,DY,PDTOP,PT
> write(0,*) 'after HALO_NMM_A CPGFU ',CPGFU(IDEBUG,JDEBUG)
> write(0,*) 'after HALO_NMM_A DX ',DX_NMM(IDEBUG,JDEBUG)
> write(0,*) 'after HALO_NMM_A DY ',DY_NMM
> write(0,*) 'after HALO_NMM_A FCP ',FCP(IDEBUG,JDEBUG)
> write(0,*) 'after HALO_NMM_A FDIV ',FDIV(IDEBUG,JDEBUG)
> write(0,*) 'after HALO_NMM_A PD ',PD(IDEBUG,JDEBUG)
> write(0,*) 'after HALO_NMM_A FIS ',FIS(IDEBUG,JDEBUG)
> write(0,*) 'after HALO_NMM_A RES ',RES(IDEBUG,JDEBUG)
> write(0,*) 'after HALO_NMM_A WPDAR ',WPDAR(IDEBUG,JDEBUG)
> write(0,*) 'after HALO_NMM_A HBM2 ',HBM2(IDEBUG,JDEBUG)
> write(0,*) 'after HALO_NMM_A VBM2 ',VBM2(IDEBUG,JDEBUG)
> write(0,*) 'after HALO_NMM_A VBM3 ',VBM3(IDEBUG,JDEBUG)
> do k = 1,kde
> write(0,*) 'after HALO_NMM_A T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A W ',k, W(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A CWM ',k,CWM(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A DWDT ',k,DWDT(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A PINT',k,PINT(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A HTM ',k,HTM(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A VTM ',k,VTM(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A DIV ',k,DIV(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A OMGALF ',k,OMGALF(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A RTOP ',k,OMGALF(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A DIV ',k, DIV(IDEBUG,k,JDEBUG)
> write(0,*) 'after HALO_NMM_A DETA1,DETA2,DFL ',k, DETA1(k),DETA2(k),DFL(k)
> enddo
> endif
> #endif
> 
712a1514,1516
>       if(mype.eq.2)then
>         t_in=t(58,1,68)
>       endif
724a1529,1538
>       if(mype.eq.2)then
> !        t_dif=t(58,1,68)-t_in
> !        write(77)t_dif
>       endif
> !jw   pfdht_tim=pfdht_tim+timef()-btim
> !     if(mype.eq.2)then
> !     write(0,21233)t(isee,ksee,jsee),u(isee,ksee,jsee) &
> !    &                               ,v(isee,ksee,jsee)
> 21233 format(' after PFDHT t=',z8,' u=',z8,' v=',z8)
> !     endif
729a1544,1556
> !jw   btim=timef()
> !jw need to add the following array to HALO:
> !jw     3D - DIV
> !jw stencil needs to go at least 1 point in the x-dir and 2 in y
> !jw   CALL EXCH(DIV,LM,1,2                                             &
> !jw            ,IMS,IME,JMS,JME,KMS,KME)
> !!!!!!!!!!!!!!!!!!!!!!#ifdef DM_PARALLEL
> !!!!!!!!!!!!!!!!!!!!!!#     include "HALO_NMM_B.inc"
> !!!!!!!!!!!!!!!!!!!!!!#endif
> !jw   exch_tim=exch_tim+timef()-btim
> !
> !jw   btim=timef()
> 
735a1563,1588
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k =1,kde
> write(0,*) '314: '
> write(0,*) '314: T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) '314: U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) '314: V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) '314: W ',k, W(IDEBUG,k,JDEBUG)
> write(0,*) '314: Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) '314: Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) '314: PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) '314: CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) '314: PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> write(0,*) '314: FEW ',k, FEW(IDEBUG,k,JDEBUG)
> write(0,*) '314: FNS ',k, FNS(IDEBUG,k,JDEBUG)
> write(0,*) '314: FNE ',k, FNE(IDEBUG,k,JDEBUG)
> write(0,*) '314: FSE ',k, FSE(IDEBUG,k,JDEBUG)
> enddo
> write(0,*) '314: PDSL ', PDSL(IDEBUG,JDEBUG)
> do k = 1,kde
> write(0,*) '314: DIV ',k, DIV(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
> 
745a1599,1603
> !jw   ddamp_tim=ddamp_tim+timef()-btim
> !     if(mype.eq.2)then
> !     write(0,21243)u(isee,ksee,jsee),v(isee,ksee,jsee)
> 21243 format(' after DDAMP u=',z8,' v=',z8)
> !     endif
762a1621,1634
> !!!!      IF(NTSD.GT.0)THEN
> !jw     btim=timef()
> !jw need to add the following arrays to HALO:
> !jw     3D - U,V
> !jw stencil needs to go at least 1 point in the x-dir and 1 in y
> !jw     CALL EXCH(U,LM,V,LM,1,1                                        &
> !jw              ,IMS,IME,JMS,JME,KMS,KME)
> !!!!!!!!!!!!!!!!!#ifdef DM_PARALLEL
> !!!!!!!!!!!!!!!!!#       include "HALO_NMM_C.inc"
> !!!!!!!!!!!!!!!!!#endif
> !jw     exch_tim=exch_tim+timef()-btim
> !
> !jw     btim=timef()
> 
768a1641,1659
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = 1,kde
> write(0,*) '368: '
> write(0,*) '368: T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) '368: U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) '368: V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) '368: W ',k, W(IDEBUG,k,JDEBUG)
> write(0,*) '368: Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) '368: Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) '368: PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) '368: CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) '368: PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> write(0,*) '368: DIV  ',k, DIV(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
> 
778a1670,1674
> !     if(ntsd.ge.179)then
> !       write(0,*)' ntsd=',ntsd
> !       write(0,12981)u(1,1,19),u(2,1,19),u(3,1,19)
> 12981   format(' MESO BOCOH u=',3(z8,1x))
> !     endif
785d1680
<       if(ntsd.ge.4318)then
788,807c1683,1701
<       write(0,*)' pdtedt_tim=',pdtedt_tim*1.e-3,' pct=',pdtedt_tim/sum_tim*100.
<       write(0,*)' adve_tim=',adve_tim*1.e-3,' pct=',adve_tim/sum_tim*100.
<       write(0,*)' vadz_tim=',vadz_tim*1.e-3,' pct=',vadz_tim/sum_tim*100.
<       write(0,*)' hadz_tim=',hadz_tim*1.e-3,' pct=',hadz_tim/sum_tim*100.
<       write(0,*)' eps_tim=',eps_tim*1.e-3,' pct=',eps_tim/sum_tim*100.
<       write(0,*)' vad2_tim=',vad2_tim*1.e-3,' pct=',vad2_tim/sum_tim*100.
<       write(0,*)' had2_tim=',had2_tim*1.e-3,' pct=',had2_tim/sum_tim*100.
<       write(0,*)' radiation_tim=',radiation_tim*1.e-3,' pct=',radiation_tim/sum_tim*100.
<       write(0,*)' rdtemp_tim=',rdtemp_tim*1.e-3,' pct=',rdtemp_tim/sum_tim*100.
<       write(0,*)' turbl_tim=',turbl_tim*1.e-3,' pct=',turbl_tim/sum_tim*100.
<       write(0,*)' cltend_tim=',cltend_tim*1.e-3,' pct=',cltend_tim/sum_tim*100.
<       write(0,*)' cucnvc_tim=',cucnvc_tim*1.e-3,' pct=',cucnvc_tim/sum_tim*100.
<       write(0,*)' gsmdrive_tim=',gsmdrive_tim*1.e-3,' pct=',gsmdrive_tim/sum_tim*100.
<       write(0,*)' hdiff_tim=',hdiff_tim*1.e-3,' pct=',hdiff_tim/sum_tim*100.
<       write(0,*)' bocoh_tim=',bocoh_tim*1.e-3,' pct=',bocoh_tim/sum_tim*100.
<       write(0,*)' pfdht_tim=',pfdht_tim*1.e-3,' pct=',pfdht_tim/sum_tim*100.
<       write(0,*)' ddamp_tim=',ddamp_tim*1.e-3,' pct=',ddamp_tim/sum_tim*100.
<       write(0,*)' bocov_tim=',bocov_tim*1.e-3,' pct=',bocov_tim/sum_tim*100.
<       write(0,*)' exch_tim=',exch_tim*1.e-3,' pct=',exch_tim/sum_tim*100.
<       endif
---
> !      write(0,*)' pdtedt_tim=',pdtedt_tim*1.e-3,' pct=',pdtedt_tim/sum_tim*100.
> !      write(0,*)' adve_tim=',adve_tim*1.e-3,' pct=',adve_tim/sum_tim*100.
> !      write(0,*)' vadz_tim=',vadz_tim*1.e-3,' pct=',vadz_tim/sum_tim*100.
> !      write(0,*)' hadz_tim=',hadz_tim*1.e-3,' pct=',hadz_tim/sum_tim*100.
> !      write(0,*)' eps_tim=',eps_tim*1.e-3,' pct=',eps_tim/sum_tim*100.
> !      write(0,*)' vad2_tim=',vad2_tim*1.e-3,' pct=',vad2_tim/sum_tim*100.
> !      write(0,*)' had2_tim=',had2_tim*1.e-3,' pct=',had2_tim/sum_tim*100.
> !      write(0,*)' radiation_tim=',radiation_tim*1.e-3,' pct=',radiation_tim/sum_tim*100.
> !      write(0,*)' rdtemp_tim=',rdtemp_tim*1.e-3,' pct=',rdtemp_tim/sum_tim*100.
> !      write(0,*)' turbl_tim=',turbl_tim*1.e-3,' pct=',turbl_tim/sum_tim*100.
> !      write(0,*)' cltend_tim=',cltend_tim*1.e-3,' pct=',cltend_tim/sum_tim*100.
> !      write(0,*)' cucnvc_tim=',cucnvc_tim*1.e-3,' pct=',cucnvc_tim/sum_tim*100.
> !      write(0,*)' gsmdrive_tim=',gsmdrive_tim*1.e-3,' pct=',gsmdrive_tim/sum_tim*100.
> !      write(0,*)' hdiff_tim=',hdiff_tim*1.e-3,' pct=',hdiff_tim/sum_tim*100.
> !      write(0,*)' bocoh_tim=',bocoh_tim*1.e-3,' pct=',bocoh_tim/sum_tim*100.
> !      write(0,*)' pfdht_tim=',pfdht_tim*1.e-3,' pct=',pfdht_tim/sum_tim*100.
> !      write(0,*)' ddamp_tim=',ddamp_tim*1.e-3,' pct=',ddamp_tim/sum_tim*100.
> !      write(0,*)' bocov_tim=',bocov_tim*1.e-3,' pct=',bocov_tim/sum_tim*100.
> !      write(0,*)' exch_tim=',exch_tim*1.e-3,' pct=',exch_tim/sum_tim*100.
808a1703,1744
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> write(0,*) '394: '
> do k = 1,kde
> write(0,*) '394: T ',k, T(IDEBUG,k,JDEBUG)
> write(0,*) '394: U ',k, U(IDEBUG,k,JDEBUG)
> write(0,*) '394: V ',k, V(IDEBUG,k,JDEBUG)
> write(0,*) '394: W ',k, W(IDEBUG,k,JDEBUG)
> write(0,*) '394: Q ',k, Q(IDEBUG,k,JDEBUG)
> write(0,*) '394: Q2 ',k, Q2(IDEBUG,k,JDEBUG)
> write(0,*) '394: PINT ',k, PINT(IDEBUG,k,JDEBUG)
> write(0,*) '394: CWM ',k, CWM(IDEBUG,k,JDEBUG)
> write(0,*) '394: PETDT ',k, PETDT(IDEBUG,k,JDEBUG)
> write(0,*) '394: DIV   ',k, DIV(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
> 
> !!!!      ENDIF
> 
> #ifdef IDEBUG
> call RSL_POINT_ON_PROC ( grid%domdesc, IDEBUG, JDEBUG, retval )
> if ( retval .eq. 1 ) then
> do k = 1,kde
> write(0,*) 'leaving solve '
> write(0,*) 'leaving solve T ', k, T(IDEBUG,K,JDEBUG)
> write(0,*) 'leaving solve U ', k, U(IDEBUG,K,JDEBUG)
> write(0,*) 'leaving solve V ', k, V(IDEBUG,K,JDEBUG)
> write(0,*) 'leaving solve W ', k, W(IDEBUG,K,JDEBUG)
> write(0,*) 'leaving solve Q ', k, Q(IDEBUG,K,JDEBUG)
> write(0,*) 'leaving solve Q2 ', k, Q2(IDEBUG,K,JDEBUG)
> write(0,*) 'leaving solve PINT ', k, PINT(IDEBUG,K,JDEBUG)
> write(0,*) 'leaving solve CWM ', k, CWM(IDEBUG,K,JDEBUG)
> write(0,*) 'leaving solve PETDT ', k, PETDT(IDEBUG,K,JDEBUG)
> write(0,*) 'leaving solve DIV ',k, DIV(IDEBUG,k,JDEBUG)
> enddo
> endif
> #endif
>       write(0,11099)totswdn(isee,jsee),ntsd
> 11099 format(' exit solv totswdn=',z8,' ntsd=',i5)
> 
821a1758,2227
> !----------------------------------------------------------------------
> !**********************************************************************
>       SUBROUTINE TWR(ARRAY,KK,FIELD,NTSD,MYPE,NPES,MPI_COMM_COMP       &
>      &              ,IDS,IDE,JDS,JDE,KDS,KDE                           &
>      &              ,IMS,IME,JMS,JME,KMS,KME                           &
>      &              ,ITS,ITE,JTS,JTE,KTS,KTE)
> !**********************************************************************
>       USE MODULE_EXT_INTERNAL
> !
>       INCLUDE "mpif.h"
> !----------------------------------------------------------------------
>       IMPLICIT NONE
> !----------------------------------------------------------------------
>       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                    &
>      &                     ,IMS,IME,JMS,JME,KMS,KME                    &
>      &                     ,ITS,ITE,JTS,JTE,KTS,KTE                    &
>      &                     ,KK,MPI_COMM_COMP,MYPE,NPES,NTSD 
> !
>       REAL,DIMENSION(IMS:IME,KMS:KME+KK,JMS:JME),INTENT(IN) :: ARRAY
> !
>       CHARACTER(*),INTENT(IN) :: FIELD
> !
> !*** LOCAL VARIABLES
> !
>       INTEGER,DIMENSION(MPI_STATUS_SIZE) :: JSTAT
>       INTEGER,DIMENSION(MPI_STATUS_SIZE,4) :: STATUS_ARRAY
>       INTEGER,DIMENSION(2) :: IM_REM,JM_REM,IT_REM,JT_REM
> !
>       INTEGER :: I,IENDX,IER,IPE,IRECV,IRTN,ISEND,IUNIT                &
>      &          ,J,K,N,NLEN,NSIZE
>       INTEGER :: ITS_REM,ITE_REM,JTS_REM,JTE_REM
> !
>       REAL,DIMENSION(IDS:IDE,JDS:JDE) :: TWRITE
>       REAL,ALLOCATABLE,DIMENSION(:) :: VALUES
>       CHARACTER(5) :: TIMESTEP
>       CHARACTER(6) :: FMT
>       CHARACTER(12) :: FILENAME
> !----------------------------------------------------------------------
> !**********************************************************************
> !----------------------------------------------------------------------
> !
>       IF(NTSD.LE.9)THEN
>         FMT='(I1.1)'
>         NLEN=1
>       ELSEIF(NTSD.LE.99)THEN
>         FMT='(I2.2)'
>         NLEN=2
>       ELSEIF(NTSD.LE.999)THEN
>         FMT='(I3.3)'
>         NLEN=3
>       ELSEIF(NTSD.LE.9999)THEN
>         FMT='(I4.4)'
>         NLEN=4
>       ELSEIF(NTSD.LE.99999)THEN
>         FMT='(I5.5)'
>         NLEN=5
>       ENDIF
>       WRITE(TIMESTEP,FMT)NTSD
>       FILENAME=FIELD//'_'//TIMESTEP(1:NLEN)
> !
>       IF(MYPE.EQ.0)THEN
>         CALL INT_GET_FRESH_HANDLE(IUNIT)
>         CLOSE(IUNIT)
>         OPEN(UNIT=IUNIT,FILE=FILENAME,FORM='UNFORMATTED',IOSTAT=IER)
>       ENDIF
> !
> !----------------------------------------------------------------------
> !!!!  DO 500 K=KTS,KTE+KK     !Unflipped
> !!!!  DO 500 K=KTE+KK,KTS,-1
>       DO 500 K=KDE-1,KDS,-1   !Write LM layers top down for checking
> !----------------------------------------------------------------------
> !
>       IF(MYPE.EQ.0)THEN
>         DO J=JTS,JTE
>         DO I=ITS,ITE
>           TWRITE(I,J)=ARRAY(I,K,J)
>         ENDDO
>         ENDDO
> !
>         DO IPE=1,NPES-1
>           CALL MPI_RECV(IT_REM,2,MPI_INTEGER,IPE,IPE                    &
>      &                 ,MPI_COMM_COMP,JSTAT,IRECV)
>           CALL MPI_RECV(JT_REM,2,MPI_INTEGER,IPE,IPE                    &
>      &                 ,MPI_COMM_COMP,JSTAT,IRECV)
> !
>           ITS_REM=IT_REM(1)
>           ITE_REM=IT_REM(2)
>           JTS_REM=JT_REM(1)
>           JTE_REM=JT_REM(2)
> !
>           NSIZE=(ITE_REM-ITS_REM+1)*(JTE_REM-JTS_REM+1)
>           ALLOCATE(VALUES(1:NSIZE))
> !
>           CALL MPI_RECV(VALUES,NSIZE,MPI_REAL,IPE,IPE                   &
>      &                 ,MPI_COMM_COMP,JSTAT,IRECV)
>           N=0
>           DO J=JTS_REM,JTE_REM
>             DO I=ITS_REM,ITE_REM
>               N=N+1
>               TWRITE(I,J)=VALUES(N)
>             ENDDO
>           ENDDO
> !
>           DEALLOCATE(VALUES)
> !
>         ENDDO
> !
> !----------------------------------------------------------------------
>       ELSE
>         NSIZE=(ITE-ITS+1)*(JTE-JTS+1)
>         ALLOCATE(VALUES(1:NSIZE))
> !
>         N=0
>         DO J=JTS,JTE
>         DO I=ITS,ITE
>           N=N+1
>           VALUES(N)=ARRAY(I,K,J)
>         ENDDO
>         ENDDO
> !
>         IT_REM(1)=ITS
>         IT_REM(2)=ITE
>         JT_REM(1)=JTS
>         JT_REM(2)=JTE
> !
>         CALL MPI_SEND(IT_REM,2,MPI_INTEGER,0,MYPE                       &
>      &               ,MPI_COMM_COMP,ISEND)
>         CALL MPI_SEND(JT_REM,2,MPI_INTEGER,0,MYPE                       &
>      &               ,MPI_COMM_COMP,ISEND)
> !
>         CALL MPI_SEND(VALUES,NSIZE,MPI_REAL,0,MYPE                      &
>      &               ,MPI_COMM_COMP,ISEND)
> !
>         DEALLOCATE(VALUES)
> !
>       ENDIF
> !----------------------------------------------------------------------
> !
>       CALL MPI_BARRIER(MPI_COMM_COMP,IRTN)
> !
>       IF(MYPE.EQ.0)THEN
> !
>         DO J=JDS,JDE-1
>           IENDX=IDE-1
>           IF(MOD(J,2).EQ.0)IENDX=IENDX-1
>           WRITE(IUNIT)(TWRITE(I,J),I=1,IENDX)
>         ENDDO
> !
>       ENDIF
> !
> !----------------------------------------------------------------------
>   500 CONTINUE
> !
>       IF(MYPE.EQ.0)CLOSE(IUNIT)
> !----------------------------------------------------------------------
> !
>       END SUBROUTINE TWR
> !
> !----------------------------------------------------------------------
> !**********************************************************************
>       SUBROUTINE VWR(ARRAY,FIELD,NTSD,MYPE,NPES,MPI_COMM_COMP          &
>      &              ,IDS,IDE,JDS,JDE,KDS,KDE                           &
>      &              ,IMS,IME,JMS,JME,KMS,KME                           &
>      &              ,ITS,ITE,JTS,JTE,KTS,KTE)
> !**********************************************************************
>       USE MODULE_EXT_INTERNAL
> !
>       INCLUDE "mpif.h"
> !----------------------------------------------------------------------
>       IMPLICIT NONE
> !----------------------------------------------------------------------
>       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                    &
>      &                     ,IMS,IME,JMS,JME,KMS,KME                    &
>      &                     ,ITS,ITE,JTS,JTE,KTS,KTE                    &
>      &                     ,KK,MPI_COMM_COMP,MYPE,NPES,NTSD 
> !
>       REAL,DIMENSION(IMS:IME,KMS:KME,JMS:JME),INTENT(IN) :: ARRAY
> !
>       CHARACTER(*),INTENT(IN) :: FIELD
> !
> !*** LOCAL VARIABLES
> !
>       INTEGER,DIMENSION(MPI_STATUS_SIZE) :: JSTAT
>       INTEGER,DIMENSION(MPI_STATUS_SIZE,4) :: STATUS_ARRAY
>       INTEGER,DIMENSION(2) :: IM_REM,JM_REM,IT_REM,JT_REM
> !
>       INTEGER :: I,IENDX,IER,IPE,IRECV,IRTN,ISEND,IUNIT                &
>                 ,J,K,N,NLEN,NSIZE
>       INTEGER :: ITS_REM,ITE_REM,JTS_REM,JTE_REM
> !
>       REAL,DIMENSION(IDS:IDE,JDS:JDE) :: VWRITE
>       REAL,ALLOCATABLE,DIMENSION(:) :: VALUES
>       CHARACTER(5) :: TIMESTEP
>       CHARACTER(6) :: FMT
>       CHARACTER(12) :: FILENAME
> !----------------------------------------------------------------------
> !**********************************************************************
> !----------------------------------------------------------------------
> !
>       IF(NTSD.LE.9)THEN
>         FMT='(I1.1)'
>         NLEN=1
>       ELSEIF(NTSD.LE.99)THEN
>         FMT='(I2.2)'
>         NLEN=2
>       ELSEIF(NTSD.LE.999)THEN
>         FMT='(I3.3)'
>         NLEN=3
>       ELSEIF(NTSD.LE.9999)THEN
>         FMT='(I4.4)'
>         NLEN=4
>       ELSEIF(NTSD.LE.99999)THEN
>         FMT='(I5.5)'
>         NLEN=5
>       ENDIF
>       WRITE(TIMESTEP,FMT)NTSD
>       FILENAME=FIELD//'_'//TIMESTEP(1:NLEN)
> !
>       IF(MYPE.EQ.0)THEN
>         CALL INT_GET_FRESH_HANDLE(IUNIT)
>         CLOSE(IUNIT)
>         OPEN(UNIT=IUNIT,FILE=FILENAME,FORM='UNFORMATTED',IOSTAT=IER)
>       ENDIF
> !
> !----------------------------------------------------------------------
> !!!!  DO 500 K=KTS,KTE+KK     !Unflipped
> !!!!  DO 500 K=KTE+KK,KTS,-1
>       DO 500 K=KDE-1,KDS,-1   !Always write LM layers for checking
> !----------------------------------------------------------------------
> !
>       IF(MYPE.EQ.0)THEN
>         DO J=JTS,JTE
>         DO I=ITS,ITE
>           VWRITE(I,J)=ARRAY(I,K,J)
>         ENDDO
>         ENDDO
> !
>         DO IPE=1,NPES-1
>           CALL MPI_RECV(IT_REM,2,MPI_INTEGER,IPE,IPE                    &
>      &                 ,MPI_COMM_COMP,JSTAT,IRECV)
>           CALL MPI_RECV(JT_REM,2,MPI_INTEGER,IPE,IPE                    &
>      &                 ,MPI_COMM_COMP,JSTAT,IRECV)
> !
>           ITS_REM=IT_REM(1)
>           ITE_REM=IT_REM(2)
>           JTS_REM=JT_REM(1)
>           JTE_REM=JT_REM(2)
> !
>           NSIZE=(ITE_REM-ITS_REM+1)*(JTE_REM-JTS_REM+1)
>           ALLOCATE(VALUES(1:NSIZE))
> !
>           CALL MPI_RECV(VALUES,NSIZE,MPI_REAL,IPE,IPE                   &
>      &                 ,MPI_COMM_COMP,JSTAT,IRECV)
>           N=0
>           DO J=JTS_REM,JTE_REM
>             DO I=ITS_REM,ITE_REM
>               N=N+1
>               VWRITE(I,J)=VALUES(N)
>             ENDDO
>           ENDDO
> !
>           DEALLOCATE(VALUES)
> !
>         ENDDO
> !
> !----------------------------------------------------------------------
>       ELSE
>         NSIZE=(ITE-ITS+1)*(JTE-JTS+1)
>         ALLOCATE(VALUES(1:NSIZE))
> !
>         N=0
>         DO J=JTS,JTE
>         DO I=ITS,ITE
>           N=N+1
>           VALUES(N)=ARRAY(I,K,J)
>         ENDDO
>         ENDDO
> !
>         IT_REM(1)=ITS
>         IT_REM(2)=ITE
>         JT_REM(1)=JTS
>         JT_REM(2)=JTE
> !
>         CALL MPI_SEND(IT_REM,2,MPI_INTEGER,0,MYPE                       &
>      &               ,MPI_COMM_COMP,ISEND)
>         CALL MPI_SEND(JT_REM,2,MPI_INTEGER,0,MYPE                       &
>      &               ,MPI_COMM_COMP,ISEND)
> !
>         CALL MPI_SEND(VALUES,NSIZE,MPI_REAL,0,MYPE                      &
>      &               ,MPI_COMM_COMP,ISEND)
> !
>         DEALLOCATE(VALUES)
> !
>       ENDIF
> !----------------------------------------------------------------------
> !
>       CALL MPI_BARRIER(MPI_COMM_COMP,IRTN)
> !
>       IF(MYPE.EQ.0)THEN
> !
>         DO J=JDS,JDE-1
>           IENDX=IDE-1
>           IF(MOD(J,2).EQ.1)IENDX=IENDX-1
>           WRITE(IUNIT)(VWRITE(I,J),I=1,IENDX)
>         ENDDO
> !
>       ENDIF
> !
> !----------------------------------------------------------------------
>   500 CONTINUE
> !
>       IF(MYPE.EQ.0)CLOSE(IUNIT)
> !----------------------------------------------------------------------
> !
>       END SUBROUTINE VWR
> !
> !----------------------------------------------------------------------
> !**********************************************************************
>       SUBROUTINE TWR2D(ARRAY,FIELD,NTSD,MYPE,NPES,MPI_COMM_COMP        &
>      &                ,IDS,IDE,JDS,JDE,KDS,KDE                         &
>      &                ,IMS,IME,JMS,JME,KMS,KME                         &
>      &                ,ITS,ITE,JTS,JTE,KTS,KTE)
> !**********************************************************************
>       USE MODULE_EXT_INTERNAL
> !
>       INCLUDE "mpif.h"
> !----------------------------------------------------------------------
>       IMPLICIT NONE
> !----------------------------------------------------------------------
>       INTEGER,INTENT(IN) :: IDS,IDE,JDS,JDE,KDS,KDE                    &
>      &                     ,IMS,IME,JMS,JME,KMS,KME                    &
>      &                     ,ITS,ITE,JTS,JTE,KTS,KTE                    &
>      &                     ,MPI_COMM_COMP,MYPE,NPES,NTSD 
> !
>       REAL,DIMENSION(IMS:IME,JMS:JME),INTENT(IN) :: ARRAY
> !
>       CHARACTER(*),INTENT(IN) :: FIELD
> !
> !*** LOCAL VARIABLES
> !
>       INTEGER,DIMENSION(MPI_STATUS_SIZE) :: JSTAT
>       INTEGER,DIMENSION(MPI_STATUS_SIZE,4) :: STATUS_ARRAY
>       INTEGER,DIMENSION(2) :: IM_REM,JM_REM,IT_REM,JT_REM
> !
>       INTEGER :: I,IENDX,IER,IPE,IRECV,IRTN,ISEND,IUNIT                &
>      &          ,J,N,NLEN,NSIZE
>       INTEGER :: ITS_REM,ITE_REM,JTS_REM,JTE_REM
> !
>       REAL,DIMENSION(IDS:IDE,JDS:JDE) :: TWRITE
>       REAL,ALLOCATABLE,DIMENSION(:) :: VALUES
>       CHARACTER(5) :: TIMESTEP
>       CHARACTER(6) :: FMT
>       CHARACTER(20) :: FILENAME
> !----------------------------------------------------------------------
> !**********************************************************************
> !----------------------------------------------------------------------
> !
>       IF(NTSD.LE.9)THEN
>         FMT='(I1.1)'
>         NLEN=1
>       ELSEIF(NTSD.LE.99)THEN
>         FMT='(I2.2)'
>         NLEN=2
>       ELSEIF(NTSD.LE.999)THEN
>         FMT='(I3.3)'
>         NLEN=3
>       ELSEIF(NTSD.LE.9999)THEN
>         FMT='(I4.4)'
>         NLEN=4
>       ELSEIF(NTSD.LE.99999)THEN
>         FMT='(I5.5)'
>         NLEN=5
>       ENDIF
>       WRITE(TIMESTEP,FMT)NTSD
>       FILENAME=FIELD//'_'//TIMESTEP(1:NLEN)
> !
>       IF(MYPE.EQ.0)THEN
>         CALL INT_GET_FRESH_HANDLE(IUNIT)
>         CLOSE(IUNIT)
>         OPEN(UNIT=IUNIT,FILE=FILENAME,FORM='UNFORMATTED',IOSTAT=IER)
>       ENDIF
> !
> !----------------------------------------------------------------------
> !
>       IF(MYPE.EQ.0)THEN
>         DO J=JTS,JTE
>         DO I=ITS,ITE
>           TWRITE(I,J)=ARRAY(I,J)
>         ENDDO
>         ENDDO
> !
>         DO IPE=1,NPES-1
>           CALL MPI_RECV(IT_REM,2,MPI_INTEGER,IPE,IPE                    &
>      &                 ,MPI_COMM_COMP,JSTAT,IRECV)
>           CALL MPI_RECV(JT_REM,2,MPI_INTEGER,IPE,IPE                    &
>      &                 ,MPI_COMM_COMP,JSTAT,IRECV)
> !
>           ITS_REM=IT_REM(1)
>           ITE_REM=IT_REM(2)
>           JTS_REM=JT_REM(1)
>           JTE_REM=JT_REM(2)
> !
>           NSIZE=(ITE_REM-ITS_REM+1)*(JTE_REM-JTS_REM+1)
>           ALLOCATE(VALUES(1:NSIZE))
> !
>           CALL MPI_RECV(VALUES,NSIZE,MPI_REAL,IPE,IPE                   &
>      &                 ,MPI_COMM_COMP,JSTAT,IRECV)
>           N=0
>           DO J=JTS_REM,JTE_REM
>             DO I=ITS_REM,ITE_REM
>               N=N+1
>               TWRITE(I,J)=VALUES(N)
>             ENDDO
>           ENDDO
> !
>           DEALLOCATE(VALUES)
> !
>         ENDDO
> !
> !----------------------------------------------------------------------
>       ELSE
>         NSIZE=(ITE-ITS+1)*(JTE-JTS+1)
>         ALLOCATE(VALUES(1:NSIZE))
> !
>         N=0
>         DO J=JTS,JTE
>         DO I=ITS,ITE
>           N=N+1
>           VALUES(N)=ARRAY(I,J)
>         ENDDO
>         ENDDO
> !
>         IT_REM(1)=ITS
>         IT_REM(2)=ITE
>         JT_REM(1)=JTS
>         JT_REM(2)=JTE
> !
>         CALL MPI_SEND(IT_REM,2,MPI_INTEGER,0,MYPE                       &
>      &               ,MPI_COMM_COMP,ISEND)
>         CALL MPI_SEND(JT_REM,2,MPI_INTEGER,0,MYPE                       &
>      &               ,MPI_COMM_COMP,ISEND)
> !
>         CALL MPI_SEND(VALUES,NSIZE,MPI_REAL,0,MYPE                      &
>      &               ,MPI_COMM_COMP,ISEND)
> !
>         DEALLOCATE(VALUES)
> !
>       ENDIF
> !----------------------------------------------------------------------
> !
>       CALL MPI_BARRIER(MPI_COMM_COMP,IRTN)
> !
>       IF(MYPE.EQ.0)THEN
> !
>         DO J=JDS,JDE-1
>           IENDX=IDE-1
>           IF(MOD(J,2).EQ.0)IENDX=IENDX-1
>           WRITE(IUNIT)(TWRITE(I,J),I=1,IENDX)
>         ENDDO
> !
>       ENDIF
> !
> !----------------------------------------------------------------------
>   500 CONTINUE
> !
>       IF(MYPE.EQ.0)CLOSE(IUNIT)
> !----------------------------------------------------------------------
> !
>       END SUBROUTINE TWR2D
> !
DONE solve_nmm.F
COMPARE start_domain_nmm.F
33,35d32
< !!!!!tlb
<       USE module_ext_internal
< !!!!!tlb
117c114
<      &                                  ,LU_INDEX,MAVAIL,NCA,PBLH       &
---
>      &                                  ,LU_INDEX,MAVAIL,MOL,NCA,PBLH   &
136,138c133,137
<       integer :: i_t=096,j_t=195,n_t=11
<       integer :: i_u=49,j_u=475,n_u=07
<       integer :: i_v=49,j_v=475,n_v=07
---
> 
> !tmp	
> 	real:: rmin, rmax
> !tmp
> 
297,301d295
<       if(mype.eq.n_t)then
<         do ns=1,nsoil
<           write(0,*)' enter START sh2o=',sh2o(i_t,ns,j_t)
<         enddo
<       endif
325c319
<        call wrf_get_myproc(mype)
---
> 
336,337c330
< !!!       fisx=ht*g
<           fisx=max(fis(i,j),0.)
---
>           fisx=ht*g
339,342d331
<       if(mype.eq.n_t.and.i.eq.i_t.and.j.eq.j_t)then
<         write(0,*)' INIT z0=',z0(i,j),' z0max=',z0max,' z0land=',z0land
<         write(0,*)' z0sea=',z0sea,' fis=',ht*g,' fisx=',fisx
<       endif
344,348c333
<      &                (Z0(I,J)*Z0MAX+FISx    *FCM+Z0LAND)
< !!!  &                (prodx        +FISx    *FCM+Z0LAND)
<       if(mype.eq.n_t.and.i.eq.i_t.and.j.eq.j_t)then
<         write(0,*)' INIT z0=',z0(i,j)
<       endif
---
>      &                (prodx        +FISx    *FCM+Z0LAND)
367,368c352,355
<           THS(I,J)=T(I,KOFF+1,J)*(1.+P608*Q(I,KOFF+1,J))*APEM1
<           TSFCK=T(I,KOFF+1,J)*(1.+P608*Q(I,KOFF+1,J))
---
> !          THS(I,J)=T(I,KOFF+1,J)*(1.+P608*Q(I,KOFF+1,J))*APEM1
> 	       THS(I,J)=NMM_TSK(I,J)*(1.+P608*Q(I,KOFF+1,J))*APEM1
> !          TSFCK=T(I,KOFF+1,J)*(1.+P608*Q(I,KOFF+1,J))
>                TSFCK=NMM_TSK(I,J)*(1.+P608*Q(I,KOFF+1,J))
394c381
<             CWM(I,K,J)=0.
---
> !!!!        CWM(I,K,J)=0.
456c443
<           Q2(I,K,J)=HTM(I,K+1,J)*HBM2(I,J)*EPSQ2
---
> !!!!!     Q2(I,K,J)=HTM(I,K+1,J)*HBM2(I,J)*EPSQ2
463,466c450,453
<           Q2(I,LM,J)    = 0.
<           LLMH          = LMH(I,J)
<           Q2(I,LLMH-2,J)= HBM2(I,J)*Q2INI
<           Q2(I,LLMH-1,J)= HBM2(I,J)*Q2INI
---
> !!!!      Q2(I,LM,J)    = 0.
> !!!!      LLMH          = LMH(I,J)
> !!!!      Q2(I,LLMH-2,J)= HBM2(I,J)*Q2INI
> !!!!      Q2(I,LLMH-1,J)= HBM2(I,J)*Q2INI
543a531,534
> 
> 	if (PM1 .lt. 70000. .or. PM1 .gt. 104000.) &
>                   write(0,*) 'weird PM1: ', PM1
> 
545,546c536,539
< !!!!!          THS(I,J)=T(I,KOFF+1,J)*(1.+P608*Q(I,KOFF+1,J))*APEM1
<           TSFCK=T(I,KOFF+1,J)*(1.+P608*Q(I,KOFF+1,J))
---
> !tst1020         THS(I,J)=T(I,KOFF+1,J)*(1.+P608*Q(I,KOFF+1,J))*APEM1
> 	       THS(I,J)=NMM_TSK(I,J)*(1.+P608*Q(I,KOFF+1,J))*APEM1
> !tst1020          TSFCK=T(I,KOFF+1,J)*(1.+P608*Q(I,KOFF+1,J))
>                TSFCK=NMM_TSK(I,J)*(1.+P608*Q(I,KOFF+1,J))
552c545,546
< !!!!!            THS(I,J)=SST(I,J)*(1.E5/(PD(I,J)+PDTOP+PT))**CAPA
---
> !reinstated below 1020
>             THS(I,J)=SST(I,J)*(1.E5/(PD(I,J)+PDTOP+PT))**CAPA
565a560,573
> 
> 	rmin=9999
> 	rmax=-9999
> 
> 	do J=180,400
> 	do I=120,200
> 	if (NMM_TSK(I,J) .gt. rmax) rmax=NMM_TSK(I,J)
> 	if (NMM_TSK(I,J) .gt. 0 .and. NMM_TSK(I,J) .lt. rmin) rmin=NMM_TSK(I,J)
> 	enddo
> 	enddo
> 
> 	write(0,*) 'NMM_TSK min: ', rmin
> 	write(0,*) 'NMM_TSK max: ', rmax
> 	
572c580
<             CWM(I,K,J)=0.
---
> !!!!        CWM(I,K,J)=0.
634,635c642
< !!!tlb    Q2(I,K,J)=HTM(I,K+1,J)*HBM2(I,J)*EPSQ2
<           Q2(I,K+1,J)=HTM(I,K,J)*HBM2(I,J)*EPSQ2
---
> !!!!      Q2(I,K+1,J)=HTM(I,K,J)*HBM2(I,J)*EPSQ2
642,645c649,652
<           Q2(I,KPS,J)    = 0.
<           LLMH          = LMH(I,J)
<           Q2(I,KOFF+2,J)= HBM2(I,J)*Q2INI
<           Q2(I,KOFF+3,J)= HBM2(I,J)*Q2INI
---
> !!!!      Q2(I,KPS,J)    = 0.
> !!!!      LLMH          = LMH(I,J)
> !!!!      Q2(I,KOFF+2,J)= HBM2(I,J)*Q2INI
> !!!!      Q2(I,KOFF+3,J)= HBM2(I,J)*Q2INI
1165,1171d1171
<       if(mype.eq.n_t)then
<         write(0,*)' nstart=',nstart,' sm=',sm(i_t,j_t) &
<      &,           ' sice=',sice(i_t,j_t)
<         do ns=1,nsoil
<           write(0,*)' START sh2o=',sh2o(i_t,ns,j_t)
<         enddo
<       endif
1349c1349,1353
<           TSHLTR(I,J)=FAC2*THS(I,J)+FAC1*THLM
---
> !mptest          TSHLTR(I,J)=FAC2*THS(I,J)+FAC1*THLM
> !
> ! based on past experience, want it HEAVILY weighted toward THLM (lowest atmospheric)
> 
>           TSHLTR(I,J)=0.2*THS(I,J)+0.8*THLM
1513a1518
>       ALLOCATE(MOL(IMS:IME,JMS:JME),STAT=I)
1631a1637,1641
> !mp
>        LU_INDEX=IVGTYP
>        write(6,*) 'minval lu_index: ', minval(LU_INDEX)
>        write(6,*) 'maxval lu_index: ', maxval(LU_INDEX)
> !mp
1675a1686
>       DEALLOCATE(MOL)
1862,1866d1872
<       if(mype.eq.n_t)then
<         do ns=1,nsoil
<           write(0,*)' exit START sh2o=',sh2o(i_t,ns,j_t)
<         enddo
<       endif
DONE start_domain_nmm.F