SUBROUTINE SUIOMI(KULOUT)

!**** *SUIOMI*   - Routine to initialize minimisation IO scheme

!     Purpose.
!     --------
!           Initialize minimisation IO scheme
!**   Interface.
!     ----------
!        *CALL* *SUIOMI(KULOUT) (from SU0YOMA)

!        Explicit arguments :
!        --------------------
!        KULOUT : Logical unit for the output

!        Implicit arguments :
!        --------------------
!        COMMON YOMIOMI

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

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

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

!     Author.
!     -------
!        Jean-Noel Thepaut *ECMWF*

!     Modifications.
!     --------------
!        Original : 92-03-6
!        R. EL Khatib : 93-04-02 Set-up defaults controled by LECMWF
!        F. Bouttier  : 94-07-28 Check NMUPD vs NMTRA if LINMEM
!        L. Isaksen   : 95-06-06 Reordering of spectral arrays
!        L. Isaksen   : 96-02-20 NFLEV --> NFLEVL
!        F. Bouttier  : 96-05-30 now NMTRA is computed from NMUPD
!        F. Rabier    : 98-01-06 add check on NCONF for warm start
!        E. Andersson : 98-07-06 TOVS control variable
!        R. Randriamampianina : 97-05  3DVAR ALADIN
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!     ------------------------------------------------------------------

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

USE YOMCT0   , ONLY :     NCONF
USE YOMLUN   , ONLY :    NULNAM
USE YOMCT0B  , ONLY : LECMWF
USE YOMIOMI  , ONLY : CFVATRA  ,NMUPD    ,LWARM_RD ,LWARM_WR ,LREADSP
USE YOMVAR   , ONLY : NITER    ,NINFRA   ,NUPTRA

IMPLICIT NONE

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

#include "posnam.intfb.h"
#include "namiomi.h"

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

!*       1.    SET DEFAULT VALUES.
!              -------------------

!        1.1 Set implicit default values

IF (LHOOK) CALL DR_HOOK('SUIOMI',0,ZHOOK_HANDLE)
NMUPD=10
CFVATRA='VATRH'

LWARM_RD=.FALSE.
LWARM_WR=.FALSE.
LREADSP=.FALSE.
IF (NUPTRA>0.AND.NCONF == 131) THEN
  LWARM_RD=.TRUE.
  LWARM_WR=.TRUE.
  LREADSP=.FALSE.
ENDIF

!        1.2 Modify default values according to LECMWF

IF (LECMWF) THEN
  IF (NITER <= 10) NMUPD=NITER-1
ELSE
ENDIF

!        1.3   Modify values according to namelist

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

!        1.4   Force the expected diminution of the cost function if LWARM_RD

IF(LWARM_RD) NINFRA=100

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

!*       3.    Print final values.
!              -------------------

WRITE(UNIT=KULOUT,FMT='('' COMMON YOMIOMI '')')
WRITE(UNIT=KULOUT,FMT='('' NMUPD = '',I6)')NMUPD
WRITE(KULOUT,*) ' LWARM_RD=',LWARM_RD,' LWARM_WR=',LWARM_WR,'  ( NUPTRA=',NUPTRA,')'
WRITE(UNIT=KULOUT,FMT='(''   CFVATRA = '',A35)')CFVATRA

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