SUBROUTINE EC_PHYS_TL (CDCONF,&
 & KBL,KNUMB,KSTGLO,&
 & PB2,&
 & PGMV,PGMVS,PGFL,&
 & PGMVT1,PGMVT1S,PGFLT1,&
 & PSP_SB,PSP_SG,PSP_RR,&
 & PSD_VN,PSD_VD,&
 & PGEMU,PGELAM,PGESLO,PGECLO,POROG,&
 & PFORCEU,PFORCEV,PFORCET,PFORCEQ,&
 & PMWAVE_ZEN_BUF,PMWAVE_AZI_BUF,PMWAVE_TB_BUF_TL,PMWAVE_OERR_BUF,&
 & PMWAVE_PERS1_BUF,KMWAVE_BUF)

USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
USE YOMDIM   , ONLY : NFLEVG   ,NPROMA
USE YOMCT0   , ONLY : NSTART, NSTOP, LTWOTL   
USE YOMCT3   , ONLY : NSTEP
USE YOMDYN   , ONLY : TDT, REPSP1
USE YOMGEM   , ONLY : VBH      ,VAH      ,VC       ,VDELB    ,NGPTOT
USE YOMRIP   , ONLY : RCODEC   ,RSIDEC   ,RCOVSR   ,RSIVSR
USE YOMSC2   , ONLY : NFLDSLB2
USE YOMPHY2  , ONLY : TSPHY
USE YOERIP   , ONLY : RCODECM  ,RSIDECM  ,RCOVSRM  ,RSIVSRM
USE YOMDPHY  , ONLY : NTILES
USE PTRSLB2  , ONLY : MSLB2VVEL  
USE SURFACE_FIELDS_MIX, ONLY : GPPOPER,&
 & YSP_SBD, YSP_SB, YSP_SGD, YSP_SG, &
 & YSP_RRD, YSP_RR,  &
 & YSD_VDD, YSD_VD, YSD_VFD, YSD_VF, &
 & YSD_VND, YSD_VN
USE YOMSRFTLAD  , ONLY : GPTSKIN0, GPTSKIN9
USE YOE_TILE_PROP, ONLY : RUSTRTI, RVSTRTI, RAHFSTI, REVAPTI, RTSKTI
USE TRAJECTORY_MOD, ONLY: GET_TRAJ_SFC, GET_TRAJ_PHYS
USE YOMLCZ   , ONLY : LFORCE
USE YOM_YGFL , ONLY : YGFL    ,YGFLC  ,YQ, YL, YI, YA, NGRG, NTRAC
USE YOMGMV, ONLY : NDIMGMV,NDIMGMVS,YT1,YPH9
USE YOMMWAVE , ONLY : N_SATSENS, LEMWAVE_ACTIVE, MWAVE_RAD_TYPE, &
                    & MWAVE_ID, MWAVE_NO_OBS
USE PARMWAVE , ONLY : NMAX_CHAN

!**** *EC_PHYS_TL* - ECMWF Physics (Tangent linear)

!     Purpose.
!     --------
!           Interface to ECMWF Physics (Tangent linear)

!**   Interface.
!     ----------
!        *CALL* *EC_PHYS_TL(...)*

!        Explicit arguments :
!        --------------------
!        CDCONF    : configuration of work
!        KNUMB     : number of elements of arrays for which computations
!                    are performed (used in message passing version)
!        KSTGLO    : Global offset for surface fields

!        Implicit arguments :
!        --------------------

!     Method.
!     -------
!        See documentation

!     Externals.
!     ----------
!        Called by GP_MODEL_TL.

!     Reference.
!     ----------

!     Author.
!     -------
!        Deborah Salmond  *ECMWF*
!        K.YESSAD (04-JAN-2002): Pruning.

!     Modifications.
!     --------------
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!        M.Hamrud      10-Jan-2004 CY28R1 Cleaning
!        M.Janiskova - 11-11-03 - perturbation of skin temperature for physics
!        M.Hamrud      15-Jan-2006  Revised GPRCP
!        JJMorcrette   20060511 MODIS albedo
!        M.Hamrud      01-Jul-2006 Revised surface fields
!        A. Geer       15-Apr-2008  Multiple sensors for rainy 4D-Var
!        A. Geer       01-Oct-2008 Rainy 4D-Var tidying
!        A. Geer       10-Jun-2008  Rainy 4D-Var passive mode and diagnostics
!  	 F. Karbou     16-Dec-2009  Surface emissivity estimation
!        H. Hersbach   04-Dec-2009 10-m neutral wind; move reset surface perts to scan2mtl
!        S. Boussetta/G.Balsamo      May 2009   (Add variable LAI) 
!     ------------------------------------------------------------------

IMPLICIT NONE

CHARACTER(LEN=1)  ,INTENT(IN)    :: CDCONF
INTEGER(KIND=JPIM),INTENT(IN)    :: KBL 
INTEGER(KIND=JPIM),INTENT(IN)    :: KNUMB 
INTEGER(KIND=JPIM),INTENT(IN)    :: KSTGLO 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PB2(NPROMA,NFLDSLB2) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PGMV(NPROMA,NFLEVG,NDIMGMV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGMVS(NPROMA,NDIMGMVS) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PGFL(NPROMA,NFLEVG,YGFL%NDIM) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PGMVT1(NPROMA,NFLEVG,YT1%NDIM) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGMVT1S(NPROMA,YT1%NDIMS) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PGFLT1(NPROMA,NFLEVG,YGFL%NDIM1) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSP_SB(NPROMA,YSP_SBD%NLEVS,YSP_SBD%NDIM)
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSP_SG(NPROMA,YSP_SGD%NDIM)
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSP_RR(NPROMA,YSP_RRD%NDIM)
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSD_VN(NPROMA,YSD_VND%NDIM)
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PSD_VD(NPROMA,YSD_VDD%NDIM)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGEMU(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGELAM(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGESLO(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGECLO(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: POROG(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PFORCEU(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PFORCEV(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PFORCET(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PFORCEQ(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PMWAVE_ZEN_BUF(NGPTOT,N_SATSENS)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PMWAVE_AZI_BUF(NGPTOT,N_SATSENS)
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PMWAVE_TB_BUF_TL(NGPTOT,NMAX_CHAN,N_SATSENS)
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PMWAVE_OERR_BUF(NGPTOT,NMAX_CHAN,N_SATSENS)
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PMWAVE_PERS1_BUF(NGPTOT,NMAX_CHAN,N_SATSENS)
INTEGER(KIND=JPIM),INTENT(INOUT) :: KMWAVE_BUF(NGPTOT,NMAX_CHAN,N_SATSENS)
!     ------------------------------------------------------------------

!     POINTER BLOCKS

! ZPRE9  : (NPROMA,0:NFLEVG)     ; HALF LEVEL PRESSURE
! ZPRE9F : (NPROMA,  NFLEVG)     ; FULL LEVEL PRESSURE

REAL(KIND=JPRB) :: ZPRE9(NPROMA,0:NFLEVG),ZPRE9F(NPROMA,NFLEVG)

! ZPRE95  : (NPROMA,0:NFLEVG)     ; HALF LEVEL PRESSURE (TRAJECTORY)
! ZPREF95 : (NPROMA,  NFLEVG)     ; FULL LEVEL PRESSURE (TRAJECTORY)

REAL(KIND=JPRB) :: ZPRE95(NPROMA,0:NFLEVG),ZPREF95(NPROMA,NFLEVG)

! ZDELP9 : (NPROMA,0:NFLEVG+1)   ; PRESSURE DIFFERENCE ACROSS LAYERS
! ZRDELP9: (NPROMA,  NFLEVG  )   ; THEIR INVERSE
! ZLNPR9 : (NPROMA,  NFLEVG  )   ; LOGARITHM OF RATIO OF PRESSURE
! ZALPH9 : (NPROMA,  NFLEVG  )   ; COEFFICIENTS OF THE HYDROSTATICS
! ZRTGR9 : (NPROMA,  NFLEVG  )   ; FOR PRES.GRAD. TERM AND ENER. CONV. TERM
! ZRPRE9 : (NPROMA,  NFLEVG  )   ; INVERSE OF PRESSURE
! ZRPP9  : (NPROMA,  NFLEVG  )   ; INVERSE OF PRESSURE(J)*PRESSURE(J-1)

REAL(KIND=JPRB) :: ZDELP9(NPROMA,0:NFLEVG+1),ZRDELP9(NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZLNPR9(NPROMA,  NFLEVG  ),ZALPH9 (NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZDUM  (NPROMA,  NFLEVG  ),ZRTGR9 (NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZRPRE9(NPROMA,  NFLEVG  ),ZRPP9  (NPROMA,NFLEVG)

! ZDELP95 : (NPROMA,0:NFLEVG+1)   ; PRESSURE DIFFERENCE ACROSS LAYERS (T.)
! ZRDELP95: (NPROMA,  NFLEVG  )   ; THEIR INVERSE (T.)
! ZLNPR95 : (NPROMA,  NFLEVG  )   ; LOGARITHM OF RATIO OF PRESSURE (T.)
! ZALPH95 : (NPROMA,  NFLEVG  )   ; COEFFICIENTS OF THE HYDROSTATICS (T.)
! ZRTGR95 : (NPROMA,  NFLEVG  )   ; FOR PRES.GRAD. TERM AND ENER. CONV. TERM (T.)
! ZRPRE95 : (NPROMA,  NFLEVG  )   ; INVERSE OF PRESSURE (T.)
! ZRPP95  : (NPROMA,  NFLEVG  )   ; INVERSE OF PRESSURE(J)*PRESSURE(J-1) (T.)

REAL(KIND=JPRB) :: ZDELP95(NPROMA,0:NFLEVG+1),ZRDELP95(NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZLNPR95(NPROMA,  NFLEVG  ),ZALPH95 (NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZRPRE95(NPROMA,  NFLEVG  ),ZRPP95  (NPROMA,NFLEVG)

! ZR9    : (NPROMA,NFLEVG)       ; R

REAL(KIND=JPRB) :: ZR9(NPROMA,NFLEVG)

! ZR95   : (NPROMA,NFLEVG)       ; R  (TRAJECTORY)

REAL(KIND=JPRB) :: ZR95(NPROMA,NFLEVG)

! ZPHI9  : (NPROMA,0:NFLEVG)     ; HALF LEVEL GEOPOTENTIAL
! ZPHIF9 : (NPROMA,  NFLEVG)     ; FULL LEVEL GEOPOTENTIAL

REAL(KIND=JPRB) :: ZPHI9(NPROMA,0:NFLEVG),ZPHIF9(NPROMA,NFLEVG)

! ZPHI95  : (NPROMA,0:NFLEVG)    ; HALF LEVEL GEOPOTENTIAL (TRAJECTORY)
! ZPHIF95 : (NPROMA,  NFLEVG)    ; FULL LEVEL GEOPOTENTIAL (TRAJECTORY)

REAL(KIND=JPRB) :: ZPHI95(NPROMA,0:NFLEVG),ZPHIF95(NPROMA,NFLEVG)

! ZMU0  : (NPROMA)            ; SOLAR ANGLE
! ZMU0M : (NPROMA)            ; SOLAR ANGLE (between radiation steps)

REAL(KIND=JPRB) :: ZMU0(NPROMA)
REAL(KIND=JPRB) :: ZMU0M(NPROMA)

!     --- ECMWF EXTRA ARRAYS, TIME 1 ---

REAL(KIND=JPRB) :: ZPRS1 (NPROMA,0:NFLEVG), ZPRSF1  (NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZPRS15(NPROMA,0:NFLEVG), ZPRSF15 (NPROMA,NFLEVG)

!     --- TRAJECTORY VARIABLES FOR CALLPARTL ---

REAL(KIND=JPRB) :: ZTT95   (NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZQT95   (NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZUT95   (NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZVT95   (NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZTENT5  (NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZTENQ5  (NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZTENU5  (NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZTENV5  (NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZVVEL5  (NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZSPT95  (NPROMA)
REAL(KIND=JPRB) :: ZSPT15  (NPROMA)
REAL(KIND=JPRB) :: ZEMTED5 (NPROMA,NFLEVG+1)
REAL(KIND=JPRB) :: ZTRSOL5 (NPROMA,NFLEVG+1)
REAL(KIND=JPRB) :: ZWSA95  (NPROMA,YSP_SBD%NLEVS)
REAL(KIND=JPRB) :: ZTSA95  (NPROMA,YSP_SBD%NLEVS)
REAL(KIND=JPRB) :: ZTIA95  (NPROMA,YSP_SBD%NLEVS)
REAL(KIND=JPRB) :: ZSNS95  (NPROMA)
REAL(KIND=JPRB) :: ZWL95   (NPROMA)
REAL(KIND=JPRB) :: ZTL95   (NPROMA)
REAL(KIND=JPRB) :: ZNTOP5  (NPROMA)
REAL(KIND=JPRB) :: ZNBAS5  (NPROMA)
REAL(KIND=JPRB) :: ZACPR5  (NPROMA)
REAL(KIND=JPRB) :: ZGZ0M5  (NPROMA)
REAL(KIND=JPRB) :: ZLZ0H5  (NPROMA)
REAL(KIND=JPRB) :: ZUSTRTI5 (NPROMA,NTILES)
REAL(KIND=JPRB) :: ZVSTRTI5 (NPROMA,NTILES)
REAL(KIND=JPRB) :: ZAHFSTI5 (NPROMA,NTILES)
REAL(KIND=JPRB) :: ZEVAPTI5 (NPROMA,NTILES)
REAL(KIND=JPRB) :: ZTSKTI5  (NPROMA,NTILES)
REAL(KIND=JPRB) :: ZGFLT95  (NPROMA,NFLEVG,YGFL%NDIM)
REAL(KIND=JPRB) :: ZTENGFL5 (NPROMA,NFLEVG,YGFL%NDIM1)

REAL(KIND=JPRB) :: ZSP_SG5(NPROMA,YSP_SGD%NDIM5)
REAL(KIND=JPRB) :: ZSD_VF5(NPROMA,YSD_VFD%NDIM5)
REAL(KIND=JPRB) :: ZSD_VD5(NPROMA,YSD_VDD%NDIM5)

!     --- FLUXES FROM PARAMETERISATIONS ---
REAL(KIND=JPRB) :: ZDIFTQ(NPROMA,0:NFLEVG), ZDIFTS(NPROMA,0:NFLEVG)
REAL(KIND=JPRB) :: ZSTRTU(NPROMA,0:NFLEVG), ZSTRTV(NPROMA,0:NFLEVG)

!     --- SURFACE TENDENCIES ---
REAL(KIND=JPRB) :: ZTLE1(NPROMA)
REAL(KIND=JPRB) :: ZTSKIN1(NPROMA)
REAL(KIND=JPRB) :: ZTSKIN9(NPROMA)


INTEGER(KIND=JPIM) :: IEND, IPCT, &
 & IST, ISTC, JFLD, JLEV, JROF, JGFL, JSAT, JLOC  

LOGICAL :: LLADNMI, LLRAIN1D

REAL(KIND=JPRB) :: ZDTPHY
REAL(KIND=JPRB) :: ZGFLFLX(NPROMA,NGRG+NTRAC)
INTEGER(KIND=JPIM) :: ICH, JGRG, JTRAC

!*     Local arrays for rain/cloud MWave assimilation
TYPE (MWAVE_RAD_TYPE) :: YL_MWAVE_RAD (NPROMA,N_SATSENS)

REAL(KIND=JPRB) :: ZHOOK_HANDLE
 
!     ------------------------------------------------------------------

#include "callpartl.intfb.h"
#include "gpgeo.intfb.h"
#include "gpgeotl.intfb.h"
#include "gpmktend.intfb.h"
#include "gppre.intfb.h"
#include "gppref.intfb.h"
#include "gppreftl.intfb.h"
#include "gppreh.intfb.h"
#include "gpprehtl.intfb.h"
#include "gppretl.intfb.h"
#include "gprcp.intfb.h"
#include "gprcptl.intfb.h"
#include "gpxyb.intfb.h"
#include "gpxybtl.intfb.h"

!     ------------------------------------------------------------------
IF (LHOOK) CALL DR_HOOK('EC_PHYS_TL',0,ZHOOK_HANDLE)
!     ------------------------------------------------------------------

!*       1.    Interface to global arrays.
!              ---------------------------

!*       1.1   INITIAL COMPUTATIONS

IPCT = 1
IST   = 1
IEND  = KNUMB
ISTC  = 1

! Adiabatic NNMI iteration
LLADNMI = CDCONF == 'E' .OR. CDCONF == 'F'
LLRAIN1D = .FALSE.

IF (.NOT.LLADNMI) THEN

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

!*       2.   PREPARE FOR PHYSICS  COMPUTATIONS  (part I)
!             -------------------------------------------

!*       2.1   READ TRAJECTORY AT T-DT


  CALL GET_TRAJ_PHYS(ZTT95,ZQT95,ZGFLT95,ZUT95,ZVT95,ZVVEL5,ZSPT95,ZSPT15, &
   & ZTENT5,ZTENQ5,ZTENGFL5,ZTENU5,ZTENV5,ZEMTED5,ZTRSOL5,ZWSA95, &
   & ZTSA95,ZSNS95,ZWL95,ZTL95,ZTIA95,ZNTOP5,ZNBAS5, &
   & ZACPR5,ZGZ0M5,ZLZ0H5,ZUSTRTI5,ZVSTRTI5,ZAHFSTI5, &
   & ZEVAPTI5,ZTSKTI5, NSTEP, KBL,IST,IEND)  

!*       2.2   SURFACE PRESSURE VARIABLES

  DO JROF=IST,IEND
    ZPRE9 (JROF,NFLEVG)=PGMVS(JROF,YPH9%MSP)*EXP(ZSPT95(JROF))
    ZPRE95(JROF,NFLEVG)=EXP(ZSPT95(JROF))
  ENDDO

!*       2.3   SURFACE FIELDS FOR PHYSICS

  CALL GET_TRAJ_SFC(NSTEP,KBL,IST,IEND,PSP_SG=ZSP_SG5,PSD_VF=ZSD_VF5,PSD_VD=ZSD_VD5)

!        2.4  INITIALISATION OF SURFACE PERTURBATION

  IF (NSTEP == 0) THEN
    IF(.NOT. LTWOTL) THEN
      CALL GPPOPER('SET9TO0',KBL=KBL)
    ENDIF
    DO JFLD=1,NTILES
      DO JROF=IST,IEND
        RUSTRTI(JROF,JFLD,KBL) = 0.0_JPRB
        RVSTRTI(JROF,JFLD,KBL) = 0.0_JPRB
        RAHFSTI(JROF,JFLD,KBL) = 0.0_JPRB
        REVAPTI(JROF,JFLD,KBL) = 0.0_JPRB
        RTSKTI (JROF,JFLD,KBL) = 0.0_JPRB
      ENDDO
    ENDDO
  ENDIF

  CALL GPPOPER('SET1TO9',KBL=KBL)

!  Initialisation of skin temperature perturbations


  IF (NSTEP == 0) THEN
    DO JROF=IST,IEND
      GPTSKIN0(JROF,KBL) = 0.0_JPRB
      GPTSKIN9(JROF,KBL) = 0.0_JPRB
    ENDDO
  ENDIF
  DO JROF=IST,IEND
    ZTSKIN9(JROF) = GPTSKIN9(JROF,KBL)
    ZTSKIN1(JROF) = GPTSKIN9(JROF,KBL)
  ENDDO

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

!*       3.   PREPARE FOR PHYSICS  COMPUTATIONS  (part II)
!             --------------------------------------------

!*      3.1   Compute pressure

  CALL GPPREH  (NPROMA,IST,IEND,NFLEVG,VAH,VBH,ZPRE95)
  CALL GPPREHTL(NPROMA,IST,IEND,NFLEVG,VBH,ZPRE9 )

!*      3.2   Compute auxiliary arrays related to the vertical

  CALL GPXYB  (NPROMA,IST,IEND,NFLEVG,VDELB,VC,&
   & ZPRE95,ZDELP95(1,1),ZRDELP95,ZLNPR95,ZALPH95,ZDUM,&
   & ZRPRE95,ZRPP95)  
  CALL GPXYBTL(NPROMA,IST,IEND,NFLEVG,VDELB,VC,&
   & ZPRE9,ZDELP9(1,1),ZRDELP9,ZLNPR9,ZALPH9,ZRTGR9,&
   & ZRPRE9,ZRPP9,&
   & ZPRE95,ZDELP95(1,1),ZRDELP95,ZLNPR95,ZRPRE95,ZRPP95)  
  CALL GPPREF  (NPROMA,IST,IEND,NFLEVG,ZALPH9,ZPRE95,ZPREF95)
  CALL GPPREFTL(NPROMA,IST,IEND,NFLEVG,ZALPH9,ZPRE9,&
   & ZPRE9F,ZALPH95,ZPRE95)  

!*      3.3   Compute R

  CALL GPRCP  (NPROMA,IST,IEND,NFLEVG,PQ=ZQT95,PR=ZR95)
  CALL GPRCPTL(NPROMA,IST,IEND,NFLEVG,PQ=PGFL(1,1,YQ%MP9_PH),PR=ZR9)  

!*       3.4   Integrate Hydrostatics

  DO JROF=IST,IEND
    ZPHI9 (JROF,NFLEVG)=0.0_JPRB
    ZPHI95(JROF,NFLEVG) = POROG(JROF)
  ENDDO

  CALL GPGEO  (NPROMA,IST,IEND,NFLEVG,&
   & ZPHI95,ZPHIF95,ZTT95,ZR95,ZLNPR95,ZALPH95)  
  CALL GPGEOTL(NPROMA,IST,IEND,NFLEVG,&
   & ZPHI9,ZPHIF9,PGMV(1,1,YPH9%MT),ZR9,ZLNPR9,ZALPH9,&
   & ZTT95,ZR95,ZLNPR95,ZALPH95)  

!*       3.5   Astronomy.

  DO JROF=IST,IEND
    ZMU0(JROF)=MAX( RSIDEC*PGEMU(JROF)&
     & -RCODEC*RCOVSR*SQRT(1.0_JPRB-PGEMU(JROF)**2)*COS(PGELAM(JROF))&
     & +RCODEC*RSIVSR*SQRT(1.0_JPRB-PGEMU(JROF)**2)*SIN(PGELAM(JROF))&
     & ,0.0_JPRB)  
  ENDDO

  DO JROF=IST,IEND
    ZMU0M(JROF)=MAX( RSIDECM*PGEMU(JROF)&
     & -RCODECM*RCOVSRM*SQRT(1.0_JPRB-PGEMU(JROF)**2)*COS(PGELAM(JROF))&
     & +RCODECM*RSIVSRM*SQRT(1.0_JPRB-PGEMU(JROF)**2)*SIN(PGELAM(JROF))&
     & ,0.0_JPRB)  
  ENDDO

!*       3.7  ADIABATIC TENDENCIES AS INPUT FOR PHYSICS

  ZDTPHY=TDT

  CALL GPMKTEND(IST,IEND,TSPHY,&
   & PGMVT1(1,1,YT1%MU),PGMVT1(1,1,YT1%MV) ,PGMVT1(1,1,YT1%MT),&
   & PGFLT1,&
   & PGMV(1,1,YPH9%MU),PGMV(1,1,YPH9%MV),PGMV(1,1,YPH9%MT),&
   & PGFL,&
   & ZDUM,ZDUM,&
   & ZDUM,ZDUM)

  DO JROF=IST,IEND
    ZPRS1 (JROF,NFLEVG) = PGMVT1S(JROF,YT1%MSP)*EXP(ZSPT15(JROF))
    ZPRS15(JROF,NFLEVG) = EXP(ZSPT15(JROF))
  ENDDO

  CALL GPPRE  (NPROMA,IST,IEND,NFLEVG,VAH,VBH,ZPRS15,ZPRSF15)
  CALL GPPRETL(NPROMA,IST,IEND,NFLEVG,VBH,ZPRS1,ZPRSF1,ZPRS15)

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

!*       4.   CALL E.C.M.W.F. LINEAR PHYSICS
!             ------------------------------

!* Obs. input and initialisations for MWave operator 
IF (LEMWAVE_ACTIVE) THEN
  DO JSAT = 1, N_SATSENS
    DO JROF = KSTGLO, MIN (KSTGLO-1+NPROMA,NGPTOT)
   
      YL_MWAVE_RAD (JROF-KSTGLO+1,JSAT) % ZENITH = PMWAVE_ZEN_BUF(JROF,JSAT)
      YL_MWAVE_RAD (JROF-KSTGLO+1,JSAT) % AZIMUTH = PMWAVE_AZI_BUF(JROF,JSAT)
      YL_MWAVE_RAD (JROF-KSTGLO+1,JSAT) % DIAG(:)   = 0.0_JPRB
      YL_MWAVE_RAD (JROF-KSTGLO+1,JSAT) % GRAD_NORM = 0.0_JPRB
      YL_MWAVE_RAD (JROF-KSTGLO+1,JSAT) % OBS (:) = 0.0_JPRB
      YL_MWAVE_RAD (JROF-KSTGLO+1,JSAT) % FW  (:) = 0.0_JPRB
      YL_MWAVE_RAD (JROF-KSTGLO+1,JSAT) % TL  (:) = 0.0_JPRB
      YL_MWAVE_RAD (JROF-KSTGLO+1,JSAT) % AD  (:) = 0.0_JPRB

      DO ICH = 1, MWAVE_ID (JSAT) % NCHANNELS

        YL_MWAVE_RAD (JROF-KSTGLO+1,JSAT) % SCREEN(ICH) = KMWAVE_BUF(JROF,ICH,JSAT) 
        YL_MWAVE_RAD (JROF-KSTGLO+1,JSAT) % PERS1(ICH) = PMWAVE_PERS1_BUF(JROF,ICH,JSAT)
        YL_MWAVE_RAD (JROF-KSTGLO+1,JSAT) % OERR(ICH) = PMWAVE_OERR_BUF(JROF,ICH,JSAT)

      ENDDO
    ENDDO
  ENDDO
ENDIF

!*       4.1  CALL PHYSICS

  DO JGRG=1,NGRG
   DO JROF=1,NPROMA 
     ZGFLFLX(JROF,JGRG) = ZSD_VF5(1,YSD_VF%YGRGFLX(JGRG)%MP5)
    ENDDO
  ENDDO
  DO JTRAC=1,NTRAC
   DO JROF=1,NPROMA 
     ZGFLFLX(JROF,NGRG+JTRAC) = ZSD_VF5(1,YSD_VF%YTRACFLX(JTRAC)%MP5)
    ENDDO
  ENDDO

  CALL CALLPARTL (IST,IEND,NPROMA,YSP_SBD%NLEVS,NTILES,&
   & KSTGLO,&
   & 1,NFLEVG,NSTART,NSTEP,LLRAIN1D,&
   ! - INPUT (TRAJECTORY)
   & ZTT95    ,ZQT95   ,ZGFLT95,&
   & ZUT95    ,ZVT95   ,ZVVEL5,&
   & ZPRS15   ,ZPRSF15,&
   & ZPRE95   ,ZPREF95 ,ZDELP95 (1,1),&
   & ZPHI95   ,ZPHIF95,&
   & ZEMTED5  ,ZTRSOL5 ,ZMU0    ,ZMU0M,&
   & ZSNS95   ,ZTSA95  ,ZWL95   ,ZTL95,&
   & ZWSA95   ,ZTIA95,&
   & ZSP_SG5(1,YSP_SG%YA%MP5), ZSP_SG5(1,YSP_SG%YR%MP5), &
   & ZSP_SG5(1,YSP_SG%YT%MP5),&
   & ZSD_VF5(1,YSD_VF%YGETRL%MP5),ZSD_VF5(1,YSD_VF%YSDFOR%MP5),&
   & ZSD_VF5(1,YSD_VF%YVRLAN%MP5),&
   & ZSD_VF5(1,YSD_VF%YVRLDI%MP5),ZSD_VF5(1,YSD_VF%YSIG%MP5),&
   & ZSD_VF5(1,YSD_VF%YLSM%MP5), ZSD_VF5(1,YSD_VF%YALBF%MP5),&
   & ZSD_VF5(1,YSD_VF%YALUVP%MP5),ZSD_VF5(1,YSD_VF%YALUVD%MP5),&
   & ZSD_VF5(1,YSD_VF%YALNIP%MP5),ZSD_VF5(1,YSD_VF%YALNID%MP5),&
   & ZSD_VF5(1,YSD_VF%YEMISF%MP5),&
   & ZSD_VF5(1,YSD_VF%YCO2O%MP5),ZSD_VF5(1,YSD_VF%YCO2B%MP5),ZSD_VF5(1,YSD_VF%YCO2A%MP5),&
   & ZSD_VF5(1,YSD_VF%YCO2F%MP5),ZSD_VF5(1,YSD_VF%YCH4AG%MP5),ZSD_VF5(1,YSD_VF%YCH4F%MP5),&
   & ZSD_VF5(1,YSD_VF%YSF6%MP5),ZGFLFLX,ZSD_VF5(1,YSD_VF%YCVL%MP5), ZSD_VF5(1,YSD_VF%YCVH%MP5) , &
   & ZSD_VF5(1,YSD_VF%YTVL%MP5),ZSD_VF5(1,YSD_VF%YTVH%MP5),&
   & ZSD_VF5(1,YSD_VF%YLAIL%MP5),ZSD_VF5(1,YSD_VF%YLAIH%MP5),&
   & ZSD_VF5(1,YSD_VF%YSOTY%MP5), ZSD_VF5(1,YSD_VF%YSOALUVP%MP5), ZSD_VF5(1,YSD_VF%YSOALUVD%MP5),&  
   & ZSD_VF5(1,YSD_VF%YSOALNIP%MP5), ZSD_VF5(1,YSD_VF%YSOALNID%MP5),&
   & ZSD_VF5(1,YSD_VF%YCI%MP5), ZSD_VF5(1,YSD_VF%YSST%MP5),&
   & PGELAM, PGECLO   ,PGESLO,&
   & ZSD_VF5(1,YSD_VF%YZ0F%MP5), ZSD_VF5(1,YSD_VF%YLZ0H%MP5) , PGEMU, POROG, &
   & ZGZ0M5   ,ZLZ0H5,&
   & ZSD_VD5(1,YSD_VD%Y10NU%MP5),ZSD_VD5(1,YSD_VD%Y10NV%MP5),&
   ! - UPDATED (TRAJECTORY)
   & ZTENT5   ,ZTENQ5,  ZTENGFL5,&
   & ZTENU5   ,ZTENV5,&
   & ZNTOP5   ,ZNBAS5  , ZACPR5,&
   & ZUSTRTI5 ,ZVSTRTI5 ,ZAHFSTI5, ZEVAPTI5, ZTSKTI5,&
   ! - INPUT
   & PGMV(1,1,YPH9%MT), PGFL(1,1,YQ%MP9_PH), PGFL,&
   & PGMV(1,1,YPH9%MU), PGMV(1,1,YPH9%MV), PB2(1,MSLB2VVEL),&
   & PGFL(1,1,YL%MP9_PH) , PGFL(1,1,YI%MP9_PH) , PGFL(1,1,YA%MP9_PH),&
   & ZPRS1    ,ZPRSF1,&
   & ZPRE9    ,ZPRE9F  , ZDELP9 (1,1),&
   & ZPHI9    ,ZPHIF9,&
   & PSP_SG(1,YSP_SG%YF%MP9 ),PSP_SB(1,1,YSP_SB%YT%MP9),PSP_RR(1,YSP_RR%YW%MP9  ),ZTSKIN9,&
   & PSP_SB(1,1,YSP_SB%YQ%MP9 ),&
   ! - UPDATED
   & PGMVT1(1,1,YT1%MT) ,PGFLT1(1,1,YQ%MP1), PGFLT1,&
   & PGMVT1(1,1,YT1%MU) ,PGMVT1(1,1,YT1%MV),&
   & PSD_VN(1,YSD_VN%YACPR%MP),&
 !- T-star Tiles
   & RUSTRTI(1,1,KBL),RVSTRTI(1,1,KBL),RAHFSTI(1,1,KBL),&
   & REVAPTI(1,1,KBL),RTSKTI(1,1,KBL),&
   ! - OUTPUT
   & ZDIFTQ ,ZDIFTS,ZSTRTU  ,ZSTRTV,&
   & PSD_VD(1,YSD_VD%YZ0F%MP)  ,PSD_VD(1,YSD_VD%YLZ0H%MP),&
   & PSD_VD(1,YSD_VD%Y10NU%MP) ,PSD_VD(1,YSD_VD%Y10NV%MP),&
   & ZTLE1,YL_MWAVE_RAD)

!*  Ouput from MWave forward operator
IF (LEMWAVE_ACTIVE) THEN
  DO JSAT = 1, N_SATSENS
    DO JROF = KSTGLO, MIN (KSTGLO-1+NPROMA,NGPTOT)
      JLOC = JROF-KSTGLO+1
        DO ICH = 1, MWAVE_ID (JSAT) % NCHANNELS
        KMWAVE_BUF (JROF,ICH,JSAT) = YL_MWAVE_RAD (JLOC,JSAT) % SCREEN(ICH)
        IF ( .NOT. BTEST(YL_MWAVE_RAD (JLOC,JSAT) % SCREEN(ICH), MWAVE_NO_OBS ) ) THEN
          PMWAVE_TB_BUF_TL (JROF,ICH,JSAT) = YL_MWAVE_RAD (JLOC,JSAT) % TL   (ICH)
          PMWAVE_OERR_BUF  (JROF,ICH,JSAT) = YL_MWAVE_RAD (JLOC,JSAT) % OERR (ICH)
          PMWAVE_PERS1_BUF (JROF,ICH,JSAT) = YL_MWAVE_RAD (JLOC,JSAT) % PERS1(ICH)
        ENDIF
        ENDDO
    ENDDO
  ENDDO
ENDIF ! LEMWAVE_ACTIVE

!*         4.1a ADD FORCING

  IF(LFORCE) THEN
    DO JLEV=1,NFLEVG
      DO JROF=IST,IEND
        PGMVT1(JROF,JLEV,YT1%MU)=PGMVT1(JROF,JLEV,YT1%MU)+&
         & PFORCEU(JROF,JLEV)  
        PGMVT1(JROF,JLEV,YT1%MV)=PGMVT1(JROF,JLEV,YT1%MV)+&
         & PFORCEV(JROF,JLEV)  
        PGMVT1(JROF,JLEV,YT1%MT)=PGMVT1(JROF,JLEV,YT1%MT)+&
         & PFORCET(JROF,JLEV)  
        PGFLT1(JROF,JLEV,YQ%MP1)=PGFLT1(JROF,JLEV,YQ%MP1)+&
         & PFORCEQ(JROF,JLEV)  
      ENDDO
    ENDDO
  ENDIF

!*       4.2  UPDATE TEMPERATURE,  WIND, GFL

  DO JLEV=1,NFLEVG
    DO JROF=IST,IEND
      PGMVT1(JROF,JLEV,YT1%MU)=PGMV(JROF,JLEV,YPH9%MU)+&
       & ZDTPHY*PGMVT1(JROF,JLEV,YT1%MU)  
      PGMVT1(JROF,JLEV,YT1%MV)=PGMV(JROF,JLEV,YPH9%MV)+&
       & ZDTPHY*PGMVT1(JROF,JLEV,YT1%MV)  
      PGMVT1(JROF,JLEV,YT1%MT)=PGMV(JROF,JLEV,YPH9%MT)+&
       & ZDTPHY*PGMVT1(JROF,JLEV,YT1%MT)  
    ENDDO
  ENDDO
  DO JGFL=1,YGFL%NUMFLDS
    IF(YGFLC(JGFL)%LT1) THEN
      DO JLEV=1,NFLEVG
        DO JROF=IST,IEND
          PGFLT1(JROF,JLEV,YGFLC(JGFL)%MP1)=PGFL(JROF,JLEV,YGFLC(JGFL)%MP9_PH)+&
           & ZDTPHY*PGFLT1(JROF,JLEV,YGFLC(JGFL)%MP1)  
        ENDDO
      ENDDO
    ENDIF
  ENDDO

!*       4.4  COMPUTE NEW T+DT FOR SURFACE FIELDS

  IF (NSTEP < (NSTOP-1)) THEN
    DO JROF=IST,IEND
      ZTSKIN1(JROF)=ZTSKIN1(JROF)+ZDTPHY*ZTLE1(JROF)
      GPTSKIN9(JROF,KBL) = REPSP1*ZTSKIN1(JROF)&
       &                 + (1.0_JPRB-REPSP1)*GPTSKIN0(JROF,KBL)
      GPTSKIN0(JROF,KBL) = ZTSKIN1(JROF)
    ENDDO
  ELSE
    DO JROF=IST,IEND
      GPTSKIN9(JROF,KBL) = 0.0_JPRB
      GPTSKIN0(JROF,KBL) = 0.0_JPRB
    ENDDO
  ENDIF

!*       4.5  COMPUTE DIAGNOSTIC QUANTITIES

  DO JFLD=1,NTILES
    DO JROF=IST,IEND
      RUSTRTI(JROF,JFLD,KBL) = 0.0_JPRB
      RVSTRTI(JROF,JFLD,KBL) = 0.0_JPRB
      RAHFSTI(JROF,JFLD,KBL) = 0.0_JPRB
      REVAPTI(JROF,JFLD,KBL) = 0.0_JPRB
      RTSKTI (JROF,JFLD,KBL) = 0.0_JPRB
    ENDDO
  ENDDO

  PSD_VD(:,YSD_VD%YZ0F%MP)    = 0.0_JPRB
  PSD_VD(:,YSD_VD%YLZ0H%MP)   = 0.0_JPRB

!*    5.7   SURFACE FIELDS TIMESTEPPING

  IF (LTWOTL) THEN
    CALL GPPOPER('SET0TO1', PSP_SB=PSP_SB,PSP_SG=PSP_SG,PSP_RR=PSP_RR)
  ELSE
    CALL GPPOPER('PHTFILT', PSP_SB=PSP_SB,PSP_SG=PSP_SG,PSP_RR=PSP_RR)
  ENDIF

ENDIF

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

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