/[MITgcm]/MITgcm/model/src/ini_parms.F
ViewVC logotype

Annotation of /MITgcm/model/src/ini_parms.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.205 - (hide annotations) (download)
Tue Feb 5 13:32:49 2008 UTC (16 years, 3 months ago) by mlosch
Branch: MAIN
CVS Tags: checkpoint59n
Changes since 1.204: +7 -2 lines
 add parameter rotateGrid and Euler angles EulerPhi/Theta/Psi. For
 usingSphericalGrid, this allows to define the rotated grid coordinates
 via phiMin/thetaMin/dxSpacing/dySpacing, etc., but then re-compute the
 geographical coordinates according to the inverse of the rotation defined
 by the Euler angles, so that Coriolis parameter and online-interpolation by
 exf works with the geographical coordinates on XC/YC/XG/YG.

 The three Euler angles PhiEuler, ThetaEuler, and PsiEuler
 define the rotation about the original z-axis (of an sphere
 centered cartesian grid), the new x-axis, and the new z-axis,
 respectively.
 Naturally, this feature does not work with all packages, so the
 some combinations are prohibited in config_summary (flt,
 flt_zonal, ecco, profiles), because there the coordinates are
 assumed to be regular spherical grid coordinates.

1 mlosch 1.205 C $Header: /u/gcmpack/MITgcm/model/src/ini_parms.F,v 1.204 2008/01/08 00:27:42 jmc Exp $
2 heimbach 1.58 C $Name: $
3 cnh 1.1
4 jmc 1.181 c #include "PACKAGES_CONFIG.h"
5 adcroft 1.22 #include "CPP_OPTIONS.h"
6 cnh 1.1
7 edhill 1.121 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
8 cnh 1.70 CBOP
9     C !ROUTINE: INI_PARMS
10     C !INTERFACE:
11 cnh 1.1 SUBROUTINE INI_PARMS( myThid )
12 cnh 1.70
13 edhill 1.121 C !DESCRIPTION:
14 jmc 1.181 C Routine to load model "parameters" from parameter file "data"
15    
16 cnh 1.70 C !USES:
17 adcroft 1.38 IMPLICIT NONE
18 cnh 1.1 #include "SIZE.h"
19     #include "EEPARAMS.h"
20     #include "PARAMS.h"
21 jmc 1.188 c#include "GRID.h"
22 mlosch 1.82 #include "EOS.h"
23 cnh 1.1
24 cnh 1.70 C !INPUT/OUTPUT PARAMETERS:
25 jmc 1.188 C myThid :: Number of this instance of INI_PARMS
26 cnh 1.1 INTEGER myThid
27    
28 cnh 1.70 C !LOCAL VARIABLES:
29 jmc 1.188 C dxSpacing, dySpacing :: Default spacing in X and Y.
30     C :: Units are that of coordinate system
31     C :: i.e. cartesian => metres
32     C :: s. polar => degrees
33     C deltaTtracer :: Timestep for tracer equations ( s )
34     C forcing_In_AB :: flag to put all forcings (Temp,Salt,Tracers,Momentum)
35     C :: contribution in (or out of) Adams-Bashforth time stepping.
36     C goptCount :: Used to count the nuber of grid options (only one is allowed!)
37     C msgBuf :: Informational/error meesage buffer
38     C errIO :: IO error flag
39     C iUnit :: Work variable for IO unit number
40     C record :: Work variable for IO buffer
41     C K, I, J :: Loop counters
42     C xxxDefault :: Default value for variable xxx
43 cnh 1.28 _RL dxSpacing
44     _RL dySpacing
45 jmc 1.139 _RL deltaTtracer
46 cnh 1.1 CHARACTER*(MAX_LEN_MBUF) msgBuf
47     CHARACTER*(MAX_LEN_PREC) record
48 jmc 1.180 LOGICAL forcing_In_AB
49 cnh 1.1 INTEGER goptCount
50 jmc 1.202 INTEGER K, i, j, IL, iUnit
51 cnh 1.1 INTEGER errIO
52     INTEGER IFNBLNK
53     EXTERNAL IFNBLNK
54     INTEGER ILNBLNK
55     EXTERNAL ILNBLNK
56 cnh 1.28 C Default values for variables which have vertical coordinate system
57     C dependency.
58     _RL viscArDefault
59     _RL diffKrTDefault
60     _RL diffKrSDefault
61     _RL hFacMinDrDefault
62 adcroft 1.39 _RL delRDefault(Nr)
63 adcroft 1.41 _RS rkFacDefault
64 cnh 1.75 C zCoordInputData :: Variables used to select between different coordinate systems.
65 jmc 1.188 C pCoordInputData :: The vertical coordinate system in the rest of the model is
66     C rCoordInputData :: written in terms of r. In the model "data" file input data
67     C coordsSet :: can be interms of z, p or r.
68 cnh 1.75 C :: e.g. delZ or delP or delR for the vertical grid spacing.
69     C :: The following rules apply:
70     C :: All parameters must use the same vertical coordinate system.
71     C :: e.g. delZ and viscAz is legal but
72     C :: delZ and viscAr is an error.
73 jmc 1.188 C :: Similarly specifying delZ and delP is an error.
74     C :: zCoord..., pCoord..., rCoord... are used to flag when
75     C :: z, p or r are used.
76     C :: coordsSet counts how many vertical coordinate systems have
77     C :: been used to specify variables. coordsSet > 1 is an error.
78 cnh 1.28 C
79 jmc 1.100
80 cnh 1.28 LOGICAL zCoordInputData
81     LOGICAL pCoordInputData
82     LOGICAL rCoordInputData
83     INTEGER coordsSet
84 jmc 1.131 LOGICAL diffKrSet
85 jmc 1.100
86     C Variables which have vertical coordinate system dependency.
87 jmc 1.188 C delZ :: Vertical grid spacing ( m ).
88     C delP :: Vertical grid spacing ( Pa ).
89     C viscAz :: Eddy viscosity coeff. for mixing of momentum vertically ( m^2/s )
90     C viscAp :: Eddy viscosity coeff. for mixing of momentum vertically ( Pa^2/s )
91     C diffKzT :: Laplacian diffusion coeff. for mixing of heat vertically ( m^2/s )
92     C diffKpT :: Laplacian diffusion coeff. for mixing of heat vertically ( Pa^2/s )
93     C diffKzS :: Laplacian diffusion coeff. for mixing of salt vertically ( m^2/s )
94     C diffKpS :: Laplacian diffusion coeff. for mixing of salt vertically ( Pa^2/s )
95 jmc 1.100 _RL delZ(Nr)
96     _RL delP(Nr)
97     _RL viscAz
98     _RL viscAp
99     _RL diffKzT
100     _RL diffKpT
101 jmc 1.131 _RL diffKrT
102 jmc 1.100 _RL diffKzS
103     _RL diffKpS
104 jmc 1.131 _RL diffKrS
105 cnh 1.75
106     C Retired main data file parameters. Kept here to trap use of old data files.
107 jmc 1.184 C Namelist PARM01:
108 jmc 1.136 C tracerAdvScheme :: tracer advection scheme (old passive tracer code)
109     C trac_EvPrRn :: tracer conc. in Rain & Evap (old passive tracer code)
110     C saltDiffusion :: diffusion of salinity on/off (flag not used)
111     C tempDiffusion :: diffusion of temperature on/off (flag not used)
112     C zonal_filt_lat :: Moved to package "zonal_filt"
113 jmc 1.188 C gravitySign :: direction of gravity relative to R direction
114     C :: (removed from namelist and set according to z/p coordinate)
115 jmc 1.167 C viscAstrain :: replaced by standard viscosity coeff & useStrainTensionVisc
116     C viscAtension :: replaced by standard viscosity coeff & useStrainTensionVisc
117 jmc 1.179 C useAnisotropicViscAgridMax :: Changed to be default behavior. Can
118     C use old method by setting useAreaViscLength=.true.
119 jmc 1.191 C usePickupBeforeC35 :: to restart from old-pickup files (generated with code
120     C from before checkpoint-35, Feb 08, 2001): disabled (Jan 2007)
121 jmc 1.184 C Namelist PARM03:
122 jmc 1.179 C tauThetaClimRelax3Dim :: replaced by pkg/rbcs (3.D Relaxation B.Cs)
123     C tauSaltClimRelax3Dim :: replaced by pkg/rbcs (3.D Relaxation B.Cs)
124 jmc 1.184 C calendarDumps :: moved to package "cal" (calendar)
125     C Namelist PARM04:
126     C groundAtK1 :: put the surface(k=1) at the ground (replaced by usingPCoords)
127     C rkFac :: removed from namelist ; replaced by -rkSign
128 jmc 1.179 C nRetired :: Counter used to trap gracefully namelists containing "retired"
129 cnh 1.75 C :: parameters. These are parameters that are either no-longer used
130     C or that have moved to a different input file and/or namelist.
131 jmc 1.136 LOGICAL tempDiffusion, saltDiffusion
132     INTEGER tracerAdvScheme
133     _RL trac_EvPrRn
134 jmc 1.188 _RL zonal_filt_lat, gravitySign
135 jmc 1.167 _RL viscAstrain, viscAtension
136 jmc 1.191 LOGICAL useAnisotropicViscAgridMax
137     LOGICAL usePickupBeforeC35
138 jmc 1.184 C-
139 jmc 1.179 _RL tauThetaClimRelax3Dim, tauSaltClimRelax3Dim
140 jmc 1.184 LOGICAL calendarDumps
141     C-
142     LOGICAL groundAtK1
143     _RL rkFac
144 cnh 1.75 INTEGER nRetired
145 cnh 1.1
146     C-- Continuous equation parameters
147     NAMELIST /PARM01/
148 adcroft 1.156 & gravitySign, nh_Am2,
149 jmc 1.188 & gravity, gBaro, rhonil, tAlpha, sBeta,
150 jmc 1.93 & f0, beta, omega, rotationPeriod,
151 baylor 1.149 & viscAh, viscAhW, viscAhMax,
152     & viscAhGrid, viscAhGridMax, viscAhGridMin,
153     & viscC2leith, viscC4leith,
154 jmc 1.191 & useFullLeith, useAnisotropicViscAgridMax, useStrainTensionVisc,
155 baylor 1.169 & useAreaViscLength,
156 baylor 1.166 & viscC2leithD, viscC4leithD, viscC2Smag, viscC4Smag,
157 jmc 1.134 & viscAhD, viscAhZ, viscA4D, viscA4Z,
158 mlosch 1.140 & viscA4, viscA4W,
159     & viscA4Max, viscA4Grid, viscA4GridMax, viscA4GridMin,
160 baylor 1.168 & viscA4ReMax, viscAhReMax,
161 jmc 1.167 & viscAz, cosPower, viscAstrain, viscAtension,
162 dimitri 1.135 & diffKhT, diffKzT, diffK4T,
163 adcroft 1.51 & diffKhS, diffKzS, diffK4S,
164 jmc 1.188 & tRef, sRef, tRefFile, sRefFile, rhoRefFile,
165     & eosType, integr_GeoPot, selectFindRoSurf,
166 jmc 1.98 & atm_Cp, atm_Rd, atm_Rq,
167 jmc 1.172 & no_slip_sides, sideDragFactor,
168     & no_slip_bottom, bottomDragLinear, bottomDragQuadratic,
169 cnh 1.1 & momViscosity, momAdvection, momForcing, useCoriolis,
170 jmc 1.187 & useConstantF, useBetaPlaneF, useSphereF, use3dCoriolis,
171 adcroft 1.66 & momPressureForcing, metricTerms, vectorInvariantMomentum,
172 cnh 1.1 & tempDiffusion, tempAdvection, tempForcing,
173 cnh 1.8 & saltDiffusion, saltAdvection, saltForcing,
174 jmc 1.55 & implicSurfPress, implicDiv2DFlow,
175 adcroft 1.24 & implicitFreeSurface, rigidLid, freeSurfFac, hFacMin, hFacMinDz,
176 dfer 1.190 & exactConserv, linFSConserveTr, uniformLin_PhiSurf,
177     & nonlinFreeSurf, hFacInf, hFacSup, select_rStar,
178 jmc 1.174 & implicitIntGravWave, staggerTimeStep,
179 heimbach 1.123 & tempStepping, saltStepping, momStepping,
180 adcroft 1.45 & implicitDiffusion, implicitViscosity,
181 jmc 1.104 & tempImplVertAdv, saltImplVertAdv, momImplVertAdv,
182 jmc 1.131 & viscAr, diffKrT, diffKrS, diffKrNrT, diffKrNrS, hFacMinDr,
183 cnh 1.29 & viscAp, diffKpT, diffKpS, hFacMinDp,
184 adcroft 1.112 & diffKrBL79surf, diffKrBL79deep, diffKrBL79scl, diffKrBL79Ho,
185 dimitri 1.195 & BL79LatVary,
186 dimitri 1.194 & diffKrBLEQsurf, diffKrBLEQdeep, diffKrBLEQscl, diffKrBLEQHo,
187 mlosch 1.84 & rhoConst, rhoConstFresh, buoyancyRelation, HeatCapacity_Cp,
188 adcroft 1.40 & writeBinaryPrec, readBinaryPrec, writeStatePrec,
189 dimitri 1.91 & nonHydrostatic, quasiHydrostatic, globalFiles, useSingleCpuIO,
190 jmc 1.197 & allowFreezing, useOldFreezing, ivdc_kappa, hMixCriteria,
191 jmc 1.116 & usePickupBeforeC35, usePickupBeforeC54, debugMode, debugLevel,
192 jmc 1.187 & tempAdvScheme, tempVertAdvScheme,
193 jmc 1.115 & saltAdvScheme, saltVertAdvScheme, tracerAdvScheme,
194 adcroft 1.73 & multiDimAdvection, useEnergyConservingCoriolis,
195 adcroft 1.113 & useCDscheme, useJamartWetPoints, useJamartMomAdv, useNHMTerms,
196 adcroft 1.111 & SadournyCoriolis, upwindVorticity, highOrderVorticity,
197 jmc 1.170 & useAbsVorticity, upwindShear, selectKEscheme,
198 jmc 1.76 & useRealFreshWaterFlux, convertFW2Salt,
199     & temp_EvPrRn, salt_EvPrRn, trac_EvPrRn,
200 heimbach 1.146 & zonal_filt_lat,
201 jmc 1.188 & inAdExact, smoothAbsFuncRange,
202 mlosch 1.177 & balanceEmPmR, balanceQnet, balancePrintMean
203 cnh 1.1
204     C-- Elliptic solver parameters
205     NAMELIST /PARM02/
206 jmc 1.188 & cg2dMaxIters, cg2dChkResFreq, cg2dTargetResidual,
207 jmc 1.117 & cg2dTargetResWunit, cg2dpcOffDFac, cg2dPreCondFreq,
208 cnh 1.34 & cg3dMaxIters, cg3dChkResFreq, cg3dTargetResidual
209 cnh 1.1
210     C-- Time stepping parammeters
211     NAMELIST /PARM03/
212 jmc 1.203 & nIter0, nTimeSteps, nEndIter,
213 jmc 1.204 & baseTime, startTime, endTime,
214 jmc 1.188 & deltaT, deltaTClock, deltaTmom,
215 jmc 1.165 & deltaTtracer, dTtracerLev, deltaTfreesurf,
216 jmc 1.188 & forcing_In_AB, momForcingOutAB, tracForcingOutAB,
217 jmc 1.180 & momDissip_In_AB, doAB_onGtGs,
218 jmc 1.188 & abEps, alph_AB, beta_AB, startFromPickupAB2,
219 jmc 1.204 & tauCD, rCD, cAdjFreq,
220     & chkPtFreq, pChkPtFreq, pickupSuff, pickupStrictlyMatch,
221 jmc 1.165 & dumpFreq, dumpInitAndLast, adjDumpFreq, taveFreq, tave_lastIter,
222 jmc 1.204 & diagFreq, monitorFreq, adjMonitorFreq, monitorSelect,
223 jmc 1.188 & outputTypesInclusive,
224     & tauThetaClimRelax, tauSaltClimRelax, latBandClimRelax,
225 heimbach 1.175 & tauThetaClimRelax3Dim, tauSaltClimRelax3Dim, tauTr1ClimRelax,
226 dimitri 1.147 & periodicExternalForcing, externForcingPeriod, externForcingCycle,
227 jmc 1.165 & calendarDumps
228 cnh 1.1
229     C-- Gridding parameters
230     NAMELIST /PARM04/
231 jmc 1.188 & usingCartesianGrid, usingCylindricalGrid,
232     & dxSpacing, dySpacing, delX, delY, delXFile, delYFile,
233 cnh 1.1 & usingSphericalPolarGrid, phiMin, thetaMin, rSphere,
234 jmc 1.189 & usingCurvilinearGrid, horizGridFile, deepAtmosphere,
235 jmc 1.188 & Ro_SeaLevel, delZ, delP, delR, delRc, delRFile, delRcFile,
236 mlosch 1.205 & rkFac, groundAtK1,
237     & phiEuler, thetaEuler, psiEuler
238 cnh 1.1
239 cnh 1.15 C-- Input files
240     NAMELIST /PARM05/
241 jmc 1.188 & bathyFile, topoFile, shelfIceFile,
242 dimitri 1.193 & hydrogThetaFile, hydrogSaltFile, diffKrFile,
243 adcroft 1.41 & zonalWindFile, meridWindFile,
244     & thetaClimFile, saltClimFile,
245 jmc 1.143 & surfQfile, surfQnetFile, surfQswFile, EmPmRfile, saltFluxFile,
246 heimbach 1.152 & lambdaThetaFile, lambdaSaltFile,
247 heimbach 1.57 & uVelInitFile, vVelInitFile, pSurfInitFile,
248 afe 1.144 & dQdTFile, ploadFile,tCylIn,tCylOut,
249 heimbach 1.148 & eddyTauxFile, eddyTauyFile,
250 edhill 1.119 & mdsioLocalDir,
251     & the_run_name
252 edhill 1.121 CEOP
253 cnh 1.15
254 cnh 1.1 C
255     _BEGIN_MASTER(myThid)
256    
257 adcroft 1.39 C Defaults values for input parameters
258     CALL SET_DEFAULTS(
259     O viscArDefault, diffKrTDefault, diffKrSDefault,
260 jmc 1.188 O hFacMinDrDefault, delRDefault, rkFacDefault,
261 adcroft 1.39 I myThid )
262    
263 cnh 1.28 C-- Initialise "which vertical coordinate system used" flags.
264     zCoordInputData = .FALSE.
265     pCoordInputData = .FALSE.
266     rCoordInputData = .FALSE.
267     coordsSet = 0
268    
269 jmc 1.131 C-- Initialise retired parameters to unlikely value
270 cnh 1.75 nRetired = 0
271 jmc 1.136 tempDiffusion = .TRUE.
272     saltDiffusion = .TRUE.
273     tracerAdvScheme = UNSET_I
274     trac_EvPrRn = UNSET_RL
275 cnh 1.75 zonal_filt_lat = UNSET_RL
276 jmc 1.99 gravitySign = UNSET_RL
277 jmc 1.167 viscAstrain = UNSET_RL
278     viscAtension = UNSET_RL
279 jmc 1.184 useAnisotropicViscAgridMax=.TRUE.
280 jmc 1.191 usePickupBeforeC35 = .FALSE.
281 jmc 1.179 tauThetaClimRelax3Dim = UNSET_RL
282     tauSaltClimRelax3Dim = UNSET_RL
283 jmc 1.184 calendarDumps = .FALSE.
284     rkFac = UNSET_RL
285     groundAtK1 = .FALSE.
286 cnh 1.75
287 cnh 1.1 C-- Open the parameter file
288 ce107 1.163 #ifdef TARGET_BGL
289     OPEN(UNIT=scrUnit1,FILE='scratch1',STATUS='UNKNOWN')
290     OPEN(UNIT=scrUnit2,FILE='scratch2',STATUS='UNKNOWN')
291     #else
292 cnh 1.1 OPEN(UNIT=scrUnit1,STATUS='SCRATCH')
293     OPEN(UNIT=scrUnit2,STATUS='SCRATCH')
294 ce107 1.163 #endif
295 cnh 1.34 OPEN(UNIT=modelDataUnit,FILE='data',STATUS='OLD',
296 cnh 1.35 & IOSTAT=errIO)
297     IF ( errIO .LT. 0 ) THEN
298 cnh 1.1 WRITE(msgBuf,'(A)')
299     & 'S/R INI_PARMS'
300 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
301 cnh 1.1 WRITE(msgBuf,'(A)')
302     & 'Unable to open model parameter'
303 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
304 cnh 1.1 WRITE(msgBuf,'(A)')
305     & 'file "data"'
306 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
307 cnh 1.1 CALL MODELDATA_EXAMPLE( myThid )
308     STOP 'ABNORMAL END: S/R INI_PARMS'
309 jmc 1.181 ENDIF
310 cnh 1.1
311 cnh 1.35 DO WHILE ( .TRUE. )
312     READ(modelDataUnit,FMT='(A)',END=1001) RECORD
313     IL = MAX(ILNBLNK(RECORD),1)
314 cnh 1.107 IF ( RECORD(1:1) .NE. commentCharacter ) THEN
315     CALL NML_SET_TERMINATOR( RECORD )
316     WRITE(UNIT=scrUnit1,FMT='(A)') RECORD(:IL)
317     ENDIF
318     WRITE(UNIT=scrUnit2,FMT='(A)') RECORD(:IL)
319 cnh 1.35 ENDDO
320 cnh 1.1 1001 CONTINUE
321     CLOSE(modelDataUnit)
322    
323     C-- Report contents of model parameter file
324 jmc 1.188 WRITE(msgBuf,'(A)')
325 cnh 1.1 &'// ======================================================='
326 jmc 1.188 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
327     & SQUEEZE_RIGHT, myThid )
328 cnh 1.1 WRITE(msgBuf,'(A)') '// Model parameter file "data"'
329 jmc 1.188 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
330     & SQUEEZE_RIGHT, myThid )
331     WRITE(msgBuf,'(A)')
332 cnh 1.1 &'// ======================================================='
333     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
334 jmc 1.188 & SQUEEZE_RIGHT, myThid )
335 cnh 1.1 iUnit = scrUnit2
336     REWIND(iUnit)
337 cnh 1.35 DO WHILE ( .TRUE. )
338 cnh 1.1 READ(UNIT=iUnit,FMT='(A)',END=2001) RECORD
339     IL = MAX(ILNBLNK(RECORD),1)
340     WRITE(msgBuf,'(A,A)') '>',RECORD(:IL)
341 jmc 1.188 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
342     & SQUEEZE_RIGHT, myThid )
343 cnh 1.35 ENDDO
344 cnh 1.1 2001 CONTINUE
345     CLOSE(iUnit)
346     WRITE(msgBuf,'(A)') ' '
347     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
348 jmc 1.188 & SQUEEZE_RIGHT, myThid )
349 cnh 1.1
350    
351     C-- Read settings from model parameter file "data".
352     iUnit = scrUnit1
353     REWIND(iUnit)
354    
355     C-- Set default "physical" parameters
356 mlosch 1.126 viscAhW = UNSET_RL
357 mlosch 1.140 viscA4W = UNSET_RL
358 jmc 1.134 viscAhD = UNSET_RL
359     viscAhZ = UNSET_RL
360     viscA4D = UNSET_RL
361     viscA4Z = UNSET_RL
362 jmc 1.181 viscAz = UNSET_RL
363 cnh 1.28 viscAr = UNSET_RL
364     viscAp = UNSET_RL
365     diffKzT = UNSET_RL
366     diffKpT = UNSET_RL
367     diffKrT = UNSET_RL
368     diffKzS = UNSET_RL
369     diffKpS = UNSET_RL
370     diffKrS = UNSET_RL
371 jmc 1.131 DO k=1,Nr
372     diffKrNrT(k) = UNSET_RL
373     diffKrNrS(k) = UNSET_RL
374 jmc 1.171 tRef(k) = UNSET_RL
375     sRef(k) = UNSET_RL
376 jmc 1.131 ENDDO
377 adcroft 1.39 gBaro = UNSET_RL
378     rhoConst = UNSET_RL
379 jmc 1.93 omega = UNSET_RL
380 cnh 1.28 hFacMinDr = UNSET_RL
381     hFacMinDz = UNSET_RL
382     hFacMinDp = UNSET_RL
383 jmc 1.102 rhoConstFresh = UNSET_RL
384 jmc 1.76 convertFW2Salt = UNSET_RL
385 mlosch 1.82 tAlpha = UNSET_RL
386     sBeta = UNSET_RL
387 jmc 1.115 tempVertAdvScheme = 0
388     saltVertAdvScheme = 0
389     C-- z,p,r coord input switching.
390 jmc 1.124 WRITE(msgBuf,'(A)') 'S/R INI_PARMS ; starts to read PARM01'
391     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
392 jmc 1.188 & SQUEEZE_RIGHT, myThid )
393 adcroft 1.41 READ(UNIT=iUnit,NML=PARM01) !,IOSTAT=errIO)
394 cnh 1.35 IF ( errIO .LT. 0 ) THEN
395 cnh 1.1 WRITE(msgBuf,'(A)')
396     & 'S/R INI_PARMS'
397 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
398 cnh 1.1 WRITE(msgBuf,'(A)')
399     & 'Error reading numerical model '
400 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
401 cnh 1.1 WRITE(msgBuf,'(A)')
402     & 'parameter file "data"'
403 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
404 cnh 1.1 WRITE(msgBuf,'(A)')
405     & 'Problem in namelist PARM01'
406 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
407 cnh 1.1 CALL MODELDATA_EXAMPLE( myThid )
408     STOP 'ABNORMAL END: S/R INI_PARMS'
409 jmc 1.72 ELSE
410     WRITE(msgBuf,'(A)') 'S/R INI_PARMS ; read PARM01 : OK'
411     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
412 jmc 1.188 & SQUEEZE_RIGHT, myThid )
413 cnh 1.35 ENDIF
414 jmc 1.89
415 jmc 1.198 C- set the type of vertical coordinate and type of fluid
416 jmc 1.133 C according to buoyancyRelation
417     usingPCoords = .FALSE.
418     usingZCoords = .FALSE.
419     fluidIsAir = .FALSE.
420     fluidIsWater = .FALSE.
421     IF ( buoyancyRelation.EQ.'ATMOSPHERIC' ) THEN
422     usingPCoords = .TRUE.
423     fluidIsAir = .TRUE.
424     ELSEIF ( buoyancyRelation.EQ.'OCEANICP') THEN
425     usingPCoords = .TRUE.
426     fluidIsWater = .TRUE.
427     ELSEIF ( buoyancyRelation.EQ.'OCEANIC' ) THEN
428     usingZCoords = .TRUE.
429     fluidIsWater = .TRUE.
430     ELSE
431     WRITE(msgBuf,'(2A)') 'S/R INI_PARMS:',
432     & ' Bad value of buoyancyRelation '
433 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
434 jmc 1.133 STOP 'ABNORMAL END: S/R INI_PARMS'
435     ENDIF
436    
437 jmc 1.161 IF ( .NOT.rigidLid .AND.
438     & .NOT.implicitFreeSurface ) THEN
439     C- No barotropic solver selected => use implicitFreeSurface as default
440     WRITE(msgBuf,'(A)')
441 jmc 1.162 & 'S/R INI_PARMS: No request for barotropic solver'
442 jmc 1.161 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
443 jmc 1.188 & SQUEEZE_RIGHT, myThid )
444 jmc 1.161 WRITE(msgBuf,'(A)')
445     & 'S/R INI_PARMS: => Use implicitFreeSurface as default'
446     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
447 jmc 1.188 & SQUEEZE_RIGHT, myThid )
448 jmc 1.161 implicitFreeSurface = .TRUE.
449     ENDIF
450 cnh 1.28 IF ( implicitFreeSurface ) freeSurfFac = 1.D0
451     IF ( rigidLid ) freeSurfFac = 0.D0
452 adcroft 1.39 IF ( gBaro .EQ. UNSET_RL ) gBaro=gravity
453     IF ( rhoConst .EQ. UNSET_RL ) rhoConst=rhoNil
454 jmc 1.102 IF ( rhoConstFresh .EQ. UNSET_RL ) rhoConstFresh=rhoConst
455 jmc 1.93 IF ( omega .EQ. UNSET_RL ) THEN
456 jmc 1.94 omega = 0. _d 0
457 jmc 1.188 IF ( rotationPeriod .NE. 0. _d 0 )
458 jmc 1.94 & omega = 2.D0 * PI / rotationPeriod
459     ELSEIF ( omega .EQ. 0. _d 0 ) THEN
460     rotationPeriod = 0. _d 0
461 jmc 1.93 ELSE
462     rotationPeriod = 2.D0 * PI / omega
463     ENDIF
464 jmc 1.89 IF (atm_Rd .EQ. UNSET_RL) THEN
465     atm_Rd = atm_Cp * atm_kappa
466     ELSE
467     atm_kappa = atm_Rd / atm_Cp
468     ENDIF
469 adcroft 1.88 C-- Non-hydrostatic/quasi-hydrostatic
470     IF (nonHydrostatic.AND.quasiHydrostatic) THEN
471     WRITE(msgBuf,'(A)')
472     & 'Illegal: both nonHydrostatic = quasiHydrostatic = TRUE'
473 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
474 adcroft 1.88 STOP 'ABNORMAL END: S/R INI_PARMS'
475 cnh 1.14 ENDIF
476 jmc 1.181 C-- Advection and Forcing for Temp and salt
477 jmc 1.115 IF (tempVertAdvScheme.EQ.0) tempVertAdvScheme = tempAdvScheme
478     IF (saltVertAdvScheme.EQ.0) saltVertAdvScheme = saltAdvScheme
479 mlosch 1.126 C-- horizontal viscosity for vertical moments
480     IF ( viscAhW .EQ. UNSET_RL ) viscAhW = viscAh
481 mlosch 1.140 IF ( viscA4W .EQ. UNSET_RL ) viscA4W = viscA4
482 jmc 1.134 C-- horizontal viscosity (acting on Divergence or Vorticity)
483     IF ( viscAhD .EQ. UNSET_RL ) viscAhD = viscAh
484     IF ( viscAhZ .EQ. UNSET_RL ) viscAhZ = viscAh
485     IF ( viscA4D .EQ. UNSET_RL ) viscA4D = viscA4
486     IF ( viscA4Z .EQ. UNSET_RL ) viscA4Z = viscA4
487 cnh 1.28 C-- z,p,r coord input switching.
488     IF ( viscAz .NE. UNSET_RL ) zCoordInputData = .TRUE.
489     IF ( viscAp .NE. UNSET_RL ) pCoordInputData = .TRUE.
490     IF ( viscAr .NE. UNSET_RL ) rCoordInputData = .TRUE.
491     IF ( viscAr .EQ. UNSET_RL ) viscAr = viscAz
492     IF ( viscAr .EQ. UNSET_RL ) viscAr = viscAp
493     IF ( viscAr .EQ. UNSET_RL ) viscAr = viscArDefault
494    
495     IF ( diffKzT .NE. UNSET_RL ) zCoordInputData = .TRUE.
496     IF ( diffKpT .NE. UNSET_RL ) pCoordInputData = .TRUE.
497     IF ( diffKrT .NE. UNSET_RL ) rCoordInputData = .TRUE.
498     IF ( diffKrT .EQ. UNSET_RL ) diffKrT = diffKzT
499     IF ( diffKrT .EQ. UNSET_RL ) diffKrT = diffKpT
500     IF ( diffKrT .EQ. UNSET_RL ) diffKrT = diffKrTDefault
501 jmc 1.131 diffKrSet = .TRUE.
502     DO k=1,Nr
503     IF ( diffKrNrT(k).EQ. UNSET_RL ) diffKrSet = .FALSE.
504     ENDDO
505     IF ( .NOT.diffKrSet ) THEN
506     DO k=1,Nr
507     diffKrNrT(k) = diffKrT
508     ENDDO
509     ELSEIF ( diffKrT.NE.diffKrTDefault ) THEN
510     WRITE(msgBuf,'(2A)') 'S/R INI_PARMS: Cannot set both ',
511     & 'diffKrNrT and diffKrT (or Kp,Kz) in input file data'
512 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
513 jmc 1.131 STOP 'ABNORMAL END: S/R INI_PARMS'
514     ENDIF
515 cnh 1.28
516     IF ( diffKzS .NE. UNSET_RL ) zCoordInputData = .TRUE.
517     IF ( diffKpS .NE. UNSET_RL ) pCoordInputData = .TRUE.
518     IF ( diffKrS .NE. UNSET_RL ) rCoordInputData = .TRUE.
519     IF ( diffKrS .EQ. UNSET_RL ) diffKrS = diffKzS
520     IF ( diffKrS .EQ. UNSET_RL ) diffKrS = diffKpS
521     IF ( diffKrS .EQ. UNSET_RL ) diffKrS = diffKrSDefault
522 jmc 1.131 diffKrSet = .TRUE.
523     DO k=1,Nr
524     IF ( diffKrNrS(k).EQ. UNSET_RL ) diffKrSet = .FALSE.
525     ENDDO
526     IF ( .NOT.diffKrSet ) THEN
527     DO k=1,Nr
528     diffKrNrS(k) = diffKrS
529     ENDDO
530     ELSEIF ( diffKrS.NE.diffKrSDefault ) THEN
531     WRITE(msgBuf,'(2A)') 'S/R INI_PARMS: Cannot set both ',
532     & 'diffKrNrS and diffKrS (or Kp,Kz) in input file data'
533 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
534 jmc 1.131 STOP 'ABNORMAL END: S/R INI_PARMS'
535     ENDIF
536 cnh 1.28
537 dimitri 1.195 IF (diffKrBLEQsurf .EQ. UNSET_RL) diffKrBLEQsurf = diffKrBL79surf
538     IF (diffKrBLEQdeep .EQ. UNSET_RL) diffKrBLEQdeep = diffKrBL79deep
539     IF (diffKrBLEQscl .EQ. UNSET_RL) diffKrBLEQscl = diffKrBL79scl
540     IF (diffKrBLEQHo .EQ. UNSET_RL) diffKrBLEQHo = diffKrBL79Ho
541    
542 cnh 1.28 IF ( hFacMinDz .NE. UNSET_RL ) zCoordInputData = .TRUE.
543     IF ( hFacMinDp .NE. UNSET_RL ) pCoordInputData = .TRUE.
544     IF ( hFacMinDr .NE. UNSET_RL ) rCoordInputData = .TRUE.
545 adcroft 1.50 IF ( hFacMinDr .EQ. UNSET_RL ) hFacMinDr = hFacMinDz
546     IF ( hFacMinDr .EQ. UNSET_RL ) hFacMinDr = hFacMinDp
547 cnh 1.28 IF ( hFacMinDr .EQ. UNSET_RL ) hFacMinDr = hFacMinDrDefault
548 cnh 1.8
549 jmc 1.76 IF (convertFW2Salt.EQ.UNSET_RL) THEN
550     convertFW2Salt = 35.
551     IF (useRealFreshWaterFlux) convertFW2Salt=-1
552     ENDIF
553    
554 adcroft 1.46 IF ( ivdc_kappa .NE. 0. .AND. .NOT. implicitDiffusion ) THEN
555 jmc 1.79 WRITE(msgBuf,'(A,A)')
556 adcroft 1.46 & 'S/R INI_PARMS: To use ivdc_kappa you must enable implicit',
557     & ' vertical diffusion.'
558 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
559 jmc 1.55 STOP 'ABNORMAL END: S/R INI_PARMS'
560     ENDIF
561    
562 cnh 1.28 coordsSet = 0
563     IF ( zCoordInputData ) coordsSet = coordsSet + 1
564     IF ( pCoordInputData ) coordsSet = coordsSet + 1
565     IF ( rCoordInputData ) coordsSet = coordsSet + 1
566     IF ( coordsSet .GT. 1 ) THEN
567     WRITE(msgBuf,'(A)')
568     & 'S/R INI_PARMS: Cannot mix z, p and r in the input data.'
569 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
570 cnh 1.8 STOP 'ABNORMAL END: S/R INI_PARMS'
571     ENDIF
572 cnh 1.28 IF ( rhoConst .LE. 0. ) THEN
573     WRITE(msgBuf,'(A)')
574     & 'S/R INI_PARMS: rhoConst must be greater than 0.'
575 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
576 cnh 1.28 STOP 'ABNORMAL END: S/R INI_PARMS'
577     ELSE
578     recip_rhoConst = 1.D0 / rhoConst
579 adcroft 1.38 ENDIF
580     IF ( rhoNil .LE. 0. ) THEN
581     WRITE(msgBuf,'(A)')
582     & 'S/R INI_PARMS: rhoNil must be greater than 0.'
583 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
584 adcroft 1.38 STOP 'ABNORMAL END: S/R INI_PARMS'
585     ELSE
586     recip_rhoNil = 1.D0 / rhoNil
587 cnh 1.33 ENDIF
588 adcroft 1.39 IF ( HeatCapacity_Cp .LE. 0. ) THEN
589     WRITE(msgBuf,'(A)')
590     & 'S/R INI_PARMS: HeatCapacity_Cp must be greater than 0.'
591 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
592 adcroft 1.39 STOP 'ABNORMAL END: S/R INI_PARMS'
593     ELSE
594     recip_Cp = 1.D0 / HeatCapacity_Cp
595     ENDIF
596 cnh 1.33 IF ( gravity .LE. 0. ) THEN
597     WRITE(msgBuf,'(A)')
598     & 'S/R INI_PARMS: gravity must be greater than 0.'
599 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
600 cnh 1.33 STOP 'ABNORMAL END: S/R INI_PARMS'
601     ELSE
602     recip_gravity = 1.D0 / gravity
603 cnh 1.28 ENDIF
604 adcroft 1.109 C This flags are now passed to RW and MDSIO packages in ini_model_io.F
605 adcroft 1.42 C Set globalFiles flag for READ_WRITE_FLD package
606 adcroft 1.109 c CALL SET_WRITE_GLOBAL_FLD( globalFiles )
607 adcroft 1.42 C Set globalFiles flag for READ_WRITE_REC package
608 adcroft 1.109 c CALL SET_WRITE_GLOBAL_REC( globalFiles )
609 adcroft 1.42 C Set globalFiles flag for READ_WRITE_REC package
610 adcroft 1.109 c CALL SET_WRITE_GLOBAL_PICKUP( globalFiles )
611 cnh 1.1
612 cnh 1.75 C Check for retired parameters still being used
613     nRetired = 0
614     IF ( zonal_filt_lat .NE. UNSET_RL ) THEN
615     nRetired = nRetired+1
616     WRITE(msgBuf,'(A,A)')
617     & 'S/R INI_PARMS: Paramater "zonal_filt_lat" is',
618     & ' no longer allowed in file "data".'
619 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
620 cnh 1.75 WRITE(msgBuf,'(A,A)')
621     & 'S/R INI_PARMS: Paramater "zonal_filt_lat" is',
622     & ' now read from file "data.zonfilt".'
623 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
624 cnh 1.75 ENDIF
625 jmc 1.99 IF ( gravitySign .NE. UNSET_RL ) THEN
626     nRetired = nRetired+1
627     WRITE(msgBuf,'(A,A)')
628     & 'S/R INI_PARMS: "gravitySign" is set according to vertical ',
629     & ' coordinate and is no longer allowed in file "data".'
630 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
631 jmc 1.99 ENDIF
632 jmc 1.136 IF ( tracerAdvScheme .NE. UNSET_I ) THEN
633     nRetired = nRetired+1
634     WRITE(msgBuf,'(A,A)') 'S/R INI_PARMS: "tracerAdvScheme" ',
635     & '(old passive tracer code) is no longer allowed in file "data"'
636 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
637 jmc 1.136 ENDIF
638     IF ( trac_EvPrRn .NE. UNSET_RL ) THEN
639     nRetired = nRetired+1
640     WRITE(msgBuf,'(A,A)') 'S/R INI_PARMS: "trac_EvPrRn" ',
641     & '(old passive tracer code) is no longer allowed in file "data"'
642 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
643 jmc 1.136 ENDIF
644     IF ( .NOT. tempDiffusion ) THEN
645     nRetired = nRetired+1
646     WRITE(msgBuf,'(A,A)') 'S/R INI_PARMS: "tempDiffusion" ',
647     & 'is no longer allowed in file "data"'
648 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
649 jmc 1.136 WRITE(msgBuf,'(A,A)') 'S/R INI_PARMS: to turn off diffusion',
650     & ' => set diffusivity to zero'
651 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
652 jmc 1.136 ENDIF
653     IF ( .NOT. saltDiffusion ) THEN
654     nRetired = nRetired+1
655     WRITE(msgBuf,'(A,A)') 'S/R INI_PARMS: "saltDiffusion" ',
656     & 'is no longer allowed in file "data"'
657 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
658 jmc 1.136 WRITE(msgBuf,'(A,A)') 'S/R INI_PARMS: to turn off diffusion',
659     & ' => set diffusivity to zero'
660 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
661 jmc 1.136 ENDIF
662 jmc 1.167 IF ( viscAstrain .NE. UNSET_RL ) THEN
663     nRetired = nRetired+1
664     WRITE(msgBuf,'(A,A)')
665     & 'S/R INI_PARMS: "viscAstrain" ',
666     & 'is no longer allowed in file "data"'
667 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
668 jmc 1.167 WRITE(msgBuf,'(A,A)') 'S/R INI_PARMS: to use Strain & Tension',
669     & ' formulation => set useStrainTensionVisc to TRUE'
670 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
671 jmc 1.167 ENDIF
672     IF ( viscAtension .NE. UNSET_RL ) THEN
673     nRetired = nRetired+1
674     WRITE(msgBuf,'(A,A)')
675     & 'S/R INI_PARMS: "viscAtension" ',
676     & 'is no longer allowed in file "data"'
677 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
678 jmc 1.167 WRITE(msgBuf,'(A,A)') 'S/R INI_PARMS: to use Strain & Tension',
679     & ' formulation => set useStrainTensionVisc to TRUE'
680 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
681 jmc 1.167 ENDIF
682 jmc 1.191 IF ( .NOT.useAnisotropicViscAgridMax ) THEN
683 baylor 1.169 nRetired = nRetired+1
684     WRITE(msgBuf,'(A,A)')
685     & 'S/R INI_PARMS: "useAnisotropicViscAgridMax" ',
686     & 'is not allowed in "data" substitute useAreaViscLength=true'
687 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
688 baylor 1.169 ENDIF
689 jmc 1.191 IF ( usePickupBeforeC35 ) THEN
690     nRetired = nRetired+1
691     WRITE(msgBuf,'(A,A)')
692     & 'S/R INI_PARMS: "usePickupBeforeC35" ',
693     & 'is no longer supported & not longer allowed in file "data"'
694     CALL PRINT_ERROR( msgBuf, myThid )
695     ENDIF
696 cnh 1.75
697 cnh 1.1 C-- Elliptic solver parameters
698 jmc 1.124 WRITE(msgBuf,'(A)') 'S/R INI_PARMS ; starts to read PARM02'
699     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
700 jmc 1.188 & SQUEEZE_RIGHT, myThid )
701 adcroft 1.41 READ(UNIT=iUnit,NML=PARM02) !,IOSTAT=errIO)
702 cnh 1.35 IF ( errIO .LT. 0 ) THEN
703 cnh 1.1 WRITE(msgBuf,'(A)')
704     & 'S/R INI_PARMS'
705 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
706 cnh 1.1 WRITE(msgBuf,'(A)')
707     & 'Error reading numerical model '
708 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
709 cnh 1.1 WRITE(msgBuf,'(A)')
710     & 'parameter file "data".'
711 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
712 cnh 1.1 WRITE(msgBuf,'(A)')
713     & 'Problem in namelist PARM02'
714 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
715 cnh 1.1 CALL MODELDATA_EXAMPLE( myThid )
716     STOP 'ABNORMAL END: S/R INI_PARMS'
717 jmc 1.72 ELSE
718     WRITE(msgBuf,'(A)') 'S/R INI_PARMS ; read PARM02 : OK'
719     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
720 jmc 1.188 & SQUEEZE_RIGHT, myThid )
721 jmc 1.181 ENDIF
722 cnh 1.1
723     C-- Time stepping parameters
724 cnh 1.28 rCD = -1.D0
725 jmc 1.99 latBandClimRelax = UNSET_RL
726 jmc 1.139 deltaTtracer = 0. _d 0
727 jmc 1.180 forcing_In_AB = .TRUE.
728 jmc 1.124 WRITE(msgBuf,'(A)') 'S/R INI_PARMS ; starts to read PARM03'
729     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
730 jmc 1.188 & SQUEEZE_RIGHT, myThid )
731 adcroft 1.41 READ(UNIT=iUnit,NML=PARM03) !,IOSTAT=errIO)
732 cnh 1.35 IF ( errIO .LT. 0 ) THEN
733 cnh 1.1 WRITE(msgBuf,'(A)')
734     & 'S/R INI_PARMS'
735 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
736 cnh 1.1 WRITE(msgBuf,'(A)')
737     & 'Error reading numerical model '
738 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
739 cnh 1.1 WRITE(msgBuf,'(A)')
740     & 'parameter file "data"'
741 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
742 cnh 1.1 WRITE(msgBuf,'(A)')
743     & 'Problem in namelist PARM03'
744 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
745 cnh 1.1 CALL MODELDATA_EXAMPLE( myThid )
746     STOP 'ABNORMAL END: S/R INI_PARMS'
747 jmc 1.72 ELSE
748     WRITE(msgBuf,'(A)') 'S/R INI_PARMS ; read PARM03 : OK'
749     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
750 jmc 1.188 & SQUEEZE_RIGHT, myThid )
751 jmc 1.181 ENDIF
752 jmc 1.179 C Check for retired parameters still being used
753     IF ( tauThetaClimRelax3Dim .NE. UNSET_RL ) THEN
754     nRetired = nRetired+1
755     WRITE(msgBuf,'(A,A)') 'S/R INI_PARMS: "tauThetaClimRelax3Dim" ',
756     & 'is no longer allowed in file "data"'
757 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
758 jmc 1.179 WRITE(msgBuf,'(A,A)') 'S/R INI_PARMS: 3-dim. relaxation code',
759     & ' has moved to separate pkg/rbcs.'
760 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
761 jmc 1.179 ENDIF
762     IF ( tauSaltClimRelax3Dim .NE. UNSET_RL ) THEN
763     nRetired = nRetired+1
764     WRITE(msgBuf,'(A,A)') 'S/R INI_PARMS: "tauSaltClimRelax3Dim" ',
765     & 'is no longer allowed in file "data"'
766 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
767 jmc 1.179 WRITE(msgBuf,'(A,A)') 'S/R INI_PARMS: 3-dim. relaxation code',
768     & ' has moved to separate pkg/rbcs.'
769 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
770 jmc 1.179 ENDIF
771 jmc 1.184 IF ( calendarDumps ) THEN
772     nRetired = nRetired+1
773     WRITE(msgBuf,'(A,A)') 'S/R INI_PARMS: "calendarDumps" ',
774     & 'is no longer allowed in file "data"'
775 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
776 jmc 1.184 WRITE(msgBuf,'(A,A)') 'S/R INI_PARMS: calendarDumps',
777     & ' has moved to "data.cal"'
778 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
779 jmc 1.184 ENDIF
780 jmc 1.179
781 cnh 1.4 C Process "timestepping" params
782     C o Time step size
783 jmc 1.139 IF ( deltaTtracer .NE. dTtracerLev(1) .AND.
784     & deltaTtracer .NE. 0. .AND. dTtracerLev(1) .NE. 0. ) THEN
785     WRITE(msgBuf,'(A)')
786     & 'S/R INI_PARMS: deltaTtracer & dTtracerLev(1) not equal'
787 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
788 jmc 1.139 STOP 'ABNORMAL END: S/R INI_PARMS'
789     ELSEIF ( dTtracerLev(1) .NE. 0. ) THEN
790     deltaTtracer = dTtracerLev(1)
791     ENDIF
792 jmc 1.186 IF ( deltaT .EQ. 0. ) deltaT = deltaTClock
793     IF ( deltaT .EQ. 0. ) deltaT = deltaTtracer
794 cnh 1.4 IF ( deltaT .EQ. 0. ) deltaT = deltaTmom
795 jmc 1.186 IF ( deltaT .EQ. 0. ) deltaT = deltaTfreesurf
796 cnh 1.4 IF ( deltaTmom .EQ. 0. ) deltaTmom = deltaT
797     IF ( deltaTtracer .EQ. 0. ) deltaTtracer = deltaT
798 cnh 1.7 IF ( deltaTClock .EQ. 0. ) deltaTClock = deltaT
799 jmc 1.139 DO k=1,Nr
800     IF (dTtracerLev(k).EQ.0.) dTtracerLev(k)= deltaTtracer
801     ENDDO
802 jmc 1.186 C Note that this line should set deltaFreesurf=deltaTtracer
803 adcroft 1.80 C but this would change a lot of existing set-ups so we are
804     C obliged to set the default inappropriately.
805     C Be advised that when using asynchronous time stepping
806     C it is better to set deltaTreesurf=deltaTtracer
807     IF ( deltaTfreesurf .EQ. 0. ) deltaTfreesurf = deltaTmom
808 adcroft 1.19 IF ( periodicExternalForcing ) THEN
809     IF ( externForcingCycle*externForcingPeriod .EQ. 0. ) THEN
810     WRITE(msgBuf,'(A)')
811     & 'S/R INI_PARMS: externForcingCycle,externForcingPeriod =0'
812 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
813 adcroft 1.19 STOP 'ABNORMAL END: S/R INI_PARMS'
814     ENDIF
815     IF ( INT(externForcingCycle/externForcingPeriod) .NE.
816     & externForcingCycle/externForcingPeriod ) THEN
817     WRITE(msgBuf,'(A)')
818     & 'S/R INI_PARMS: externForcingCycle <> N*externForcingPeriod'
819 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
820 adcroft 1.19 STOP 'ABNORMAL END: S/R INI_PARMS'
821     ENDIF
822 heimbach 1.137 IF ( externForcingCycle.lt.externForcingPeriod ) THEN
823 adcroft 1.19 WRITE(msgBuf,'(A)')
824     & 'S/R INI_PARMS: externForcingCycle < externForcingPeriod'
825 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
826 adcroft 1.19 STOP 'ABNORMAL END: S/R INI_PARMS'
827     ENDIF
828     IF ( externForcingPeriod.lt.deltaTclock ) THEN
829     WRITE(msgBuf,'(A)')
830     & 'S/R INI_PARMS: externForcingPeriod < deltaTclock'
831 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
832 adcroft 1.19 STOP 'ABNORMAL END: S/R INI_PARMS'
833     ENDIF
834     ENDIF
835 jmc 1.180 C o Adams-Bashforth time stepping:
836 jmc 1.188 IF ( momForcingOutAB .EQ. UNSET_I ) THEN
837 jmc 1.180 momForcingOutAB = 1
838     IF ( forcing_In_AB ) momForcingOutAB = 0
839     ENDIF
840 jmc 1.188 IF ( tracForcingOutAB .EQ. UNSET_I ) THEN
841 jmc 1.180 tracForcingOutAB = 1
842     IF ( forcing_In_AB ) tracForcingOutAB = 0
843     ENDIF
844 cnh 1.9 C o Convection frequency
845     IF ( cAdjFreq .LT. 0. ) THEN
846     cAdjFreq = deltaTClock
847     ENDIF
848 adcroft 1.46 IF ( ivdc_kappa .NE. 0. .AND. cAdjFreq .NE. 0. ) THEN
849     WRITE(msgBuf,'(A,A)')
850     & 'S/R INI_PARMS: You have enabled both ivdc_kappa and',
851     & ' convective adjustment.'
852 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
853 adcroft 1.46 STOP 'ABNORMAL END: S/R INI_PARMS'
854     ENDIF
855 jmc 1.95 IF (useCDscheme) THEN
856     C o CD coupling (CD scheme):
857     IF ( tauCD .EQ. 0.D0 ) tauCD = deltaTmom
858     IF ( rCD .LT. 0. ) rCD = 1. _d 0 - deltaTMom/tauCD
859 cnh 1.14 ENDIF
860 cnh 1.18 C o Temperature climatology relaxation time scale
861 cnh 1.28 IF ( tauThetaClimRelax .EQ. 0.D0 ) THEN
862 cnh 1.18 doThetaClimRelax = .FALSE.
863     ELSE
864     doThetaClimRelax = .TRUE.
865     ENDIF
866     C o Salinity climatology relaxation time scale
867 cnh 1.28 IF ( tauSaltClimRelax .EQ. 0.D0 ) THEN
868 cnh 1.18 doSaltClimRelax = .FALSE.
869     ELSE
870     doSaltClimRelax = .TRUE.
871 heimbach 1.64 ENDIF
872     C o Tracer 1 climatology relaxation time scale
873     IF ( tauTr1ClimRelax .EQ. 0.D0 ) THEN
874     doTr1ClimRelax = .FALSE.
875     lambdaTr1ClimRelax = 0.D0
876     ELSE
877     doTr1ClimRelax = .TRUE.
878     lambdaTr1ClimRelax = 1./tauTr1ClimRelax
879 cnh 1.18 ENDIF
880 adcroft 1.41
881 jmc 1.151 C o Base time
882     IF ( nIter0.NE.0 .AND. startTime.NE.0. .AND. baseTime.EQ.0. )
883     & baseTime = startTime - deltaTClock*float(nIter0)
884 adcroft 1.41 C o Start time
885     IF ( nIter0 .NE. 0 .AND. startTime .EQ. 0. )
886 jmc 1.151 & startTime = baseTime + deltaTClock*float(nIter0)
887 adcroft 1.41 C o nIter0
888 jmc 1.151 IF ( nIter0 .EQ. 0 .AND. startTime .NE. baseTime )
889     & nIter0 = NINT( (startTime-baseTime)/deltaTClock )
890 adcroft 1.46
891     C o nTimeSteps 1
892     IF ( nTimeSteps .EQ. 0 .AND. nEndIter .NE. 0 )
893     & nTimeSteps = nEndIter-nIter0
894     C o nTimeSteps 2
895 adcroft 1.41 IF ( nTimeSteps .EQ. 0 .AND. endTime .NE. 0. )
896 jmc 1.151 & nTimeSteps = NINT((endTime-startTime)/deltaTclock)
897 adcroft 1.46 C o nEndIter 1
898     IF ( nEndIter .EQ. 0 .AND. nTimeSteps .NE. 0 )
899     & nEndIter = nIter0+nTimeSteps
900     C o nEndIter 2
901     IF ( nEndIter .EQ. 0 .AND. endTime .NE. 0. )
902 jmc 1.151 & nEndIter = NINT((endTime-baseTime)/deltaTclock)
903 adcroft 1.46 C o End Time 1
904     IF ( endTime .EQ. 0. .AND. nTimeSteps .NE. 0 )
905     & endTime = startTime + deltaTClock*float(nTimeSteps)
906     C o End Time 2
907     IF ( endTime .EQ. 0. .AND. nEndIter .NE. 0 )
908 jmc 1.151 & endTime = baseTime + deltaTClock*float(nEndIter)
909 adcroft 1.46
910 adcroft 1.41 C o Consistent?
911 jmc 1.151 IF ( startTime .NE. baseTime+deltaTClock*float(nIter0) ) THEN
912     WRITE(msgBuf,'(A)')
913     & 'S/R INI_PARMS: startTime, baseTime and nIter0 are inconsistent'
914 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
915 jmc 1.151 WRITE(msgBuf,'(A)')
916     & 'S/R INI_PARMS: Perhaps more than two were set at once'
917 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
918 jmc 1.151 STOP 'ABNORMAL END: S/R INI_PARMS'
919     ENDIF
920 adcroft 1.46 IF ( nEndIter .NE. nIter0+nTimeSteps ) THEN
921     WRITE(msgBuf,'(A)')
922     & 'S/R INI_PARMS: nIter0, nTimeSteps and nEndIter are inconsistent'
923 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
924 adcroft 1.46 WRITE(msgBuf,'(A)')
925     & 'S/R INI_PARMS: Perhaps more than two were set at once'
926 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
927 adcroft 1.46 STOP 'ABNORMAL END: S/R INI_PARMS'
928     ENDIF
929 jmc 1.188 IF ( nTimeSteps .NE. NINT((endTime-startTime)/deltaTClock)
930     & ) THEN
931     WRITE(msgBuf,'(A)')
932     & 'S/R INI_PARMS: both endTime and nTimeSteps have been set'
933     CALL PRINT_ERROR( msgBuf, myThid )
934     WRITE(msgBuf,'(A)')
935     & 'S/R INI_PARMS: but are inconsistent'
936     CALL PRINT_ERROR( msgBuf, myThid )
937     STOP 'ABNORMAL END: S/R INI_PARMS'
938 adcroft 1.60 ENDIF
939    
940     C o Monitor (should also add CPP flag for monitor?)
941     IF (monitorFreq.LT.0.) THEN
942     monitorFreq=0.
943 adcroft 1.62 IF (dumpFreq.NE.0.) monitorFreq=dumpFreq
944 adcroft 1.67 IF (diagFreq.NE.0..AND.diagFreq.LT.monitorFreq)
945     & monitorFreq=diagFreq
946 adcroft 1.62 IF (taveFreq.NE.0..AND.taveFreq.LT.monitorFreq)
947     & monitorFreq=taveFreq
948     IF (chkPtFreq.NE.0..AND.chkPtFreq.LT.monitorFreq)
949     & monitorFreq=chkPtFreq
950     IF (pChkPtFreq.NE.0..AND.pChkPtFreq.LT.monitorFreq)
951     & monitorFreq=pChkPtFreq
952 adcroft 1.60 IF (monitorFreq.EQ.0.) monitorFreq=deltaTclock
953 cnh 1.4 ENDIF
954 jmc 1.204 IF ( monitorSelect.EQ.UNSET_I ) THEN
955     monitorSelect = 2
956     IF ( fluidIsWater ) monitorSelect = 3
957     ENDIF
958 adcroft 1.21
959 cnh 1.1 C-- Grid parameters
960     C In cartesian coords distances are in metres
961 cnh 1.26 DO K =1,Nr
962 cnh 1.28 delZ(K) = UNSET_RL
963     delP(K) = UNSET_RL
964     delR(K) = UNSET_RL
965 cnh 1.1 ENDDO
966     C In spherical polar distances are in degrees
967 adcroft 1.39 dxSpacing = UNSET_RL
968     dySpacing = UNSET_RL
969 jmc 1.124 WRITE(msgBuf,'(A)') 'S/R INI_PARMS ; starts to read PARM04'
970     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
971 jmc 1.188 & SQUEEZE_RIGHT, myThid )
972 mlosch 1.82 READ(UNIT=iUnit,NML=PARM04,IOSTAT=errIO)
973 cnh 1.35 IF ( errIO .LT. 0 ) THEN
974 cnh 1.1 WRITE(msgBuf,'(A)')
975     & 'S/R INI_PARMS'
976 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
977 cnh 1.1 WRITE(msgBuf,'(A)')
978     & 'Error reading numerical model '
979 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
980 cnh 1.1 WRITE(msgBuf,'(A)')
981     & 'parameter file "data"'
982 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
983 cnh 1.1 WRITE(msgBuf,'(A)')
984     & 'Problem in namelist PARM04'
985 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
986 cnh 1.1 CALL MODELDATA_EXAMPLE( myThid )
987     STOP 'ABNORMAL END: S/R INI_PARMS'
988 jmc 1.72 ELSE
989     WRITE(msgBuf,'(A)') 'S/R INI_PARMS ; read PARM04 : OK'
990     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
991 jmc 1.188 & SQUEEZE_RIGHT, myThid )
992 jmc 1.181 ENDIF
993 adcroft 1.48
994 jmc 1.158 C Check for retired parameters still being used
995     IF ( rkFac .NE. UNSET_RL ) THEN
996     nRetired = nRetired+1
997     WRITE(msgBuf,'(A,A)')
998     & 'S/R INI_PARMS: "rkFac" has been replaced by -rkSign ',
999     & ' and is no longer allowed in file "data".'
1000 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
1001 jmc 1.158 ENDIF
1002     IF ( groundAtK1 ) THEN
1003     c nRetired = nRetired+1
1004     WRITE(msgBuf,'(A,A)')
1005     & 'S/R INI_PARMS: "groundAtK1" is set according to vertical ',
1006     & ' coordinate and is no longer allowed in file "data".'
1007 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
1008 jmc 1.158 ENDIF
1009    
1010 jmc 1.162 C X coordinate : Check for multiple definitions
1011     goptCount = 0
1012     IF ( delX(1) .NE. UNSET_RL ) goptCount = goptCount + 1
1013     IF ( dxSpacing .NE. UNSET_RL ) goptCount = goptCount + 1
1014     IF ( delXFile .NE. ' ' ) goptCount = goptCount + 1
1015     IF ( goptCount.GT.1 ) THEN
1016 jmc 1.188 WRITE(msgBuf,'(A,A)') 'Too many specifications for delX:',
1017 adcroft 1.48 & 'Specify only one of delX, dxSpacing or delXfile'
1018 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
1019     STOP 'ABNORMAL END: S/R INI_PARMS'
1020 adcroft 1.48 ENDIF
1021 adcroft 1.39 IF ( dxSpacing .NE. UNSET_RL ) THEN
1022     DO i=1,Nx
1023     delX(i) = dxSpacing
1024     ENDDO
1025     ENDIF
1026 jmc 1.162 C Y coordinate : Check for multiple definitions
1027     goptCount = 0
1028     IF ( delY(1) .NE. UNSET_RL ) goptCount = goptCount + 1
1029     IF ( dySpacing .NE. UNSET_RL ) goptCount = goptCount + 1
1030     IF ( delYFile .NE. ' ' ) goptCount = goptCount + 1
1031     IF ( goptCount.GT.1 ) THEN
1032 jmc 1.188 WRITE(msgBuf,'(A,A)') 'Too many specifications for delY:',
1033 adcroft 1.48 & 'Specify only one of delY, dySpacing or delYfile'
1034 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
1035     STOP 'ABNORMAL END: S/R INI_PARMS'
1036 adcroft 1.48 ENDIF
1037 adcroft 1.39 IF ( dySpacing .NE. UNSET_RL ) THEN
1038 jmc 1.162 DO j=1,Ny
1039     delY(j) = dySpacing
1040 adcroft 1.39 ENDDO
1041     ENDIF
1042 adcroft 1.48 C
1043 jmc 1.188 IF ( rSphere .NE. 0. ) THEN
1044     recip_rSphere = 1. _d 0/rSphere
1045 cnh 1.14 ELSE
1046 cnh 1.26 recip_rSphere = 0.
1047 adcroft 1.11 ENDIF
1048 cnh 1.28 C-- Check for conflicting grid definitions.
1049 cnh 1.1 goptCount = 0
1050     IF ( usingCartesianGrid ) goptCount = goptCount+1
1051     IF ( usingSphericalPolarGrid ) goptCount = goptCount+1
1052 adcroft 1.59 IF ( usingCurvilinearGrid ) goptCount = goptCount+1
1053 afe 1.114 IF ( usingCylindricalGrid ) goptCount = goptCount+1
1054 adcroft 1.59 IF ( goptCount .GT. 1 ) THEN
1055 cnh 1.1 WRITE(msgBuf,'(A)')
1056     & 'S/R INI_PARMS: More than one coordinate system requested'
1057 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
1058 cnh 1.1 STOP 'ABNORMAL END: S/R INI_PARMS'
1059 cnh 1.14 ENDIF
1060 adcroft 1.59 IF ( goptCount .LT. 1 ) THEN
1061 jmc 1.103 C- No horizontal grid is specified => use Cartesian grid as default:
1062 adcroft 1.59 WRITE(msgBuf,'(A)')
1063 jmc 1.103 & 'S/R INI_PARMS: No horizontal grid requested'
1064     CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
1065 jmc 1.188 & SQUEEZE_RIGHT, myThid )
1066 jmc 1.103 WRITE(msgBuf,'(A)')
1067     & 'S/R INI_PARMS: => Use Cartesian Grid as default'
1068     CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
1069 jmc 1.188 & SQUEEZE_RIGHT, myThid )
1070 jmc 1.103 usingCartesianGrid = .TRUE.
1071 adcroft 1.59 ENDIF
1072 jmc 1.187 C-- Make metric term & Coriolis settings consistent with underlying grid.
1073 cnh 1.14 IF ( usingCartesianGrid ) THEN
1074 jmc 1.187 metricTerms = .FALSE.
1075     useNHMTerms = .FALSE.
1076 cnh 1.18 useBetaPlaneF = .TRUE.
1077 cnh 1.14 ENDIF
1078 jmc 1.187 IF ( usingCylindricalGrid ) THEN
1079     useNHMTerms = .FALSE.
1080 afe 1.114 useBetaPlaneF = .TRUE.
1081     WRITE(msgBuf,'(A)') 'S/R INI_PARMS ; Cylinder OK'
1082     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
1083 jmc 1.188 & SQUEEZE_RIGHT, myThid )
1084 afe 1.114 ENDIF
1085 adcroft 1.59 IF ( usingCurvilinearGrid ) THEN
1086 jmc 1.187 metricTerms = .FALSE.
1087 cnh 1.1 ENDIF
1088 jmc 1.187 IF ( useConstantF ) useBetaPlaneF = .FALSE.
1089     IF ( useConstantF ) useSphereF = .FALSE.
1090     IF ( useBetaPlaneF ) useSphereF = .FALSE.
1091     IF ( usingCartesianGrid .OR. usingCylindricalGrid
1092     & .OR. .NOT.(nonHydrostatic.OR.quasiHydrostatic) )
1093     & use3dCoriolis = .FALSE.
1094 jmc 1.183
1095 mlosch 1.205 C-- Grid rotation
1096     IF ( phiEuler .NE. 0. _d 0 .OR. thetaEuler .NE. 0. _d 0
1097     & .OR. psiEuler .NE. 0. _d 0 ) rotateGrid = .TRUE.
1098    
1099 jmc 1.99 C-- Set default for latitude-band where relaxation to climatology applies
1100 jmc 1.162 C note: done later (once domain size is known) if using CartesianGrid
1101 jmc 1.99 IF ( latBandClimRelax .EQ. UNSET_RL) THEN
1102     IF ( usingSphericalPolarGrid ) latBandClimRelax= 180. _d 0
1103     IF ( usingCurvilinearGrid ) latBandClimRelax= 180. _d 0
1104     ENDIF
1105 jmc 1.78 C-- set cell Center depth and put Interface at the middle between 2 C
1106     setCenterDr = .FALSE.
1107     DO K=1,Nr+1
1108 jmc 1.188 IF ( delRc(K).EQ.UNSET_RL ) THEN
1109     IF ( setCenterDr ) THEN
1110     WRITE(msgBuf,'(A,I4)')
1111     & 'S/R INI_PARMS: No value for delRc at K =', K
1112     CALL PRINT_ERROR( msgBuf, myThid )
1113     STOP 'ABNORMAL END: S/R INI_PARMS'
1114     ENDIF
1115     ELSE
1116     IF ( k.EQ.1 ) setCenterDr = .TRUE.
1117     IF ( .NOT.setCenterDr ) THEN
1118     WRITE(msgBuf,'(A,I4)')
1119     & 'S/R INI_PARMS: No value for delRc at K <', K
1120     CALL PRINT_ERROR( msgBuf, myThid )
1121     STOP 'ABNORMAL END: S/R INI_PARMS'
1122     ENDIF
1123     ENDIF
1124 jmc 1.78 ENDDO
1125 jmc 1.188 IF ( setCenterDr ) rCoordInputData = .TRUE.
1126 cnh 1.28 C-- p, z, r coord parameters
1127 jmc 1.188 setInterFDr = .FALSE.
1128 cnh 1.28 DO K = 1, Nr
1129     IF ( delZ(K) .NE. UNSET_RL ) zCoordInputData = .TRUE.
1130     IF ( delP(K) .NE. UNSET_RL ) pCoordInputData = .TRUE.
1131     IF ( delR(K) .NE. UNSET_RL ) rCoordInputData = .TRUE.
1132     IF ( delR(K) .EQ. UNSET_RL ) delR(K) = delZ(K)
1133     IF ( delR(K) .EQ. UNSET_RL ) delR(K) = delP(K)
1134 jmc 1.188 IF ( delR(K) .EQ. UNSET_RL ) THEN
1135     IF ( setInterFDr ) THEN
1136 adcroft 1.41 WRITE(msgBuf,'(A,I4)')
1137 jmc 1.188 & 'S/R INI_PARMS: No value for delZ/delP/delR at K =', K
1138     CALL PRINT_ERROR( msgBuf, myThid )
1139 jmc 1.78 STOP 'ABNORMAL END: S/R INI_PARMS'
1140 jmc 1.188 ENDIF
1141     ELSE
1142     IF ( k.EQ.1 ) setInterFDr = .TRUE.
1143     IF ( .NOT.setInterFDr ) THEN
1144     WRITE(msgBuf,'(A,I4)')
1145     & 'S/R INI_PARMS: No value for delZ/delP/delR at K <', K
1146     CALL PRINT_ERROR( msgBuf, myThid )
1147 adcroft 1.41 STOP 'ABNORMAL END: S/R INI_PARMS'
1148 jmc 1.188 ENDIF
1149 adcroft 1.41 ENDIF
1150 cnh 1.28 ENDDO
1151     C Check for multiple coordinate systems
1152 jmc 1.188 coordsSet = 0
1153 cnh 1.28 IF ( zCoordInputData ) coordsSet = coordsSet + 1
1154     IF ( pCoordInputData ) coordsSet = coordsSet + 1
1155     IF ( rCoordInputData ) coordsSet = coordsSet + 1
1156     IF ( coordsSet .GT. 1 ) THEN
1157     WRITE(msgBuf,'(A)')
1158     & 'S/R INI_PARMS: Cannot mix z, p and r in the input data.'
1159 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
1160 cnh 1.28 STOP 'ABNORMAL END: S/R INI_PARMS'
1161     ENDIF
1162 jmc 1.188 C- Check for double definition (file & namelist)
1163     IF ( delRcFile.NE.' ' ) THEN
1164     IF ( setCenterDr ) THEN
1165     WRITE(msgBuf,'(A)')
1166     & 'S/R INI_PARMS: Cannot set both delRc and delRcFile'
1167     CALL PRINT_ERROR( msgBuf, myThid )
1168     STOP 'ABNORMAL END: S/R INI_PARMS'
1169     ENDIF
1170     setCenterDr = .TRUE.
1171     ENDIF
1172     IF ( delRFile.NE.' ' ) THEN
1173     IF ( setInterFDr ) THEN
1174     WRITE(msgBuf,'(A)')
1175     & 'S/R INI_PARMS: Cannot set both delR and delRFile'
1176     CALL PRINT_ERROR( msgBuf, myThid )
1177     STOP 'ABNORMAL END: S/R INI_PARMS'
1178     ENDIF
1179     setInterFDr = .TRUE.
1180     ENDIF
1181     c IF ( setInterFDr .AND. setCenterDr ) THEN
1182     c WRITE(msgBuf,'(2A)') 'S/R INI_PARMS:',
1183     c & ' Cannot specify both delRc and delZ/delP/delR'
1184     c CALL PRINT_ERROR( msgBuf, myThid )
1185     c STOP 'ABNORMAL END: S/R INI_PARMS'
1186     c ENDIF
1187 jmc 1.92
1188 cnh 1.15 C-- Input files
1189 jmc 1.124 WRITE(msgBuf,'(A)') 'S/R INI_PARMS ; starts to read PARM05'
1190     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
1191 jmc 1.188 & SQUEEZE_RIGHT, myThid )
1192 adcroft 1.41 READ(UNIT=iUnit,NML=PARM05) !,IOSTAT=errIO)
1193 jmc 1.181 IF ( errIO .LT. 0 ) THEN
1194 cnh 1.15 WRITE(msgBuf,'(A)')
1195     & 'Error reading numerical model '
1196 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
1197 cnh 1.15 WRITE(msgBuf,'(A)')
1198     & 'parameter file "data"'
1199 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
1200 cnh 1.15 WRITE(msgBuf,'(A)')
1201     & 'Problem in namelist PARM05'
1202 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
1203 cnh 1.15 CALL MODELDATA_EXAMPLE( myThid )
1204     STOP 'ABNORMAL END: S/R INI_PARMS'
1205 jmc 1.72 ELSE
1206     WRITE(msgBuf,'(A)') 'S/R INI_PARMS ; read PARM05 : OK'
1207     CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
1208 jmc 1.188 & SQUEEZE_RIGHT, myThid )
1209 jmc 1.181 ENDIF
1210 cnh 1.25
1211 jmc 1.198 C-- Set Units conversion factor required to incorporate
1212     C surface forcing into z-p isomorphic equations:
1213     C mass2rUnit: from mass per unit area [kg/m2] to r-coordinate (z:=1/rho;p:=g)
1214     C rUnit2mass: from r-coordinate to mass per unit area [kg/m2] (z:=rho;p:=1/g)
1215 jmc 1.133 IF ( usingPCoords ) THEN
1216 jmc 1.198 mass2rUnit = gravity
1217     rUnit2mass = recip_gravity
1218     ELSE
1219     mass2rUnit = recip_rhoConst
1220     rUnit2mass = rhoConst
1221 jmc 1.85 ENDIF
1222 adcroft 1.37
1223 heimbach 1.97 c-- gradually replacing debugMode by debugLevel
1224 jmc 1.142 IF ( debugMode ) debugLevel = debLevB
1225 dimitri 1.201 IF ( debugLevel .GE. debLevB ) debugMode = .TRUE.
1226 jmc 1.142
1227 heimbach 1.146 c-- flag for approximate adjoint
1228     IF ( inAdExact ) THEN
1229     inAdTrue = .FALSE.
1230     inAdFALSE = .FALSE.
1231     ELSE
1232     inAdTrue = .TRUE.
1233     inAdFALSE = .FALSE.
1234     ENDIF
1235     C
1236 cnh 1.25 CLOSE(iUnit)
1237 cnh 1.75
1238     C-- Check whether any retired parameters were found.
1239     C-- Stop if they were
1240 jmc 1.179 IF ( nRetired .GT. 0 ) THEN
1241 cnh 1.75 WRITE(msgBuf,'(A)')
1242 jmc 1.167 & 'Error reading parameter file "data"'
1243 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
1244 cnh 1.75 WRITE(msgBuf,'(A)')
1245     & 'some out of date parameters were found in the namelist'
1246 jmc 1.188 CALL PRINT_ERROR( msgBuf, myThid )
1247 cnh 1.75 STOP 'ABNORMAL END: S/R INI_PARMS'
1248     ENDIF
1249 cnh 1.1
1250     _END_MASTER(myThid)
1251    
1252     C-- Everyone else must wait for the parameters to be loaded
1253     _BARRIER
1254     C
1255     RETURN
1256     END

  ViewVC Help
Powered by ViewVC 1.1.22