Back to home page

MITgcm

 
 

    


File indexing completed on 2018-03-02 18:38:25 UTC

view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
273b87cfc7 Jean*0001 #include "CHEAPAML_OPTIONS.h"
cf5b5345a0 Jean*0002 
                0003       SUBROUTINE CHEAPAML_READPARMS( myThid )
0076c86d1b Jean*0004 C     *==========================================================*
cf5b5345a0 Jean*0005 C     | SUBROUTINE CHEAPAML_READPARMS                            |
                0006 C     | o Routine to initialize CHEAPAML variables and consts.   |
0076c86d1b Jean*0007 C     *==========================================================*
cf5b5345a0 Jean*0008       IMPLICIT NONE
                0009 
                0010 C     === Global variables ===
                0011 #include "SIZE.h"
                0012 #include "EEPARAMS.h"
                0013 #include "PARAMS.h"
                0014 #include "CHEAPAML.h"
                0015 
                0016 C     === Routine arguments ===
                0017       INTEGER myThid
                0018 
                0019 C     === Local variables ===
0076c86d1b Jean*0020 C     msgBuf      :: Informational/error message buffer
                0021 C     iUnit       :: Work variable for IO unit number
cf5b5345a0 Jean*0022       CHARACTER*(MAX_LEN_MBUF) msgBuf
                0023       INTEGER iUnit
2d31068647 Jean*0024 C-    retired parameters:
                0025 C     nRetired    :: Count number of "retired" parameters found in namelist.
                0026       INTEGER nRetired
                0027       _RL cheapaml_taurelax, cheapaml_taurelaxocean
cf5b5345a0 Jean*0028 
                0029 C--   Bulk Formula parameter
                0030       NAMELIST /CHEAPAML_CONST/
ced0783fba Jean*0031      &  cheapaml_ntim, cheapaml_mask_width,
0076c86d1b Jean*0032      &  cheapaml_h, cheapaml_kdiff,
2d31068647 Jean*0033      &  cheap_tauRelax, cheap_tauRelaxOce,
cf5b5345a0 Jean*0034      &  cdrag_1,cdrag_2,cdrag_3,
0076c86d1b Jean*0035      &  rhoa, cpair, stefan, gasR, xkar,
2616d73cb2 Nico*0036      &   dsolms,dsolmn,zu,zt,zq,
                0037      &   xphaseinit,gamma_blk,humid_fac,p0,
2d31068647 Jean*0038      &   cheap_pr1, cheap_pr2,
                0039      &  cheapaml_taurelax, cheapaml_taurelaxocean
                0040 
cf5b5345a0 Jean*0041       NAMELIST /CHEAPAML_PARM01/
0076c86d1b Jean*0042      &         periodicExternalForcing_cheap,
                0043      &         externForcingPeriod_cheap,
                0044      &         externForcingCycle_cheap,
                0045      &         AirTempFile,
                0046      &         SolarFile,
5b5e7c31c6 Jean*0047      &         UWindFile,
0076c86d1b Jean*0048      &         VWindFile,
ced0783fba Jean*0049      &         TrFile,
                0050      &         QrFile,
                0051      &         AirQFile,
                0052      &         UStressFile, VStressFile,
                0053      &         WaveHFile,WavePFile,
0076c86d1b Jean*0054      &         TracerFile,TracerRfile,
                0055      &         cheapMaskFile,cheap_hFile,
                0056      &         cheap_clFile,cheap_dlwFile,
                0057      &         cheap_prFile
2d31068647 Jean*0058 
cf5b5345a0 Jean*0059       NAMELIST /CHEAPAML_PARM02/
76b059cef2 Jean*0060      &         cheapamlXperiodic,
                0061      &         cheapamlYperiodic,
0076c86d1b Jean*0062      &         useFreshWaterFlux,
ced0783fba Jean*0063      &         useFluxLimit,
                0064      &         FluxFormula,WaveModel,
51132e5783 Nico*0065      &         useStressOption,
2616d73cb2 Nico*0066      &         useCheapTracer ,
0076c86d1b Jean*0067      &         useTimeVarBLH,
                0068      &         useClouds,
cf6b9ab292 Brun*0069      &         useDLongWave,
d54b0079d9 Brun*0070      &         usePrecip,
                0071      &         useRelativeWind
cf5b5345a0 Jean*0072 
ae4c29e0db Jean*0073 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0074 
                0075       IF ( .NOT.useCheapAML ) THEN
                0076 C-    pkg CHEAPAML is not used
                0077         _BEGIN_MASTER(myThid)
                0078 C-    Track pkg activation status:
                0079 C     print a (weak) warning if data.cheapaml is found
                0080          CALL PACKAGES_UNUSED_MSG( 'useCheapAML', ' ', ' ' )
                0081         _END_MASTER(myThid)
                0082         RETURN
                0083       ENDIF
                0084 
cf5b5345a0 Jean*0085       _BEGIN_MASTER(myThid)
                0086 
                0087       WRITE(msgBuf,'(A)') ' BULKF_READPARMS: opening data.cheapaml'
                0088       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
ae4c29e0db Jean*0089      &                    SQUEEZE_RIGHT, myThid )
0076c86d1b Jean*0090 
cf5b5345a0 Jean*0091       CALL OPEN_COPY_DATA_FILE(
                0092      I                          'data.cheapaml', 'CHEAPAML_READPARMS',
                0093      O                          iUnit,
                0094      I                          myThid )
                0095 
0076c86d1b Jean*0096 C--   Hard-coded values (not in any namelist):
                0097 C     coeff. used to compute saturation specific humidity (not in namelist)
                0098       ssq0 = 3.797915 _d 0
                0099       ssq1 = 7.93252  _d -6
                0100       ssq2 = 2.166847 _d -3
4fa4901be6 Nico*0101 
0076c86d1b Jean*0102 C--   Default values
cf5b5345a0 Jean*0103 C-    Physical constant :
                0104       cheapaml_ntim = 5
ced0783fba Jean*0105       cheapaml_h=1000. _d 0
0076c86d1b Jean*0106       cheapaml_kdiff=1. _d 4
2d31068647 Jean*0107       cheap_tauRelax    = 8640. _d 0
                0108       cheap_tauRelaxOce = 0. _d 0
ced0783fba Jean*0109       cheapaml_mask_width = 0
cf5b5345a0 Jean*0110       rhoa   = 1.3 _d 0
ced0783fba Jean*0111       cpair  = 1004. _d 0
cf5b5345a0 Jean*0112       stefan = 5.67 _d -8
ced0783fba Jean*0113       dsolms = 50. _d 0
                0114       dsolmn = 25. _d 0
0076c86d1b Jean*0115 C heights of variables
ced0783fba Jean*0116       zu=10. _d 0
                0117       zt=zu
                0118       zq=zu
                0119       xphaseinit = 0. _d 0
                0120       cdrag_1=0.0027 _d 0
4fa4901be6 Nico*0121       cdrag_2=0.000142 _d 0
ced0783fba Jean*0122       cdrag_3=0.0000764 _d 0
0076c86d1b Jean*0123 C gas constant
ced0783fba Jean*0124       gasR=287.04 _d 0
0076c86d1b Jean*0125 C atmospheric adiabatic lapse rate
                0126       gamma_blk=0.0098 _d 0
                0127 C humidity factor for computing virtual potential temperature
                0128       humid_fac=0.606 _d 0
                0129 C surface pressure in mb
                0130       p0=1000. _d 0
                0131 C latent heat (J/kg)
                0132       lath=2.5 _d 6
                0133 C von Karman constant
                0134       xkar=0.4 _d 0
                0135 C periodic forcing
                0136       periodicExternalForcing_cheap = periodicExternalForcing
                0137       externForcingPeriod_cheap = externForcingPeriod
                0138       externForcingCycle_cheap = externForcingCycle
2616d73cb2 Nico*0139 C precipitation time constant
0076c86d1b Jean*0140       cheap_pr1 = 2*3600.0 _d 0
                0141       cheap_pr2 = 36*3600.0 _d 0
cf5b5345a0 Jean*0142 
2d31068647 Jean*0143 C-    Retired parameters: initialised to unlikely value:
                0144       nRetired = 0
                0145       cheapaml_taurelax = UNSET_RL
                0146       cheapaml_taurelaxocean = UNSET_RL
                0147 
cf5b5345a0 Jean*0148 C-    Input data files names :
                0149       AirTempFile=' '
ced0783fba Jean*0150       AirQFile=' '
cf5b5345a0 Jean*0151       SolarFile=' '
                0152       UWindFile=' '
                0153       VWindFile=' '
ced0783fba Jean*0154       TrFile=' '
7b487d119e Jean*0155       QrFile=' '
ced0783fba Jean*0156       WaveHFile=' '
                0157       WavePFile=' '
51132e5783 Nico*0158       TracerFile=' '
                0159       TracerRFile=' '
0076c86d1b Jean*0160       cheapMaskFile=' '
                0161       cheap_hFile =' '
                0162       cheap_prFile =' '
                0163       cheap_clFile =' '
                0164       cheap_dlwFile =' '
86e074f765 Nico*0165       FluxFormula='COARE3'
ced0783fba Jean*0166       WaveModel='Smith'
cf5b5345a0 Jean*0167 
76b059cef2 Jean*0168 C-    Assumes domain (with land) is periodic in both direction
                0169 C      (consitent with default EXCH setting)
                0170 c     cheapamlXperiodic = .TRUE.
                0171 c     cheapamlYperiodic = .TRUE.
                0172 C note: for backward compatibility, switch to non periodic domain:
                0173       cheapamlXperiodic = .FALSE.
                0174       cheapamlYperiodic = .FALSE.
                0175 
cf5b5345a0 Jean*0176 C-    e-p option turned off by default
0076c86d1b Jean*0177       useFreshWaterFlux=.TRUE.
cf5b5345a0 Jean*0178 
51132e5783 Nico*0179 C-    turn off flux limiting advection by default
0076c86d1b Jean*0180       useFluxLimit=.FALSE.
cf5b5345a0 Jean*0181 
51132e5783 Nico*0182 C-    turn off stress option by default
0076c86d1b Jean*0183       useStressOption=.FALSE.
cf5b5345a0 Jean*0184 
51132e5783 Nico*0185 C-    turn off passive tracer option by default
0076c86d1b Jean*0186       useCheapTracer=.FALSE.
2616d73cb2 Nico*0187 
                0188 C-    turn off time varying BL height option by default
0076c86d1b Jean*0189       useTimeVarBLH=.FALSE.
2616d73cb2 Nico*0190 
                0191 C-    turn off clouds option by default
0076c86d1b Jean*0192       useClouds=.FALSE.
86e074f765 Nico*0193 
                0194 C-    use imported downward longwave
0076c86d1b Jean*0195       useDLongWave=.FALSE.
51132e5783 Nico*0196 
cf6b9ab292 Brun*0197 C-    use imported precip
                0198       usePrecip=.FALSE.
                0199 
d54b0079d9 Brun*0200 C-    use relative wind
                0201       useRelativeWind=.FALSE.
                0202 
ced0783fba Jean*0203 C--   Read parameters from open data file
                0204       READ(UNIT=iUnit,NML=CHEAPAML_CONST)
cf5b5345a0 Jean*0205       WRITE(msgBuf,'(A)') ' CHEAPAML_READPARMS: read CHEAPAML_CONST'
                0206       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
ae4c29e0db Jean*0207      &                    SQUEEZE_RIGHT, myThid )
cf5b5345a0 Jean*0208 
                0209 C--   Read parameters from open data file
                0210       READ(UNIT=iUnit,NML=CHEAPAML_PARM01)
                0211       WRITE(msgBuf,'(A)') ' CHEAPAML_READPARMS: read CHEAPAML_PARM01'
                0212       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
ae4c29e0db Jean*0213      &                    SQUEEZE_RIGHT, myThid )
cf5b5345a0 Jean*0214 
                0215 C--   Read parameters from open data file
                0216       READ(UNIT=iUnit,NML=CHEAPAML_PARM02)
                0217       WRITE(msgBuf,'(A)') ' CHEAPAML_READPARMS: read CHEAPAML_PARM02'
                0218       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
ae4c29e0db Jean*0219      &                    SQUEEZE_RIGHT, myThid )
cf5b5345a0 Jean*0220 
                0221 C--   Close the open data file
7a77863887 Mart*0222 #ifdef SINGLE_DISK_IO
cf5b5345a0 Jean*0223       CLOSE(iUnit)
7a77863887 Mart*0224 #else
                0225       CLOSE(iUnit,STATUS='DELETE')
                0226 #endif /* SINGLE_DISK_IO */
0076c86d1b Jean*0227 C compute derivative values
                0228 C energy flux conversion factor
4fa4901be6 Nico*0229         xef=1. _d 0 /rhoa/cpair
0076c86d1b Jean*0230 C inverse of layer thickness
4fa4901be6 Nico*0231         hm=1. _d 0/cheapaml_h
ced0783fba Jean*0232 
cf5b5345a0 Jean*0233 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0234       iUnit = standardMessageUnit
                0235       WRITE(iUnit,*) 'Caml: ntim     =',cheapaml_ntim
ced0783fba Jean*0236       WRITE(iUnit,*) 'Caml: mask_w   =',cheapaml_mask_width
cf5b5345a0 Jean*0237       WRITE(iUnit,*) 'Caml: h        =',cheapaml_h
                0238       WRITE(iUnit,*) 'Caml: kdiff    =',cheapaml_kdiff
2d31068647 Jean*0239       WRITE(iUnit,*) 'Caml: tauRelax =', cheap_tauRelax, ' (s)'
                0240       WRITE(iUnit,*) 'Caml: tRelaxOce=', cheap_tauRelaxOce,' (s)'
cf5b5345a0 Jean*0241       WRITE(iUnit,*) 'Caml: rhoa     =',rhoa
                0242       WRITE(iUnit,*) 'Caml: cpair    =',cpair
                0243       WRITE(iUnit,*) 'Caml: stefan   =',stefan
76b059cef2 Jean*0244       WRITE(iUnit,*) 'Caml: cheapamlXperiodic  =',cheapamlXperiodic
                0245       WRITE(iUnit,*) 'Caml: cheapamlYperiodic  =',cheapamlYperiodic
0076c86d1b Jean*0246       WRITE(iUnit,*) 'Caml: useFreshWaterFlux  =',useFreshWaterFlux
                0247       WRITE(iUnit,*) 'Caml: useFluxLimit       =',useFluxLimit
                0248       WRITE(iUnit,*) 'Caml: useStressOption    =',useStressOption
                0249       WRITE(iUnit,*) 'Caml: useCheapTracer     =',useCheapTracer
                0250       WRITE(iUnit,*) 'Caml: useTimeVarBLH      =',useTimeVarBLH
                0251       WRITE(iUnit,*) 'Caml: useClouds          =',useClouds
                0252       WRITE(iUnit,*) 'Caml: useDlongwave       =',useDLongWave
cf6b9ab292 Brun*0253       WRITE(iUnit,*) 'Caml: usePrecip          =',usePrecip
cf5b5345a0 Jean*0254 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0255 
2d31068647 Jean*0256       IF ( cheapaml_taurelax .NE. UNSET_RL ) THEN
                0257         nRetired = nRetired + 1
                0258         WRITE(msgBuf,'(2A)')
                0259      &   'S/R CHEAPAML_READPARMS: "cheapaml_taurelax" no longer'
                0260         CALL PRINT_ERROR( msgBuf, myThid )
                0261         WRITE(msgBuf,'(2A)')
                0262      &   'S/R CHEAPAML_READPARMS:  allowed in file "data.cheapaml"'
                0263         CALL PRINT_ERROR( msgBuf, myThid )
                0264       ENDIF
                0265       IF ( cheapaml_taurelaxocean .NE. UNSET_RL ) THEN
                0266         nRetired = nRetired + 1
                0267         WRITE(msgBuf,'(2A)')
                0268      &   'S/R CHEAPAML_READPARMS: "cheapaml_taurelaxocean" no longer'
                0269         CALL PRINT_ERROR( msgBuf, myThid )
                0270         WRITE(msgBuf,'(2A)')
                0271      &   'S/R CHEAPAML_READPARMS:  allowed in file "data.cheapaml"'
                0272         CALL PRINT_ERROR( msgBuf, myThid )
                0273       ENDIF
                0274 
                0275       IF ( nRetired .GT. 0 ) THEN
                0276        WRITE(msgBuf,'(2A)') 'S/R CHEAPAML_READPARMS: ',
                0277      &  'Error reading file "data.cheapaml":'
                0278        CALL PRINT_ERROR( msgBuf, myThid )
                0279        WRITE(msgBuf,'(I4,A)') nRetired,
                0280      &      ' out-of-date parameters were found in the namelist(s)'
                0281        CALL PRINT_ERROR( msgBuf, myThid )
                0282 c      errCount = errCount + 1
                0283        CALL ALL_PROC_DIE( 0 )
                0284        STOP 'ABNORMAL END: S/R CHEAPAML_READPARMS'
                0285       ENDIF
                0286 
cf5b5345a0 Jean*0287       _END_MASTER(myThid)
                0288 
                0289 C--   Everyone else must wait for the parameters to be loaded
                0290       _BARRIER
                0291 
                0292       RETURN
                0293       END