!--------------------------------------------------------------------------------------------------
!  DOXYGEN
!> @brief CALCULATES HORIZONTAL ADVECTION AND UPDATES ADVECTED VARIABLES
!> @details CALCULATES HORIZONTAL ADVECTION AND UPDATES ADVECTED VARIABLES, USING 4TH ORDER ADVECTION 
!! SCHEMES: MESINGER (1981) FOR MOMENTUM AND A-LA-RANCIC (1988) FOR TEMPERATURE AND TURBULENT 
!! KINETIC ENERGY, WITH A MODIFIED EULER-BACKWARD (OR HEUN SCHEME) FOR TIME-DIFFERENCING.
!> @author ORIGINATOR - ????? 
!> @date ??-??-?? \n
!> @author LUCCI 
!> @date 18-03-20 \n
!> @version V1.1.0
!> @details MODERNIZATION OF THE CODE, INCLUDING:
!!                      * F77 TO F90/F95
!!                      * INDENTATION & UNIFORMIZATION CODE
!!                      * REPLACEMENT OF COMMONS BLOCK FOR MODULES
!!                      * DOCUMENTATION WITH DOXYGEN
!!                      * OPENMP FUNCTIONALITY 
!<
!> @details <b>Use Module:</b>
!! @arg @c CONTIN
!! @arg @c CTLBLK
!! @arg @c DYNAM
!! @arg @c F77KINDS
!! @arg @c LOOPS
!! @arg @c MASKS
!! @arg @c METRCS
!! @arg @c MPPSTAFF
!! @arg @c PARMETA
!! @arg @c PVRBLS
!! @arg @c REALPAR
!! @arg @c VRBLS
!> @details <b>Driver:</b> 
!<
!> @details <b>Calls:</b>
!! @arg @c AVRH
!! @arg @c BOCOHMPI
!! @arg @c BOCOVMPI
!--------------------------------------------------------------------------------------------------
    SUBROUTINE HZADV_VP2
!--------------------------------------------------------------------------------------------------
! SUBROUTINE HZADV_VP2
! 
! SUBPROGRAM: HZADV_VP2 - CALCULATES THE CONTRIBUTION OF THE HORIZONTAL ADVECTION
! PROGRAMMER: ?????          
! ORG: W/NP22
! DATE: ??-??-??
!
! ABSTRACT:
! CALCULATES THE CONTRIBUTION OF THE HORIZONTAL ADVECTION OF TEMPERATURE AND ROTATIONAL MOMENTUM 
! TERMS TO THE TENDENCIES OF TEMPERATURE AND WIND COMPONENTS, RESPECTIVELY, AND THEN UPDATES THESE
! VARIABLES. 
! THE VECTOR PROJECTION ADVECTION SCHEMES FOR THE ARAKAWA E GRID (FOR MOMENTUM AND  TEMPERATURE), 
! ARE  USED FOR SPACE-DIFFERENCING, AND A MODIFIED EULER-BACKWARD SCHEME (HEUN) FOR 
! TIME-DIFFERENCING.                                              
!
! PROGRAM HISTORY LOG:
! ??-??-??  ?????      - ORIGINATOR
! 18-01-15  LUCCI      - MODERNIZATION OF THE CODE, INCLUDING:
!                        * F77 TO F90/F95
!                        * INDENTATION & UNIFORMIZATION CODE
!                        * REPLACEMENT OF COMMONS BLOCK FOR MODULES
!                        * DOCUMENTATION WITH DOXYGEN
!                        * OPENMP FUNCTIONALITY
!
! INPUT ARGUMENT LIST:
! NONE
!
! OUTPUT ARGUMENT LIST:
! NONE
!
! INPUT/OUTPUT ARGUMENT LIST:
! NONE
!
! USE MODULES: CONTIN
!              CTLBLK
!              DYNAM
!              F77KINDS
!              LOOPS
!              MASKS
!              METRCS
!              MPPSTAFF
!              PARMETA
!              PVRBLS
!              REALPAR
!              VRBLS
! 
! DRIVER     : -----
!
! CALLS      : AVRH
!              BOCOHMPI
!              BOCOVMPI
!--------------------------------------------------------------------------------------------------
    USE CONTIN
    USE CTLBLK
    USE DYNAM
    USE F77KINDS
    USE LOOPS
    USE MASKS
    USE METRCS
    USE MPPSTAFF
    USE PARMETA
    USE PVRBLS
    USE REALPAR
    USE VRBLS
!
    IMPLICIT NONE
!
    REAL   (KIND=R4)    , DIMENSION(0:IM+1, 0:JM+1)                                             ::&
    & HM      , VM      , DPDE    , GDPD    , RGDP    , AGDP    ,                                 &
    & UT      , VT      , TT      , UTLD    , VTLD    ,                                           & 
    & FXE     , FYE     , FXB     , FYB     , GDPD2   ,                                           &
    & TXE     , TYE     , TXB     , TYB     , ADU     , ADV     , ADT     ,                       &
    & FXEB    , FYEB    , FXBB    , FYBB    , Q2M     , Q2L     , Q2MXE   , Q2LXE   ,             &
    & Q2MYE   , Q2LYE   , Q2MXB   , Q2LXB   , Q2MYB   ,                                           &
    & Q2LYB   , ADQ2M   , ADQ2L   , QXE     , QYE     , QT
!
    REAL   (KIND=R4)    , DIMENSION(0:IM+1, 0:JM+1)                                             ::&
    & UEW     , VEW     , UNS     , UNE     , VNS     , VNE     , USE     , VSE
!
    REAL   (KIND=R4)    , DIMENSION(0:IM+1, 0:JM+1, 4)                                          ::&
    & UH      , VH
!
    REAL   (KIND=R4)    , DIMENSION(0:IM+1, 0:JM+1, 2)                                          ::&
    & UX      , VX      , UY      , VY
!
    REAL   (KIND=R4)    , DIMENSION(0:IM+1, 0:JM+1, 2)                                          ::&
    & UEW1    , VEW1    , UNS1    , UNE1    , VNS1    , VNE1    , USE1    , VSE1
!
    REAL   (KIND=R4)    , DIMENSION(0:IM+1, 0:JM+1, 2)                                          ::&
    & UEW2    , VEW2    , UNS2    , UNE2    , VNS2    , VNE2    , USE2    , VSE2
!
    REAL   (KIND=R4)    , DIMENSION(0:IM+1, 0:JM+1, LM+1)                                       ::&
    & Q2ML    , ADQ2HL
!
    REAL   (KIND=R4)                                                                            ::&
    & ADUEW1  , ADUEW2  , ADVEW1  , ADVEW2  , ADUNS1  , ADUNS2  , ADUNE1  , ADUNE2  ,             &
    & ADVNS1  , ADVNS2  , ADVNE1  , ADVNE2  , ADUSE1  , ADUSE2  , ADVSE1  , ADVSE2
!
    INTEGER(KIND=I4)                                                                            ::&
    & I       , J       , L       , IT      , K       , K2
!
    INTEGER(KIND=I4)                                                                            ::&
    & ISCORNER2
!
    REAL   (KIND=R4)                                                                            ::&
    & FAC     , TADXE   , TADYE   , TADXB   , TADYB
!
    Q2ML(0:IM+1, 0:JM+1, 1) = 0.
!
    DO L=2,LM+1
        Q2ML(0:IM+1, 0:JM+1, L) = Q2(0:IM+1, 0:JM+1, L-1)
    END DO
!
    MAIN_LOOP: DO L=1,LM
!
        HM      = HTM(0:IM+1, 0:JM+1, L)
        VM(:,:) = VTM(0:IM+1, 0:JM+1, L)    
!
        DPDE  = PDSL(0:IM+1,0:JM+1) * DETA(L)
        GDPD  =  DPDE
        GDPD2 =  DPDE * SQH
!
        DO I=0,IM+1
            DO J=0,JM+1
!
                IF (GDPD(I,J) == 0 .OR. SQH(I,J) == 0) THEN
	            RGDP(I,J) = 0.
                ELSE
                    RGDP(I,J) = 1. / (GDPD(I,J) * SQH(I,J))
                END IF
!
            END DO
        END DO
!
        UT(:,:) = U(0:IM+1, 0:JM+1, L)
        VT(:,:) = V(0:IM+1, 0:JM+1, L)
        TT(:,:) = T(0:IM+1, 0:JM+1, L)
!  
        Q2M = Q2ML(0:IM+1, 0:JM+1, L  )
        Q2L = Q2ML(0:IM+1, 0:JM+1, L+1)
!
        CALL AVRH(GDPD, AGDP, IM, JM)
!
        DO IT=1,2                   
!-------
! FLUXES
!-------
            DO J=0,JM
                DO I=0,IM
                    UTLD(I,J) = Q11(I,J)*UT(I,J) + Q12(I,J) * VT(I,J)
                    VTLD(I,J) = Q12(I,J)*UT(I,J) + Q22(I,J) * VT(I,J)
!
                    FXE(I,J) = 0.25 * (GDPD2(I+1,J) + GDPD2(I,J+1) + GDPD2(I,J) + GDPD2(I+1,J+1)) &
    &                        * UTLD(I,J)
!  
                    FYE(I,J) = 0.25 * (GDPD2(I+1,J) + GDPD2(I,J+1) + GDPD2(I,J) + GDPD2(I+1,J+1)) &
    &                        * VTLD(I,J)  
                END DO
            END DO
!
            DO J=1,JM
                DO I=0,IM
                    FXB(I,J) = 0.5 * (FXE(I,J) + FYE(I,J) + FXE(I,J-1) + FYE(I,J-1))
                END DO
            END DO
!
            DO J=0,JM
                DO I=1,IM
                    FYB(I,J) = 0.5 * (-FXE(I,J) + FYE(I,J) - FXE(I-1,J) + FYE(I-1,J))
                END DO
            END DO
!
            IF (ISCORNER2(1,1) == 1) THEN
                FXB(0,1) = FXB(0,1) + FYB(1,0)
	        FYB(1,0) = FXB(0,1)
            END IF
!
            IF (ISCORNER2(IM,1) == 2) THEN
                FXB(IM,1) =  FXB(IM,1) - FYB(IM,0)
	        FYB(IM,0) = -FXB(IM,1)
            END IF
!
            IF (ISCORNER2(1,JM) == 3) THEN
                FXB(0,JM) =  FXB(0,JM) - FYB(1,JM)
                FYB(1,JM) = -FXB(0,JM)
            END IF
!
            IF (ISCORNER2(IM,JM) == 4) THEN
                FXB(IM,JM) = FXB(IM,JM) + FYB(IM,JM)
	        FYB(IM,JM) = FXB(IM,JM)
            END IF
!
            DO J=1,JM
                DO I=1,IM
                    FXEB(I,J) = 0.25 * (FXE(I,J) + FXE(I-1,J) + FXE(I,J-1) + FXE(I-1,J-1))
                    FYEB(I,J) = 0.25 * (FYE(I,J) + FYE(I-1,J) + FYE(I,J-1) + FYE(I-1,J-1))
                END DO
            END DO
!
            DO J=1,JM-1
                DO I=1,IM
                    FXBB(I,J) = 0.25 * (FXB(I,J) + FXB(I,J+1) + FXB(I-1,J) + FXB(I-1,J+1))
                END DO
            END DO
!
            DO J=1,JM
                DO I=1,IM-1
                    FYBB(I,J) = 0.25 * (FYB(I,J) + FYB(I+1,J) + FYB(I,J-1) + FYB(I+1,J-1))
                END DO
            END DO
!
            DO J=1,JM
                DO I=1,IM
                    UEW1(I,J,1) = FXEB(I,J)                                                       &
    &                           * (QA(I,J-1,5,1,1)   * UT(I,J-1) - QA(I,J-1,7,1,1)   * UT(I-1,J))
! 
                    UEW1(I,J,2) = FXEB(I,J)                                                       &
    &                           * (QA(I,J-1,5,1,2)   * VT(I,J-1) - QA(I,J-1,7,1,2)   * VT(I-1,J))
!
                    UEW2(I,J,1) = FXEB(I,J)                                                       &
    &                           * (QA(I-1,J,3,1,1)   * UT(I,J-1) - QA(I-1,J,5,1,1)   * UT(I-1,J))
!
                    UEW2(I,J,2) = FXEB(I,J)                                                       &
    &                           * (QA(I-1,J,3,1,2)   * VT(I,J-1) - QA(I-1,J,5,1,2)   * VT(I-1,J))
!
                    VEW1(I,J,1) = FXEB(I,J)                                                       &
    &                           * (QA(I,J-1,5,2,1)   * UT(I,J-1) - QA(I,J-1,7,2,1)   * UT(I-1,J))
!
	            VEW1(I,J,2) = FXEB(I,J)                                                       &
    &                           * (QA(I,J-1,5,2,2)   * VT(I,J-1) - QA(I,J-1,7,2,2)   * VT(I-1,J))
!
                    VEW2(I,J,1) = FXEB(I,J)                                                       &
    &                           * (QA(I-1,J,3,2,1)   * UT(I,J-1) - QA(I-1,J,5,2,1)   * UT(I-1,J))
!
                    VEW2(I,J,2) = FXEB(I,J)                                                       &
    &                           * (QA(I-1,J,3,2,2)   * VT(I,J-1) - QA(I-1,J,5,2,2)   * VT(I-1,J))
!		
                    UNS1(I,J,1) = FYEB(I,J)                                                       &
    &                           * (QA(I,J,5,1,1)     * UT(I,J)   - QA(I,J,1,1,1)     * UT(I-1,J-1))
!
                    UNS1(I,J,2) = FYEB(I,J)                                                       &
    &                           * (QA(I,J,5,1,2)     * VT(I,J)   - QA(I,J,1,1,2)     * VT(I-1,J-1))
!
                    UNS2(I,J,1) = FYEB(I,J)                                                       &
    &                           * (QA(I-1,J-1,9,1,1) * UT(I,J)   - QA(I-1,J-1,5,1,1) * UT(I-1,J-1))
!
                    UNS2(I,J,2) = FYEB(I,J)                                                       &
    &                           * (QA(I-1,J-1,9,1,2) * VT(I,J)   - QA(I-1,J-1,5,1,2) * VT(I-1,J-1))
!
                    VNS1(I,J,1) = FYEB(I,J)                                                       &
    &                           * (QA(I,J,5,2,1)     * UT(I,J)   - QA(I,J,1,2,1)     * UT(I-1,J-1))
!
                    VNS1(I,J,2) = FYEB(I,J)                                                       &
    &                           * (QA(I,J,5,2,2)     * VT(I,J)   - QA(I,J,1,2,2)     * VT(I-1,J-1))
!
                    VNS2(I,J,1) = FYEB(I,J)                                                       &
    &                           * (QA(I-1,J-1,9,2,1) * UT(I,J)   - QA(I-1,J-1,5,2,1) * UT(I-1,J-1))
!
                    VNS2(I,J,2) = FYEB(I,J)                                                       &
    &                           * (QA(I-1,J-1,9,2,2) * VT(I,J)   - QA(I-1,J-1,5,2,2) * VT(I-1,J-1))
!
                    UNE1(I,J,1) = FXBB(I,J)                                                       &
    &                           * (QA(I,J,5,1,1)     * UT(I,J)   - QA(I,J,4,1,1)     * UT(I-1,J))
!
                    UNE1(I,J,2) = FXBB(I,J)                                                       &
    &                           * (QA(I,J,5,1,2)     * VT(I,J)   - QA(I,J,4,1,2)     * VT(I-1,J))
!
                    UNE2(I,J,1) = FXBB(I,J)                                                       &
    &                           * (QA(I-1,J,6,1,1)   * UT(I,J)   - QA(I-1,J,5,1,1)   * UT(I-1,J))
!
                    UNE2(I,J,2) = FXBB(I,J)                                                       &
    &                           * (QA(I-1,J,6,1,2)   * VT(I,J)   - QA(I-1,J,5,1,2)   * VT(I-1,J))
!		 
	            VNE1(I,J,1) = FXBB(I,J)                                                       &
    &                           * (QA(I,J,5,2,1)     * UT(I,J)   - QA(I,J,4,2,1)     * UT(I-1,J))
!
                    VNE1(I,J,2) = FXBB(I,J)                                                       &
    &                           * (QA(I,J,5,2,2)     * VT(I,J)   - QA(I,J,4,2,2)     * VT(I-1,J))
!
                    VNE2(I,J,1) = FXBB(I,J)                                                       &
    &                           * (QA(I-1,J,6,2,1)   * UT(I,J)   - QA(I-1,J,5,2,1)   * UT(I-1,J))
!  
                    VNE2(I,J,2) = FXBB(I,J)                                                       &
    &                           * (QA(I-1,J,6,2,2)   * VT(I,J)   - QA(I-1,J,5,2,2)   * VT(I-1,J))
! 
                    USE1(I,J,1) = FYBB(I,J)                                                       &
    &                           * (QA(I,J,5,1,1)     * UT(I,J)   - QA(I,J,2,1,1)     * UT(I,J-1))
!
                    USE1(I,J,2) = FYBB(I,J)                                                       &
    &                           * (QA(I,J,5,1,2)     * VT(I,J)   - QA(I,J,2,1,2)     * VT(I,J-1))
!
                    USE2(I,J,1) = FYBB(I,J)                                                       &
    &                           * (QA(I,J-1,8,1,1)   * UT(I,J)   - QA(I,J-1,5,1,1)   * UT(I,J-1))
!
                    USE2(I,J,2) = FYBB(I,J)                                                       &
    &                           * (QA(I,J-1,8,1,2)   * VT(I,J)   - QA(I,J-1,5,1,2)   * VT(I,J-1))
!
                    VSE1(I,J,1) = FYBB(I,J)                                                       &
    &                           * (QA(I,J,5,2,1)     * UT(I,J)   - QA(I,J,2,2,1)     * UT(I,J-1))
!
                    VSE1(I,J,2) = FYBB(I,J)                                                       &
    &                           * (QA(I,J,5,2,2)     * VT(I,J)   - QA(I,J,2,2,2)     * VT(I,J-1))
!
                    VSE2(I,J,1) = FYBB(I,J)                                                       &
    &                           * (QA(I,J-1,8,2,1)   * UT(I,J)   - QA(I,J-1,5,2,1)   * UT(I,J-1))
!
                    VSE2(I,J,2) = FYBB(I,J)                                                       &
    &                           * (QA(I,J-1,8,2,2)   * VT(I,J)   - QA(I,J-1,5,2,2)   * VT(I,J-1))
!
                    IF (ISCORNER2(I,J) == 1 .OR. ISCORNER2(I,J) == 4) THEN
                        UNS1(I,J,:) = 0.
                        UNS2(I,J,:) = 0.
                        VNS1(I,J,:) = 0.
                        VNS2(I,J,:) = 0.
                    ELSE IF (ISCORNER2(I,J) ==  2 .OR. ISCORNER2(I,J) == 3) THEN
                        UEW1(I,J,:) = 0.
                        UEW2(I,J,:) = 0.
                        VEW1(I,J,:) = 0.
                        VEW2(I,J,:) = 0.
                    END IF
!
                END DO
            END DO
!
            DO J=1,JM1
                DO I=1,IM1
                    ADUEW1 = 0.5 * (UEW2(I+1,J,1) + UEW1(I,J+1,1)) 
                    ADVEW1 = 0.5 * (VEW2(I+1,J,1) + VEW1(I,J+1,1))
                    ADUEW2 = 0.5 * (UEW2(I+1,J,2) + UEW1(I,J+1,2)) 
                    ADVEW2 = 0.5 * (VEW2(I+1,J,2) + VEW1(I,J+1,2))
!
                    ADUNS1 = 0.5 * (UNS2(I+1,J+1,1) + UNS1(I,J,1))
                    ADVNS1 = 0.5 * (VNS2(I+1,J+1,1) + VNS1(I,J,1))
                    ADUNS2 = 0.5 * (UNS2(I+1,J+1,2) + UNS1(I,J,2))
                    ADVNS2 = 0.5 * (VNS2(I+1,J+1,2) + VNS1(I,J,2))
!
                    ADUNE1 = (UNE2(I+1,J,1) + UNE1(I,J,1))
                    ADVNE1 = (VNE2(I+1,J,1) + VNE1(I,J,1))
                    ADUNE2 = (UNE2(I+1,J,2) + UNE1(I,J,2))
                    ADVNE2 = (VNE2(I+1,J,2) + VNE1(I,J,2))
!
                    ADUSE1 = (USE2(I,J+1,1) + USE1(I,J,1))
                    ADVSE1 = (VSE2(I,J+1,1) + VSE1(I,J,1))
                    ADUSE2 = (USE2(I,J+1,2) + USE1(I,J,2))
                    ADVSE2 = (VSE2(I,J+1,2) + VSE1(I,J,2))
!
                    ADU(I,J) = 4. * FADV2 * ((ADUEW1 + ADUNS1 + ADUNE1 + ADUSE1)                  &
    &                        +               (ADUEW2 + ADUNS2 + ADUNE2 + ADUSE2)) / ((GDPD2(I,J)  &
    &                        + GDPD2(I+1,J+1) + GDPD2(I+1,J)  + GDPD2(I,J+1))) * VM(I,J)
!
                    ADV(I,J) = 4. * FADV2 * ((ADVEW1 + ADVNS1 + ADVNE1 + ADVSE1)                  &
    &                        +               (ADVEW2 + ADVNS2 + ADVNE2 + ADVSE2)) / ((GDPD2(I,J)  &
    &                        + GDPD2(I+1,J+1) + GDPD2(I+1,J)  + GDPD2(I,J+1))) * VM(I,J)
!
                END DO
            END DO
!------------
! TEMPERATURE
!------------
            DO J=0,JM
                DO I=0,IM
                    TXE(I,J) = 4. * FXE(I,J) * ( TT(I+1,J  ) -  TT(I,J+1))
                    TYE(I,J) = 4. * FYE(I,J) * ( TT(I+1,J+1) -  TT(I,J  ))
	            Q2MXE(I,J)=4. * FXE(I,J) * (Q2M(I+1,J  ) - Q2M(I,J+1))
	            Q2LXE(I,J)=4. * FXE(I,J) * (Q2L(I+1,J  ) - Q2L(I,J+1))
	            Q2MYE(I,J)=4. * FYE(I,J) * (Q2M(I+1,J+1) - Q2M(I,J  ))
	            Q2LYE(I,J)=4. * FYE(I,J) * (Q2L(I+1,J+1) - Q2L(I,J  ))
                END DO
            END DO
!
            DO J=1,JM
                DO I=0,IM
                    FXB(I,J) = ( FXE(I,J) + FYE(I,J) + FXE(I,J-1) + FYE(I,J-1)) * 4.
                END DO
            END DO
!
            DO J=0,JM
                DO I=1,IM
                    FYB(I,J) = (-FXE(I,J) + FYE(I,J) - FXE(I-1,J) + FYE(I-1,J)) * 4.
                END DO
            END DO
!
            DO J=1,JM
                DO I=0,IM
                      TXB(I,J) = FXB(I,J) * ( TT(I+1,J) -  TT(I,J))
                    Q2MXB(I,J) = FXB(I,J) * (Q2M(I+1,J) - Q2M(I,J))
                    Q2LXB(I,J) = FXB(I,J) * (Q2L(I+1,J) - Q2L(I,J))
                END DO
            END DO
!
            DO J=0,JM
                DO I=1,IM
                      TYB(I,J) = FYB(I,J) * ( TT(I,J+1) -  TT(I,J))
                    Q2MYB(I,J) = FYB(I,J) * (Q2M(I,J+1) - Q2M(I,J))
                    Q2LYB(I,J) = FYB(I,J) * (Q2L(I,J+1) - Q2L(I,J))
                END DO
            END DO
!
            DO J=1,JM
                DO I=1,IM 
                    FAC   = FADT * RGDP(I,J)
!
                    TADXE = TXE(I, J-1) + TXE(I-1, J  )
                    TADYE = TYE(I, J  ) + TYE(I-1, J-1)
                    TADXB = TXB(I, J  ) + TXB(I-1, J  )
                    TADYB = TYB(I, J  ) + TYB(I  , J-1)
!
                    ADT(I,J) = FAC * HM(I,J) * (TADXE + TADYE + TADXB + TADYB)
!
                    TADXE = Q2MXE(I,J-1) + Q2MXE(I-1, J  )
                    TADYE = Q2MYE(I,J  ) + Q2MYE(I-1, J-1)
                    TADXB = Q2MXB(I,J  ) + Q2MXB(I-1, J  )
                    TADYB = Q2MYB(I,J  ) + Q2MYB(I  , J-1)
!
                    ADQ2M(I,J) = FAC * HM(I,J) * (TADXE + TADYE + (TADXB + TADYB))
!   
                    TADXE = Q2LXE(I,J-1) + Q2LXE(I-1, J  )
                    TADYE = Q2LYE(I,J  ) + Q2LYE(I-1, J-1)
                    TADXB = Q2LXB(I,J  ) + Q2LXB(I-1, J  )
                    TADYB = Q2LYB(I,J  ) + Q2LYB(I  , J-1)
!
                    ADQ2L(I,J) = FAC * HM(I,J) * (TADXE + TADYE + TADXB + TADYB)
                END DO 
            END DO 
!-------------
! FIRST UPDATE 
!-------------
            IF (IT == 1) THEN
!
                DO J=1,JM1
                    DO I=1,IM1
                        UT(I,J) = UT(I,J) + ADU(I,J) * 0.75
                        VT(I,J) = VT(I,J) + ADV(I,J) * 0.75
                    END DO
                END DO
!
                DO J=1,JM
                    DO I=1,IM
                        TT(I,J) =  TT(I,J) +   ADT(I,J) * 0.75 
                       Q2M(I,J) = Q2M(I,J) + ADQ2M(I,J) * 0.75
                       Q2L(I,J) = Q2L(I,J) + ADQ2L(I,J) * 0.75
                    END DO
               END DO
!               
               CALL BOCOVMPI(UT , VT, 1)
               CALL BOCOHMPI(TT , 1)
               CALL BOCOHMPI(Q2M, 1)
               CALL BOCOHMPI(Q2L, 1)
!
            END IF
!----------------
! CLOSE DO IT=1,2 
!----------------
        END DO                         
!    
        DO J=1,JM1
            DO I=1,IM1
                U(I,J,L) = U(I,J,L) + ADU(I,J)
                V(I,J,L) = V(I,J,L) + ADV(I,J)
            END DO
        END DO
!
        DO J=1,JM
            DO I=1,IM
                T(I,J,L) = T(I,J,L) + ADT(I,J)
            END DO
        END DO
!
        IF (L == 1) THEN
            ADQ2HL(0:IM+1, 0:JM+1,   1) = ADQ2L
        ELSE
            ADQ2HL(0:IM+1, 0:JM+1, L  ) = ADQ2L
                Q2(0:IM+1, 0:JM+1, L-1) = ADQ2M * HM * 0.5 + Q2(0:IM+1, 0:JM+1, L-1)
        END IF
!--------------
! END MAIN_LOOP
!--------------
    END DO MAIN_LOOP
!
    CALL BOCOVMPI(U,V,LM)
!
    CALL BOCOHMPI(T,LM)
!
    DO L=2,LM
        HM = HTM(0:IM+1, 0:JM+1, L)
!
        Q2(0:IM+1, 0:JM+1, L-1) = ADQ2HL(0:IM+1, 0:JM+1, L-1) * HM * 0.5 + Q2(0:IM+1, 0:JM+1, L-1)
    END DO
!
    DO I=1,IM
        DO J=1,JM
            DO L=1,LMH(I,J)-1
                Q2(I,J,L) = AMAX1(Q2(I,J,L), EPSQ2)
            END DO
        END DO
    END DO
!  
    CALL BOCOHMPI(Q2,LM)
!
    END SUBROUTINE HZADV_VP2
