/[MITgcm]/MITgcm/model/src/config_check.F
ViewVC logotype

Diff of /MITgcm/model/src/config_check.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.7 by jmc, Thu Jan 30 00:08:29 2003 UTC revision 1.24 by edhill, Wed Apr 20 19:51:37 2005 UTC
# Line 1  Line 1 
1  C $Header$  C $Header$
2  C $Name$  C $Name$
3    
4    #include "PACKAGES_CONFIG.h"
5  #include "CPP_OPTIONS.h"  #include "CPP_OPTIONS.h"
6    
7  CBOP  CBOP
# Line 39  CEOP Line 40  CEOP
40    
41  C-  check that CPP option is "defined" when running-flag parameter is on:  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  #ifndef ALLOW_NONHYDROSTATIC
69        IF (nonHydrostatic) THEN        IF (nonHydrostatic) THEN
70          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
# Line 51  C-  check that CPP option is "defined" w Line 77  C-  check that CPP option is "defined" w
77        ENDIF        ENDIF
78  #endif  #endif
79    
80    #ifndef ALLOW_ADAMSBASHFORTH_3
81          IF ( alph_AB.NE.UNSET_RL .OR. beta_AB.NE.UNSET_RL ) THEN
82            WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: ',
83         &   '#undef ALLOW_ADAMSBASHFORTH_3 but alph_AB,beta_AB'
84            CALL PRINT_ERROR( msgBuf , myThid)
85            WRITE(msgBuf,'(A,1P2E20.7)')
86         &   'CONFIG_CHECK: are set to:',alph_AB,beta_AB
87            CALL PRINT_ERROR( msgBuf , myThid)
88            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
89          ENDIF
90    #endif
91    
92    #ifndef INCLUDE_IMPLVERTADV_CODE
93          IF ( momImplVertAdv ) THEN
94            WRITE(msgBuf,'(A)')
95         &   'CONFIG_CHECK: #undef INCLUDE_IMPLVERTADV_CODE'
96            CALL PRINT_ERROR( msgBuf , myThid)
97            WRITE(msgBuf,'(A)')
98         &   'CONFIG_CHECK: but momImplVertAdv is TRUE'
99            CALL PRINT_ERROR( msgBuf , myThid)
100            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
101          ENDIF
102          IF ( tempImplVertAdv ) THEN
103            WRITE(msgBuf,'(A)')
104         &   'CONFIG_CHECK: #undef INCLUDE_IMPLVERTADV_CODE'
105            CALL PRINT_ERROR( msgBuf , myThid)
106            WRITE(msgBuf,'(A)')
107         &   'CONFIG_CHECK: but tempImplVertAdv is TRUE'
108            CALL PRINT_ERROR( msgBuf , myThid)
109            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
110          ENDIF
111          IF ( saltImplVertAdv ) THEN
112            WRITE(msgBuf,'(A)')
113         &   'CONFIG_CHECK: #undef INCLUDE_IMPLVERTADV_CODE'
114            CALL PRINT_ERROR( msgBuf , myThid)
115            WRITE(msgBuf,'(A)')
116         &   'CONFIG_CHECK: but saltImplVertAdv is TRUE'
117            CALL PRINT_ERROR( msgBuf , myThid)
118            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
119          ENDIF
120          IF ( dTtracerLev(1).NE.dTtracerLev(Nr) .AND. implicitDiffusion
121         &     .AND. ( saltStepping .OR. tempStepping .OR. usePTRACERS )
122         &   ) THEN
123            WRITE(msgBuf,'(A)')
124         &   'CONFIG_CHECK: #undef INCLUDE_IMPLVERTADV_CODE'
125            CALL PRINT_ERROR( msgBuf , myThid)
126            WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: ',
127         &   'but implicitDiffusion=T with non-uniform dTtracerLev'
128            CALL PRINT_ERROR( msgBuf , myThid)
129            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
130          ENDIF
131    #endif
132    
133  #ifndef EXACT_CONSERV  #ifndef EXACT_CONSERV
134        IF (exactConserv) THEN        IF (exactConserv) THEN
135          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
# Line 75  C-  check that CPP option is "defined" w Line 154  C-  check that CPP option is "defined" w
154        ENDIF        ENDIF
155  #endif  #endif
156    
157    #ifndef NONLIN_FRSURF
158          IF (select_rStar .NE. 0) THEN
159            WRITE(msgBuf,'(A)')
160         &   'CONFIG_CHECK: rStar is part of NonLin-FS '
161            CALL PRINT_ERROR( msgBuf, myThid)                      
162            WRITE(msgBuf,'(A)')
163         &   'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to use it'
164            CALL PRINT_ERROR( msgBuf, myThid)                      
165            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
166          ENDIF
167    #endif /* NONLIN_FRSURF */
168    
169  #ifdef USE_NATURAL_BCS  #ifdef USE_NATURAL_BCS
170          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
171       &   'CONFIG_CHECK: USE_NATURAL_BCS option has been replaced'       &   'CONFIG_CHECK: USE_NATURAL_BCS option has been replaced'
# Line 95  C       code is being compiled Line 186  C       code is being compiled
186          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
187       &  'compiled the model with the pressure loading code.'       &  'compiled the model with the pressure loading code.'
188          CALL PRINT_ERROR( msgBuf , myThid)          CALL PRINT_ERROR( msgBuf , myThid)
189          WRITE(msgBuf,'(A,A)')          WRITE(msgBuf,'(A)')
190       &  'Re-compile with:  #define ATMOSPHERIC_LOADING',       &  'Re-compile with:  #define ATMOSPHERIC_LOADING'
191       &  '              or  -DATMOSPHERIC_LOADING'          CALL PRINT_ERROR( msgBuf , myThid)
192            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
193          ENDIF
194          IF ( useRealFreshWaterFlux .AND. useThSIce ) THEN
195            WRITE(msgBuf,'(A)')
196         &  'CONFIG_CHECK: sIceLoad is computed but'
197            CALL PRINT_ERROR( msgBuf , myThid)
198            WRITE(msgBuf,'(A)')
199         &  'pressure loading code is not compiled.'
200            CALL PRINT_ERROR( msgBuf , myThid)
201            WRITE(msgBuf,'(A)')
202         &  'Re-compile with:  #define ATMOSPHERIC_LOADING'
203          CALL PRINT_ERROR( msgBuf , myThid)          CALL PRINT_ERROR( msgBuf , myThid)
204          STOP 'ABNORMAL END: S/R CONFIG_CHECK'          STOP 'ABNORMAL END: S/R CONFIG_CHECK'
205        ENDIF        ENDIF
206  #endif  #endif
207    
208    #ifndef ALLOW_GENERIC_ADVDIFF
209          IF ( tempStepping .OR. saltStepping ) THEN
210            WRITE(msgBuf,'(2A)')
211         &  'CONFIG_CHECK: cannot step forward Temp or Salt',
212         &  ' without pkg/generic_advdiff'
213            CALL PRINT_ERROR( msgBuf , 1)
214            WRITE(msgBuf,'(A)')
215         &  'Re-compile with pkg "generic_advdiff" in packages.conf'
216            CALL PRINT_ERROR( msgBuf , 1)
217            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
218          ENDIF
219    #endif
220    
221  C     o If taveFreq is finite, then we must make sure the diagnostics  C     o If taveFreq is finite, then we must make sure the diagnostics
222  C       code is being compiled  C       code is being compiled
223  #ifndef ALLOW_TIMEAVE  #ifndef ALLOW_TIMEAVE
224        IF (taveFreq.NE.0.) THEN        IF (taveFreq.NE.0.) THEN
225          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
226       &  'CONFIG_CHECK: taveFreq <> 0  but you have'       &  'CONFIG_CHECK: taveFreq <> 0  but pkg/timeave is not compiled'
227          CALL PRINT_ERROR( msgBuf , 1)          CALL PRINT_ERROR( msgBuf , 1)
228          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
229       &  'not compiled the model with the diagnostics routines.'       &  'Re-compile with pkg "timeave" in packages.conf'
230          CALL PRINT_ERROR( msgBuf , 1)          CALL PRINT_ERROR( msgBuf , 1)
231          WRITE(msgBuf,'(A,A)')          STOP 'ABNORMAL END: S/R CONFIG_CHECK'
232       &  'Re-compile with:  #define ALLOW_TIMEAVE',        ENDIF
233       &  '              or  -DALLOW_TIMEAVE'  #endif
234    
235    C     o If calendarDumps is set, pkg/cal is required
236    #ifndef ALLOW_CAL
237          IF (calendarDumps) THEN
238            WRITE(msgBuf,'(A)')
239         &  'CONFIG_CHECK: calendarDumps is set but pkg/cal is not compiled'
240          CALL PRINT_ERROR( msgBuf , 1)          CALL PRINT_ERROR( msgBuf , 1)
241            WRITE(msgBuf,'(A)')
242         &  'Re-compile with pkg "cal" in packages.conf'
243            CALL PRINT_ERROR( msgBuf , 1)
244            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
245          ENDIF
246    #endif
247    
248    #ifndef ALLOW_MATRIX
249          IF (useMATRIX) THEN
250            WRITE(msgBuf,'(A)')
251         &   'CONFIG_CHECK: useMATRIX is TRUE and #undef ALLOW_MATRIX'
252            CALL PRINT_ERROR( msgBuf , myThid)
253          STOP 'ABNORMAL END: S/R CONFIG_CHECK'          STOP 'ABNORMAL END: S/R CONFIG_CHECK'
254        ENDIF        ENDIF
255  #endif  #endif
# Line 125  C---+----1----+----2----+----3----+----4 Line 258  C---+----1----+----2----+----3----+----4
258    
259  C-  check parameter consistency :  C-  check parameter consistency :
260    
261          IF ( ( Olx.LT.3 .OR. Oly.LT.3 ) .AND.
262         &     ( viscC4leith.NE.0. .OR. viscA4Grid.NE.0.
263         &      .OR. viscA4D.NE.0. .OR. viscA4Z.NE.0. ) ) THEN
264            WRITE(msgBuf,'(A,A)')
265         &  'CONFIG_CHECK: cannot use Biharmonic Visc. (viscA4) with',
266         &  ' overlap (Olx,Oly) smaller than 3'
267            CALL PRINT_ERROR( msgBuf , myThid)
268            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
269          ENDIF                
270    
271        IF ( rigidLid .AND. implicitFreeSurface ) THEN        IF ( rigidLid .AND. implicitFreeSurface ) THEN
272          WRITE(msgBuf,'(A,A)')          WRITE(msgBuf,'(A,A)')
273       &  'CONFIG_CHECK: Cannot select both implicitFreeSurface',       &  'CONFIG_CHECK: Cannot select both implicitFreeSurface',
# Line 205  c     ENDIF Line 348  c     ENDIF
348          STOP 'ABNORMAL END: S/R CONFIG_CHECK'          STOP 'ABNORMAL END: S/R CONFIG_CHECK'
349        ENDIF        ENDIF
350    
351        IF (nonlinFreeSurf.NE.0.AND.deltaTfreesurf.NE.deltaTtracer) THEN        IF ( nonlinFreeSurf.NE.0 .AND.
352         &     deltaTfreesurf.NE.dTtracerLev(1) ) THEN
353          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
354       &   'CONFIG_CHECK: WARNING: nonlinFreeSurf might cause problems'       &   'CONFIG_CHECK: WARNING: nonlinFreeSurf might cause problems'
355          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
# Line 216  c     ENDIF Line 360  c     ENDIF
360       &                    SQUEEZE_RIGHT , myThid)                             &                    SQUEEZE_RIGHT , myThid)                      
361        ENDIF        ENDIF
362    
363        IF (useRealFreshWaterFlux .AND. exactConserv        IF ( useRealFreshWaterFlux .AND. exactConserv
364       &    .AND.startTime.NE.0. .AND. implicSurfPress.EQ.0. _d 0) THEN       &     .AND. implicDiv2DFlow.EQ.0. _d 0
365         &     .AND. startTime.NE.baseTime .AND. usePickupBeforeC54 ) THEN
366          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
367       &   'CONFIG_CHECK: RealFreshWaterFlux+implicSurfP=0+exactConserv:'       &   'CONFIG_CHECK: RealFreshWaterFlux+implicSurfP=0+exactConserv:'
368          CALL PRINT_ERROR( msgBuf , myThid)          CALL PRINT_ERROR( msgBuf , myThid)
# Line 227  c     ENDIF Line 372  c     ENDIF
372          STOP 'ABNORMAL END: S/R CONFIG_CHECK'          STOP 'ABNORMAL END: S/R CONFIG_CHECK'
373        ENDIF        ENDIF
374    
375  #ifdef NONLIN_FRSURF        IF ( useRealFreshWaterFlux .AND. .NOT.exactConserv
376         &     .AND. implicDiv2DFlow.NE.1. ) THEN
377            WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: **WARNNING** ',
378         &   'RealFreshWater & implicDiv2DFlow < 1'
379            CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
380         &                    SQUEEZE_RIGHT , myThid)                      
381            WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: works better',
382         &   ' with exactConserv=.T. (+ #define EXACT_CONSERV)'
383            CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
384         &                    SQUEEZE_RIGHT , myThid)                      
385          ENDIF
386    
387    #ifdef EXACT_CONSERV
388        IF (useRealFreshWaterFlux .AND. .NOT.exactConserv        IF (useRealFreshWaterFlux .AND. .NOT.exactConserv
389       &            .AND. buoyancyRelation.EQ.'OCEANICP' ) THEN       &            .AND. buoyancyRelation.EQ.'OCEANICP' ) THEN
390          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
# Line 239  c     ENDIF Line 396  c     ENDIF
396          STOP 'ABNORMAL END: S/R CONFIG_CHECK'          STOP 'ABNORMAL END: S/R CONFIG_CHECK'
397        ENDIF        ENDIF
398  #else  #else
       IF (useRealFreshWaterFlux .AND. exactConserv  
      &            .AND. implicSurfPress.NE.1. _d 0 ) THEN  
         WRITE(msgBuf,'(A)')  
      &   'CONFIG_CHECK: Pb with restart in this config'  
         CALL PRINT_ERROR( msgBuf , myThid)  
         WRITE(msgBuf,'(A)')  
      &   'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to fix it'  
         CALL PRINT_ERROR( msgBuf , myThid)  
         STOP 'ABNORMAL END: S/R CONFIG_CHECK'  
       ENDIF  
   
399        IF (useRealFreshWaterFlux        IF (useRealFreshWaterFlux
400       &            .AND. buoyancyRelation.EQ.'OCEANICP' ) THEN       &            .AND. buoyancyRelation.EQ.'OCEANICP' ) THEN
401          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
# Line 257  c     ENDIF Line 403  c     ENDIF
403          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
404       &                    SQUEEZE_RIGHT , myThid)                             &                    SQUEEZE_RIGHT , myThid)                      
405          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
406       &   'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to fix it'       &   'CONFIG_CHECK: ==> use #define EXACT_CONSERV to fix it'
407          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
408       &                    SQUEEZE_RIGHT , myThid)                             &                    SQUEEZE_RIGHT , myThid)                      
409        ENDIF        ENDIF
410    #endif /* EXACT_CONSERV */
411    
412        IF (select_rStar .NE. 0) THEN        IF (.NOT.useCDscheme .AND. (tauCD.NE.0. .OR. rCD.NE.-1.) ) THEN
413          WRITE(msgBuf,'(A)')  C- jmc: since useCDscheme is a new [04-13-03] flag (default=F),
414       &   'CONFIG_CHECK: rStar is part of NonLin-FS '  C       put this WARNING to stress that even if CD-scheme parameters
415    C       (tauCD,rCD) are set, CD-scheme is not used without useCDscheme=T
416    C-    and STOP if using mom_fluxform (following Chris advise).
417    C- jmc: but ultimately, this block can/will be removed.
418           IF (.NOT.vectorInvariantMomentum.AND.momStepping) THEN
419            WRITE(msgBuf,'(A)')
420         &   'CONFIG_CHECK: CD-scheme is OFF but params(tauCD,rCD) are set'
421            CALL PRINT_ERROR( msgBuf , myThid)
422            WRITE(msgBuf,'(2A)')
423         &   'CONFIG_CHECK: to turn ON CD-scheme: => "useCDscheme=.TRUE."',
424         &   ' in "data", namelist PARM01'
425            CALL PRINT_ERROR( msgBuf , myThid)
426            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
427           ENDIF
428            WRITE(msgBuf,'(2A)') '**WARNNING** ',
429         &   'CONFIG_CHECK: CD-scheme is OFF but params(tauCD,rCD) are set'
430          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
431       &                    SQUEEZE_RIGHT , myThid)                             &                    SQUEEZE_RIGHT , myThid)                      
432          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(2A)')
433       &   'CONFIG_CHECK: ==> use #define NONLIN_FRSURF to use it'       &   'CONFIG_CHECK: to turn ON CD-scheme: => "useCDscheme=.TRUE."',
434         &   ' in "data", namelist PARM01'
435          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
436       &                    SQUEEZE_RIGHT , myThid)                             &                    SQUEEZE_RIGHT , myThid)                      
437        ENDIF        ENDIF
 #endif /* NONLIN_FRSURF */  
438    
439          IF ( useCDscheme .AND. useCubedSphereExchange ) THEN
440            WRITE(msgBuf,'(2A)')
441         &   'CONFIG_CHECK: CD-scheme not implemented on CubedSphere grid'
442            CALL PRINT_ERROR( msgBuf , myThid)
443            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
444          ENDIF
445    
446          IF ( useOldFreezing .AND. allowFreezing ) THEN
447            WRITE(msgBuf,'(2A)')
448         &   'CONFIG_CHECK: cannot set both: allowFreezing & useOldFreezing'
449            CALL PRINT_ERROR( msgBuf , myThid)
450            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
451          ENDIF
452    
453          IF ( useMATRIX .AND. useGCHEM ) THEN
454            WRITE(msgBuf,'(2A)')
455         &   'CONFIG_CHECK: cannot set both: useMATRIX & useGCHEM'
456            CALL PRINT_ERROR( msgBuf , myThid)
457            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
458          ENDIF
459    
460          IF ( useMATRIX .AND. .NOT.usePTRACERS ) THEN
461            WRITE(msgBuf,'(2A)')
462         &       'CONFIG_CHECK: cannot set useMATRIX without ',
463         &       'setting usePTRACERS'
464            CALL PRINT_ERROR( msgBuf , myThid)
465            STOP 'ABNORMAL END: S/R CONFIG_CHECK'
466          ENDIF      
467          
468        WRITE(msgBuf,'(A)') 'CONFIG_CHECK: OK'        WRITE(msgBuf,'(A)') 'CONFIG_CHECK: OK'
469        CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,        CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,
470       &                   SQUEEZE_RIGHT,myThid)       &                   SQUEEZE_RIGHT,myThid)

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.24

  ViewVC Help
Powered by ViewVC 1.1.22