SUBROUTINE AER_LOSS_AD &
  &( KIDIA, KFDIA, KLON, KLEV, KAERO, &
  &  PAERO5 , PTSPHY, &
  &  PTAERO5, & 
  &  PAERO  , &
  &  PTAERO & 
  &)

!*** * AER_LOSS_AD* - SINK TERMS FOR AEROSOLS IN ANALYSIS

!**   INTERFACE.
!     ----------
!          *AER_LOSS_AD* IS CALLED FROM *AER_xxx*.

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

!     SOURCE.
!     -------

!     MODIFICATIONS.
!     --------------
!        ORIGINAL : 2007-11-17

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

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

USE YOEAERSNK ,ONLY : RAERTS

IMPLICIT NONE

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

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

INTEGER(KIND=JPIM),INTENT(IN) :: KLON 
INTEGER(KIND=JPIM),INTENT(IN) :: KIDIA 
INTEGER(KIND=JPIM),INTENT(IN) :: KFDIA 
INTEGER(KIND=JPIM),INTENT(IN) :: KLEV
INTEGER(KIND=JPIM),INTENT(IN) :: KAERO

REAL(KIND=JPRB),INTENT(IN)    :: PAERO5(KLON,KLEV,KAERO)
REAL(KIND=JPRB),INTENT(IN)    :: PTSPHY

REAL(KIND=JPRB),INTENT(INOUT) :: PTAERO5(KLON,KLEV,KAERO)

REAL(KIND=JPRB),INTENT(INOUT) :: PAERO(KLON,KLEV,KAERO)
REAL(KIND=JPRB),INTENT(IN)    :: PTAERO(KLON,KLEV,KAERO)


!*       0.5   LOCAL VARIABLES
!              ---------------

INTEGER(KIND=JPIM) :: JAER, JK, JL
REAL(KIND=JPRB) :: ZEXP(KAERO), ZAERN(KLON,KLEV,KAERO)

REAL(KIND=JPRB) :: ZHOOK_HANDLE
!-----------------------------------------------------------------------
IF (LHOOK) CALL DR_HOOK('AER_LOSS_AD',0,ZHOOK_HANDLE)

ZAERN(:,:,:) = 0._JPRB

DO JAER=1,KAERO
  ZEXP(JAER)=EXP(-PTSPHY*RAERTS(JAER))
  DO JK=KLEV,1,-1
    DO JL=KIDIA,KFDIA
      PAERO(JL,JK,JAER)=PAERO(JL,JK,JAER)-PTAERO(JL,JK,JAER)/PTSPHY
      ZAERN(JL,JK,JAER)=ZAERN(JL,JK,JAER)+PTAERO(JL,JK,JAER)/PTSPHY
      PAERO(JL,JK,JAER)=PAERO(JL,JK,JAER)+ZAERN(JL,JK,JAER)*ZEXP(JAER)
      ZAERN(JL,JK,JAER)=0._JPRB
    ENDDO
  ENDDO
ENDDO

!-----------------------------------------------------------------------
IF (LHOOK) CALL DR_HOOK('AER_LOSS_AD',1,ZHOOK_HANDLE)
END SUBROUTINE AER_LOSS_AD
