SUBROUTINE DEALLT

!**** *DEALLT * - Release additional space for trajectory.

!     Purpose.
!     --------
!           Release space for the grid-point and spectral trajectory.

!**   Interface.
!     ----------
!        *CALL* *DEALLT*

!     Explicit arguments :  None
!     --------------------

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

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

!     Externals.
!     ----------

!     Reference.
!     ----------
!        ECMWF Research Department documentation of the IFS

!     Author.
!     -------
!        Mats Hamrud and Philippe Courtier  *ECMWF*

!     Modifications.
!     --------------
!        Original : 88-05-19
!        Modified : 93-04-13 L.Labbe - Unloc trajectory boundaries array -
!        Modified : 97-12-01 E. Holm - Ozone included
!        Modified : 98-27-10 G. Mozdzynski - grid-point trajectory added
!        Modified : 00-02-15 C.Temperton - semi-Lag. trajectory added
!        Modified : 00-08-11 Y.Tremolet  - removed SPECTRAJ and GPTRAJ
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!        M.Hamrud      01-Dec-2003 CY28R1 Cleaning
!     ------------------------------------------------------------------

USE PARKIND1  ,ONLY : JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
USE YOMSP    , ONLY : SP5A3    ,SP5A2    ,SP5VOR   ,SP5DIV   ,&
 & SP5HV    ,SP5T     ,SP5Q     ,SP5O3    ,SP5L     ,&
 & SP5I     ,SP5SP    ,SP5GFL  
USE YOMTRSL  , ONLY : TRAJSL
USE TRAJECTORY_MOD, ONLY: deallocate_trajectory
USE YOMGMV   , ONLY : GMV_DEPART,GMVS_DEPART
USE YOMGFL   , ONLY : GFL_DEPART

IMPLICIT NONE

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

!*       1.    RELEASE SPACE FOR ARRAYS.
!              -------------------------

IF (LHOOK) CALL DR_HOOK('DEALLT',0,ZHOOK_HANDLE)
CALL DEALLOCATE_TRAJECTORY

!*       1.1   ALL FIELDS.
IF(ASSOCIATED(SP5VOR)) NULLIFY(SP5VOR)
IF(ASSOCIATED(SP5DIV)) NULLIFY(SP5DIV)
IF(ASSOCIATED(SP5HV )) NULLIFY(SP5HV )
IF(ASSOCIATED(SP5T  )) NULLIFY(SP5T  )
IF(ASSOCIATED(SP5Q  )) NULLIFY(SP5Q  )
IF(ASSOCIATED(SP5O3 )) NULLIFY(SP5O3 )
IF(ASSOCIATED(SP5L  )) NULLIFY(SP5L  )
IF(ASSOCIATED(SP5I  )) NULLIFY(SP5I  )
IF(ASSOCIATED(SP5GFL )) NULLIFY(SP5GFL )
IF(ALLOCATED(SP5A3 )) DEALLOCATE(SP5A3)

IF(ASSOCIATED(SP5SP )) NULLIFY(SP5SP )
IF(ALLOCATED(SP5A2 )) DEALLOCATE(SP5A2)

IF(ALLOCATED(GMV_DEPART)) DEALLOCATE(GMV_DEPART)
IF(ALLOCATED(GMVS_DEPART)) DEALLOCATE(GMVS_DEPART)
IF(ALLOCATED(GFL_DEPART)) DEALLOCATE(GFL_DEPART)

IF(ALLOCATED(TRAJSL)) DEALLOCATE(TRAJSL)

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

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