SUBROUTINE SUVERTFE

!**** *SUVERTFE*  - Setup VERTical Finite Element scheme

!     Purpose.
!     --------
!           Call of initialisation routines for the different 
!           versions of the vertical finite element scheme

!**   Interface.
!     ----------

!     *CALL* SUVERTFE

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

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

!     Method.
!     -------

!     Externals.
!     ----------
!        SUVERTFE1 - setup of linear finite element scheme
!        SUVERTFE3 - setup of cubic  finite element scheme

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

!     Author.
!     -------
!        Mariano Hortal ECMWF

!     Modifications.
!     --------------
!   Original : 2000-05
!   Modified by A. Untch: 2000-09 Added option of cubic finite elements.
!   M.Hamrud      01-Oct-2003 CY28 Cleaning
!   M.Hamrud      01-Dec-2003 CY28R1 Cleaning
!   K.Yessad and J.Vivoda: 28-08-2007 Set-up VFE for NH model.
!   N. Wedi and K. Yessad (Jan 2008): different dev for NH model and PC scheme
!     ------------------------------------------------------------------

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

USE YOMCT0   , ONLY : LNHDYN
USE YOMLUN   , ONLY : NULERR
USE YOMCVER  , ONLY : LVERTFE  ,NVSCH    ,RDERB    ,RDERI
USE YOMDIM   , ONLY : NFLEVG

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

IMPLICIT NONE

REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

#include "abor1.intfb.h"
#include "sunh_vertfe1d.intfb.h"
#include "sunh_vertfe1dd.intfb.h"
#include "sunh_vertfe3d.intfb.h"
#include "sunh_vertfe3dbc.intfb.h"
#include "sunh_vertfe3dd.intfb.h"
#include "suvertfe1.intfb.h"
#include "suvertfe3.intfb.h"
#include "suvertfe3d.intfb.h"

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

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

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

IF(LVERTFE) THEN
  IF(NVSCH == 1) THEN
    ! setup linear finite element scheme
    CALL SUVERTFE1
    IF (LNHDYN) THEN
      CALL SUNH_VERTFE1D
      ! ----- SUNH_VERTFE1DBC not yet coded ----------------------
      ! CALL SUNH_VERTFE1DBC
      ! Provisionally RDERB=RDERI with additional zeroed columns.
      RDERB(1:NFLEVG,1)=0.0_JPRB
      RDERB(1:NFLEVG,2:NFLEVG+1)=RDERI(1:NFLEVG,1:NFLEVG)
      RDERB(1:NFLEVG,NFLEVG+2)=0.0_JPRB
      ! ----------------------------------------------------------
      CALL SUNH_VERTFE1DD
    ENDIF
  ELSEIF(NVSCH == 3) THEN
    ! setup cubic finite element scheme
    CALL SUVERTFE3
    IF (LNHDYN) THEN
      CALL SUNH_VERTFE3D
      CALL SUNH_VERTFE3DBC
      CALL SUNH_VERTFE3DD
    ELSE
      CALL SUVERTFE3D
    ENDIF
  ELSE
    WRITE(NULERR,*) ' SUVERTFE: INVALID VALUE OF NVSCH: ',NVSCH
  ENDIF
ELSE
  CALL ABOR1(' IN SUVERTFE LVERTFE SHOULD BE TRUE')
ENDIF

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

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