Back to home page

MITgcm

 
 

    


File indexing completed on 2023-12-05 06:10:57 UTC

view on githubraw file Latest commit 143d9ce8 on 2023-12-04 15:35:20 UTC
809c36b928 Patr*0001 #include "SEAICE_OPTIONS.h"
b0c32e7c62 Jean*0002 #ifdef ALLOW_EXF
                0003 # include "EXF_OPTIONS.h"
                0004 #endif
772b2ed80e Gael*0005 #ifdef ALLOW_AUTODIFF
                0006 # include "AUTODIFF_OPTIONS.h"
                0007 #endif
809c36b928 Patr*0008 
a7a2228515 Jean*0009 CBOP
                0010 C     !ROUTINE: SEAICE_CHECK
                0011 C     !INTERFACE:
809c36b928 Patr*0012       SUBROUTINE SEAICE_CHECK( myThid )
a7a2228515 Jean*0013 
                0014 C     !DESCRIPTION: \bv
8e92ca36c0 Jean*0015 C     *==========================================================*
a7a2228515 Jean*0016 C     | S/R SEAICE_CHECK
8e92ca36c0 Jean*0017 C     | o Validate basic package setup and inter-package
a7a2228515 Jean*0018 C     |   dependencies.
8e92ca36c0 Jean*0019 C     *==========================================================*
a7a2228515 Jean*0020 C     \ev
                0021 
                0022 C     !USES:
809c36b928 Patr*0023       IMPLICIT NONE
                0024 
                0025 C     === Global variables ===
                0026 #include "SIZE.h"
                0027 #include "EEPARAMS.h"
                0028 #include "PARAMS.h"
358649780a Gael*0029 #ifdef ALLOW_EXF
                0030 # include "EXF_PARAM.h"
                0031 #endif
ceae9498ad Gael*0032 #include "GRID.h"
ccaa3c61f4 Patr*0033 #include "SEAICE_SIZE.h"
6060ec2938 Dimi*0034 #include "SEAICE_PARAMS.h"
cf9fa44a59 Patr*0035 #include "SEAICE.h"
ccaa3c61f4 Patr*0036 #include "SEAICE_TRACER.h"
e0fa1cecbf Mart*0037 #ifdef ALLOW_GENERIC_ADVDIFF
                0038 # include "GAD.h"
                0039 #endif /* ALLOW_GENERIC_ADVDIFF */
a7a2228515 Jean*0040 C     !INPUT/OUTPUT PARAMETERS:
809c36b928 Patr*0041 C     === Routine arguments ===
a7a2228515 Jean*0042 C     myThid     :: my Thread Id. number
809c36b928 Patr*0043       INTEGER myThid
a7a2228515 Jean*0044 CEOP
809c36b928 Patr*0045 
a7a2228515 Jean*0046 C     !LOCAL VARIABLES:
809c36b928 Patr*0047 C     === Local variables ===
c3a5b6decf Jean*0048 C     ioUnit     :: temp for writing msg unit
a7a2228515 Jean*0049 C     msgBuf     :: Informational/error message buffer
dc26f158aa Mart*0050 C     errCount   :: error counter
c3a5b6decf Jean*0051       INTEGER ioUnit
809c36b928 Patr*0052       CHARACTER*(MAX_LEN_MBUF) msgBuf
1819581090 Mart*0053       LOGICAL checkAdvSchArea, checkAdvSchHeff, checkAdvSchSnow
e54fe3e1f9 Gael*0054       LOGICAL checkAdvSchSalt
8bc8bee483 Gael*0055 #ifdef ALLOW_SITRACER
                0056       INTEGER iTracer
                0057 #endif
ceae9498ad Gael*0058       _RL SEAICE_mcphee_max
0320e25227 Mart*0059       INTEGER  kSrf
3c7d68edf4 Mart*0060       INTEGER  i
dc26f158aa Mart*0061       INTEGER  errCount
3c7d68edf4 Mart*0062       INTEGER  ILNBLNK
                0063       EXTERNAL ILNBLNK
a7a2228515 Jean*0064 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0065 
0320e25227 Mart*0066       IF ( usingPCoords ) THEN
                0067        kSrf        = Nr
ceae9498ad Gael*0068       ELSE
0320e25227 Mart*0069        kSrf        = 1
ceae9498ad Gael*0070       ENDIF
c3a5b6decf Jean*0071       ioUnit = errorMessageUnit
ceae9498ad Gael*0072 
835bd4f8b2 Jean*0073       _BEGIN_MASTER(myThid)
                0074 
cee16b76ae Dimi*0075 C--   ALLOW_SEAICE
809c36b928 Patr*0076       WRITE(msgBuf,'(A)') 'SEAICE_CHECK: #define ALLOW_SEAICE'
                0077       CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
3efa3cc6e1 Jean*0078      &     SQUEEZE_RIGHT, myThid )
809c36b928 Patr*0079 
dc26f158aa Mart*0080       errCount = 0
                0081 
0f1d4cfc8d Dimi*0082 C--   SEAICE needs forcing_In_AB FALSE
34d6f142df Jean*0083       IF (tracForcingOutAB.NE.1) THEN
                0084          WRITE(msgBuf,'(2A)') 'SEAICE_CHECK:',
                0085      &         ' Need T,S forcing out of AB (tracForcingOutAB=1)'
835bd4f8b2 Jean*0086          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0087          errCount = errCount + 1
0f1d4cfc8d Dimi*0088       ENDIF
                0089 
fa64f6674f Jean*0090 C-------------------------------------------------
                0091 C--   Check seaice thermodynamics setting:
                0092       IF ( usePW79thermodynamics ) THEN
                0093 
65f34462d4 Gael*0094 C--   check ice cover fraction formula
fa64f6674f Jean*0095        IF ((SEAICE_areaGainFormula.LT.1).OR.
                0096      &     (SEAICE_areaGainFormula.GT.2)) THEN
65f34462d4 Gael*0097          WRITE(msgBuf,'(2A)') 'SEAICE_CHECK:',
6ec4646d60 Gael*0098      &         ' SEAICE_areaGainFormula must be between 1 and 2'
65f34462d4 Gael*0099          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0100          errCount = errCount + 1
fa64f6674f Jean*0101        ENDIF
                0102        IF ((SEAICE_areaLossFormula.LT.1).OR.
                0103      &     (SEAICE_areaLossFormula.GT.3)) THEN
6ec4646d60 Gael*0104          WRITE(msgBuf,'(2A)') 'SEAICE_CHECK:',
                0105      &         ' SEAICE_areaLossFormula must be between 1 and 2'
                0106          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0107          errCount = errCount + 1
fa64f6674f Jean*0108        ENDIF
6ec4646d60 Gael*0109 
fa64f6674f Jean*0110        IF ( (.NOT.SEAICE_doOpenWaterGrowth)
6ec4646d60 Gael*0111      &   .AND.( (SEAICE_areaGainFormula.NE.2).OR.
                0112      &          (SEAICE_areaLossFormula.NE.3) ) ) THEN
                0113         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
                0114      &       'when SEAICE_doOpenWaterGrowth is false, you need to set'
                0115         CALL PRINT_ERROR( msgBuf, myThid )
                0116         WRITE(msgBuf,'(A)')
                0117      &   'SEAICE_areaGainFormula.EQ.2 and SEAICE_areaLossFormula.EQ.3'
                0118         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0119         errCount = errCount + 1
fa64f6674f Jean*0120        ENDIF
6ec4646d60 Gael*0121 
ceae9498ad Gael*0122 C--   check concistency of turbulent flux term etc. specification
                0123 
0320e25227 Mart*0124        SEAICE_mcphee_max=drF(kSrf)/SEAICE_deltaTtherm
                0125        IF ( usingPCoords ) SEAICE_mcphee_max
                0126      &      = SEAICE_mcphee_max * recip_rhoConst * recip_gravity
fa64f6674f Jean*0127        IF ( SEAICE_mcPheePiston .LT. 0. _d 0 .OR.
                0128      &      SEAICE_mcPheePiston .GT. SEAICE_mcphee_max ) THEN
                0129         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK:',
                0130      &   ' SEAICE_mcPheePiston is out of bounds.'
                0131         CALL PRINT_ERROR( msgBuf, myThid )
                0132         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK:',
                0133      &   ' They must lie within 0. and drF(1)/SEAICE_deltaTtherm'
                0134         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0135         errCount = errCount + 1
fa64f6674f Jean*0136        ENDIF
8bc8bee483 Gael*0137 
fa64f6674f Jean*0138        IF ( ( SEAICE_frazilFrac .LT. 0. _d 0 ) .OR.
                0139      &      ( SEAICE_frazilFrac .GT. 1. _d 0 ) ) THEN
                0140         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK:',
                0141      &   ' SEAICE_frazilFrac is out of bounds.'
                0142         CALL PRINT_ERROR( msgBuf, myThid )
                0143         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK:',
                0144      &   ' They must lie within 0. and 1. '
                0145         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0146         errCount = errCount + 1
fa64f6674f Jean*0147        ENDIF
8bc8bee483 Gael*0148 
fa64f6674f Jean*0149        IF ( ( SEAICE_mcPheeTaper .LT. 0. _d 0 ) .OR.
                0150      &      ( SEAICE_mcPheeTaper .GT. 1. _d 0 ) ) THEN
                0151         WRITE(msgBuf,'(2A)')
1c278edd09 Jean*0152      &      'SEAICE_mcPheeTaper cannot be specified  ',
8bc8bee483 Gael*0153      &      'outside of the [0. 1.] range'
fa64f6674f Jean*0154         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0155         errCount = errCount + 1
fa64f6674f Jean*0156        ENDIF
8bc8bee483 Gael*0157 
fa64f6674f Jean*0158        IF ( SEAICE_doOpenWaterMelt .AND.
                0159      &      (.NOT.SEAICE_doOpenWaterGrowth) ) THEN
6ec4646d60 Gael*0160         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
                0161      &       'to use SEAICE_doOpenWaterMelt, you need to '
                0162         CALL PRINT_ERROR( msgBuf, myThid )
                0163         WRITE(msgBuf,'(A)')
                0164      &   'also set SEAICE_doOpenWaterGrowth to .TRUE.'
                0165         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0166         errCount = errCount + 1
                0167        ENDIF
                0168 
                0169 C     check albedos
                0170        IF ( SEAICE_dryIceAlb .GT. SEAICE_drySnowAlb ) THEN
                0171         WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: ',
                0172      &       'SEAICE_dryIceAlb > SEAICE_drySnowAlb makes little sense'
                0173         CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0174      &                      SQUEEZE_RIGHT, myThid )
                0175         WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: and leads ',
                0176      &       'to albedo = SEAICE_drySnowAlb for all snow thicknesses'
                0177         CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0178      &                      SQUEEZE_RIGHT, myThid )
                0179        ENDIF
                0180        IF ( SEAICE_wetIceAlb .GT. SEAICE_wetSnowAlb ) THEN
                0181         WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: ',
                0182      &       'SEAICE_wetIceAlb > SEAICE_wetSnowAlb makes little sense'
                0183         CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0184      &                      SQUEEZE_RIGHT, myThid )
                0185         WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: and leads ',
                0186      &       'to albedo = SEAICE_wetSnowAlb for all snow thicknesses'
                0187         CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0188      &                      SQUEEZE_RIGHT, myThid )
                0189        ENDIF
                0190        IF ( SEAICE_dryIceAlb_south .GT. SEAICE_drySnowAlb_south ) THEN
                0191         WRITE(msgBuf,'(3A)') '** WARNING ** SEAICE_CHECK: ',
                0192      &       'SEAICE_dryIceAlb_south > SEAICE_drySnowAlb_south ',
                0193      &       'makes little sense'
                0194         CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0195      &                      SQUEEZE_RIGHT, myThid )
                0196         WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: and leads ',
                0197      &  'to albedo = SEAICE_drySnowAlb_south for all snow thicknesses'
                0198         CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0199      &                      SQUEEZE_RIGHT, myThid )
                0200        ENDIF
                0201        IF ( SEAICE_wetIceAlb_south .GT. SEAICE_wetSnowAlb_south ) THEN
                0202         WRITE(msgBuf,'(3A)') '** WARNING ** SEAICE_CHECK: ',
                0203      &       'SEAICE_wetIceAlb_south > SEAICE_wetSnowAlb_south ',
                0204      &       'makes little sense'
                0205         CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0206      &                      SQUEEZE_RIGHT, myThid )
                0207         WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: and leads ',
                0208      &  'to albedo = SEAICE_wetSnowAlb_south for all snow thicknesses'
                0209         CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                0210      &                      SQUEEZE_RIGHT, myThid )
fa64f6674f Jean*0211        ENDIF
                0212 
                0213 C--   end if usePW79thermodynamics
6ec4646d60 Gael*0214       ENDIF
fa64f6674f Jean*0215 C--   Checking seaice thermodynamics setting: end
                0216 C-------------------------------------------------
e6353c27c4 Gael*0217 
8bc8bee483 Gael*0218 C--   check specifications of new features for testing
                0219 
7e00d7e8f9 Jean*0220 #ifdef ALLOW_BALANCE_FLUXES
                0221       IF ( usePW79thermodynamics .AND. selectBalanceEmPmR.EQ.2 ) THEN
                0222         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
                0223      &       'selectBalanceEmPmR=2 not yet implemented in pkg/seaice'
                0224         CALL PRINT_ERROR( msgBuf, myThid )
                0225         errCount = errCount + 1
                0226       ENDIF
                0227 #endif
                0228 
e6353c27c4 Gael*0229 #ifdef SEAICE_DISABLE_HEATCONSFIX
                0230       IF ( SEAICEheatConsFix ) THEN
                0231         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
                0232      &       'to use SEAICEheatConsFix, you need to '
                0233         CALL PRINT_ERROR( msgBuf, myThid )
                0234         WRITE(msgBuf,'(A)')
                0235      &   'undef SEAICE_DISABLE_HEATCONSFIX and recompile'
                0236         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0237         errCount = errCount + 1
e6353c27c4 Gael*0238       ENDIF
                0239 #endif
                0240 
8bc8bee483 Gael*0241 #ifndef ALLOW_SITRACER
                0242       IF ( SEAICE_salinityTracer ) THEN
                0243         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
                0244      &       'to use SEAICE_salinityTracer, you need to '
                0245         CALL PRINT_ERROR( msgBuf, myThid )
                0246         WRITE(msgBuf,'(A)')
                0247      &   'define ALLOW_SITRACER and recompile'
                0248         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0249         errCount = errCount + 1
8bc8bee483 Gael*0250       ENDIF
                0251 
                0252       IF ( SEAICE_ageTracer ) THEN
                0253         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
                0254      &       'to use SEAICE_ageTracer, you need to '
                0255         CALL PRINT_ERROR( msgBuf, myThid )
                0256         WRITE(msgBuf,'(A)')
                0257      &   'define ALLOW_SITRACER and recompile'
                0258         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0259         errCount = errCount + 1
8bc8bee483 Gael*0260       ENDIF
                0261 #endif
                0262 
                0263 C--   check SItracer specifications
                0264 #ifdef ALLOW_SITRACER
                0265 
                0266 c to be added : if SEAICE_salinityTracer we need one tracer doing that
                0267 c to be added : if SEAICE_ageTracer we suggest that one tracer does that
                0268 
                0269       DO iTracer = 1, SItrNumInUse
                0270 
                0271       IF ( ( SItrFromOceanFrac(iTracer) .LT. 0. _d 0 ) .OR.
                0272      &     ( SItrFromOceanFrac(iTracer) .GT. 1. _d 0 ) ) THEN
1c278edd09 Jean*0273          WRITE(msgBuf,'(2A)')
                0274      &      'SItrFromOceanFrac cannot be specified  ',
8bc8bee483 Gael*0275      &      'outside of the [0. 1.] range'
3efa3cc6e1 Jean*0276          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0277          errCount = errCount + 1
8bc8bee483 Gael*0278       ENDIF
                0279 
                0280       IF ( ( SItrFromFloodFrac(iTracer) .LT. 0. _d 0 ) .OR.
                0281      &     ( SItrFromFloodFrac(iTracer) .GT. 1. _d 0 ) ) THEN
1c278edd09 Jean*0282          WRITE(msgBuf,'(2A)')
                0283      &      'SItrFromFloodFrac cannot be specified  ',
8bc8bee483 Gael*0284      &      'outside of the [0. 1.] range'
3efa3cc6e1 Jean*0285          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0286          errCount = errCount + 1
8bc8bee483 Gael*0287       ENDIF
                0288 
                0289 c      IF ( (SItrName(iTracer).EQ.'salinity') .AND.
                0290 c     &     (SItrMate(iTracer).NE.'HEFF') ) THEN
1c278edd09 Jean*0291 c         WRITE(msgBuf,'(2A)')
                0292 c     &      'SItrName = "salinity" requires  ',
8bc8bee483 Gael*0293 c     &      'SItrMate = "HEFF" '
3efa3cc6e1 Jean*0294 c         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0295 c         errCount = errCount + 1
8bc8bee483 Gael*0296 c      ENDIF
                0297 
                0298       IF ( (SItrName(iTracer).NE.'salinity').AND.
                0299      &     ( (SItrFromOceanFrac(iTracer).NE.ZERO).OR.
                0300      &       (SItrFromFloodFrac(iTracer).NE.ZERO) ) ) THEN
1c278edd09 Jean*0301          WRITE(msgBuf,'(2A)')
                0302      &      'SItrFromOceanFrac / SItrFromFloodFrac is only  ',
8bc8bee483 Gael*0303      &      'available for SItrName = "salinity" (for now)'
3efa3cc6e1 Jean*0304          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0305          errCount = errCount + 1
8bc8bee483 Gael*0306       ENDIF
                0307 
                0308       ENDDO
1c278edd09 Jean*0309 #endif
                0310 
1819581090 Mart*0311 C--   Check advection schemes
e0fa1cecbf Mart*0312 #ifdef ALLOW_GENERIC_ADVDIFF
1819581090 Mart*0313       checkAdvSchArea = SEAICEadvArea .AND. (
                0314      &     SEAICEadvSchArea.NE.ENUM_UPWIND_1RST .AND.
                0315      &     SEAICEadvSchArea.NE.ENUM_CENTERED_2ND .AND.
                0316      &     SEAICEadvSchArea.NE.ENUM_DST2 .AND.
                0317      &     SEAICEadvSchArea.NE.ENUM_FLUX_LIMIT .AND.
                0318      &     SEAICEadvSchArea.NE.ENUM_DST3 .AND.
                0319      &     SEAICEadvSchArea.NE.ENUM_DST3_FLUX_LIMIT .AND.
83ddf5a6c6 Mart*0320      &     SEAICEadvSchArea.NE.ENUM_PPM_NULL_LIMIT  .AND.
                0321      &     SEAICEadvSchArea.NE.ENUM_PPM_MONO_LIMIT  .AND.
                0322      &     SEAICEadvSchArea.NE.ENUM_PPM_WENO_LIMIT  .AND.
                0323      &     SEAICEadvSchArea.NE.ENUM_PQM_NULL_LIMIT  .AND.
                0324      &     SEAICEadvSchArea.NE.ENUM_PQM_MONO_LIMIT  .AND.
                0325      &     SEAICEadvSchArea.NE.ENUM_PQM_WENO_LIMIT  .AND.
1819581090 Mart*0326      &     SEAICEadvSchArea.NE.ENUM_OS7MP )
                0327       checkAdvSchHEFF = SEAICEadvHeff .AND. (
                0328      &     SEAICEadvSchHeff.NE.ENUM_UPWIND_1RST .AND.
                0329      &     SEAICEadvSchHeff.NE.ENUM_CENTERED_2ND .AND.
                0330      &     SEAICEadvSchHeff.NE.ENUM_DST2 .AND.
                0331      &     SEAICEadvSchHeff.NE.ENUM_FLUX_LIMIT .AND.
                0332      &     SEAICEadvSchHeff.NE.ENUM_DST3 .AND.
                0333      &     SEAICEadvSchHeff.NE.ENUM_DST3_FLUX_LIMIT .AND.
83ddf5a6c6 Mart*0334      &     SEAICEadvSchHeff.NE.ENUM_PPM_NULL_LIMIT  .AND.
                0335      &     SEAICEadvSchHeff.NE.ENUM_PPM_MONO_LIMIT  .AND.
                0336      &     SEAICEadvSchHeff.NE.ENUM_PPM_WENO_LIMIT  .AND.
                0337      &     SEAICEadvSchHeff.NE.ENUM_PQM_NULL_LIMIT  .AND.
                0338      &     SEAICEadvSchHeff.NE.ENUM_PQM_MONO_LIMIT  .AND.
                0339      &     SEAICEadvSchHeff.NE.ENUM_PQM_WENO_LIMIT  .AND.
1819581090 Mart*0340      &     SEAICEadvSchHeff.NE.ENUM_OS7MP )
                0341       checkAdvSchSnow = SEAICEadvSnow .AND. (
                0342      &     SEAICEadvSchSnow.NE.ENUM_UPWIND_1RST .AND.
                0343      &     SEAICEadvSchSnow.NE.ENUM_CENTERED_2ND .AND.
                0344      &     SEAICEadvSchSnow.NE.ENUM_DST2 .AND.
                0345      &     SEAICEadvSchSnow.NE.ENUM_FLUX_LIMIT .AND.
                0346      &     SEAICEadvSchSnow.NE.ENUM_DST3 .AND.
                0347      &     SEAICEadvSchSnow.NE.ENUM_DST3_FLUX_LIMIT .AND.
83ddf5a6c6 Mart*0348      &     SEAICEadvSchSnow.NE.ENUM_PPM_NULL_LIMIT  .AND.
                0349      &     SEAICEadvSchSnow.NE.ENUM_PPM_MONO_LIMIT  .AND.
                0350      &     SEAICEadvSchSnow.NE.ENUM_PPM_WENO_LIMIT  .AND.
                0351      &     SEAICEadvSchSnow.NE.ENUM_PQM_NULL_LIMIT  .AND.
                0352      &     SEAICEadvSchSnow.NE.ENUM_PQM_MONO_LIMIT  .AND.
                0353      &     SEAICEadvSchSnow.NE.ENUM_PQM_WENO_LIMIT  .AND.
1819581090 Mart*0354      &     SEAICEadvSchSnow.NE.ENUM_OS7MP )
                0355       checkAdvSchSalt = SEAICEadvSalt .AND. (
                0356      &     SEAICEadvSchSalt.NE.ENUM_UPWIND_1RST .AND.
                0357      &     SEAICEadvSchSalt.NE.ENUM_CENTERED_2ND .AND.
                0358      &     SEAICEadvSchSalt.NE.ENUM_DST2 .AND.
                0359      &     SEAICEadvSchSalt.NE.ENUM_FLUX_LIMIT .AND.
                0360      &     SEAICEadvSchSalt.NE.ENUM_DST3 .AND.
                0361      &     SEAICEadvSchSalt.NE.ENUM_DST3_FLUX_LIMIT .AND.
83ddf5a6c6 Mart*0362      &     SEAICEadvSchSalt.NE.ENUM_PPM_NULL_LIMIT  .AND.
                0363      &     SEAICEadvSchSalt.NE.ENUM_PPM_MONO_LIMIT  .AND.
                0364      &     SEAICEadvSchSalt.NE.ENUM_PPM_WENO_LIMIT  .AND.
                0365      &     SEAICEadvSchSalt.NE.ENUM_PQM_NULL_LIMIT  .AND.
                0366      &     SEAICEadvSchSalt.NE.ENUM_PQM_MONO_LIMIT  .AND.
                0367      &     SEAICEadvSchSalt.NE.ENUM_PQM_WENO_LIMIT  .AND.
8c02537f20 Jean*0368      &     SEAICEadvSchSalt.NE.ENUM_OS7MP )
                0369       IF ( checkAdvSchArea .OR. checkAdvSchHeff .OR.
e54fe3e1f9 Gael*0370      &     checkAdvSchSnow .OR. checkAdvSchSalt ) THEN
f681b7f5d4 Dimi*0371        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: allowed advection schemes',
e54fe3e1f9 Gael*0372      &          ' for heff, area, snow, and salt are: '
1819581090 Mart*0373        CALL PRINT_ERROR( msgBuf, myThid )
83ddf5a6c6 Mart*0374        WRITE(msgBuf,'(A,13I3)') 'SEAICE_CHECK:',
1819581090 Mart*0375      &      ENUM_UPWIND_1RST, ENUM_CENTERED_2ND, ENUM_DST2,
8c02537f20 Jean*0376      &      ENUM_FLUX_LIMIT, ENUM_DST3, ENUM_DST3_FLUX_LIMIT,
83ddf5a6c6 Mart*0377      &      ENUM_PPM_NULL_LIMIT,ENUM_PPM_MONO_LIMIT,ENUM_PPM_WENO_LIMIT,
                0378      &      ENUM_PQM_NULL_LIMIT,ENUM_PQM_MONO_LIMIT,ENUM_PQM_WENO_LIMIT,
1819581090 Mart*0379      &      ENUM_OS7MP
                0380        CALL PRINT_ERROR( msgBuf, myThid )
                0381        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK:',
83ddf5a6c6 Mart*0382      &      ' the following Adv.Schemes are not allowed:'
1819581090 Mart*0383        CALL PRINT_ERROR( msgBuf, myThid )
8e92ca36c0 Jean*0384        IF ( checkAdvSchArea ) THEN
                0385         WRITE(msgBuf,'(2A,I3)') 'SEAICE_CHECK:',
                0386      &       ' SEAICEadvSchArea = ',  SEAICEadvSchArea
                0387         CALL PRINT_ERROR( msgBuf, myThid )
                0388        ENDIF
                0389        IF ( checkAdvSchHeff ) THEN
                0390         WRITE(msgBuf,'(2A,I3)') 'SEAICE_CHECK:',
                0391      &       ' SEAICEadvSchHeff = ',  SEAICEadvSchHeff
                0392         CALL PRINT_ERROR( msgBuf, myThid )
                0393        ENDIF
                0394        IF ( checkAdvSchSnow ) THEN
                0395         WRITE(msgBuf,'(2A,I3)') 'SEAICE_CHECK:',
                0396      &       ' SEAICEadvSchSnow = ',  SEAICEadvSchSnow
                0397         CALL PRINT_ERROR( msgBuf, myThid )
                0398        ENDIF
                0399        IF ( checkAdvSchSalt ) THEN
                0400         WRITE(msgBuf,'(2A,I3)') 'SEAICE_CHECK:',
                0401      &       ' SEAICEadvSchSalt = ',  SEAICEadvSchSalt
                0402         CALL PRINT_ERROR( msgBuf, myThid )
                0403        ENDIF
dc26f158aa Mart*0404        errCount = errCount + 1
1819581090 Mart*0405       ENDIF
8e92ca36c0 Jean*0406       IF ( SEAICEadvScheme.EQ.ENUM_CENTERED_2ND ) THEN
                0407 C-- for now, the code does not allow to use the default advection scheme
                0408 C    (Centered 2nd order) for 1 ice-field and an other advection scheme
                0409 C    for an other ice-field. In this case, stop here.
                0410         checkAdvSchArea = SEAICEadvArea .AND.
                0411      &     SEAICEadvSchArea.NE.ENUM_CENTERED_2ND
                0412         checkAdvSchHEFF = SEAICEadvHeff .AND.
                0413      &     SEAICEadvSchHeff.NE.ENUM_CENTERED_2ND
                0414         checkAdvSchSnow = SEAICEadvSnow .AND.
                0415      &     SEAICEadvSchSnow.NE.ENUM_CENTERED_2ND
                0416         checkAdvSchSalt = SEAICEadvSalt .AND.
                0417      &     SEAICEadvSchSalt.NE.ENUM_CENTERED_2ND
e0fa1cecbf Mart*0418 #else /* not ALLOW_GENERIC_ADVDIFF */
                0419       IF ( SEAICEadvScheme.EQ.2 ) THEN
                0420 C-- for now, the code does not allow to use the default advection scheme
                0421 C    (Centered 2nd order) for 1 ice-field and an other advection scheme
                0422 C    for an other ice-field. In this case, stop here.
                0423         checkAdvSchArea = SEAICEadvArea .AND.
                0424      &     SEAICEadvSchArea.NE.2
                0425         checkAdvSchHEFF = SEAICEadvHeff .AND.
                0426      &     SEAICEadvSchHeff.NE.2
                0427         checkAdvSchSnow = SEAICEadvSnow .AND.
                0428      &     SEAICEadvSchSnow.NE.2
                0429         checkAdvSchSalt = SEAICEadvSalt .AND.
                0430      &     SEAICEadvSchSalt.NE.2
                0431 #endif /* ALLOW_GENERIC_ADVDIFF */
8e92ca36c0 Jean*0432        IF ( checkAdvSchArea .OR. checkAdvSchHeff .OR.
e54fe3e1f9 Gael*0433      &      checkAdvSchSnow .OR. checkAdvSchSalt ) THEN
8e92ca36c0 Jean*0434         WRITE(msgBuf,'(A,I3,A)') 'SEAICE_CHECK: SEAICEadvScheme=',
                0435      &   SEAICEadvScheme, ' not compatible with those Adv.Scheme:'
                0436         CALL PRINT_ERROR( msgBuf, myThid )
                0437         IF ( checkAdvSchArea ) THEN
                0438          WRITE(msgBuf,'(2A,I3)') 'SEAICE_CHECK:',
                0439      &        ' SEAICEadvSchArea = ',  SEAICEadvSchArea
                0440          CALL PRINT_ERROR( msgBuf, myThid )
                0441         ENDIF
                0442         IF ( checkAdvSchHeff ) THEN
                0443          WRITE(msgBuf,'(2A,I3)') 'SEAICE_CHECK:',
                0444      &        ' SEAICEadvSchHeff = ',  SEAICEadvSchHeff
                0445          CALL PRINT_ERROR( msgBuf, myThid )
                0446         ENDIF
                0447         IF ( checkAdvSchSnow ) THEN
                0448          WRITE(msgBuf,'(2A,I3)') 'SEAICE_CHECK:',
                0449      &        ' SEAICEadvSchSnow = ',  SEAICEadvSchSnow
                0450          CALL PRINT_ERROR( msgBuf, myThid )
                0451         ENDIF
                0452         IF ( checkAdvSchSalt ) THEN
                0453          WRITE(msgBuf,'(2A,I3)') 'SEAICE_CHECK:',
                0454      &        ' SEAICEadvSchSalt = ',  SEAICEadvSchSalt
                0455          CALL PRINT_ERROR( msgBuf, myThid )
                0456         ENDIF
dc26f158aa Mart*0457         errCount = errCount + 1
8e92ca36c0 Jean*0458        ENDIF
a7a2228515 Jean*0459       ELSEIF ( DIFF1 .NE. 0. _d 0 ) THEN
                0460 C-- for now, the code does not allow to use DIFF1 without the default
                0461 C   advection scheme (Centered 2nd order). In this case, stop here.
                0462         WRITE(msgBuf,'(2A,1PE16.8)') 'SEAICE_CHECK: ',
                0463      &        'harmonic+biharmonic DIFF1=',  DIFF1
                0464         CALL PRINT_ERROR( msgBuf, myThid )
                0465         WRITE(msgBuf,'(2A,I3)') 'SEAICE_CHECK: ',
                0466      &        'not available with SEAICEadvScheme=', SEAICEadvScheme
                0467         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0468         errCount = errCount + 1
8e92ca36c0 Jean*0469       ENDIF
1819581090 Mart*0470 
37ee17b0db Jean*0471 C     Avoid using both type of diffusion scheme (DIFF1 & SEAICEdiffKh)
                0472       IF ( DIFF1 .NE. 0. _d 0 .AND. (
                0473      &     ( SEAICEdiffKhHeff .NE. 0. _d 0 ) .OR.
                0474      &     ( SEAICEdiffKhArea .NE. 0. _d 0 ) .OR.
                0475      &     ( SEAICEdiffKhSnow .NE. 0. _d 0 ) .OR.
e54fe3e1f9 Gael*0476      &     ( SEAICEdiffKhSalt .NE. 0. _d 0 )
37ee17b0db Jean*0477      &                              ) ) THEN
                0478        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK:',
                0479      &  ' DIFF1 > 0 and one of the SEAICEdiffKh[] > 0'
                0480        CALL PRINT_ERROR( msgBuf, myThid )
                0481        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK:',
                0482      &  ' => Cannot use both type of diffusion'
                0483        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0484        errCount = errCount + 1
37ee17b0db Jean*0485       ENDIF
6d78fc5463 Gael*0486 
53957712aa Mart*0487       IF ( postSolvTempIter.GT.2 .OR. postSolvTempIter .LT. 0 ) THEN
                0488        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK:',
                0489      &  ' => allowed values for postSolveTempIter: 0, 1, 2'
                0490        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0491        errCount = errCount + 1
53957712aa Mart*0492       ENDIF
                0493 
96da9a2bc2 Gael*0494       IF ( SEAICEpresH0    .LE. 0. _d 0 .OR.
                0495      &     SEAICEpresPow0  .LT. 0 .OR. SEAICEpresPow1  .LT. 0 ) THEN
                0496         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
                0497      &      'SEAICEpresH0 (real), SEAICEpresPow0 (integer)'
3efa3cc6e1 Jean*0498         CALL PRINT_ERROR( msgBuf, myThid )
96da9a2bc2 Gael*0499         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: OR SEAICEpresPow1 ',
                0500      &      '(integer) has been specified as negative (data.seaice)'
3efa3cc6e1 Jean*0501         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0502         errCount = errCount + 1
96da9a2bc2 Gael*0503       ENDIF
f82b316546 Jean*0504 
8a37a22def Patr*0505 C--
0ae85bb38a Patr*0506 #ifdef ALLOW_AUTODIFF_TAMC
79df32c3f1 Mart*0507       IF ( SEAICEnonLinIterMax .GT. MPSEUDOTIMESTEPS ) THEN
8a37a22def Patr*0508        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK:',
                0509      &  ' need to increase MPSEUDOTIMESTEPS in SEAICE_PARAMS.h'
                0510        CALL PRINT_ERROR( msgBuf, myThid )
                0511        WRITE(msgBuf,'(2A,2I4)') 'SEAICE_CHECK:',
79df32c3f1 Mart*0512      &  ' MPSEUDOTIMESTEPS, SEAICEnonLinIterMax = ',
                0513      &  MPSEUDOTIMESTEPS, SEAICEnonLinIterMax
8a37a22def Patr*0514        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0515        errCount = errCount + 1
8a37a22def Patr*0516       ENDIF
0d75a51072 Mart*0517       IF ( SEAICElinearIterMax .GT. SOLV_MAX_FIXED ) THEN
                0518        WRITE(msgBuf,'(2A,I10,A,I10)') 'SEAICE_CHECK:',
                0519      &      'SEAICElinearIterMax = ', SEAICElinearIterMax,
                0520      &      ' > SOLV_MAX_FIXED = ', SOLV_MAX_FIXED
                0521        CALL PRINT_ERROR( msgBuf, myThid )
                0522        WRITE(msgBuf,'(2A,I10,A,I10)') 'SEAICE_CHECK:',
                0523      &'either increase SOLV_MAX_FIXED or decrease SEAICElinearIterMax'
                0524        CALL PRINT_ERROR( msgBuf, myThid )
                0525        STOP 'ABNORMAL END: S/R SEAICE_LSR'
                0526       ENDIF
8b7b383de8 Mart*0527       IF ( IMAX_TICE .GT. NMAX_TICE ) THEN
                0528        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK:',
                0529      &  ' need to increase NMAX_TICE in SEAICE_PARAMS.h'
                0530        CALL PRINT_ERROR( msgBuf, myThid )
                0531        WRITE(msgBuf,'(2A,2I4)') 'SEAICE_CHECK:',
                0532      &  ' NMAX_TICE, MAX_TICE = ', NMAX_TICE, IMAX_TICE
                0533        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0534        errCount = errCount + 1
8b7b383de8 Mart*0535       ENDIF
b0c32e7c62 Jean*0536       IF ( SEAICE_maskRHS ) THEN
                0537        WRITE(msgBuf,'(A)') 'SEAICE_CHECK: SEAICE_maskRHS not allowed'
                0538        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0539        errCount = errCount + 1
b0c32e7c62 Jean*0540       ENDIF
0ae85bb38a Patr*0541 #endif
8a37a22def Patr*0542 
45315406aa Mart*0543 C--   SEAICE_CGRID, SEAICE_BGRID_DYNAMICS and SEAICEuseDYNAMICS
                0544 #if ( defined SEAICE_CGRID && defined SEAICE_BGRID_DYNAMICS )
                0545       WRITE(msgBuf,'(A,A)')
                0546      &     'SEAICE_CHECK: SEAICE_CGRID and SEAICE_BGRID_DYNAMICS ',
                0547      &     'cannot be defined at the same time.'
                0548       CALL PRINT_ERROR( msgBuf, myThid )
                0549       errCount = errCount + 1
                0550 #endif
                0551 #if !( defined SEAICE_CGRID || defined SEAICE_BGRID_DYNAMICS )
cee16b76ae Dimi*0552       IF (SEAICEuseDYNAMICS) THEN
45315406aa Mart*0553          WRITE(msgBuf,'(A,A)')
                0554      &      'SEAICE_CHECK: either SEAICE_CGRID ',
                0555      &      'or SEAICE_BGRID_DYNAMICS needed for SEAICEuseDYNAMICS = T'
835bd4f8b2 Jean*0556          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0557          errCount = errCount + 1
cee16b76ae Dimi*0558       ENDIF
6060ec2938 Dimi*0559 #endif
cee16b76ae Dimi*0560 
2e05c0b826 Mart*0561 #ifndef SEAICE_ALLOW_MOM_ADVECTION
210ee8461e jm-c 0562       IF ( SEAICEmomAdvection ) THEN
2e05c0b826 Mart*0563        WRITE(msgBuf,'(A)')
                0564      &   'SEAICE_ALLOW_MOM_ADVECTION needed for SEAICEmomAdvection'
                0565        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0566        errCount = errCount + 1
2e05c0b826 Mart*0567       ENDIF
                0568 #endif
                0569 
ae1fb66b64 Dimi*0570 C--   SEAICE_EXTERNAL_FORCING is obsolete: issue warning but continue.
cee16b76ae Dimi*0571 #ifdef SEAICE_EXTERNAL_FORCING
3efa3cc6e1 Jean*0572         WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: ',
ae1fb66b64 Dimi*0573      &        'SEAICE_EXTERNAL_FORCING option is obsolete:'
3efa3cc6e1 Jean*0574         CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
                0575         WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: ',
8c1e355199 Mart*0576      &        'seaice now always uses exf to read input files.'
3efa3cc6e1 Jean*0577         CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
ae1fb66b64 Dimi*0578 #endif
                0579 
050eb90cc6 Gael*0580 C--   SEAICE_GROWTH_LEGACY is obsolete: issue warning but continue.
                0581 #ifdef SEAICE_GROWTH_LEGACY
                0582       WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: ',
                0583      &     'CPP flag SEAICE_GROWTH_LEGACY has been retired.'
                0584       CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
                0585 #endif /* SEAICE_GROWTH_LEGACY */
                0586 
                0587 C--   SEAICE_CAP_HEFF is obsolete: issue warning but continue.
                0588 #ifdef SEAICE_CAP_HEFF
                0589       WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: ',
                0590      &     'CPP flag SEAICE_CAP_HEFF has been retired.'
                0591       CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
                0592 #endif /* SEAICE_CAP_HEFF */
                0593 
94e16c6a45 Dimi*0594 C--   SEAICE_MULTICATEGORY is obsolete: issue warning but continue.
                0595 #ifdef SEAICE_MULTICATEGORY
                0596       WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: ',
                0597      &     'CPP flag SEAICE_MULTICATEGORY has been retired.'
3efa3cc6e1 Jean*0598       CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
94e16c6a45 Dimi*0599       WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: ',
                0600      &     'Specify SEAICE_multDim=7 in data.seaice to recover'
3efa3cc6e1 Jean*0601       CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
94e16c6a45 Dimi*0602       WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: ',
                0603      &     'previous default SEAICE_MULTICATEGORY setting.'
3efa3cc6e1 Jean*0604       CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
94e16c6a45 Dimi*0605 #endif /* SEAICE_MULTICATEGORY */
                0606 
8377b8ee87 Mart*0607 C--   SEAICE_ALLOW_TD_IF is obsolete: issue error and stop.
136908bfac Ian *0608 #ifdef SEAICE_ALLOW_TD_IF
                0609          WRITE(msgBuf,'(A)')
                0610      &     'SEAICE_ALLOW_TD_IF option is obsolete:'
                0611          CALL PRINT_ERROR( msgBuf, myThid )
                0612          WRITE(msgBuf,'(A)')
                0613      &     'the seaice*_IF codes are now merged into the main branch.'
                0614          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0615          errCount = errCount + 1
1ed503f8a3 Gael*0616 #endif /* SEAICE_ALLOW_TD_IF */
                0617 
8377b8ee87 Mart*0618 C--   SEAICE_DO_OPEN_WATER_GROWTH is obsolete: issue error and stop.
6ec4646d60 Gael*0619 #if defined(SEAICE_DO_OPEN_WATER_GROWTH) || \
1c278edd09 Jean*0620       defined(SEAICE_DO_OPEN_WATER_MELT)
6ec4646d60 Gael*0621          WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
                0622      &     'SEAICE_DO_OPEN_WATER_GROWTH / MELT options are obsolete'
                0623          CALL PRINT_ERROR( msgBuf, myThid )
                0624          WRITE(msgBuf,'(2A)') 'they are replaced with run time',
                0625      &     ' parameter SEAICE_doOpenWaterGrowth / Melt'
                0626          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0627          errCount = errCount + 1
6ec4646d60 Gael*0628 #endif /* SEAICE_DO_OPEN_WATER_GROWTH */
                0629 
8377b8ee87 Mart*0630 C--   SEAICE_OCN_MELT_ACT_ON_AREA is obsolete: issue error and stop.
6ec4646d60 Gael*0631 #ifdef SEAICE_OCN_MELT_ACT_ON_AREA
                0632          WRITE(msgBuf,'(A)')
                0633      &     'SEAICE_OCN_MELT_ACT_ON_AREA option is obsolete:'
                0634          CALL PRINT_ERROR( msgBuf, myThid )
                0635          WRITE(msgBuf,'(A)')
                0636      &     'it is now done with SEAICE_areaLossFormula.EQ.1 and 2'
                0637          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0638          errCount = errCount + 1
6ec4646d60 Gael*0639 #endif /* SEAICE_OCN_MELT_ACT_ON_AREA */
                0640 
8377b8ee87 Mart*0641 C--   FENTY_AREA_EXPANSION_CONTRACTION is obsolete: issue error and stop.
6ec4646d60 Gael*0642 #ifdef FENTY_AREA_EXPANSION_CONTRACTION
                0643          WRITE(msgBuf,'(A)')
                0644      &     'FENTY_AREA_EXPANSION_CONTRACTION option is obsolete:'
                0645          CALL PRINT_ERROR( msgBuf, myThid )
                0646          WRITE(msgBuf,'(A)')
                0647      &     'it is now done with SEAICE_areaLoss(Melt)Formula.EQ.1'
                0648          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0649          errCount = errCount + 1
6ec4646d60 Gael*0650 #endif /* SEAICE_DO_OPEN_WATER_MELT */
                0651 
8377b8ee87 Mart*0652 C--   SEAICE_AGE is obsolete: issue error and stop.
1ed503f8a3 Gael*0653 #ifdef SEAICE_AGE
                0654          WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
                0655      &     'SEAICE_AGE option is obsolete: '
                0656          CALL PRINT_ERROR( msgBuf, myThid )
                0657          WRITE(msgBuf,'(2A)') 'it now is done',
                0658      &     ' with SEAICE_SITRACER and siTrName=age'
                0659          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0660          errCount = errCount + 1
1ed503f8a3 Gael*0661 #endif /* SEAICE_AGE */
136908bfac Ian *0662 
8377b8ee87 Mart*0663 C--   SEAICE_SALINITY is obsolete: issue error and stop.
a98c4b8072 Ian *0664 #ifdef SEAICE_SALINITY
                0665          WRITE(msgBuf,'(A)')
                0666      &     'SEAICE_SALINITY option is obsolete'
                0667          CALL PRINT_ERROR( msgBuf, myThid )
                0668          WRITE(msgBuf,'(A)')
                0669      &     'use SEAICE_VARIABLE_SALINITY instead.'
                0670          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0671          errCount = errCount + 1
a98c4b8072 Ian *0672 #endif /* SEAICE_SALINITY */
                0673 
8377b8ee87 Mart*0674 C--   SEAICE_OLD_AND_BAD_DISCRETIZATION is obsolete: issue error and stop.
8c1e355199 Mart*0675 #ifdef SEAICE_OLD_AND_BAD_DISCRETIZATION
                0676          WRITE(msgBuf,'(A)')
                0677      &     'SEAICE_OLD_AND_BAD_DISCRETIZATION option is obsolete'
                0678          CALL PRINT_ERROR( msgBuf, myThid )
                0679          WRITE(msgBuf,'(A)')
                0680      &     'and has no effect.'
                0681          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0682          errCount = errCount + 1
8c1e355199 Mart*0683 #endif /* SEAICE_OLD_AND_BAD_DISCRETIZATION */
                0684 
ae1fb66b64 Dimi*0685 C--   pkg/seaice requires pkg/exf with following CPP options/
fa64f6674f Jean*0686 C jmc: strickly true for Thermodynamics parts since Dynamics can be used
                0687 C      without EXF (assuming a simple scaling of wind-stress over ice)
                0688       IF ( usePW79thermodynamics ) THEN
95c7d150a4 Ed H*0689 #ifndef ALLOW_EXF
cee16b76ae Dimi*0690          WRITE(msgBuf,'(A)')
95c7d150a4 Ed H*0691      &        'need to define ALLOW_EXF'
835bd4f8b2 Jean*0692          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0693          errCount = errCount + 1
95c7d150a4 Ed H*0694 #else /* ALLOW_EXF */
0ba6d68576 Jean*0695          IF ( .NOT.useEXF ) THEN
                0696            WRITE(msgBuf,'(A)')
                0697      &        'S/R SEAICE_CHECK: need to set useEXF in data.pkg'
                0698            CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0699            errCount = errCount + 1
0ba6d68576 Jean*0700          ENDIF
6060ec2938 Dimi*0701 #ifndef ALLOW_ATM_TEMP
b0c32e7c62 Jean*0702          WRITE(msgBuf,'(2A)') 'S/R SEAICE_CHECK: ',
6060ec2938 Dimi*0703      &        'need to define pkg/exf ALLOW_ATM_TEMP'
835bd4f8b2 Jean*0704          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0705          errCount = errCount + 1
6060ec2938 Dimi*0706 #endif
                0707 #ifndef ALLOW_DOWNWARD_RADIATION
b0c32e7c62 Jean*0708          WRITE(msgBuf,'(2A)') 'S/R SEAICE_CHECK: ',
6060ec2938 Dimi*0709      &        'need to define pkg/exf ALLOW_DOWNWARD_RADIATION'
835bd4f8b2 Jean*0710          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0711          errCount = errCount + 1
6060ec2938 Dimi*0712 #endif
454a842c16 Mart*0713 #ifdef SEAICE_EXTERNAL_FLUXES
4613bbc38b Dimi*0714 # if !defined(EXF_READ_EVAP) && !defined(ALLOW_BULKFORMULAE)
b0c32e7c62 Jean*0715          WRITE(msgBuf,'(2A)') 'S/R SEAICE_CHECK: ',
4613bbc38b Dimi*0716      &     'need to set EXF_READ_EVAP or ALLOW_BULKFORMULAE in pkg/exf'
835bd4f8b2 Jean*0717          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0718          errCount = errCount + 1
4613bbc38b Dimi*0719 # endif /* !defined(EXF_READ_EVAP) && !defined(ALLOW_BULKFORMULAE) */
                0720          IF ( SEAICE_waterAlbedo .NE. UNSET_RL ) THEN
                0721           WRITE(msgBuf,'(A)')
                0722      &      'SEAICE_waterAlbedo is not used with SEAICE_EXTERNAL_FLUXES'
3efa3cc6e1 Jean*0723           CALL PRINT_ERROR( msgBuf, myThid )
4613bbc38b Dimi*0724           WRITE(msgBuf,'(A)')
                0725      &      'Set exf_albedo in data.exf EXF_NML_01 instead'
3efa3cc6e1 Jean*0726           CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0727           errCount = errCount + 1
3c7d68edf4 Mart*0728          ENDIF
                0729          IF ( lwfluxfile .NE. ' ' .AND. lwdownfile .EQ. ' ' ) THEN
                0730           i = ILNBLNK(lwfluxfile)
                0731           WRITE(msgBuf,'(A,A)')
                0732      &         'lwFlux is read from lwfluxfile = ',lwfluxfile(1:i)
                0733           CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*0734           WRITE(msgBuf,'(2A)')
                0735      &         'implying that lwdown = 0. For pkg/seaice to work ',
3c7d68edf4 Mart*0736      &         'properly lwdown should be read from lwdownfile!'
                0737           CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0738           errCount = errCount + 1
3c7d68edf4 Mart*0739          ENDIF
                0740          IF ( swfluxfile .NE. ' ' .AND. swdownfile .EQ. ' ' ) THEN
                0741           i = ILNBLNK(swfluxfile)
                0742           WRITE(msgBuf,'(A,A)')
                0743      &         'swFlux is read from swfluxfile = ',swfluxfile(1:i)
                0744           CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*0745           WRITE(msgBuf,'(2A)')
                0746      &         'implying that swdown = 0. For pkg/seaice to work ',
3c7d68edf4 Mart*0747      &         'properly swdown should be read from swdownfile!'
                0748           CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0749           errCount = errCount + 1
4613bbc38b Dimi*0750          ENDIF
                0751 #else /* if undef SEAICE_EXTERNAL_FLUXES */
454a842c16 Mart*0752          WRITE(msgBuf,'(3A)') 'S/R SEAICE_CHECK: ',
4613bbc38b Dimi*0753      &     'SEAICE_EXTERNAL_FLUXES is undefined, so we assume you ',
                0754      &     'know what you are doing.'
454a842c16 Mart*0755          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
3efa3cc6e1 Jean*0756      &        SQUEEZE_RIGHT, myThid )
454a842c16 Mart*0757          CALL PRINT_ERROR( msgBuf, myThid )
                0758          WRITE(msgBuf,'(2A)') 'S/R SEAICE_CHECK: ',
                0759      &     'Use S/R SEAICE_BUDGET_OCEAN to compute fluxes over ocean.'
                0760          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
3efa3cc6e1 Jean*0761      &        SQUEEZE_RIGHT, myThid )
454a842c16 Mart*0762          CALL PRINT_ERROR( msgBuf, myThid )
                0763 #endif /* SEAICE_EXTERNAL_FLUXES */
358649780a Gael*0764 #ifndef SEAICE_CGRID
                0765          IF ( .NOT.useAtmWind ) THEN
                0766            WRITE(msgBuf,'(2A)') 'S/R SEAICE_CHECK: ',
                0767      &        'needs pkg/exf useAtmWind to be true'
                0768            CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0769            errCount = errCount + 1
358649780a Gael*0770          ENDIF
0ba6d68576 Jean*0771 #endif
d2119dc372 Jean*0772 #ifndef EXF_SEAICE_FRACTION
                0773          IF ( SEAICE_tauAreaObsRelax.GT.zeroRL ) THEN
                0774            WRITE(msgBuf,'(2A)') 'S/R SEAICE_CHECK: ',
                0775      &        'ice-area relaxation needs #define EXF_SEAICE_FRACTION'
                0776            CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0777            errCount = errCount + 1
d2119dc372 Jean*0778          ENDIF
                0779 #endif
95c7d150a4 Ed H*0780 #endif /* ALLOW_EXF */
fa64f6674f Jean*0781 C     end if usePW79thermodynamics
5650936ed9 Jean*0782       ENDIF
6060ec2938 Dimi*0783 
210ee8461e jm-c 0784       IF ( ( SEAICEuseDynamics .OR. SEAICEuseFREEDRIFT ) .AND.
                0785      &     momStepping .AND. .NOT.SEAICEupdateOceanStress ) THEN
                0786         WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: ',
                0787      &      'SEAICEupdateOceanStress= FALSE will'
                0788         CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
                0789         WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: ',
                0790      &      'give inconsistent Ocean surface stress'
                0791         CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
                0792       ENDIF
                0793 
45315406aa Mart*0794 #ifdef SEAICE_CGRID
f76143c445 Mart*0795       IF ( SEAICEuseDynamics ) THEN
8377b8ee87 Mart*0796 C--   Check Overlap size:
f76143c445 Mart*0797        IF ( SEAICEuseJFNK ) THEN
                0798         IF ( OLx.LT.3 .OR. OLy.LT.3 ) THEN
                0799          WRITE(msgBuf,'(A,A)')
                0800      &        'SEAICE_CHECK: cannot use JFNK-solver with',
                0801      &        ' overlap (OLx,OLy) smaller than 3'
                0802          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0803          errCount = errCount + 1
f76143c445 Mart*0804         ENDIF
                0805        ELSE
                0806         IF ( OLx.LT.2 .OR. OLy.LT.2 ) THEN
                0807          WRITE(msgBuf,'(A,A)')
                0808      &        'SEAICE_CHECK: cannot use dynamics solver with',
                0809      &        ' overlap (OLx,OLy) smaller than 2'
                0810          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0811          errCount = errCount + 1
f76143c445 Mart*0812         ENDIF
                0813        ENDIF
                0814        IF ( SEAICE_OLx .GT. OLx-2 .OR. SEAICE_OLy .GT. OLy-2 .OR.
                0815      &      SEAICE_OLx .LT. 0     .OR. SEAICE_OLy .LT. 0 ) THEN
                0816         WRITE(msgBuf,'(A,I2,A,I2)') 'S/R SEAICE_CHECK: SEAICE_OLx/y = ',
                0817      &       SEAICE_OLx, '/', SEAICE_OLy
                0818         CALL PRINT_ERROR( msgBuf, myThid )
                0819         WRITE(msgBuf,'(2A,I2,A,I2)')
                0820      &       'S/R SEAICE_CHECK: SEAICE_OLx/y cannot be smaller than 0 ',
                0821      &       'or larger than OLx/y-2 = ', OLx-2, '/', OLy-2
3efa3cc6e1 Jean*0822         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0823         errCount = errCount + 1
f76143c445 Mart*0824        ENDIF
                0825        IF ( SEAICE_2ndOrderBC ) THEN
                0826         IF ( OLx.LT.3 .OR. OLy.LT.3 ) THEN
                0827          WRITE(msgBuf,'(A,A)')
                0828      &   'SEAICE_CHECK: SEAICE_2ndOrderBC = .TRUE. requires',
                0829      &   ' an overlap (OLx,OLy) of at least 3'
                0830          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0831          errCount = errCount + 1
f76143c445 Mart*0832         ENDIF
                0833         IF ( SEAICE_OLx .GT. OLx-3 .OR. SEAICE_OLy .GT. OLy-3 ) THEN
                0834          WRITE(msgBuf,'(A,I2,A,I2)')
210ee8461e jm-c 0835      &        'S/R SEAICE_CHECK: SEAICE_OLx/y = ',
f76143c445 Mart*0836      &        SEAICE_OLx, '/', SEAICE_OLy
                0837          CALL PRINT_ERROR( msgBuf, myThid )
                0838          WRITE(msgBuf,'(2A,I2,A,I2)')
210ee8461e jm-c 0839      &        'S/R SEAICE_CHECK: with SEAICE_2ndOrderBC, SEAICE_OLx/y',
f76143c445 Mart*0840      &        ' cannot be larger than OLx/y-3 = ', OLx-3, '/', OLy-3
                0841          CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0842          errCount = errCount + 1
f76143c445 Mart*0843         ENDIF
                0844        ENDIF
4b491e6964 Mart*0845 
dc26f158aa Mart*0846 # ifdef SEAICE_ALLOW_EVP
                0847        IF ( SEAICEuseEVP ) THEN
                0848 #  ifdef ALLOW_AUTODIFF_TAMC
                0849         IF ( SEAICEnEVPstarSteps.GT.nEVPstepMax ) THEN
8377b8ee87 Mart*0850          WRITE(msgBuf,'(2A)')
                0851      &        'SEAICE_CHECK: need to set nEVPstepMax to >= ',
dc26f158aa Mart*0852      &        'SEAICEnEVPstarSteps'
                0853          CALL PRINT_ERROR( msgBuf, myThid )
                0854          WRITE(msgBuf,'(A,I4)')
                0855      &   'SEAICE_CHECK: SEAICEnEVPstarSteps = ', SEAICEnEVPstarSteps
                0856          CALL PRINT_ERROR( msgBuf, myThid )
                0857          errCount = errCount + 1
                0858         ENDIF
                0859 #  endif
                0860         IF ( .NOT.(SEAICEuseEVPstar.OR.SEAICEuseEVPrev)
                0861      &       .AND. SEAICEnEVPstarSteps.NE.
                0862      &       INT(SEAICE_deltaTdyn/SEAICE_deltaTevp) ) THEN
8377b8ee87 Mart*0863          WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: SEAICEnEVPstarSteps is ',
dc26f158aa Mart*0864      &        'set in namelist, but SEAICEuseEVPstar = .FALSE.'
                0865          CALL PRINT_ERROR( msgBuf, myThid )
                0866          errCount = errCount + 1
                0867         ENDIF
                0868        ENDIF
8377b8ee87 Mart*0869 # else /* SEAICE_ALLOW_EVP */
dc26f158aa Mart*0870        IF ( SEAICEuseEVP ) THEN
                0871         WRITE(msgBuf,'(A)')
                0872      &       'SEAICE_CHECK: SEAICEuseEVP = .TRUE., so EVP is turned on'
                0873         CALL PRINT_ERROR( msgBuf, myThid )
                0874         WRITE(msgBuf,'(A)')
                0875      &       'SEAICE_CHECK: by setting appropriate runtime parameters,'
                0876         CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*0877         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: but cpp-flag ',
dc26f158aa Mart*0878      &       'SEAICE_ALLOW_EVP is not defined in SEAICE_OPTIONS.h'
                0879         CALL PRINT_ERROR( msgBuf, myThid )
                0880         errCount = errCount + 1
                0881        ENDIF
8377b8ee87 Mart*0882 # endif /* SEAICE_ALLOW_EVP */
cf9fa44a59 Patr*0883 
45315406aa Mart*0884 # ifdef SEAICE_ALLOW_EVP
dc26f158aa Mart*0885        IF ( SEAICEuseEVP .AND. (SEAICE_eccfr.NE.SEAICE_eccen) ) THEN
8377b8ee87 Mart*0886         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: SEAICEuseEVP = .TRUE., ',
dc26f158aa Mart*0887      &       'so EVP is turned on by setting appropriate'
                0888         CALL PRINT_ERROR( msgBuf, myThid )
                0889         WRITE(msgBuf,'(A,F5.2,A,F5.2,A)')
                0890      &       'SEAICE_CHECK: runtime parameters, but SEAICE_eccfr(=',
                0891      &       SEAICE_eccfr , ')/=SEAICE_eccen(=', SEAICE_eccen, ')'
                0892         CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*0893         WRITE(msgBuf,'(2A)')'SEAICE_CHECK: implies a non-normal flow ',
dc26f158aa Mart*0894      &       'rule for the elliptical yield curve,'
                0895         CALL PRINT_ERROR( msgBuf, myThid )
                0896         WRITE(msgBuf,'(A)')
                0897      &       'SEAICE_CHECK: which is not implemented for EVP.'
                0898         CALL PRINT_ERROR( msgBuf, myThid )
                0899         errCount = errCount + 1
                0900        ENDIF
8377b8ee87 Mart*0901        IF ( SEAICEuseEVP .AND.
                0902      &      ( SEAICEuseTD .OR. SEAICEusePL .OR.
                0903      &        SEAICEuseMCE .OR.  SEAICEuseMCS ) ) THEN
                0904         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: SEAICEuseMCS, ',
dc26f158aa Mart*0905      &      'SEAICEuseTD, SEAICEusePL, or SEAICEuseMCE = .TRUE.,'
c512e371cc drin*0906         CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*0907         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: and SEAICEuseEVP = ',
dc26f158aa Mart*0908      &       '.TRUE., but these non-standard rheologies'
                0909         CALL PRINT_ERROR( msgBuf, myThid )
                0910         WRITE(msgBuf,'(A)')
                0911      &       'SEAICE_CHECK: are not implemented for EVP'
                0912         CALL PRINT_ERROR( msgBuf, myThid )
                0913         errCount = errCount + 1
                0914        ENDIF
45315406aa Mart*0915 # endif /* SEAICE_ALLOW_EVP */
c512e371cc drin*0916 
143d9ce879 Dami*0917 #ifndef SEAICE_ALLOW_LSR_FLEX
                0918       IF ( SEAICEuseLSRflex ) THEN
                0919        WRITE(msgBuf,'(A)')
                0920      &   'SEAICE_ALLOW_LSR_FLEX needed for SEAICEuseLSRflex'
                0921        CALL PRINT_ERROR( msgBuf, myThid )
                0922        errCount = errCount + 1
                0923       ENDIF
                0924 #endif
dc26f158aa Mart*0925 C     SEAICEuseDynamics
                0926       ENDIF
45315406aa Mart*0927 #endif /* SEAICE_CGRID */
dc26f158aa Mart*0928 
f82b316546 Jean*0929 #ifndef SEAICE_GLOBAL_3DIAG_SOLVER
                0930       IF ( SEAICEuseMultiTileSolver ) THEN
                0931         WRITE(msgBuf,'(A)')
                0932      &   'SEAICE_CHECK: SEAICEuseMultiTileSolver = .TRUE.'
3efa3cc6e1 Jean*0933         CALL PRINT_ERROR( msgBuf, myThid )
f82b316546 Jean*0934         WRITE(msgBuf,'(2A)') ' but CPP-flag ',
                0935      &   'SEAICE_GLOBAL_3DIAG_SOLVER is #undef in SEAICE_OPTIONS.h'
                0936         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0937         errCount = errCount + 1
f82b316546 Jean*0938       ENDIF
                0939 #endif /* SEAICE_GLOBAL_3DIAG_SOLVER */
                0940 
d37c75ccbc Mart*0941 #ifndef SEAICE_ALLOW_CLIPVELS
                0942       IF ( SEAICE_clipVelocities ) THEN
8c02537f20 Jean*0943         WRITE(msgBuf,'(A)')
d37c75ccbc Mart*0944      &      'SEAICE_CHECK: SEAICE_clipVelocities = .TRUE.'
3efa3cc6e1 Jean*0945         CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*0946         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: but cpp-flag ',
d37c75ccbc Mart*0947      &       'SEAICE_ALLOW_CLIPVELS is not defined in SEAICE_OPTIONS.h'
3efa3cc6e1 Jean*0948         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0949         errCount = errCount + 1
d37c75ccbc Mart*0950       ENDIF
                0951 #endif /* SEAICE_ALLOW_CLIPVELS */
                0952 
fc27138d73 Mart*0953 #ifndef SEAICE_ALLOW_CLIPZETA
                0954       IF ( SEAICE_evpDampC .GT. 0. _d 0 .OR.
                0955      &     SEAICE_zetaMin  .GT. 0. _d 0 ) THEN
8377b8ee87 Mart*0956         WRITE(msgBuf,'(2A)')
                0957      &      'SEAICE_CHECK: SEAICE_evpDampC and/or SEAICE_zetaMin ',
fc27138d73 Mart*0958      &      'are set in data.seaice'
3efa3cc6e1 Jean*0959         CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*0960         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: but cpp-flag ',
fc27138d73 Mart*0961      &       'SEAICE_ALLOW_CLIPZETA is not defined in SEAICE_OPTIONS.h'
3efa3cc6e1 Jean*0962         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0963         errCount = errCount + 1
fc27138d73 Mart*0964       ENDIF
                0965 #endif /* SEAICE_ALLOW_CLIPZETA */
                0966 
c512e371cc drin*0967 #ifndef SEAICE_ALLOW_TEM
dadd13178c Mart*0968       IF ( SEAICEuseTEM ) THEN
8377b8ee87 Mart*0969        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: SEAICEuseTEM requires ',
c512e371cc drin*0970      &      'that SEAICE_ALLOW_TEM is defined.'
dadd13178c Mart*0971        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0972        errCount = errCount + 1
c512e371cc drin*0973       ENDIF
                0974 #endif
                0975 #ifndef SEAICE_ALLOW_MCE
                0976       IF ( SEAICEuseMCE ) THEN
8377b8ee87 Mart*0977        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: SEAICEuseMCE requires ',
c512e371cc drin*0978      &      'that SEAICE_ALLOW_MCE is defined.'
                0979        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0980        errCount = errCount + 1
c512e371cc drin*0981       ENDIF
                0982 #endif
                0983 #ifndef SEAICE_ALLOW_MCS
                0984       IF ( SEAICEuseMCS ) THEN
8377b8ee87 Mart*0985        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: SEAICEuseMCS requires ',
c512e371cc drin*0986      &      'that SEAICE_ALLOW_MCS is defined.'
                0987        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0988        errCount = errCount + 1
c512e371cc drin*0989       ENDIF
                0990 #endif
                0991 #ifndef SEAICE_ALLOW_TEARDROP
                0992       IF (SEAICEuseTD ) THEN
8377b8ee87 Mart*0993        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: SEAICEuseTD requires ',
c512e371cc drin*0994      &      'that SEAICE_ALLOW_TEARDROP is defined.'
                0995        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*0996        errCount = errCount + 1
c512e371cc drin*0997       ENDIF
                0998       IF ( SEAICEusePL ) THEN
8377b8ee87 Mart*0999        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: SEAICEusePL requires ',
c512e371cc drin*1000      &      'that SEAICE_ALLOW_TEARDROP is defined.'
dadd13178c Mart*1001        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1002        errCount = errCount + 1
dadd13178c Mart*1003       ENDIF
                1004 #endif
06de6b2e81 Mart*1005 
8377b8ee87 Mart*1006       i = 0
                1007       IF ( SEAICEuseTEM ) i = i + 1
                1008       IF ( SEAICEuseMCS ) i = i + 1
                1009       IF ( SEAICEuseMCE ) i = i + 1
                1010       IF ( SEAICEuseTD  ) i = i + 1
                1011       IF ( SEAICEusePL  ) i = i + 1
                1012       IF ( i .GT. 1 ) THEN
                1013        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: More than one rheology ',
                1014      &      'flag = .TRUE.,'
                1015        CALL PRINT_ERROR( msgBuf, myThid )
                1016        WRITE(msgBuf,'(A)')
                1017      &      'SEAICE_CHECK: but only one can be .TRUE. at a time.'
                1018        CALL PRINT_ERROR( msgBuf, myThid )
                1019        errCount = errCount + 1
                1020       ENDIF
                1021 
45315406aa Mart*1022 #ifdef SEAICE_BGRID_DYNAMICS
8377b8ee87 Mart*1023       IF ( i .GE. 1 ) THEN
                1024        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: non-default rheologies ',
c512e371cc drin*1025      &      'require that SEAICE_CGRID is defined.'
                1026        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1027        errCount = errCount + 1
c512e371cc drin*1028       ENDIF
                1029 
                1030 # ifdef SEAICE_TEST_ICE_STRESS_1
06de6b2e81 Mart*1031        WRITE(msgBuf,'(A)')
                1032      &  'SEAICE_CHECK: Only relevant for B-grid:'
                1033        CALL PRINT_ERROR( msgBuf, myThid )
                1034        WRITE(msgBuf,'(A)')
                1035      &  'SEAICE_CHECK: SEAICE_TEST_ICE_STRESS_1 is replaced by'
                1036        CALL PRINT_ERROR( msgBuf, myThid )
                1037        WRITE(msgBuf,'(A)')
                1038      &  'SEAICE_CHECK: SEAICE_BICE_STRESS (defined by default)'
                1039        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1040        errCount = errCount + 1
c512e371cc drin*1041 # endif /* SEAICE_TEST_ICE_STRESS_1 */
b0c32e7c62 Jean*1042       IF ( SEAICEuseDYNAMICS.AND.useCubedSphereExchange ) THEN
                1043        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
                1044      &       'B-grid dynamics not working on Cubed-Sphere grid'
                1045        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1046        errCount = errCount + 1
b0c32e7c62 Jean*1047       ENDIF
                1048       IF ( SEAICEuseDYNAMICS.AND.useOBCS ) THEN
                1049        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
                1050      &       'Open-Boundaries not implemented in B-grid dynamics'
                1051        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1052 C      errCount = errCount + 1
b0c32e7c62 Jean*1053       ENDIF
45315406aa Mart*1054 #endif /* SEAICE_BGRID_DYNAMICS */
06de6b2e81 Mart*1055 
f5ec4d1505 Gael*1056 C--   SEAICE_ALLOW_FREEDRIFT and SEAICEuseFREEDRIFT
                1057 #ifndef SEAICE_ALLOW_FREEDRIFT
                1058       IF (SEAICEuseFREEDRIFT) THEN
3de1dea93d Jean*1059         WRITE(msgBuf,'(A)')
                1060      &   'need to #define SEAICE_ALLOW_FREEDRIFT for SEAICEuseFREEDRIFT'
                1061         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1062         errCount = errCount + 1
3de1dea93d Jean*1063       ENDIF
d63f6ccbee Jean*1064       IF ( LSR_mixIniGuess.GE.0 ) THEN
3de1dea93d Jean*1065         WRITE(msgBuf,'(A)')
                1066      &   'need to #define SEAICE_ALLOW_FREEDRIFT to use LSR_mixIniGuess'
                1067         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1068         errCount = errCount + 1
f5ec4d1505 Gael*1069       ENDIF
                1070 #endif
                1071 
a7a2228515 Jean*1072 #ifndef SEAICE_VARIABLE_SALINITY
                1073       IF ( SEAICEadvSalt ) THEN
                1074         WRITE(msgBuf,'(A)')
                1075      &      'SEAICE_CHECK: SEAICEadvSalt = .TRUE. but cpp-flag'
3efa3cc6e1 Jean*1076         CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*1077         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
a7a2228515 Jean*1078      &   'SEAICE_VARIABLE_SALINITY is undef in SEAICE_OPTIONS.h'
3efa3cc6e1 Jean*1079         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1080         errCount = errCount + 1
a7a2228515 Jean*1081       ENDIF
                1082 #endif /* SEAICE_VARIABLE_SALINITY */
                1083 
3ece2f30f9 Mart*1084 #ifdef SEAICE_ALLOW_JFNK
                1085       IF ( SEAICEuseJFNK ) THEN
2e75855dde Mart*1086        IF ( JFNKres_t.NE.UNSET_RL .AND. JFNKres_tFac.NE.UNSET_RL) THEN
                1087         WRITE(msgBuf,'(3A)') 'S/R SEAICE_CHECK: JFNKres_t and ',
                1088      &       'JFNKres_tFac are both set, so that JFNKres_t will be'
                1089         CALL PRINT_ERROR( msgBuf, myThid )
                1090         WRITE(msgBuf,'(3A)') 'S/R SEAICE_CHECK: ',
                1091      &       'overwritten by JFNKres_tFac*JFNKresidual ',
                1092      &       'in each initial Newton iteration.'
                1093         CALL PRINT_ERROR( msgBuf, myThid )
5650936ed9 Jean*1094         WRITE(msgBuf,'(2A)')
2e75855dde Mart*1095      &       'S/R SEAICE_CHECK: For safety we stop here. ',
                1096      &       'Please unset one of the two parameters.'
                1097         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1098         errCount = errCount + 1
2e75855dde Mart*1099        ELSEIF (JFNKres_t.EQ.UNSET_RL.AND.JFNKres_tFac.EQ.UNSET_RL) THEN
3ece2f30f9 Mart*1100         WRITE(msgBuf,'(2A)') 'S/R SEAICE_CHECK: need to specify ',
2e75855dde Mart*1101      &       'JFNKres_t or JFNKres_tFac for SEAICEuseJFNK=.TRUE.'
3efa3cc6e1 Jean*1102         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1103         errCount = errCount + 1
3ece2f30f9 Mart*1104        ENDIF
                1105       ENDIF
                1106       IF ( SEAICEuseJFNK .AND. SEAICEuseEVP ) THEN
f82b316546 Jean*1107        WRITE(msgBuf,'(2A)')
3ece2f30f9 Mart*1108      &      'S/R SEAICE_CHECK: cannot have both SEAICEuseJFNK=.TRUE.',
                1109      &      'and SEAICEuseEVP=.TRUE. (i.e. SEAICE_deltaTevp > 0)'
3efa3cc6e1 Jean*1110         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1111         errCount = errCount + 1
3ece2f30f9 Mart*1112       ENDIF
                1113 #else
                1114       IF ( SEAICEuseJFNK ) THEN
                1115         WRITE(msgBuf,'(A)')
                1116      &      'SEAICE_CHECK: SEAICEuseJFNK = .TRUE. but cpp-flag'
3efa3cc6e1 Jean*1117         CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*1118         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
3ece2f30f9 Mart*1119      &   'SEAICE_ALLOW_JFNK is undef in SEAICE_OPTIONS.h'
3efa3cc6e1 Jean*1120         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1121         errCount = errCount + 1
3ece2f30f9 Mart*1122       ENDIF
                1123 #endif /* SEAICE_ALLOW_JFNK */
3f15753c22 Mart*1124 #ifndef SEAICE_ALLOW_KRYLOV
                1125       IF ( SEAICEuseKrylov ) THEN
                1126         WRITE(msgBuf,'(A)')
                1127      &      'SEAICE_CHECK: SEAICEuseKRYLOV = .TRUE. but cpp-flag'
                1128         CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*1129         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
3f15753c22 Mart*1130      &   'SEAICE_ALLOW_KRYLOV is undef in SEAICE_OPTIONS.h'
                1131         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1132         errCount = errCount + 1
3f15753c22 Mart*1133       ENDIF
                1134 #endif /* SEAICE_ALLOW_KRYLOV */
3ece2f30f9 Mart*1135 
702b797d9b Mart*1136       IF ( SEAICEuseDynamics .AND. .NOT.SEAICEuseJFNK ) THEN
e501eee760 Mart*1137        IF ( SEAICEuseBDF2 ) THEN
8377b8ee87 Mart*1138         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: SEAICEuseBDF2 = .TRUE. ',
6cbc659de0 Mart*1139      &       'only allowed with SEAICEuseJFNK = .TRUE.'
dc66f404d9 Mart*1140         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1141         errCount = errCount + 1
6cbc659de0 Mart*1142        ENDIF
                1143        IF ( SEAICEuseIMEX ) THEN
8377b8ee87 Mart*1144         WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: SEAICEuseIMEX = .TRUE. ',
6cbc659de0 Mart*1145      &       'only allowed with SEAICEuseJFNK = .TRUE.'
dc66f404d9 Mart*1146         CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1147         errCount = errCount + 1
6cbc659de0 Mart*1148        ENDIF
                1149       ENDIF
702b797d9b Mart*1150       IF ( SEAICEuseIMEX ) THEN
8377b8ee87 Mart*1151        WRITE(msgBuf,'(3A)') '** WARNING ** SEAICE_CHECK: ',
                1152      &      'SEAICEuseIMEX = .TRUE. ',
702b797d9b Mart*1153      &      'currently has no effect, because the code is missing'
                1154        CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
                1155       ENDIF
6cbc659de0 Mart*1156 
                1157       IF ( .NOT.(SEAICEetaZmethod.EQ.0.OR.SEAICEetaZmethod.EQ.3) ) THEN
                1158        WRITE(msgBuf,'(A,I2)')
                1159      &      'SEAICE_CHECK: SEAICEetaZmethod = ', SEAICEetaZmethod
                1160        CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*1161        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: ',
5650936ed9 Jean*1162      &      'is no longer allowed; allowed values are 0 and 3'
6cbc659de0 Mart*1163        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1164        errCount = errCount + 1
dc66f404d9 Mart*1165       ENDIF
                1166 
0adbdb4edd Mart*1167       IF ( SEAICEpressReplFac .LT. 0. _d 0 .OR.
                1168      &     SEAICEpressReplFac .GT. 1. _d 0 ) THEN
                1169        WRITE(msgBuf,'(A,I2)')
                1170      &      'SEAICE_CHECK: SEAICEpressReplFac = ', SEAICEpressReplFac
                1171        CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*1172        WRITE(msgBuf,'(A)') 'SEAICE_CHECK: cannot be < 0 or > 1'
0adbdb4edd Mart*1173        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1174        errCount = errCount + 1
0adbdb4edd Mart*1175       ENDIF
                1176 
5867b94c2f Mart*1177 C--   Some sanity checks for SEAICEdWatMin
                1178       IF ( SEAICEdWatMin .LT. 0. _d 0 ) THEN
                1179        WRITE(msgBuf,'(A,A,F5.2,A)') 'SEAICE_CHECK: ',
                1180      &      'SEAICEdWatMin (= ', SEAICEdWatMin, ') may not be < 0.'
                1181        CALL PRINT_ERROR( msgBuf , myThid)
dc26f158aa Mart*1182        errCount = errCount + 1
5867b94c2f Mart*1183       ENDIF
                1184       IF ( SEAICE_waterDrag .EQ. 0. _d 0
                1185      &     .AND. SEAICEdWatMin .GT. 0. _d 0) THEN
                1186        WRITE(msgBuf,'(A,A,F5.2)') '** WARNING ** SEAICE_CHECK: ',
                1187      &      'SEAICE_waterDrag  = ', SEAICE_waterDrag
                1188        CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                1189      &                     SQUEEZE_RIGHT, myThid )
                1190        WRITE(msgBuf,'(A,A,F5.2)') '** WARNING ** SEAICE_CHECK: ',
                1191      &      'but SEAICEdWatMin = ', SEAICEdWatMin
                1192        CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                1193      &                     SQUEEZE_RIGHT, myThid )
                1194        WRITE(msgBuf,'(A,A)') '** WARNING ** SEAICE_CHECK: ',
                1195      &      'so that the ice-ocean drag will be non-zero'
                1196        CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
                1197      &                     SQUEEZE_RIGHT, myThid )
                1198       ENDIF
                1199 #ifdef SEAICE_ALLOW_FREEDRIFT
                1200       IF ( SEAICE_waterDrag_South .EQ. 0. _d 0
                1201      &     .OR.  SEAICE_waterDrag .EQ. 0. _d 0 ) THEN
                1202        WRITE(msgBuf,'(A,A,A)') 'SEAICE_CHECK: ',
                1203      &      'When SEAICE_ALLOW_FREEDRIFT is defined, ',
                1204      &      'SEAICE_waterDrag or SEAICE_waterDragSouth may not be zero.'
                1205        CALL PRINT_ERROR( msgBuf , myThid)
dc26f158aa Mart*1206        errCount = errCount + 1
5867b94c2f Mart*1207       ENDIF
                1208 #endif /* SEAICE_ALLOW_FREEDRIFT */
                1209 
3f15753c22 Mart*1210 #ifndef SEAICE_ALLOW_BOTTOMDRAG
                1211       IF ( SEAICEbasalDragK2 .GT. 0. _d 0 ) THEN
                1212        WRITE(msgBuf,'(A,I2)')
                1213      &      'SEAICE_CHECK: SEAICEbasalDragK2 = ', SEAICEbasalDragK2
                1214        CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*1215        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: is greater than 0, ',
3f15753c22 Mart*1216      &      'but SEAICE_ALLOW_BOTTOMDRAG is not defined'
                1217        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1218        errCount = errCount + 1
3f15753c22 Mart*1219       ENDIF
                1220 #endif /* SEAICE_ALLOW_BOTTOMDRAG */
                1221 
9e44a61c99 Mart*1222 #ifdef SEAICE_ITD
                1223 C     The ice thickness distribution (ITD) module can only be used with
                1224 C     the zero-layer thermodynamics of S/R SEAICE_GROWTH and the
                1225 C     advection in S/R SEAICE_ADVDIFF
                1226 C     If useThSice=.TRUE., do not reset it here, but issue a warning
                1227       IF ( useThSice ) THEN
8377b8ee87 Mart*1228        WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: ',
9e44a61c99 Mart*1229      &      'SEAICE_ITD is defined, but useThSice = .TRUE.'
                1230        CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
                1231        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                1232      &      SQUEEZE_RIGHT, myThid )
8377b8ee87 Mart*1233        WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: ',
9e44a61c99 Mart*1234      &      'avoids the ice thickness distribution code.'
                1235        CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
                1236        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                1237      &      SQUEEZE_RIGHT, myThid )
8377b8ee87 Mart*1238        WRITE(msgBuf,'(2A)') '** WARNING ** SEAICE_CHECK: ',
fa64f6674f Jean*1239      &      'If you want the ITD code, set useThSice=.FALSE.'
9e44a61c99 Mart*1240        CALL PRINT_MESSAGE( msgBuf, ioUnit, SQUEEZE_RIGHT, myThid )
                1241        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                1242      &      SQUEEZE_RIGHT, myThid )
                1243       ENDIF
e0fa1cecbf Mart*1244 C
                1245       IF ( .NOT.SEAICEmultiDimAdvection ) THEN
                1246        WRITE(msgBuf,'(A,L1)')
                1247      &      'SEAICE_CHECK: SEAICEmultiDimAdvection = ',
                1248      &      SEAICEmultiDimAdvection
                1249        CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*1250        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: is not allowed when ',
e0fa1cecbf Mart*1251      &      'SEAICE_ITD is defined'
                1252        CALL PRINT_ERROR( msgBuf, myThid )
8377b8ee87 Mart*1253        WRITE(msgBuf,'(2A)') 'SEAICE_CHECK: use a multiDimAdvection ',
e0fa1cecbf Mart*1254      &      'scheme instead'
                1255        CALL PRINT_ERROR( msgBuf, myThid )
dc26f158aa Mart*1256        errCount = errCount + 1
e0fa1cecbf Mart*1257       ENDIF
9e44a61c99 Mart*1258 #endif
                1259 
2b959ba38e Mart*1260 #ifdef ALLOW_SEAICE_COST_SMR_AREA
8377b8ee87 Mart*1261       WRITE(msgBuf,'(2A)')
                1262      & 'SEAICE_CHECK: cpp-flag ALLOW_SEAICE_COST_SMR_AREA ',
2b959ba38e Mart*1263      & 'is not allowed anymore.'
                1264       CALL PRINT_ERROR( msgBuf, myThid )
                1265       WRITE(msgBuf,'(A)')
                1266      & 'SEAICE_CHECK: Use pkg/ecco''s generic cost function instead.'
                1267       CALL PRINT_ERROR( msgBuf, myThid )
                1268       errCount = errCount + 1
                1269 #endif
                1270 
dc26f158aa Mart*1271       IF ( errCount .GE. 1 ) THEN
8377b8ee87 Mart*1272        WRITE(msgBuf,'(A,I3,2A)') 'SEAICE_CHECK: ', errCount,
                1273      &      ' parameter/CPP-flag combinations are',
                1274      &      ' inconsistent or incomplete'
dc26f158aa Mart*1275        CALL PRINT_ERROR( msgBuf, myThid )
                1276        WRITE(msgBuf,'(A,I3,A)')
                1277      &       'SEAICE_CHECK: detected', errCount,' fatal error(s)'
                1278        CALL PRINT_ERROR( msgBuf, myThid )
                1279        CALL ALL_PROC_DIE( 0 )
                1280        STOP 'ABNORMAL END: S/R SEAICE_CHECK'
                1281       ENDIF
                1282 
835bd4f8b2 Jean*1283       _END_MASTER(myThid)
                1284 
                1285       RETURN
                1286       END