 MODULE comdem
!!======================================================================
!!                   ***  MODULE comdem  ***
!!
!!======================================================================





























































!! * Modules used
   USE parameters
!, only: kmax,imin,imax,ljmin,ljmax,rsh

!! * Accessibility

!! * Shared or public module variables

!! * Private variables
   INTEGER                                      :: nsdem
   REAL(kind=rsh),ALLOCATABLE, DIMENSION(:,:)   :: ud,vd,xed
   REAL(kind=rsh),ALLOCATABLE, DIMENSION(:,:,:) :: sald,tempd,uzd,vzd

!real(kind=rsh),allocatable, dimension(:,:,:,:):: cv_watd
   REAL(kind=rsh),DIMENSION(nb_var,kmax,imin:imax,jmin:jmax) :: cv_watd


 CONTAINS

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

  SUBROUTINE alloc_comdem

!&E---------------------------------------------------------------------
!&E                 ***  ROUTINE alloc_comdem  ***
!&E
!&E ** Purpose :
!&E
!&E ** Description :
!&E
!&E ** Called by :
!&E
!&E ** External calls :
!&E
!&E ** Used ij-arrays :
!&E
!&E ** Modified variables :
!&E
!&E ** Reference :
!&E
!&E ** History :
!&E       !  2009-09 (S. Michel, HOCER) correct i dimension of the arrays
!&E
!&E---------------------------------------------------------------------
!! * Modules used
   IMPLICIT NONE

!! * Local declarations

!!----------------------------------------------------------------------
!! * Executable part

   IF (ALLOCATED(ud)) PRINT*,"error: alloc_comdem already allocated"
   ALLOCATE(   ud(     limin:limax,ljmin:ljmax) )
   ALLOCATE(   vd(     limin:limax,ljmin:ljmax) )
   ALLOCATE(  xed(     limin:limax,ljmin:ljmax) )
   ALLOCATE( sald(kmax,limin:limax,ljmin:ljmax) )
   ALLOCATE(tempd(kmax,limin:limax,ljmin:ljmax) )
   ALLOCATE(  uzd(kmax,limin:limax,ljmin:ljmax) )
   ALLOCATE(  vzd(kmax,limin:limax,ljmin:ljmax) )
!#ifdef 1
!  allocate(cv_watd(nb_var,kmax,imin:imax,ljmin:ljmax) )
!#endif

  END SUBROUTINE alloc_comdem

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

  SUBROUTINE dealloc_comdem

!&E---------------------------------------------------------------------
!&E                 ***  ROUTINE dealloc_comdem  ***
!&E
!&E ** Purpose :
!&E
!&E ** Description :
!&E
!&E ** Called by :
!&E
!&E ** External calls :
!&E
!&E ** Used ij-arrays :
!&E
!&E ** Modified variables :
!&E
!&E ** Reference :
!&E
!&E ** History :
!&E       !
!&E
!&E---------------------------------------------------------------------
!! * Modules used
   IMPLICIT NONE

!! * Arguments

!! * Local declarations

!!----------------------------------------------------------------------
!! * Executable part

   DEALLOCATE(ud,vd,xed,sald,tempd,uzd,vzd)
!#ifdef 1
!  deallocate(cv_watd)
!#endif

  END SUBROUTINE dealloc_comdem

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

 END MODULE comdem
