SUBROUTINE SUCVMNH(KULOUT)

! Purpose:
! --------
! Setup of KFB convection

! Interface:
! ----------
! KULOUT: logical unit for the output

! Externals:
! ----------
! None

! Method:
! -------

! Reference:
! ----------

! Author:
! ------
! 04-02-05 G. Hello

! Modifications:
! --------------
! End Modifications
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!        E. BAZILE     03-August-2006 Read NAMCVMNH
!        E. BAZILE     21-Feb.-2008 Correction for XWTRIG
!----------------------------------------------------------------
USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK

USE YOMLUN   , ONLY : NULNAM
USE YOMARPHY  , ONLY : LKFBD, LKFBS
USE YOMPHY    , ONLY : LCVPPKF
USE YOMCVMNH, ONLY : LDEEP, LSHALLOW, LDIAGCONV, LSETTADJ, &
 & OTADJD, OTADJS, NSETENS, NIICE,&
 & LREFRESH_ALL, LDOWN,&
 & XA25, XCRAD, XCDEPTH, XCDEPTH_D, XDTPERT, XENTR, &
 & XZLCL, XZPBL, XWTRIG, XNHGAM, XTFRZ1, XTFRZ2, XSTABT, XSTABC
IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KULOUT 
REAL(KIND=JPRB) :: ZHOOK_HANDLE

#include "posnam.intfb.h"
#include "namcvmnh.h"

! 1. Set default values
! ---------------------

IF (LHOOK) CALL DR_HOOK('SUCVMNH',0,ZHOOK_HANDLE)
LDEEP=LKFBD
LSHALLOW=LKFBS
LDIAGCONV=.TRUE.
LSETTADJ=.TRUE.
LREFRESH_ALL=.TRUE.
LDOWN=.TRUE.

OTADJD=3600._JPRB
OTADJS=3600._JPRB

XA25     = 625.E6_JPRB    ! 25 km x 25 km reference grid area
XCRAD       = 50._JPRB    ! cloud radius
XCDEPTH     = 0.5E3_JPRB  ! minimum necessary shallow cloud depth
XCDEPTH_D   = 2.5E3_JPRB  ! maximum allowed shallow cloud depth
XDTPERT     = .2_JPRB     ! add small Temp perturbation at LCL
XENTR    = 0.02_JPRB      ! entrainment constant (m/Pa) = 0.2 (m)
XZLCL    = 0.5E3_JPRB   ! maximum allowed allowed height
                     ! difference between the DPL and the surface
XZPBL    = 40.E2_JPRB     ! minimum mixed layer depth to sustain convection
XNHGAM   = 1.3333_JPRB    ! accounts for non-hydrost. pressure
                     ! in buoyancy term of w equation
                     ! = 2 / (1+gamma)
XWTRIG   = 6._JPRB   ! constant in vertical velocity trigger
XTFRZ1   = 268.16_JPRB    ! begin of freezing interval
XTFRZ2   = 248.16_JPRB    ! end of freezing interval
XSTABT   = 0.75_JPRB      ! factor to assure stability in  fractional time
                     ! integration, routine CONVECT_CLOSURE
XSTABC   = 0.95_JPRB      ! factor to assure stability in CAPE adjustment,
                     !  routine CONVECT_CLOSURE


!*       2.    Modify default values.
!              ----------------------

CALL POSNAM(NULNAM,'NAMCVMNH')
READ(NULNAM,NAMCVMNH)

NSETENS=0.0_JPRB
NIICE=1.0_JPRB

WRITE(UNIT=KULOUT,FMT='('' COMMON YOMCVMNH '')')

WRITE(UNIT=KULOUT,FMT='('' LDEEP= '',L5 &
 & ,'' LSHALLOW= '',L5 &
 & ,'' LDIAGCONV= '',L5 &
 & ,'' LSETTADJ= '',L5 &
 & ,'' LREFRESH_ALL= '',L5 &
 & ,'' LDOWN= '',L5 &
 & )')&
 & LDEEP,LSHALLOW,LDIAGCONV,LSETTADJ,LREFRESH_ALL,LDOWN  

WRITE(UNIT=KULOUT,FMT='('' NSETENS= '',I2 &
 & ,'' NIICE= '',I2 &
 & )')&
 & NSETENS,NIICE  
IF (LCVPPKF) THEN
   WRITE(UNIT=KULOUT,FMT='('' COMMON YOMCVMNH PARTIE SHALLOW KFB'')')
   WRITE(UNIT=KULOUT,FMT='('' OTADJD= '',E14.7 &
     & ,'' OTADJS= '',E14.7, '' XA25= '',E14.7,'' XCRAD= '',E14.7 &
     & ,'' XCDEPTH= '',E14.7, '' XCDEPTH_D= '',E14.7,'' XDTPERT= '',E14.7 &
     & ,'' XENTR= '',E14.7, '' XZLCL= '',E14.7,'' XZPBL= '',E14.7 &
     & ,'' XWTRIG= '',E14.7 &
     & ,'' XNHGAM= '',E14.7, '' XTFRZ1= '',E14.7,'' XTFRZ2= '',E14.7 &
     & ,'' XSTABT= '',E14.7, '' XSTABC= '',E14.7 &
     & )')&
     & OTADJD,OTADJS  ,&
     & XA25, XCRAD, XCDEPTH, XCDEPTH_D, XDTPERT, XENTR, &
     & XZLCL, XZPBL, XWTRIG, XNHGAM, XTFRZ1, XTFRZ2, XSTABT, XSTABC
ENDIF
IF (LHOOK) CALL DR_HOOK('SUCVMNH',1,ZHOOK_HANDLE)

END SUBROUTINE SUCVMNH
