1 |
jmc |
1.6 |
C $Header: /u/gcmpack/MITgcm/model/src/config_check.F,v 1.5 2003/01/24 18:26:53 jmc Exp $ |
2 |
jmc |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "CPP_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
CBOP |
7 |
|
|
C !ROUTINE: CONFIG_CHECK |
8 |
|
|
C !INTERFACE: |
9 |
|
|
SUBROUTINE CONFIG_CHECK( myThid ) |
10 |
|
|
C !DESCRIPTION: \bv |
11 |
|
|
C *=========================================================* |
12 |
|
|
C | SUBROUTINE CONFIG_CHECK |
13 |
|
|
C | o Check model parameter settings. |
14 |
|
|
C *=========================================================* |
15 |
|
|
C | This routine help to prevent the use of parameters |
16 |
|
|
C | that are not compatible with the model configuration. |
17 |
|
|
C *=========================================================* |
18 |
|
|
C \ev |
19 |
|
|
|
20 |
|
|
C !USES: |
21 |
|
|
IMPLICIT NONE |
22 |
|
|
C === Global variables === |
23 |
|
|
#include "SIZE.h" |
24 |
|
|
#include "EEPARAMS.h" |
25 |
|
|
#include "PARAMS.h" |
26 |
|
|
c #include "GRID.h" |
27 |
|
|
|
28 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
29 |
|
|
C === Routine arguments === |
30 |
|
|
C myThid - Number of this instances of CONFIG_CHECK |
31 |
|
|
INTEGER myThid |
32 |
|
|
CEndOfInterface |
33 |
|
|
|
34 |
|
|
C !LOCAL VARIABLES: |
35 |
|
|
C == Local variables == |
36 |
|
|
C msgBuf :: Informational/error meesage buffer |
37 |
|
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
38 |
|
|
CEOP |
39 |
|
|
|
40 |
|
|
C- check that CPP option is "defined" when running-flag parameter is on: |
41 |
|
|
|
42 |
|
|
#ifndef ALLOW_NONHYDROSTATIC |
43 |
|
|
IF (nonHydrostatic) THEN |
44 |
|
|
WRITE(msgBuf,'(A)') |
45 |
|
|
& 'CONFIG_CHECK: #undef ALLOW_NONHYDROSTATIC and' |
46 |
jmc |
1.3 |
CALL PRINT_ERROR( msgBuf , myThid) |
47 |
jmc |
1.1 |
WRITE(msgBuf,'(A)') |
48 |
|
|
& 'CONFIG_CHECK: nonHydrostatic is TRUE' |
49 |
jmc |
1.3 |
CALL PRINT_ERROR( msgBuf , myThid) |
50 |
jmc |
1.1 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
51 |
|
|
ENDIF |
52 |
|
|
#endif |
53 |
|
|
|
54 |
|
|
#ifndef EXACT_CONSERV |
55 |
|
|
IF (exactConserv) THEN |
56 |
|
|
WRITE(msgBuf,'(A)') |
57 |
|
|
& 'CONFIG_CHECK: #undef EXACT_CONSERV and' |
58 |
jmc |
1.3 |
CALL PRINT_ERROR( msgBuf , myThid) |
59 |
jmc |
1.1 |
WRITE(msgBuf,'(A)') |
60 |
|
|
& 'CONFIG_CHECK: exactConserv is TRUE' |
61 |
jmc |
1.3 |
CALL PRINT_ERROR( msgBuf , myThid) |
62 |
jmc |
1.1 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
63 |
|
|
ENDIF |
64 |
|
|
#endif |
65 |
|
|
|
66 |
|
|
#ifndef NONLIN_FRSURF |
67 |
|
|
IF (nonlinFreeSurf.NE.0) THEN |
68 |
|
|
WRITE(msgBuf,'(A)') |
69 |
|
|
& 'CONFIG_CHECK: #undef NONLIN_FRSURF and' |
70 |
jmc |
1.3 |
CALL PRINT_ERROR( msgBuf , myThid) |
71 |
jmc |
1.1 |
WRITE(msgBuf,'(A)') |
72 |
|
|
& 'CONFIG_CHECK: nonlinFreeSurf is non-zero' |
73 |
jmc |
1.3 |
CALL PRINT_ERROR( msgBuf , myThid) |
74 |
jmc |
1.1 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
75 |
|
|
ENDIF |
76 |
|
|
#endif |
77 |
|
|
|
78 |
|
|
#ifdef USE_NATURAL_BCS |
79 |
|
|
WRITE(msgBuf,'(A)') |
80 |
jmc |
1.3 |
& 'CONFIG_CHECK: USE_NATURAL_BCS option has been replaced' |
81 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
82 |
jmc |
1.1 |
WRITE(msgBuf,'(A)') |
83 |
jmc |
1.3 |
& 'CONFIG_CHECK: by useRealFreshWaterFlux=TRUE in data file' |
84 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
85 |
jmc |
1.1 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
86 |
jmc |
1.3 |
#endif |
87 |
|
|
|
88 |
jmc |
1.4 |
C o If pLoadFile is set, then we should make sure the corresponing |
89 |
|
|
C code is being compiled |
90 |
|
|
#ifndef ATMOSPHERIC_LOADING |
91 |
|
|
IF (pLoadFile.NE.' ') THEN |
92 |
|
|
WRITE(msgBuf,'(A)') |
93 |
|
|
& 'CONFIG_CHECK: pLoadFile is set but you have not' |
94 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
95 |
|
|
WRITE(msgBuf,'(A)') |
96 |
|
|
& 'compiled the model with the pressure loading code.' |
97 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
98 |
|
|
WRITE(msgBuf,'(A,A)') |
99 |
|
|
& 'Re-compile with: #define ATMOSPHERIC_LOADING', |
100 |
|
|
& ' or -DATMOSPHERIC_LOADING' |
101 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
102 |
|
|
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
103 |
|
|
ENDIF |
104 |
|
|
#endif |
105 |
|
|
|
106 |
|
|
C o If taveFreq is finite, then we must make sure the diagnostics |
107 |
|
|
C code is being compiled |
108 |
|
|
#ifndef ALLOW_TIMEAVE |
109 |
|
|
IF (taveFreq.NE.0.) THEN |
110 |
|
|
WRITE(msgBuf,'(A)') |
111 |
|
|
& 'CONFIG_CHECK: taveFreq <> 0 but you have' |
112 |
|
|
CALL PRINT_ERROR( msgBuf , 1) |
113 |
|
|
WRITE(msgBuf,'(A)') |
114 |
|
|
& 'not compiled the model with the diagnostics routines.' |
115 |
|
|
CALL PRINT_ERROR( msgBuf , 1) |
116 |
|
|
WRITE(msgBuf,'(A,A)') |
117 |
|
|
& 'Re-compile with: #define ALLOW_TIMEAVE', |
118 |
|
|
& ' or -DALLOW_TIMEAVE' |
119 |
|
|
CALL PRINT_ERROR( msgBuf , 1) |
120 |
|
|
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
121 |
|
|
ENDIF |
122 |
|
|
#endif |
123 |
|
|
|
124 |
jmc |
1.3 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
125 |
|
|
|
126 |
|
|
C- check parameter consistency : |
127 |
|
|
|
128 |
|
|
IF ( rigidLid .AND. implicitFreeSurface ) THEN |
129 |
|
|
WRITE(msgBuf,'(A,A)') |
130 |
|
|
& 'CONFIG_CHECK: Cannot select both implicitFreeSurface', |
131 |
|
|
& ' and rigidLid.' |
132 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
133 |
|
|
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
134 |
|
|
ENDIF |
135 |
|
|
|
136 |
|
|
IF (rigidLid .AND. exactConserv) THEN |
137 |
jmc |
1.1 |
WRITE(msgBuf,'(A)') |
138 |
jmc |
1.3 |
& 'CONFIG_CHECK: exactConserv not compatible with' |
139 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
140 |
jmc |
1.1 |
WRITE(msgBuf,'(A)') |
141 |
jmc |
1.3 |
& 'CONFIG_CHECK: rigidLid (meaningless in that case)' |
142 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
143 |
jmc |
1.1 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
144 |
|
|
ENDIF |
145 |
|
|
|
146 |
jmc |
1.3 |
IF (rigidLid .AND. useRealFreshWaterFlux) THEN |
147 |
jmc |
1.1 |
WRITE(msgBuf,'(A)') |
148 |
jmc |
1.3 |
& 'CONFIG_CHECK: useRealFreshWaterFlux not compatible with' |
149 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
150 |
jmc |
1.1 |
WRITE(msgBuf,'(A)') |
151 |
|
|
& 'CONFIG_CHECK: rigidLid (meaningless in that case)' |
152 |
jmc |
1.3 |
CALL PRINT_ERROR( msgBuf , myThid) |
153 |
|
|
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
154 |
|
|
ENDIF |
155 |
|
|
|
156 |
|
|
IF ( (implicSurfPress.NE.1. .OR. implicDiv2DFlow.NE.1.) |
157 |
|
|
& .AND. nonHydrostatic ) THEN |
158 |
|
|
WRITE(msgBuf,'(A,A)') 'CONFIG_CHECK: nonHydrostatic', |
159 |
|
|
& ' NOT SAFE with non-fully implicit Barotropic solver' |
160 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
161 |
|
|
WRITE(msgBuf,'(A,A)') 'CONFIG_CHECK: To by-pass this', |
162 |
|
|
& 'STOP, comment this test and re-compile config_check' |
163 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
164 |
jmc |
1.1 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
165 |
|
|
ENDIF |
166 |
|
|
|
167 |
|
|
IF (nonlinFreeSurf.NE.0 .AND. .NOT.exactConserv) THEN |
168 |
|
|
WRITE(msgBuf,'(A)') |
169 |
|
|
& 'CONFIG_CHECK: nonlinFreeSurf cannot be used' |
170 |
jmc |
1.3 |
CALL PRINT_ERROR( msgBuf , myThid) |
171 |
jmc |
1.1 |
WRITE(msgBuf,'(A)') |
172 |
|
|
& 'CONFIG_CHECK: without exactConserv' |
173 |
jmc |
1.3 |
CALL PRINT_ERROR( msgBuf , myThid) |
174 |
jmc |
1.1 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
175 |
|
|
ENDIF |
176 |
|
|
|
177 |
jmc |
1.6 |
IF (select_rStar.NE.0 .AND. .NOT.exactConserv) THEN |
178 |
|
|
WRITE(msgBuf,'(A)') |
179 |
|
|
& 'CONFIG_CHECK: r* Coordinate cannot be used' |
180 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
181 |
|
|
WRITE(msgBuf,'(A)') |
182 |
|
|
& 'CONFIG_CHECK: without exactConserv' |
183 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
184 |
|
|
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
185 |
|
|
ENDIF |
186 |
|
|
|
187 |
|
|
C- note : not yet implemented |
188 |
|
|
IF (select_rStar.GT.0 .AND. useOBCS ) THEN |
189 |
|
|
WRITE(msgBuf,'(A)') |
190 |
|
|
& 'CONFIG_CHECK: r* Coordinate not yet implemented' |
191 |
|
|
CALL PRINT_ERROR( msgBuf , 1) |
192 |
|
|
WRITE(msgBuf,'(A)') |
193 |
|
|
& 'CONFIG_CHECK: in OBC package' |
194 |
|
|
CALL PRINT_ERROR( msgBuf , 1) |
195 |
|
|
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
196 |
|
|
ENDIF |
197 |
jmc |
1.1 |
|
198 |
|
|
IF (nonlinFreeSurf.NE.0 .AND. nonHydrostatic) THEN |
199 |
|
|
WRITE(msgBuf,'(A)') |
200 |
|
|
& 'CONFIG_CHECK: nonlinFreeSurf not yet implemented' |
201 |
jmc |
1.3 |
CALL PRINT_ERROR( msgBuf , myThid) |
202 |
jmc |
1.1 |
WRITE(msgBuf,'(A)') |
203 |
|
|
& 'CONFIG_CHECK: in nonHydrostatic code' |
204 |
jmc |
1.3 |
CALL PRINT_ERROR( msgBuf , myThid) |
205 |
jmc |
1.1 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
206 |
|
|
ENDIF |
207 |
jmc |
1.3 |
|
208 |
jmc |
1.4 |
IF (nonlinFreeSurf.NE.0.AND.deltaTfreesurf.NE.deltaTtracer) THEN |
209 |
jmc |
1.3 |
WRITE(msgBuf,'(A)') |
210 |
jmc |
1.4 |
& 'CONFIG_CHECK: WARNING: nonlinFreeSurf might cause problems' |
211 |
|
|
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
212 |
|
|
& SQUEEZE_RIGHT , myThid) |
213 |
|
|
WRITE(msgBuf,'(A)') |
214 |
|
|
& 'CONFIG_CHECK: with different FreeSurf & Tracer time-steps' |
215 |
|
|
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
216 |
|
|
& SQUEEZE_RIGHT , myThid) |
217 |
jmc |
1.3 |
ENDIF |
218 |
|
|
|
219 |
|
|
IF (useRealFreshWaterFlux .AND. exactConserv |
220 |
|
|
& .AND.startTime.NE.0. .AND. implicSurfPress.EQ.0. _d 0) THEN |
221 |
|
|
WRITE(msgBuf,'(A)') |
222 |
|
|
& 'CONFIG_CHECK: RealFreshWaterFlux+implicSurfP=0+exactConserv:' |
223 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
224 |
|
|
WRITE(msgBuf,'(A)') |
225 |
|
|
& 'CONFIG_CHECK: restart not implemented in this config' |
226 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
227 |
|
|
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
228 |
|
|
ENDIF |
229 |
|
|
|
230 |
jmc |
1.4 |
#ifdef NONLIN_FRSURF |
231 |
|
|
IF (useRealFreshWaterFlux .AND. .NOT.exactConserv |
232 |
|
|
& .AND. buoyancyRelation.EQ.'OCEANICP' ) THEN |
233 |
|
|
WRITE(msgBuf,'(A)') |
234 |
|
|
& 'CONFIG_CHECK: RealFreshWaterFlux with OCEANICP' |
235 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
236 |
|
|
WRITE(msgBuf,'(A)') |
237 |
|
|
& 'CONFIG_CHECK: requires exactConserv=T' |
238 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
239 |
|
|
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
240 |
|
|
ENDIF |
241 |
|
|
#else |
242 |
jmc |
1.3 |
IF (useRealFreshWaterFlux .AND. exactConserv |
243 |
|
|
& .AND. implicSurfPress.NE.1. _d 0 ) THEN |
244 |
|
|
WRITE(msgBuf,'(A)') |
245 |
|
|
& 'CONFIG_CHECK: Pb with restart in this config' |
246 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
247 |
|
|
WRITE(msgBuf,'(A)') |
248 |
|
|
& 'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to fix it' |
249 |
|
|
CALL PRINT_ERROR( msgBuf , myThid) |
250 |
|
|
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
251 |
|
|
ENDIF |
252 |
jmc |
1.4 |
|
253 |
|
|
IF (useRealFreshWaterFlux |
254 |
|
|
& .AND. buoyancyRelation.EQ.'OCEANICP' ) THEN |
255 |
|
|
WRITE(msgBuf,'(A)') |
256 |
|
|
& 'CONFIG_CHECK: E-P effects on wVel are not included' |
257 |
|
|
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
258 |
|
|
& SQUEEZE_RIGHT , myThid) |
259 |
|
|
WRITE(msgBuf,'(A)') |
260 |
|
|
& 'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to fix it' |
261 |
jmc |
1.5 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
262 |
|
|
& SQUEEZE_RIGHT , myThid) |
263 |
|
|
ENDIF |
264 |
|
|
|
265 |
|
|
IF (select_rStar .NE. 0) THEN |
266 |
|
|
WRITE(msgBuf,'(A)') |
267 |
|
|
& 'CONFIG_CHECK: rStar is part of NonLin-FS ' |
268 |
|
|
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
269 |
|
|
& SQUEEZE_RIGHT , myThid) |
270 |
|
|
WRITE(msgBuf,'(A)') |
271 |
|
|
& 'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to use it' |
272 |
jmc |
1.4 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
273 |
|
|
& SQUEEZE_RIGHT , myThid) |
274 |
|
|
ENDIF |
275 |
|
|
#endif /* NONLIN_FRSURF */ |
276 |
jmc |
1.1 |
|
277 |
|
|
WRITE(msgBuf,'(A)') 'CONFIG_CHECK: OK' |
278 |
|
|
CALL PRINT_MESSAGE(msgBuf,standardMessageUnit, |
279 |
|
|
& SQUEEZE_RIGHT,myThid) |
280 |
|
|
|
281 |
|
|
RETURN |
282 |
|
|
END |