!OPTIONS XOPT(HSFUN)
SUBROUTINE LWTTAD ( KIDIA, KFDIA, KLON, PGA, PGB, PUU5, PTT5, PUU, PTT )

!**** *LWTTAS* - LONGWAVE TRANSMISSION FUNCTIONS
!                      (adjoint)

!     PURPOSE.
!     --------
!           THIS ROUTINE COMPUTES THE TRANSMISSION FUNCTIONS FOR ALL THE
!     ABSORBERS (H2O, UNIFORMLY MIXED GASES, AND O3) IN ALL SIX SPECTRAL
!     INTERVALS.

!**   INTERFACE.
!     ----------
!          *LWTTAD* IS CALLED FROM *LWVNAD*, *LWVBAD*

!        EXPLICIT ARGUMENTS :
!        --------------------
!     ==== INPUTS ===
! KND    :                    ; WEIGHTING INDEX
!  Trajectory  Perturbation  Description                         Dimension
!  PGA         ---           PADE APPROXIMANTS                   (KLON,NIPD,2)
!  PGB         ---           PADE APPROXIMANTS                   (KLON,NIPD,2)
!  PUU5        PUU           ABSORBER AMOUNTS                    (KLON,NUA)

!     ==== OUTPUTS ===
!  Trajectory  Perturbation  Description                         Dimension
!  PTT5        PTT           TRANSMISSION FUNCTIONS              (KLON,NTRA)

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

!     METHOD.
!     -------

!          1. TRANSMISSION FUNCTION BY H2O AND UNIFORMLY MIXED GASES ARE
!     COMPUTED USING PADE APPROXIMANTS AND HORNER'S ALGORITHM.
!          2. TRANSMISSION BY O3 IS EVALUATED WITH MALKMUS'S BAND MODEL.
!          3. TRANSMISSION BY H2O CONTINUUM AND AEROSOLS FOLLOW AN
!     A SIMPLE EXPONENTIAL DECREASE WITH ABSORBER AMOUNT.

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

!          NONE

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

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

!     AUTHOR.
!     -------
!        M. Janiskova  *ECMWF*       27-Nov-2006

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

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

USE YOELW    , ONLY : NIPD , NTRA  ,NUA  ,RPTYPE   ,RETYPE   ,&
 & RO1H     ,RO2H     ,RPIALF0  
USE YOELWCONST,ONLY : RCH4A, RCH4B, RCN2OA, RCN2OB

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KLON 
INTEGER(KIND=JPIM),INTENT(IN)    :: KIDIA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFDIA 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGA(KLON,NIPD,2) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGB(KLON,NIPD,2) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PUU5(KLON,NUA) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PTT5(KLON,NTRA)
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PUU(KLON,NUA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PTT(KLON,NTRA) 
!     ------------------------------------------------------------------

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

INTEGER(KIND=JPIM) :: JA, JL

REAL(KIND=JPRB) :: ZA11, ZA12, ZAERCN, ZEU10, ZEU11, ZEU12,&
 & ZEU13, ZODH41, ZODH42, ZODN21, ZODN22, ZPU10, &
 & ZPU11, ZPU12, ZPU13, ZSQ1, ZSQ2, ZSQH41, &
 & ZSQH42, ZSQN21, ZSQN22, ZTO1, ZTO2, ZTTF11, &
 & ZTTF12, ZUU11, ZUU12, ZUXY, ZVXY, &
 & ZXD, ZXN, ZZ, ZUXYCH4, ZVXYCH4, &
 & ZUXYN2O, ZVXYN2O

REAL(KIND=JPRB) :: ZZ5(KLON,8), ZXD5(KLON,8)
REAL(KIND=JPRB) :: ZXN5(KLON,8),ZXDIV5(KLON,8)
REAL(KIND=JPRB) :: ZPU105(KLON),ZPU115(KLON),ZPU125(KLON),ZPU135(KLON)
REAL(KIND=JPRB) :: ZEU105(KLON),ZEU115(KLON),ZEU125(KLON),ZEU135(KLON)
REAL(KIND=JPRB) :: ZUXY15(KLON),ZVXY15(KLON),ZSQ15(KLON),ZSQ25(KLON)
REAL(KIND=JPRB) :: ZAERCN5(KLON),ZTO15(KLON),ZTO25(KLON)
REAL(KIND=JPRB) :: ZUXY25(KLON),ZVXY25(KLON),ZUXYCH45(KLON)
REAL(KIND=JPRB) :: ZVXYCH45(KLON),ZSQH415(KLON),ZODH415(KLON)
REAL(KIND=JPRB) :: ZUXY35(KLON),ZVXY35(KLON),ZUXYN2O5(KLON)
REAL(KIND=JPRB) :: ZVXYN2O5(KLON),ZSQN215(KLON), ZODN215(KLON)
REAL(KIND=JPRB) :: ZUXY45(KLON),ZVXY45(KLON)
REAL(KIND=JPRB) :: ZSQH425(KLON),ZODH425(KLON)
REAL(KIND=JPRB) :: ZUXY55(KLON),ZVXY55(KLON)
REAL(KIND=JPRB) :: ZODN225(KLON),ZSQN225(KLON)
REAL(KIND=JPRB) :: ZA115(KLON),ZA125(KLON)
REAL(KIND=JPRB) :: ZTTF115(KLON),ZTTF125(KLON),ZUU115(KLON),ZUU125(KLON)
REAL(KIND=JPRB) :: ZDIV15(KLON),ZDIV25(KLON),ZDIV35(KLON),ZDIV45(KLON)
REAL(KIND=JPRB) :: ZDIV55(KLON),ZDIV65(KLON)
REAL(KIND=JPRB) :: ZZ15(KLON),ZSQRT15(KLON),ZZ25(KLON),ZSQRT25(KLON)
REAL(KIND=JPRB) :: ZZ35(KLON),ZSQRT35(KLON),ZZ45(KLON),ZSQRT45(KLON)
REAL(KIND=JPRB) :: ZZ55(KLON),ZSQRT55(KLON),ZZ65(KLON),ZSQRT65(KLON)
REAL(KIND=JPRB) :: ZEXP15(KLON),ZEXP25(KLON)
REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

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

!     ------------------------------------------------------------------
!DIR$ VFUNCTION SQRTHF

!*         1.     HORNER'S ALGORITHM FOR H2O AND CO2 TRANSMISSION
!                 -----------------------------------------------

IF (LHOOK) CALL DR_HOOK('LWTTAD',0,ZHOOK_HANDLE)

DO JA = 1 , 8
  DO JL = KIDIA,KFDIA
    ZZ5(JL,JA) = SQRT(PUU5(JL,JA))
    ZXD5(JL,JA) = PGB(JL,JA,1)+ZZ5(JL,JA)*(PGB(JL,JA,2)+ZZ5(JL,JA))
    ZXN5(JL,JA) = PGA(JL,JA,1)+ZZ5(JL,JA)*PGA(JL,JA,2)
    ZXDIV5(JL,JA) = 1.0_JPRB/ZXD5(JL,JA)
    PTT5(JL,JA) = ZXN5(JL,JA)*ZXDIV5(JL,JA)
  ENDDO
ENDDO

DO JL = KIDIA,KFDIA
  IF (PTT5(JL,3) < 0.0_JPRB) THEN
    PTT5(JL,3) = 0.0_JPRB
  ENDIF
ENDDO

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

!*         2.     CONTINUUM, OZONE AND AEROSOL TRANSMISSION FUNCTIONS
!                 ---------------------------------------------------

DO JL = KIDIA,KFDIA
  PTT5(JL, 9) = PTT5(JL, 8)

!-  CONTINUUM ABSORPTION: E- AND P-TYPE (from Giorgetta and Wild, 1997)

  ZPU105(JL) = RPTYPE(1) * PUU5(JL,10)
  ZPU115(JL) = RPTYPE(2) * PUU5(JL,10)
  ZPU125(JL) = RPTYPE(3) * PUU5(JL,10)
  ZPU135(JL) = RPTYPE(4) * PUU5(JL,10)
  ZEU105(JL) = RETYPE(1) * PUU5(JL,11)
  ZEU115(JL) = RETYPE(2) * PUU5(JL,11)
  ZEU125(JL) = RETYPE(3) * PUU5(JL,11)
  ZEU135(JL) = RETYPE(4) * PUU5(JL,11)

!-  OZONE ABSORPTION

  ZDIV15(JL) = 1.0_JPRB/(RPIALF0 * PUU5(JL,13))
  ZUXY15(JL) = 4.0_JPRB * PUU5(JL,12) * PUU5(JL,12) * ZDIV15(JL)
  ZZ15(JL) = 1.0_JPRB + RO1H * ZUXY15(JL)
  ZSQRT15(JL) = SQRT(ZZ15(JL))
  IF (ZZ15(JL) > 0.0_JPRB) THEN
    ZSQ15(JL) = ZSQRT15(JL) - 1.0_JPRB
  ELSE
    ZSQ15(JL) = - 1.0_JPRB
  ENDIF
  ZZ25(JL) = 1.0_JPRB + RO2H * ZUXY15(JL)
  ZSQRT25(JL) = SQRT(ZZ25(JL))
  IF (ZZ25(JL) > 0.0_JPRB) THEN
    ZSQ25(JL) = ZSQRT25(JL) - 1.0_JPRB
  ELSE
    ZSQ25(JL) = - 1.0_JPRB
  ENDIF
  ZDIV25(JL) = 1.0_JPRB/PUU5(JL,12)
  ZVXY15(JL) = 0.5_JPRB * RPIALF0 * PUU5(JL,13) * ZDIV25(JL)
  ZAERCN5(JL) = PUU5(JL,17) + ZEU125(JL) + ZPU125(JL)
  ZTO15(JL) = EXP( - ZVXY15(JL) * ZSQ15(JL) - ZAERCN5(JL) )
  ZTO25(JL) = EXP( - ZVXY15(JL) * ZSQ25(JL) - ZAERCN5(JL) )

!-- TRACE GASES (CH4, N2O, CFC-11, CFC-12)

!* CH4 IN INTERVAL 800-970 + 1110-1250 CM-1

  ZDIV35(JL) = 1.0_JPRB/PUU5(JL,20)
  ZUXYCH45(JL) = PUU5(JL,19)*PUU5(JL,19)*ZDIV35(JL)
  ZDIV45(JL) = 1.0_JPRB/PUU5(JL,19)
  ZVXYCH45(JL) = PUU5(JL,20)*ZDIV45(JL)
  ZUXY25(JL) = RCH4A * ZUXYCH45(JL)
  ZZ35(JL) = 1.0_JPRB + 33.7_JPRB * ZUXY25(JL)
  ZSQRT35(JL) = SQRT(ZZ35(JL))
  IF (ZZ35(JL) > 0.0_JPRB) THEN
    ZSQH415(JL) = ZSQRT35(JL) - 1.0_JPRB
  ELSE
    ZSQH415(JL) = - 1.0_JPRB
  ENDIF
  ZVXY25(JL) = 0.0515_JPRB * ZVXYCH45(JL)
  ZODH415(JL) = ZVXY25(JL) * ZSQH415(JL)

!* N2O IN INTERVAL 800-970 + 1110-1250 CM-1

  ZDIV55(JL) = 1.0_JPRB/PUU5(JL,22)
  ZUXYN2O5(JL) = PUU5(JL,21)*PUU5(JL,21)*ZDIV55(JL)
  ZDIV65(JL) = 1.0_JPRB/PUU5(JL,21)
  ZVXYN2O5(JL) = PUU5(JL,22)*ZDIV65(JL)
  ZUXY35(JL) = RCN2OA * ZUXYN2O5(JL)
  ZZ45(JL) = 1.0_JPRB + 21.3_JPRB * ZUXY35(JL)
  ZSQRT45(JL) = SQRT(ZZ45(JL))
  IF (ZZ45(JL) > 0.0_JPRB) THEN
    ZSQN215(JL) = ZSQRT45(JL) - 1.0_JPRB
  ELSE
    ZSQN215(JL) = - 1.0_JPRB
  ENDIF
  ZVXY35(JL) = 0.208_JPRB * ZVXYN2O5(JL)
  ZODN215(JL) = ZVXY35(JL) * ZSQN215(JL)

!* CH4 IN INTERVAL 1250-1450 + 1880-2820 CM-1

  ZUXY45(JL) = RCH4B * ZUXYCH45(JL)
  ZZ55(JL) = 1.0_JPRB + 400._JPRB * ZUXY45(JL)
  ZSQRT55(JL) = SQRT(ZZ55(JL))
  IF (ZZ55(JL) > 0.0_JPRB) THEN
    ZSQH425(JL) = ZSQRT55(JL) - 1.0_JPRB
  ELSE
    ZSQH425(JL) = - 1.0_JPRB
  ENDIF
  ZVXY45(JL) = 0.0565_JPRB * ZVXYCH45(JL)
  ZODH425(JL) = ZVXY45(JL) * ZSQH425(JL)

!* N2O IN INTERVAL 1250-1450 + 1880-2820 CM-1

  ZUXY55(JL) = RCN2OB * ZUXYN2O5(JL)
  ZZ65(JL) = 1.0_JPRB + 2000._JPRB * ZUXY55(JL)
  ZSQRT65(JL) = SQRT(ZZ65(JL))
  IF (ZZ65(JL) > 0.0_JPRB) THEN
    ZSQN225(JL) = ZSQRT65(JL) - 1.0_JPRB
  ELSE
    ZSQN225(JL) = - 1.0_JPRB
  ENDIF
  ZVXY55(JL) = 0.0985_JPRB * ZVXYN2O5(JL)
  ZODN225(JL) = ZVXY55(JL) * ZSQN225(JL)

!* CFC-11 IN INTERVAL 800-970 + 1110-1250 CM-1

  ZA115(JL) = 2.0_JPRB * PUU5(JL,23) * 4.404E+05_JPRB
  ZTTF115(JL) = 1.0_JPRB - ZA115(JL) * 0.003225_JPRB

!* CFC-12 IN INTERVAL 800-970 + 1110-1250 CM-1

  ZA125(JL) = 2.0_JPRB * PUU5(JL,24) * 6.7435E+05_JPRB
  ZTTF125(JL) = 1.0_JPRB - ZA125(JL) * 0.003225_JPRB
  ZUU115(JL) = -PUU5(JL,15)-ZEU105(JL)-ZPU105(JL)
  ZUU125(JL) = -PUU5(JL,16)-ZEU115(JL)-ZPU115(JL)-ZODH415(JL)-ZODN215(JL)
  PTT5(JL,10) = EXP( - PUU5(JL,14) )
  PTT5(JL,11) = EXP( ZUU115(JL) )
  ZEXP15(JL) = EXP( ZUU125(JL))
  PTT5(JL,12) = ZEXP15(JL) * ZTTF115(JL) * ZTTF125(JL)
  PTT5(JL,13) = 0.7554_JPRB * ZTO15(JL) + 0.2446_JPRB * ZTO25(JL)
  ZEXP25(JL) = EXP( - ZEU135(JL) - ZPU135(JL) )
  PTT5(JL,14) = PTT5(JL,10) * ZEXP25(JL)
  PTT5(JL,15) = EXP ( - PUU5(JL,14) - ZODH425(JL) - ZODN225(JL) )
ENDDO

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

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

!*         1.2.  CONTINUUM, OZONE AND AEROSOL TRANSMISSION FUNCTIONS
!                ---------------------------------------------------

DO JL = KIDIA,KFDIA
  ZPU10 = 0.0_JPRB
  ZPU11 = 0.0_JPRB
  ZPU12 = 0.0_JPRB
  ZPU13 = 0.0_JPRB
  ZEU10 = 0.0_JPRB
  ZEU11 = 0.0_JPRB
  ZEU12 = 0.0_JPRB
  ZEU13 = 0.0_JPRB
  ZUXY  = 0.0_JPRB
  ZVXY  = 0.0_JPRB
  ZSQ1  = 0.0_JPRB
  ZSQ2  = 0.0_JPRB
  ZAERCN = 0.0_JPRB
  ZTO1  = 0.0_JPRB
  ZTO2  = 0.0_JPRB
  ZUXYCH4 = 0.0_JPRB
  ZVXYCH4 = 0.0_JPRB
  ZSQH41  = 0.0_JPRB
  ZODH41  = 0.0_JPRB
  ZUXYN2O = 0.0_JPRB
  ZVXYN2O = 0.0_JPRB
  ZSQN21  = 0.0_JPRB
  ZODN21  = 0.0_JPRB
  ZSQH42  = 0.0_JPRB
  ZODH42  = 0.0_JPRB
  ZSQN22  = 0.0_JPRB
  ZODN22  = 0.0_JPRB
  ZTTF11 = 0.0_JPRB
  ZTTF12 = 0.0_JPRB
  ZA11  = 0.0_JPRB
  ZA12  = 0.0_JPRB
  ZUU11 = 0.0_JPRB
  ZUU12 = 0.0_JPRB

!-- TRACE GASES (CH4, N2O, CFC-11, CFC-12)

!* CFC-12 IN INTERVAL 800-970 + 1110-1250 CM-1

  PUU(JL,14) = PUU(JL,14)-PTT5(JL,15)*PTT(JL,15)
  ZODH42 = ZODH42-PTT5(JL,15)*PTT(JL,15)
  ZODN22 = ZODN22-PTT5(JL,15)*PTT(JL,15)
  PTT(JL,15) = 0.0_JPRB
  PTT(JL,10) = PTT(JL,10)+ZEXP25(JL)*PTT(JL,14)
  ZEU13 = ZEU13-PTT5(JL,10)*ZEXP25(JL)*PTT(JL,14)
  ZPU13 = ZPU13-PTT5(JL,10)*ZEXP25(JL)*PTT(JL,14)
  PTT(JL,14) = 0.0_JPRB
  ZTO1 = ZTO1+0.7554_JPRB*PTT(JL,13)
  ZTO2 = ZTO2+0.2446_JPRB*PTT(JL,13)
  PTT(JL,13) = 0.0_JPRB
  ZTTF12 = ZTTF12+ZEXP15(JL)*ZTTF115(JL)*PTT(JL,12)
  ZTTF11 = ZTTF11+ZEXP15(JL)*ZTTF125(JL)*PTT(JL,12)
  ZUU12 = ZUU12+ZEXP15(JL)*ZTTF115(JL)*ZTTF125(JL)*PTT(JL,12)
  PTT(JL,12) = 0.0_JPRB
  ZUU11 = ZUU11+PTT5(JL,11)*PTT(JL,11)
  PTT(JL,11) = 0.0_JPRB
  PUU(JL,14) = PUU(JL,14)-PTT5(JL,10)*PTT(JL,10)
  PTT(JL,10) = 0.0_JPRB
  
  PUU(JL,16) =  PUU(JL,16)-ZUU12
  ZEU11 = ZEU11-ZUU12
  ZPU11 = ZPU11-ZUU12
  ZODH41 = ZODH41-ZUU12
  ZODN21 = ZODN21-ZUU12
  PUU(JL,15) = PUU(JL,15)-ZUU11
  ZEU10 = ZEU10-ZUU11
  ZPU10 = ZPU10-ZUU11
  ZA12 = ZA12-0.003225_JPRB*ZTTF12
  PUU(JL,24) = PUU(JL,24)+2.0_JPRB*6.7435E+05_JPRB*ZA12

!* CFC-11 IN INTERVAL 800-970 + 1110-1250 CM-1

  ZA11 = ZA11-0.003225_JPRB*ZTTF11
  PUU(JL,23) = PUU(JL,23)+2.0_JPRB*4.404E+05_JPRB*ZA11

!* N2O IN INTERVAL 1250-1450 + 1880-2820 CM-1

  ZSQN22 = ZSQN22+ZVXY55(JL)*ZODN22
  ZVXY = ZVXY+ZSQN225(JL)*ZODN22
  ZVXYN2O = ZVXYN2O+0.0985_JPRB*ZVXY
  ZVXY = 0.0_JPRB
  IF (ZZ65(JL) > 0.0_JPRB) THEN
    ZUXY = ZUXY+1000._JPRB*ZSQN22/ZSQRT65(JL)
  ENDIF
  ZUXYN2O = ZUXYN2O+RCN2OB*ZUXY
  ZUXY = 0.0_JPRB

!* CH4 IN INTERVAL 1250-1450 + 1880-2820 CM-1

  ZSQH42 = ZSQH42+ZVXY45(JL)*ZODH42
  ZVXY = ZVXY+ZSQH425(JL)*ZODH42
  ZVXYCH4 = ZVXYCH4+0.0565_JPRB*ZVXY
  ZVXY = 0.0_JPRB
  IF (ZZ55(JL) > 0.0_JPRB) THEN
    ZUXY = ZUXY+200._JPRB*ZSQH42/ZSQRT55(JL)
  ENDIF
  ZUXYCH4 = ZUXYCH4+RCH4B*ZUXY
  ZUXY = 0.0_JPRB

!* N2O IN INTERVAL 800-970 + 1110-1250 CM-1

  ZSQN21 = ZSQN21+ZVXY35(JL)*ZODN21
  ZVXY = ZVXY+ZSQN215(JL)*ZODN21
  ZVXYN2O = ZVXYN2O+0.208_JPRB*ZVXY
  ZVXY = 0.0_JPRB
  IF (ZZ45(JL) > 0.0_JPRB) THEN
    ZUXY = ZUXY+10.65_JPRB*ZSQN21/ZSQRT45(JL)
  ENDIF
  ZUXYN2O = ZUXYN2O+RCN2OA*ZUXY
  ZUXY = 0.0_JPRB
  PUU(JL,22) = PUU(JL,22)+ZDIV65(JL)*ZVXYN2O
  PUU(JL,21) = PUU(JL,21)-PUU5(JL,22)*ZDIV65(JL)*ZDIV65(JL)*ZVXYN2O
  PUU(JL,21) = PUU(JL,21)+2.0_JPRB*PUU5(JL,21)*ZDIV55(JL)*ZUXYN2O
  PUU(JL,22) = PUU(JL,22)-PUU5(JL,21)*PUU5(JL,21) &
   &         * ZDIV55(JL)*ZDIV55(JL)*ZUXYN2O

!* CH4 IN INTERVAL 800-970 + 1110-1250 CM-1

  ZSQH41 = ZSQH41+ZVXY25(JL)*ZODH41
  ZVXY = ZVXY+ZSQH415(JL)*ZODH41
  ZVXYCH4 = ZVXYCH4+0.0515_JPRB*ZVXY
  ZVXY = 0.0_JPRB
  IF (ZZ35(JL) > 0.0_JPRB) THEN
    ZUXY = ZUXY+16.85_JPRB*ZSQH41/ZSQRT35(JL)
  ENDIF
  ZUXYCH4 = ZUXYCH4+RCH4A*ZUXY
  ZUXY = 0.0_JPRB
  PUU(JL,20) = PUU(JL,20)+ZDIV45(JL)*ZVXYCH4
  PUU(JL,19) = PUU(JL,19)-PUU5(JL,20)*ZDIV45(JL)*ZDIV45(JL)*ZVXYCH4
  PUU(JL,19) = PUU(JL,19)+2.0_JPRB*PUU5(JL,19)*ZDIV35(JL)*ZUXYCH4
  PUU(JL,20) = PUU(JL,20)-PUU5(JL,19)*PUU5(JL,19) &
   &         * ZDIV35(JL)*ZDIV35(JL)*ZUXYCH4

!-  OZONE ABSORPTION

  ZSQ2 = ZSQ2-ZTO25(JL)*ZVXY15(JL)*ZTO2
  ZVXY = ZVXY-ZTO25(JL)*ZSQ25(JL)*ZTO2
  ZAERCN = ZAERCN-ZTO25(JL)*ZTO2
  ZSQ1 = ZSQ1-ZTO15(JL)*ZVXY15(JL)*ZTO1
  ZVXY = ZVXY-ZTO15(JL)*ZSQ15(JL)*ZTO1
  ZAERCN = ZAERCN-ZTO15(JL)*ZTO1
  PUU(JL,17) = PUU(JL,17)+ZAERCN
  ZEU12 = ZEU12+ZAERCN
  ZPU12 = ZPU12+ZAERCN
  PUU(JL,13) = PUU(JL,13)+0.5_JPRB*RPIALF0*ZDIV25(JL)*ZVXY
  PUU(JL,12) = PUU(JL,12)-0.5_JPRB*RPIALF0*PUU5(JL,13) &
   &         * ZDIV25(JL)*ZDIV25(JL)*ZVXY
  IF (ZZ25(JL) > 0.0_JPRB) THEN
    ZUXY = ZUXY+0.5_JPRB*RO2H*ZSQ2/ZSQRT25(JL)
  ENDIF
  IF (ZZ15(JL) > 0.0_JPRB) THEN
    ZUXY = ZUXY+0.5_JPRB*RO1H*ZSQ1/ZSQRT15(JL)
  ENDIF
  PUU(JL,12) = PUU(JL,12)+8.0_JPRB*PUU5(JL,12)*ZDIV15(JL)*ZUXY
  PUU(JL,13) = PUU(JL,13)-4._JPRB*RPIALF0*PUU5(JL,12)*PUU5(JL,12) &
   &         * ZDIV15(JL)*ZDIV15(JL)*ZUXY

!-  CONTINUUM ABSORPTION: E- AND P-TYPE (from Giorgetta and Wild, 1997)

  PUU(JL,11) = PUU(JL,11)+RETYPE(4)*ZEU13
  PUU(JL,11) = PUU(JL,11)+RETYPE(3)*ZEU12
  PUU(JL,11) = PUU(JL,11)+RETYPE(2)*ZEU11
  PUU(JL,11) = PUU(JL,11)+RETYPE(1)*ZEU10
  PUU(JL,10) = PUU(JL,10)+RPTYPE(4)*ZPU13
  PUU(JL,10) = PUU(JL,10)+RPTYPE(3)*ZPU12
  PUU(JL,10) = PUU(JL,10)+RPTYPE(2)*ZPU11
  PUU(JL,10) = PUU(JL,10)+RPTYPE(1)*ZPU10

  PTT(JL,8) = PTT(JL,8)+PTT(JL,9)
  PTT(JL,9) = 0.0_JPRB
ENDDO

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

!*         1.1.   HORNER'S ALGORITHM FOR H2O AND CO2 TRANSMISSION
!                 -----------------------------------------------

DO JL = KIDIA,KFDIA
  IF (PTT5(JL,3) < 0.0_JPRB) THEN
    PTT (JL,3) = 0.0_JPRB
  ENDIF
ENDDO

DO JA = 1 , 8
  DO JL = KIDIA,KFDIA
    ZZ  = 0.0_JPRB
    ZXD = 0.0_JPRB
    ZXN = 0.0_JPRB

    ZXN = ZXN+ZXDIV5(JL,JA)*PTT(JL,JA)
    ZXD = ZXD-ZXN5(JL,JA)*ZXDIV5(JL,JA)*ZXDIV5(JL,JA)*PTT(JL,JA)
    PTT(JL,JA) = 0.0_JPRB
    ZZ = ZZ+PGA( JL,JA,2)*ZXN
    ZZ = ZZ+ZXD*PGB( JL,JA,2)+2.0_JPRB*ZZ5(JL,JA)*ZXD
    IF (ZZ5(JL,JA) > 0.0_JPRB) THEN
      PUU(JL,JA) = PUU(JL,JA)+0.5_JPRB*ZZ/ZZ5(JL,JA)
    ENDIF
  ENDDO
ENDDO

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