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

Contents of /MITgcm/model/src/config_check.F

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


Revision 1.22 - (show annotations) (download)
Fri Apr 15 14:02:08 2005 UTC (19 years, 1 month ago) by jmc
Branch: MAIN
CVS Tags: checkpoint57g_post
Changes since 1.21: +13 -1 lines
add parameters for AB-3 ; remove readPickupWithTracer & writePickupWithTracer

1 C $Header: /u/gcmpack/MITgcm/model/src/config_check.F,v 1.21 2005/04/06 18:29:52 jmc Exp $
2 C $Name: $
3
4 #include "PACKAGES_CONFIG.h"
5 #include "CPP_OPTIONS.h"
6
7 CBOP
8 C !ROUTINE: CONFIG_CHECK
9 C !INTERFACE:
10 SUBROUTINE CONFIG_CHECK( myThid )
11 C !DESCRIPTION: \bv
12 C *=========================================================*
13 C | SUBROUTINE CONFIG_CHECK
14 C | o Check model parameter settings.
15 C *=========================================================*
16 C | This routine help to prevent the use of parameters
17 C | that are not compatible with the model configuration.
18 C *=========================================================*
19 C \ev
20
21 C !USES:
22 IMPLICIT NONE
23 C === Global variables ===
24 #include "SIZE.h"
25 #include "EEPARAMS.h"
26 #include "PARAMS.h"
27 c #include "GRID.h"
28
29 C !INPUT/OUTPUT PARAMETERS:
30 C === Routine arguments ===
31 C myThid - Number of this instances of CONFIG_CHECK
32 INTEGER myThid
33 CEndOfInterface
34
35 C !LOCAL VARIABLES:
36 C == Local variables ==
37 C msgBuf :: Informational/error meesage buffer
38 CHARACTER*(MAX_LEN_MBUF) msgBuf
39 CEOP
40
41 C- check that CPP option is "defined" when running-flag parameter is on:
42
43 #ifndef ALLOW_MNC
44 IF (useMNC) THEN
45 WRITE(msgBuf,'(2A)') '**WARNNING** ',
46 & 'CONFIG_CHECK: useMNC is TRUE and #undef ALLOW_MNC'
47 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
48 & SQUEEZE_RIGHT , myThid)
49 ENDIF
50 #endif
51
52 #ifndef ALLOW_CD_CODE
53 IF (useCDscheme) THEN
54 WRITE(msgBuf,'(A)')
55 & 'CONFIG_CHECK: useCDscheme is TRUE and #undef ALLOW_CD_CODE'
56 CALL PRINT_ERROR( msgBuf , myThid)
57 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
58 ENDIF
59 IF (tauCD.NE.0.) THEN
60 WRITE(msgBuf,'(A)')
61 & 'CONFIG_CHECK: tauCD has been set but the cd_code package is',
62 & ' enabled'
63 CALL PRINT_ERROR( msgBuf , myThid)
64 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
65 ENDIF
66 #endif
67
68 #ifndef ALLOW_NONHYDROSTATIC
69 IF (nonHydrostatic) THEN
70 WRITE(msgBuf,'(A)')
71 & 'CONFIG_CHECK: #undef ALLOW_NONHYDROSTATIC and'
72 CALL PRINT_ERROR( msgBuf , myThid)
73 WRITE(msgBuf,'(A)')
74 & 'CONFIG_CHECK: nonHydrostatic is TRUE'
75 CALL PRINT_ERROR( msgBuf , myThid)
76 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
77 ENDIF
78 #endif
79
80 #ifndef ALLOW_ADAMSBASHFORTH_3
81 IF ( alph_AB.NE.UNSET_RL .OR. beta_AB.NE.UNSET_RL ) THEN
82 WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: ',
83 & '#undef ALLOW_ADAMSBASHFORTH_3 but alph_AB,beta_AB'
84 CALL PRINT_ERROR( msgBuf , myThid)
85 WRITE(msgBuf,'(A,1P2E20.7)')
86 & 'CONFIG_CHECK: are set to:',alph_AB,beta_AB
87 CALL PRINT_ERROR( msgBuf , myThid)
88 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
89 ENDIF
90 #endif
91
92 #ifndef INCLUDE_IMPLVERTADV_CODE
93 IF ( momImplVertAdv ) THEN
94 WRITE(msgBuf,'(A)')
95 & 'CONFIG_CHECK: #undef INCLUDE_IMPLVERTADV_CODE'
96 CALL PRINT_ERROR( msgBuf , myThid)
97 WRITE(msgBuf,'(A)')
98 & 'CONFIG_CHECK: but momImplVertAdv is TRUE'
99 CALL PRINT_ERROR( msgBuf , myThid)
100 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
101 ENDIF
102 IF ( tempImplVertAdv ) THEN
103 WRITE(msgBuf,'(A)')
104 & 'CONFIG_CHECK: #undef INCLUDE_IMPLVERTADV_CODE'
105 CALL PRINT_ERROR( msgBuf , myThid)
106 WRITE(msgBuf,'(A)')
107 & 'CONFIG_CHECK: but tempImplVertAdv is TRUE'
108 CALL PRINT_ERROR( msgBuf , myThid)
109 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
110 ENDIF
111 IF ( saltImplVertAdv ) THEN
112 WRITE(msgBuf,'(A)')
113 & 'CONFIG_CHECK: #undef INCLUDE_IMPLVERTADV_CODE'
114 CALL PRINT_ERROR( msgBuf , myThid)
115 WRITE(msgBuf,'(A)')
116 & 'CONFIG_CHECK: but saltImplVertAdv is TRUE'
117 CALL PRINT_ERROR( msgBuf , myThid)
118 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
119 ENDIF
120 IF ( dTtracerLev(1).NE.dTtracerLev(Nr) .AND. implicitDiffusion
121 & .AND. ( saltStepping .OR. tempStepping .OR. usePTRACERS )
122 & ) THEN
123 WRITE(msgBuf,'(A)')
124 & 'CONFIG_CHECK: #undef INCLUDE_IMPLVERTADV_CODE'
125 CALL PRINT_ERROR( msgBuf , myThid)
126 WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: ',
127 & 'but implicitDiffusion=T with non-uniform dTtracerLev'
128 CALL PRINT_ERROR( msgBuf , myThid)
129 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
130 ENDIF
131 #endif
132
133 #ifndef EXACT_CONSERV
134 IF (exactConserv) THEN
135 WRITE(msgBuf,'(A)')
136 & 'CONFIG_CHECK: #undef EXACT_CONSERV and'
137 CALL PRINT_ERROR( msgBuf , myThid)
138 WRITE(msgBuf,'(A)')
139 & 'CONFIG_CHECK: exactConserv is TRUE'
140 CALL PRINT_ERROR( msgBuf , myThid)
141 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
142 ENDIF
143 #endif
144
145 #ifndef NONLIN_FRSURF
146 IF (nonlinFreeSurf.NE.0) THEN
147 WRITE(msgBuf,'(A)')
148 & 'CONFIG_CHECK: #undef NONLIN_FRSURF and'
149 CALL PRINT_ERROR( msgBuf , myThid)
150 WRITE(msgBuf,'(A)')
151 & 'CONFIG_CHECK: nonlinFreeSurf is non-zero'
152 CALL PRINT_ERROR( msgBuf , myThid)
153 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
154 ENDIF
155 #endif
156
157 #ifndef NONLIN_FRSURF
158 IF (select_rStar .NE. 0) THEN
159 WRITE(msgBuf,'(A)')
160 & 'CONFIG_CHECK: rStar is part of NonLin-FS '
161 CALL PRINT_ERROR( msgBuf, myThid)
162 WRITE(msgBuf,'(A)')
163 & 'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to use it'
164 CALL PRINT_ERROR( msgBuf, myThid)
165 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
166 ENDIF
167 #endif /* NONLIN_FRSURF */
168
169 #ifdef USE_NATURAL_BCS
170 WRITE(msgBuf,'(A)')
171 & 'CONFIG_CHECK: USE_NATURAL_BCS option has been replaced'
172 CALL PRINT_ERROR( msgBuf , myThid)
173 WRITE(msgBuf,'(A)')
174 & 'CONFIG_CHECK: by useRealFreshWaterFlux=TRUE in data file'
175 CALL PRINT_ERROR( msgBuf , myThid)
176 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
177 #endif
178
179 C o If pLoadFile is set, then we should make sure the corresponing
180 C code is being compiled
181 #ifndef ATMOSPHERIC_LOADING
182 IF (pLoadFile.NE.' ') THEN
183 WRITE(msgBuf,'(A)')
184 & 'CONFIG_CHECK: pLoadFile is set but you have not'
185 CALL PRINT_ERROR( msgBuf , myThid)
186 WRITE(msgBuf,'(A)')
187 & 'compiled the model with the pressure loading code.'
188 CALL PRINT_ERROR( msgBuf , myThid)
189 WRITE(msgBuf,'(A)')
190 & 'Re-compile with: #define ATMOSPHERIC_LOADING'
191 CALL PRINT_ERROR( msgBuf , myThid)
192 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
193 ENDIF
194 IF ( useRealFreshWaterFlux .AND. useThSIce ) THEN
195 WRITE(msgBuf,'(A)')
196 & 'CONFIG_CHECK: sIceLoad is computed but'
197 CALL PRINT_ERROR( msgBuf , myThid)
198 WRITE(msgBuf,'(A)')
199 & 'pressure loading code is not compiled.'
200 CALL PRINT_ERROR( msgBuf , myThid)
201 WRITE(msgBuf,'(A)')
202 & 'Re-compile with: #define ATMOSPHERIC_LOADING'
203 CALL PRINT_ERROR( msgBuf , myThid)
204 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
205 ENDIF
206 #endif
207
208 #ifndef ALLOW_GENERIC_ADVDIFF
209 IF ( tempStepping .OR. saltStepping ) THEN
210 WRITE(msgBuf,'(2A)')
211 & 'CONFIG_CHECK: cannot step forward Temp or Salt',
212 & ' without pkg/generic_advdiff'
213 CALL PRINT_ERROR( msgBuf , 1)
214 WRITE(msgBuf,'(A)')
215 & 'Re-compile with pkg "generic_advdiff" in packages.conf'
216 CALL PRINT_ERROR( msgBuf , 1)
217 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
218 ENDIF
219 #endif
220
221 C o If taveFreq is finite, then we must make sure the diagnostics
222 C code is being compiled
223 #ifndef ALLOW_TIMEAVE
224 IF (taveFreq.NE.0.) THEN
225 WRITE(msgBuf,'(A)')
226 & 'CONFIG_CHECK: taveFreq <> 0 but pkg/timeave is not compiled'
227 CALL PRINT_ERROR( msgBuf , 1)
228 WRITE(msgBuf,'(A)')
229 & 'Re-compile with pkg "timeave" in packages.conf'
230 CALL PRINT_ERROR( msgBuf , 1)
231 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
232 ENDIF
233 #endif
234
235 C o If calendarDumps is set, pkg/cal is required
236 #ifndef ALLOW_CAL
237 IF (calendarDumps) THEN
238 WRITE(msgBuf,'(A)')
239 & 'CONFIG_CHECK: calendarDumps is set but pkg/cal is not compiled'
240 CALL PRINT_ERROR( msgBuf , 1)
241 WRITE(msgBuf,'(A)')
242 & 'Re-compile with pkg "cal" in packages.conf'
243 CALL PRINT_ERROR( msgBuf , 1)
244 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
245 ENDIF
246 #endif
247
248 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
249
250 C- check parameter consistency :
251
252 IF ( ( Olx.LT.3 .OR. Oly.LT.3 ) .AND.
253 & ( viscC4leith.NE.0. .OR. viscA4Grid.NE.0.
254 & .OR. viscA4D.NE.0. .OR. viscA4Z.NE.0. ) ) THEN
255 WRITE(msgBuf,'(A,A)')
256 & 'CONFIG_CHECK: cannot use Biharmonic Visc. (viscA4) with',
257 & ' overlap (Olx,Oly) smaller than 3'
258 CALL PRINT_ERROR( msgBuf , myThid)
259 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
260 ENDIF
261
262 IF ( rigidLid .AND. implicitFreeSurface ) THEN
263 WRITE(msgBuf,'(A,A)')
264 & 'CONFIG_CHECK: Cannot select both implicitFreeSurface',
265 & ' and rigidLid.'
266 CALL PRINT_ERROR( msgBuf , myThid)
267 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
268 ENDIF
269
270 IF (rigidLid .AND. exactConserv) THEN
271 WRITE(msgBuf,'(A)')
272 & 'CONFIG_CHECK: exactConserv not compatible with'
273 CALL PRINT_ERROR( msgBuf , myThid)
274 WRITE(msgBuf,'(A)')
275 & 'CONFIG_CHECK: rigidLid (meaningless in that case)'
276 CALL PRINT_ERROR( msgBuf , myThid)
277 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
278 ENDIF
279
280 IF (rigidLid .AND. useRealFreshWaterFlux) THEN
281 WRITE(msgBuf,'(A)')
282 & 'CONFIG_CHECK: useRealFreshWaterFlux not compatible with'
283 CALL PRINT_ERROR( msgBuf , myThid)
284 WRITE(msgBuf,'(A)')
285 & 'CONFIG_CHECK: rigidLid (meaningless in that case)'
286 CALL PRINT_ERROR( msgBuf , myThid)
287 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
288 ENDIF
289
290 IF ( (implicSurfPress.NE.1. .OR. implicDiv2DFlow.NE.1.)
291 & .AND. nonHydrostatic ) THEN
292 WRITE(msgBuf,'(A,A)') 'CONFIG_CHECK: nonHydrostatic',
293 & ' NOT SAFE with non-fully implicit Barotropic solver'
294 CALL PRINT_ERROR( msgBuf , myThid)
295 WRITE(msgBuf,'(A,A)') 'CONFIG_CHECK: To by-pass this',
296 & 'STOP, comment this test and re-compile config_check'
297 CALL PRINT_ERROR( msgBuf , myThid)
298 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
299 ENDIF
300
301 IF (nonlinFreeSurf.NE.0 .AND. .NOT.exactConserv) THEN
302 WRITE(msgBuf,'(A)')
303 & 'CONFIG_CHECK: nonlinFreeSurf cannot be used'
304 CALL PRINT_ERROR( msgBuf , myThid)
305 WRITE(msgBuf,'(A)')
306 & 'CONFIG_CHECK: without exactConserv'
307 CALL PRINT_ERROR( msgBuf , myThid)
308 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
309 ENDIF
310
311 IF (select_rStar.NE.0 .AND. .NOT.exactConserv) THEN
312 WRITE(msgBuf,'(A)')
313 & 'CONFIG_CHECK: r* Coordinate cannot be used'
314 CALL PRINT_ERROR( msgBuf , myThid)
315 WRITE(msgBuf,'(A)')
316 & 'CONFIG_CHECK: without exactConserv'
317 CALL PRINT_ERROR( msgBuf , myThid)
318 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
319 ENDIF
320
321 C- note : not implemented in checkpoint48b but it's done now (since 01-28-03)
322 c IF (select_rStar.GT.0 .AND. useOBCS ) THEN
323 c WRITE(msgBuf,'(A)')
324 c & 'CONFIG_CHECK: r* Coordinate not yet implemented'
325 c CALL PRINT_ERROR( msgBuf , 1)
326 c WRITE(msgBuf,'(A)')
327 c & 'CONFIG_CHECK: in OBC package'
328 c CALL PRINT_ERROR( msgBuf , 1)
329 c STOP 'ABNORMAL END: S/R CONFIG_CHECK'
330 c ENDIF
331
332 IF (nonlinFreeSurf.NE.0 .AND. nonHydrostatic) THEN
333 WRITE(msgBuf,'(A)')
334 & 'CONFIG_CHECK: nonlinFreeSurf not yet implemented'
335 CALL PRINT_ERROR( msgBuf , myThid)
336 WRITE(msgBuf,'(A)')
337 & 'CONFIG_CHECK: in nonHydrostatic code'
338 CALL PRINT_ERROR( msgBuf , myThid)
339 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
340 ENDIF
341
342 IF ( nonlinFreeSurf.NE.0 .AND.
343 & deltaTfreesurf.NE.dTtracerLev(1) ) THEN
344 WRITE(msgBuf,'(A)')
345 & 'CONFIG_CHECK: WARNING: nonlinFreeSurf might cause problems'
346 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
347 & SQUEEZE_RIGHT , myThid)
348 WRITE(msgBuf,'(A)')
349 & 'CONFIG_CHECK: with different FreeSurf & Tracer time-steps'
350 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
351 & SQUEEZE_RIGHT , myThid)
352 ENDIF
353
354 IF ( useRealFreshWaterFlux .AND. exactConserv
355 & .AND. implicDiv2DFlow.EQ.0. _d 0
356 & .AND. startTime.NE.baseTime .AND. usePickupBeforeC54 ) THEN
357 WRITE(msgBuf,'(A)')
358 & 'CONFIG_CHECK: RealFreshWaterFlux+implicSurfP=0+exactConserv:'
359 CALL PRINT_ERROR( msgBuf , myThid)
360 WRITE(msgBuf,'(A)')
361 & 'CONFIG_CHECK: restart not implemented in this config'
362 CALL PRINT_ERROR( msgBuf , myThid)
363 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
364 ENDIF
365
366 IF ( useRealFreshWaterFlux .AND. .NOT.exactConserv
367 & .AND. implicDiv2DFlow.NE.1. ) THEN
368 WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: **WARNNING** ',
369 & 'RealFreshWater & implicDiv2DFlow < 1'
370 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
371 & SQUEEZE_RIGHT , myThid)
372 WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: works better',
373 & ' with exactConserv=.T. (+ #define EXACT_CONSERV)'
374 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
375 & SQUEEZE_RIGHT , myThid)
376 ENDIF
377
378 #ifdef EXACT_CONSERV
379 IF (useRealFreshWaterFlux .AND. .NOT.exactConserv
380 & .AND. buoyancyRelation.EQ.'OCEANICP' ) THEN
381 WRITE(msgBuf,'(A)')
382 & 'CONFIG_CHECK: RealFreshWaterFlux with OCEANICP'
383 CALL PRINT_ERROR( msgBuf , myThid)
384 WRITE(msgBuf,'(A)')
385 & 'CONFIG_CHECK: requires exactConserv=T'
386 CALL PRINT_ERROR( msgBuf , myThid)
387 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
388 ENDIF
389 #else
390 IF (useRealFreshWaterFlux
391 & .AND. buoyancyRelation.EQ.'OCEANICP' ) THEN
392 WRITE(msgBuf,'(A)')
393 & 'CONFIG_CHECK: E-P effects on wVel are not included'
394 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
395 & SQUEEZE_RIGHT , myThid)
396 WRITE(msgBuf,'(A)')
397 & 'CONFIG_CHECK: ==> use #define EXACT_CONSERV to fix it'
398 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
399 & SQUEEZE_RIGHT , myThid)
400 ENDIF
401 #endif /* EXACT_CONSERV */
402
403 IF (.NOT.useCDscheme .AND. (tauCD.NE.0. .OR. rCD.NE.-1.) ) THEN
404 C- jmc: since useCDscheme is a new [04-13-03] flag (default=F),
405 C put this WARNING to stress that even if CD-scheme parameters
406 C (tauCD,rCD) are set, CD-scheme is not used without useCDscheme=T
407 C- and STOP if using mom_fluxform (following Chris advise).
408 C- jmc: but ultimately, this block can/will be removed.
409 IF (.NOT.vectorInvariantMomentum.AND.momStepping) THEN
410 WRITE(msgBuf,'(A)')
411 & 'CONFIG_CHECK: CD-scheme is OFF but params(tauCD,rCD) are set'
412 CALL PRINT_ERROR( msgBuf , myThid)
413 WRITE(msgBuf,'(2A)')
414 & 'CONFIG_CHECK: to turn ON CD-scheme: => "useCDscheme=.TRUE."',
415 & ' in "data", namelist PARM01'
416 CALL PRINT_ERROR( msgBuf , myThid)
417 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
418 ENDIF
419 WRITE(msgBuf,'(2A)') '**WARNNING** ',
420 & 'CONFIG_CHECK: CD-scheme is OFF but params(tauCD,rCD) are set'
421 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
422 & SQUEEZE_RIGHT , myThid)
423 WRITE(msgBuf,'(2A)')
424 & 'CONFIG_CHECK: to turn ON CD-scheme: => "useCDscheme=.TRUE."',
425 & ' in "data", namelist PARM01'
426 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
427 & SQUEEZE_RIGHT , myThid)
428 ENDIF
429
430 IF ( useCDscheme .AND. useCubedSphereExchange ) THEN
431 WRITE(msgBuf,'(2A)')
432 & 'CONFIG_CHECK: CD-scheme not implemented on CubedSphere grid'
433 CALL PRINT_ERROR( msgBuf , myThid)
434 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
435 ENDIF
436
437 IF ( useOldFreezing .AND. allowFreezing ) THEN
438 WRITE(msgBuf,'(2A)')
439 & 'CONFIG_CHECK: cannot set both: allowFreezing & useOldFreezing'
440 CALL PRINT_ERROR( msgBuf , myThid)
441 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
442 ENDIF
443
444 WRITE(msgBuf,'(A)') 'CONFIG_CHECK: OK'
445 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,
446 & SQUEEZE_RIGHT,myThid)
447
448 RETURN
449 END

  ViewVC Help
Powered by ViewVC 1.1.22