/[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.12 - (show annotations) (download)
Thu Nov 13 21:54:11 2003 UTC (20 years, 6 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint52d_pre, checkpoint52e_pre, checkpoint52b_pre, checkpoint52b_post, checkpoint52c_post, checkpoint52d_post, branch-netcdf, checkpoint52a_post
Branch point for: netcdf-sm0
Changes since 1.11: +15 -1 lines
additional changes for FREEZE:
 - new S/R FREEZE_SURFACE only apllied to surface level.
 - add run-time parameter "useOldFreezing" to use the old version "FREEZE"

1 C $Header: /u/gcmpack/MITgcm/model/src/config_check.F,v 1.11 2003/10/28 22:57:59 edhill 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_CD_CODE
44 IF (useCDscheme) THEN
45 WRITE(msgBuf,'(A)')
46 & 'CONFIG_CHECK: #undef ALLOW_CD_CODE and'
47 CALL PRINT_ERROR( msgBuf , myThid)
48 WRITE(msgBuf,'(A)')
49 & 'CONFIG_CHECK: useCDscheme is TRUE'
50 CALL PRINT_ERROR( msgBuf , myThid)
51 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
52 ENDIF
53 #endif
54
55 #ifndef ALLOW_NONHYDROSTATIC
56 IF (nonHydrostatic) THEN
57 WRITE(msgBuf,'(A)')
58 & 'CONFIG_CHECK: #undef ALLOW_NONHYDROSTATIC and'
59 CALL PRINT_ERROR( msgBuf , myThid)
60 WRITE(msgBuf,'(A)')
61 & 'CONFIG_CHECK: nonHydrostatic is TRUE'
62 CALL PRINT_ERROR( msgBuf , myThid)
63 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
64 ENDIF
65 #endif
66
67 #ifndef EXACT_CONSERV
68 IF (exactConserv) THEN
69 WRITE(msgBuf,'(A)')
70 & 'CONFIG_CHECK: #undef EXACT_CONSERV and'
71 CALL PRINT_ERROR( msgBuf , myThid)
72 WRITE(msgBuf,'(A)')
73 & 'CONFIG_CHECK: exactConserv is TRUE'
74 CALL PRINT_ERROR( msgBuf , myThid)
75 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
76 ENDIF
77 #endif
78
79 #ifndef NONLIN_FRSURF
80 IF (nonlinFreeSurf.NE.0) THEN
81 WRITE(msgBuf,'(A)')
82 & 'CONFIG_CHECK: #undef NONLIN_FRSURF and'
83 CALL PRINT_ERROR( msgBuf , myThid)
84 WRITE(msgBuf,'(A)')
85 & 'CONFIG_CHECK: nonlinFreeSurf is non-zero'
86 CALL PRINT_ERROR( msgBuf , myThid)
87 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
88 ENDIF
89 #endif
90
91 #ifndef NONLIN_FRSURF
92 IF (select_rStar .NE. 0) THEN
93 WRITE(msgBuf,'(A)')
94 & 'CONFIG_CHECK: rStar is part of NonLin-FS '
95 CALL PRINT_ERROR( msgBuf, myThid)
96 WRITE(msgBuf,'(A)')
97 & 'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to use it'
98 CALL PRINT_ERROR( msgBuf, myThid)
99 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
100 ENDIF
101 #endif /* NONLIN_FRSURF */
102
103 #ifdef USE_NATURAL_BCS
104 WRITE(msgBuf,'(A)')
105 & 'CONFIG_CHECK: USE_NATURAL_BCS option has been replaced'
106 CALL PRINT_ERROR( msgBuf , myThid)
107 WRITE(msgBuf,'(A)')
108 & 'CONFIG_CHECK: by useRealFreshWaterFlux=TRUE in data file'
109 CALL PRINT_ERROR( msgBuf , myThid)
110 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
111 #endif
112
113 C o If pLoadFile is set, then we should make sure the corresponing
114 C code is being compiled
115 #ifndef ATMOSPHERIC_LOADING
116 IF (pLoadFile.NE.' ') THEN
117 WRITE(msgBuf,'(A)')
118 & 'CONFIG_CHECK: pLoadFile is set but you have not'
119 CALL PRINT_ERROR( msgBuf , myThid)
120 WRITE(msgBuf,'(A)')
121 & 'compiled the model with the pressure loading code.'
122 CALL PRINT_ERROR( msgBuf , myThid)
123 WRITE(msgBuf,'(A,A)')
124 & 'Re-compile with: #define ATMOSPHERIC_LOADING',
125 & ' or -DATMOSPHERIC_LOADING'
126 CALL PRINT_ERROR( msgBuf , myThid)
127 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
128 ENDIF
129 #endif
130
131 C o If taveFreq is finite, then we must make sure the diagnostics
132 C code is being compiled
133 #ifndef ALLOW_TIMEAVE
134 ceh3 needs an IF ( useTIMEAVE ) THEN
135 IF (taveFreq.NE.0.) THEN
136 WRITE(msgBuf,'(A)')
137 & 'CONFIG_CHECK: taveFreq <> 0 but you have'
138 CALL PRINT_ERROR( msgBuf , 1)
139 WRITE(msgBuf,'(A)')
140 & 'not compiled the model with the diagnostics routines.'
141 CALL PRINT_ERROR( msgBuf , 1)
142 WRITE(msgBuf,'(A,A)')
143 & 'Re-compile with: #define ALLOW_TIMEAVE',
144 & ' or -DALLOW_TIMEAVE'
145 CALL PRINT_ERROR( msgBuf , 1)
146 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
147 ENDIF
148 #endif
149
150 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
151
152 C- check parameter consistency :
153
154 IF ( viscA4.NE.0. .AND. (Olx.LT.3 .OR. Oly.LT.3)) THEN
155 WRITE(msgBuf,'(A,A)')
156 & 'CONFIG_CHECK: cannot use Biharmonic Visc. (viscA4) with',
157 & ' overlap (Olx,Oly) smaller than 3'
158 CALL PRINT_ERROR( msgBuf , myThid)
159 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
160 ENDIF
161
162 IF ( rigidLid .AND. implicitFreeSurface ) THEN
163 WRITE(msgBuf,'(A,A)')
164 & 'CONFIG_CHECK: Cannot select both implicitFreeSurface',
165 & ' and rigidLid.'
166 CALL PRINT_ERROR( msgBuf , myThid)
167 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
168 ENDIF
169
170 IF (rigidLid .AND. exactConserv) THEN
171 WRITE(msgBuf,'(A)')
172 & 'CONFIG_CHECK: exactConserv not compatible with'
173 CALL PRINT_ERROR( msgBuf , myThid)
174 WRITE(msgBuf,'(A)')
175 & 'CONFIG_CHECK: rigidLid (meaningless in that case)'
176 CALL PRINT_ERROR( msgBuf , myThid)
177 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
178 ENDIF
179
180 IF (rigidLid .AND. useRealFreshWaterFlux) THEN
181 WRITE(msgBuf,'(A)')
182 & 'CONFIG_CHECK: useRealFreshWaterFlux not compatible with'
183 CALL PRINT_ERROR( msgBuf , myThid)
184 WRITE(msgBuf,'(A)')
185 & 'CONFIG_CHECK: rigidLid (meaningless in that case)'
186 CALL PRINT_ERROR( msgBuf , myThid)
187 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
188 ENDIF
189
190 IF ( (implicSurfPress.NE.1. .OR. implicDiv2DFlow.NE.1.)
191 & .AND. nonHydrostatic ) THEN
192 WRITE(msgBuf,'(A,A)') 'CONFIG_CHECK: nonHydrostatic',
193 & ' NOT SAFE with non-fully implicit Barotropic solver'
194 CALL PRINT_ERROR( msgBuf , myThid)
195 WRITE(msgBuf,'(A,A)') 'CONFIG_CHECK: To by-pass this',
196 & 'STOP, comment this test and re-compile config_check'
197 CALL PRINT_ERROR( msgBuf , myThid)
198 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
199 ENDIF
200
201 IF (nonlinFreeSurf.NE.0 .AND. .NOT.exactConserv) THEN
202 WRITE(msgBuf,'(A)')
203 & 'CONFIG_CHECK: nonlinFreeSurf cannot be used'
204 CALL PRINT_ERROR( msgBuf , myThid)
205 WRITE(msgBuf,'(A)')
206 & 'CONFIG_CHECK: without exactConserv'
207 CALL PRINT_ERROR( msgBuf , myThid)
208 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
209 ENDIF
210
211 IF (select_rStar.NE.0 .AND. .NOT.exactConserv) THEN
212 WRITE(msgBuf,'(A)')
213 & 'CONFIG_CHECK: r* Coordinate cannot be used'
214 CALL PRINT_ERROR( msgBuf , myThid)
215 WRITE(msgBuf,'(A)')
216 & 'CONFIG_CHECK: without exactConserv'
217 CALL PRINT_ERROR( msgBuf , myThid)
218 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
219 ENDIF
220
221 C- note : not implemented in checkpoint48b but it's done now (since 01-28-03)
222 c IF (select_rStar.GT.0 .AND. useOBCS ) THEN
223 c WRITE(msgBuf,'(A)')
224 c & 'CONFIG_CHECK: r* Coordinate not yet implemented'
225 c CALL PRINT_ERROR( msgBuf , 1)
226 c WRITE(msgBuf,'(A)')
227 c & 'CONFIG_CHECK: in OBC package'
228 c CALL PRINT_ERROR( msgBuf , 1)
229 c STOP 'ABNORMAL END: S/R CONFIG_CHECK'
230 c ENDIF
231
232 IF (nonlinFreeSurf.NE.0 .AND. nonHydrostatic) THEN
233 WRITE(msgBuf,'(A)')
234 & 'CONFIG_CHECK: nonlinFreeSurf not yet implemented'
235 CALL PRINT_ERROR( msgBuf , myThid)
236 WRITE(msgBuf,'(A)')
237 & 'CONFIG_CHECK: in nonHydrostatic code'
238 CALL PRINT_ERROR( msgBuf , myThid)
239 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
240 ENDIF
241
242 IF (nonlinFreeSurf.NE.0.AND.deltaTfreesurf.NE.deltaTtracer) THEN
243 WRITE(msgBuf,'(A)')
244 & 'CONFIG_CHECK: WARNING: nonlinFreeSurf might cause problems'
245 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
246 & SQUEEZE_RIGHT , myThid)
247 WRITE(msgBuf,'(A)')
248 & 'CONFIG_CHECK: with different FreeSurf & Tracer time-steps'
249 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
250 & SQUEEZE_RIGHT , myThid)
251 ENDIF
252
253 IF (useRealFreshWaterFlux .AND. exactConserv
254 & .AND.startTime.NE.0. .AND. implicSurfPress.EQ.0. _d 0) THEN
255 WRITE(msgBuf,'(A)')
256 & 'CONFIG_CHECK: RealFreshWaterFlux+implicSurfP=0+exactConserv:'
257 CALL PRINT_ERROR( msgBuf , myThid)
258 WRITE(msgBuf,'(A)')
259 & 'CONFIG_CHECK: restart not implemented in this config'
260 CALL PRINT_ERROR( msgBuf , myThid)
261 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
262 ENDIF
263
264 #ifdef NONLIN_FRSURF
265 IF (useRealFreshWaterFlux .AND. .NOT.exactConserv
266 & .AND. buoyancyRelation.EQ.'OCEANICP' ) THEN
267 WRITE(msgBuf,'(A)')
268 & 'CONFIG_CHECK: RealFreshWaterFlux with OCEANICP'
269 CALL PRINT_ERROR( msgBuf , myThid)
270 WRITE(msgBuf,'(A)')
271 & 'CONFIG_CHECK: requires exactConserv=T'
272 CALL PRINT_ERROR( msgBuf , myThid)
273 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
274 ENDIF
275 #else
276 IF (useRealFreshWaterFlux .AND. exactConserv
277 & .AND. implicSurfPress.NE.1. _d 0 ) THEN
278 WRITE(msgBuf,'(A)')
279 & 'CONFIG_CHECK: Pb with restart in this config'
280 CALL PRINT_ERROR( msgBuf , myThid)
281 WRITE(msgBuf,'(A)')
282 & 'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to fix it'
283 CALL PRINT_ERROR( msgBuf , myThid)
284 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
285 ENDIF
286
287 IF (useRealFreshWaterFlux
288 & .AND. buoyancyRelation.EQ.'OCEANICP' ) THEN
289 WRITE(msgBuf,'(A)')
290 & 'CONFIG_CHECK: E-P effects on wVel are not included'
291 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
292 & SQUEEZE_RIGHT , myThid)
293 WRITE(msgBuf,'(A)')
294 & 'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to fix it'
295 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
296 & SQUEEZE_RIGHT , myThid)
297 ENDIF
298 #endif /* NONLIN_FRSURF */
299
300 IF (.NOT.useCDscheme .AND. (tauCD.NE.0. .OR. rCD.NE.-1.) ) THEN
301 C- jmc: since useCDscheme is a new [04-13-03] flag (default=F),
302 C put this WARNING to stress that even if CD-scheme parameters
303 C (tauCD,rCD) are set, CD-scheme is not used without useCDscheme=T
304 C- and STOP if using mom_fluxform (following Chris advise).
305 C- jmc: but ultimately, this block can/will be removed.
306 IF (.NOT.vectorInvariantMomentum.AND.momStepping) THEN
307 WRITE(msgBuf,'(A)')
308 & 'CONFIG_CHECK: CD-scheme is OFF but params(tauCD,rCD) are set'
309 CALL PRINT_ERROR( msgBuf , myThid)
310 WRITE(msgBuf,'(2A)')
311 & 'CONFIG_CHECK: to turn ON CD-scheme: => "useCDscheme=.TRUE."',
312 & ' in "data", namelist PARM01'
313 CALL PRINT_ERROR( msgBuf , myThid)
314 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
315 ENDIF
316 WRITE(msgBuf,'(2A)') '**WARNNING** ',
317 & 'CONFIG_CHECK: CD-scheme is OFF but params(tauCD,rCD) are set'
318 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
319 & SQUEEZE_RIGHT , myThid)
320 WRITE(msgBuf,'(2A)')
321 & 'CONFIG_CHECK: to turn ON CD-scheme: => "useCDscheme=.TRUE."',
322 & ' in "data", namelist PARM01'
323 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
324 & SQUEEZE_RIGHT , myThid)
325 ENDIF
326
327 IF ( useCDscheme .AND. useCubedSphereExchange ) THEN
328 WRITE(msgBuf,'(2A)')
329 & 'CONFIG_CHECK: CD-scheme not implemented on CubedSphere grid'
330 CALL PRINT_ERROR( msgBuf , myThid)
331 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
332 ENDIF
333
334 IF ( useOldFreezing .AND. allowFreezing ) THEN
335 WRITE(msgBuf,'(2A)')
336 & 'CONFIG_CHECK: cannot set both: allowFreezing & useOldFreezing'
337 CALL PRINT_ERROR( msgBuf , myThid)
338 STOP 'ABNORMAL END: S/R CONFIG_CHECK'
339 ENDIF
340
341 WRITE(msgBuf,'(A)') 'CONFIG_CHECK: OK'
342 CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,
343 & SQUEEZE_RIGHT,myThid)
344
345 RETURN
346 END

  ViewVC Help
Powered by ViewVC 1.1.22