/[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.18 - (show annotations) (download)
Sat Dec 4 00:12:14 2004 UTC (19 years, 6 months ago) by jmc
Branch: MAIN
Changes since 1.17: +16 -2 lines
depth convergence accelerator: replace deltaTtracer by dTtracerLev(k)

1 C $Header: /u/gcmpack/MITgcm/model/src/config_check.F,v 1.17 2004/11/02 01:02:25 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 INCLUDE_IMPLVERTADV_CODE
81 IF ( momImplVertAdv ) THEN
82 WRITE(msgBuf,'(A)')
83 & 'CONFIG_CHECK: #undef INCLUDE_IMPLVERTADV_CODE'
84 CALL PRINT_ERROR( msgBuf , myThid)
85 WRITE(msgBuf,'(A)')
86 & 'CONFIG_CHECK: but momImplVertAdv is TRUE'
87 CALL PRINT_ERROR( msgBuf , myThid)
88 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
89 ENDIF
90 IF ( tempImplVertAdv ) THEN
91 WRITE(msgBuf,'(A)')
92 & 'CONFIG_CHECK: #undef INCLUDE_IMPLVERTADV_CODE'
93 CALL PRINT_ERROR( msgBuf , myThid)
94 WRITE(msgBuf,'(A)')
95 & 'CONFIG_CHECK: but tempImplVertAdv is TRUE'
96 CALL PRINT_ERROR( msgBuf , myThid)
97 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
98 ENDIF
99 IF ( saltImplVertAdv ) THEN
100 WRITE(msgBuf,'(A)')
101 & 'CONFIG_CHECK: #undef INCLUDE_IMPLVERTADV_CODE'
102 CALL PRINT_ERROR( msgBuf , myThid)
103 WRITE(msgBuf,'(A)')
104 & 'CONFIG_CHECK: but saltImplVertAdv is TRUE'
105 CALL PRINT_ERROR( msgBuf , myThid)
106 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
107 ENDIF
108 #endif
109
110 #ifndef EXACT_CONSERV
111 IF (exactConserv) THEN
112 WRITE(msgBuf,'(A)')
113 & 'CONFIG_CHECK: #undef EXACT_CONSERV and'
114 CALL PRINT_ERROR( msgBuf , myThid)
115 WRITE(msgBuf,'(A)')
116 & 'CONFIG_CHECK: exactConserv is TRUE'
117 CALL PRINT_ERROR( msgBuf , myThid)
118 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
119 ENDIF
120 #endif
121
122 #ifndef NONLIN_FRSURF
123 IF (nonlinFreeSurf.NE.0) THEN
124 WRITE(msgBuf,'(A)')
125 & 'CONFIG_CHECK: #undef NONLIN_FRSURF and'
126 CALL PRINT_ERROR( msgBuf , myThid)
127 WRITE(msgBuf,'(A)')
128 & 'CONFIG_CHECK: nonlinFreeSurf is non-zero'
129 CALL PRINT_ERROR( msgBuf , myThid)
130 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
131 ENDIF
132 #endif
133
134 #ifndef NONLIN_FRSURF
135 IF (select_rStar .NE. 0) THEN
136 WRITE(msgBuf,'(A)')
137 & 'CONFIG_CHECK: rStar is part of NonLin-FS '
138 CALL PRINT_ERROR( msgBuf, myThid)
139 WRITE(msgBuf,'(A)')
140 & 'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to use it'
141 CALL PRINT_ERROR( msgBuf, myThid)
142 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
143 ENDIF
144 #endif /* NONLIN_FRSURF */
145
146 #ifdef USE_NATURAL_BCS
147 WRITE(msgBuf,'(A)')
148 & 'CONFIG_CHECK: USE_NATURAL_BCS option has been replaced'
149 CALL PRINT_ERROR( msgBuf , myThid)
150 WRITE(msgBuf,'(A)')
151 & 'CONFIG_CHECK: by useRealFreshWaterFlux=TRUE in data file'
152 CALL PRINT_ERROR( msgBuf , myThid)
153 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
154 #endif
155
156 C o If pLoadFile is set, then we should make sure the corresponing
157 C code is being compiled
158 #ifndef ATMOSPHERIC_LOADING
159 IF (pLoadFile.NE.' ') THEN
160 WRITE(msgBuf,'(A)')
161 & 'CONFIG_CHECK: pLoadFile is set but you have not'
162 CALL PRINT_ERROR( msgBuf , myThid)
163 WRITE(msgBuf,'(A)')
164 & 'compiled the model with the pressure loading code.'
165 CALL PRINT_ERROR( msgBuf , myThid)
166 WRITE(msgBuf,'(A)')
167 & 'Re-compile with: #define ATMOSPHERIC_LOADING'
168 CALL PRINT_ERROR( msgBuf , myThid)
169 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
170 ENDIF
171 IF ( useRealFreshWaterFlux .AND. useThSIce ) THEN
172 WRITE(msgBuf,'(A)')
173 & 'CONFIG_CHECK: sIceLoad is computed but'
174 CALL PRINT_ERROR( msgBuf , myThid)
175 WRITE(msgBuf,'(A)')
176 & 'pressure loading code is not compiled.'
177 CALL PRINT_ERROR( msgBuf , myThid)
178 WRITE(msgBuf,'(A)')
179 & 'Re-compile with: #define ATMOSPHERIC_LOADING'
180 CALL PRINT_ERROR( msgBuf , myThid)
181 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
182 ENDIF
183 #endif
184
185 #ifndef ALLOW_GENERIC_ADVDIFF
186 IF ( tempStepping .OR. saltStepping .OR. usePTRACERS ) THEN
187 WRITE(msgBuf,'(2A)')
188 & 'CONFIG_CHECK: cannot step forward Temp,Salt or pTracers',
189 & ' without pkg/generic_advdiff'
190 CALL PRINT_ERROR( msgBuf , 1)
191 WRITE(msgBuf,'(A)')
192 & 'Re-compile with pkg "generic_advdiff" in packages.conf'
193 CALL PRINT_ERROR( msgBuf , 1)
194 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
195 ENDIF
196 #endif
197
198 C o If taveFreq is finite, then we must make sure the diagnostics
199 C code is being compiled
200 #ifndef ALLOW_TIMEAVE
201 IF (taveFreq.NE.0.) THEN
202 WRITE(msgBuf,'(A)')
203 & 'CONFIG_CHECK: taveFreq <> 0 but pkg/timeave is not compiled'
204 CALL PRINT_ERROR( msgBuf , 1)
205 WRITE(msgBuf,'(A)')
206 & 'Re-compile with pkg "timeave" in packages.conf'
207 CALL PRINT_ERROR( msgBuf , 1)
208 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
209 ENDIF
210 #endif
211
212 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
213
214 C- check parameter consistency :
215
216 IF ( ( Olx.LT.3 .OR. Oly.LT.3 ) .AND.
217 & ( viscC4leith.NE.0. .OR. viscA4Grid.NE.0.
218 & .OR. viscA4D.NE.0. .OR. viscA4Z.NE.0. ) ) THEN
219 WRITE(msgBuf,'(A,A)')
220 & 'CONFIG_CHECK: cannot use Biharmonic Visc. (viscA4) with',
221 & ' overlap (Olx,Oly) smaller than 3'
222 CALL PRINT_ERROR( msgBuf , myThid)
223 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
224 ENDIF
225
226 IF ( rigidLid .AND. implicitFreeSurface ) THEN
227 WRITE(msgBuf,'(A,A)')
228 & 'CONFIG_CHECK: Cannot select both implicitFreeSurface',
229 & ' and rigidLid.'
230 CALL PRINT_ERROR( msgBuf , myThid)
231 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
232 ENDIF
233
234 IF (rigidLid .AND. exactConserv) THEN
235 WRITE(msgBuf,'(A)')
236 & 'CONFIG_CHECK: exactConserv not compatible with'
237 CALL PRINT_ERROR( msgBuf , myThid)
238 WRITE(msgBuf,'(A)')
239 & 'CONFIG_CHECK: rigidLid (meaningless in that case)'
240 CALL PRINT_ERROR( msgBuf , myThid)
241 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
242 ENDIF
243
244 IF (rigidLid .AND. useRealFreshWaterFlux) THEN
245 WRITE(msgBuf,'(A)')
246 & 'CONFIG_CHECK: useRealFreshWaterFlux not compatible with'
247 CALL PRINT_ERROR( msgBuf , myThid)
248 WRITE(msgBuf,'(A)')
249 & 'CONFIG_CHECK: rigidLid (meaningless in that case)'
250 CALL PRINT_ERROR( msgBuf , myThid)
251 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
252 ENDIF
253
254 IF ( (implicSurfPress.NE.1. .OR. implicDiv2DFlow.NE.1.)
255 & .AND. nonHydrostatic ) THEN
256 WRITE(msgBuf,'(A,A)') 'CONFIG_CHECK: nonHydrostatic',
257 & ' NOT SAFE with non-fully implicit Barotropic solver'
258 CALL PRINT_ERROR( msgBuf , myThid)
259 WRITE(msgBuf,'(A,A)') 'CONFIG_CHECK: To by-pass this',
260 & 'STOP, comment this test and re-compile config_check'
261 CALL PRINT_ERROR( msgBuf , myThid)
262 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
263 ENDIF
264
265 IF (nonlinFreeSurf.NE.0 .AND. .NOT.exactConserv) THEN
266 WRITE(msgBuf,'(A)')
267 & 'CONFIG_CHECK: nonlinFreeSurf cannot be used'
268 CALL PRINT_ERROR( msgBuf , myThid)
269 WRITE(msgBuf,'(A)')
270 & 'CONFIG_CHECK: without exactConserv'
271 CALL PRINT_ERROR( msgBuf , myThid)
272 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
273 ENDIF
274
275 IF (select_rStar.NE.0 .AND. .NOT.exactConserv) THEN
276 WRITE(msgBuf,'(A)')
277 & 'CONFIG_CHECK: r* Coordinate cannot be used'
278 CALL PRINT_ERROR( msgBuf , myThid)
279 WRITE(msgBuf,'(A)')
280 & 'CONFIG_CHECK: without exactConserv'
281 CALL PRINT_ERROR( msgBuf , myThid)
282 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
283 ENDIF
284
285 C- note : not implemented in checkpoint48b but it's done now (since 01-28-03)
286 c IF (select_rStar.GT.0 .AND. useOBCS ) THEN
287 c WRITE(msgBuf,'(A)')
288 c & 'CONFIG_CHECK: r* Coordinate not yet implemented'
289 c CALL PRINT_ERROR( msgBuf , 1)
290 c WRITE(msgBuf,'(A)')
291 c & 'CONFIG_CHECK: in OBC package'
292 c CALL PRINT_ERROR( msgBuf , 1)
293 c STOP 'ABNORMAL END: S/R CONFIG_CHECK'
294 c ENDIF
295
296 IF (nonlinFreeSurf.NE.0 .AND. nonHydrostatic) THEN
297 WRITE(msgBuf,'(A)')
298 & 'CONFIG_CHECK: nonlinFreeSurf not yet implemented'
299 CALL PRINT_ERROR( msgBuf , myThid)
300 WRITE(msgBuf,'(A)')
301 & 'CONFIG_CHECK: in nonHydrostatic code'
302 CALL PRINT_ERROR( msgBuf , myThid)
303 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
304 ENDIF
305
306 IF ( nonlinFreeSurf.NE.0 .AND.
307 & deltaTfreesurf.NE.dTtracerLev(1) ) THEN
308 WRITE(msgBuf,'(A)')
309 & 'CONFIG_CHECK: WARNING: nonlinFreeSurf might cause problems'
310 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
311 & SQUEEZE_RIGHT , myThid)
312 WRITE(msgBuf,'(A)')
313 & 'CONFIG_CHECK: with different FreeSurf & Tracer time-steps'
314 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
315 & SQUEEZE_RIGHT , myThid)
316 ENDIF
317
318 IF ( useRealFreshWaterFlux .AND. exactConserv
319 & .AND. implicDiv2DFlow.EQ.0. _d 0
320 & .AND. startTime.NE.0. .AND. usePickupBeforeC54 ) THEN
321 WRITE(msgBuf,'(A)')
322 & 'CONFIG_CHECK: RealFreshWaterFlux+implicSurfP=0+exactConserv:'
323 CALL PRINT_ERROR( msgBuf , myThid)
324 WRITE(msgBuf,'(A)')
325 & 'CONFIG_CHECK: restart not implemented in this config'
326 CALL PRINT_ERROR( msgBuf , myThid)
327 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
328 ENDIF
329
330 IF ( useRealFreshWaterFlux .AND. .NOT.exactConserv
331 & .AND. implicDiv2DFlow.NE.1. ) THEN
332 WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: **WARNNING** ',
333 & 'RealFreshWater & implicDiv2DFlow < 1'
334 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
335 & SQUEEZE_RIGHT , myThid)
336 WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: works better',
337 & ' with exactConserv=.T. (+ #define EXACT_CONSERV)'
338 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
339 & SQUEEZE_RIGHT , myThid)
340 ENDIF
341
342 #ifdef EXACT_CONSERV
343 IF (useRealFreshWaterFlux .AND. .NOT.exactConserv
344 & .AND. buoyancyRelation.EQ.'OCEANICP' ) THEN
345 WRITE(msgBuf,'(A)')
346 & 'CONFIG_CHECK: RealFreshWaterFlux with OCEANICP'
347 CALL PRINT_ERROR( msgBuf , myThid)
348 WRITE(msgBuf,'(A)')
349 & 'CONFIG_CHECK: requires exactConserv=T'
350 CALL PRINT_ERROR( msgBuf , myThid)
351 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
352 ENDIF
353 #else
354 IF (useRealFreshWaterFlux
355 & .AND. buoyancyRelation.EQ.'OCEANICP' ) THEN
356 WRITE(msgBuf,'(A)')
357 & 'CONFIG_CHECK: E-P effects on wVel are not included'
358 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
359 & SQUEEZE_RIGHT , myThid)
360 WRITE(msgBuf,'(A)')
361 & 'CONFIG_CHECK: ==> use #define EXACT_CONSERV to fix it'
362 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
363 & SQUEEZE_RIGHT , myThid)
364 ENDIF
365 #endif /* EXACT_CONSERV */
366
367 IF (.NOT.useCDscheme .AND. (tauCD.NE.0. .OR. rCD.NE.-1.) ) THEN
368 C- jmc: since useCDscheme is a new [04-13-03] flag (default=F),
369 C put this WARNING to stress that even if CD-scheme parameters
370 C (tauCD,rCD) are set, CD-scheme is not used without useCDscheme=T
371 C- and STOP if using mom_fluxform (following Chris advise).
372 C- jmc: but ultimately, this block can/will be removed.
373 IF (.NOT.vectorInvariantMomentum.AND.momStepping) THEN
374 WRITE(msgBuf,'(A)')
375 & 'CONFIG_CHECK: CD-scheme is OFF but params(tauCD,rCD) are set'
376 CALL PRINT_ERROR( msgBuf , myThid)
377 WRITE(msgBuf,'(2A)')
378 & 'CONFIG_CHECK: to turn ON CD-scheme: => "useCDscheme=.TRUE."',
379 & ' in "data", namelist PARM01'
380 CALL PRINT_ERROR( msgBuf , myThid)
381 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
382 ENDIF
383 WRITE(msgBuf,'(2A)') '**WARNNING** ',
384 & 'CONFIG_CHECK: CD-scheme is OFF but params(tauCD,rCD) are set'
385 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
386 & SQUEEZE_RIGHT , myThid)
387 WRITE(msgBuf,'(2A)')
388 & 'CONFIG_CHECK: to turn ON CD-scheme: => "useCDscheme=.TRUE."',
389 & ' in "data", namelist PARM01'
390 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
391 & SQUEEZE_RIGHT , myThid)
392 ENDIF
393
394 IF ( useCDscheme .AND. useCubedSphereExchange ) THEN
395 WRITE(msgBuf,'(2A)')
396 & 'CONFIG_CHECK: CD-scheme not implemented on CubedSphere grid'
397 CALL PRINT_ERROR( msgBuf , myThid)
398 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
399 ENDIF
400
401 IF ( useOldFreezing .AND. allowFreezing ) THEN
402 WRITE(msgBuf,'(2A)')
403 & 'CONFIG_CHECK: cannot set both: allowFreezing & useOldFreezing'
404 CALL PRINT_ERROR( msgBuf , myThid)
405 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
406 ENDIF
407
408 WRITE(msgBuf,'(A)') 'CONFIG_CHECK: OK'
409 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,
410 & SQUEEZE_RIGHT,myThid)
411
412 RETURN
413 END

  ViewVC Help
Powered by ViewVC 1.1.22