/[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.19 - (show annotations) (download)
Sun Dec 5 22:23:17 2004 UTC (19 years, 5 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint57b_post, checkpoint57d_post, checkpoint57, checkpoint57a_post, checkpoint57c_post, checkpoint57c_pre, checkpoint57a_pre
Changes since 1.18: +14 -3 lines
implement Implicit Vertical advection for pTracers

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

  ViewVC Help
Powered by ViewVC 1.1.22