Back to home page

MITgcm

 
 

    


File indexing completed on 2026-05-05 05:09:01 UTC

view on githubraw file Latest commit 3f0f10fc on 2026-05-04 14:55:37 UTC
1cf549c217 Mart*0001 #include "SEAICE_OPTIONS.h"
                0002 
                0003 CBOP
                0004 C !ROUTINE: SEAICE_DO_RIDGING
                0005 C !INTERFACE: ==========================================================
                0006       SUBROUTINE SEAICE_DO_RIDGING(
                0007      I     bi, bj, myTime, myIter, myThid )
                0008 
                0009 C !DESCRIPTION: \bv
                0010 C     *===========================================================*
                0011 C     | SUBROUTINE SEAICE_DO_RIDGING
                0012 C     | o compute mechanical redistribution of thin (undeformed) into
                0013 C     |   thick (deformed, i.e. ridged) ice categories
                0014 C     |   according to Thorndyke et al (1975) and Hibler (1980)
                0015 C     |   or Bitz et al (2001) and Lipscomb et al (2007)
                0016 C     |
                0017 C     | Martin Losch, Apr. 2014, Martin.Losch@awi.de
                0018 C     *===========================================================*
                0019 C \ev
                0020 
                0021 C !USES: ===============================================================
                0022       IMPLICIT NONE
                0023 
                0024 #include "SIZE.h"
                0025 #include "EEPARAMS.h"
                0026 #include "PARAMS.h"
                0027 #include "GRID.h"
                0028 #include "SEAICE_SIZE.h"
                0029 #include "SEAICE_PARAMS.h"
3f0f10fc37 Mart*0030 #include "SEAICE_GRID.h"
1cf549c217 Mart*0031 #include "SEAICE.h"
                0032 
                0033 C !INPUT PARAMETERS: ===================================================
                0034 C     === Routine arguments ===
                0035 C     bi, bj    :: outer loop counters
                0036 C     myTime    :: current time
                0037 C     myIter    :: iteration number
                0038 C     myThid    :: Thread no. that called this routine.
                0039       _RL myTime
                0040       INTEGER bi,bj
                0041       INTEGER myIter
                0042       INTEGER myThid
                0043 CEndOfInterface
                0044 
                0045 C !LOCAL VARIABLES: ====================================================
                0046 C     === Local variables ===
                0047 C     i,j,k       :: inner loop counters
                0048 C     openWater   :: open water area fraction
                0049 C
                0050       INTEGER i, j
                0051       INTEGER iMin, iMax, jMin, jMax
                0052 #ifdef SEAICE_ITD
                0053       INTEGER k, l, n
                0054       _RL ridgingModeNorm (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0055       _RL partFunc        (1-OLx:sNx+OLx,1-OLy:sNy+OLy,0:nITD)
                0056 C     ridgeRatio :: mean ridge thickness/ thickness of ridging ice
                0057 C     hrMin      :: min ridge thickness
                0058 C     hrMax      :: max ridge thickness   (SEAICEredistFunc = 0)
                0059 C     hrExp      :: ridge e-folding scale (SEAICEredistFunc = 1)
                0060       _RL hrMin           (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:nITD)
                0061       _RL hrMax           (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:nITD)
                0062       _RL hrExp           (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:nITD)
                0063       _RL ridgeRatio      (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:nITD)
353a8877c7 Mart*0064 C     computed and returned by S/R seaice_prepare_ridging, but not needed here
37d4930619 Jean*0065       _RL hActual         (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:nITD)
1cf549c217 Mart*0066 C
                0067       _RL openWater       (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0068       _RL netArea         (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0069 C     variables related to ridging schemes
                0070       _RL openingRate     (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0071       _RL closingRate     (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0072       _RL grossClosing    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0073 C     amount of ice that participates in ridging (according to partFunc)
                0074       _RL ridgingArea     (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0075       _RL ridgingHeff     (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0076       _RL ridgingHsnw     (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0077 C     fractions of deformed/ridged ice
                0078       _RL areaFraction    (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0079       _RL volFraction     (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0080 C     absolute area/concentration of deformed/ridged ice
                0081       _RL ridgedArea      (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0082       LOGICAL doRidging   (1-OLx:sNx+OLx,1-OLy:sNy+OLy)
                0083       LOGICAL doRidgeAgain, areaTooLarge
                0084 C
                0085       _RL recip_deltaT, convergence, divergence, shear, divAdv
                0086       _RL tmp, tmpFac, hL, hR, expL, expR
37d4930619 Jean*0087       _RL areaPR          (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:nITD)
                0088       _RL heffPR          (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:nITD)
                0089       _RL hsnwPR          (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:nITD)
                0090 C
badaa21155 Mart*0091       CHARACTER*(MAX_LEN_MBUF) msgBuf
1cf549c217 Mart*0092 #endif /* SEAICE_ITD */
                0093 CEOP
                0094 
                0095 C---+-|--1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0096 
                0097       iMin=1
                0098       iMax=sNx
                0099       jMin=1
                0100       jMax=sNy
37d4930619 Jean*0101 #ifndef SEAICE_ITD
1cf549c217 Mart*0102 C     Hiblers "ridging function" for single category ice
                0103       DO j=jMin,jMax
                0104        DO i=iMin,iMax
4e4ad91a39 Jean*0105         AREA(i,j,bi,bj) = MIN(AREA(i,j,bi,bj),SEAICE_area_max)
1cf549c217 Mart*0106        ENDDO
                0107       ENDDO
                0108 #else
                0109 C     calculate area of open water
                0110       DO j=jMin,jMax
                0111        DO i=iMin,iMax
                0112         openWater(i,j) = ONE
                0113        ENDDO
                0114       ENDDO
                0115       DO k=1,nITD
                0116        DO j=jMin,jMax
                0117         DO i=iMin,iMax
                0118          openWater(i,j) = openWater(i,j) - AREAITD(i,j,k,bi,bj)
                0119         ENDDO
                0120        ENDDO
                0121       ENDDO
                0122       IF ( SEAICEsimpleRidging ) THEN
                0123 C--   Hibler-type "ridging", i.e. cut back excessive ice area fraction ---
                0124 C     in case ice concentration exceeds 100% assume that
                0125 C     convergence of floe field has eliminated all open water
37d4930619 Jean*0126 C     and eventual rafting occured in thinnest category:
1cf549c217 Mart*0127        DO j=jMin,jMax
                0128         DO i=iMin,iMax
                0129          IF (openWater(i,j) .lt. 0.0)
                0130      &        AREAITD(i,j,1,bi,bj) = openWater(i,j)+AREAITD(i,j,1,bi,bj)
                0131         ENDDO
                0132        ENDDO
                0133 C---+-|--1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0134       ELSE
353a8877c7 Mart*0135 C     initialisation
                0136       DO j=jMin,jMax
                0137        DO i=iMin,iMax
                0138         ridgingArea(i,j)       = 0. _d 0
                0139         ridgingHeff(i,j)       = 0. _d 0
                0140         ridgingHsnw(i,j)       = 0. _d 0
                0141         areaFraction(i,j)      = 0. _d 0
                0142         volFraction(i,j)       = 0. _d 0
                0143         fw2ObyRidge(i,j,bi,bj) = 0. _d 0
06c98f766d Mart*0144         ridgedArea(i,j)        = 0. _d 0
353a8877c7 Mart*0145        ENDDO
                0146       ENDDO
                0147       CALL SEAICE_PREPARE_RIDGING(
                0148      O     hActual,
                0149      O     hrMin, hrMax, hrExp, ridgeRatio, ridgingModeNorm, partFunc,
                0150      I     iMin, iMax, jMin, jMax, bi, bj, myTime, myIter, myThid )
1cf549c217 Mart*0151 C     Compute the first strain rate invariant epsilonI (divergence)
                0152 C     energy dissipation by convergence = -min (divergence, 0)
                0153 C     energy dissipation by shearing    = (1/2) * (Delta - abs(divergence))
                0154       DO j=jMin,jMax
                0155        DO i=iMin,iMax
                0156         divergence  = e11(i,j,bi,bj) + e22(i,j,bi,bj)
                0157         shear       = 0.5 _d 0 * ( deltaC(i,j,bi,bj) - ABS(divergence) )
                0158         convergence = - MIN(divergence, 0.D0)
                0159         closingRate(i,j) = SEAICEshearParm*shear + convergence
                0160        ENDDO
                0161       ENDDO
37d4930619 Jean*0162 C     we need a new estimate of the total AREA (including the open water
1cf549c217 Mart*0163 C     fraction, but for computational reason it is not included here)
                0164       DO j=jMin,jMax
                0165        DO i=iMin,iMax
                0166         netArea(i,j) = 0. _d 0
                0167        ENDDO
                0168       ENDDO
                0169       DO k=1,nITD
                0170        DO j=jMin,jMax
                0171         DO i=iMin,iMax
                0172          netArea(i,j) = netArea(i,j) + AREAITD(i,j,k,bi,bj)
                0173         ENDDO
                0174        ENDDO
                0175       ENDDO
                0176       recip_DeltaT = 1. _d 0/SEAICE_deltaTtherm
                0177       DO j=jMin,jMax
                0178        DO i=iMin,iMax
37d4930619 Jean*0179 C     divergence rate due to advection; this term need not be zero due
                0180 C     to numerical effects
1cf549c217 Mart*0181 C     (this is copied from CICE but I am not sure about that)
                0182         divAdv = (1. _d 0-netArea(i,j)-opnWtrFrac(i,j,bi,bj))
                0183      &       *recip_deltaT
37d4930619 Jean*0184         IF (divAdv .LT. 0. _d 0)
1cf549c217 Mart*0185      &       closingRate(i,j) = MAX(closingRate(i,j), -divAdv)
badaa21155 Mart*0186 C     finally compute a non-negative opening rate that will lead to
                0187 C     a net area of 1
1cf549c217 Mart*0188         openingRate(i,j) = closingRate(i,j) + divAdv
                0189        ENDDO
                0190       ENDDO
                0191 C
                0192 C     start of the ridging loop
                0193 C
                0194       doRidgeAgain = .TRUE.
                0195       n = 1
                0196       DO WHILE (doRidgeAgain)
                0197 C     save pre-ridging ice concentration and ridged ice volume
                0198       DO k=1,nITD
                0199        DO j=jMin,jMax
                0200         DO i=iMin,iMax
                0201          areaPR(i,j,k) = AREAITD(i,j,k,bi,bj)
badaa21155 Mart*0202          heffPR(i,j,k) = HEFFITD(i,j,k,bi,bj)
                0203          hsnwPR(i,j,k) = HSNOWITD(i,j,k,bi,bj)
37d4930619 Jean*0204 C        ridgeFrac(i,j,k) = 0. _d 0
1cf549c217 Mart*0205 C        IF (HEFFITD(i,j,k,bi,bj) .GT. 0. _d 0 )
                0206 C   &     ridgeFrac(i,j,k) = ridgedHeff/HEFF
                0207         ENDDO
                0208        ENDDO
                0209       ENDDO
37d4930619 Jean*0210 C
1cf549c217 Mart*0211       DO j=jMin,jMax
                0212        DO i=iMin,iMax
                0213 C     Based on the ITD of ridging and ridged ice, convert the net
                0214 C     closing rate to a gross closing rate times deltaT.
                0215 C     NOTE: 0 < ridgingModeNorm <= 1
                0216         grossClosing(i,j) = closingRate(i,j)*SEAICE_deltaTtherm
                0217      &       /ridgingModeNorm(i,j)
                0218 C     reduce rates in case more than 100% of open water would be removed
                0219         IF ( partFunc(i,j,0) .GT. 0. _d 0 ) THEN
                0220          tmp = partFunc(i,j,0)*grossClosing(i,j)
                0221          IF ( tmp .GT. opnWtrFrac(i,j,bi,bj) ) THEN
                0222           tmpFac = opnWtrFrac(i,j,bi,bj)/tmp
                0223           grossClosing(i,j) = grossClosing(i,j) * tmpFac
                0224           openingRate(i,j)  =  openingRate(i,j) * tmpFac
                0225          ENDIF
                0226         ENDIF
                0227        ENDDO
                0228       ENDDO
                0229       DO k=1,nITD
                0230        DO j=jMin,jMax
                0231         DO i=iMin,iMax
                0232 C     reduce rates in case more than 100% of any ice categroy would be removed
37d4930619 Jean*0233          IF ( areaPR(i,j,k) .GT. SEAICE_area_reg
1cf549c217 Mart*0234      &        .AND. partFunc(i,j,k) .GT. 0. _d 0 ) THEN
                0235           tmp = partFunc(i,j,k)*grossClosing(i,j)
                0236           IF ( tmp .GT. AREAITD(i,j,k,bi,bj) ) THEN
                0237            tmpFac = AREAITD(i,j,k,bi,bj)/tmp
                0238            grossClosing(i,j) = grossClosing(i,j) * tmpFac
                0239            openingRate(i,j)  =  openingRate(i,j) * tmpFac
                0240           ENDIF
                0241          ENDIF
                0242         ENDDO
                0243        ENDDO
                0244       ENDDO
                0245 C
                0246 C     start redistribution
37d4930619 Jean*0247 C
1cf549c217 Mart*0248       DO j=jMin,jMax
                0249        DO i=iMin,iMax
                0250 C     open water first
37d4930619 Jean*0251         opnWtrFrac(i,j,bi,bj) = opnWtrFrac(i,j,bi,bj)
1cf549c217 Mart*0252      &       - partFunc(i,j,0)*grossClosing(i,j)
                0253      &       + openingRate(i,j)*SEAICE_deltaTtherm
badaa21155 Mart*0254 C     need to catch openWater << 0 properly
                0255 C     negative open water it not allowed
                0256         opnWtrFrac(i,j,bi,bj) = MAX( 0. _d 0, opnWtrFrac(i,j,bi,bj) )
1cf549c217 Mart*0257        ENDDO
                0258       ENDDO
37d4930619 Jean*0259 C
1cf549c217 Mart*0260       DO k=1,nITD
                0261 C     need to catch partFunc*grossClosing > AREAITD (or areaPR)
                0262        DO j=jMin,jMax
                0263         DO i=iMin,iMax
                0264          doRidging(i,j) = areaPR(i,j,k) .GT. SEAICE_area_reg
37d4930619 Jean*0265      &        .AND. partFunc(i,j,k) .GT. 0. _d 0
1cf549c217 Mart*0266      &        .AND. grossClosing(i,j) .GT. 0. _d 0
                0267      &        .AND. HEFFM(i,j,bi,bj) .GT. 0. _d 0
                0268 C     this would be safety catch only
                0269 C     &        .AND. netArea(i,j) .GT. 1. _d 0
                0270          IF ( doRidging(i,j) ) THEN
                0271 CML          ridgingArea(i,j) = MIN(partFunc(i,j,k)*grossClosing(i,j),
                0272 CML     &         areaPR(i,j,k))
                0273           ridgingArea(i,j) = partFunc(i,j,k)*grossClosing(i,j)
37d4930619 Jean*0274           IF ( ridgingArea(i,j) .GT. areaPR(i,j,k) ) THEN
1cf549c217 Mart*0275            ridgingArea(i,j) = areaPR(i,j,k)
                0276           ENDIF
                0277           areaFraction(i,j) = ridgingArea(i,j)/areaPR(i,j,k)
                0278           ridgedArea(i,j)   = ridgingArea(i,j)/ridgeRatio(i,j,k)
                0279 C     compute ice volume (HEFF) and snow volume to be removed from this
                0280 C     ridging category
badaa21155 Mart*0281           ridgingHEFF(i,j) = heffPR(i,j,k) * areaFraction(i,j)
                0282           ridgingHsnw(i,j) = hsnwPR(i,j,k) * areaFraction(i,j)
1cf549c217 Mart*0283 C     part of the snow mass is pushed into the ocean during ridging;
37d4930619 Jean*0284 C     this freshwater flux will be added to the net feshwater flux into
1cf549c217 Mart*0285 C     the ocean in seaice_growth
37d4930619 Jean*0286           fw2ObyRidge(i,j,bi,bj) = fw2ObyRidge(i,j,bi,bj)
1cf549c217 Mart*0287      &         + SEAICE_rhoSnow*ridgingHsnw(i,j)
                0288      &         *(1. _d 0 - SEAICEsnowFracRidge)
                0289 C     reduce the snow volume that is left for redistribution
                0290           ridgingHsnw(i,j) = ridgingHsnw(i,j) * SEAICEsnowFracRidge
                0291 C     remove ice concentration, volume (HEFF), and snow volume from
                0292 C     this ridging category
                0293           AREAITD(i,j,k,bi,bj) = AREAITD(i,j,k,bi,bj) - ridgingArea(i,j)
                0294           HEFFITD(i,j,k,bi,bj) = HEFFITD(i,j,k,bi,bj) - ridgingHeff(i,j)
                0295           HSNOWITD(i,j,k,bi,bj)=HSNOWITD(i,j,k,bi,bj) - ridgingHsnw(i,j)
                0296          ENDIF
                0297         ENDDO
                0298        ENDDO
37d4930619 Jean*0299 C     inner loop over categories: distribute what has been removed from the
1cf549c217 Mart*0300 C     kth category to all categories according to area/volFraction
                0301        DO l=1,nITD
06c98f766d Mart*0302 C     initialising these is essential, because here the ridging-mask doRidging
                0303 C     to area/volFraction, and applied via these fields
1cf549c217 Mart*0304         DO j=jMin,jMax
                0305          DO i=iMin,iMax
                0306           areaFraction(i,j) = 0. _d 0
                0307           volFraction (i,j) = 0. _d 0
                0308          ENDDO
                0309         ENDDO
                0310         IF ( SEAICEredistFunc .EQ. 0 ) THEN
                0311 C     Assume ridged ice is uniformly distributed between hrmin and hrmax
                0312 C     (Hibler, 1980), see also s/r seaice_prepare_ridging.
                0313          DO j=jMin,jMax
                0314           DO i=iMin,iMax
                0315            IF ( doRidging(i,j) ) THEN
                0316             IF ( hrMin(i,j,k) .GE. hLimit(l) .OR.
                0317      &           hrMax(i,j,k) .LE. hLimit(l-1) ) THEN
                0318 CML             hL = 0. _d 0
                0319 CML             hR = 0. _d 0
                0320              areaFraction(i,j) = 0. _d 0
                0321              volFraction (i,j) = 0. _d 0
                0322             ELSE
                0323              hL = MAX(hrMin(i,j,k), hLimit(l-1))
                0324              hR = MIN(hrMax(i,j,k), hLimit(l))
37d4930619 Jean*0325              areaFraction(i,j) = ( hR - hL )
1cf549c217 Mart*0326      &            / ( hrMax(i,j,k) - hrMin(i,j,k) )
37d4930619 Jean*0327 CML             volFraction (i,j) = ( hR*hR - hL*hL )
1cf549c217 Mart*0328 CML     &            / ( hrMax(i,j,k)**2 - hrMin(i,j,k)**2 )
37d4930619 Jean*0329              volFraction (i,j) = areaFraction(i,j)*( hR + hL )
1cf549c217 Mart*0330      &            / ( hrMax(i,j,k) + hrMin(i,j,k) )
                0331             ENDIF
                0332            ENDIF
                0333           ENDDO
                0334          ENDDO
                0335         ELSEIF ( SEAICEredistFunc .EQ. 1 ) THEN
                0336 C     Follow Lipscomb et al. (2007) and model ridge ITD as an exponentially
                0337 C     decaying function, see also s/r seaice_prepare_ridging.
                0338          IF ( l.LT.nITD ) THEN
                0339           DO j=jMin,jMax
                0340            DO i=iMin,iMax
37d4930619 Jean*0341             IF ( doRidging(i,j)
                0342      &           .AND. hrMin(i,j,k) .LT. hLimit(l)
1cf549c217 Mart*0343      &           .AND. hrExp(i,j,k) .NE. 0. _d 0 ) THEN
                0344              hL   = MAX( hrMin(i,j,k), hLimit(l-1) )
                0345              hR   = hLimit(l)
                0346              expL = EXP(-( hL - hrMin(i,j,k) )/hrExp(i,j,k) )
                0347              expR = EXP(-( hR - hrMin(i,j,k) )/hrExp(i,j,k) )
                0348              areaFraction(i,j) = expL - expR
                0349              volFraction (i,j) =
                0350      &            ( ( hL + hrExp(i,j,k) ) * expL
                0351      &            - ( hR + hrExp(i,j,k) ) * expR )
                0352      &            / ( hrMin(i,j,k) + hrExp(i,j,k) )
                0353             ENDIF
                0354            ENDDO
                0355           ENDDO
                0356          ELSE
                0357           DO j=jMin,jMax
                0358            DO i=iMin,iMax
                0359             IF ( doRidging(i,j) .AND. hrExp(i,j,k) .NE. 0. _d 0 ) THEN
                0360               hL   = MAX( hrMin(i,j,k), hLimit(l-1) )
                0361               expL = EXP(-( hL - hrMin(i,j,k) )/hrExp(i,j,k) )
                0362               areaFraction(i,j) = expL
                0363               volFraction (i,j) = ( hL + hrExp(i,j,k) ) * expL
                0364      &             / ( hrMin(i,j,k) + hrExp(i,j,k) )
                0365              ENDIF
                0366            ENDDO
                0367           ENDDO
                0368          ENDIF
37d4930619 Jean*0369         ENDIF
                0370 C     after computing the fraction ridged ice for this category, apply it
1cf549c217 Mart*0371         DO j=jMin,jMax
                0372          DO i=iMin,iMax
                0373           AREAITD(i,j,l,bi,bj) = AREAITD(i,j,l,bi,bj)
badaa21155 Mart*0374      &         +areaFraction(i,j)*ridgedArea(i,j)
1cf549c217 Mart*0375           HEFFITD(i,j,l,bi,bj) = HEFFITD(i,j,l,bi,bj)
                0376      &         +volFraction(i,j)*ridgingHeff(i,j)
                0377           HSNOWITD(i,j,l,bi,bj) = HSNOWITD(i,j,l,bi,bj)
badaa21155 Mart*0378      &         +volFraction(i,j)*ridgingHsnw(i,j)*SEAICEsnowFracRidge
1cf549c217 Mart*0379          ENDDO
                0380         ENDDO
                0381 C     category l-loop
                0382        ENDDO
                0383 C     category k-loop
                0384       ENDDO
                0385 C     determine if the ridging process needs to be repeated
                0386 C     we need a new estimate of the total AREA
                0387       DO j=jMin,jMax
                0388        DO i=iMin,iMax
                0389         netArea(i,j) = 0. _d 0
                0390        ENDDO
                0391       ENDDO
                0392       DO k=1,nITD
                0393        DO j=jMin,jMax
                0394         DO i=iMin,iMax
                0395          netArea(i,j) = netArea(i,j) + AREAITD(i,j,k,bi,bj)
                0396         ENDDO
                0397        ENDDO
                0398       ENDDO
                0399       doRidgeAgain   = .FALSE.
                0400       DO j=jMin,jMax
                0401        DO i=iMin,iMax
                0402         tmp = netArea(i,j)+opnWtrFrac(i,j,bi,bj)
                0403         areaTooLarge = tmp - 1. _d 0 .GT. 1. _d -11
                0404         IF ( HEFFM(i,j,bi,bj) .GT. 0. _d 0 .AND. areaTooLarge ) THEN
                0405          doRidging(i,j) = .TRUE.
                0406          doRidgeAgain   = .TRUE.
                0407          divAdv = (1. _d 0-tmp)*recip_deltaT
badaa21155 Mart*0408          closingRate(i,j) = MAX( 0. _d 0, -divAdv)
                0409          openingRate(i,j) = MAX( 0. _d 0,  divAdv)
                0410         ELSE
                0411 C     set to zero avoid going through this grid point again
                0412          closingRate(i,j) = 0. _d 0
                0413          openingRate(i,j) = 0. _d 0
44114fe2bb Mart*0414          doRidging(i,j)   = .FALSE.
1cf549c217 Mart*0415         ENDIF
                0416        ENDDO
                0417       ENDDO
badaa21155 Mart*0418       IF ( doRidgeAgain .AND. n.GE.SEAICEridgingIterMax ) THEN
                0419 C     some debugging information
                0420        WRITE(msgBuf,'(A)') 'SEAICE_DO_RIDGING: *** WARNING ***'
                0421        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0422      &      SQUEEZE_RIGHT, myThid )
                0423        WRITE(msgBuf,'(A,I2,A)') 'SEAICE_DO_RIDGING: '//
37d4930619 Jean*0424      &      'did not converge in SEAICEridgingIterMax = ',
badaa21155 Mart*0425      &      SEAICEridgingIterMax, ' iterations.'
                0426        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0427      &      SQUEEZE_RIGHT, myThid )
                0428 CML       CALL PRINT_ERROR( msgBuf, myThid )
                0429       ENDIF
1cf549c217 Mart*0430       doRidgeAgain = doRidgeAgain .AND. n.LT.SEAICEridgingIterMax
badaa21155 Mart*0431       IF ( doRidgeAgain .AND. debugLevel .GE. debLevA ) THEN
                0432 C     some debugging information
37d4930619 Jean*0433        WRITE(msgBuf,'(A,I2,A,I10)')
badaa21155 Mart*0434      &      'SEAICE_DO_RIDGING: Repeat ridging after iteration ',
                0435      &      n, ' in timestep ', myIter
                0436        CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
                0437      &      SQUEEZE_RIGHT, myThid )
                0438       ENDIF
1cf549c217 Mart*0439       IF ( doRidgeAgain ) CALL SEAICE_PREPARE_RIDGING(
353a8877c7 Mart*0440      O     hActual,
1cf549c217 Mart*0441      O     hrMin, hrMax, hrExp, ridgeRatio, ridgingModeNorm, partFunc,
                0442      I     iMin, iMax, jMin, jMax, bi, bj, myTime, myIter, myThid )
                0443       n = n + 1
                0444 C     ridging iteration
                0445       ENDDO
                0446 C     .not. SEAICEsimpleRidging
                0447       ENDIF
                0448 #endif /* SEAICE_ITD */
                0449 
37d4930619 Jean*0450 C     after ridging is complete, the critical variables need to be
                0451 C     regularized and checked for consistency. This is done in a separate
1cf549c217 Mart*0452 C     routine
                0453 CML      CALL SEAICE_REGULARIZE( bi, bj, myTime, myIter, myThid )
                0454 
                0455       RETURN
                0456       END