SUBROUTINE SWCLRAD &
 & ( KIDIA  , KFDIA  , KLON   , KLEV   , KAER   , KNU,&
 & PAER5  , PALBP5 , PDSIG5 , PRAYL5 , PSEC5,&
 & PCGAZ5 , PPIZAZ5, PRAY15 , PRAY25 , PREFZ5 , PRJ05,&
 & PRK05  , PRMU05 , PTAUAZ5, PTRA15 , PTRA25,&
 & PAER   , PALBP  , PDSIG  , PRAYL  , PSEC,&
 & PCGAZ  , PPIZAZ , PRAY1  , PRAY2  , PREFZ  , PRJ0,&
 & PRK0   , PRMU0  , PTAUAZ , PTRA1  , PTRA2 &
 & )  

!**** *SWCLRAD* - CLEAR-SKY COLUMN COMPUTATIONS
!                 -> ADJOINT <-  

!     PURPOSE.
!     --------
!           COMPUTES THE REFLECTIVITY AND TRANSMISSIVITY IN CASE OF
!     CLEAR-SKY COLUMN

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

!          *SWCLRAD* IS CALLED EITHER FROM *SW1SAD*, *SWNIAD*

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

!     ==== INPUTS ===
!     ==== OUTPUTS ===

!     METHOD.
!     -------

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

!          NONE

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

!        SEE RADIATION'S PART OF THE ECMWF RESEARCH DEPARTMENT
!        DOCUMENTATION, AND FOUQUART AND BONNEL (1980)

!     AUTHOR.
!     -------
!        JEAN-JACQUES MORCRETTE  *ECMWF*

!     MODIFICATIONS.
!     --------------
!        ORIGINAL : 96-10-24
!        Modified : 99-05-07 M.Janiskova - code corrections 
!                 2000-02-24 M.Janiskova - adopted for revised aerosols
!                                          as in swclr
!                 2002-05-06 M.Janiskova - adopted for 6 spectral intervals
!        03-10-10 Deborah Salmond and Marta Janiskova Optimisation
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!        JJMorcrette 20051111 bug-fix to swclr from Alf Grini (Meteo-France)
!        M. Janiskova 2005-11-14 bug correction on bug-fix
!        M. Janiskova 2008-03-18 code optimization + cleaning

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

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

USE YOESW    , ONLY : RTAUA    ,RPIZA    ,RCGA
USE YOERAD   , ONLY : NOVLP    ,NSW
USE YOERDI   , ONLY : REPCLC
USE YOERDU   , ONLY : REPSCT

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)    :: KAER 
INTEGER(KIND=JPIM),INTENT(IN)    :: KNU 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PAER5(KLON,6,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PALBP5(KLON,NSW) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PDSIG5(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRAYL5(KLON) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSEC5(KLON) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PCGAZ5(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PPIZAZ5(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRAY15(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRAY25(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PREFZ5(KLON,2,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRJ05(KLON,6,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRK05(KLON,6,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRMU05(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PTAUAZ5(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PTRA15(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PTRA25(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PAER(KLON,6,KLEV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PALBP(KLON,NSW) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PDSIG(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PRAYL(KLON) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSEC(KLON) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PCGAZ(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PPIZAZ(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PRAY1(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PRAY2(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PREFZ(KLON,2,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PRJ0(KLON,6,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PRK0(KLON,6,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PRMU0(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PTAUAZ(KLON,KLEV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PTRA1(KLON,KLEV+1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PTRA2(KLON,KLEV+1) 
!     ------------------------------------------------------------------

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

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

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

REAL(KIND=JPRB) :: ZC0I5(KLON,KLEV+1)&
 & ,  ZCLEAR5(KLON,KLEV+1) &
 & ,  ZR215(KLON,KLEV) ,  ZSS05(KLON,KLEV) , ZSCAT5(KLON,KLEV+1)&
 & ,  ZTR5(KLON,2,KLEV+1)  

! extra fields needed by adjoint computations
REAL(KIND=JPRB) :: ZRE115(KLON,2,KLEV+1)&
 & ,  ZDEN05(KLON,KLEV)     , ZDEN15(KLON,KLEV) , ZDENB5(KLON,KLEV) &
 & ,  ZDENO5(KLON,KLEV)     , ZNUME5(KLON,KLEV) &
 & ,  ZBMU05(KLON,KLEV)     , ZBMU15(KLON,KLEV)&
 & ,  ZFACOA5(KLON,KLEV)&
 & ,  ZCORAE5(KLON,KLEV)&
 & ,  ZRATIO5(KLON,KLEV) , ZTRAY5(KLON,KLEV)&
 & ,  ZPIZAZ05(KLON,KLEV), ZPIZAZ15(KLON,KLEV)&
 & ,  ZCGAZ05 (KLON,KLEV), ZCGAZ15 (KLON,KLEV)&
 & ,  ZTAUAZ05(KLON,KLEV) 
REAL(KIND=JPRB) :: ZMUE5(KLON,KLEV+1),ZRR5(KLON,KLEV+1) 
REAL(KIND=JPRB) :: ZIPIZAZ5(KLON,KLEV), ZIPTAUZ5(KLON,KLEV)
REAL(KIND=JPRB) :: ZIDENB5(KLON,KLEV), ZICLEAR5(KLON,KLEV)
REAL(KIND=JPRB) :: ZDIV15(KLON,KLEV), ZDIV25(KLON,KLEV)

REAL(KIND=JPRB) :: ZC0I(KLON,KLEV+1),  ZCLEAR(KLON)&
 & ,  ZTR(KLON,2,KLEV+1), ZSCAT(KLON)  

INTEGER(KIND=JPIM) :: IKL, IKLP1, IKM1, JA, JAE, JAJ, JK, JL, INU1

REAL(KIND=JPRB) :: ZBMU0, ZBMU1, ZCGAZ1, ZCORAE, ZDEN0, ZDEN1, ZDENB, &
 & ZDENO, ZFACOA, ZFF, ZFF5, ZMUE, &
 & ZNUME, ZPIZAZ1, ZR21, ZRATIO, ZRE11, &
 & ZSS0, ZTRAY
REAL(KIND=JPRB) :: ZRR

REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

!*         1.    OPTICAL PARAMETERS FOR AEROSOLS AND RAYLEIGH
!                --------------------------------------------

! 100 CONTINUE

IF (LHOOK) CALL DR_HOOK('SWCLRAD',0,ZHOOK_HANDLE)
DO JK = 1 , KLEV+1
  DO JA = 1 , 6
    DO JL = KIDIA,KFDIA
      PRJ05(JL,JA,JK) = 0.0_JPRB
      PRK05(JL,JA,JK) = 0.0_JPRB
    ENDDO
  ENDDO
ENDDO

! ------   NB: 'PAER' AEROSOLS ARE ENTERD FROM TOP TO BOTTOM

DO JK = 1 , KLEV
  IKL=KLEV+1-JK
  DO JL = KIDIA,KFDIA
    ZCGAZ05 (JL,JK) = 0.0_JPRB
    ZPIZAZ05(JL,JK) = 0.0_JPRB
    ZTAUAZ05(JL,JK) = 0.0_JPRB
  ENDDO
  DO JL = KIDIA,KFDIA
    ZTAUAZ05(JL,JK)= PAER5(JL,1,IKL)*RTAUA(KNU,1)&
     & +PAER5(JL,2,IKL)*RTAUA(KNU,2)&
     & +PAER5(JL,3,IKL)*RTAUA(KNU,3)&
     & +PAER5(JL,4,IKL)*RTAUA(KNU,4)&
     & +PAER5(JL,5,IKL)*RTAUA(KNU,5)&
     & +PAER5(JL,6,IKL)*RTAUA(KNU,6)  
    ZPIZAZ05(JL,JK)= PAER5(JL,1,IKL)*RTAUA(KNU,1)*RPIZA(KNU,1)&
     & +PAER5(JL,2,IKL)*RTAUA(KNU,2)*RPIZA(KNU,2)&
     & +PAER5(JL,3,IKL)*RTAUA(KNU,3)*RPIZA(KNU,3)&
     & +PAER5(JL,4,IKL)*RTAUA(KNU,4)*RPIZA(KNU,4)&
     & +PAER5(JL,5,IKL)*RTAUA(KNU,5)*RPIZA(KNU,5)&
     & +PAER5(JL,6,IKL)*RTAUA(KNU,6)*RPIZA(KNU,6)  
    ZCGAZ05(JL,JK) = PAER5(JL,1,IKL)&
     & * RTAUA(KNU,1)*RPIZA(KNU,1)*RCGA(KNU,1)&
     & + PAER5(JL,2,IKL)&
     & * RTAUA(KNU,2)*RPIZA(KNU,2)*RCGA(KNU,2)&
     & + PAER5(JL,3,IKL)&
     & * RTAUA(KNU,3)*RPIZA(KNU,3)*RCGA(KNU,3)&
     & + PAER5(JL,4,IKL)&
     & * RTAUA(KNU,4)*RPIZA(KNU,4)*RCGA(KNU,4)&
     & + PAER5(JL,5,IKL)&
     & * RTAUA(KNU,5)*RPIZA(KNU,5)*RCGA(KNU,5)&
     & + PAER5(JL,6,IKL)&
     & * RTAUA(KNU,6)*RPIZA(KNU,6)*RCGA(KNU,6)  
  ENDDO

  DO JL = KIDIA,KFDIA
    IF (KAER /= 0) THEN
      ZIPIZAZ5(JL,JK) = 1.0_JPRB/ZPIZAZ05(JL,JK)
      ZCGAZ15(JL,JK) =ZCGAZ05(JL,JK) * ZIPIZAZ5(JL,JK)
      ZIPTAUZ5(JL,JK) = 1.0_JPRB/ZTAUAZ05(JL,JK)
      ZPIZAZ15(JL,JK)=ZPIZAZ05(JL,JK)*ZIPTAUZ5(JL,JK)
      ZTRAY5(JL,JK) = PRAYL5(JL) * PDSIG5(JL,JK)
!      ZRATIO5(JL,JK)= ZTRAY5(JL,JK) / (ZTRAY5(JL,JK)+ZTAUAZ05(JL,JK))

      ZFF5 = ZCGAZ15(JL,JK) * ZCGAZ15(JL,JK)
      
      ZDENB5(JL,JK)= ZTRAY5(JL,JK)+ZTAUAZ05(JL,JK) &
       & *(1.0_JPRB-ZPIZAZ15(JL,JK)*ZFF5)
      ZIDENB5(JL,JK) = 1.0_JPRB/ZDENB5(JL,JK)
      ZRATIO5(JL,JK)= ZTRAY5(JL,JK) * ZIDENB5(JL,JK)

      PTAUAZ5(JL,JK)=ZTRAY5(JL,JK)&
       & +ZTAUAZ05(JL,JK)*(1.0_JPRB-ZPIZAZ15(JL,JK)*ZFF5) 
      ZDIV15(JL,JK) = 1.0_JPRB/(1.0_JPRB + ZCGAZ15(JL,JK)) 
      PCGAZ5(JL,JK) = ZCGAZ15(JL,JK)*(1.0_JPRB - ZRATIO5(JL,JK)) &
       & * ZDIV15(JL,JK)

      ZDIV25(JL,JK) = 1.0_JPRB/(1.0_JPRB - ZPIZAZ15(JL,JK) * ZFF5)
      PPIZAZ5(JL,JK)= ZRATIO5(JL,JK)&
       & + (1.0_JPRB-ZRATIO5(JL,JK))*ZPIZAZ15(JL,JK)*(1.0_JPRB-ZFF5)&
       & * ZDIV25(JL,JK)
    ELSE
      ZTRAY5(JL,JK) = PRAYL5(JL) * PDSIG5(JL,JK)
      PTAUAZ5(JL,JK) = ZTRAY5(JL,JK)
      PCGAZ5 (JL,JK) = 0.0_JPRB
      PPIZAZ5(JL,JK) = 1.0_JPRB-REPSCT
    ENDIF
  ENDDO
ENDDO

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

!*         2.    TOTAL EFFECTIVE CLOUDINESS ABOVE A GIVEN LEVEL
!                ----------------------------------------------

! 200 CONTINUE

DO JL = KIDIA,KFDIA
  ZC0I5(JL,KLEV+1)   = 0.0_JPRB
  ZCLEAR5(JL,KLEV+1) = 1.0_JPRB
  ZSCAT5(JL,KLEV+1)  = 0.0_JPRB
ENDDO

DO JK = 1 , KLEV
  IKL = KLEV+1 - JK
  IKLP1 = IKL + 1
  DO JL = KIDIA,KFDIA
    ZFACOA5(JL,IKL) = 1.0_JPRB - PPIZAZ5(JL,IKL)*  PCGAZ5(JL,IKL)**2
    ZCORAE5(JL,IKL) = ZFACOA5(JL,IKL) * PTAUAZ5(JL,IKL) * PSEC5(JL)
    ZR215(JL,IKL) = EXP(-ZCORAE5(JL,IKL) )
    ZSS05(JL,IKL) = 1.0_JPRB-ZR215(JL,IKL)
    IF (NOVLP == 1 .OR. NOVLP == 4) THEN
!* maximum-random      
      IF (ZSS05(JL,IKL) >= ZSCAT5(JL,IKLP1)) THEN
        ZNUME5(JL,IKL)= ZSS05(JL,IKL)
      ELSE
        ZNUME5(JL,IKL) = ZSCAT5(JL,IKLP1)
      ENDIF
      IF (ZSCAT5(JL,IKLP1) <= 1.0_JPRB-REPCLC) THEN
        ZDENO5(JL,IKL) = ZSCAT5(JL,IKLP1)
      ELSE
        ZDENO5(JL,IKL) = 1.0_JPRB-REPCLC
      ENDIF
      ZICLEAR5(JL,IKL) = 1.0_JPRB/(1.0_JPRB-ZDENO5(JL,IKL))
      ZCLEAR5(JL,IKL)= ZCLEAR5(JL,IKLP1)&
       & * (1.0_JPRB-ZNUME5(JL,IKL)) * ZICLEAR5(JL,IKL)  
      ZC0I5(JL,IKL) = 1.0_JPRB - ZCLEAR5(JL,IKL)
      ZSCAT5(JL,IKL) = ZSS05(JL,IKL)
    ELSEIF (NOVLP == 2) THEN
!* maximum
      IF (ZSS05(JL,IKL) >= ZSCAT5(JL,IKLP1)) THEN
        ZSCAT5(JL,IKL) = ZSS05(JL,IKL)
      ELSE
        ZSCAT5(JL,IKL) = ZSCAT5(JL,IKLP1)
      ENDIF
      ZC0I5(JL,IKL) = ZSCAT5(JL,IKL)
      ZCLEAR5(JL,IKL) = 1.0_JPRB 
    ELSEIF (NOVLP == 3) THEN
!* random
      ZCLEAR5(JL,IKL) = ZCLEAR5(JL,IKLP1)*(1.0_JPRB-ZSS05(JL,IKL))
      ZSCAT5(JL,IKL)  = 1.0_JPRB - ZCLEAR5(JL,IKL)
      ZC0I5(JL,IKL)   = ZSCAT5(JL,IKL)
    ENDIF
  ENDDO
ENDDO

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

!*         3.    REFLECTIVITY/TRANSMISSIVITY FOR PURE SCATTERING
!                -----------------------------------------------

! 300 CONTINUE

DO JL = KIDIA,KFDIA
  PRAY15(JL,KLEV+1) = 0.0_JPRB
  PRAY25(JL,KLEV+1) = 0.0_JPRB
  PREFZ5(JL,2,1) = PALBP5(JL,KNU)
  PREFZ5(JL,1,1) = PALBP5(JL,KNU)
  PTRA15(JL,KLEV+1) = 1.0_JPRB
  PTRA25(JL,KLEV+1) = 1.0_JPRB
ENDDO

DO JK = 2 , KLEV+1
  IKM1 = JK-1
  DO JL = KIDIA,KFDIA

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

!*         3.1  EQUIVALENT ZENITH ANGLE
!               -----------------------

! 310 CONTINUE

    ZMUE5(JL,JK) = (1.0_JPRB-ZC0I5(JL,JK))*PSEC5(JL) + ZC0I5(JL,JK)*1.66_JPRB
    PRMU05(JL,JK) = 1.0_JPRB/ZMUE5(JL,JK)

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

!*         3.2  REFLECT./TRANSMISSIVITY DUE TO RAYLEIGH AND AEROSOLS
!               ----------------------------------------------------

! 320 CONTINUE

    ZBMU05(JL,IKM1) = 0.5_JPRB - 0.75_JPRB * PCGAZ5(JL,IKM1) * PRMU05(JL,JK)
    ZDEN05(JL,IKM1)= 1.0_JPRB &
     & + (1.0_JPRB - PPIZAZ5(JL,IKM1) + ZBMU05(JL,IKM1) * PPIZAZ5(JL,IKM1))&
     & * PTAUAZ5(JL,IKM1) * ZMUE5(JL,JK) &
     & + (1-PPIZAZ5(JL,IKM1)) * (1.0_JPRB - PPIZAZ5(JL,IKM1)&
     & + 2.0_JPRB*ZBMU05(JL,IKM1)*PPIZAZ5(JL,IKM1))*PTAUAZ5(JL,IKM1)**2 &
     & * ZMUE5(JL,JK)**2  
    PTRA15(JL,IKM1) = 1.0_JPRB/ZDEN05(JL,IKM1)
    PRAY15(JL,IKM1) = ZBMU05(JL,IKM1) * PPIZAZ5(JL,IKM1)&
     & * PTAUAZ5(JL,IKM1) * ZMUE5(JL,JK) *PTRA15(JL,IKM1)  

    ZBMU15(JL,IKM1) = 0.5_JPRB - 0.75_JPRB * PCGAZ5(JL,IKM1) * 0.5_JPRB
    ZDEN15(JL,IKM1)= 1.0_JPRB &
     & + (1.0_JPRB - PPIZAZ5(JL,IKM1) + ZBMU15(JL,IKM1) * PPIZAZ5(JL,IKM1)) &
     & * PTAUAZ5(JL,IKM1) * 2.0_JPRB   &
     & + (1-PPIZAZ5(JL,IKM1)) * (1.0_JPRB - PPIZAZ5(JL,IKM1)&
     & + 2.0_JPRB*ZBMU15(JL,IKM1)*PPIZAZ5(JL,IKM1))*PTAUAZ5(JL,IKM1)**2 &
     & * 4.0_JPRB  
    PTRA25(JL,IKM1) = 1.0_JPRB/ZDEN15(JL,IKM1)
    PRAY25(JL,IKM1) = ZBMU15(JL,IKM1) * PPIZAZ5(JL,IKM1)&
     & * PTAUAZ5(JL,IKM1) * 2.0_JPRB * PTRA25(JL,IKM1)  

    ZRR5(JL,IKM1) = 1.0_JPRB/(1.0_JPRB-PRAY25(JL,IKM1)*PREFZ5(JL,1,IKM1))
    PREFZ5(JL,1,JK) =  PRAY15(JL,IKM1)&
     & + PREFZ5(JL,1,IKM1) * PTRA15(JL,IKM1) * PTRA25(JL,IKM1) * ZRR5(JL,IKM1)
    ZTR5(JL,1,IKM1) =  PTRA15(JL,IKM1) * ZRR5(JL,IKM1)  

    PREFZ5(JL,2,JK) =  PRAY15(JL,IKM1) &
     & + PREFZ5(JL,2,IKM1) * PTRA15(JL,IKM1) * PTRA25(JL,IKM1)   
    ZTR5(JL,2,IKM1) = PTRA15(JL,IKM1)
  ENDDO
ENDDO

DO JL = KIDIA,KFDIA
  ZMUE5(JL,1) = (1.0_JPRB-ZC0I5(JL,1))*PSEC5(JL)+ZC0I5(JL,1)*1.66_JPRB
  PRMU05(JL,1)=1.0_JPRB/ZMUE5(JL,1)
ENDDO

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

!*         3.5    REFLECT./TRANSMISSIVITY BETWEEN SURFACE AND LEVEL
!                 -------------------------------------------------

! 350 CONTINUE

IF (NSW <= 4) THEN
  INU1=1
ELSEIF (NSW == 6) THEN
  INU1=3
ENDIF

IF (KNU <= INU1) THEN
  JAJ = 2
  DO JL = KIDIA,KFDIA
    PRJ05(JL,JAJ,KLEV+1) = 1.0_JPRB
    PRK05(JL,JAJ,KLEV+1) = PREFZ5(JL, 1,KLEV+1)
  ENDDO

  DO JK = 1 , KLEV
    IKL = KLEV+1 - JK
    IKLP1 = IKL + 1
    DO JL = KIDIA,KFDIA
      ZRE115(JL,JAJ,IKL)= PRJ05(JL,JAJ,IKLP1) * ZTR5(JL,  1,IKL)
      PRJ05(JL,JAJ,IKL) = ZRE115(JL,JAJ,IKL)
      PRK05(JL,JAJ,IKL) = ZRE115(JL,JAJ,IKL) * PREFZ5(JL,  1,IKL)
    ENDDO
  ENDDO

ELSE

  DO JAJ = 1 , 2
    DO JL = KIDIA,KFDIA
      PRJ05(JL,JAJ,KLEV+1) = 1.0_JPRB
      PRK05(JL,JAJ,KLEV+1) = PREFZ5(JL,JAJ,KLEV+1)
    ENDDO

    DO JK = 1 , KLEV
      IKL = KLEV+1 - JK
      IKLP1 = IKL + 1
      DO JL = KIDIA,KFDIA
        ZRE115(JL,JAJ,IKL)= PRJ05(JL,JAJ,IKLP1) * ZTR5(JL,JAJ,IKL)
        PRJ05(JL,JAJ,IKL) = ZRE115(JL,JAJ,IKL)
        PRK05(JL,JAJ,IKL) = ZRE115(JL,JAJ,IKL) * PREFZ5(JL,JAJ,IKL)
      ENDDO
    ENDDO
  ENDDO

ENDIF

!     ==================================================================

!*         10.     ADJOINT CALCULATIONS
!                  --------------------

ZC0I(:,:)  = 0.0_JPRB
ZTR(:,:,:) = 0.0_JPRB

IF (KNU <= INU1) THEN

  JAJ=2
  DO JK=KLEV,1,-1
    IKL=KLEV+1-JK
    IKLP1=IKL+1
    DO JL=KIDIA,KFDIA
!------      
      ZRE11 = 0.0_JPRB

      ZRE11 = ZRE11 + PRK0(JL,JAJ,IKL) * PREFZ5(JL,1,IKL)
      PREFZ(JL,1,IKL) = PREFZ(JL,1,IKL)&
       & + PRK0(JL,JAJ,IKL) * ZRE115(JL,JAJ,IKL)  
      PRK0(JL,JAJ,IKL) = 0.0_JPRB

      ZRE11 = ZRE11 + PRJ0(JL,JAJ,IKL)
      PRJ0(JL,JAJ,IKL) = 0.0_JPRB

      PRJ0(JL,JAJ,IKLP1) = PRJ0(JL,JAJ,IKLP1) + ZRE11 * ZTR5(JL,1,IKL)
      ZTR(JL,1,IKL) = ZTR(JL,1,IKL) + ZRE11 * PRJ05(JL,JAJ,IKLP1)
!      ZRE11 = 0.0_JPRB
    ENDDO
  ENDDO

  DO JL=KIDIA,KFDIA
    PREFZ(JL,1,KLEV+1) = PREFZ(JL,1,KLEV+1) + PRK0(JL,JAJ,KLEV+1)
    PRK0(JL,JAJ,KLEV+1) = 0.0_JPRB
    PRJ0(JL,JAJ,KLEV+1) = 0.0_JPRB
  ENDDO

ELSE

  DO JAJ=1,2

    DO JK=KLEV,1,-1
      IKL=KLEV+1-JK
      IKLP1=IKL+1
      DO JL=KIDIA,KFDIA
!------      
        ZRE11 = 0.0_JPRB

        ZRE11 = ZRE11 + PRK0(JL,JAJ,IKL) * PREFZ5(JL,JAJ,IKL)
        PREFZ(JL,JAJ,IKL) = PREFZ(JL,JAJ,IKL)&
         & + PRK0(JL,JAJ,IKL) * ZRE115(JL,JAJ,IKL)  
        PRK0(JL,JAJ,IKL) = 0.0_JPRB

        ZRE11 = ZRE11 + PRJ0(JL,JAJ,IKL)
        PRJ0(JL,JAJ,IKL) = 0.0_JPRB

        PRJ0(JL,JAJ,IKLP1) = PRJ0(JL,JAJ,IKLP1) + ZRE11 * ZTR5(JL,JAJ,IKL)
        ZTR(JL,JAJ,IKL) = ZTR(JL,JAJ,IKL) + ZRE11 * PRJ05(JL,JAJ,IKLP1)
!        ZRE11 = 0.0_JPRB
      ENDDO
    ENDDO

    DO JL=KIDIA,KFDIA
      PREFZ(JL,JAJ,KLEV+1) = PREFZ(JL,JAJ,KLEV+1) + PRK0(JL,JAJ,KLEV+1)
      PRK0(JL,JAJ,KLEV+1) = 0.0_JPRB
      PRJ0(JL,JAJ,KLEV+1) = 0.0_JPRB
    ENDDO

  ENDDO

ENDIF

!1350 CONTINUE

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

DO JL=KIDIA,KFDIA
!------      
  ZMUE = 0.0_JPRB

  ZMUE = ZMUE - PRMU0(JL,1)*PRMU05(JL,1)**2
  PRMU0(JL,1) = 0.0_JPRB

  ZC0I(JL,1) = ZC0I(JL,1) - ZMUE * PSEC5(JL)
  PSEC(JL) = PSEC(JL) + ZMUE *(1.0_JPRB-ZC0I5(JL,1))
  ZC0I(JL,1) = ZC0I(JL,1) + ZMUE*1.66_JPRB
!  ZMUE = 0.0_JPRB
ENDDO

DO JK=KLEV+1,2,-1
  IKM1=JK-1

  DO JL=KIDIA,KFDIA
    ZRR=0.0_JPRB

    PTRA1(JL,IKM1) = PTRA1(JL,IKM1) + ZTR(JL,2,IKM1)
    ZTR(JL,2,IKM1) = 0.0_JPRB

    PRAY1(JL,IKM1) = PRAY1(JL,IKM1) + PREFZ(JL,2,JK)
    ZRR=ZRR+ZTR(JL,1,IKM1)*PTRA15(JL,IKM1)
    PREFZ(JL,2,IKM1) = PREFZ(JL,2,IKM1)&
     & + PREFZ(JL,2,JK) *PTRA15(JL,IKM1)*PTRA25(JL,IKM1)   
    PTRA1(JL,IKM1) = PTRA1(JL,IKM1)&
     & + PREFZ(JL,2,JK) *PREFZ5(JL,2,IKM1)*PTRA25(JL,IKM1)  
    PTRA2(JL,IKM1) = PTRA2(JL,IKM1)&
     & + PREFZ(JL,2,JK) *PREFZ5(JL,2,IKM1)*PTRA15(JL,IKM1)  
    PREFZ(JL,2,JK) = 0.0_JPRB

    PTRA1(JL,IKM1) = PTRA1(JL,IKM1) + ZTR(JL,1,IKM1)&
     & *ZRR5(JL,IKM1)  
    ZTR(JL,1,IKM1) = 0.0_JPRB

    PRAY1(JL,IKM1) = PRAY1(JL,IKM1) + PREFZ(JL,1,JK)
    ZRR=ZRR+ PREFZ(JL,1,JK) *PREFZ5(JL,1,IKM1)*PTRA15(JL,IKM1)*PTRA25(JL,IKM1)
    PREFZ(JL,1,IKM1) = PREFZ(JL,1,IKM1)&
     & + PREFZ(JL,1,JK) *PTRA15(JL,IKM1)*PTRA25(JL,IKM1) &
     & *ZRR5(JL,IKM1)  
    PTRA1(JL,IKM1) = PTRA1(JL,IKM1)&
     & + PREFZ(JL,1,JK) *PREFZ5(JL,1,IKM1)*PTRA25(JL,IKM1)&
     & *ZRR5(JL,IKM1)  
    PTRA2(JL,IKM1) = PTRA2(JL,IKM1)&
     & + PREFZ(JL,1,JK) *PREFZ5(JL,1,IKM1)*PTRA15(JL,IKM1)&
     & *ZRR5(JL,IKM1)  
    PRAY2(JL,IKM1) = PRAY2(JL,IKM1)+ZRR*PREFZ5(JL,1,IKM1)*ZRR5(JL,IKM1)**2
    PREFZ(JL,1,IKM1) = PREFZ(JL,1,IKM1)+ZRR*PRAY25(JL,IKM1)*ZRR5(JL,IKM1)**2
    PREFZ(JL,1,JK) = 0.0_JPRB

!------
    ZDEN1 = 0.0_JPRB
    ZBMU1 = 0.0_JPRB
    ZMUE  = 0.0_JPRB
    ZDEN0 = 0.0_JPRB
    ZBMU0 = 0.0_JPRB

    ZBMU1 = ZBMU1 + PRAY2(JL,IKM1) *PPIZAZ5(JL,IKM1)*PTAUAZ5(JL,IKM1)&
     & *2.0_JPRB*PTRA25(JL,IKM1)  
    PPIZAZ(JL,IKM1) = PPIZAZ(JL,IKM1) &
     & + PRAY2(JL,IKM1)*ZBMU15(JL,IKM1)*PTAUAZ5(JL,IKM1) &
     & * 2.0_JPRB*PTRA25(JL,IKM1)  
    PTAUAZ(JL,IKM1) = PTAUAZ(JL,IKM1) &
     & + PRAY2(JL,IKM1)*ZBMU15(JL,IKM1)*PPIZAZ5(JL,IKM1) &
     & * 2.0_JPRB*PTRA25(JL,IKM1)  
    PTRA2(JL,IKM1) = PTRA2(JL,IKM1) &
     & + PRAY2(JL,IKM1)*ZBMU15(JL,IKM1)*PPIZAZ5(JL,IKM1) &
     & * 2.0_JPRB*PTAUAZ5(JL,IKM1)
    PRAY2(JL,IKM1) = 0.0_JPRB

    ZDEN1 = ZDEN1 - PTRA2(JL,IKM1)*(PTRA25(JL,IKM1)**2)
    PTRA2(JL,IKM1) = 0.0_JPRB

    PPIZAZ(JL,IKM1) = PPIZAZ(JL,IKM1) - ZDEN1 *PTAUAZ5(JL,IKM1)*2.0_JPRB
    ZBMU1 = ZBMU1 + ZDEN1 *PPIZAZ5(JL,IKM1)*PTAUAZ5(JL,IKM1)*2.0_JPRB
    PPIZAZ(JL,IKM1) = PPIZAZ(JL,IKM1) &
     & + ZDEN1 *ZBMU15(JL,IKM1) *PTAUAZ5(JL,IKM1)*2.0_JPRB
    PTAUAZ(JL,IKM1)   = PTAUAZ(JL,IKM1) + ZDEN1*2.0_JPRB &
     & *(1.0_JPRB-PPIZAZ5(JL,IKM1)+ZBMU15(JL,IKM1)*PPIZAZ5(JL,IKM1)) 
    PPIZAZ(JL,IKM1)  = PPIZAZ(JL,IKM1) - ZDEN1 &
     & *(1.0_JPRB-PPIZAZ5(JL,IKM1)+2.0_JPRB*ZBMU15(JL,IKM1)*PPIZAZ5(JL,IKM1))&
     & *(PTAUAZ5(JL,IKM1)**2)*4.0_JPRB  
    PPIZAZ(JL,IKM1)  = PPIZAZ(JL,IKM1) - ZDEN1 *(1.0_JPRB-PPIZAZ5(JL,IKM1))&
     & *(PTAUAZ5(JL,IKM1)**2)*4.0_JPRB
    ZBMU1 = ZBMU1 + ZDEN1 &
     & *(1.0_JPRB-PPIZAZ5(JL,IKM1))*2.0_JPRB*PPIZAZ5(JL,IKM1)&
     & *(PTAUAZ5(JL,IKM1)**2)*4.0_JPRB  
    PPIZAZ(JL,IKM1)  = PPIZAZ(JL,IKM1) &
     & + ZDEN1 *(1.0_JPRB-PPIZAZ5(JL,IKM1))*2.0_JPRB*ZBMU15(JL,IKM1)&
     & *(PTAUAZ5(JL,IKM1)**2)*4.0_JPRB 
    PTAUAZ(JL,IKM1)  = PTAUAZ(JL,IKM1) &
     & + ZDEN1 *(1.0_JPRB-PPIZAZ5(JL,IKM1))*2.0_JPRB*PTAUAZ5(JL,IKM1) &
     & *(1.0_JPRB-PPIZAZ5(JL,IKM1)+2.0_JPRB*ZBMU15(JL,IKM1)*PPIZAZ5(JL,IKM1))&
     & *4.0_JPRB 
!    ZDEN1 = 0.0_JPRB

    PCGAZ(JL,IKM1) = PCGAZ(JL,IKM1) - ZBMU1 *0.75_JPRB*0.5_JPRB
!    ZBMU1 = 0.0_JPRB

    ZBMU0 = ZBMU0 + PRAY1(JL,IKM1)&
     & *PPIZAZ5(JL,IKM1)*PTAUAZ5(JL,IKM1)*ZMUE5(JL,JK) &
     & *PTRA15(JL,IKM1)
    PPIZAZ(JL,IKM1) = PPIZAZ(JL,IKM1) + PRAY1(JL,IKM1) &
     & *ZBMU05(JL,IKM1)*PTAUAZ5(JL,IKM1)*ZMUE5(JL,JK) &
     & *PTRA15(JL,IKM1)
    PTAUAZ(JL,IKM1) = PTAUAZ(JL,IKM1) + PRAY1(JL,IKM1) &
     & *ZBMU05(JL,IKM1)*PPIZAZ5(JL,IKM1)*ZMUE5(JL,JK) &
     & *PTRA15(JL,IKM1)
    ZMUE = ZMUE + PRAY1(JL,IKM1)&
     & *ZBMU05(JL,IKM1)*PPIZAZ5(JL,IKM1)*PTAUAZ5(JL,IKM1)&
     & *PTRA15(JL,IKM1)
    PTRA1(JL,IKM1) = PTRA1(JL,IKM1) + PRAY1(JL,IKM1)&
     & *ZBMU05(JL,IKM1)*PPIZAZ5(JL,IKM1)*PTAUAZ5(JL,IKM1)&
     & *ZMUE5(JL,JK)
    PRAY1(JL,IKM1) = 0.0_JPRB

    ZDEN0 = ZDEN0-PTRA1(JL,IKM1)*(PTRA15(JL,IKM1)**2)
    PTRA1(JL,IKM1) = 0.0_JPRB

    PPIZAZ(JL,IKM1) = PPIZAZ(JL,IKM1) - ZDEN0 *PTAUAZ5(JL,IKM1)*ZMUE5(JL,JK)
    ZBMU0 = ZBMU0 + ZDEN0 *PPIZAZ5(JL,IKM1)*PTAUAZ5(JL,IKM1)*ZMUE5(JL,JK)
    PPIZAZ(JL,IKM1) = PPIZAZ(JL,IKM1) &
     & + ZDEN0 *ZBMU05(JL,IKM1)*PTAUAZ5(JL,IKM1)*ZMUE5(JL,JK)
    PTAUAZ(JL,IKM1) = PTAUAZ(JL,IKM1) + ZDEN0*(1.0_JPRB-PPIZAZ5(JL,IKM1) &
     & +ZBMU05(JL,IKM1)*PPIZAZ5(JL,IKM1))*ZMUE5(JL,JK)
    ZMUE = ZMUE + ZDEN0 *PTAUAZ5(JL,IKM1)&
     & *(1.0_JPRB-PPIZAZ5(JL,IKM1)+ZBMU05(JL,IKM1)*PPIZAZ5(JL,IKM1))
    PPIZAZ(JL,IKM1) = PPIZAZ(JL,IKM1) &
     & - ZDEN0*(PTAUAZ5(JL,IKM1)**2)*(1.0_JPRB-PPIZAZ5(JL,IKM1) &
     & + 2.0_JPRB*ZBMU05(JL,IKM1)*PPIZAZ5(JL,IKM1))*ZMUE5(JL,JK)**2
    PPIZAZ(JL,IKM1) = PPIZAZ(JL,IKM1) - ZDEN0*(1.0_JPRB-PPIZAZ5(JL,IKM1)) &
     & *(PTAUAZ5(JL,IKM1)**2)* ZMUE5(JL,JK)**2
    ZBMU0 = ZBMU0 + ZDEN0 *2.0_JPRB*PPIZAZ5(JL,IKM1) &
     & *(1.0_JPRB-PPIZAZ5(JL,IKM1))*(PTAUAZ5(JL,IKM1)**2)*ZMUE5(JL,JK)**2
    PPIZAZ(JL,IKM1) = PPIZAZ(JL,IKM1) + ZDEN0*2.0_JPRB*ZBMU05(JL,IKM1) &
     & *(1.0_JPRB-PPIZAZ5(JL,IKM1))*(PTAUAZ5(JL,IKM1)**2)*ZMUE5(JL,JK)**2
    PTAUAZ(JL,IKM1) = PTAUAZ(JL,IKM1) &
     & + ZDEN0 *2.0_JPRB*PTAUAZ5(JL,IKM1)*(1.0_JPRB-PPIZAZ5(JL,IKM1))&
     & *(1.0_JPRB-PPIZAZ5(JL,IKM1)+2.0_JPRB*ZBMU05(JL,IKM1)*PPIZAZ5(JL,IKM1))&
     & * ZMUE5(JL,JK)**2  
    ZMUE = ZMUE + ZDEN0 *2*(PTAUAZ5(JL,IKM1)**2)*ZMUE5(JL,JK) &
     & *(1.0_JPRB-PPIZAZ5(JL,IKM1))&
     & *(1.0_JPRB-PPIZAZ5(JL,IKM1)+2.0_JPRB*ZBMU05(JL,IKM1)*PPIZAZ5(JL,IKM1))
!    ZDEN0 = 0.0_JPRB

    PCGAZ(JL,IKM1) = PCGAZ(JL,IKM1) - 0.75_JPRB*PRMU05(JL,JK)*ZBMU0
    PRMU0(JL,JK) = PRMU0(JL,JK) - 0.75_JPRB * PCGAZ5(JL,IKM1)*ZBMU0
!    ZBMU0 = 0.0_JPRB

!1320 CONTINUE

    ZMUE = ZMUE - PRMU0(JL,JK)*(PRMU05(JL,JK)**2)
    PRMU0(JL,JK) = 0.0_JPRB

    ZC0I(JL,JK) = ZC0I(JL,JK) - ZMUE *PSEC5(JL)
    PSEC(JL) = PSEC(JL) + ZMUE *(1.0_JPRB-ZC0I5(JL,JK))
    ZC0I(JL,JK) = ZC0I(JL,JK) + ZMUE *1.66_JPRB
!    ZMUE = 0.0_JPRB

!1310 CONTINUE

  ENDDO

ENDDO

DO JL=KIDIA,KFDIA
  PTRA2(JL,KLEV+1) = 0.0_JPRB
  PTRA1(JL,KLEV+1) = 0.0_JPRB

  PALBP(JL,KNU) = PALBP(JL,KNU) + PREFZ(JL,1,1)
  PREFZ(JL,1,1) = 0.0_JPRB

  PALBP(JL,KNU) = PALBP(JL,KNU) + PREFZ(JL,2,1)
  PREFZ(JL,2,1) = 0.0_JPRB

  PRAY2(JL,KLEV+1) = 0.0_JPRB
  PRAY1(JL,KLEV+1) = 0.0_JPRB
ENDDO

!1300 CONTINUE             

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

ZCLEAR(:) = 0.0_JPRB
ZSCAT (:) = 0.0_JPRB

DO JK=KLEV,1,-1
  IKL=KLEV+1-JK
  IKLP1=IKL+1

  DO JL=KIDIA,KFDIA
    ZSS0   = 0.0_JPRB
    ZNUME  = 0.0_JPRB
    ZDENO  = 0.0_JPRB
    ZR21   = 0.0_JPRB
    ZCORAE = 0.0_JPRB
    ZFACOA = 0.0_JPRB

    IF (NOVLP == 3) THEN
      ZSCAT(JL) = ZSCAT(JL) + ZC0I(JL,IKL)
      ZC0I(JL,IKL) = 0.0_JPRB

      ZCLEAR(JL) = ZCLEAR(JL) - ZSCAT(JL)
      ZSCAT(JL) = 0.0_JPRB

      ZSS0 = ZSS0 - ZCLEAR(JL) *ZCLEAR5(JL,IKLP1)
      ZCLEAR(JL)=ZCLEAR(JL)*(1.-ZSS05(JL,IKL))

    ELSEIF (NOVLP == 2) THEN
      ZSCAT(JL) = ZSCAT(JL) + ZC0I(JL,IKL)
      ZC0I(JL,IKL) = 0.0_JPRB

      IF (ZSS05(JL,IKL) >= ZSCAT5(JL,IKLP1)) THEN
        ZSS0 = ZSS0 + ZSCAT(JL)
        ZSCAT(JL) = 0.0_JPRB
      ENDIF
      ZCLEAR(JL) = 0.0_JPRB

    ELSEIF (NOVLP == 1 .OR. NOVLP == 4) THEN
      ZSS0 = ZSS0 + ZSCAT(JL)
      ZSCAT(JL) = 0.0_JPRB

      ZCLEAR(JL) = ZCLEAR(JL) - ZC0I(JL,IKL)
      ZC0I(JL,IKL) = 0.0_JPRB

      ZNUME = ZNUME-ZCLEAR(JL) *ZCLEAR5(JL,IKLP1)*ZICLEAR5(JL,IKL)  
      ZDENO = ZDENO&
       & +ZCLEAR(JL) *ZCLEAR5(JL,IKLP1)*(1.0_JPRB-ZNUME5(JL,IKL))&
       & *(ZICLEAR5(JL,IKL)**2)  
      ZCLEAR(JL) = ZCLEAR(JL)*(1.0_JPRB-ZNUME5(JL,IKL))*ZICLEAR5(JL,IKL)  

      IF (ZSCAT5(JL,IKLP1) <= 1.0_JPRB-REPCLC) THEN
        ZSCAT(JL) = ZSCAT(JL) + ZDENO
      ENDIF
!      ZDENO = 0.0_JPRB

      IF (ZSS05(JL,IKL) >= ZSCAT5(JL,IKLP1)) THEN
        ZSS0 = ZSS0 + ZNUME
      ELSE
        ZSCAT(JL) = ZSCAT(JL) + ZNUME
      ENDIF
!      ZNUME = 0.0_JPRB

    ENDIF

    ZR21 = ZR21 - ZSS0
!    ZSS0 = 0.0_JPRB

    ZCORAE = ZCORAE - ZR21 *ZR215(JL,IKL)
!    ZR21 = 0.0_JPRB

    ZFACOA = ZFACOA + ZCORAE *PTAUAZ5(JL,IKL)*PSEC5(JL)
    PTAUAZ(JL,IKL) = PTAUAZ(JL,IKL)+ ZCORAE *ZFACOA5(JL,IKL)*PSEC5(JL)
    PSEC(JL) = PSEC(JL) + ZCORAE *ZFACOA5(JL,IKL)*PTAUAZ5(JL,IKL)
!    ZCORAE = 0.0_JPRB

    PPIZAZ(JL,IKL) = PPIZAZ(JL,IKL) - ZFACOA *PCGAZ5(JL,IKL)**2
    PCGAZ(JL,IKL) = PCGAZ(JL,IKL)- ZFACOA *PPIZAZ5(JL,IKL)*2*PCGAZ5(JL,IKL)
!    ZFACOA = 0.0_JPRB
  ENDDO

ENDDO

!1201 CONTINUE

!1200 CONTINUE

!1100 CONTINUE       

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

DO JK=KLEV,1,-1
  IKL=KLEV+1-JK

  DO JL=KIDIA,KFDIA
    ZFF     = 0.0_JPRB
    ZTRAY   = 0.0_JPRB
    ZRATIO  = 0.0_JPRB
    ZPIZAZ1 = 0.0_JPRB
    ZCGAZ1  = 0.0_JPRB
    ZDENB   = 0.0_JPRB

    IF (KAER == 0) THEN
      PPIZAZ(JL,JK) = 0.0_JPRB
      PCGAZ (JL,JK) = 0.0_JPRB

      ZTRAY = ZTRAY + PTAUAZ(JL,JK)
      PTAUAZ(JL,JK) = 0.0_JPRB

      PRAYL(JL) = PRAYL(JL) + ZTRAY *PDSIG5(JL,JK)
      PDSIG(JL,JK) = PDSIG(JL,JK) + ZTRAY *PRAYL5(JL)
!      ZTRAY = 0.0_JPRB

    ELSE
      ZFF5 = ZCGAZ15(JL,JK)*ZCGAZ15(JL,JK)
      ZRATIO = ZRATIO + PPIZAZ(JL,JK)
      ZRATIO = ZRATIO - PPIZAZ(JL,JK)&
       & *ZPIZAZ15(JL,JK)*(1.0_JPRB-ZFF5)*ZDIV25(JL,JK)  
      ZFF = ZFF - PPIZAZ(JL,JK)&
       & *(1.0_JPRB-ZRATIO5(JL,JK))*ZPIZAZ15(JL,JK)*ZDIV25(JL,JK)  
      ZFF = ZFF + PPIZAZ(JL,JK)&
       & *(1.0_JPRB-ZRATIO5(JL,JK))*ZPIZAZ15(JL,JK)*(1.0_JPRB-ZFF5)&
       & *ZPIZAZ15(JL,JK)*(ZDIV25(JL,JK)**2)  
      PPIZAZ(JL,JK) = PPIZAZ(JL,JK)&
       & *(1.0_JPRB-ZRATIO5(JL,JK))*(1.0_JPRB-ZFF5)*ZDIV25(JL,JK)  
      PPIZAZ(JL,JK) = PPIZAZ(JL,JK)*(1.0_JPRB-ZRATIO5(JL,JK))&
       & *ZPIZAZ15(JL,JK)*(1.0_JPRB-ZFF5)*ZFF5*(ZDIV25(JL,JK)**2)  

      ZRATIO = ZRATIO - PCGAZ(JL,JK) *ZCGAZ15(JL,JK)*ZDIV15(JL,JK)
      PCGAZ(JL,JK) = PCGAZ(JL,JK)*(1.0_JPRB-ZRATIO5(JL,JK))*ZDIV15(JL,JK) 
      PCGAZ(JL,JK) = - PCGAZ(JL,JK)*ZCGAZ15(JL,JK) &
       & *(1.0_JPRB-ZRATIO5(JL,JK))*(ZDIV15(JL,JK)**2) 

      ZTRAY = ZTRAY + PTAUAZ(JL,JK)
      PPIZAZ(JL,JK) = PPIZAZ(JL,JK) - PTAUAZ(JL,JK)&
       & *ZTAUAZ05(JL,JK)*ZFF5  
      ZFF = ZFF - PTAUAZ(JL,JK)*ZTAUAZ05(JL,JK)*ZPIZAZ15(JL,JK)
      PTAUAZ(JL,JK) = PTAUAZ(JL,JK)*(1.-ZPIZAZ15(JL,JK)*ZFF5)
!--
      ZTRAY = ZTRAY + ZRATIO*ZIDENB5(JL,JK)
      ZDENB = ZDENB - ZRATIO*ZTRAY5(JL,JK)*(ZIDENB5(JL,JK)*ZIDENB5(JL,JK))
!      ZRATIO = 0.0_JPRB
      ZTRAY = ZTRAY + ZDENB
      PTAUAZ(JL,JK) = PTAUAZ(JL,JK) + ZDENB*(1.0_JPRB-ZPIZAZ15(JL,JK)*ZFF5)
      PPIZAZ(JL,JK) = PPIZAZ(JL,JK) - ZDENB*ZTAUAZ05(JL,JK)*ZFF5
      ZFF = ZFF - ZDENB*ZTAUAZ05(JL,JK)*ZPIZAZ15(JL,JK)
!      ZDENB = 0.0_JPRB
!--
      PCGAZ(JL,JK) = PCGAZ(JL,JK) + ZFF *2*ZCGAZ15(JL,JK)
!      ZFF = 0.0_JPRB

!      ZTRAY = ZTRAY + ZRATIO /(ZTRAY5(JL,JK)+ZTAUAZ05(JL,JK))
!      ZTRAY = ZTRAY - ZRATIO &
!       & *ZTRAY5(JL,JK)/((ZTRAY5(JL,JK)+ZTAUAZ05(JL,JK))**2)  
!      PTAUAZ(JL,JK) = PTAUAZ(JL,JK) - ZRATIO&
!       & *ZTRAY5(JL,JK)/((ZTRAY5(JL,JK)+ZTAUAZ05(JL,JK))**2)  
!      ZRATIO = 0.0_JPRB

      PRAYL(JL) = PRAYL(JL) + ZTRAY *PDSIG5(JL,JK)
      PDSIG(JL,JK) = PDSIG(JL,JK) + ZTRAY *PRAYL5(JL)
!      ZTRAY = 0.0_JPRB

      PTAUAZ(JL,JK) = PTAUAZ(JL,JK)-ZPIZAZ05(JL,JK)*PPIZAZ(JL,JK)&
       & *(ZIPTAUZ5(JL,JK)**2)  
      PPIZAZ(JL,JK)=PPIZAZ(JL,JK)*ZIPTAUZ5(JL,JK)

      PPIZAZ(JL,JK)=PPIZAZ(JL,JK)-ZCGAZ05(JL,JK)*PCGAZ(JL,JK)&
       & *(ZIPIZAZ5(JL,JK)**2)  
      PCGAZ(JL,JK)=PCGAZ(JL,JK)*ZIPIZAZ5(JL,JK)
    ENDIF
  ENDDO

  DO JAE=1,6
    DO JL=KIDIA,KFDIA
      PAER(JL,JAE,IKL) = PAER(JL,JAE,IKL) + PCGAZ(JL,JK)&
       & * RTAUA(KNU,JAE)*RPIZA(KNU,JAE)*RCGA(KNU,JAE)  
      PAER(JL,JAE,IKL) = PAER(JL,JAE,IKL) + PPIZAZ(JL,JK)&
       & * RTAUA(KNU,JAE)*RPIZA(KNU,JAE)  
      PAER(JL,JAE,IKL) = PAER(JL,JAE,IKL) + PTAUAZ(JL,JK)&
       & * RTAUA(KNU,JAE)  
    ENDDO
  ENDDO
  DO JL=KIDIA,KFDIA
    PCGAZ(JL,JK)  = 0.0_JPRB
    PPIZAZ(JL,JK) = 0.0_JPRB
    PTAUAZ(JL,JK) = 0.0_JPRB
  ENDDO

ENDDO

!1100 CONTINUE              

DO JK = 1, KLEV+1
  DO JA = 1, 6
    DO JL = KIDIA,KFDIA
      PRJ0(JL,JA,JK) = 0.0_JPRB
      PRK0(JL,JA,JK) = 0.0_JPRB
    ENDDO
  ENDDO
ENDDO

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

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