/[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.68 by jmc, Mon Jul 9 19:20:17 2012 UTC revision 1.77 by jmc, Wed Aug 6 23:11:49 2014 UTC
# Line 3  C $Name$ Line 3  C $Name$
3    
4  #include "PACKAGES_CONFIG.h"  #include "PACKAGES_CONFIG.h"
5  #include "CPP_OPTIONS.h"  #include "CPP_OPTIONS.h"
6    #ifdef ALLOW_MOM_COMMON
7    # include "MOM_COMMON_OPTIONS.h"
8    #endif
9    
10  CBOP  CBOP
11  C     !ROUTINE: CONFIG_CHECK  C     !ROUTINE: CONFIG_CHECK
# Line 24  C     === Global variables === Line 27  C     === Global variables ===
27  #include "SIZE.h"  #include "SIZE.h"
28  #include "EEPARAMS.h"  #include "EEPARAMS.h"
29  #include "PARAMS.h"  #include "PARAMS.h"
 c #include "GRID.h"  
30    
31  C     !INPUT/OUTPUT PARAMETERS:  C     !INPUT/OUTPUT PARAMETERS:
32  C     === Routine arguments ===  C     === Routine arguments ===
# Line 39  C     msgBuf :: Informational/error mess Line 41  C     msgBuf :: Informational/error mess
41        INTEGER errCount        INTEGER errCount
42  CEOP  CEOP
43    
44          _BEGIN_MASTER(myThid)
45          WRITE(msgBuf,'(A)')
46         &'// ======================================================='
47          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
48         &                    SQUEEZE_RIGHT, myThid )
49          WRITE(msgBuf,'(A)') '// Check Model config. (CONFIG_CHECK):'
50          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
51         &                    SQUEEZE_RIGHT, myThid )
52          _END_MASTER(myThid)
53    
54  C--   MPI + multi-threads: seems to be OK to let master-thread check & stop  C--   MPI + multi-threads: seems to be OK to let master-thread check & stop
55  C      (as long as all procs finish cleanly by calling ALL_PROC_DIE)  C      (as long as all procs finish cleanly by calling ALL_PROC_DIE)
56        _BEGIN_MASTER(myThid)        _BEGIN_MASTER(myThid)
# Line 53  C       code is being compiled Line 65  C       code is being compiled
65          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
66       &  'CONFIG_CHECK: diffKrFile is set but never used.'       &  'CONFIG_CHECK: diffKrFile is set but never used.'
67          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
68          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: ',
69       &  'Re-compile with:  #define ALLOW_3D_DIFFKR'       &  'Re-compile with: "#define ALLOW_3D_DIFFKR"'
70            CALL PRINT_ERROR( msgBuf, myThid )
71            errCount = errCount + 1
72          ENDIF
73    #endif
74    
75    #ifndef ALLOW_SMAG_3D
76          IF ( useSmag3D ) THEN
77            WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: ',
78         &  'Cannot set useSmag3D=TRUE when compiled with'
79            CALL PRINT_ERROR( msgBuf, myThid )
80            WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: ',
81         &  '"#undef ALLOW_SMAG_3D" in MOM_COMMON_OPTIONS.h'
82          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
83          errCount = errCount + 1          errCount = errCount + 1
84        ENDIF        ENDIF
# Line 127  C       code is being compiled Line 151  C       code is being compiled
151        ENDIF        ENDIF
152  #endif  #endif
153    
154  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF
155        IF ( momImplVertAdv ) THEN        IF ( momImplVertAdv ) THEN
156          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
157       &   'CONFIG_CHECK: momImplVertAdv is not yet'       &   'CONFIG_CHECK: momImplVertAdv is not yet'
# Line 221  C       code is being compiled Line 245  C       code is being compiled
245  #ifndef ALLOW_ADDFLUID  #ifndef ALLOW_ADDFLUID
246        IF ( selectAddFluid.NE.0 ) THEN        IF ( selectAddFluid.NE.0 ) THEN
247          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
248       &   'CONFIG_CHECK: #undef ALLOW_ADDFLUID and'       &   'CONFIG_CHECK: #undef ALLOW_ADDFLUID (CPP_OPTIONS.h) and'
249          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
250          WRITE(msgBuf,'(A,I4,A)') 'CONFIG_CHECK: selectAddFluid=',          WRITE(msgBuf,'(A,I4,A)') 'CONFIG_CHECK: selectAddFluid=',
251       &                           selectAddFluid, ' is not zero'       &                           selectAddFluid, ' is not zero'
# Line 238  C       code is being compiled Line 262  C       code is being compiled
262       &  'CONFIG_CHECK: pLoadFile is set but you have not'       &  'CONFIG_CHECK: pLoadFile is set but you have not'
263          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
264          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
265       &  'compiled the model with the pressure loading code.'       &  ' compiled the model with the pressure loading code.'
266          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
267          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
268       &  'Re-compile with:  #define ATMOSPHERIC_LOADING'       &  ' Re-compile with: "#define ATMOSPHERIC_LOADING"'
269          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
270          errCount = errCount + 1          errCount = errCount + 1
271        ENDIF        ENDIF
# Line 250  C       code is being compiled Line 274  C       code is being compiled
274       &  'CONFIG_CHECK: sIceLoad is computed but'       &  'CONFIG_CHECK: sIceLoad is computed but'
275          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
276          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
277       &  'pressure loading code is not compiled.'       &  ' pressure loading code is not compiled.'
278          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
279          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
280       &  'Re-compile with:  #define ATMOSPHERIC_LOADING'       &  ' Re-compile with: "#define ATMOSPHERIC_LOADING"'
281            CALL PRINT_ERROR( msgBuf, myThid )
282            errCount = errCount + 1
283          ENDIF
284    #endif
285    
286    #ifndef ALLOW_FRICTION_HEATING
287          IF ( addFrictionHeating ) THEN
288            WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: addFrictionHeating=T',
289         &  ' but FRICTIONAL_HEATING code is not compiled.'
290            CALL PRINT_ERROR( msgBuf, myThid )
291            WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: Re-compile with:',
292         &   ' "#define ALLOW_FRICTION_HEATING" (CPP_OPTIONS.h)'
293          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
294          errCount = errCount + 1          errCount = errCount + 1
295        ENDIF        ENDIF
# Line 265  C       code is being compiled Line 301  C       code is being compiled
301       &  'CONFIG_CHECK: balanceEmPmR/Qnet is set but balance code ',       &  'CONFIG_CHECK: balanceEmPmR/Qnet is set but balance code ',
302       &  'is not compiled.'       &  'is not compiled.'
303          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
304          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: ',
305       &  'Re-compile with  ALLOW_BALANCE_FLUXES defined'       &  'Re-compile with:  ALLOW_BALANCE_FLUXES defined'
306          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
307          errCount = errCount + 1          errCount = errCount + 1
308        ENDIF        ENDIF
# Line 278  C       code is being compiled Line 314  C       code is being compiled
314       &  'CONFIG_CHECK: balanceTheta/SaltClimRelax is set ',       &  'CONFIG_CHECK: balanceTheta/SaltClimRelax is set ',
315       &  'but balance code is not compiled.'       &  'but balance code is not compiled.'
316          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
317          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: ',
318       &  'Re-compile with  ALLOW_BALANCE_RELAX defined'       &  'Re-compile with  ALLOW_BALANCE_RELAX defined'
319          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
320          errCount = errCount + 1          errCount = errCount + 1
# Line 321  C--   Check parameter consistency : Line 357  C--   Check parameter consistency :
357          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
358          errCount = errCount + 1          errCount = errCount + 1
359        ENDIF        ENDIF
360          IF ( ( OLx.LT.3 .OR. OLy.LT.3 ) .AND.
361         &     useSmag3D .AND. useCDscheme ) THEN
362            WRITE(msgBuf,'(A,A)')
363         &  'CONFIG_CHECK: cannot use Smag-3D + CD-scheme with',
364         &  ' overlap (OLx,OLy) smaller than 3'
365            CALL PRINT_ERROR( msgBuf, myThid )
366            errCount = errCount + 1
367          ENDIF
368    
369  #ifndef DISCONNECTED_TILES  #ifndef DISCONNECTED_TILES
370  C     Overlaps cannot be larger than interior tile except for special cases  C     Overlaps cannot be larger than interior tile except for special cases
# Line 383  C--   Deep-Atmosphere & Anelastic limita Line 427  C--   Deep-Atmosphere & Anelastic limita
427        ENDIF        ENDIF
428    
429  C--   Free-surface related limitations:  C--   Free-surface related limitations:
430          IF ( cg2dUseMinResSol.LT.0 .OR. cg2dUseMinResSol.GT.1 ) THEN
431            WRITE(msgBuf,'(A,I10,A)')
432         &   'CONFIG_CHECK: cg2dUseMinResSol set to unvalid value(=',
433         &                  cg2dUseMinResSol, ')'
434            CALL PRINT_ERROR( msgBuf, myThid )
435            errCount = errCount + 1
436          ENDIF
437    
438        IF ( rigidLid .AND. implicitFreeSurface ) THEN        IF ( rigidLid .AND. implicitFreeSurface ) THEN
439          WRITE(msgBuf,'(A,A)')          WRITE(msgBuf,'(A,A)')
440       &  'CONFIG_CHECK: Cannot select both implicitFreeSurface',       &  'CONFIG_CHECK: Cannot select both implicitFreeSurface',
# Line 450  C--   Free-surface related limitations: Line 502  C--   Free-surface related limitations:
502          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
503          errCount = errCount + 1          errCount = errCount + 1
504        ENDIF        ENDIF
505          IF ( select_rStar.EQ.2 .AND. nonlinFreeSurf.NE.4 ) THEN
506    C-    not consistent to account for the slope of the coordinate when
507    C     ignoring the variations of level-thickness in PhiHyd calculation;
508    C     for now, issue a warning (but might change the code later on):
509            WRITE(msgBuf,'(2A,I3)') '** WARNING ** CONFIG_CHECK: ',
510         &   'select_rStar=2 not right with nonlinFreeSurf=', nonlinFreeSurf
511            CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
512         &                      SQUEEZE_RIGHT, myThid )
513          ENDIF
514    
515        IF ( selectSigmaCoord.NE.0 ) THEN        IF ( selectSigmaCoord.NE.0 ) THEN
516         IF ( fluidIsWater ) THEN         IF ( fluidIsWater ) THEN
# Line 482  c       STOP 'ABNORMAL END: S/R CONFIG_C Line 543  c       STOP 'ABNORMAL END: S/R CONFIG_C
543  c     ENDIF  c     ENDIF
544    
545        IF ( nonlinFreeSurf.NE.0 .AND.        IF ( nonlinFreeSurf.NE.0 .AND.
546       &     deltaTfreesurf.NE.dTtracerLev(1) ) THEN       &     deltaTFreeSurf.NE.dTtracerLev(1) ) THEN
547          WRITE(msgBuf,'(2A)') '** WARNING ** CONFIG_CHECK: ',          WRITE(msgBuf,'(2A)') '** WARNING ** CONFIG_CHECK: ',
548       &                       'nonlinFreeSurf might cause problems'       &                       'nonlinFreeSurf might cause problems'
549          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
# Line 571  c     ENDIF Line 632  c     ENDIF
632       &                      SQUEEZE_RIGHT, myThid )       &                      SQUEEZE_RIGHT, myThid )
633        ENDIF        ENDIF
634    
635    C--   Pressure calculation and pressure gradient:
636    #ifndef INCLUDE_PHIHYD_CALCULATION_CODE
637          IF ( momPressureForcing .OR. useDynP_inEos_Zc ) THEN
638            WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: ',
639         &   'missing code to calculate pressure (totPhiHyd)'
640            CALL PRINT_ERROR( msgBuf, myThid )
641            errCount = errCount + 1
642          ENDIF
643    #endif /* INCLUDE_PHIHYD_CALCULATION_CODE */
644          IF ( useDynP_inEos_Zc .AND. .NOT.momStepping ) THEN
645            WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: ',
646         &   'useDynP_inEos_Zc = TRUE but pressure is not computed'
647            CALL PRINT_ERROR( msgBuf, myThid )
648            errCount = errCount + 1
649          ENDIF
650    
651  C--   Non-hydrostatic and 3-D solver related limitations:  C--   Non-hydrostatic and 3-D solver related limitations:
652        IF (nonlinFreeSurf.NE.0 .AND. use3Dsolver) THEN        IF (nonlinFreeSurf.NE.0 .AND. use3Dsolver) THEN
653          WRITE(msgBuf,'(A)')          WRITE(msgBuf,'(A)')
# Line 641  C--   Momentum related limitations: Line 718  C--   Momentum related limitations:
718          errCount = errCount + 1          errCount = errCount + 1
719         ENDIF         ENDIF
720        ENDIF        ENDIF
721          IF ( .NOT.vectorInvariantMomentum .AND. momAdvection ) THEN
722           IF ( usingCurvilinearGrid ) THEN
723            WRITE(msgBuf,'(2A)') '** WARNING ** CONFIG_CHECK: ',
724         &       'missing metric-terms for CurvilinearGrid'
725            CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
726         &                      SQUEEZE_RIGHT, myThid )
727           ENDIF
728           IF ( hasWetCSCorners ) THEN
729            WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: momAdvection ',
730         &   'in flux-form is wrong on CubedSphere grid (corners)'
731            CALL PRINT_ERROR( msgBuf, myThid )
732            errCount = errCount + 1
733           ENDIF
734          ENDIF
735        IF ( selectCoriMap.LT.0 .OR. selectCoriMap.GT.3 ) THEN        IF ( selectCoriMap.LT.0 .OR. selectCoriMap.GT.3 ) THEN
736          WRITE(msgBuf,'(2A,I4)') 'CONFIG_CHECK: ',          WRITE(msgBuf,'(2A,I4)') 'CONFIG_CHECK: ',
737       &       'Invalid option: selectCoriMap=', selectCoriMap       &       'Invalid option: selectCoriMap=', selectCoriMap
738          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
739          errCount = errCount + 1          errCount = errCount + 1
740        ENDIF        ENDIF
741          IF ( useSmag3D .AND.
742         &    ( usingPCoords .OR. deepAtmosphere .OR. selectSigmaCoord.NE.0
743         &                   .OR. rhoRefFile.NE.' ' .OR. hasWetCSCorners )
744         &   ) THEN
745            WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: ',
746         &       'Smag-3D not yet implemented for this set-up'
747            CALL PRINT_ERROR( msgBuf, myThid )
748            errCount = errCount + 1
749          ENDIF
750    
751        IF (.NOT.useCDscheme .AND. (tauCD.NE.0. .OR. rCD.NE.-1.) ) THEN        IF (.NOT.useCDscheme .AND. (tauCD.NE.0. .OR. rCD.NE.-1.) ) THEN
752  C- jmc: since useCDscheme is a new [04-13-03] flag (default=F),  C- jmc: since useCDscheme is a new [04-13-03] flag (default=F),
# Line 668  C- jmc: but ultimately, this block can/w Line 768  C- jmc: but ultimately, this block can/w
768       &   'CD-scheme is OFF but params(tauCD,rCD) are set'       &   'CD-scheme is OFF but params(tauCD,rCD) are set'
769          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
770       &                      SQUEEZE_RIGHT, myThid )       &                      SQUEEZE_RIGHT, myThid )
         WRITE(msgBuf,'(3A)') '** WARNING ** ',  
      &   'to turn ON CD-scheme: => "useCDscheme=.TRUE."',  
      &   ' in "data", namelist PARM01'  
771          WRITE(msgBuf,'(3A)') '** WARNING ** to turn ON CD-scheme:',          WRITE(msgBuf,'(3A)') '** WARNING ** to turn ON CD-scheme:',
772       &   ' => "useCDscheme=.TRUE." in "data", namelist PARM01'       &   ' => "useCDscheme=.TRUE." in "data", namelist PARM01'
773          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,          CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
774       &                      SQUEEZE_RIGHT, myThid )       &                      SQUEEZE_RIGHT, myThid )
775        ENDIF        ENDIF
776    
777        IF ( useCDscheme .AND. useCubedSphereExchange ) THEN        IF ( useCDscheme .AND. hasWetCSCorners ) THEN
778          WRITE(msgBuf,'(2A)')          WRITE(msgBuf,'(2A)')
779       &   'CONFIG_CHECK: CD-scheme not implemented on CubedSphere grid'       &   'CONFIG_CHECK: CD-scheme not implemented on CubedSphere grid'
780          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
781  cph        errCount = errCount + 1          errCount = errCount + 1
782        ENDIF        ENDIF
783    
784  C--   Time-stepping limitations  C--   Time-stepping limitations
785          IF ( implicitIntGravWave .AND. staggerTimeStep ) THEN
786            WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: staggerTimeStep',
787         &    ' incompatible with implicitIntGravWave'
788            CALL PRINT_ERROR( msgBuf, myThid )
789            errCount = errCount + 1
790          ENDIF
791        IF ( momForcingOutAB.NE.0 .AND. momForcingOutAB.NE.1 ) THEN        IF ( momForcingOutAB.NE.0 .AND. momForcingOutAB.NE.1 ) THEN
792          WRITE(msgBuf,'(A,I10,A)') 'CONFIG_CHECK: momForcingOutAB=',          WRITE(msgBuf,'(A,I10,A)') 'CONFIG_CHECK: momForcingOutAB=',
793       &                             momForcingOutAB, ' not allowed'       &                             momForcingOutAB, ' not allowed'
# Line 703  C--   Time-stepping limitations Line 806  C--   Time-stepping limitations
806          CALL PRINT_ERROR( msgBuf, myThid )          CALL PRINT_ERROR( msgBuf, myThid )
807          errCount = errCount + 1          errCount = errCount + 1
808        ENDIF        ENDIF
809          IF ( addFrictionHeating .AND. .NOT.staggerTimeStep ) THEN
810            WRITE(msgBuf,'(2A)') 'CONFIG_CHECK: addFrictionHeating',
811         &  ' not yet coded for synchronous time-stepping.'
812            CALL PRINT_ERROR( msgBuf, myThid )
813            errCount = errCount + 1
814          ENDIF
815    
816  C--   Grid limitations:  C--   Grid limitations:
817        IF ( rotateGrid ) THEN        IF ( rotateGrid ) THEN
# Line 758  C--   Packages conflict Line 867  C--   Packages conflict
867  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
868    
869        _BEGIN_MASTER(myThid)        _BEGIN_MASTER(myThid)
       WRITE(msgBuf,'(A)')  
      &'// ======================================================='  
       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,  
      &                    SQUEEZE_RIGHT, myThid )  
870        WRITE(msgBuf,'(A)') '// CONFIG_CHECK : Normal End'        WRITE(msgBuf,'(A)') '// CONFIG_CHECK : Normal End'
871        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
872       &                    SQUEEZE_RIGHT, myThid )       &                    SQUEEZE_RIGHT, myThid )

Legend:
Removed from v.1.68  
changed lines
  Added in v.1.77

  ViewVC Help
Powered by ViewVC 1.1.22