1 |
C $Header: /u/gcmpack/MITgcm/model/src/config_check.F,v 1.4 2002/12/10 02:55:47 jmc Exp $ |
2 |
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 |
CALL PRINT_ERROR( msgBuf , myThid) |
47 |
WRITE(msgBuf,'(A)') |
48 |
& 'CONFIG_CHECK: nonHydrostatic is TRUE' |
49 |
CALL PRINT_ERROR( msgBuf , myThid) |
50 |
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 |
CALL PRINT_ERROR( msgBuf , myThid) |
59 |
WRITE(msgBuf,'(A)') |
60 |
& 'CONFIG_CHECK: exactConserv is TRUE' |
61 |
CALL PRINT_ERROR( msgBuf , myThid) |
62 |
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 |
CALL PRINT_ERROR( msgBuf , myThid) |
71 |
WRITE(msgBuf,'(A)') |
72 |
& 'CONFIG_CHECK: nonlinFreeSurf is non-zero' |
73 |
CALL PRINT_ERROR( msgBuf , myThid) |
74 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
75 |
ENDIF |
76 |
#endif |
77 |
|
78 |
#ifdef USE_NATURAL_BCS |
79 |
WRITE(msgBuf,'(A)') |
80 |
& 'CONFIG_CHECK: USE_NATURAL_BCS option has been replaced' |
81 |
CALL PRINT_ERROR( msgBuf , myThid) |
82 |
WRITE(msgBuf,'(A)') |
83 |
& 'CONFIG_CHECK: by useRealFreshWaterFlux=TRUE in data file' |
84 |
CALL PRINT_ERROR( msgBuf , myThid) |
85 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
86 |
#endif |
87 |
|
88 |
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 |
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 |
WRITE(msgBuf,'(A)') |
138 |
& 'CONFIG_CHECK: exactConserv not compatible with' |
139 |
CALL PRINT_ERROR( msgBuf , myThid) |
140 |
WRITE(msgBuf,'(A)') |
141 |
& 'CONFIG_CHECK: rigidLid (meaningless in that case)' |
142 |
CALL PRINT_ERROR( msgBuf , myThid) |
143 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
144 |
ENDIF |
145 |
|
146 |
IF (rigidLid .AND. useRealFreshWaterFlux) THEN |
147 |
WRITE(msgBuf,'(A)') |
148 |
& 'CONFIG_CHECK: useRealFreshWaterFlux not compatible with' |
149 |
CALL PRINT_ERROR( msgBuf , myThid) |
150 |
WRITE(msgBuf,'(A)') |
151 |
& 'CONFIG_CHECK: rigidLid (meaningless in that case)' |
152 |
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 |
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 |
CALL PRINT_ERROR( msgBuf , myThid) |
171 |
WRITE(msgBuf,'(A)') |
172 |
& 'CONFIG_CHECK: without exactConserv' |
173 |
CALL PRINT_ERROR( msgBuf , myThid) |
174 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
175 |
ENDIF |
176 |
|
177 |
C- note : not implemented in Release1_beta1 but it's done now (since 01-30-02) |
178 |
c IF (nonlinFreeSurf.NE.0 .AND. useOBCS ) THEN |
179 |
c WRITE(msgBuf,'(A)') |
180 |
c & 'CONFIG_CHECK: nonlinFreeSurf not yet implemented' |
181 |
c CALL PRINT_ERROR( msgBuf , 1) |
182 |
c WRITE(msgBuf,'(A)') |
183 |
c & 'CONFIG_CHECK: in OBC package' |
184 |
c CALL PRINT_ERROR( msgBuf , 1) |
185 |
c STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
186 |
c ENDIF |
187 |
|
188 |
IF (nonlinFreeSurf.NE.0 .AND. nonHydrostatic) THEN |
189 |
WRITE(msgBuf,'(A)') |
190 |
& 'CONFIG_CHECK: nonlinFreeSurf not yet implemented' |
191 |
CALL PRINT_ERROR( msgBuf , myThid) |
192 |
WRITE(msgBuf,'(A)') |
193 |
& 'CONFIG_CHECK: in nonHydrostatic code' |
194 |
CALL PRINT_ERROR( msgBuf , myThid) |
195 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
196 |
ENDIF |
197 |
|
198 |
IF (nonlinFreeSurf.NE.0.AND.deltaTfreesurf.NE.deltaTtracer) THEN |
199 |
WRITE(msgBuf,'(A)') |
200 |
& 'CONFIG_CHECK: WARNING: nonlinFreeSurf might cause problems' |
201 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
202 |
& SQUEEZE_RIGHT , myThid) |
203 |
WRITE(msgBuf,'(A)') |
204 |
& 'CONFIG_CHECK: with different FreeSurf & Tracer time-steps' |
205 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
206 |
& SQUEEZE_RIGHT , myThid) |
207 |
ENDIF |
208 |
|
209 |
IF (useRealFreshWaterFlux .AND. exactConserv |
210 |
& .AND.startTime.NE.0. .AND. implicSurfPress.EQ.0. _d 0) THEN |
211 |
WRITE(msgBuf,'(A)') |
212 |
& 'CONFIG_CHECK: RealFreshWaterFlux+implicSurfP=0+exactConserv:' |
213 |
CALL PRINT_ERROR( msgBuf , myThid) |
214 |
WRITE(msgBuf,'(A)') |
215 |
& 'CONFIG_CHECK: restart not implemented in this config' |
216 |
CALL PRINT_ERROR( msgBuf , myThid) |
217 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
218 |
ENDIF |
219 |
|
220 |
#ifdef NONLIN_FRSURF |
221 |
IF (useRealFreshWaterFlux .AND. .NOT.exactConserv |
222 |
& .AND. buoyancyRelation.EQ.'OCEANICP' ) THEN |
223 |
WRITE(msgBuf,'(A)') |
224 |
& 'CONFIG_CHECK: RealFreshWaterFlux with OCEANICP' |
225 |
CALL PRINT_ERROR( msgBuf , myThid) |
226 |
WRITE(msgBuf,'(A)') |
227 |
& 'CONFIG_CHECK: requires exactConserv=T' |
228 |
CALL PRINT_ERROR( msgBuf , myThid) |
229 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
230 |
ENDIF |
231 |
#else |
232 |
IF (useRealFreshWaterFlux .AND. exactConserv |
233 |
& .AND. implicSurfPress.NE.1. _d 0 ) THEN |
234 |
WRITE(msgBuf,'(A)') |
235 |
& 'CONFIG_CHECK: Pb with restart in this config' |
236 |
CALL PRINT_ERROR( msgBuf , myThid) |
237 |
WRITE(msgBuf,'(A)') |
238 |
& 'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to fix it' |
239 |
CALL PRINT_ERROR( msgBuf , myThid) |
240 |
STOP 'ABNORMAL END: S/R CONFIG_CHECK' |
241 |
ENDIF |
242 |
|
243 |
IF (useRealFreshWaterFlux |
244 |
& .AND. buoyancyRelation.EQ.'OCEANICP' ) THEN |
245 |
WRITE(msgBuf,'(A)') |
246 |
& 'CONFIG_CHECK: E-P effects on wVel are not included' |
247 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
248 |
& SQUEEZE_RIGHT , myThid) |
249 |
WRITE(msgBuf,'(A)') |
250 |
& 'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to fix it' |
251 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
252 |
& SQUEEZE_RIGHT , myThid) |
253 |
ENDIF |
254 |
|
255 |
IF (select_rStar .NE. 0) THEN |
256 |
WRITE(msgBuf,'(A)') |
257 |
& 'CONFIG_CHECK: rStar is part of NonLin-FS ' |
258 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
259 |
& SQUEEZE_RIGHT , myThid) |
260 |
WRITE(msgBuf,'(A)') |
261 |
& 'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to use it' |
262 |
CALL PRINT_MESSAGE( msgBuf, errorMessageUnit, |
263 |
& SQUEEZE_RIGHT , myThid) |
264 |
ENDIF |
265 |
#endif /* NONLIN_FRSURF */ |
266 |
|
267 |
WRITE(msgBuf,'(A)') 'CONFIG_CHECK: OK' |
268 |
CALL PRINT_MESSAGE(msgBuf,standardMessageUnit, |
269 |
& SQUEEZE_RIGHT,myThid) |
270 |
|
271 |
RETURN |
272 |
END |