C $Header: /u/gcmpack/MITgcm/pkg/bulk_force/bulkf_readparms.F,v 1.3 2003/11/23 01:36:55 jmc Exp $
C $Name:  $

#include "CPP_OPTIONS.h"

      SUBROUTINE CHEAPAML_READPARMS( myThid )
C     /==========================================================\
C     | SUBROUTINE CHEAPAML_READPARMS                            |
C     | o Routine to initialize CHEAPAML variables and consts.   |
C     \==========================================================/
      IMPLICIT NONE

C     === Global variables ===
#include "SIZE.h"
#include "EEPARAMS.h"
#include "PARAMS.h"
#include "CHEAPAML.h"

C     === Routine arguments ===
      INTEGER myThid

C     === Local variables ===
C     msgBuf      - Informational/error meesage buffer
C     iUnit       - Work variable for IO unit number
      CHARACTER*(MAX_LEN_MBUF) msgBuf
      INTEGER iUnit

C--   Bulk Formula parameter
      NAMELIST /CHEAPAML_CONST/
     &  cheapaml_ntim, cheapaml_h,
     &  cheapaml_kdiff, cheapaml_taurelax1,
     &  cheapaml_taurelax2, cheapaml_xf,
     &  cdrag_1,cdrag_2,cdrag_3,
     &  cheapaml_dtc, rhoa, cpair, stefan
      NAMELIST /CHEAPAML_PARM01/
     &         AirTempFile, 
     &         SolarFile, 
     &  	UWindFile,
     &         VWindFile, 
     &		TRFile


      _BEGIN_MASTER(myThid)

      WRITE(msgBuf,'(A)') ' BULKF_READPARMS: opening data.cheapaml'
      CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
     &                    SQUEEZE_RIGHT , 1)
    

      CALL OPEN_COPY_DATA_FILE(
     I                          'data.cheapaml', 'CHEAPAML_READPARMS',
     O                          iUnit,
     I                          myThid )

C--   Default values 
C-    Physical constant :
	cheapaml_ntim = 5
	cheapaml_h=1000.d0
	cheapaml_kdiff=1.d4
	cheapaml_taurelax1 = 30.d0
	cheapaml_taurelax2 = .1d0
	cheapaml_xf=2.d0
	cheapaml_dtc=1.d0
      rhoa   = 1.3 _d 0
      cpair  = 1004.d0
      stefan = 5.67 _d -8
	cdrag_1=0.0027d0
	cdrag_2=0.00142d0
	cdrag_3=0.0000764d0

C-    Input data files names :
      AirTempFile=' '
      SolarFile=' '
      UWindFile=' '
      VWindFile=' '
	TRFile=' '

C--   Read parameters from open data file
      READ(UNIT=iUnit,NML=CHEAPAML_CONST)
      WRITE(msgBuf,'(A)') ' CHEAPAML_READPARMS: read CHEAPAML_PARM01'
      CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
     &                    SQUEEZE_RIGHT , 1)
C--   Read parameters from open data file
      READ(UNIT=iUnit,NML=CHEAPAML_PARM01)
      WRITE(msgBuf,'(A)') ' CHEAPAML_READPARMS: read CHEAPAML_PARM01'
      CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
     &                    SQUEEZE_RIGHT , 1)

C--   Close the open data file
      CLOSE(iUnit)

C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
      iUnit = standardMessageUnit
      WRITE(iUnit,*) 'Caml: ntim     =',cheapaml_ntim
      WRITE(iUnit,*) 'Caml: h        =',cheapaml_h
      WRITE(iUnit,*) 'Caml: kdiff    =',cheapaml_kdiff
      WRITE(iUnit,*) 'Caml: tau1     =',cheapaml_taurelax1
      WRITE(iUnit,*) 'Caml: tau2     =',cheapaml_taurelax2
      WRITE(iUnit,*) 'Caml: xf       =',cheapaml_xf
      WRITE(iUnit,*) 'Caml: dtc      =',cheapaml_dtc
      WRITE(iUnit,*) 'Caml: rhoa     =',rhoa
      WRITE(iUnit,*) 'Caml: cpair    =',cpair
      WRITE(iUnit,*) 'Caml: stefan   =',stefan
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|

      _END_MASTER(myThid)

C--   Everyone else must wait for the parameters to be loaded
      _BARRIER

      RETURN
      END
