/[MITgcm]/MITgcm_contrib/torge/itd/code/seaice_growth.F
ViewVC logotype

Diff of /MITgcm_contrib/torge/itd/code/seaice_growth.F

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

revision 1.11 by torge, Mon Oct 22 22:18:09 2012 UTC revision 1.17 by torge, Wed Apr 10 00:35:33 2013 UTC
# Line 58  C     !FUNCTIONS: Line 58  C     !FUNCTIONS:
58    
59  C     !LOCAL VARIABLES:  C     !LOCAL VARIABLES:
60  C     === Local variables ===  C     === Local variables ===
 #ifdef SEAICE_DEBUG  
 c ToM<<< debug seaice_growth  
 C     msgBuf      :: Informational/error message buffer  
       CHARACTER*(MAX_LEN_MBUF) msgBuf  
 c ToM>>>  
 #endif  
61  C  C
62  C unit/sign convention:  C unit/sign convention:
63  C    Within the thermodynamic computation all stocks, except HSNOW,  C    Within the thermodynamic computation all stocks, except HSNOW,
# Line 99  C     number of surface interface layer Line 93  C     number of surface interface layer
93        INTEGER kSurface        INTEGER kSurface
94  C     IT :: ice thickness category index (MULTICATEGORIES and ITD code)  C     IT :: ice thickness category index (MULTICATEGORIES and ITD code)
95        INTEGER IT        INTEGER IT
96        _RL pFac  C     msgBuf      :: Informational/error message buffer
97    #ifdef ALLOW_BALANCE_FLUXES
98          CHARACTER*(MAX_LEN_MBUF) msgBuf
99    #elif (defined (SEAICE_DEBUG))
100          CHARACTER*(MAX_LEN_MBUF) msgBuf
101          CHARACTER*12 msgBufForm
102    #endif
103  C     constants  C     constants
104          _RL pFac
105        _RL tempFrz, ICE2SNOW, SNOW2ICE        _RL tempFrz, ICE2SNOW, SNOW2ICE
106        _RL QI, QS, recip_QI        _RL QI, QS, recip_QI
107        _RL lhSublim        _RL lhSublim
# Line 134  C     facilitate multi-category snow imp Line 135  C     facilitate multi-category snow imp
135    
136  C     temporary variables available for the various computations  C     temporary variables available for the various computations
137        _RL tmpscal0, tmpscal1, tmpscal2, tmpscal3, tmpscal4        _RL tmpscal0, tmpscal1, tmpscal2, tmpscal3, tmpscal4
138    #ifdef SEAICE_ITD
139          _RL tmpscal1itd(1:sNx,1:sNy), tmpscal2itd(1:sNx,1:sNy)
140          _RL tmpscal3itd(1:sNx,1:sNy)
141    #endif
142    
143  #ifdef ALLOW_SITRACER  #ifdef ALLOW_SITRACER
144        INTEGER iTr        INTEGER iTr
# Line 165  C     AREA_PRE :: hold sea-ice fraction Line 170  C     AREA_PRE :: hold sea-ice fraction
170        _RL HEFFITDpreTH        (1:sNx,1:sNy,1:nITD)        _RL HEFFITDpreTH        (1:sNx,1:sNy,1:nITD)
171        _RL HSNWITDpreTH        (1:sNx,1:sNy,1:nITD)        _RL HSNWITDpreTH        (1:sNx,1:sNy,1:nITD)
172        _RL areaFracFactor      (1:sNx,1:sNy,1:nITD)        _RL areaFracFactor      (1:sNx,1:sNy,1:nITD)
       _RL leadIceThickMin  
173  #endif  #endif
174    
175  C     wind speed  C     wind speed
# Line 190  C     temporary variables available for Line 194  C     temporary variables available for
194  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
195        _RL r_QbyATMmult_cover  (1:sNx,1:sNy,MULTDIM)        _RL r_QbyATMmult_cover  (1:sNx,1:sNy,MULTDIM)
196        _RL r_FWbySublimMult    (1:sNx,1:sNy,MULTDIM)        _RL r_FWbySublimMult    (1:sNx,1:sNy,MULTDIM)
197    c for lateral melt parameterization:
198          _RL latMeltFrac         (1:sNx,1:sNy,MULTDIM)
199          _RL latMeltRate         (1:sNx,1:sNy,MULTDIM)
200          _RL floeAlpha
201          _RL floeDiameter
202          _RL floeDiameterMin
203          _RL floeDiameterMax
204  #endif  #endif
205    
206  C     a_QbyATM_cover :: available heat (in W/m^2) due to the interaction of  C     a_QbyATM_cover :: available heat (in W/m^2) due to the interaction of
# Line 259  C     The change of mean ice thickness d Line 270  C     The change of mean ice thickness d
270        _RL d_HEFFbyRLX         (1:sNx,1:sNy)        _RL d_HEFFbyRLX         (1:sNx,1:sNy)
271  #endif  #endif
272    
273    #ifdef SEAICE_ITD
274          _RL d_HEFFbySublim_ITD         (1:sNx,1:sNy,1:nITD)
275          _RL d_HSNWbySublim_ITD         (1:sNx,1:sNy,1:nITD)
276          _RL d_HEFFbyOCNonICE_ITD       (1:sNx,1:sNy,1:nITD)
277          _RL d_HSNWbyATMonSNW_ITD       (1:sNx,1:sNy,1:nITD)
278          _RL d_HEFFbyATMonOCN_ITD       (1:sNx,1:sNy,1:nITD)
279          _RL d_HEFFbyATMonOCN_cover_ITD (1:sNx,1:sNy,1:nITD)
280          _RL d_HEFFbyATMonOCN_open_ITD  (1:sNx,1:sNy,1:nITD)
281          _RL d_HSNWbyRAIN_ITD           (1:sNx,1:sNy,1:nITD)
282          _RL d_HSNWbyOCNonSNW_ITD       (1:sNx,1:sNy,1:nITD)
283          _RL d_HEFFbyFLOODING_ITD       (1:sNx,1:sNy,1:nITD)
284    #endif
285    
286  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
287  C ICE/SNOW stocks tendencies associated with the various melt/freeze processes  C ICE/SNOW stocks tendencies associated with the various melt/freeze processes
288        _RL d_AREAbyATM         (1:sNx,1:sNy)        _RL d_AREAbyATM         (1:sNx,1:sNy)
# Line 281  C     Helper variables for diagnostics Line 305  C     Helper variables for diagnostics
305        _RL HFsiGlob        _RL HFsiGlob
306        _RL FWF2HFsiTile(nSx,nSy)        _RL FWF2HFsiTile(nSx,nSy)
307        _RL FWF2HFsiGlob        _RL FWF2HFsiGlob
       CHARACTER*(max_len_mbuf) msgbuf  
308  #endif  #endif
309    
310  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|  C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
# Line 300  C     avoid unnecessary divisions in loo Line 323  C     avoid unnecessary divisions in loo
323  c#ifdef SEAICE_ITD  c#ifdef SEAICE_ITD
324  CToM this is now set by MULTDIM = nITD in SEAICE_SIZE.h  CToM this is now set by MULTDIM = nITD in SEAICE_SIZE.h
325  C    (see SEAICE_SIZE.h and seaice_readparms.F)  C    (see SEAICE_SIZE.h and seaice_readparms.F)
326  c     SEAICE_multDim = nITD  c     SEAICE_multDim = nITD
327  c#endif  c#endif
328        recip_multDim        = SEAICE_multDim        recip_multDim        = SEAICE_multDim
329        recip_multDim        = ONE / recip_multDim        recip_multDim        = ONE / recip_multDim
# Line 335  C conversion factors to go from Q (W/m2) Line 358  C conversion factors to go from Q (W/m2)
358  C conversion factors to go from precip (m/s) unit to HEFF (ice meters)  C conversion factors to go from precip (m/s) unit to HEFF (ice meters)
359        convertPRECIP2HI=SEAICE_deltaTtherm*rhoConstFresh/SEAICE_rhoIce        convertPRECIP2HI=SEAICE_deltaTtherm*rhoConstFresh/SEAICE_rhoIce
360        convertHI2PRECIP = ONE/convertPRECIP2HI        convertHI2PRECIP = ONE/convertPRECIP2HI
361    #ifdef SEAICE_ITD
362    c constants for lateral melt parameterization:
363    c following Steele (1992), Equ. 2
364          floeAlpha                  = 0.66 _d 0
365    c typical mean diameter used in CICE 4.1:
366    c      floeDiameter               = 300. _d 0
367    c parameters needed for variable floe diameter following Luepkes et al. (2012):
368          floeDiameterMin            = 8. _d 0
369          floeDiameterMax            = 300. _d 0
370    #endif
371    
372        DO bj=myByLo(myThid),myByHi(myThid)        DO bj=myByLo(myThid),myByHi(myThid)
373         DO bi=myBxLo(myThid),myBxHi(myThid)         DO bi=myBxLo(myThid),myBxHi(myThid)
# Line 413  C ===================== Line 446  C =====================
446              latentHeatFluxMaxMult(I,J,IT) = 0.0 _d 0              latentHeatFluxMaxMult(I,J,IT) = 0.0 _d 0
447  #endif  #endif
448  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
449              r_QbyATMmult_cover (I,J,IT)   = 0.0 _d 0              d_HEFFbySublim_ITD(I,J,IT)         = 0.0 _d 0
450              r_FWbySublimMult(I,J,IT)      = 0.0 _d 0              d_HSNWbySublim_ITD(I,J,IT)         = 0.0 _d 0
451                d_HEFFbyOCNonICE_ITD(I,J,IT)       = 0.0 _d 0
452                d_HSNWbyATMonSNW_ITD(I,J,IT)       = 0.0 _d 0
453                d_HEFFbyATMonOCN_ITD(I,J,IT)       = 0.0 _d 0
454                d_HEFFbyATMonOCN_cover_ITD(I,J,IT) = 0.0 _d 0
455                d_HEFFbyATMonOCN_open_ITD(I,J,IT)  = 0.0 _d 0
456                d_HSNWbyRAIN_ITD(I,J,IT)           = 0.0 _d 0
457                d_HSNWbyOCNonSNW_ITD(I,J,IT)       = 0.0 _d 0
458                d_HEFFbyFLOODING_ITD(I,J,IT)       = 0.0 _d 0
459                r_QbyATMmult_cover(I,J,IT)         = 0.0 _d 0
460                r_FWbySublimMult(I,J,IT)           = 0.0 _d 0
461    c for lateral melt parameterization:
462                latMeltFrac(I,J,IT)                = 0.0 _d 0
463                latMeltRate(I,J,IT)                = 0.0 _d 0
464  #endif  #endif
465            ENDDO            ENDDO
466           ENDDO           ENDDO
# Line 431  C ====================================== Line 477  C ======================================
477  C ===========PART 1: treat pathological cases (post advdiff)===========  C ===========PART 1: treat pathological cases (post advdiff)===========
478  C =====================================================================  C =====================================================================
479    
 #ifdef SEAICE_GROWTH_LEGACY  
   
         DO J=1,sNy  
          DO I=1,sNx  
           HEFFpreTH(I,J)=HEFFNM1(I,J,bi,bj)  
           HSNWpreTH(I,J)=HSNOW(I,J,bi,bj)  
           AREApreTH(I,J)=AREANM1(I,J,bi,bj)  
           d_HEFFbyNEG(I,J)=0. _d 0  
           d_HSNWbyNEG(I,J)=0. _d 0  
 #ifdef ALLOW_DIAGNOSTICS  
           DIAGarrayA(I,J) = AREANM1(I,J,bi,bj)  
           DIAGarrayB(I,J) = AREANM1(I,J,bi,bj)  
           DIAGarrayC(I,J) = HEFFNM1(I,J,bi,bj)  
           DIAGarrayD(I,J) = HSNOW(I,J,bi,bj)  
 #endif  
          ENDDO  
         ENDDO  
 #ifdef SEAICE_ITD  
         DO IT=1,nITD  
          DO J=1,sNy  
           DO I=1,sNx  
            HEFFITDpreTH(I,J,IT)=HEFFITD(I,J,IT,bi,bj)  
            HSNWITDpreTH(I,J,IT)=HSNOWITD(I,J,IT,bi,bj)  
            AREAITDpreTH(I,J,IT)=AREAITD(I,J,IT,bi,bj)  
           ENDDO  
          ENDDO  
         ENDDO  
 #endif  
   
 #else /* SEAICE_GROWTH_LEGACY */  
   
480  #if (defined ALLOW_AUTODIFF_TAMC && defined SEAICE_MODIFY_GROWTH_ADJ)  #if (defined ALLOW_AUTODIFF_TAMC && defined SEAICE_MODIFY_GROWTH_ADJ)
481  Cgf no dependency through pathological cases treatment  Cgf no dependency through pathological cases treatment
482          IF ( SEAICEadjMODE.EQ.0 ) THEN          IF ( SEAICEadjMODE.EQ.0 ) THEN
# Line 487  C           d_HEFFbyRLX(i,j) = 1. _d 1 * Line 502  C           d_HEFFbyRLX(i,j) = 1. _d 1 *
502              d_HEFFbyRLX(i,j) = 1. _d 1 * siEps              d_HEFFbyRLX(i,j) = 1. _d 1 * siEps
503             ENDIF             ENDIF
504  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
505              AREAITD(I,J,1,bi,bj) = AREAITD(I,J,1,bi,bj)              AREAITD(I,J,1,bi,bj) = AREAITD(I,J,1,bi,bj)
506       &                           +  d_AREAbyRLX(i,j)       &                           +  d_AREAbyRLX(i,j)
507              HEFFITD(I,J,1,bi,bj) = HEFFITD(I,J,1,bi,bj)              HEFFITD(I,J,1,bi,bj) = HEFFITD(I,J,1,bi,bj)
508       &                           +  d_HEFFbyRLX(i,j)       &                           +  d_HEFFbyRLX(i,j)
# Line 506  CADJ STORE heff(:,:,bi,bj)  = comlev1_bi Line 521  CADJ STORE heff(:,:,bi,bj)  = comlev1_bi
521  CADJ STORE hsnow(:,:,bi,bj) = comlev1_bibj, key = iicekey,byte=isbyte  CADJ STORE hsnow(:,:,bi,bj) = comlev1_bibj, key = iicekey,byte=isbyte
522  CADJ STORE area(:,:,bi,bj) = comlev1_bibj, key = iicekey,byte=isbyte  CADJ STORE area(:,:,bi,bj) = comlev1_bibj, key = iicekey,byte=isbyte
523  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
524    #ifdef SEAICE_ITD
525            DO IT=1,nITD
526    #endif
527          DO J=1,sNy          DO J=1,sNy
528           DO I=1,sNx           DO I=1,sNx
529  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
530            DO IT=1,nITD            tmpscal2=0. _d 0
531             tmpscal2=0. _d 0            tmpscal3=0. _d 0
532             tmpscal3=0. _d 0            tmpscal2=MAX(-HEFFITD(I,J,IT,bi,bj),0. _d 0)
533             tmpscal2=MAX(-HEFFITD(I,J,IT,bi,bj),0. _d 0)            HEFFITD(I,J,IT,bi,bj)=HEFFITD(I,J,IT,bi,bj)+tmpscal2
534             HEFFITD(I,J,IT,bi,bj)=HEFFITD(I,J,IT,bi,bj)+tmpscal2            d_HEFFbyNEG(I,J)=d_HEFFbyNEG(I,J)+tmpscal2
535             d_HEFFbyNEG(I,J)=d_HEFFbyNEG(I,J)+tmpscal2            tmpscal3=MAX(-HSNOWITD(I,J,IT,bi,bj),0. _d 0)
536             tmpscal3=MAX(-HSNOWITD(I,J,IT,bi,bj),0. _d 0)            HSNOWITD(I,J,IT,bi,bj)=HSNOWITD(I,J,IT,bi,bj)+tmpscal3
537             HSNOWITD(I,J,IT,bi,bj)=HSNOWITD(I,J,IT,bi,bj)+tmpscal3            d_HSNWbyNEG(I,J)=d_HSNWbyNEG(I,J)+tmpscal3
538             d_HSNWbyNEG(I,J)=d_HSNWbyNEG(I,J)+tmpscal3            AREAITD(I,J,IT,bi,bj)=MAX(AREAITD(I,J,IT,bi,bj),0. _d 0)
            AREAITD(I,J,IT,bi,bj)=MAX(AREAITD(I,J,IT,bi,bj),0. _d 0)  
           ENDDO  
539  CToM      AREA, HEFF, and HSNOW will be updated at end of PART 1  CToM      AREA, HEFF, and HSNOW will be updated at end of PART 1
540  C         by calling SEAICE_ITD_SUM  C         by calling SEAICE_ITD_SUM
541  #else  #else
# Line 531  C         by calling SEAICE_ITD_SUM Line 547  C         by calling SEAICE_ITD_SUM
547  #endif  #endif
548           ENDDO           ENDDO
549          ENDDO          ENDDO
550    #ifdef SEAICE_ITD
551            ENDDO
552    #endif
553    
554  C 1.25) treat the case of very thin ice:  C 1.25) treat the case of very thin ice:
555    
556  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
557  CADJ STORE heff(:,:,bi,bj)  = comlev1_bibj, key = iicekey,byte=isbyte  CADJ STORE heff(:,:,bi,bj)  = comlev1_bibj, key = iicekey,byte=isbyte
558  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
         DO J=1,sNy  
          DO I=1,sNx  
559  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
560            DO IT=1,nITD          DO IT=1,nITD
561  #endif  #endif
562            tmpscal2=0. _d 0          DO J=1,sNy
563            tmpscal3=0. _d 0           DO I=1,sNx
564              tmpscal2=0. _d 0
565              tmpscal3=0. _d 0
566  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
567             IF (HEFFITD(I,J,IT,bi,bj).LE.siEps) THEN            IF (HEFFITD(I,J,IT,bi,bj).LE.siEps) THEN
568              tmpscal2=-HEFFITD(I,J,IT,bi,bj)             tmpscal2=-HEFFITD(I,J,IT,bi,bj)
569              tmpscal3=-HSNOWITD(I,J,IT,bi,bj)             tmpscal3=-HSNOWITD(I,J,IT,bi,bj)
570              TICES(I,J,IT,bi,bj)=celsius2K             TICES(I,J,IT,bi,bj)=celsius2K
571  CToM        TICE will be updated at end of Part 1 together with AREA and HEFF  CToM       TICE will be updated at end of Part 1 together with AREA and HEFF
572             ENDIF            ENDIF
573             HEFFITD(I,J,IT,bi,bj) =HEFFITD(I,J,IT,bi,bj) +tmpscal2            HEFFITD(I,J,IT,bi,bj) =HEFFITD(I,J,IT,bi,bj) +tmpscal2
574             HSNOWITD(I,J,IT,bi,bj)=HSNOWITD(I,J,IT,bi,bj)+tmpscal3            HSNOWITD(I,J,IT,bi,bj)=HSNOWITD(I,J,IT,bi,bj)+tmpscal3
575  #else  #else
576            IF (HEFF(I,J,bi,bj).LE.siEps) THEN            IF (HEFF(I,J,bi,bj).LE.siEps) THEN
577             tmpscal2=-HEFF(I,J,bi,bj)             tmpscal2=-HEFF(I,J,bi,bj)
# Line 567  CToM        TICE will be updated at end Line 586  CToM        TICE will be updated at end
586  #endif  #endif
587            d_HEFFbyNEG(I,J)=d_HEFFbyNEG(I,J)+tmpscal2            d_HEFFbyNEG(I,J)=d_HEFFbyNEG(I,J)+tmpscal2
588            d_HSNWbyNEG(I,J)=d_HSNWbyNEG(I,J)+tmpscal3            d_HSNWbyNEG(I,J)=d_HSNWbyNEG(I,J)+tmpscal3
 #ifdef SEAICE_ITD  
           ENDDO  
 #endif  
589           ENDDO           ENDDO
590          ENDDO          ENDDO
591    #ifdef SEAICE_ITD
592            ENDDO
593    #endif
594    
595  C 1.5) treat the case of area but no ice/snow:  C 1.5) treat the case of area but no ice/snow:
596    
# Line 579  C 1.5) treat the case of area but no ice Line 598  C 1.5) treat the case of area but no ice
598  CADJ STORE heff(:,:,bi,bj)  = comlev1_bibj, key = iicekey,byte=isbyte  CADJ STORE heff(:,:,bi,bj)  = comlev1_bibj, key = iicekey,byte=isbyte
599  CADJ STORE hsnow(:,:,bi,bj) = comlev1_bibj, key = iicekey,byte=isbyte  CADJ STORE hsnow(:,:,bi,bj) = comlev1_bibj, key = iicekey,byte=isbyte
600  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
601    #ifdef SEAICE_ITD
602            DO IT=1,nITD
603    #endif
604          DO J=1,sNy          DO J=1,sNy
605           DO I=1,sNx           DO I=1,sNx
606  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
607            DO IT=1,nITD            IF ((HEFFITD(I,J,IT,bi,bj).EQ.0. _d 0).AND.
608             IF ((HEFFITD(I,J,IT,bi,bj).EQ.0. _d 0).AND.       &        (HSNOWITD(I,J,IT,bi,bj).EQ.0. _d 0))
609       &         (HSNOWITD(I,J,IT,bi,bj).EQ.0. _d 0))       &     AREAITD(I,J,IT,bi,bj)=0. _d 0
      &      AREAITD(I,J,IT,bi,bj)=0. _d 0  
           ENDDO  
610  #else  #else
611            IF ((HEFF(i,j,bi,bj).EQ.0. _d 0).AND.            IF ((HEFF(i,j,bi,bj).EQ.0. _d 0).AND.
612       &        (HSNOW(i,j,bi,bj).EQ.0. _d 0)) AREA(I,J,bi,bj)=0. _d 0       &        (HSNOW(i,j,bi,bj).EQ.0. _d 0)) AREA(I,J,bi,bj)=0. _d 0
613  #endif  #endif
614           ENDDO           ENDDO
615          ENDDO          ENDDO
616    #ifdef SEAICE_ITD
617            ENDDO
618    #endif
619    
620  C 2) treat the case of very small area:  C 2) treat the case of very small area:
621    
# Line 600  C 2) treat the case of very small area: Line 623  C 2) treat the case of very small area:
623  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
624  CADJ STORE area(:,:,bi,bj)  = comlev1_bibj, key = iicekey,byte=isbyte  CADJ STORE area(:,:,bi,bj)  = comlev1_bibj, key = iicekey,byte=isbyte
625  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
626    #ifdef SEAICE_ITD
627            DO IT=1,nITD
628    #endif
629          DO J=1,sNy          DO J=1,sNy
630           DO I=1,sNx           DO I=1,sNx
631  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
632            DO IT=1,nITD            IF ((HEFFITD(I,J,IT,bi,bj).GT.0).OR.
633             IF ((HEFFITD(I,J,IT,bi,bj).GT.0).OR.       &        (HSNOWITD(I,J,IT,bi,bj).GT.0)) THEN
634       &         (HSNOWITD(I,J,IT,bi,bj).GT.0)) THEN  CToM       SEAICE_area_floor*nITD cannot be allowed to exceed 1
635  CToM        SEAICE_area_floor*nITD cannot be allowed to exceed 1  C          hence use SEAICE_area_floor devided by nITD
636  C           hence use SEAICE_area_floor devided by nITD  C          (or install a warning in e.g. seaice_readparms.F)
637  C           (or install a warning in e.g. seaice_readparms.F)             AREAITD(I,J,IT,bi,bj)=
638              AREAITD(I,J,IT,bi,bj)=       &        MAX(AREAITD(I,J,IT,bi,bj),SEAICE_area_floor/float(nITD))
639       &         MAX(AREAITD(I,J,IT,bi,bj),SEAICE_area_floor/float(nITD))            ENDIF
            ENDIF  
           ENDDO  
640  #else  #else
641            IF ((HEFF(i,j,bi,bj).GT.0).OR.(HSNOW(i,j,bi,bj).GT.0)) THEN            IF ((HEFF(i,j,bi,bj).GT.0).OR.(HSNOW(i,j,bi,bj).GT.0)) THEN
642             AREA(I,J,bi,bj)=MAX(AREA(I,J,bi,bj),SEAICE_area_floor)             AREA(I,J,bi,bj)=MAX(AREA(I,J,bi,bj),SEAICE_area_floor)
# Line 620  C           (or install a warning in e.g Line 644  C           (or install a warning in e.g
644  #endif  #endif
645           ENDDO           ENDDO
646          ENDDO          ENDDO
647    #ifdef SEAICE_ITD
648            ENDDO
649    #endif
650  #endif /* DISABLE_AREA_FLOOR */  #endif /* DISABLE_AREA_FLOOR */
651    
652  C 2.5) treat case of excessive ice cover, e.g., due to ridging:  C 2.5) treat case of excessive ice cover, e.g., due to ridging:
# Line 645  CADJ STORE area(:,:,bi,bj)  = comlev1_bi Line 672  CADJ STORE area(:,:,bi,bj)  = comlev1_bi
672    
673  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
674  CToM catch up with items 1.25 and 2.5 involving category sums AREA and HEFF  CToM catch up with items 1.25 and 2.5 involving category sums AREA and HEFF
675          DO J=1,sNy          DO IT=1,nITD
676           DO I=1,sNx           DO J=1,sNy
677              DO I=1,sNx
678  C    TICES was changed above (item 1.25), now update TICE as ice volume  C    TICES was changed above (item 1.25), now update TICE as ice volume
679  C     weighted average of TICES  C     weighted average of TICES
680  C    also compute total of AREAITD (needed for finishing item 2.5, see below)  C    also compute total of AREAITD (needed for finishing item 2.5, see below)
681            tmpscal1 = 0. _d 0             IF (IT .eq. 1) THEN
682            tmpscal2 = 0. _d 0              tmpscal1itd(i,j) = 0. _d 0
683            tmpscal3 = 0. _d 0              tmpscal2itd(i,j) = 0. _d 0
684            DO IT=1,nITD              tmpscal3itd(i,j) = 0. _d 0
685             tmpscal1=tmpscal1 + TICES(I,J,IT,bi,bj)*HEFFITD(I,J,IT,bi,bj)             ENDIF
686             tmpscal2=tmpscal2 + HEFFITD(I,J,IT,bi,bj)             tmpscal1itd(i,j)=tmpscal1itd(i,j) + TICES(I,J,IT,bi,bj)
687             tmpscal3=tmpscal3 + AREAITD(I,J,IT,bi,bj)       &                                       * HEFFITD(I,J,IT,bi,bj)
688            ENDDO             tmpscal2itd(i,j)=tmpscal2itd(i,j) + HEFFITD(I,J,IT,bi,bj)
689            TICE(I,J,bi,bj)=tmpscal1/tmpscal2             tmpscal3itd(i,j)=tmpscal3itd(i,j) + AREAITD(I,J,IT,bi,bj)
690  C    lines of item 2.5 that were omitted:             IF (IT .eq. nITD) THEN
691                TICE(I,J,bi,bj)=tmpscal1itd(i,j)/tmpscal2itd(i,j)
692    C    lines of item 2.5 that were omitted:
693  C    in 2.5 these lines are executed before "ridging" is applied to AREA  C    in 2.5 these lines are executed before "ridging" is applied to AREA
694  C    hence we execute them here before SEAICE_ITD_REDIST is called  C    hence we execute them here before SEAICE_ITD_REDIST is called
695  C    although this means that AREA has not been completely regularized  C    although this means that AREA has not been completely regularized
696  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
697            DIAGarrayA(I,J) = tmpscal3              DIAGarrayA(I,J) = tmpscal3itd(i,j)
698  #endif  #endif
699  #ifdef ALLOW_SITRACER  #ifdef ALLOW_SITRACER
700            SItrAREA(I,J,bi,bj,1)=tmpscal3              SItrAREA(I,J,bi,bj,1)=tmpscal3itd(i,j)
701  #endif  #endif
702               ENDIF
703              ENDDO
704           ENDDO           ENDDO
705          ENDDO          ENDDO
706    
# Line 677  C    which includes ridging as in item 2 Line 709  C    which includes ridging as in item 2
709  C    and update AREA, HEFF, and HSNOW  C    and update AREA, HEFF, and HSNOW
710          CALL SEAICE_ITD_REDIST(bi, bj, myTime, myIter, myThid)          CALL SEAICE_ITD_REDIST(bi, bj, myTime, myIter, myThid)
711          CALL SEAICE_ITD_SUM(bi, bj, myTime, myIter, myThid)          CALL SEAICE_ITD_SUM(bi, bj, myTime, myIter, myThid)
712    #endif /* SEAICE_ITD */
713    
714  #ifdef SEAICE_DEBUG  #ifdef SEAICE_DEBUG
715  c ToM<<< debug seaice_growth  #ifdef SEAICE_ITD
716          WRITE(msgBuf,'(A,7F8.4)')          WRITE(msgBufForm,'(A,I2,A)') '(A,',nITD,'F14.10)'
      &    ' SEAICE_GROWTH: Heff increments 0, HEFFITD = ',  
      &     HEFFITD(1,1,:,bi,bj)  
         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,  
      &    SQUEEZE_RIGHT , myThid)  
         WRITE(msgBuf,'(A,7F8.4)')  
      &    ' SEAICE_GROWTH: Area increments 0, AREAITD = ',  
      &     AREAITD(1,1,:,bi,bj)  
         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,  
      &    SQUEEZE_RIGHT , myThid)  
 #endif  
717  #else  #else
718  #ifdef SEAICE_DEBUG          WRITE(msgBufForm,'(A,A)') '(A,  F14.10)'
719          WRITE(msgBuf,'(A,7F8.4)')  #endif
720            WRITE(msgBuf,msgBufForm)
721       &    ' SEAICE_GROWTH: Heff increments 0, HEFF = ',       &    ' SEAICE_GROWTH: Heff increments 0, HEFF = ',
722    #ifdef SEAICE_ITD
723         &     HEFFITD(1,1,:,bi,bj)
724    #else
725       &     HEFF(1,1,bi,bj)       &     HEFF(1,1,bi,bj)
726    #endif
727          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
728       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
729          WRITE(msgBuf,'(A,7F8.4)')          WRITE(msgBuf,msgBufForm)
730       &    ' SEAICE_GROWTH: Area increments 0, AREA = ',       &    ' SEAICE_GROWTH: Area increments 0, AREA = ',
731    #ifdef SEAICE_ITD
732         &     AREAITD(1,1,:,bi,bj)
733    #else
734       &     AREA(1,1,bi,bj)       &     AREA(1,1,bi,bj)
735    #endif
736          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
737       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
738  c ToM>>>  #endif /* SEAICE_DEBUG */
739  #endif  
 #endif /* SEAICE_ITD */  
740  #if (defined ALLOW_AUTODIFF_TAMC && defined SEAICE_MODIFY_GROWTH_ADJ)  #if (defined ALLOW_AUTODIFF_TAMC && defined SEAICE_MODIFY_GROWTH_ADJ)
741  C        end SEAICEadjMODE.EQ.0 statement:  C        end SEAICEadjMODE.EQ.0 statement:
742          ENDIF          ENDIF
# Line 732  C 3) store regularized values of heff, h Line 763  C 3) store regularized values of heff, h
763          DO IT=1,nITD          DO IT=1,nITD
764           DO J=1,sNy           DO J=1,sNy
765            DO I=1,sNx            DO I=1,sNx
766             HEFFITDpreTH(I,J,IT)=HEFFITD(I,J,IT,bi,bj)             HEFFITDpreTH(I,J,IT)=HEFFITD(I,J,IT,bi,bj)
767             HSNWITDpreTH(I,J,IT)=HSNOWITD(I,J,IT,bi,bj)             HSNWITDpreTH(I,J,IT)=HSNOWITD(I,J,IT,bi,bj)
768             AREAITDpreTH(I,J,IT)=AREAITD(I,J,IT,bi,bj)             AREAITDpreTH(I,J,IT)=AREAITD(I,J,IT,bi,bj)
769    
770  C memorize areal and volume fraction of each ITD category  C memorize areal and volume fraction of each ITD category
771             IF (AREA(I,J,bi,bj) .GT. ZERO) THEN             IF (AREA(I,J,bi,bj) .GT. ZERO) THEN
772              areaFracFactor(I,J,IT)=AREAITD(I,J,IT,bi,bj)/AREA(I,J,bi,bj)              areaFracFactor(I,J,IT)=AREAITD(I,J,IT,bi,bj)/AREA(I,J,bi,bj)
773             ELSE             ELSE
774  C           if there's no ice, potential growth starts in 1st category  C           if there is no ice, potential growth starts in 1st category
775              IF (IT .EQ. 1) THEN              IF (IT .EQ. 1) THEN
776               areaFracFactor(I,J,IT)=ONE               areaFracFactor(I,J,IT)=ONE
777              ELSE              ELSE
778               areaFracFactor(I,J,IT)=ZERO               areaFracFactor(I,J,IT)=ZERO
779              ENDIF              ENDIF
780             ENDIF             ENDIF
781            ENDDO            ENDDO
782           ENDDO           ENDDO
783          ENDDO          ENDDO
# Line 786  CADJ STORE heff(:,:,bi,bj)  = comlev1_bi Line 817  CADJ STORE heff(:,:,bi,bj)  = comlev1_bi
817          ENDDO          ENDDO
818  #endif /* SEAICE_VARIABLE_SALINITY */  #endif /* SEAICE_VARIABLE_SALINITY */
819    
 #endif /* SEAICE_GROWTH_LEGACY */  
   
820  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
821          IF ( useDiagnostics ) THEN          IF ( useDiagnostics ) THEN
822           CALL DIAGNOSTICS_FILL(DIAGarrayA,'SIareaPR',0,1,3,bi,bj,myThid)           CALL DIAGNOSTICS_FILL(DIAGarrayA,'SIareaPR',0,1,3,bi,bj,myThid)
# Line 859  CADJ STORE HSNWpreTH = comlev1_bibj, key Line 888  CADJ STORE HSNWpreTH = comlev1_bibj, key
888    
889  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
890            IF (HEFFITDpreTH(I,J,IT) .GT. ZERO) THEN            IF (HEFFITDpreTH(I,J,IT) .GT. ZERO) THEN
 #ifdef SEAICE_GROWTH_LEGACY  
             tmpscal1          = MAX(SEAICE_area_reg/float(nITD),  
      &                              AREAITDpreTH(I,J,IT))  
             hsnowActualMult(I,J,IT) = HSNWITDpreTH(I,J,IT)/tmpscal1  
             tmpscal2               = HEFFITDpreTH(I,J,IT)/tmpscal1  
             heffActualMult(I,J,IT)  = MAX(tmpscal2,SEAICE_hice_reg)  
 #else /* SEAICE_GROWTH_LEGACY */  
891  cif        regularize AREA with SEAICE_area_reg  cif        regularize AREA with SEAICE_area_reg
892             tmpscal1 = SQRT(AREAITDpreTH(I,J,IT) * AREAITDpreTH(I,J,IT)             tmpscal1 = SQRT(AREAITDpreTH(I,J,IT) * AREAITDpreTH(I,J,IT)
893       &                     + area_reg_sq)       &                     + area_reg_sq)
894  cif        heffActual calculated with the regularized AREA  cif        heffActual calculated with the regularized AREA
895             tmpscal2 = HEFFITDpreTH(I,J,IT) / tmpscal1             tmpscal2 = HEFFITDpreTH(I,J,IT) / tmpscal1
896  cif        regularize heffActual with SEAICE_hice_reg (add lower bound)  cif        regularize heffActual with SEAICE_hice_reg (add lower bound)
897             heffActualMult(I,J,IT) = SQRT(tmpscal2 * tmpscal2             heffActualMult(I,J,IT) = SQRT(tmpscal2 * tmpscal2
898       &                                  + hice_reg_sq)       &                                  + hice_reg_sq)
899  cif        hsnowActual calculated with the regularized AREA  cif        hsnowActual calculated with the regularized AREA
900             hsnowActualMult(I,J,IT) = HSNWITDpreTH(I,J,IT) / tmpscal1             hsnowActualMult(I,J,IT) = HSNWITDpreTH(I,J,IT) / tmpscal1
 #endif /* SEAICE_GROWTH_LEGACY */  
901  cif        regularize the inverse of heffActual by hice_reg  cif        regularize the inverse of heffActual by hice_reg
902             recip_heffActualMult(I,J,IT)  = AREAITDpreTH(I,J,IT) /             recip_heffActualMult(I,J,IT)  = AREAITDpreTH(I,J,IT) /
903       &                 sqrt(HEFFITDpreTH(I,J,IT) * HEFFITDpreTH(I,J,IT)       &                 sqrt(HEFFITDpreTH(I,J,IT) * HEFFITDpreTH(I,J,IT)
904       &                      + hice_reg_sq)       &                      + hice_reg_sq)
905  cif       Do not regularize when HEFFpreTH = 0  cif       Do not regularize when HEFFpreTH = 0
906            ELSE            ELSE
# Line 889  cif       Do not regularize when HEFFpre Line 910  cif       Do not regularize when HEFFpre
910            ENDIF            ENDIF
911  #else /* SEAICE_ITD */  #else /* SEAICE_ITD */
912            IF (HEFFpreTH(I,J) .GT. ZERO) THEN            IF (HEFFpreTH(I,J) .GT. ZERO) THEN
 #ifdef SEAICE_GROWTH_LEGACY  
             tmpscal1         = MAX(SEAICE_area_reg,AREApreTH(I,J))  
             hsnowActual(I,J) = HSNWpreTH(I,J)/tmpscal1  
             tmpscal2         = HEFFpreTH(I,J)/tmpscal1  
             heffActual(I,J)  = MAX(tmpscal2,SEAICE_hice_reg)  
 #else /* SEAICE_GROWTH_LEGACY */  
913  Cif        regularize AREA with SEAICE_area_reg  Cif        regularize AREA with SEAICE_area_reg
914             tmpscal1 = SQRT(AREApreTH(I,J)* AREApreTH(I,J) + area_reg_sq)             tmpscal1 = SQRT(AREApreTH(I,J)* AREApreTH(I,J) + area_reg_sq)
915  Cif        heffActual calculated with the regularized AREA  Cif        heffActual calculated with the regularized AREA
# Line 903  Cif        regularize heffActual with SE Line 918  Cif        regularize heffActual with SE
918             heffActual(I,J) = SQRT(tmpscal2 * tmpscal2 + hice_reg_sq)             heffActual(I,J) = SQRT(tmpscal2 * tmpscal2 + hice_reg_sq)
919  Cif        hsnowActual calculated with the regularized AREA  Cif        hsnowActual calculated with the regularized AREA
920             hsnowActual(I,J) = HSNWpreTH(I,J) / tmpscal1             hsnowActual(I,J) = HSNWpreTH(I,J) / tmpscal1
 #endif /* SEAICE_GROWTH_LEGACY */  
921  Cif        regularize the inverse of heffActual by hice_reg  Cif        regularize the inverse of heffActual by hice_reg
922             recip_heffActual(I,J)  = AREApreTH(I,J) /             recip_heffActual(I,J)  = AREApreTH(I,J) /
923       &                 sqrt(HEFFpreTH(I,J)*HEFFpreTH(I,J) + hice_reg_sq)       &                 sqrt(HEFFpreTH(I,J)*HEFFpreTH(I,J) + hice_reg_sq)
# Line 1031  CADJ &                       key = iicek Line 1045  CADJ &                       key = iicek
1045    
1046  C--   Start loop over multi-categories  C--   Start loop over multi-categories
1047  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1048  CToM  SEAICE_multDim = nITD (see SEAICE_SIZE.h and seaice_readparms.F)          DO IT=1,nITD
1049  #endif           DO J=1,sNy
1050              DO I=1,sNx
1051    CToM for SEAICE_ITD heffActualMult and latentHeatFluxMaxMult are calculated above
1052    C    (instead of heffActual and latentHeatFluxMax)
1053               ticeInMult(I,J,IT)=TICES(I,J,IT,bi,bj)
1054               ticeOutMult(I,J,IT)=TICES(I,J,IT,bi,bj)
1055               TICE(I,J,bi,bj) = ZERO
1056               TICES(I,J,IT,bi,bj) = ZERO
1057              ENDDO
1058             ENDDO
1059            ENDDO
1060    #else
1061          DO IT=1,SEAICE_multDim          DO IT=1,SEAICE_multDim
1062  C        homogeneous distribution between 0 and 2 x heffActual  C        homogeneous distribution between 0 and 2 x heffActual
 #ifndef SEAICE_ITD  
1063           pFac = (2.0 _d 0*IT - 1.0 _d 0)*recip_multDim           pFac = (2.0 _d 0*IT - 1.0 _d 0)*recip_multDim
1064           pFacSnow = 1. _d 0           pFacSnow = 1. _d 0
1065           IF ( SEAICE_useMultDimSnow ) pFacSnow=pFac           IF ( SEAICE_useMultDimSnow ) pFacSnow=pFac
 #endif  
1066           DO J=1,sNy           DO J=1,sNy
1067            DO I=1,sNx            DO I=1,sNx
 #ifndef SEAICE_ITD  
 CToM for SEAICE_ITD heffActualMult and latentHeatFluxMaxMult are calculated above  
 C    (instead of heffActual and latentHeatFluxMax)  
1068             heffActualMult(I,J,IT)= heffActual(I,J)*pFac             heffActualMult(I,J,IT)= heffActual(I,J)*pFac
1069             hsnowActualMult(I,J,IT)=hsnowActual(I,J)*pFacSnow             hsnowActualMult(I,J,IT)=hsnowActual(I,J)*pFacSnow
1070  #ifdef SEAICE_CAP_SUBLIM  #ifdef SEAICE_CAP_SUBLIM
1071             latentHeatFluxMaxMult(I,J,IT) = latentHeatFluxMax(I,J)*pFac             latentHeatFluxMaxMult(I,J,IT) = latentHeatFluxMax(I,J)*pFac
1072  #endif  #endif
 #endif  
1073             ticeInMult(I,J,IT)=TICES(I,J,IT,bi,bj)             ticeInMult(I,J,IT)=TICES(I,J,IT,bi,bj)
1074             ticeOutMult(I,J,IT)=TICES(I,J,IT,bi,bj)             ticeOutMult(I,J,IT)=TICES(I,J,IT,bi,bj)
1075             TICE(I,J,bi,bj) = ZERO             TICE(I,J,bi,bj) = ZERO
# Line 1058  C    (instead of heffActual and latentHe Line 1077  C    (instead of heffActual and latentHe
1077            ENDDO            ENDDO
1078           ENDDO           ENDDO
1079          ENDDO          ENDDO
1080    #endif
1081    
1082  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
1083  CADJ STORE heffActualMult = comlev1_bibj, key = iicekey, byte = isbyte  CADJ STORE heffActualMult = comlev1_bibj, key = iicekey, byte = isbyte
# Line 1110  CADJ &     comlev1_bibj, key = iicekey, Line 1130  CADJ &     comlev1_bibj, key = iicekey,
1130  C     update TICE & TICES  C     update TICE & TICES
1131  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1132  C     calculate area weighted mean  C     calculate area weighted mean
1133  C     (although the ice's temperature relates to its energy content  C     (although the ice temperature relates to its energy content
1134  C      and hence should be averaged weighted by ice volume,  C      and hence should be averaged weighted by ice volume,
1135  C      the temperature here is a result of the fluxes through the ice surface  C      the temperature here is a result of the fluxes through the ice surface
1136  C      computed individually for each single category in SEAICE_SOLVE4TEMP  C      computed individually for each single category in SEAICE_SOLVE4TEMP
1137  C      and hence is averaged area weighted [areaFracFactor])  C      and hence is averaged area weighted [areaFracFactor])
1138             TICE(I,J,bi,bj) = TICE(I,J,bi,bj)             TICE(I,J,bi,bj) = TICE(I,J,bi,bj)
1139       &          +  ticeOutMult(I,J,IT)*areaFracFactor(I,J,IT)       &          +  ticeOutMult(I,J,IT)*areaFracFactor(I,J,IT)
# Line 1173  CADJ STORE a_FWbySublim    = comlev1_bib Line 1193  CADJ STORE a_FWbySublim    = comlev1_bib
1193    
1194  C switch heat fluxes from W/m2 to 'effective' ice meters  C switch heat fluxes from W/m2 to 'effective' ice meters
1195  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1196          DO IT=1,nITD          DO IT=1,nITD
1197           DO J=1,sNy           DO J=1,sNy
1198            DO I=1,sNx            DO I=1,sNx
1199             a_QbyATMmult_cover(I,J,IT)   = a_QbyATMmult_cover(I,J,IT)             a_QbyATMmult_cover(I,J,IT)   = a_QbyATMmult_cover(I,J,IT)
# Line 1190  C     Negative sublimation is resublimat Line 1210  C     Negative sublimation is resublimat
1210             a_FWbySublimMult(I,J,IT) = SEAICE_deltaTtherm*recip_rhoIce             a_FWbySublimMult(I,J,IT) = SEAICE_deltaTtherm*recip_rhoIce
1211       &            * a_FWbySublimMult(I,J,IT)*AREAITDpreTH(I,J,IT)       &            * a_FWbySublimMult(I,J,IT)*AREAITDpreTH(I,J,IT)
1212             r_FWbySublimMult(I,J,IT)=a_FWbySublimMult(I,J,IT)             r_FWbySublimMult(I,J,IT)=a_FWbySublimMult(I,J,IT)
1213            ENDDO            ENDDO
1214           ENDDO           ENDDO
1215          ENDDO          ENDDO
1216          DO J=1,sNy          DO J=1,sNy
# Line 1246  CADJ STORE r_FWbySublim    = comlev1_bib Line 1266  CADJ STORE r_FWbySublim    = comlev1_bib
1266  Cgf no additional dependency through ice cover  Cgf no additional dependency through ice cover
1267          IF ( SEAICEadjMODE.GE.3 ) THEN          IF ( SEAICEadjMODE.GE.3 ) THEN
1268  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1269           DO IT=1,nITD           DO IT=1,nITD
1270            DO J=1,sNy            DO J=1,sNy
1271             DO I=1,sNx             DO I=1,sNx
1272              a_QbyATMmult_cover(I,J,IT)   = 0. _d 0              a_QbyATMmult_cover(I,J,IT)   = 0. _d 0
# Line 1254  Cgf no additional dependency through ice Line 1274  Cgf no additional dependency through ice
1274              a_QSWbyATMmult_cover(I,J,IT) = 0. _d 0              a_QSWbyATMmult_cover(I,J,IT) = 0. _d 0
1275             ENDDO             ENDDO
1276            ENDDO            ENDDO
1277           ENDDO           ENDDO
1278  #else  #else
1279           DO J=1,sNy           DO J=1,sNy
1280            DO I=1,sNx            DO I=1,sNx
# Line 1311  C available turbulent flux Line 1331  C available turbulent flux
1331           ENDDO           ENDDO
1332          ENDDO          ENDDO
1333    
1334    #ifdef SEAICE_ITD
1335    C determine lateral melt rate at floe edges based on an
1336    C average floe diameter or a floe size distribution
1337    C following Steele (1992, Tab. 2)
1338    C ======================================================
1339            DO J=1,sNy
1340             DO I=1,sNx
1341              tmpscal1=(theta(I,J,kSurface,bi,bj)-tempFrz)
1342              tmpscal2=sqrt(0.87 + 0.067*UG(i,j)) * UG(i,j)
1343    c
1344    c variable floe diameter following Luepkes et al. (2012, JGR, Equ. 26) with beta=1
1345              tmpscal3=ONE/(ONE-(floeDiameterMin/floeDiameterMax))
1346              floeDiameter = floeDiameterMin
1347         &                 * (tmpscal3 / (tmpscal3-AREApreTH(I,J)))
1348              DO IT=1,nITD
1349    C following the idea of SEAICE_areaLossFormula == 1:
1350               IF (r_QbyATMmult_cover(i,j,it).LT.ZERO .OR.
1351         &         r_QbyATM_open(i,j) .LT.ZERO .OR.
1352         &         r_QbyOCN(i,j)      .LT.ZERO) THEN
1353    c lateral melt rate as suggested by Perovich, 1983 (PhD thesis)
1354    c            latMeltRate(i,j,it) = 1.6 _d -6 * tmpscal1**1.36
1355    c lateral melt rate as suggested by Maykut and Perovich, 1987 (JGR 92(C7)), Equ. 24
1356    c            latMeltRate(i,j,it) = 13.5 _d -6 * tmpscal2 * tmpscal1**1.3
1357    c further suggestion by Maykut and Perovich to avoid latMeltRate -> 0 for UG -> 0
1358                latMeltRate(i,j,it) = (1.6 _d -6 + 13.5 _d -6 * tmpscal2)
1359         &                          * tmpscal1**1.3
1360    c factor determining fraction of area and ice volume reduction
1361    c due to lateral melt
1362                latMeltFrac(i,j,it) =
1363         &       latMeltRate(i,j,it)*SEAICE_deltaTtherm*PI /
1364         &       (floeAlpha * floeDiameter)
1365                latMeltFrac(i,j,it)=max(ZERO, min(latMeltFrac(i,j,it),ONE))
1366                print*,'latMelt',it,tmpscal1,latMeltRate(i,j,it),
1367         &                       areaitd(i,j,it,bi,bj),latMeltFrac(i,j,it)
1368               ELSE
1369    c            latMeltRate(i,j,it)=0.0 _d 0
1370                latMeltFrac(i,j,it)=0.0 _d 0
1371                print*,'latMelt',it,' 0.0 0.0 ',
1372         &                       areaitd(i,j,it,bi,bj),latMeltFrac(i,j,it)
1373               ENDIF
1374              ENDDO
1375             ENDDO
1376            ENDDO
1377    #endif
1378    
1379  #if (defined ALLOW_AUTODIFF_TAMC && defined SEAICE_MODIFY_GROWTH_ADJ)  #if (defined ALLOW_AUTODIFF_TAMC && defined SEAICE_MODIFY_GROWTH_ADJ)
1380          CALL ZERO_ADJ_1D( sNx*sNy, r_QbyOCN, myThid)          CALL ZERO_ADJ_1D( sNx*sNy, r_QbyOCN, myThid)
1381  #endif  #endif
# Line 1336  C     First sublimate/deposite snow Line 1401  C     First sublimate/deposite snow
1401  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1402       &     MAX(MIN(r_FWbySublimMult(I,J,IT),HSNOWITD(I,J,IT,bi,bj)       &     MAX(MIN(r_FWbySublimMult(I,J,IT),HSNOWITD(I,J,IT,bi,bj)
1403       &             *SNOW2ICE),ZERO)       &             *SNOW2ICE),ZERO)
1404              d_HSNWbySublim_ITD(I,J,IT) = - tmpscal2 * ICE2SNOW
1405  C         accumulate change over ITD categories  C         accumulate change over ITD categories
1406            d_HSNWbySublim(I,J)     = d_HSNWbySublim(I,J)      - tmpscal2            d_HSNWbySublim(I,J)     = d_HSNWbySublim(I,J)      - tmpscal2
1407       &                                                       *ICE2SNOW       &                                                       *ICE2SNOW
           HSNOWITD(I,J,IT,bi,bj)  = HSNOWITD(I,J,IT,bi,bj)   - tmpscal2  
      &                                                       *ICE2SNOW  
1408            r_FWbySublimMult(I,J,IT)= r_FWbySublimMult(I,J,IT) - tmpscal2            r_FWbySublimMult(I,J,IT)= r_FWbySublimMult(I,J,IT) - tmpscal2
1409  #else  #else
1410       &     MAX(MIN(r_FWbySublim(I,J),HSNOW(I,J,bi,bj)*SNOW2ICE),ZERO)       &     MAX(MIN(r_FWbySublim(I,J),HSNOW(I,J,bi,bj)*SNOW2ICE),ZERO)
# Line 1360  C     If anything is left, sublimate ice Line 1424  C     If anything is left, sublimate ice
1424            tmpscal2 =            tmpscal2 =
1425  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1426       &     MAX(MIN(r_FWbySublimMult(I,J,IT),HEFFITD(I,J,IT,bi,bj)),ZERO)       &     MAX(MIN(r_FWbySublimMult(I,J,IT),HEFFITD(I,J,IT,bi,bj)),ZERO)
1427              d_HEFFbySublim_ITD(I,J,IT) = - tmpscal2
1428  C         accumulate change over ITD categories  C         accumulate change over ITD categories
1429            d_HSNWbySublim(I,J)      = d_HSNWbySublim(I,J)      - tmpscal2            d_HEFFbySublim(I,J)      = d_HEFFbySublim(I,J)      - tmpscal2
           HEFFITD(I,J,IT,bi,bj)    = HEFFITD(I,J,IT,bi,bj)    - tmpscal2  
1430            r_FWbySublimMult(I,J,IT) = r_FWbySublimMult(I,J,IT) - tmpscal2            r_FWbySublimMult(I,J,IT) = r_FWbySublimMult(I,J,IT) - tmpscal2
1431  #else  #else
1432       &     MAX(MIN(r_FWbySublim(I,J),HEFF(I,J,bi,bj)),ZERO)       &     MAX(MIN(r_FWbySublim(I,J),HEFF(I,J,bi,bj)),ZERO)
# Line 1390  C     remove the fusion part for the res Line 1454  C     remove the fusion part for the res
1454          ENDDO          ENDDO
1455  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1456  C       end IT loop  C       end IT loop
1457          ENDDO          ENDDO
1458  #endif  #endif
1459  #ifdef SEAICE_DEBUG  #ifdef SEAICE_DEBUG
1460  c ToM<<< debug seaice_growth  c ToM<<< debug seaice_growth
1461          WRITE(msgBuf,'(A,7F8.4)')          WRITE(msgBuf,msgBufForm)
1462         &    ' SEAICE_GROWTH: Hsnow increments 1, d_HSNWySublim = ',
1463  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1464       &    ' SEAICE_GROWTH: Heff increments 1, HEFFITD = ',       &     d_HSNWbySublim_ITD(1,1,:)
1465       &     HEFFITD(1,1,:,bi,bj)  #else
1466         &     d_HSNWbySublim(1,1)
1467    #endif
1468          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
1469       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
1470          WRITE(msgBuf,'(A,7F8.4)')          WRITE(msgBuf,msgBufForm)
1471       &    ' SEAICE_GROWTH: Area increments 1, AREAITD = ',       &    ' SEAICE_GROWTH: Heff increments 1, d_HEFFbySublim = ',
1472       &     AREAITD(1,1,:,bi,bj)  #ifdef SEAICE_ITD
1473         &     d_HEFFbySublim_ITD(1,1,:)
1474  #else  #else
1475       &    ' SEAICE_GROWTH: Heff increments 1, HEFF = ',       &     d_HEFFbySublim(1,1)
      &     HEFF(1,1,bi,bj)  
1476  #endif  #endif
1477          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
1478       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
1479  c ToM>>>  c ToM>>>
1480  #endif  #endif /* SEAICE_DEBUG */
1481    
1482  C compute ice thickness tendency due to ice-ocean interaction  C compute ice thickness tendency due to ice-ocean interaction
1483  C ===========================================================  C ===========================================================
# Line 1424  CADJ STORE r_QbyOCN = comlev1_bibj,key=i Line 1491  CADJ STORE r_QbyOCN = comlev1_bibj,key=i
1491          DO IT=1,nITD          DO IT=1,nITD
1492           DO J=1,sNy           DO J=1,sNy
1493            DO I=1,sNx            DO I=1,sNx
1494  C          ice growth/melt due to ocean heat r_QbyOCN (W/m^2) is  C          ice growth/melt due to ocean heat r_QbyOCN (W/m^2) is
1495  C          equally distributed under the ice and hence weighted by  C          equally distributed under the ice and hence weighted by
1496  C          fractional area of each thickness category  C          fractional area of each thickness category
1497             tmpscal1=MAX(r_QbyOCN(i,j)*areaFracFactor(I,J,IT),             tmpscal1=MAX(r_QbyOCN(i,j)*areaFracFactor(I,J,IT),
1498       &                               -HEFFITD(I,J,IT,bi,bj))       &                               -HEFFITD(I,J,IT,bi,bj))
1499               d_HEFFbyOCNonICE_ITD(I,J,IT)=tmpscal1
1500             d_HEFFbyOCNonICE(I,J) = d_HEFFbyOCNonICE(I,J) + tmpscal1             d_HEFFbyOCNonICE(I,J) = d_HEFFbyOCNonICE(I,J) + tmpscal1
            HEFFITD(I,J,IT,bi,bj) = HEFFITD(I,J,IT,bi,bj) + tmpscal1  
 #ifdef ALLOW_SITRACER  
            SItrHEFF(I,J,bi,bj,2) = SItrHEFF(I,J,bi,bj,2)  
      &                           + HEFFITD(I,J,IT,bi,bj)  
 #endif  
1501            ENDDO            ENDDO
1502           ENDDO           ENDDO
1503          ENDDO          ENDDO
1504    #ifdef ALLOW_SITRACER
1505            DO J=1,sNy
1506             DO I=1,sNx
1507              SItrHEFF(I,J,bi,bj,2) = HEFFpreTH(I,J)
1508         &                          + d_HEFFbySublim(I,J)
1509         &                          + d_HEFFbyOCNonICE(I,J)
1510             ENDDO
1511            ENDDO
1512    #endif
1513          DO J=1,sNy          DO J=1,sNy
1514           DO I=1,sNx           DO I=1,sNx
1515            r_QbyOCN(I,J)=r_QbyOCN(I,J)-d_HEFFbyOCNonICE(I,J)            r_QbyOCN(I,J)=r_QbyOCN(I,J)-d_HEFFbyOCNonICE(I,J)
# Line 1457  C          fractional area of each thick Line 1529  C          fractional area of each thick
1529  #endif /* SEAICE_ITD */  #endif /* SEAICE_ITD */
1530  #ifdef SEAICE_DEBUG  #ifdef SEAICE_DEBUG
1531  c ToM<<< debug seaice_growth  c ToM<<< debug seaice_growth
1532          WRITE(msgBuf,'(A,7F8.4)')          WRITE(msgBuf,msgBufForm)
1533         &    ' SEAICE_GROWTH: Heff increments 2, d_HEFFbyOCNonICE = ',
1534  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1535       &    ' SEAICE_GROWTH: Heff increments 2, HEFFITD = ',       &     d_HEFFbyOCNonICE_ITD(1,1,:)
      &     HEFFITD(1,1,:,bi,bj)  
         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,  
      &    SQUEEZE_RIGHT , myThid)  
         WRITE(msgBuf,'(A,7F8.4)')  
      &    ' SEAICE_GROWTH: Area increments 2, AREAITD = ',  
      &     AREAITD(1,1,:,bi,bj)  
1536  #else  #else
1537       &    ' SEAICE_GROWTH: Heff increments 2, HEFF = ',       &     d_HEFFbyOCNonICE(1,1)
      &     HEFF(1,1,bi,bj)  
1538  #endif  #endif
1539          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
1540       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
1541  c ToM>>>  c ToM>>>
1542  #endif  #endif /* SEAICE_DEBUG */
1543    
1544  C compute snow melt tendency due to snow-atmosphere interaction  C compute snow melt tendency due to snow-atmosphere interaction
1545  C ==================================================================  C ==================================================================
# Line 1484  CADJ STORE r_QbyATM_cover = comlev1_bibj Line 1550  CADJ STORE r_QbyATM_cover = comlev1_bibj
1550  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
1551    
1552  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1553          DO IT=1,nITD          DO IT=1,nITD
1554           DO J=1,sNy           DO J=1,sNy
1555            DO I=1,sNx            DO I=1,sNx
1556  C     Convert to standard units (meters of ice) rather than to meters  C     Convert to standard units (meters of ice) rather than to meters
# Line 1496  C     of snow. This appears to be more r Line 1562  C     of snow. This appears to be more r
1562  Cgf no additional dependency through snow  Cgf no additional dependency through snow
1563             IF ( SEAICEadjMODE.GE.2 ) tmpscal2 = 0. _d 0             IF ( SEAICEadjMODE.GE.2 ) tmpscal2 = 0. _d 0
1564  #endif  #endif
1565               d_HSNWbyATMonSNW_ITD(I,J,IT) = tmpscal2*ICE2SNOW
1566             d_HSNWbyATMonSNW(I,J) = d_HSNWbyATMonSNW(I,J)             d_HSNWbyATMonSNW(I,J) = d_HSNWbyATMonSNW(I,J)
1567       &                           + tmpscal2*ICE2SNOW       &                           + tmpscal2*ICE2SNOW
1568             HSNOWITD(I,J,IT,bi,bj)= HSNOWITD(I,J,IT,bi,bj)             r_QbyATMmult_cover(I,J,IT)=r_QbyATMmult_cover(I,J,IT)
      &                           + tmpscal2*ICE2SNOW  
            r_QbyATMmult_cover(I,J,IT)=r_QbyATMmult_cover(I,J,IT)  
1569       &                           - tmpscal2       &                           - tmpscal2
1570            ENDDO            ENDDO
1571           ENDDO           ENDDO
1572          ENDDO          ENDDO
1573  #else /* SEAICE_ITD */  #else /* SEAICE_ITD */
1574          DO J=1,sNy          DO J=1,sNy
1575           DO I=1,sNx           DO I=1,sNx
# Line 1524  Cgf no additional dependency through sno Line 1589  Cgf no additional dependency through sno
1589  #endif /* SEAICE_ITD */  #endif /* SEAICE_ITD */
1590  #ifdef SEAICE_DEBUG  #ifdef SEAICE_DEBUG
1591  c ToM<<< debug seaice_growth  c ToM<<< debug seaice_growth
1592          WRITE(msgBuf,'(A,7F8.4)')          WRITE(msgBuf,msgBufForm)
1593         &    ' SEAICE_GROWTH: Hsnow increments 3, d_HSNWbyATMonSNW = ',
1594  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1595       &    ' SEAICE_GROWTH: Heff increments 3, HEFFITD = ',       &    d_HSNWbyATMonSNW_ITD(1,1,:)
      &     HEFFITD(1,1,:,bi,bj)  
         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,  
      &    SQUEEZE_RIGHT , myThid)  
         WRITE(msgBuf,'(A,7F8.4)')  
      &    ' SEAICE_GROWTH: Area increments 3, AREAITD = ',  
      &     AREAITD(1,1,:,bi,bj)  
1596  #else  #else
1597       &    ' SEAICE_GROWTH: Heff increments 3, HEFF = ',       &    d_HSNWbyATMonSNW(1,1)
      &     HEFF(1,1,bi,bj)  
1598  #endif  #endif
1599          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
1600       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
1601  c ToM>>>  c ToM>>>
1602  #endif  #endif /* SEAICE_DEBUG */
1603    
1604  C compute ice thickness tendency due to the atmosphere  C compute ice thickness tendency due to the atmosphere
1605  C ====================================================  C ====================================================
# Line 1556  Cgf the v1.81=>v1.82 revision would chan Line 1615  Cgf the v1.81=>v1.82 revision would chan
1615  Cgf warming conditions, the lab_sea results were not changed.  Cgf warming conditions, the lab_sea results were not changed.
1616    
1617  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1618          DO IT=1,nITD          DO IT=1,nITD
1619           DO J=1,sNy           DO J=1,sNy
1620            DO I=1,sNx            DO I=1,sNx
1621  #ifdef SEAICE_GROWTH_LEGACY             tmpscal1 = HEFFITDpreTH(I,J,IT)
1622             tmpscal2 = MAX(-HEFFITD(I,J,IT,bi,bj),       &              + d_HEFFbySublim_ITD(I,J,IT)
1623       &                     r_QbyATMmult_cover(I,J,IT))       &              + d_HEFFbyOCNonICE_ITD(I,J,IT)
1624  #else             tmpscal2 = MAX(-tmpscal1,
            tmpscal2 = MAX(-HEFFITD(I,J,IT,bi,bj),  
1625       &                     r_QbyATMmult_cover(I,J,IT)       &                     r_QbyATMmult_cover(I,J,IT)
1626  c         Limit ice growth by potential melt by ocean  c         Limit ice growth by potential melt by ocean
1627       &              + AREAITDpreTH(I,J,IT) * r_QbyOCN(I,J))       &              + AREAITDpreTH(I,J,IT) * r_QbyOCN(I,J))
1628  #endif /* SEAICE_GROWTH_LEGACY */             d_HEFFbyATMonOCN_cover_ITD(I,J,IT) = tmpscal2
1629             d_HEFFbyATMonOCN_cover(I,J) = d_HEFFbyATMonOCN_cover(I,J)             d_HEFFbyATMonOCN_cover(I,J) = d_HEFFbyATMonOCN_cover(I,J)
1630       &                                 + tmpscal2       &                                 + tmpscal2
1631               d_HEFFbyATMonOCN_ITD(I,J,IT) = d_HEFFbyATMonOCN_ITD(I,J,IT)
1632         &                                 + tmpscal2
1633             d_HEFFbyATMonOCN(I,J)       = d_HEFFbyATMonOCN(I,J)             d_HEFFbyATMonOCN(I,J)       = d_HEFFbyATMonOCN(I,J)
1634       &                                 + tmpscal2       &                                 + tmpscal2
1635             r_QbyATMmult_cover(I,J,IT)  = r_QbyATMmult_cover(I,J,IT)             r_QbyATMmult_cover(I,J,IT)  = r_QbyATMmult_cover(I,J,IT)
1636       &                                 - tmpscal2       &                                 - tmpscal2
1637             HEFFITD(I,J,IT,bi,bj) = HEFFITD(I,J,IT,bi,bj) + tmpscal2            ENDDO
1638             ENDDO
1639            ENDDO
1640  #ifdef ALLOW_SITRACER  #ifdef ALLOW_SITRACER
1641             SItrHEFF(I,J,bi,bj,3) = SItrHEFF(I,J,bi,bj,3)          DO J=1,sNy
1642       &                           + HEFFITD(I,J,IT,bi,bj)           DO I=1,sNx
1643              SItrHEFF(I,J,bi,bj,3) = SItrHEFF(I,J,bi,bj,2)
1644         &                          + d_HEFFbyATMonOCN_cover(I,J)
1645             ENDDO
1646            ENDDO
1647  #endif  #endif
           ENDDO  
          ENDDO  
         ENDDO  
1648  #else /* SEAICE_ITD */  #else /* SEAICE_ITD */
1649          DO J=1,sNy          DO J=1,sNy
1650           DO I=1,sNx           DO I=1,sNx
1651    
 #ifdef SEAICE_GROWTH_LEGACY  
           tmpscal2 = MAX(-HEFF(I,J,bi,bj),r_QbyATM_cover(I,J))  
 #else  
1652            tmpscal2 = MAX(-HEFF(I,J,bi,bj),r_QbyATM_cover(I,J)+            tmpscal2 = MAX(-HEFF(I,J,bi,bj),r_QbyATM_cover(I,J)+
1653  C         Limit ice growth by potential melt by ocean  C         Limit ice growth by potential melt by ocean
1654       &        AREApreTH(I,J) * r_QbyOCN(I,J))       &        AREApreTH(I,J) * r_QbyOCN(I,J))
 #endif /* SEAICE_GROWTH_LEGACY */  
1655    
1656            d_HEFFbyATMonOCN_cover(I,J)=tmpscal2            d_HEFFbyATMonOCN_cover(I,J)=tmpscal2
1657            d_HEFFbyATMonOCN(I,J)=d_HEFFbyATMonOCN(I,J)+tmpscal2            d_HEFFbyATMonOCN(I,J)=d_HEFFbyATMonOCN(I,J)+tmpscal2
# Line 1608  C         Limit ice growth by potential Line 1666  C         Limit ice growth by potential
1666  #endif /* SEAICE_ITD */  #endif /* SEAICE_ITD */
1667  #ifdef SEAICE_DEBUG  #ifdef SEAICE_DEBUG
1668  c ToM<<< debug seaice_growth  c ToM<<< debug seaice_growth
1669          WRITE(msgBuf,'(A,7F8.4)')          WRITE(msgBuf,msgBufForm)
1670         &   ' SEAICE_GROWTH: Heff increments 4, d_HEFFbyATMonOCN_cover = ',
1671  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1672       &    ' SEAICE_GROWTH: Heff increments 4, HEFFITD = ',       &     d_HEFFbyATMonOCN_cover_ITD(1,1,:)
1673       &     HEFFITD(1,1,:,bi,bj)  #else
1674         &     d_HEFFbyATMonOCN_cover(1,1)
1675    #endif
1676          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
1677       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
1678          WRITE(msgBuf,'(A,7F8.4)')          WRITE(msgBuf,msgBufForm)
1679       &    ' SEAICE_GROWTH: Area increments 4, AREAITD = ',       &    ' SEAICE_GROWTH: Heff increments 4, d_HEFFbyATMonOCN = ',
1680       &     AREAITD(1,1,:,bi,bj)  #ifdef SEAICE_ITD
1681         &     d_HEFFbyATMonOCN_ITD(1,1,:)
1682  #else  #else
1683       &    ' SEAICE_GROWTH: Heff increments 4, HEFF = ',       &     d_HEFFbyATMonOCN(1,1)
      &     HEFF(1,1,bi,bj)  
1684  #endif  #endif
1685          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
1686       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
1687  c ToM>>>  c ToM>>>
1688  #endif  #endif /* SEAICE_DEBUG */
1689    
1690  C add snow precipitation to HSNOW.  C add snow precipitation to HSNOW.
1691  C =================================================  C =================================================
# Line 1668  C           add precip to the fresh wate Line 1729  C           add precip to the fresh wate
1729           ENDDO           ENDDO
1730          ENDDO          ENDDO
1731  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1732          DO IT=1,nITD          DO IT=1,nITD
1733           DO J=1,sNy           DO J=1,sNy
1734            DO I=1,sNx            DO I=1,sNx
1735             HSNOWITD(I,J,IT,bi,bj) = HSNOWITD(I,J,IT,bi,bj)             d_HSNWbyRAIN_ITD(I,J,IT)
1736       &     + d_HSNWbyRAIN(I,J)*areaFracFactor(I,J,IT)       &     = d_HSNWbyRAIN(I,J)*areaFracFactor(I,J,IT)
1737            ENDDO            ENDDO
1738           ENDDO           ENDDO
1739          ENDDO          ENDDO
1740  #else  #else
1741          DO J=1,sNy          DO J=1,sNy
1742           DO I=1,sNx           DO I=1,sNx
# Line 1691  C end of IF statement snowPrecipFile: Line 1752  C end of IF statement snowPrecipFile:
1752  #endif /* ALLOW_ATM_TEMP */  #endif /* ALLOW_ATM_TEMP */
1753  #ifdef SEAICE_DEBUG  #ifdef SEAICE_DEBUG
1754  c ToM<<< debug seaice_growth  c ToM<<< debug seaice_growth
1755          WRITE(msgBuf,'(A,7F8.4)')          WRITE(msgBuf,msgBufForm)
1756         &    ' SEAICE_GROWTH: Hsnow increments 5, d_HSNWbyRAIN = ',
1757  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1758       &    ' SEAICE_GROWTH: Heff increments 5, HEFFITD = ',       &     d_HSNWbyRAIN_ITD(1,1,:)
      &     HEFFITD(1,1,:,bi,bj)  
         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,  
      &    SQUEEZE_RIGHT , myThid)  
         WRITE(msgBuf,'(A,7F8.4)')  
      &    ' SEAICE_GROWTH: Area increments 5, AREAITD = ',  
      &     AREAITD(1,1,:,bi,bj)  
1759  #else  #else
1760       &    ' SEAICE_GROWTH: Heff increments 5, HEFF = ',       &     d_HSNWbyRAIN(1,1)
      &     HEFF(1,1,bi,bj)  
1761  #endif  #endif
1762          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
1763       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
1764  c ToM>>>  c ToM>>>
1765  #endif  #endif /* SEAICE_DEBUG */
1766    
1767  C compute snow melt due to heat available from ocean.  C compute snow melt due to heat available from ocean.
1768  C =================================================================  C =================================================================
# Line 1724  CADJ STORE r_QbyOCN = comlev1_bibj,key=i Line 1779  CADJ STORE r_QbyOCN = comlev1_bibj,key=i
1779          DO IT=1,nITD          DO IT=1,nITD
1780           DO J=1,sNy           DO J=1,sNy
1781            DO I=1,sNx            DO I=1,sNx
1782             tmpscal1=MAX(r_QbyOCN(i,j)*ICE2SNOW*areaFracFactor(I,J,IT),             tmpscal4 = HSNWITDpreTH(I,J,IT)
1783       &                  -HSNOWITD(I,J,IT,bi,bj))       &              + d_HSNWbySublim_ITD(I,J,IT)
1784         &              + d_HSNWbyATMonSNW_ITD(I,J,IT)
1785         &              + d_HSNWbyRAIN_ITD(I,J,IT)
1786               tmpscal1=MAX(r_QbyOCN(i,j)*ICE2SNOW*areaFracFactor(I,J,IT),
1787         &                  -tmpscal4)
1788             tmpscal2=MIN(tmpscal1,0. _d 0)             tmpscal2=MIN(tmpscal1,0. _d 0)
1789  #ifdef SEAICE_MODIFY_GROWTH_ADJ  #ifdef SEAICE_MODIFY_GROWTH_ADJ
1790  Cgf no additional dependency through snow  Cgf no additional dependency through snow
1791             if ( SEAICEadjMODE.GE.2 ) tmpscal2 = 0. _d 0             if ( SEAICEadjMODE.GE.2 ) tmpscal2 = 0. _d 0
1792  #endif  #endif
1793               d_HSNWbyOCNonSNW_ITD(I,J,IT) = tmpscal2
1794             d_HSNWbyOCNonSNW(I,J) = d_HSNWbyOCNonSNW(I,J) + tmpscal2             d_HSNWbyOCNonSNW(I,J) = d_HSNWbyOCNonSNW(I,J) + tmpscal2
1795             r_QbyOCN(I,J)=r_QbyOCN(I,J) - tmpscal2*SNOW2ICE             r_QbyOCN(I,J)=r_QbyOCN(I,J) - tmpscal2*SNOW2ICE
            HSNOWITD(I,J,IT,bi,bj) = HSNOWITD(I,J,IT,bi,bj) + tmpscal2  
1796            ENDDO            ENDDO
1797           ENDDO           ENDDO
1798          ENDDO          ENDDO
# Line 1757  Cgf no additional dependency through sno Line 1816  Cgf no additional dependency through sno
1816  Cph)  Cph)
1817  #ifdef SEAICE_DEBUG  #ifdef SEAICE_DEBUG
1818  c ToM<<< debug seaice_growth  c ToM<<< debug seaice_growth
1819          WRITE(msgBuf,'(A,7F8.4)')          WRITE(msgBuf,msgBufForm)
1820         &    ' SEAICE_GROWTH: Hsnow increments 6, d_HSNWbyOCNonSNW = ',
1821  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1822       &    ' SEAICE_GROWTH: Heff increments 6, HEFFITD = ',       &     d_HSNWbyOCNonSNW_ITD(1,1,:)
      &     HEFFITD(1,1,:,bi,bj)  
         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,  
      &    SQUEEZE_RIGHT , myThid)  
         WRITE(msgBuf,'(A,7F8.4)')  
      &    ' SEAICE_GROWTH: Area increments 6, AREAITD = ',  
      &     AREAITD(1,1,:,bi,bj)  
1823  #else  #else
1824       &    ' SEAICE_GROWTH: Heff increments 6, HEFF = ',       &     d_HSNWbyOCNonSNW(1,1)
      &     HEFF(1,1,bi,bj)  
1825  #endif  #endif
1826          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
1827       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
1828  c ToM>>>  c ToM>>>
1829  #endif  #endif /* SEAICE_DEBUG */
1830    
1831  C gain of new ice over open water  C gain of new ice over open water
1832  C ===============================  C ===============================
# Line 1787  CADJ STORE a_QSWbyATM_open = comlev1_bib Line 1840  CADJ STORE a_QSWbyATM_open = comlev1_bib
1840    
1841          DO J=1,sNy          DO J=1,sNy
1842           DO I=1,sNx           DO I=1,sNx
1843    #ifdef SEAICE_ITD
1844    C         HEFF will be updated at the end of PART 3,
1845    C         hence sum of tendencies so far is needed
1846              tmpscal4 = HEFFpreTH(I,J)
1847         &             + d_HEFFbySublim(I,J)
1848         &             + d_HEFFbyOCNonICE(I,J)
1849         &             + d_HEFFbyATMonOCN(I,J)
1850    #else
1851    C         HEFF is updated step by step throughout seaice_growth
1852              tmpscal4 = HEFF(I,J,bi,bj)
1853    #endif
1854  C           Initial ice growth is triggered by open water  C           Initial ice growth is triggered by open water
1855  C           heat flux overcoming potential melt by ocean  C           heat flux overcoming potential melt by ocean
1856              tmpscal1=r_QbyATM_open(I,J)+r_QbyOCN(i,j) *              tmpscal1=r_QbyATM_open(I,J)+r_QbyOCN(i,j) *
# Line 1797  C           that is therefore not availa Line 1861  C           that is therefore not availa
1861  C           impose -HEFF as the maxmum melting if SEAICE_doOpenWaterMelt  C           impose -HEFF as the maxmum melting if SEAICE_doOpenWaterMelt
1862  C           or 0. otherwise (no melting if not SEAICE_doOpenWaterMelt)  C           or 0. otherwise (no melting if not SEAICE_doOpenWaterMelt)
1863              tmpscal3=facOpenGrow*MAX(tmpscal1-tmpscal2,              tmpscal3=facOpenGrow*MAX(tmpscal1-tmpscal2,
1864       &           -HEFF(I,J,bi,bj)*facOpenMelt)*HEFFM(I,J,bi,bj)       &           -tmpscal4*facOpenMelt)*HEFFM(I,J,bi,bj)
1865    #ifdef SEAICE_ITD
1866    C         ice growth in open water adds to first category
1867              d_HEFFbyATMonOCN_open_ITD(I,J,1)=tmpscal3
1868              d_HEFFbyATMonOCN_ITD(I,J,1)     =d_HEFFbyATMonOCN_ITD(I,J,1)
1869         &                                    +tmpscal3
1870    #endif
1871            d_HEFFbyATMonOCN_open(I,J)=tmpscal3            d_HEFFbyATMonOCN_open(I,J)=tmpscal3
1872            d_HEFFbyATMonOCN(I,J)=d_HEFFbyATMonOCN(I,J)+tmpscal3            d_HEFFbyATMonOCN(I,J)=d_HEFFbyATMonOCN(I,J)+tmpscal3
1873            r_QbyATM_open(I,J)=r_QbyATM_open(I,J)-tmpscal3            r_QbyATM_open(I,J)=r_QbyATM_open(I,J)-tmpscal3
 #ifdef SEAICE_ITD  
 C         open water area fraction  
           tmpscal0 = ONE-AREApreTH(I,J)  
 C         determine thickness of new ice  
 ctomC         considering the entire open water area to refreeze  
 ctom          tmpscal1 = tmpscal3/tmpscal0  
 C         considering a minimum lead ice thickness of 10 cm  
 C         WATCH that leadIceThickMin is smaller that Hlimit(1)!  
           leadIceThickMin = 0.1  
           tmpscal1 = MAX(leadIceThickMin,tmpscal3/tmpscal0)  
 C         adjust ice area fraction covered by new ice  
           tmpscal0 = tmpscal3/tmpscal1  
 C         then add new ice volume to appropriate thickness category  
           DO IT=1,nITD  
            IF (tmpscal1.LT.Hlimit(IT)) THEN  
             HEFFITD(I,J,IT,bi,bj) = HEFFITD(I,J,IT,bi,bj) + tmpscal3  
             tmpscal3=ZERO  
 C not sure if AREAITD should be changed here since AREA is incremented  
 C   in PART 4 below in non-itd code  
 C in this scenario all open water is covered by new ice instantaneously,  
 C   i.e. no delayed lead closing is concidered such as is associated with  
 C   Hibler's h_0 parameter  
             AREAITD(I,J,IT,bi,bj) = AREAITD(I,J,IT,bi,bj)  
      &                           + tmpscal0  
             tmpscal0=ZERO  
            ENDIF  
           ENDDO  
 #else  
1874            HEFF(I,J,bi,bj) = HEFF(I,J,bi,bj) + tmpscal3            HEFF(I,J,bi,bj) = HEFF(I,J,bi,bj) + tmpscal3
 #endif  
1875           ENDDO           ENDDO
1876          ENDDO          ENDDO
1877    
1878  #ifdef ALLOW_SITRACER  #ifdef ALLOW_SITRACER
 #ifdef SEAICE_ITD  
         DO IT=1,nITD  
          DO J=1,sNy  
           DO I=1,sNx  
 c needs to be here to allow use also with LEGACY branch  
            SItrHEFF(I,J,bi,bj,4) = SItrHEFF(I,J,bi,bj,4)  
      &                           + HEFFITD(I,J,IT,bi,bj)  
           ENDDO  
          ENDDO  
         ENDDO  
 #else  
1879          DO J=1,sNy          DO J=1,sNy
1880           DO I=1,sNx           DO I=1,sNx
1881  C needs to be here to allow use also with LEGACY branch  C needs to be here to allow use also with LEGACY branch
1882    #ifdef SEAICE_ITD
1883              SItrHEFF(I,J,bi,bj,4)=SItrHEFF(I,J,bi,bj,3)
1884         &                         +d_HEFFbyATMonOCN_open(I,J)
1885    #else
1886            SItrHEFF(I,J,bi,bj,4)=HEFF(I,J,bi,bj)            SItrHEFF(I,J,bi,bj,4)=HEFF(I,J,bi,bj)
1887    #endif
1888           ENDDO           ENDDO
1889          ENDDO          ENDDO
 #endif  
1890  #endif /* ALLOW_SITRACER */  #endif /* ALLOW_SITRACER */
1891  #ifdef SEAICE_DEBUG  #ifdef SEAICE_DEBUG
1892  c ToM<<< debug seaice_growth  c ToM<<< debug seaice_growth
1893          WRITE(msgBuf,'(A,7F8.4)')          WRITE(msgBuf,msgBufForm)
1894         &    ' SEAICE_GROWTH: Heff increments 7, d_HEFFbyATMonOCN_open = ',
1895  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1896       &    ' SEAICE_GROWTH: Heff increments 7, HEFFITD = ',       &     d_HEFFbyATMonOCN_open_ITD(1,1,:)
      &     HEFFITD(1,1,:,bi,bj)  
         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,  
      &    SQUEEZE_RIGHT , myThid)  
         WRITE(msgBuf,'(A,7F8.4)')  
      &    ' SEAICE_GROWTH: Area increments 7, AREAITD = ',  
      &     AREAITD(1,1,:,bi,bj)  
1897  #else  #else
1898       &    ' SEAICE_GROWTH: Heff increments 7, HEFF = ',       &     d_HEFFbyATMonOCN_open(1,1)
1899       &     HEFF(1,1,bi,bj)  #endif
1900          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
1901       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
1902          WRITE(msgBuf,'(A,7F8.4)')          WRITE(msgBuf,msgBufForm)
1903       &    ' SEAICE_GROWTH: Area increments 7, AREA = ',       &    ' SEAICE_GROWTH: Heff increments 7, d_HEFFbyATMonOCN = ',
1904       &     AREA(1,1,bi,bj)  #ifdef SEAICE_ITD
1905         &     d_HEFFbyATMonOCN_ITD(1,1,:)
1906    #else
1907         &     d_HEFFbyATMonOCN(1,1)
1908  #endif  #endif
1909          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
1910       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
1911  c ToM>>>  c ToM>>>
1912  #endif  #endif /* SEAICE_DEBUG */
1913    
1914  C convert snow to ice if submerged.  C convert snow to ice if submerged.
1915  C =================================  C =================================
1916    
 #ifndef SEAICE_GROWTH_LEGACY  
1917  C note: in legacy, this process is done at the end  C note: in legacy, this process is done at the end
1918  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
1919  CADJ STORE heff(:,:,bi,bj) = comlev1_bibj,key=iicekey,byte=isbyte  CADJ STORE heff(:,:,bi,bj) = comlev1_bibj,key=iicekey,byte=isbyte
# Line 1890  CADJ STORE hsnow(:,:,bi,bj) = comlev1_bi Line 1921  CADJ STORE hsnow(:,:,bi,bj) = comlev1_bi
1921  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
1922          IF ( SEAICEuseFlooding ) THEN          IF ( SEAICEuseFlooding ) THEN
1923  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1924           DO IT=1,nITD           DO IT=1,nITD
1925            DO J=1,sNy            DO J=1,sNy
1926             DO I=1,sNx             DO I=1,sNx
1927              tmpscal0 = (HSNOWITD(I,J,IT,bi,bj)*SEAICE_rhoSnow              tmpscal3 = HEFFITDpreTH(I,J,IT)
1928       &               +  HEFFITD(I,J,IT,bi,bj) *SEAICE_rhoIce)       &               + d_HEFFbySublim_ITD(I,J,IT)
1929       &                                        *recip_rhoConst       &               + d_HEFFbyOCNonICE_ITD(I,J,IT)
1930              tmpscal1 = MAX( 0. _d 0, tmpscal0 - HEFFITD(I,J,IT,bi,bj))       &               + d_HEFFbyATMonOCN_ITD(I,J,IT)
1931                tmpscal4 = HSNWITDpreTH(I,J,IT)
1932         &               + d_HSNWbySublim_ITD(I,J,IT)
1933         &               + d_HSNWbyATMonSNW_ITD(I,J,IT)
1934         &               + d_HSNWbyRAIN_ITD(I,J,IT)
1935                tmpscal0 = (tmpscal4*SEAICE_rhoSnow
1936         &               +  tmpscal3*SEAICE_rhoIce)
1937         &               * recip_rhoConst
1938                tmpscal1 = MAX( 0. _d 0, tmpscal0 - tmpscal3)
1939                d_HEFFbyFLOODING_ITD(I,J,IT) = tmpscal1
1940              d_HEFFbyFLOODING(I,J) = d_HEFFbyFLOODING(I,J)  + tmpscal1              d_HEFFbyFLOODING(I,J) = d_HEFFbyFLOODING(I,J)  + tmpscal1
1941              HEFFITD(I,J,IT,bi,bj) = HEFFITD(I,J,IT,bi,bj)  + tmpscal1             ENDDO
1942              HSNOWITD(I,J,IT,bi,bj)= HSNOWITD(I,J,IT,bi,bj) - tmpscal1            ENDDO
1943       &                            * ICE2SNOW           ENDDO
            ENDDO  
           ENDDO  
          ENDDO  
1944  #else  #else
1945           DO J=1,sNy           DO J=1,sNy
1946            DO I=1,sNx            DO I=1,sNx
# Line 1918  CADJ STORE hsnow(:,:,bi,bj) = comlev1_bi Line 1955  CADJ STORE hsnow(:,:,bi,bj) = comlev1_bi
1955           ENDDO           ENDDO
1956  #endif  #endif
1957          ENDIF          ENDIF
1958  #endif /* SEAICE_GROWTH_LEGACY */  
1959  #ifdef SEAICE_DEBUG  #ifdef SEAICE_DEBUG
1960  c ToM<<< debug seaice_growth  c ToM<<< debug seaice_growth
1961          WRITE(msgBuf,'(A,7F8.4)')          WRITE(msgBuf,msgBufForm)
1962         &    ' SEAICE_GROWTH: Heff increments 8, d_HEFFbyFLOODING = ',
1963  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
1964       &    ' SEAICE_GROWTH: Heff increments 8, HEFFITD = ',       &     d_HEFFbyFLOODING_ITD(1,1,:)
1965       &     HEFFITD(1,1,:,bi,bj)  #else
1966         &     d_HEFFbyFLOODING(1,1)
1967    #endif
1968          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
1969       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
1970          WRITE(msgBuf,'(A,7F8.4)')  c ToM>>>
1971       &    ' SEAICE_GROWTH: Area increments 8, AREAITD = ',  #endif /* SEAICE_DEBUG */
1972       &     AREAITD(1,1,:,bi,bj)  #ifdef SEAICE_ITD
1973    C apply ice and snow thickness changes
1974    C =================================================================
1975             DO IT=1,nITD
1976              DO J=1,sNy
1977               DO I=1,sNx
1978                HEFFITD(I,J,IT,bi,bj) = HEFFITD(I,J,IT,bi,bj)
1979         &                            + d_HEFFbySublim_ITD(I,J,IT)
1980         &                            + d_HEFFbyOCNonICE_ITD(I,J,IT)
1981         &                            + d_HEFFbyATMonOCN_ITD(I,J,IT)
1982         &                            + d_HEFFbyFLOODING_ITD(I,J,IT)
1983                HSNOWITD(I,J,IT,bi,bj) = HSNOWITD(I,J,IT,bi,bj)
1984         &                            + d_HSNWbySublim_ITD(I,J,IT)
1985         &                            + d_HSNWbyATMonSNW_ITD(I,J,IT)
1986         &                            + d_HSNWbyRAIN_ITD(I,J,IT)
1987         &                            + d_HSNWbyOCNonSNW_ITD(I,J,IT)
1988         &                            - d_HEFFbyFLOODING_ITD(I,J,IT)
1989         &                            * ICE2SNOW
1990               ENDDO
1991              ENDDO
1992             ENDDO
1993    #endif
1994    #ifdef SEAICE_DEBUG
1995    c ToM<<< debug seaice_growth
1996            WRITE(msgBuf,msgBufForm)
1997         &    ' SEAICE_GROWTH: Heff increments 9, HEFF = ',
1998    #ifdef SEAICE_ITD
1999         &     HEFFITD(1,1,:,bi,bj)
2000  #else  #else
      &    ' SEAICE_GROWTH: Heff increments 8, HEFF = ',  
2001       &     HEFF(1,1,bi,bj)       &     HEFF(1,1,bi,bj)
2002    #endif
2003          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
2004       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
2005          WRITE(msgBuf,'(A,7F8.4)')          WRITE(msgBuf,msgBufForm)
2006       &    ' SEAICE_GROWTH: Area increments 8, AREA = ',       &    ' SEAICE_GROWTH: Area increments 9, AREA = ',
2007    #ifdef SEAICE_ITD
2008         &     AREAITD(1,1,:,bi,bj)
2009    #else
2010       &     AREA(1,1,bi,bj)       &     AREA(1,1,bi,bj)
2011  #endif  #endif
2012          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,          CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
2013       &    SQUEEZE_RIGHT , myThid)       &    SQUEEZE_RIGHT , myThid)
2014  c ToM>>>  c ToM>>>
2015  #endif  #endif /* SEAICE_DEBUG */
2016    
2017  C ===================================================================  C ===================================================================
2018  C ==========PART 4: determine ice cover fraction increments=========-  C ==========PART 4: determine ice cover fraction increments=========-
# Line 1969  CADJ STORE AREA(:,:,bi,bj) = comlev1_bib Line 2039  CADJ STORE AREA(:,:,bi,bj) = comlev1_bib
2039  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
2040    
2041  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
2042  C       replaces Hibler '79 scheme and lead closing parameter  C--     account for lateral ice growth and melt only in thinnest category
2043  C       because ITD accounts explicitly for lead openings and  C--     use HEFF, ARE, HSNOW, etc. temporarily for 1st category
2044  C       different melt rates due to varying ice thickness  C       (this way we can use same code for ITD and non-ITD case)
2045  C          DO J=1,sNy
2046  C       only consider ice area loss due to total ice thickness loss;           DO I=1,sNx
2047  C       ice area gain due to freezing of open water is handled above            HEFF(I,J,bi,bj)=HEFFITD(I,J,1,bi,bj)
2048  C       under "gain of new ice over open water"            AREA(I,J,bi,bj)=AREAITD(I,J,1,bi,bj)
2049  C            HSNOW(I,J,bi,bj)=HSNOWITD(I,J,1,bi,bj)
2050  C       does not account for lateral melt of ice floes            HEFFpreTH(I,J)=HEFFITDpreTH(I,J,1)
2051  C            AREApreTH(I,J)=AREAITDpreTH(I,J,1)
2052  C        AREAITD is incremented in section "gain of new ice over open water" above            recip_heffActual(I,J)=recip_heffActualMult(I,J,1)
2053  C           ENDDO
2054          DO IT=1,nITD          ENDDO
2055           DO J=1,sNy  C       all other categories only experience basal growth or melt,
2056           DO I=1,sNx  C       i.e. change sin AREA only occur when all ice in a category is melted
2057             IF (HEFFITD(I,J,IT,bi,bj).LE.ZERO) THEN          IF (nITD .gt. 1) THEN
2058              AREAITD(I,J,IT,bi,bj)=ZERO           DO IT=2,nITD
2059             ENDIF            DO J=1,sNy
2060  #ifdef ALLOW_SITRACER             DO I=1,sNx
2061             SItrAREA(I,J,bi,bj,3) = SItrAREA(I,J,bi,bj,3)              IF (HEFFITD(I,J,IT,bi,bj).LE.ZERO) THEN
2062       &                           + AREAITD(I,J,IT,bi,bj)               AREAITD(I,J,IT,bi,bj)=ZERO
2063  #endif /* ALLOW_SITRACER */              ELSE
2064            ENDDO  c            melt ice laterally based on an average floe sice
2065           ENDDO  c            following Steele (1992)
2066          ENDDO               AREAITD(I,J,IT,bi,bj) = AREAITD(I,J,IT,bi,bj)
2067  #else /* SEAICE_ITD */       &                             * (ONE - latMeltFrac(I,J,IT))
2068                 AREAITD(I,J,IT,bi,bj) = max(ZERO,AREAITD(I,J,IT,bi,bj))
2069                ENDIF
2070               ENDDO
2071              ENDDO
2072             ENDDO
2073            ENDIF
2074    #endif
2075          DO J=1,sNy          DO J=1,sNy
2076           DO I=1,sNx           DO I=1,sNx
2077    
# Line 2003  C Line 2080  C
2080            ELSE            ELSE
2081             recip_HO=1. _d 0 / HO             recip_HO=1. _d 0 / HO
2082            ENDIF            ENDIF
2083  #ifdef SEAICE_GROWTH_LEGACY            recip_HH = recip_heffActual(I,J)
            tmpscal0=HEFF(I,J,bi,bj) - d_HEFFbyATMonOCN(I,J)  
            recip_HH = AREApreTH(I,J) /(tmpscal0+.00001 _d 0)  
 #else  
            recip_HH = recip_heffActual(I,J)  
 #endif  
2084    
2085  C gain of ice over open water : computed from  C gain of ice over open water : computed from
2086  C   (SEAICE_areaGainFormula.EQ.1) from growth by ATM  C   (SEAICE_areaGainFormula.EQ.1) from growth by ATM
# Line 2064  C apply tendency Line 2136  C apply tendency
2136  #endif /* ALLOW_DIAGNOSTICS */  #endif /* ALLOW_DIAGNOSTICS */
2137           ENDDO           ENDDO
2138          ENDDO          ENDDO
2139  #endif /* SEAICE_ITD */  #ifdef SEAICE_ITD
2140    C       transfer 1st category values back into ITD variables
2141            DO J=1,sNy
2142             DO I=1,sNx
2143              HEFFITD(I,J,1,bi,bj)=HEFF(I,J,bi,bj)
2144              AREAITD(I,J,1,bi,bj)=AREA(I,J,bi,bj)
2145              HSNOWITD(I,J,1,bi,bj)=HSNOW(I,J,bi,bj)
2146             ENDDO
2147            ENDDO
2148    #endif
2149    
2150  #if (defined ALLOW_AUTODIFF_TAMC && defined SEAICE_MODIFY_GROWTH_ADJ)  #if (defined ALLOW_AUTODIFF_TAMC && defined SEAICE_MODIFY_GROWTH_ADJ)
2151  Cgf 'bulk' linearization of area=f(HEFF)  Cgf 'bulk' linearization of area=f(HEFF)
2152          IF ( SEAICEadjMODE.GE.1 ) THEN          IF ( SEAICEadjMODE.GE.1 ) THEN
2153  #ifdef SEAICE_ITD  #ifdef SEAICE_ITD
2154           DO IT=1,nITD           DO IT=1,nITD
2155            DO J=1,sNy            DO J=1,sNy
2156             DO I=1,sNx             DO I=1,sNx
2157              AREAITD(I,J,IT,bi,bj) = AREAITDpreTH(I,J,IT) + 0.1 _d 0 *              AREAITD(I,J,IT,bi,bj) = AREAITDpreTH(I,J,IT) + 0.1 _d 0 *
# Line 2135  CADJ &                       key = iicek Line 2216  CADJ &                       key = iicek
2216    
2217  #ifdef SEAICE_VARIABLE_SALINITY  #ifdef SEAICE_VARIABLE_SALINITY
2218    
 #ifdef SEAICE_GROWTH_LEGACY  
 # ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE hsalt(:,:,bi,bj) = comlev1_bibj,key=iicekey,byte=isbyte  
 # endif /* ALLOW_AUTODIFF_TAMC */  
         DO J=1,sNy  
          DO I=1,sNx  
 C set HSALT = 0 if HSALT < 0 and compute salt to remove from ocean  
           IF ( HSALT(I,J,bi,bj) .LT. 0.0 ) THEN  
              saltFluxAdjust(I,J) = - HEFFM(I,J,bi,bj) *  
      &            HSALT(I,J,bi,bj) * recip_deltaTtherm  
              HSALT(I,J,bi,bj) = 0.0 _d 0  
           ENDIF  
          ENDDO  
         ENDDO  
 #endif /* SEAICE_GROWTH_LEGACY */  
   
2219  #ifdef ALLOW_AUTODIFF_TAMC  #ifdef ALLOW_AUTODIFF_TAMC
2220  CADJ STORE hsalt(:,:,bi,bj) = comlev1_bibj,key=iicekey,byte=isbyte  CADJ STORE hsalt(:,:,bi,bj) = comlev1_bibj,key=iicekey,byte=isbyte
2221  #endif /* ALLOW_AUTODIFF_TAMC */  #endif /* ALLOW_AUTODIFF_TAMC */
# Line 2197  C update HSALT based on surface saltFlux Line 2262  C update HSALT based on surface saltFlux
2262       &         saltFlux(I,J,bi,bj) * SEAICE_deltaTtherm       &         saltFlux(I,J,bi,bj) * SEAICE_deltaTtherm
2263            saltFlux(I,J,bi,bj) =            saltFlux(I,J,bi,bj) =
2264       &         saltFlux(I,J,bi,bj) + saltFluxAdjust(I,J)       &         saltFlux(I,J,bi,bj) + saltFluxAdjust(I,J)
 #ifdef SEAICE_GROWTH_LEGACY  
 C set HSALT = 0 if HEFF = 0 and compute salt to dump into ocean  
           IF ( HEFF(I,J,bi,bj) .EQ. 0.0 ) THEN  
            saltFlux(I,J,bi,bj) = saltFlux(I,J,bi,bj) -  
      &          HEFFM(I,J,bi,bj) * HSALT(I,J,bi,bj) * recip_deltaTtherm  
            HSALT(I,J,bi,bj) = 0.0 _d 0  
 #ifdef ALLOW_SALT_PLUME  
            saltPlumeFlux(i,j,bi,bj) = 0.0 _d 0  
 #endif /* ALLOW_SALT_PLUME */  
           ENDIF  
 #endif /* SEAICE_GROWTH_LEGACY */  
2265           ENDDO           ENDDO
2266          ENDDO          ENDDO
2267  #endif /* SEAICE_VARIABLE_SALINITY */  #endif /* SEAICE_VARIABLE_SALINITY */
2268    
 C =======================================================================  
 C ==LEGACY PART 6 (LEGACY) treat pathological cases, then do flooding ===  
 C =======================================================================  
   
 #ifdef SEAICE_GROWTH_LEGACY  
   
 C treat values of ice cover fraction oustide  
 C the [0 1] range, and other such issues.  
 C ===========================================  
   
 Cgf note: this part cannot be heat and water conserving  
   
 #ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE area(:,:,bi,bj) = comlev1_bibj,  
 CADJ &                       key = iicekey, byte = isbyte  
 CADJ STORE heff(:,:,bi,bj) = comlev1_bibj,  
 CADJ &                       key = iicekey, byte = isbyte  
 #endif /* ALLOW_AUTODIFF_TAMC */  
         DO J=1,sNy  
          DO I=1,sNx  
 C     NOW SET AREA(I,J,bi,bj)=0 WHERE THERE IS NO ICE  
 CML   replaced "/.0001 _d 0" by "*1. _d 4", 1e-4 is probably  
 CML   meant to be something like a minimum thickness  
           AREA(I,J,bi,bj)=MIN(AREA(I,J,bi,bj),HEFF(I,J,bi,bj)*1. _d 4)  
          ENDDO  
         ENDDO  
   
 #ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE area(:,:,bi,bj) = comlev1_bibj,  
 CADJ &                       key = iicekey, byte = isbyte  
 #endif /* ALLOW_AUTODIFF_TAMC */  
         DO J=1,sNy  
          DO I=1,sNx  
 C NOW TRUNCATE AREA  
           AREA(I,J,bi,bj)=MIN(ONE,AREA(I,J,bi,bj))  
          ENDDO  
         ENDDO  
   
 #ifdef ALLOW_AUTODIFF_TAMC  
 CADJ STORE area(:,:,bi,bj)  = comlev1_bibj,  
 CADJ &                        key = iicekey, byte = isbyte  
 CADJ STORE hsnow(:,:,bi,bj) = comlev1_bibj,  
 CADJ &                         key = iicekey, byte = isbyte  
 #endif /* ALLOW_AUTODIFF_TAMC */  
         DO J=1,sNy  
          DO I=1,sNx  
           AREA(I,J,bi,bj) = MAX(ZERO,AREA(I,J,bi,bj))  
           HSNOW(I,J,bi,bj)  = MAX(ZERO,HSNOW(I,J,bi,bj))  
           AREA(I,J,bi,bj) = AREA(I,J,bi,bj)*HEFFM(I,J,bi,bj)  
           HEFF(I,J,bi,bj) = HEFF(I,J,bi,bj)*HEFFM(I,J,bi,bj)  
 #ifdef SEAICE_CAP_HEFF  
 C     This is not energy conserving, but at least it conserves fresh water  
           tmpscal0         = -MAX(HEFF(I,J,bi,bj)-MAX_HEFF,0. _d 0)  
           d_HEFFbyNeg(I,J) = d_HEFFbyNeg(I,J) + tmpscal0  
           HEFF(I,J,bi,bj)  = HEFF(I,J,bi,bj)  + tmpscal0  
 #endif /* SEAICE_CAP_HEFF */  
           HSNOW(I,J,bi,bj)  = HSNOW(I,J,bi,bj)*HEFFM(I,J,bi,bj)  
          ENDDO  
         ENDDO  
   
 C convert snow to ice if submerged.  
 C =================================  
   
         IF ( SEAICEuseFlooding ) THEN  
          DO J=1,sNy  
           DO I=1,sNx  
            tmpscal0     = (HSNOW(I,J,bi,bj)*SEAICE_rhoSnow  
      &              +HEFF(I,J,bi,bj)*SEAICE_rhoIce)*recip_rhoConst  
            tmpscal1 = MAX( 0. _d 0, tmpscal0 - HEFF(I,J,bi,bj))  
            d_HEFFbyFLOODING(I,J)=tmpscal1  
            HEFF(I,J,bi,bj) = HEFF(I,J,bi,bj)+d_HEFFbyFLOODING(I,J)  
            HSNOW(I,J,bi,bj) = HSNOW(I,J,bi,bj)-  
      &                           d_HEFFbyFLOODING(I,J)*ICE2SNOW  
           ENDDO  
          ENDDO  
         ENDIF  
   
 #endif /* SEAICE_GROWTH_LEGACY */  
   
2269  #ifdef ALLOW_SITRACER  #ifdef ALLOW_SITRACER
2270          DO J=1,sNy          DO J=1,sNy
2271           DO I=1,sNx           DO I=1,sNx
# Line 2322  C compute total of "mult" fluxes for oce Line 2297  C compute total of "mult" fluxes for oce
2297           DO J=1,sNy           DO J=1,sNy
2298            DO I=1,sNx            DO I=1,sNx
2299  cToM if fluxes in W/m^2 then  cToM if fluxes in W/m^2 then
2300  c           a_QbyATM_cover(I,J)=a_QbyATM_cover(I,J)  c           a_QbyATM_cover(I,J)=a_QbyATM_cover(I,J)
2301  c     &      + a_QbyATMmult_cover(I,J,IT) * areaFracFactor(I,J,IT)  c     &      + a_QbyATMmult_cover(I,J,IT) * areaFracFactor(I,J,IT)
2302  c           r_QbyATM_cover(I,J)=r_QbyATM_cover(I,J)  c           r_QbyATM_cover(I,J)=r_QbyATM_cover(I,J)
2303  c     &      + r_QbyATMmult_cover(I,J,IT) * areaFracFactor(I,J,IT)  c     &      + r_QbyATMmult_cover(I,J,IT) * areaFracFactor(I,J,IT)
2304  c           a_QSWbyATM_cover(I,J)=a_QSWbyATM_cover(I,J)  c           a_QSWbyATM_cover(I,J)=a_QSWbyATM_cover(I,J)
2305  c     &      + a_QSWbyATMmult_cover(I,J,IT) * areaFracFactor(I,J,IT)  c     &      + a_QSWbyATMmult_cover(I,J,IT) * areaFracFactor(I,J,IT)
2306  c           r_FWbySublim(I,J)=r_FWbySublim(I,J)  c           r_FWbySublim(I,J)=r_FWbySublim(I,J)
2307  c     &      + r_FWbySublimMult(I,J,IT) * areaFracFactor(I,J,IT)  c     &      + r_FWbySublimMult(I,J,IT) * areaFracFactor(I,J,IT)
2308  cToM if fluxes in effective ice meters, i.e. ice volume per area, then  cToM if fluxes in effective ice meters, i.e. ice volume per area, then
2309             a_QbyATM_cover(I,J)=a_QbyATM_cover(I,J)             a_QbyATM_cover(I,J)=a_QbyATM_cover(I,J)
2310       &      + a_QbyATMmult_cover(I,J,IT)       &      + a_QbyATMmult_cover(I,J,IT)
2311             r_QbyATM_cover(I,J)=r_QbyATM_cover(I,J)             r_QbyATM_cover(I,J)=r_QbyATM_cover(I,J)
2312       &      + r_QbyATMmult_cover(I,J,IT)       &      + r_QbyATMmult_cover(I,J,IT)
2313             a_QSWbyATM_cover(I,J)=a_QSWbyATM_cover(I,J)             a_QSWbyATM_cover(I,J)=a_QSWbyATM_cover(I,J)
2314       &      + a_QSWbyATMmult_cover(I,J,IT)       &      + a_QSWbyATMmult_cover(I,J,IT)
2315             r_FWbySublim(I,J)=r_FWbySublim(I,J)             r_FWbySublim(I,J)=r_FWbySublim(I,J)
2316       &      + r_FWbySublimMult(I,J,IT)       &      + r_FWbySublimMult(I,J,IT)
2317            ENDDO            ENDDO
2318           ENDDO           ENDDO
# Line 2352  CADJ STORE d_hsnwbyocnonsnw = comlev1_bi Line 2327  CADJ STORE d_hsnwbyocnonsnw = comlev1_bi
2327          DO J=1,sNy          DO J=1,sNy
2328           DO I=1,sNx           DO I=1,sNx
2329            QNET(I,J,bi,bj) = r_QbyATM_cover(I,J) + r_QbyATM_open(I,J)            QNET(I,J,bi,bj) = r_QbyATM_cover(I,J) + r_QbyATM_open(I,J)
 #ifndef SEAICE_GROWTH_LEGACY  
 C in principle a_QSWbyATM_cover should always be included here, however  
 C for backward compatibility it is left out of the LEGACY branch  
2330       &         +   a_QSWbyATM_cover(I,J)       &         +   a_QSWbyATM_cover(I,J)
 #endif /* SEAICE_GROWTH_LEGACY */  
2331       &         - ( d_HEFFbyOCNonICE(I,J)       &         - ( d_HEFFbyOCNonICE(I,J)
2332       &           + d_HSNWbyOCNonSNW(I,J)*SNOW2ICE       &           + d_HSNWbyOCNonSNW(I,J)*SNOW2ICE
2333       &           + d_HEFFbyNEG(I,J)       &           + d_HEFFbyNEG(I,J)
# Line 2400  CADJ &                       key = iicek Line 2371  CADJ &                       key = iicek
2371  # endif /* ALLOW_AUTODIFF_TAMC */  # endif /* ALLOW_AUTODIFF_TAMC */
2372  cgf Unlike for evap and precip, the temperature of gained/lost  cgf Unlike for evap and precip, the temperature of gained/lost
2373  C ocean liquid water due to melt/freeze of solid water cannot be chosen  C ocean liquid water due to melt/freeze of solid water cannot be chosen
2374  C arbitrarily to be e.g. the ocean SST. Indeed the present seaice model  C arbitrarily to be e.g. the ocean SST. Indeed the present seaice model
2375  C implies a constant ice temperature of 0degC. If melt/freeze water is exchanged  C implies a constant ice temperature of 0degC. If melt/freeze water is exchanged
2376  C at a different temperature, it leads to a loss of conservation in the  C at a different temperature, it leads to a loss of conservation in the
2377  C ocean+ice system. While this is mostly a serious issue in the  C ocean+ice system. While this is mostly a serious issue in the
2378  C real fresh water + non linear free surface framework, a mismatch  C real fresh water + non linear free surface framework, a mismatch
2379  C between ice and ocean boundary condition can result in all cases.  C between ice and ocean boundary condition can result in all cases.
2380  C Below we therefore anticipate on external_forcing_surf.F  C Below we therefore anticipate on external_forcing_surf.F
2381  C to diagnoze and/or apply the correction to QNET.  C to diagnoze and/or apply the correction to QNET.
2382          DO J=1,sNy          DO J=1,sNy
2383           DO I=1,sNx           DO I=1,sNx
# Line 2460  CML according to wave-length) fluxes but Line 2431  CML according to wave-length) fluxes but
2431  CML since it does not contribute to heating the air.  CML since it does not contribute to heating the air.
2432  CML So this diagnostic is only good for heat budget calculations within  CML So this diagnostic is only good for heat budget calculations within
2433  CML the ice-ocean system.  CML the ice-ocean system.
2434             SIatmQnt(I,J,bi,bj) =             SIatmQnt(I,J,bi,bj) =
2435       &            maskC(I,J,kSurface,bi,bj)*convertHI2Q*(       &            maskC(I,J,kSurface,bi,bj)*convertHI2Q*(
 #ifndef SEAICE_GROWTH_LEGACY  
2436       &            a_QSWbyATM_cover(I,J) +       &            a_QSWbyATM_cover(I,J) +
 #endif /* SEAICE_GROWTH_LEGACY */  
2437       &            a_QbyATM_cover(I,J) + a_QbyATM_open(I,J) )       &            a_QbyATM_cover(I,J) + a_QbyATM_open(I,J) )
2438  cgf 2) SItflux (analogous to tflux; includes advection by water  cgf 2) SItflux (analogous to tflux; includes advection by water
2439  C             exchanged between atmosphere and ocean+ice)  C             exchanged between atmosphere and ocean+ice)
2440  C solid water going to atm, in precip units  C solid water going to atm, in precip units
2441             tmpscal1 = rhoConstFresh*maskC(I,J,kSurface,bi,bj)             tmpscal1 = rhoConstFresh*maskC(I,J,kSurface,bi,bj)
# Line 2501  C linFS, rain/evap get a special treatme Line 2470  C linFS, rain/evap get a special treatme
2470             tmpscal2= ZERO             tmpscal2= ZERO
2471        ENDIF        ENDIF
2472             SItflux(I,J,bi,bj)=             SItflux(I,J,bi,bj)=
2473       &            SIatmQnt(I,J,bi,bj)-tmpscal1-tmpscal2           &            SIatmQnt(I,J,bi,bj)-tmpscal1-tmpscal2
2474            ENDDO            ENDDO
2475           ENDDO           ENDDO
2476    
# Line 2543  c and the flux leaving/entering the ocea Line 2512  c and the flux leaving/entering the ocea
2512       &     + a_FWbySublim(I,J) * SEAICE_rhoIce * recip_deltaTtherm       &     + a_FWbySublim(I,J) * SEAICE_rhoIce * recip_deltaTtherm
2513    
2514           ENDDO           ENDDO
2515          ENDDO                  ENDDO
2516    
2517  #ifdef ALLOW_SSH_GLOBMEAN_COST_CONTRIBUTION  #ifdef ALLOW_SSH_GLOBMEAN_COST_CONTRIBUTION
2518  C--  C--
# Line 2621  C ====================================== Line 2590  C ======================================
2590         IF ( balanceEmPmR ) THEN         IF ( balanceEmPmR ) THEN
2591          DO j=1,sNy          DO j=1,sNy
2592           DO i=1,sNx           DO i=1,sNx
2593            FWFsiTile(bi,bj) =            FWFsiTile(bi,bj) =
2594       &      FWFsiTile(bi,bj) + SIatmFW(i,j,bi,bj)       &      FWFsiTile(bi,bj) + SIatmFW(i,j,bi,bj)
2595       &      * rA(i,j,bi,bj) * maskInC(i,j,bi,bj)       &      * rA(i,j,bi,bj) * maskInC(i,j,bi,bj)
2596           ENDDO           ENDDO
2597          ENDDO          ENDDO
2598         ENDIF         ENDIF
2599  c to translate global mean FWF adjustements (see below) we may need :  c to translate global mean FWF adjustements (see below) we may need :
2600         FWF2HFsiTile(bi,bj) = 0. _d 0               FWF2HFsiTile(bi,bj) = 0. _d 0
2601         IF ( balanceEmPmR.AND.(temp_EvPrRn.EQ.UNSET_RL) ) THEN         IF ( balanceEmPmR.AND.(temp_EvPrRn.EQ.UNSET_RL) ) THEN
2602          DO j=1,sNy          DO j=1,sNy
2603           DO i=1,sNx           DO i=1,sNx
# Line 2642  c to translate global mean FWF adjusteme Line 2611  c to translate global mean FWF adjusteme
2611         IF ( balanceQnet ) THEN         IF ( balanceQnet ) THEN
2612          DO j=1,sNy          DO j=1,sNy
2613           DO i=1,sNx           DO i=1,sNx
2614            HFsiTile(bi,bj) =            HFsiTile(bi,bj) =
2615       &      HFsiTile(bi,bj) + SItflux(i,j,bi,bj)       &      HFsiTile(bi,bj) + SItflux(i,j,bi,bj)
2616       &      * rA(i,j,bi,bj) * maskInC(i,j,bi,bj)       &      * rA(i,j,bi,bj) * maskInC(i,j,bi,bj)
2617           ENDDO           ENDDO
# Line 2754  CADJ STORE FWF2HFsiTile = comlev1, key=i Line 2723  CADJ STORE FWF2HFsiTile = comlev1, key=i
2723  # endif /* ALLOW_AUTODIFF_TAMC */  # endif /* ALLOW_AUTODIFF_TAMC */
2724        FWFsiGlob=0. _d 0        FWFsiGlob=0. _d 0
2725        IF ( balanceEmPmR )        IF ( balanceEmPmR )
2726       &   CALL GLOBAL_SUM_TILE_RL( FWFsiTile, FWFsiGlob, myThid )               &   CALL GLOBAL_SUM_TILE_RL( FWFsiTile, FWFsiGlob, myThid )
2727        FWF2HFsiGlob=0. _d 0        FWF2HFsiGlob=0. _d 0
2728        IF ( balanceEmPmR.AND.(temp_EvPrRn.EQ.UNSET_RL) ) THEN        IF ( balanceEmPmR.AND.(temp_EvPrRn.EQ.UNSET_RL) ) THEN
2729           CALL GLOBAL_SUM_TILE_RL(FWF2HFsiTile, FWF2HFsiGlob, myThid)           CALL GLOBAL_SUM_TILE_RL(FWF2HFsiTile, FWF2HFsiGlob, myThid)
# Line 2784  c 3) balancing adjustments Line 2753  c 3) balancing adjustments
2753           DO i=1-OLx,sNx+OLx           DO i=1-OLx,sNx+OLx
2754              empmr(i,j,bi,bj) = empmr(i,j,bi,bj) - tmpscal0              empmr(i,j,bi,bj) = empmr(i,j,bi,bj) - tmpscal0
2755              SIatmFW(i,j,bi,bj) = SIatmFW(i,j,bi,bj) - tmpscal0              SIatmFW(i,j,bi,bj) = SIatmFW(i,j,bi,bj) - tmpscal0
2756  c           adjust SItflux consistently        c           adjust SItflux consistently
2757              IF ( (temp_EvPrRn.NE.UNSET_RL).AND.              IF ( (temp_EvPrRn.NE.UNSET_RL).AND.
2758       &        useRealFreshWaterFlux.AND.(nonlinFreeSurf.NE.0) ) THEN       &        useRealFreshWaterFlux.AND.(nonlinFreeSurf.NE.0) ) THEN
2759              tmpscal1=              tmpscal1=
# Line 2807  c           no qnet or tflux adjustement Line 2776  c           no qnet or tflux adjustement
2776        ENDDO        ENDDO
2777        IF ( balancePrintMean ) THEN        IF ( balancePrintMean ) THEN
2778         _BEGIN_MASTER( myThid )         _BEGIN_MASTER( myThid )
2779         WRITE(msgbuf,'(a,a,e24.17)') 'rm Global mean of ',         WRITE(msgBuf,'(a,a,e24.17)') 'rm Global mean of ',
2780       &      'SIatmFW = ', tmpscal0       &      'SIatmFW = ', tmpscal0
2781         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
2782       &      SQUEEZE_RIGHT , myThid)       &      SQUEEZE_RIGHT , myThid)
# Line 2828  c           no qnet or tflux adjustement Line 2797  c           no qnet or tflux adjustement
2797        ENDDO        ENDDO
2798        IF ( balancePrintMean ) THEN        IF ( balancePrintMean ) THEN
2799         _BEGIN_MASTER( myThid )         _BEGIN_MASTER( myThid )
2800         WRITE(msgbuf,'(a,a,e24.17)') 'rm Global mean of ',         WRITE(msgBuf,'(a,a,e24.17)') 'rm Global mean of ',
2801       &      'SItflux = ', tmpscal2       &      'SItflux = ', tmpscal2
2802         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,         CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
2803       &      SQUEEZE_RIGHT , myThid)       &      SQUEEZE_RIGHT , myThid)
2804         _END_MASTER( myThid )         _END_MASTER( myThid )
2805        ENDIF        ENDIF
2806        ENDIF        ENDIF
2807  #endif /* */  #endif /* ALLOW_BALANCE_FLUXES */
2808    
2809  #ifdef ALLOW_DIAGNOSTICS  #ifdef ALLOW_DIAGNOSTICS
2810  c these diags need to be done outside of the bi,bj loop so that  c these diags need to be done outside of the bi,bj loop so that

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.22