SUBROUTINE LWVNRAD &
 & ( KIDIA, KFDIA, KLON   , KLEV , KUAER,&
 & PGA   , PGB   , PABCU5 , PDBSL5, &
 & PADJD5, PADJU5, PCNTRB5, PDBDT5, PDWFSU5,&
 & PABCU , PDBSL , &
 & PADJD , PADJU , PCNTRB , PDBDT , PDWFSU &
 & )  

!**** *LWVNRAD*   - L.W., VERTICAL INTEGRATION, NEARBY LAYERS
!                      (adjoint)

!     PURPOSE.
!     --------
!           CARRIES OUT THE VERTICAL INTEGRATION ON NEARBY LAYERS
!           TO GIVE LONGWAVE FLUXES OR RADIANCES

!**   INTERFACE.
!     ----------

!        EXPLICIT ARGUMENTS :
!        --------------------
!     ==== INPUTS ===
!  Trajectory  Perturbation  Description                    Dimension
!  PABCU5      PABCU         ABSORBER AMOUNTS               (KLON,NUA,3*KLEV+1)
!  PDBSL5      PDBSL         SUB-LAYER PLANCK FUNCTION
!                            GRADIENT                       (KLON,KLEV*2)
!  PGA         ---           PADE APPROXIMANTS              (KLON,NIPD,2)
!  PGB         ---           PADE APPROXIMANTS              (KLON,NIPD,2)

!     ==== OUTPUTS ===
!  Trajectory  Perturbation  Description                       Dimension
!  PADJD5      PADJD         CONTRIBUTION OF ADJACENT LAYERS   (KLON,KLEV+1)
!  PADJU5      PADJU         CONTRIBUTION OF ADJACENT LAYERS   (KLON,KLEV+1)
!  PCNTRB5     PCNTRB        CLEAR-SKY ENERGY EXCHANGE 
!                            MATRIX                        (KLON,KLEV+1,KLEV+1)
!  PDBDT5      PDBDT         LAYER PLANCK FUNCTION GRADIENT    (KLON,NUA,KLEV)
!  PDWFSU5     PDWFSU        SPECTRAL DOWNWARD FLUX AT SURFACE (KLON,NSIL)

!        IMPLICIT ARGUMENTS :   NONE
!        --------------------

!     METHOD.
!     -------

!          1. PERFORMS THE VERTICAL INTEGRATION CORRESPONDING TO THE
!     CONTRIBUTIONS OF THE ADJACENT LAYERS USING A GAUSSIAN QUADRATURE

!     EXTERNALS.
!     ----------

!     REFERENCE.
!     ----------

!        SEE RADIATION'S PART OF THE MODEL'S DOCUMENTATION AND
!        ECMWF RESEARCH DEPARTMENT DOCUMENTATION OF THE IFS

!     AUTHOR.
!     -------
!        M. Janiskova  *ECMWF*       29-Nov-2006
!                       reduced version for H2O and CO2 based on lwvnad

!     MODIFICATIONS.
!     --------------

!-----------------------------------------------------------------------

USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK

USE YOELW    , ONLY : NSIL     ,NIPD     ,NTRA     ,NUA      ,&
 & NG1      ,NG1P1    ,WG1  
USE YOPHNC   , ONLY : LWLOPT

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KLON 
INTEGER(KIND=JPIM),INTENT(IN)    :: KLEV 
INTEGER(KIND=JPIM),INTENT(IN)    :: KIDIA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFDIA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KUAER 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGA(KLON,NIPD,2,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGB(KLON,NIPD,2,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PABCU5(KLON,NUA,3*KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PDBSL5(KLON,NSIL,KLEV*2) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PADJD5(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PADJU5(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PCNTRB5(KLON,KLEV+1,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PDBDT5(KLON,NSIL,KLEV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PDWFSU5(KLON,NSIL) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PABCU(KLON,NUA,3*KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PDBSL(KLON,NSIL,KLEV*2) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PADJD(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PADJU(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PCNTRB(KLON,KLEV+1,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PDBDT(KLON,NSIL,KLEV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PDWFSU(KLON,NSIL) 

!-----------------------------------------------------------------------

!*       0.1   ARGUMENTS
!              ---------

!-----------------------------------------------------------------------

!              ------------

REAL(KIND=JPRB) :: ZTTD5(KLON,KUAER,KLEV*NG1),ZTTU5(KLON,KUAER,KLEV*NG1)
REAL(KIND=JPRB) :: ZTTD15(KLON,KLEV*NG1),ZTTU15(KLON,KLEV*NG1)
REAL(KIND=JPRB) :: ZUU5(KLON,NUA)
REAL(KIND=JPRB) :: ZZD5(KLON,KUAER,KLEV*NG1),ZXND5(KLON,KUAER,KLEV*NG1)
REAL(KIND=JPRB) :: ZXDIVD5(KLON,KUAER,KLEV*NG1)
REAL(KIND=JPRB) :: ZZU5(KLON,KUAER,KLEV*NG1),ZXNU5(KLON,KUAER,KLEV*NG1)
REAL(KIND=JPRB) :: ZXDIVU5(KLON,KUAER,KLEV*NG1)
REAL(KIND=JPRB) :: ZXD5,ZWTRD5, ZWTRU5, ZWTR15, ZWTR25, ZWTR35 
REAL(KIND=JPRB) :: ZWTR45, ZWTR55, ZWTR65

REAL(KIND=JPRB) :: ZTT(KLON,NTRA), ZUU(KLON,NUA)
REAL(KIND=JPRB) :: ZWTRD, ZWTRU, ZWTR1, ZWTR2, ZWTR3 
REAL(KIND=JPRB) :: ZWTR4, ZWTR5, ZWTR6
REAL(KIND=JPRB) :: ZXN, ZXD, ZZ

INTEGER(KIND=JPIM) :: IBS, IDD, IM12, IMU, IND, INU, IXD, IXU, IGL,&
 & JA, JG, JK, JK1, JK2, JL, JNU  

REAL(KIND=JPRB) :: ZHOOK_HANDLE

!#include "lwtttl.intfb.h"

!-----------------------------------------------------------------------

!*         1.    INITIALIZATION
!                --------------

!*         1.1     INITIALIZE LAYER CONTRIBUTIONS
!                  ------------------------------

IF (LHOOK) CALL DR_HOOK('LWVNRAD',0,ZHOOK_HANDLE)
IF (.NOT. LWLOPT) THEN
  DO JK = 1 , KLEV+1
    DO JL = KIDIA,KFDIA
      PADJD5(JL,JK) = 0.0_JPRB
      PADJU5(JL,JK) = 0.0_JPRB
    ENDDO
  ENDDO
ENDIF

!*         1.2     INITIALIZE TRANSMISSION FUNCTIONS
!                  ---------------------------------

!DO JA = 1 , NTRA
DO JK = 1, NG1*KLEV
  DO JA = 1, KUAER
    DO JL = KIDIA,KFDIA
      ZTTD5(JL,JA,JK) = 1.0_JPRB
      ZTTU5(JL,JA,JK) = 1.0_JPRB
    ENDDO
  ENDDO
ENDDO

!DO JA = 1 , NUA
DO JA = 1, KUAER
  DO JL = KIDIA,KFDIA
    ZUU5(JL,JA) = 0.0_JPRB
  ENDDO
ENDDO

!     ------------------------------------------------------------------

!*         2.      VERTICAL INTEGRATION
!                  --------------------

!*         2.1     CONTRIBUTION FROM ADJACENT LAYERS
!                  ---------------------------------

DO JK = 1 , KLEV

!*         2.1.1   DOWNWARD LAYERS
!                  ---------------

  IM12 = 2 * (JK - 1)
  IND = (JK - 1) * NG1P1 + 1
  IXD = IND
  INU = JK * NG1P1 + 1
  IXU = IND

  DO JG = 1 , NG1
    IBS = IM12 + JG
    IDD = IXD + JG
    IGL = KLEV*(JG-1)+JK

    DO JA = 1 , KUAER
      DO JL = KIDIA,KFDIA
        ZUU5(JL,JA) = PABCU5(JL,JA,IND) - PABCU5(JL,JA,IDD)
      ENDDO
    ENDDO

    DO JA = 1 , 8
      DO JL = KIDIA,KFDIA
        ZZD5(JL,JA,IGL) = SQRT(ZUU5(JL,JA))
        ZXD5 = PGB(JL,JA,1,JK) &
         & + ZZD5(JL,JA,IGL)*(PGB(JL,JA,2,JK)+ZZD5(JL,JA,IGL))
        ZXND5(JL,JA,IGL) = PGA(JL,JA,1,JK)+ZZD5(JL,JA,IGL)*PGA(JL,JA,2,JK)
        ZXDIVD5(JL,JA,IGL) = 1.0_JPRB/ZXD5
        ZTTD5(JL,JA,IGL) = ZXND5(JL,JA,IGL)*ZXDIVD5(JL,JA,IGL)
      ENDDO
    ENDDO

    DO JL = KIDIA,KFDIA
      ZTTD15(JL,IGL) = ZTTD5(JL,3,IGL)
      IF (ZTTD15(JL,IGL) < 0.0_JPRB) THEN
        ZTTD5(JL,3,IGL) = 0.0_JPRB
      ENDIF
      ZTTD5(JL,9,IGL) = ZTTD5(JL,8,IGL)
    ENDDO

    IF (.NOT. LWLOPT) THEN
      DO JL = KIDIA,KFDIA
        ZWTR15 = PDBSL5(JL,1,IBS)*ZTTD5(JL,1,IGL)
        ZWTR25 = PDBSL5(JL,2,IBS)*ZTTD5(JL,2,IGL)*ZTTD5(JL,7,IGL)
        ZWTR35 = PDBSL5(JL,3,IBS)*ZTTD5(JL,4,IGL)*ZTTD5(JL,8,IGL)
        ZWTR45 = PDBSL5(JL,4,IBS)*ZTTD5(JL,5,IGL)*ZTTD5(JL,9,IGL)
        ZWTR55 = PDBSL5(JL,5,IBS)*ZTTD5(JL,3,IGL)
        ZWTR65 = PDBSL5(JL,6,IBS)*ZTTD5(JL,6,IGL)
        ZWTRD5 = ZWTR15+ZWTR25+ZWTR35+ZWTR45+ZWTR55+ZWTR65
        PADJD5(JL,JK) = PADJD5(JL,JK) + ZWTRD5 * WG1(JG)

        IF (JK == 1) THEN
          PDWFSU5(JL,1) = PDWFSU5(JL,1)+WG1(JG)*ZWTR15
          PDWFSU5(JL,2) = PDWFSU5(JL,2)+WG1(JG)*ZWTR25
          PDWFSU5(JL,3) = PDWFSU5(JL,3)+WG1(JG)*ZWTR35
          PDWFSU5(JL,4) = PDWFSU5(JL,4)+WG1(JG)*ZWTR45
          PDWFSU5(JL,5) = PDWFSU5(JL,5)+WG1(JG)*ZWTR55
          PDWFSU5(JL,6) = PDWFSU5(JL,6)+WG1(JG)*ZWTR65
        ENDIF
      ENDDO
    ENDIF

!*         2.1.2   UPWARD LAYERS
!                  -------------

    IMU = IXU + JG
    DO JA = 1 , KUAER
      DO JL = KIDIA,KFDIA
        ZUU5(JL,JA) = PABCU5(JL,JA,IMU) - PABCU5(JL,JA,INU)
      ENDDO
    ENDDO

    DO JA = 1 , 8
      DO JL = KIDIA,KFDIA
        ZZU5(JL,JA,IGL) = SQRT(ZUU5(JL,JA))
        ZXD5 = PGB(JL,JA,1,JK) &
         & + ZZU5(JL,JA,IGL)*(PGB(JL,JA,2,JK)+ZZU5(JL,JA,IGL))
        ZXNU5(JL,JA,IGL) = PGA(JL,JA,1,JK)+ZZU5(JL,JA,IGL)*PGA(JL,JA,2,JK)
        ZXDIVU5(JL,JA,IGL) = 1.0_JPRB/ZXD5
        ZTTU5(JL,JA,IGL) = ZXNU5(JL,JA,IGL)*ZXDIVU5(JL,JA,IGL)
      ENDDO
    ENDDO

    DO JL = KIDIA,KFDIA
      ZTTU15(JL,IGL) = ZTTU5(JL,3,IGL)
      IF (ZTTU15(JL,IGL) < 0.0_JPRB) THEN
        ZTTU5(JL,3,IGL) = 0.0_JPRB
      ENDIF
      ZTTU5(JL,9,IGL) = ZTTU5(JL,8,IGL)
    ENDDO

    IF (.NOT. LWLOPT) THEN
      DO JL = KIDIA,KFDIA
        ZWTRU5 = PDBSL5(JL,1,IBS)*ZTTU5(JL,1,IGL) &
         &     + PDBSL5(JL,2,IBS)*ZTTU5(JL,2,IGL)*ZTTU5(JL,7,IGL) &
         &     + PDBSL5(JL,3,IBS)*ZTTU5(JL,4,IGL)*ZTTU5(JL,8,IGL) &
         &     + PDBSL5(JL,4,IBS)*ZTTU5(JL,5,IGL)*ZTTU5(JL,9,IGL) &
         &     + PDBSL5(JL,5,IBS)*ZTTU5(JL,3,IGL) &
         &     + PDBSL5(JL,6,IBS)*ZTTU5(JL,6,IGL)
        PADJU5(JL,JK+1) = PADJU5(JL,JK+1) + ZWTRU5 * WG1(JG)
      ENDDO
    ENDIF

  ENDDO

  IF (.NOT. LWLOPT) THEN
    DO JL = KIDIA,KFDIA
      PCNTRB5(JL,JK,JK+1) = PADJD5(JL,JK)
      PCNTRB5(JL,JK+1,JK) = PADJU5(JL,JK+1)
      PCNTRB5(JL,JK  ,JK) = 0.0_JPRB
    ENDDO
  ENDIF

ENDDO

IF (.NOT. LWLOPT) THEN
  DO JK = 1 , KLEV
    JK2 = 2 * JK
    JK1 = JK2 - 1

    DO JNU = 1 , NSIL
      DO JL = KIDIA,KFDIA
        PDBDT5(JL,JNU,JK) = PDBSL5(JL,JNU,JK1) + PDBSL5(JL,JNU,JK2)
      ENDDO
    ENDDO
  ENDDO
ENDIF

!*         0.    ADJOINT CALCULATIONS
!                --------------------

!* Set local variables to zero

ZTT(:,:) = 0.0_JPRB
ZUU(:,:) = 0.0_JPRB

!     ------------------------------------------------------------------

!*         1.2.    VERTICAL INTEGRATION
!                  --------------------

DO JK = KLEV,1,-1
  JK2 = 2 * JK
  JK1 = JK2 - 1

  DO JNU = 1 , NSIL
    DO JL = KIDIA,KFDIA
      PDBSL(JL,JNU,JK1) = PDBSL(JL,JNU,JK1)+PDBDT(JL,JNU,JK)
      PDBSL(JL,JNU,JK2) = PDBSL(JL,JNU,JK2)+PDBDT(JL,JNU,JK)
      PDBDT(JL,JNU,JK) = 0.0_JPRB
    ENDDO
  ENDDO
ENDDO

!*         1.2.1   CONTRIBUTION FROM ADJACENT LAYERS
!                  ---------------------------------

DO JK = KLEV,1,-1

  IM12 = 2 * (JK - 1)
  IND = (JK - 1) * NG1P1 + 1
  IXD = IND
  INU = JK * NG1P1 + 1
  IXU = IND

  DO JL = KIDIA,KFDIA
    PCNTRB(JL,JK,JK) = 0.0_JPRB
    PADJU(JL,JK+1) = PADJU(JL,JK+1)+PCNTRB(JL,JK+1,JK)
    PCNTRB(JL,JK+1,JK) = 0.0_JPRB
    PADJD(JL,JK) = PADJD(JL,JK)+PCNTRB(JL,JK,JK+1)
    PCNTRB(JL,JK,JK+1) = 0.0_JPRB
  ENDDO

  DO JG = NG1,1,-1
    IBS = IM12 + JG
    IDD = IXD + JG
    IGL = KLEV*(JG-1)+JK

!*         1.2.1.2   UPWARD LAYERS
!                    -------------


    DO JL = KIDIA,KFDIA
      ZWTRU = WG1(JG)*PADJU(JL,JK+1)

      ZTT(JL,1) = ZTT(JL,1)+PDBSL5(JL,1,IBS)*ZWTRU
      PDBSL(JL,1,IBS) = PDBSL(JL,1,IBS)+ZTTU5(JL,1,IGL)*ZWTRU
      ZTT(JL,7) = ZTT(JL,7)+PDBSL5(JL,2,IBS)*ZTTU5(JL,2,IGL)*ZWTRU
      ZTT(JL,2) = ZTT(JL,2)+PDBSL5(JL,2,IBS)*ZTTU5(JL,7,IGL)*ZWTRU
      PDBSL(JL,2,IBS) = PDBSL(JL,2,IBS)+ZTTU5(JL,2,IGL) &
       & *ZTTU5(JL,7,IGL)*ZWTRU
      ZTT(JL,8) = ZTT(JL,8)+PDBSL5(JL,3,IBS)*ZTTU5(JL,4,IGL)*ZWTRU
      ZTT(JL,4) = ZTT(JL,4)+PDBSL5(JL,3,IBS)*ZTTU5(JL,8,IGL)*ZWTRU
      PDBSL(JL,3,IBS) = PDBSL(JL,3,IBS)+ZTTU5(JL,4,IGL) &
       & *ZTTU5(JL,8,IGL)*ZWTRU
      ZTT(JL,9) = ZTT(JL,9)+PDBSL5(JL,4,IBS)*ZTTU5(JL,5,IGL)*ZWTRU
      ZTT(JL,5) = ZTT(JL,5)+PDBSL5(JL,4,IBS)*ZTTU5(JL,9,IGL)*ZWTRU
      PDBSL(JL,4,IBS) = PDBSL(JL,4,IBS)+ZTTU5(JL,5,IGL) &
       & *ZTTU5(JL,9,IGL)*ZWTRU
      ZTT(JL,3) = ZTT(JL,3)+PDBSL5(JL,5,IBS)*ZWTRU
      PDBSL(JL,5,IBS) = PDBSL(JL,5,IBS)+ZTTU5(JL,3,IGL)*ZWTRU
      ZTT(JL,6) = ZTT(JL,6)+PDBSL5(JL,6,IBS)*ZWTRU
      PDBSL(JL,6,IBS) = PDBSL(JL,6,IBS)+ZTTU5(JL,6,IGL)*ZWTRU
    ENDDO

    DO JL = KIDIA,KFDIA
      ZTT(JL,8) = ZTT(JL,8)+ZTT(JL,9)
      ZTT(JL,9) = 0.0_JPRB
      IF (ZTTU15(JL,IGL) < 0.0_JPRB) THEN
        ZTT(JL,3) = 0.0_JPRB
      ENDIF
    ENDDO

    DO JA = 1 , 8
      DO JL = KIDIA,KFDIA
        ZXN = ZXDIVU5(JL,JA,IGL)*ZTT(JL,JA)
        ZXD = -ZXNU5(JL,JA,IGL)*ZXDIVU5(JL,JA,IGL) &
         &  * ZXDIVU5(JL,JA,IGL)*ZTT(JL,JA)
        ZTT(JL,JA) = 0.0_JPRB
        ZZ = PGA( JL,JA,2,JK)*ZXN
        ZZ = ZZ+(PGB( JL,JA,2,JK)+2.0_JPRB*ZZU5(JL,JA,IGL))*ZXD
        IF (ZZU5(JL,JA,IGL) > 0.0_JPRB) THEN
          ZUU(JL,JA) = ZUU(JL,JA)+0.5_JPRB*ZZ/ZZU5(JL,JA,IGL)
        ENDIF
      ENDDO
    ENDDO

    IMU = IXU + JG
    DO JA = 1 , KUAER
      DO JL = KIDIA,KFDIA
        PABCU(JL,JA,IMU) = PABCU(JL,JA,IMU)+ZUU(JL,JA)
        PABCU(JL,JA,INU) = PABCU(JL,JA,INU)-ZUU(JL,JA)
        ZUU(JL,JA) = 0.0_JPRB
      ENDDO
    ENDDO

!*         1.2.1.1   DOWNWARD LAYERS
!                    ---------------

    DO JL = KIDIA,KFDIA
      IF (JK == 1) THEN
        ZWTR6 = WG1(JG)*PDWFSU(JL,6)
        ZWTR5 = WG1(JG)*PDWFSU(JL,5)
        ZWTR4 = WG1(JG)*PDWFSU(JL,4)
        ZWTR3 = WG1(JG)*PDWFSU(JL,3)
        ZWTR2 = WG1(JG)*PDWFSU(JL,2)
        ZWTR1 = WG1(JG)*PDWFSU(JL,1)

        ZWTRD = WG1(JG)*PADJD(JL,JK)
        ZWTR1 = ZWTR1+ZWTRD
        ZWTR2 = ZWTR2+ZWTRD
        ZWTR3 = ZWTR3+ZWTRD
        ZWTR4 = ZWTR4+ZWTRD
        ZWTR5 = ZWTR5+ZWTRD
        ZWTR6 = ZWTR6+ZWTRD
      ELSE
        ZWTRD = WG1(JG)*PADJD(JL,JK)
        ZWTR1 = ZWTRD
        ZWTR2 = ZWTRD
        ZWTR3 = ZWTRD
        ZWTR4 = ZWTRD
        ZWTR5 = ZWTRD
        ZWTR6 = ZWTRD
      ENDIF

      ZTT(JL,6) = ZTT(JL,6)+PDBSL5(JL,6,IBS)*ZWTR6
      PDBSL(JL,6,IBS) = PDBSL(JL,6,IBS)+ZTTD5(JL,6,IGL)*ZWTR6
      ZTT(JL,3) = ZTT(JL,3)+PDBSL5(JL,5,IBS)*ZWTR5
      PDBSL(JL,5,IBS) = PDBSL(JL,5,IBS)+ZTTD5(JL,3,IGL)*ZWTR5
      ZTT(JL,9) = ZTT(JL,9)+PDBSL5(JL,4,IBS)*ZTTD5(JL,5,IGL)*ZWTR4
      ZTT(JL,5) = ZTT(JL,5)+PDBSL5(JL,4,IBS)*ZTTD5(JL,9,IGL)*ZWTR4
      PDBSL(JL,4,IBS) = PDBSL(JL,4,IBS)+ZTTD5(JL,5,IGL) &
       & *ZTTD5(JL,9,IGL)*ZWTR4
      ZTT(JL,8) = ZTT(JL,8)+PDBSL5(JL,3,IBS)*ZTTD5(JL,4,IGL)*ZWTR3
      ZTT(JL,4) = ZTT(JL,4)+PDBSL5(JL,3,IBS)*ZTTD5(JL,8,IGL)*ZWTR3
      PDBSL(JL,3,IBS) = PDBSL(JL,3,IBS)+ZTTD5(JL,4,IGL) &
       & *ZTTD5(JL,8,IGL)*ZWTR3
      ZTT(JL,7) = ZTT(JL,7)+PDBSL5(JL,2,IBS)*ZTTD5(JL,2,IGL)*ZWTR2
      ZTT(JL,2) = ZTT(JL,2)+PDBSL5(JL,2,IBS)*ZTTD5(JL,7,IGL)*ZWTR2
      PDBSL(JL,2,IBS) = PDBSL(JL,2,IBS)+ZTTD5(JL,2,IGL) &
       & *ZTTD5(JL,7,IGL)*ZWTR2
      ZTT(JL,1) = ZTT(JL,1)+PDBSL5(JL,1,IBS)*ZWTR1
      PDBSL(JL,1,IBS) = PDBSL(JL,1,IBS)+ZTTD5(JL,1,IGL)*ZWTR1
    ENDDO

    DO JL = KIDIA,KFDIA
      ZTT(JL,8) = ZTT(JL,8)+ZTT(JL,9)
      ZTT(JL,9) = 0.0_JPRB
      IF (ZTTD15(JL,IGL) < 0.0_JPRB) THEN
        ZTT(JL,3) = 0.0_JPRB
      ENDIF
    ENDDO

    DO JA = 1 , 8
      DO JL = KIDIA,KFDIA
        ZXN = ZXDIVD5(JL,JA,IGL)*ZTT(JL,JA)
        ZXD = -ZXND5(JL,JA,IGL)*ZXDIVD5(JL,JA,IGL) &
         &  * ZXDIVD5(JL,JA,IGL)*ZTT(JL,JA)
        ZTT(JL,JA) = 0.0_JPRB
        ZZ = PGA( JL,JA,2,JK)*ZXN
        ZZ = ZZ+(PGB( JL,JA,2,JK)+2.0_JPRB*ZZD5(JL,JA,IGL))*ZXD
        IF (ZZD5(JL,JA,IGL) > 0.0_JPRB) THEN
          ZUU(JL,JA) = ZUU(JL,JA)+0.5_JPRB*ZZ/ZZD5(JL,JA,IGL)
        ENDIF
      ENDDO
    ENDDO

    DO JA = 1 , KUAER
      DO JL = KIDIA,KFDIA
        PABCU(JL,JA,IND) = PABCU(JL,JA,IND)+ZUU(JL,JA)
        PABCU(JL,JA,IDD) = PABCU(JL,JA,IDD)-ZUU(JL,JA)
        ZUU(JL,JA) = 0.0_JPRB
      ENDDO
    ENDDO

  ENDDO
ENDDO

!*         1.1.1     INITIALIZE LAYER CONTRIBUTIONS
!                    ------------------------------

DO JK = 1 , KLEV+1
  DO JL = KIDIA,KFDIA
    PADJD (JL,JK) = 0.0_JPRB
    PADJU (JL,JK) = 0.0_JPRB
  ENDDO
ENDDO


!-----------------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('LWVNRAD',1,ZHOOK_HANDLE)
END SUBROUTINE LWVNRAD
