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