Index: branches/2014/dev_r4621_NOC4_BDY_VERT_INTERP/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90
===================================================================
--- branches/2014/dev_r4621_NOC4_BDY_VERT_INTERP/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90	(revision 4622)
+++ branches/2014/dev_r4621_NOC4_BDY_VERT_INTERP/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90	(revision 5038)
@@ -8,5 +8,5 @@
    !!            3.0  ! 2005-11 (M. Vancoppenolle)  LIM-3 : Multi-layer thermodynamics + salinity variations
    !!             -   ! 2007-04 (M. Vancoppenolle) add lim_thd_glohec, lim_thd_con_dh and lim_thd_con_dif
-   !!            3.2  ! 2009-07 (M. Vancoppenolle, Y. Aksenov, G. Madec) bug correction in rdm_snw
+   !!            3.2  ! 2009-07 (M. Vancoppenolle, Y. Aksenov, G. Madec) bug correction in wfx_snw
    !!            3.3  ! 2010-11 (G. Madec) corrected snow melting heat (due to factor betas)
    !!            4.0  ! 2011-02 (G. Madec) dynamical allocation
@@ -22,5 +22,5 @@
    USE phycst         ! physical constants
    USE dom_oce        ! ocean space and time domain variables
-   USE oce     , ONLY :  iatte, oatte
+   USE oce     , ONLY : fraqsr_1lev 
    USE ice            ! LIM: sea-ice variables
    USE par_ice        ! LIM: sea-ice parameters
@@ -43,4 +43,5 @@
    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
    USE timing         ! Timing
+   USE limcons        ! conservation tests
 
    IMPLICIT NONE
@@ -49,8 +50,4 @@
    PUBLIC   lim_thd        ! called by limstp module
    PUBLIC   lim_thd_init   ! called by iceini module
-
-   REAL(wp) ::   epsi10 = 1.e-10_wp   !
-   REAL(wp) ::   zzero  = 0._wp      !
-   REAL(wp) ::   zone   = 1._wp      !
 
    !! * Substitutions
@@ -68,5 +65,5 @@
       !!                ***  ROUTINE lim_thd  ***       
       !!  
-      !! ** Purpose : This routine manages the ice thermodynamic.
+      !! ** Purpose : This routine manages ice thermodynamics
       !!         
       !! ** Action : - Initialisation of some variables
@@ -74,42 +71,39 @@
       !!               at the ice base, snow acc.,heat budget of the leads)
       !!             - selection of the icy points and put them in an array
-      !!             - call lim_vert_ther for vert ice thermodynamic
-      !!             - back to the geographic grid
-      !!             - selection of points for lateral accretion
-      !!             - call lim_lat_acc  for the ice accretion
+      !!             - call lim_thd_dif  for vertical heat diffusion
+      !!             - call lim_thd_dh   for vertical ice growth and melt
+      !!             - call lim_thd_ent  for enthalpy remapping
+      !!             - call lim_thd_sal  for ice desalination
+      !!             - call lim_thd_temp to  retrieve temperature from ice enthalpy
       !!             - back to the geographic grid
       !!     
-      !! ** References : H. Goosse et al. 1996, Bul. Soc. Roy. Sc. Liege, 65, 87-90
+      !! ** References : 
       !!---------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt    ! number of iteration
       !!
-      INTEGER  ::   ji, jj, jk, jl   ! dummy loop indices
-      INTEGER  ::   nbpb             ! nb of icy pts for thermo. cal.
-      REAL(wp) ::   zfric_umin = 5e-03_wp    ! lower bound for the friction velocity
-      REAL(wp) ::   zfric_umax = 2e-02_wp    ! upper bound for the friction velocity
-      REAL(wp) ::   zinda, zindb, zthsnice, zfric_u     ! local scalar
-      REAL(wp) ::   zfntlat, zpareff, zareamin, zcoef   !    -         -
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zqlbsbq   ! link with lead energy budget qldif
-      REAL(wp) :: zchk_v_i, zchk_smv, zchk_fs, zchk_fw, zchk_v_i_b, zchk_smv_b, zchk_fs_b, zchk_fw_b ! Check conservation (C Rousset)
-      REAL(wp) :: zchk_vmin, zchk_amin, zchk_amax ! Check errors (C Rousset)
+      INTEGER  :: ji, jj, jk, jl   ! dummy loop indices
+      INTEGER  :: nbpb             ! nb of icy pts for thermo. cal.
+      INTEGER  :: ii, ij           ! temporary dummy loop index
+      REAL(wp) :: zfric_umin = 0._wp        ! lower bound for the friction velocity (cice value=5.e-04)
+      REAL(wp) :: zch        = 0.0057_wp    ! heat transfer coefficient
+      REAL(wp) :: zareamin 
+      REAL(wp) :: zfric_u, zqld, zqfr
+      !
+      REAL(wp) :: zvi_b, zsmv_b, zei_b, zfs_b, zfw_b, zft_b 
+      !
+      REAL(wp), POINTER, DIMENSION(:,:) ::  zqsr, zqns
       !!-------------------------------------------------------------------
+      CALL wrk_alloc( jpi, jpj, zqsr, zqns )
+
       IF( nn_timing == 1 )  CALL timing_start('limthd')
 
-      CALL wrk_alloc( jpi, jpj, zqlbsbq )
-   
-      ! -------------------------------
-      !- check conservation (C Rousset)
-      IF (ln_limdiahsb) THEN
-         zchk_v_i_b = glob_sum( SUM(   v_i(:,:,:), dim=3 ) * area(:,:) * tms(:,:) )
-         zchk_smv_b = glob_sum( SUM( smv_i(:,:,:), dim=3 ) * area(:,:) * tms(:,:) )
-         zchk_fw_b  = glob_sum( rdm_ice(:,:) * area(:,:) * tms(:,:) )
-         zchk_fs_b  = glob_sum( ( sfx_bri(:,:) + sfx_thd(:,:) + sfx_res(:,:) + sfx_mec(:,:) ) * area(:,:) * tms(:,:) )
-      ENDIF
-      !- check conservation (C Rousset)
-      ! -------------------------------
-
-      !------------------------------------------------------------------------------!
-      ! 1) Initialization of diagnostic variables                                    !
-      !------------------------------------------------------------------------------!
+      ! conservation test
+      IF( ln_limdiahsb ) CALL lim_cons_hsm(0, 'limthd', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
+
+      !------------------------------------------------------------------------!
+      ! 1) Initialization of some variables                                    !
+      !------------------------------------------------------------------------!
+      ftr_ice(:,:,:) = 0._wp  ! part of solar radiation transmitted through the ice
+
 
       !--------------------
@@ -121,10 +115,10 @@
             DO jj = 1, jpj
                DO ji = 1, jpi
+                  !0 if no ice and 1 if yes
+                  rswitch = 1.0 - MAX(  0.0 , SIGN( 1.0 , - v_i(ji,jj,jl) + epsi10 )  )
                   !Energy of melting q(S,T) [J.m-3]
-                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) / ( area(ji,jj) * MAX( v_i(ji,jj,jl) , epsi10 ) ) * REAL( nlay_i )
-                  !0 if no ice and 1 if yes
-                  zindb = 1.0 - MAX(  0.0 , SIGN( 1.0 , - v_i(ji,jj,jl) + epsi10 )  )
-                  !convert units ! very important that this line is here
-                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * unit_fac * zindb 
+                  e_i(ji,jj,jk,jl) = rswitch * e_i(ji,jj,jk,jl) / ( area(ji,jj) * MAX( v_i(ji,jj,jl) , epsi10 ) ) * REAL( nlay_i )
+                  !convert units ! very important that this line is here        
+                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * unit_fac 
                END DO
             END DO
@@ -133,27 +127,37 @@
             DO jj = 1, jpj
                DO ji = 1, jpi
+                  !0 if no ice and 1 if yes
+                  rswitch = 1.0 - MAX(  0.0 , SIGN( 1.0 , - v_s(ji,jj,jl) + epsi10 )  )
                   !Energy of melting q(S,T) [J.m-3]
-                  e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) / ( area(ji,jj) * MAX( v_s(ji,jj,jl) , epsi10 ) ) * REAL( nlay_s )
-                  !0 if no ice and 1 if yes
-                  zindb = 1.0 - MAX(  0.0 , SIGN( 1.0 , - v_s(ji,jj,jl) + epsi10 )  )
+                  e_s(ji,jj,jk,jl) = rswitch * e_s(ji,jj,jk,jl) / ( area(ji,jj) * MAX( v_s(ji,jj,jl) , epsi10 ) ) * REAL( nlay_s )
                   !convert units ! very important that this line is here
-                  e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) * unit_fac * zindb 
+                  e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) * unit_fac 
                END DO
             END DO
          END DO
       END DO
-
-      !-----------------------------------
-      ! 1.4) Compute global heat content
-      !-----------------------------------
-      qt_i_in  (:,:) = 0.e0
-      qt_s_in  (:,:) = 0.e0
-      qt_i_fin (:,:) = 0.e0
-      qt_s_fin (:,:) = 0.e0
-      sum_fluxq(:,:) = 0.e0
-      fatm     (:,:) = 0.e0
 
       ! 2) Partial computation of forcing for the thermodynamic sea ice model.      !
       !-----------------------------------------------------------------------------!
+
+      !--- Ocean solar and non solar fluxes to be used in zqld
+      IF ( .NOT. lk_cpl ) THEN   ! --- forced case, fluxes to the lead are the same as over the ocean
+         !
+         zqsr(:,:) = qsr(:,:)      ; zqns(:,:) = qns(:,:)
+         !
+      ELSE                       ! --- coupled case, fluxes to the lead are total - intercepted
+         !
+         zqsr(:,:) = qsr_tot(:,:)  ; zqns(:,:) = qns_tot(:,:)
+         !
+         DO jl = 1, jpl
+            DO jj = 1, jpj
+               DO ji = 1, jpi
+                  zqsr(ji,jj) = zqsr(ji,jj) - qsr_ice(ji,jj,jl) * a_i_b(ji,jj,jl)
+                  zqns(ji,jj) = zqns(ji,jj) - qns_ice(ji,jj,jl) * a_i_b(ji,jj,jl)
+               END DO
+            END DO
+         END DO
+         !
+      ENDIF
 
 !CDIR NOVERRCHK
@@ -161,5 +165,5 @@
 !CDIR NOVERRCHK
          DO ji = 1, jpi
-            zinda          = tms(ji,jj) * ( 1.0 - MAX( zzero , SIGN( zone , - at_i(ji,jj) + epsi10 ) ) )
+            rswitch          = tms(ji,jj) * ( 1._wp - MAX( 0._wp , SIGN( 1._wp , - at_i(ji,jj) + epsi10 ) ) ) ! 0 if no ice
             !
             !           !  solar irradiance transmission at the mixed layer bottom and used in the lead heat budget
@@ -168,39 +172,77 @@
             !           !  net downward heat flux from the ice to the ocean, expressed as a function of ocean 
             !           !  temperature and turbulent mixing (McPhee, 1992)
-            ! friction velocity
-            zfric_u        = MAX ( MIN( SQRT( ust2s(ji,jj) ) , zfric_umax ) , zfric_umin ) 
-
-            ! here the drag will depend on ice thickness and type (0.006)
-            fdtcn(ji,jj)  = zinda * rau0 * rcp * 0.006  * zfric_u * ( ( sst_m(ji,jj) + rt0 ) - t_bo(ji,jj) ) 
-            ! also category dependent
-            !           !-- Energy from the turbulent oceanic heat flux heat flux coming in the lead 
-            qdtcn(ji,jj)  = zinda * fdtcn(ji,jj) * ( 1.0 - at_i(ji,jj) ) * rdt_ice
-            !                       
-            !           !-- Lead heat budget, qldif (part 1, next one is in limthd_dh) 
-            !           !   caution: exponent betas used as more snow can fallinto leads
-            qldif(ji,jj) =  tms(ji,jj) * rdt_ice  * (                             &
-               &   pfrld(ji,jj)        * (  qsr(ji,jj) * oatte(ji,jj)             &   ! solar heat + clem modif
-               &                            + qns(ji,jj)                          &   ! non solar heat
-               &                            + fdtcn(ji,jj)                        &   ! turbulent ice-ocean heat
-               &                            + fsbbq(ji,jj) * ( 1.0 - zinda )  )   &   ! residual heat from previous step
-               & - pfrld(ji,jj)**betas * sprecip(ji,jj) * lfus                    )   ! latent heat of sprecip melting
             !
-            ! Positive heat budget is used for bottom ablation
-            zfntlat        = 1.0 - MAX( zzero , SIGN( zone ,  - qldif(ji,jj) ) )
-            != 1 if positive heat budget
-            zpareff        = 1.0 - zinda * zfntlat
-            != 0 if ice and positive heat budget and 1 if one of those two is false
-            zqlbsbq(ji,jj) = qldif(ji,jj) * ( 1.0 - zpareff ) / ( rdt_ice * MAX( at_i(ji,jj), epsi10 ) )
+
+            ! --- Energy received in the lead, zqld is defined everywhere (J.m-2) --- !
+            ! REMARK valid at least in forced mode from clem
+            ! precip is included in qns but not in qns_ice
+            IF ( lk_cpl ) THEN
+               zqld =  tms(ji,jj) * rdt_ice *  &
+                  &    (   zqsr(ji,jj) * fraqsr_1lev(ji,jj) + zqns(ji,jj)               &   ! pfrld already included in coupled mode
+                  &    + ( pfrld(ji,jj)**betas - pfrld(ji,jj) ) * sprecip(ji,jj)  *     &   ! heat content of precip
+                  &      ( cpic * ( MIN( tatm_ice(ji,jj), rt0_snow ) - rtt ) - lfus )   &
+                  &    + ( 1._wp - pfrld(ji,jj) ) * ( tprecip(ji,jj) - sprecip(ji,jj) ) * rcp * ( tatm_ice(ji,jj) - rtt ) )
+            ELSE
+               zqld =  tms(ji,jj) * rdt_ice *  &
+                  &      ( pfrld(ji,jj) * ( zqsr(ji,jj) * fraqsr_1lev(ji,jj) + zqns(ji,jj) )    &
+                  &    + ( pfrld(ji,jj)**betas - pfrld(ji,jj) ) * sprecip(ji,jj)  *             &  ! heat content of precip
+                  &      ( cpic * ( MIN( tatm_ice(ji,jj), rt0_snow ) - rtt ) - lfus )           &
+                  &    + ( 1._wp - pfrld(ji,jj) ) * ( tprecip(ji,jj) - sprecip(ji,jj) ) * rcp * ( tatm_ice(ji,jj) - rtt ) )
+            ENDIF
+
+            !-- Energy needed to bring ocean surface layer until its freezing (<0, J.m-2) --- !
+            zqfr = tms(ji,jj) * rau0 * rcp * fse3t_m(ji,jj) * ( t_bo(ji,jj) - ( sst_m(ji,jj) + rt0 ) )
+
+            !-- Energy Budget of the leads (J.m-2). Must be < 0 to form ice
+            qlead(ji,jj) = MIN( 0._wp , zqld - zqfr ) 
+
+            ! If there is ice and leads are warming, then transfer energy from the lead budget and use it for bottom melting 
+            IF( at_i(ji,jj) > epsi10 .AND. zqld > 0._wp ) THEN
+               fhld (ji,jj) = zqld * r1_rdtice / at_i(ji,jj) ! divided by at_i since this is (re)multiplied by a_i in limthd_dh.F90
+               qlead(ji,jj) = 0._wp
+            ELSE
+               fhld (ji,jj) = 0._wp
+            ENDIF
             !
-            ! Heat budget of the lead, energy transferred from ice to ocean
-            qldif  (ji,jj) = zpareff * qldif(ji,jj)
-            qdtcn  (ji,jj) = zpareff * qdtcn(ji,jj)
-            !
-            ! Energy needed to bring ocean surface layer until its freezing (qcmif, limflx)
-            qcmif  (ji,jj) =  rau0 * rcp * fse3t_m(ji,jj) * ( t_bo(ji,jj) - ( sst_m(ji,jj) + rt0 ) )
-            !
-            ! oceanic heat flux (limthd_dh)
-            fbif   (ji,jj) = zinda * (  fsbbq(ji,jj) / MAX( at_i(ji,jj) , epsi10 ) + fdtcn(ji,jj) )
-            !
+            !-- Energy from the turbulent oceanic heat flux --- !
+            !clem zfric_u        = MAX ( MIN( SQRT( ust2s(ji,jj) ) , zfric_umax ) , zfric_umin )
+            zfric_u      = MAX( SQRT( ust2s(ji,jj) ), zfric_umin ) 
+            fhtur(ji,jj) = MAX( 0._wp, rswitch * rau0 * rcp * zch  * zfric_u * ( ( sst_m(ji,jj) + rt0 ) - t_bo(ji,jj) ) ) ! W.m-2 
+            ! upper bound for fhtur: we do not want SST to drop below Tfreeze. 
+            ! So we say that the heat retrieved from the ocean (fhtur+fhld) must be < to the heat necessary to reach Tfreeze (zqfr)   
+            ! This is not a clean budget, so that should be corrected at some point
+            fhtur(ji,jj) = rswitch * MIN( fhtur(ji,jj), - fhld(ji,jj) - zqfr * r1_rdtice / MAX( at_i(ji,jj), epsi10 ) )
+
+            ! -----------------------------------------
+            ! Net heat flux on top of ice-ocean [W.m-2]
+            ! -----------------------------------------
+            !     First  step here      : heat flux at the ocean surface + precip
+            !     Second step below     : heat flux at the ice   surface (after limthd_dif) 
+            hfx_in(ji,jj) = hfx_in(ji,jj)                                                                                         & 
+               ! heat flux above the ocean
+               &    +             pfrld(ji,jj)   * ( zqns(ji,jj) + zqsr(ji,jj) )                                                  &
+               ! latent heat of precip (note that precip is included in qns but not in qns_ice)
+               &    +   ( 1._wp - pfrld(ji,jj) ) * sprecip(ji,jj) * ( cpic * ( MIN( tatm_ice(ji,jj), rt0_snow ) - rtt ) - lfus )  &
+               &    +   ( 1._wp - pfrld(ji,jj) ) * ( tprecip(ji,jj) - sprecip(ji,jj) ) * rcp * ( tatm_ice(ji,jj) - rtt )
+
+            ! -----------------------------------------------------------------------------
+            ! Net heat flux that is retroceded to the ocean or taken from the ocean [W.m-2]
+            ! -----------------------------------------------------------------------------
+            !     First  step here              :  non solar + precip - qlead - qturb
+            !     Second step in limthd_dh      :  heat remaining if total melt (zq_rema) 
+            !     Third  step in limsbc         :  heat from ice-ocean mass exchange (zf_mass) + solar
+            hfx_out(ji,jj) = hfx_out(ji,jj)                                                                                       & 
+               ! Non solar heat flux received by the ocean
+               &    +        pfrld(ji,jj) * qns(ji,jj)                                                                            &
+               ! latent heat of precip (note that precip is included in qns but not in qns_ice)
+               &    +      ( pfrld(ji,jj)**betas - pfrld(ji,jj) ) * sprecip(ji,jj)       &
+               &         * ( cpic * ( MIN( tatm_ice(ji,jj), rt0_snow ) - rtt ) - lfus )  &
+               &    +      ( 1._wp - pfrld(ji,jj) ) * ( tprecip(ji,jj) - sprecip(ji,jj) ) * rcp * ( tatm_ice(ji,jj) - rtt )       &
+               ! heat flux taken from the ocean where there is open water ice formation
+               &    -      qlead(ji,jj) * r1_rdtice                                                                               &
+               ! heat flux taken from the ocean during bottom growth/melt (fhld should be 0 while bott growth)
+               &    -      at_i(ji,jj) * fhtur(ji,jj)                                                                             &
+               &    -      at_i(ji,jj) *  fhld(ji,jj)
+
          END DO
       END DO
@@ -234,4 +276,5 @@
                DO jj = mj0(jjindx), mj1(jjindx)
                   jiindex_1d = (jj - 1) * jpi + ji
+                  WRITE(numout,*) ' lim_thd : Category no : ', jl 
                END DO
             END DO
@@ -250,19 +293,19 @@
             !-------------------------
 
-            CALL tab_2d_1d( nbpb, at_i_b     (1:nbpb), at_i            , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, a_i_b      (1:nbpb), a_i(:,:,jl)     , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, ht_i_b     (1:nbpb), ht_i(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, ht_s_b     (1:nbpb), ht_s(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
-
-            CALL tab_2d_1d( nbpb, t_su_b     (1:nbpb), t_su(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, sm_i_b     (1:nbpb), sm_i(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, at_i_1d     (1:nbpb), at_i            , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, a_i_1d      (1:nbpb), a_i(:,:,jl)     , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, ht_i_1d     (1:nbpb), ht_i(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, ht_s_1d     (1:nbpb), ht_s(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
+
+            CALL tab_2d_1d( nbpb, t_su_1d     (1:nbpb), t_su(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, sm_i_1d     (1:nbpb), sm_i(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
             DO jk = 1, nlay_s
-               CALL tab_2d_1d( nbpb, t_s_b(1:nbpb,jk), t_s(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
-               CALL tab_2d_1d( nbpb, q_s_b(1:nbpb,jk), e_s(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
+               CALL tab_2d_1d( nbpb, t_s_1d(1:nbpb,jk), t_s(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
+               CALL tab_2d_1d( nbpb, q_s_1d(1:nbpb,jk), e_s(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
             END DO
             DO jk = 1, nlay_i
-               CALL tab_2d_1d( nbpb, t_i_b(1:nbpb,jk), t_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
-               CALL tab_2d_1d( nbpb, q_i_b(1:nbpb,jk), e_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
-               CALL tab_2d_1d( nbpb, s_i_b(1:nbpb,jk), s_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
+               CALL tab_2d_1d( nbpb, t_i_1d(1:nbpb,jk), t_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
+               CALL tab_2d_1d( nbpb, q_i_1d(1:nbpb,jk), e_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
+               CALL tab_2d_1d( nbpb, s_i_1d(1:nbpb,jk), s_i(:,:,jk,jl)  , jpi, jpj, npb(1:nbpb) )
             END DO
 
@@ -271,58 +314,73 @@
             CALL tab_2d_1d( nbpb, fr1_i0_1d  (1:nbpb), fr1_i0          , jpi, jpj, npb(1:nbpb) )
             CALL tab_2d_1d( nbpb, fr2_i0_1d  (1:nbpb), fr2_i0          , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, qnsr_ice_1d(1:nbpb), qns_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
-#if ! defined key_coupled
-            CALL tab_2d_1d( nbpb, qla_ice_1d (1:nbpb), qla_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, dqla_ice_1d(1:nbpb), dqla_ice(:,:,jl), jpi, jpj, npb(1:nbpb) )
-#endif
+            CALL tab_2d_1d( nbpb, qns_ice_1d (1:nbpb), qns_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, ftr_ice_1d (1:nbpb), ftr_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
+            IF( .NOT. lk_cpl ) THEN
+               CALL tab_2d_1d( nbpb, qla_ice_1d (1:nbpb), qla_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
+               CALL tab_2d_1d( nbpb, dqla_ice_1d(1:nbpb), dqla_ice(:,:,jl), jpi, jpj, npb(1:nbpb) )
+            ENDIF
             CALL tab_2d_1d( nbpb, dqns_ice_1d(1:nbpb), dqns_ice(:,:,jl), jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, t_bo_b     (1:nbpb), t_bo            , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, t_bo_1d     (1:nbpb), t_bo            , jpi, jpj, npb(1:nbpb) )
             CALL tab_2d_1d( nbpb, sprecip_1d (1:nbpb), sprecip         , jpi, jpj, npb(1:nbpb) ) 
-            CALL tab_2d_1d( nbpb, fbif_1d    (1:nbpb), fbif            , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, qldif_1d   (1:nbpb), qldif           , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, rdm_ice_1d (1:nbpb), rdm_ice         , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, rdm_snw_1d (1:nbpb), rdm_snw         , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, dmgwi_1d   (1:nbpb), dmgwi           , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, qlbbq_1d   (1:nbpb), zqlbsbq         , jpi, jpj, npb(1:nbpb) )
-
-            CALL tab_2d_1d( nbpb, sfx_thd_1d (1:nbpb), sfx_thd         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, fhtur_1d   (1:nbpb), fhtur           , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, qlead_1d   (1:nbpb), qlead           , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, fhld_1d    (1:nbpb), fhld            , jpi, jpj, npb(1:nbpb) )
+
+            CALL tab_2d_1d( nbpb, wfx_snw_1d (1:nbpb), wfx_snw         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, wfx_sub_1d (1:nbpb), wfx_sub         , jpi, jpj, npb(1:nbpb) )
+
+            CALL tab_2d_1d( nbpb, wfx_bog_1d (1:nbpb), wfx_bog         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, wfx_bom_1d (1:nbpb), wfx_bom         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, wfx_sum_1d (1:nbpb), wfx_sum         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, wfx_sni_1d (1:nbpb), wfx_sni         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, wfx_res_1d (1:nbpb), wfx_res         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, wfx_spr_1d (1:nbpb), wfx_spr         , jpi, jpj, npb(1:nbpb) )
+
+            CALL tab_2d_1d( nbpb, sfx_bog_1d (1:nbpb), sfx_bog         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, sfx_bom_1d (1:nbpb), sfx_bom         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, sfx_sum_1d (1:nbpb), sfx_sum         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, sfx_sni_1d (1:nbpb), sfx_sni         , jpi, jpj, npb(1:nbpb) )
             CALL tab_2d_1d( nbpb, sfx_bri_1d (1:nbpb), sfx_bri         , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, fhbri_1d   (1:nbpb), fhbri           , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, fstbif_1d  (1:nbpb), fstric          , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, qfvbq_1d   (1:nbpb), qfvbq           , jpi, jpj, npb(1:nbpb) )
-
-            CALL tab_2d_1d( nbpb, iatte_1d   (1:nbpb), iatte           , jpi, jpj, npb(1:nbpb) ) ! clem modif
-            CALL tab_2d_1d( nbpb, oatte_1d   (1:nbpb), oatte           , jpi, jpj, npb(1:nbpb) ) ! clem modif
+            CALL tab_2d_1d( nbpb, sfx_res_1d (1:nbpb), sfx_res         , jpi, jpj, npb(1:nbpb) )
+
+            CALL tab_2d_1d( nbpb, hfx_thd_1d (1:nbpb), hfx_thd         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, hfx_spr_1d (1:nbpb), hfx_spr         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, hfx_sum_1d (1:nbpb), hfx_sum         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, hfx_bom_1d (1:nbpb), hfx_bom         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, hfx_bog_1d (1:nbpb), hfx_bog         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, hfx_dif_1d (1:nbpb), hfx_dif         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, hfx_opw_1d (1:nbpb), hfx_opw         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, hfx_snw_1d (1:nbpb), hfx_snw         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, hfx_sub_1d (1:nbpb), hfx_sub         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, hfx_err_1d (1:nbpb), hfx_err         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, hfx_res_1d (1:nbpb), hfx_res         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, hfx_err_rem_1d (1:nbpb), hfx_err_rem , jpi, jpj, npb(1:nbpb) )
+
             !--------------------------------
             ! 4.3) Thermodynamic processes
             !--------------------------------
 
-            IF( con_i .AND. jiindex_1d > 0 )   CALL lim_thd_enmelt( 1, nbpb )   ! computes sea ice energy of melting
-            IF( con_i .AND. jiindex_1d > 0 )   CALL lim_thd_glohec( qt_i_in, qt_s_in, q_i_layer_in, 1, nbpb, jl )
-
-            !                                 !---------------------------------!
-            CALL lim_thd_dif( 1, nbpb, jl )   ! Ice/Snow Temperature profile    !
-            !                                 !---------------------------------!
-
-            CALL lim_thd_enmelt( 1, nbpb )    ! computes sea ice energy of melting compulsory for limthd_dh
-
-            IF( con_i .AND. jiindex_1d > 0 )   CALL lim_thd_glohec ( qt_i_fin, qt_s_fin, q_i_layer_fin, 1, nbpb, jl ) 
-            IF( con_i .AND. jiindex_1d > 0 )   CALL lim_thd_con_dif( 1 , nbpb , jl )
-
-            !                                 !---------------------------------!
-            CALL lim_thd_dh( 1, nbpb, jl )    ! Ice/Snow thickness              ! 
-            !                                 !---------------------------------!
-
-            !                                 !---------------------------------!
-            CALL lim_thd_ent( 1, nbpb, jl )   ! Ice/Snow enthalpy remapping     !
-            !                                 !---------------------------------!
-
-            !                                 !---------------------------------!
-            CALL lim_thd_sal( 1, nbpb )       ! Ice salinity computation        !
-            !                                 !---------------------------------!
-
-            !           CALL lim_thd_enmelt(1,nbpb)   ! computes sea ice energy of melting
-            IF( con_i .AND. jiindex_1d > 0 )   CALL lim_thd_glohec( qt_i_fin, qt_s_fin, q_i_layer_fin, 1, nbpb, jl ) 
-            IF( con_i .AND. jiindex_1d > 0 )   CALL lim_thd_con_dh ( 1 , nbpb , jl )
+            !---------------------------------!
+            ! Ice/Snow Temperature profile    !
+            !---------------------------------!
+            CALL lim_thd_dif( 1, nbpb )
+
+            !---------------------------------!
+            ! Ice/Snow thicnkess              !
+            !---------------------------------!
+            CALL lim_thd_dh( 1, nbpb )    
+
+            ! --- Ice enthalpy remapping --- !
+            CALL lim_thd_ent( 1, nbpb, q_i_1d(1:nbpb,:) ) 
+                                            
+            !---------------------------------!
+            ! --- Ice salinity --- !
+            !---------------------------------!
+            CALL lim_thd_sal( 1, nbpb )    
+
+            !---------------------------------!
+            ! --- temperature update --- !
+            !---------------------------------!
+            CALL lim_thd_temp( 1, nbpb )
 
             !--------------------------------
@@ -330,45 +388,53 @@
             !--------------------------------
 
-               CALL tab_1d_2d( nbpb, at_i          , npb, at_i_b    (1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, ht_i(:,:,jl)  , npb, ht_i_b    (1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, ht_s(:,:,jl)  , npb, ht_s_b    (1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, a_i (:,:,jl)  , npb, a_i_b     (1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, t_su(:,:,jl)  , npb, t_su_b    (1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, sm_i(:,:,jl)  , npb, sm_i_b    (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, at_i          , npb, at_i_1d    (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, ht_i(:,:,jl)  , npb, ht_i_1d    (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, ht_s(:,:,jl)  , npb, ht_s_1d    (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, a_i (:,:,jl)  , npb, a_i_1d     (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, t_su(:,:,jl)  , npb, t_su_1d    (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, sm_i(:,:,jl)  , npb, sm_i_1d    (1:nbpb)   , jpi, jpj )
             DO jk = 1, nlay_s
-               CALL tab_1d_2d( nbpb, t_s(:,:,jk,jl), npb, t_s_b     (1:nbpb,jk), jpi, jpj)
-               CALL tab_1d_2d( nbpb, e_s(:,:,jk,jl), npb, q_s_b     (1:nbpb,jk), jpi, jpj)
+               CALL tab_1d_2d( nbpb, t_s(:,:,jk,jl), npb, t_s_1d     (1:nbpb,jk), jpi, jpj)
+               CALL tab_1d_2d( nbpb, e_s(:,:,jk,jl), npb, q_s_1d     (1:nbpb,jk), jpi, jpj)
             END DO
             DO jk = 1, nlay_i
-               CALL tab_1d_2d( nbpb, t_i(:,:,jk,jl), npb, t_i_b     (1:nbpb,jk), jpi, jpj)
-               CALL tab_1d_2d( nbpb, e_i(:,:,jk,jl), npb, q_i_b     (1:nbpb,jk), jpi, jpj)
-               CALL tab_1d_2d( nbpb, s_i(:,:,jk,jl), npb, s_i_b     (1:nbpb,jk), jpi, jpj)
-            END DO
-               CALL tab_1d_2d( nbpb, fstric        , npb, fstbif_1d (1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, qldif         , npb, qldif_1d  (1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, qfvbq         , npb, qfvbq_1d  (1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, rdm_ice       , npb, rdm_ice_1d(1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, rdm_snw       , npb, rdm_snw_1d(1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, dmgwi         , npb, dmgwi_1d  (1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, rdvosif       , npb, dvsbq_1d  (1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, rdvobif       , npb, dvbbq_1d  (1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, fdvolif       , npb, dvlbq_1d  (1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, rdvonif       , npb, dvnbq_1d  (1:nbpb)   , jpi, jpj ) 
-               CALL tab_1d_2d( nbpb, sfx_thd       , npb, sfx_thd_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, t_i(:,:,jk,jl), npb, t_i_1d     (1:nbpb,jk), jpi, jpj)
+               CALL tab_1d_2d( nbpb, e_i(:,:,jk,jl), npb, q_i_1d     (1:nbpb,jk), jpi, jpj)
+               CALL tab_1d_2d( nbpb, s_i(:,:,jk,jl), npb, s_i_1d     (1:nbpb,jk), jpi, jpj)
+            END DO
+               CALL tab_1d_2d( nbpb, qlead         , npb, qlead_1d  (1:nbpb)   , jpi, jpj )
+
+               CALL tab_1d_2d( nbpb, wfx_snw       , npb, wfx_snw_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, wfx_sub       , npb, wfx_sub_1d(1:nbpb)   , jpi, jpj )
+
+               CALL tab_1d_2d( nbpb, wfx_bog       , npb, wfx_bog_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, wfx_bom       , npb, wfx_bom_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, wfx_sum       , npb, wfx_sum_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, wfx_sni       , npb, wfx_sni_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, wfx_res       , npb, wfx_res_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, wfx_spr       , npb, wfx_spr_1d(1:nbpb)   , jpi, jpj )
+
+               CALL tab_1d_2d( nbpb, sfx_bog       , npb, sfx_bog_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, sfx_bom       , npb, sfx_bom_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, sfx_sum       , npb, sfx_sum_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, sfx_sni       , npb, sfx_sni_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, sfx_res       , npb, sfx_res_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, sfx_bri       , npb, sfx_bri_1d(1:nbpb)   , jpi, jpj )
+
+              CALL tab_1d_2d( nbpb, hfx_thd       , npb, hfx_thd_1d(1:nbpb)   , jpi, jpj )
+              CALL tab_1d_2d( nbpb, hfx_spr       , npb, hfx_spr_1d(1:nbpb)   , jpi, jpj )
+              CALL tab_1d_2d( nbpb, hfx_sum       , npb, hfx_sum_1d(1:nbpb)   , jpi, jpj )
+              CALL tab_1d_2d( nbpb, hfx_bom       , npb, hfx_bom_1d(1:nbpb)   , jpi, jpj )
+              CALL tab_1d_2d( nbpb, hfx_bog       , npb, hfx_bog_1d(1:nbpb)   , jpi, jpj )
+              CALL tab_1d_2d( nbpb, hfx_dif       , npb, hfx_dif_1d(1:nbpb)   , jpi, jpj )
+              CALL tab_1d_2d( nbpb, hfx_opw       , npb, hfx_opw_1d(1:nbpb)   , jpi, jpj )
+              CALL tab_1d_2d( nbpb, hfx_snw       , npb, hfx_snw_1d(1:nbpb)   , jpi, jpj )
+              CALL tab_1d_2d( nbpb, hfx_sub       , npb, hfx_sub_1d(1:nbpb)   , jpi, jpj )
+              CALL tab_1d_2d( nbpb, hfx_err       , npb, hfx_err_1d(1:nbpb)   , jpi, jpj )
+              CALL tab_1d_2d( nbpb, hfx_res       , npb, hfx_res_1d(1:nbpb)   , jpi, jpj )
+              CALL tab_1d_2d( nbpb, hfx_err_rem   , npb, hfx_err_rem_1d(1:nbpb)   , jpi, jpj )
             !
-            IF( num_sal == 2 ) THEN
-               CALL tab_1d_2d( nbpb, sfx_bri       , npb, sfx_bri_1d(1:nbpb)   , jpi, jpj )
-               CALL tab_1d_2d( nbpb, fhbri         , npb, fhbri_1d  (1:nbpb)   , jpi, jpj )
-            ENDIF
-            !
-            !+++++       temporary stuff for a dummy version
-            CALL tab_1d_2d( nbpb, dh_i_surf2D, npb, dh_i_surf(1:nbpb)      , jpi, jpj )
-            CALL tab_1d_2d( nbpb, dh_i_bott2D, npb, dh_i_bott(1:nbpb)      , jpi, jpj )
-            CALL tab_1d_2d( nbpb, fsup2D     , npb, fsup     (1:nbpb)      , jpi, jpj )
-            CALL tab_1d_2d( nbpb, focea2D    , npb, focea    (1:nbpb)      , jpi, jpj )
-            CALL tab_1d_2d( nbpb, s_i_newice , npb, s_i_new  (1:nbpb)      , jpi, jpj )
-            CALL tab_1d_2d( nbpb, izero(:,:,jl) , npb, i0    (1:nbpb)      , jpi, jpj )
-            CALL tab_1d_2d( nbpb, qns_ice(:,:,jl), npb, qnsr_ice_1d(1:nbpb), jpi, jpj)
-            !+++++
+              CALL tab_1d_2d( nbpb, qns_ice(:,:,jl), npb, qns_ice_1d(1:nbpb) , jpi, jpj)
+              CALL tab_1d_2d( nbpb, ftr_ice(:,:,jl), npb, ftr_ice_1d(1:nbpb) , jpi, jpj )
             !
             IF( lk_mpp )   CALL mpp_comm_free( ncomm_ice ) !RB necessary ??
@@ -384,9 +450,8 @@
       ! 5.1) Ice heat content              
       !------------------------
-      ! Enthalpies are global variables we have to readjust the units (heat content in 10^9 Joules)
-      zcoef = 1._wp / ( unit_fac * REAL( nlay_i ) )
+      ! Enthalpies are global variables we have to readjust the units (heat content in Joules)
       DO jl = 1, jpl
          DO jk = 1, nlay_i
-            e_i(:,:,jk,jl) = e_i(:,:,jk,jl) * area(:,:) * a_i(:,:,jl) * ht_i(:,:,jl) * zcoef
+            e_i(:,:,jk,jl) = e_i(:,:,jk,jl) * area(:,:) * a_i(:,:,jl) * ht_i(:,:,jl) / ( unit_fac * REAL( nlay_i ) )
          END DO
       END DO
@@ -395,9 +460,8 @@
       ! 5.2) Snow heat content              
       !------------------------
-      ! Enthalpies are global variables we have to readjust the units (heat content in 10^9 Joules)
-      zcoef = 1._wp / ( unit_fac * REAL( nlay_s ) )
+      ! Enthalpies are global variables we have to readjust the units (heat content in Joules)
       DO jl = 1, jpl
          DO jk = 1, nlay_s
-            e_s(:,:,jk,jl) = e_s(:,:,jk,jl) * area(:,:) * a_i(:,:,jl) * ht_s(:,:,jl) * zcoef
+            e_s(:,:,jk,jl) = e_s(:,:,jk,jl) * area(:,:) * a_i(:,:,jl) * ht_s(:,:,jl) / ( unit_fac * REAL( nlay_s ) )
          END DO
       END DO
@@ -411,9 +475,4 @@
       ! 5.4) Diagnostic thermodynamic growth rates
       !--------------------------------------------
-!clem@useless      d_v_i_thd(:,:,:) = v_i      (:,:,:) - old_v_i(:,:,:)    ! ice volumes 
-!clem@mv-to-itd    dv_dt_thd(:,:,:) = d_v_i_thd(:,:,:) * r1_rdtice * rday
-
-      IF( con_i .AND. jiindex_1d > 0 )   fbif(:,:) = fbif(:,:) + zqlbsbq(:,:)
-
       IF(ln_ctl) THEN            ! Control print
          CALL prt_ctl_info(' ')
@@ -448,334 +507,20 @@
       ENDIF
       !
-      ! -------------------------------
-      !- check conservation (C Rousset)
-      IF (ln_limdiahsb) THEN
-         zchk_fs  = glob_sum( ( sfx_bri(:,:) + sfx_thd(:,:) + sfx_res(:,:) + sfx_mec(:,:) ) * area(:,:) * tms(:,:) ) - zchk_fs_b
-         zchk_fw  = glob_sum( rdm_ice(:,:) * area(:,:) * tms(:,:) ) - zchk_fw_b
- 
-         zchk_v_i = ( glob_sum( SUM(   v_i(:,:,:), dim=3 ) * area(:,:) * tms(:,:) ) - zchk_v_i_b - ( zchk_fw / rhoic ) ) * r1_rdtice
-         zchk_smv = ( glob_sum( SUM( smv_i(:,:,:), dim=3 ) * area(:,:) * tms(:,:) ) - zchk_smv_b ) * r1_rdtice + ( zchk_fs / rhoic )
-
-         zchk_vmin = glob_min(v_i)
-         zchk_amax = glob_max(SUM(a_i,dim=3))
-         zchk_amin = glob_min(a_i)
-       
-         IF(lwp) THEN
-            IF ( ABS( zchk_v_i   ) >  1.e-5 ) WRITE(numout,*) 'violation volume [m3/day]     (limthd) = ',(zchk_v_i * rday)
-            IF ( ABS( zchk_smv   ) >  1.e-4 ) WRITE(numout,*) 'violation saline [psu*m3/day] (limthd) = ',(zchk_smv * rday)
-            IF ( zchk_vmin <  0.            ) WRITE(numout,*) 'violation v_i<0  [mm]         (limthd) = ',(zchk_vmin * 1.e-3)
-            IF ( zchk_amax >  amax+epsi10   ) WRITE(numout,*) 'violation a_i>amax            (limthd) = ',zchk_amax
-            IF ( zchk_amin <  0.            ) WRITE(numout,*) 'violation a_i<0               (limthd) = ',zchk_amin
-         ENDIF
-      ENDIF
-      !- check conservation (C Rousset)
-      ! -------------------------------
-      !
-      CALL wrk_dealloc( jpi, jpj, zqlbsbq )
+      !
+      CALL wrk_dealloc( jpi, jpj, zqsr, zqns )
+
+      !
+      ! conservation test
+      IF( ln_limdiahsb ) CALL lim_cons_hsm(1, 'limthd', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
       !
       IF( nn_timing == 1 )  CALL timing_stop('limthd')
-   END SUBROUTINE lim_thd
-
-
-   SUBROUTINE lim_thd_glohec( eti, ets, etilayer, kideb, kiut, jl )
+
+   END SUBROUTINE lim_thd 
+
+   SUBROUTINE lim_thd_temp( kideb, kiut )
       !!-----------------------------------------------------------------------
-      !!                   ***  ROUTINE lim_thd_glohec *** 
+      !!                   ***  ROUTINE lim_thd_temp *** 
       !!                 
-      !! ** Purpose :  Compute total heat content for each category
-      !!               Works with 1d vectors only
-      !!-----------------------------------------------------------------------
-      INTEGER , INTENT(in   )                         ::   kideb, kiut   ! bounds for the spatial loop
-      INTEGER , INTENT(in   )                         ::   jl            ! category number
-      REAL(wp), INTENT(  out), DIMENSION (jpij,jpl  ) ::   eti, ets      ! vertically-summed heat content for ice & snow
-      REAL(wp), INTENT(  out), DIMENSION (jpij,jkmax) ::   etilayer      ! heat content for ice layers
-      !!
-      INTEGER  ::   ji,jk   ! loop indices
-      !!-----------------------------------------------------------------------
-      eti(:,:) = 0._wp
-      ets(:,:) = 0._wp
-      !
-      DO jk = 1, nlay_i                ! total q over all layers, ice [J.m-2]
-         DO ji = kideb, kiut
-            etilayer(ji,jk) = q_i_b(ji,jk) * ht_i_b(ji) / REAL( nlay_i )
-            eti     (ji,jl) = eti(ji,jl) + etilayer(ji,jk) 
-         END DO
-      END DO
-      DO ji = kideb, kiut              ! total q over all layers, snow [J.m-2]
-         ets(ji,jl) = ets(ji,jl) + q_s_b(ji,1) * ht_s_b(ji) / REAL( nlay_s )
-      END DO
-      !
-      WRITE(numout,*) ' lim_thd_glohec '
-      WRITE(numout,*) ' qt_i_in : ', eti(jiindex_1d,jl) * r1_rdtice
-      WRITE(numout,*) ' qt_s_in : ', ets(jiindex_1d,jl) * r1_rdtice
-      WRITE(numout,*) ' qt_in   : ', ( eti(jiindex_1d,jl) + ets(jiindex_1d,jl) ) * r1_rdtice
-      !
-   END SUBROUTINE lim_thd_glohec
-
-
-   SUBROUTINE lim_thd_con_dif( kideb, kiut, jl )
-      !!-----------------------------------------------------------------------
-      !!                   ***  ROUTINE lim_thd_con_dif *** 
-      !!                 
-      !! ** Purpose :   Test energy conservation after heat diffusion
-      !!-------------------------------------------------------------------
-      INTEGER , INTENT(in   ) ::   kideb, kiut   ! bounds for the spatial loop
-      INTEGER , INTENT(in   ) ::   jl            ! category number
-
-      INTEGER  ::   ji, jk         ! loop indices
-      INTEGER  ::   ii, ij
-      INTEGER  ::   numce          ! number of points for which conservation is violated
-      REAL(wp) ::   meance         ! mean conservation error
-      REAL(wp) ::   max_cons_err, max_surf_err
-      !!---------------------------------------------------------------------
-
-      max_cons_err =  1.0_wp          ! maximum tolerated conservation error
-      max_surf_err =  0.001_wp        ! maximum tolerated surface error
-
-      !--------------------------
-      ! Increment of energy
-      !--------------------------
-      ! global
-      DO ji = kideb, kiut
-         dq_i(ji,jl) = qt_i_fin(ji,jl) - qt_i_in(ji,jl) + qt_s_fin(ji,jl) - qt_s_in(ji,jl)
-      END DO
-      ! layer by layer
-      dq_i_layer(:,:) = q_i_layer_fin(:,:) - q_i_layer_in(:,:)
-
-      !----------------------------------------
-      ! Atmospheric heat flux, ice heat budget
-      !----------------------------------------
-      DO ji = kideb, kiut
-         ii = MOD( npb(ji) - 1 , jpi ) + 1
-         ij =    ( npb(ji) - 1 ) / jpi + 1
-         fatm     (ji,jl) = qnsr_ice_1d(ji) + ( 1._wp - i0(ji) ) * qsr_ice_1d(ji)
-         sum_fluxq(ji,jl) = fc_su(ji) - fc_bo_i(ji) + qsr_ice_1d(ji) * i0(ji) - fstroc(ii,ij,jl)
-      END DO
-
-      !--------------------
-      ! Conservation error
-      !--------------------
-      DO ji = kideb, kiut
-         cons_error(ji,jl) = ABS( dq_i(ji,jl) * r1_rdtice + sum_fluxq(ji,jl) )
-      END DO
-
-      numce  = 0
-      meance = 0._wp
-      DO ji = kideb, kiut
-         IF ( cons_error(ji,jl) .GT. max_cons_err ) THEN
-            numce = numce + 1
-            meance = meance + cons_error(ji,jl)
-         ENDIF
-      END DO
-      IF( numce > 0 )   meance = meance / numce
-
-      WRITE(numout,*) ' Maximum tolerated conservation error : ', max_cons_err
-      WRITE(numout,*) ' After lim_thd_dif, category : ', jl
-      WRITE(numout,*) ' Mean conservation error on big error points ', meance, numit
-      WRITE(numout,*) ' Number of points where there is a cons err gt than c.e. : ', numce, numit
-
-      !-------------------------------------------------------
-      ! Surface error due to imbalance between Fatm and Fcsu
-      !-------------------------------------------------------
-      numce  = 0
-      meance = 0._wp
-
-      DO ji = kideb, kiut
-         surf_error(ji,jl) = ABS ( fatm(ji,jl) - fc_su(ji) )
-         IF( ( t_su_b(ji) .LT. rtt ) .AND. ( surf_error(ji,jl) .GT. max_surf_err ) ) THEN
-            numce = numce + 1 
-            meance = meance + surf_error(ji,jl)
-         ENDIF
-      ENDDO
-      IF( numce > 0 )   meance = meance / numce
-
-      WRITE(numout,*) ' Maximum tolerated surface error : ', max_surf_err
-      WRITE(numout,*) ' After lim_thd_dif, category : ', jl
-      WRITE(numout,*) ' Mean surface error on big error points ', meance, numit
-      WRITE(numout,*) ' Number of points where there is a surf err gt than surf_err : ', numce, numit
-
-      WRITE(numout,*) ' fc_su      : ', fc_su(jiindex_1d)
-      WRITE(numout,*) ' fatm       : ', fatm(jiindex_1d,jl)
-      WRITE(numout,*) ' t_su       : ', t_su_b(jiindex_1d)
-
-      !---------------------------------------
-      ! Write ice state in case of big errors
-      !---------------------------------------
-      DO ji = kideb, kiut
-         IF ( ( ( t_su_b(ji) .LT. rtt ) .AND. ( surf_error(ji,jl) .GT. max_surf_err ) ) .OR. &
-            ( cons_error(ji,jl) .GT. max_cons_err  ) ) THEN
-            ii                 = MOD( npb(ji) - 1, jpi ) + 1
-            ij                 = ( npb(ji) - 1 ) / jpi + 1
-            !
-            WRITE(numout,*) ' alerte 1     '
-            WRITE(numout,*) ' Untolerated conservation / surface error after '
-            WRITE(numout,*) ' heat diffusion in the ice '
-            WRITE(numout,*) ' Category   : ', jl
-            WRITE(numout,*) ' ii , ij  : ', ii, ij
-            WRITE(numout,*) ' lat, lon   : ', gphit(ii,ij), glamt(ii,ij)
-            WRITE(numout,*) ' cons_error : ', cons_error(ji,jl)
-            WRITE(numout,*) ' surf_error : ', surf_error(ji,jl)
-            WRITE(numout,*) ' dq_i       : ', - dq_i(ji,jl) * r1_rdtice
-            WRITE(numout,*) ' Fdt        : ', sum_fluxq(ji,jl)
-            WRITE(numout,*)
-            !        WRITE(numout,*) ' qt_i_in   : ', qt_i_in(ji,jl)
-            !        WRITE(numout,*) ' qt_s_in   : ', qt_s_in(ji,jl)
-            !        WRITE(numout,*) ' qt_i_fin  : ', qt_i_fin(ji,jl)
-            !        WRITE(numout,*) ' qt_s_fin  : ', qt_s_fin(ji,jl)
-            !        WRITE(numout,*) ' qt        : ', qt_i_fin(ji,jl) + qt_s_fin(ji,jl)
-            WRITE(numout,*) ' ht_i       : ', ht_i_b(ji)
-            WRITE(numout,*) ' ht_s       : ', ht_s_b(ji)
-            WRITE(numout,*) ' t_su       : ', t_su_b(ji)
-            WRITE(numout,*) ' t_s        : ', t_s_b(ji,1)
-            WRITE(numout,*) ' t_i        : ', t_i_b(ji,1:nlay_i)
-            WRITE(numout,*) ' t_bo       : ', t_bo_b(ji)
-            WRITE(numout,*) ' q_i        : ', q_i_b(ji,1:nlay_i)
-            WRITE(numout,*) ' s_i        : ', s_i_b(ji,1:nlay_i)
-            WRITE(numout,*) ' tmelts     : ', rtt - tmut*s_i_b(ji,1:nlay_i)
-            WRITE(numout,*)
-            WRITE(numout,*) ' Fluxes '
-            WRITE(numout,*) ' ~~~~~~ '
-            WRITE(numout,*) ' fatm       : ', fatm(ji,jl)
-            WRITE(numout,*) ' fc_su      : ', fc_su    (ji)
-            WRITE(numout,*) ' fstr_inice : ', qsr_ice_1d(ji)*i0(ji)
-            WRITE(numout,*) ' fc_bo      : ', - fc_bo_i  (ji)
-            WRITE(numout,*) ' foc        : ', fbif_1d(ji)
-            WRITE(numout,*) ' fstroc     : ', fstroc   (ii,ij,jl)
-            WRITE(numout,*) ' i0         : ', i0(ji)
-            WRITE(numout,*) ' qsr_ice    : ', (1.0-i0(ji))*qsr_ice_1d(ji)
-            WRITE(numout,*) ' qns_ice    : ', qnsr_ice_1d(ji)
-            WRITE(numout,*) ' Conduction fluxes : '
-            WRITE(numout,*) ' fc_s      : ', fc_s(ji,0:nlay_s)
-            WRITE(numout,*) ' fc_i      : ', fc_i(ji,0:nlay_i)
-            WRITE(numout,*)
-            WRITE(numout,*) ' Layer by layer ... '
-            WRITE(numout,*) ' dq_snow : ', ( qt_s_fin(ji,jl) - qt_s_in(ji,jl) ) * r1_rdtice
-            WRITE(numout,*) ' dfc_snow  : ', fc_s(ji,1) - fc_s(ji,0)
-            DO jk = 1, nlay_i
-               WRITE(numout,*) ' layer  : ', jk
-               WRITE(numout,*) ' dq_ice : ', dq_i_layer(ji,jk) * r1_rdtice  
-               WRITE(numout,*) ' radab  : ', radab(ji,jk)
-               WRITE(numout,*) ' dfc_i  : ', fc_i(ji,jk) - fc_i(ji,jk-1)
-               WRITE(numout,*) ' tot f  : ', fc_i(ji,jk) - fc_i(ji,jk-1) - radab(ji,jk)
-            END DO
-
-         ENDIF
-         !
-      END DO
-      !
-   END SUBROUTINE lim_thd_con_dif
-
-
-   SUBROUTINE lim_thd_con_dh( kideb, kiut, jl )
-      !!-----------------------------------------------------------------------
-      !!                   ***  ROUTINE lim_thd_con_dh  *** 
-      !!                 
-      !! ** Purpose :   Test energy conservation after enthalpy redistr.
-      !!-----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kideb, kiut   ! bounds for the spatial loop
-      INTEGER, INTENT(in) ::   jl            ! category number
-      !
-      INTEGER  ::   ji                ! loop indices
-      INTEGER  ::   ii, ij, numce         ! local integers
-      REAL(wp) ::   meance, max_cons_err    !local scalar
-      !!---------------------------------------------------------------------
-
-      max_cons_err = 1._wp
-
-      !--------------------------
-      ! Increment of energy
-      !--------------------------
-      DO ji = kideb, kiut
-         dq_i(ji,jl) = qt_i_fin(ji,jl) - qt_i_in(ji,jl) + qt_s_fin(ji,jl) - qt_s_in(ji,jl)   ! global
-      END DO
-      dq_i_layer(:,:)    = q_i_layer_fin(:,:) - q_i_layer_in(:,:)                            ! layer by layer
-
-      !----------------------------------------
-      ! Atmospheric heat flux, ice heat budget
-      !----------------------------------------
-      DO ji = kideb, kiut
-         ii = MOD( npb(ji) - 1 , jpi ) + 1
-         ij =    ( npb(ji) - 1 ) / jpi + 1
-
-         fatm      (ji,jl) = qnsr_ice_1d(ji) + qsr_ice_1d(ji)                       ! total heat flux
-         sum_fluxq (ji,jl) = fatm(ji,jl) + fbif_1d(ji) - ftotal_fin(ji) - fstroc(ii,ij,jl) 
-         cons_error(ji,jl) = ABS( dq_i(ji,jl) * r1_rdtice + sum_fluxq(ji,jl) )
-      END DO
-
-      !--------------------
-      ! Conservation error
-      !--------------------
-      DO ji = kideb, kiut
-         cons_error(ji,jl) = ABS( dq_i(ji,jl) * r1_rdtice + sum_fluxq(ji,jl) )
-      END DO
-
-      numce = 0
-      meance = 0._wp
-      DO ji = kideb, kiut
-         IF( cons_error(ji,jl) .GT. max_cons_err ) THEN
-            numce = numce + 1
-            meance = meance + cons_error(ji,jl)
-         ENDIF
-      ENDDO
-      IF(numce > 0 ) meance = meance / numce
-
-      WRITE(numout,*) ' Error report - Category : ', jl
-      WRITE(numout,*) ' ~~~~~~~~~~~~ '
-      WRITE(numout,*) ' Maximum tolerated conservation error : ', max_cons_err
-      WRITE(numout,*) ' After lim_thd_ent, category : ', jl
-      WRITE(numout,*) ' Mean conservation error on big error points ', meance, numit
-      WRITE(numout,*) ' Number of points where there is a cons err gt than 0.1 W/m2 : ', numce, numit
-
-      !---------------------------------------
-      ! Write ice state in case of big errors
-      !---------------------------------------
-      DO ji = kideb, kiut
-         IF ( cons_error(ji,jl) .GT. max_cons_err  ) THEN
-            ii = MOD( npb(ji) - 1, jpi ) + 1
-            ij =    ( npb(ji) - 1 ) / jpi + 1
-            !
-            WRITE(numout,*) ' alerte 1 - category : ', jl
-            WRITE(numout,*) ' Untolerated conservation error after limthd_ent '
-            WRITE(numout,*) ' ii , ij  : ', ii, ij
-            WRITE(numout,*) ' lat, lon   : ', gphit(ii,ij), glamt(ii,ij)
-            WRITE(numout,*) ' * '
-            WRITE(numout,*) ' Ftotal     : ', sum_fluxq(ji,jl)
-            WRITE(numout,*) ' dq_t       : ', - dq_i(ji,jl) * r1_rdtice
-            WRITE(numout,*) ' dq_i       : ', - ( qt_i_fin(ji,jl) - qt_i_in(ji,jl) ) * r1_rdtice
-            WRITE(numout,*) ' dq_s       : ', - ( qt_s_fin(ji,jl) - qt_s_in(ji,jl) ) * r1_rdtice
-            WRITE(numout,*) ' cons_error : ', cons_error(ji,jl)
-            WRITE(numout,*) ' * '
-            WRITE(numout,*) ' Fluxes        --- : '
-            WRITE(numout,*) ' fatm       : ', fatm(ji,jl)
-            WRITE(numout,*) ' foce       : ', fbif_1d(ji)
-            WRITE(numout,*) ' fres       : ', ftotal_fin(ji)
-            WRITE(numout,*) ' fhbri      : ', fhbricat(ii,ij,jl)
-            WRITE(numout,*) ' * '
-            WRITE(numout,*) ' Heat contents --- : '
-            WRITE(numout,*) ' qt_s_in    : ', qt_s_in(ji,jl) * r1_rdtice
-            WRITE(numout,*) ' qt_i_in    : ', qt_i_in(ji,jl) * r1_rdtice
-            WRITE(numout,*) ' qt_in      : ', ( qt_i_in(ji,jl) + qt_s_in(ji,jl) ) * r1_rdtice
-            WRITE(numout,*) ' qt_s_fin   : ', qt_s_fin(ji,jl) * r1_rdtice
-            WRITE(numout,*) ' qt_i_fin   : ', qt_i_fin(ji,jl) * r1_rdtice
-            WRITE(numout,*) ' qt_fin     : ', ( qt_i_fin(ji,jl) + qt_s_fin(ji,jl) ) * r1_rdtice
-            WRITE(numout,*) ' * '
-            WRITE(numout,*) ' Ice variables --- : '
-            WRITE(numout,*) ' ht_i       : ', ht_i_b(ji)
-            WRITE(numout,*) ' ht_s       : ', ht_s_b(ji)
-            WRITE(numout,*) ' dh_s_tot  : ', dh_s_tot(ji)
-            WRITE(numout,*) ' dh_snowice: ', dh_snowice(ji)
-            WRITE(numout,*) ' dh_i_surf : ', dh_i_surf(ji)
-            WRITE(numout,*) ' dh_i_bott : ', dh_i_bott(ji)
-         ENDIF
-         !
-      END DO
-      !
-   END SUBROUTINE lim_thd_con_dh
-
-
-   SUBROUTINE lim_thd_enmelt( kideb, kiut )
-      !!-----------------------------------------------------------------------
-      !!                   ***  ROUTINE lim_thd_enmelt *** 
-      !!                 
-      !! ** Purpose :   Computes sea ice energy of melting q_i (J.m-3)
+      !! ** Purpose :   Computes sea ice temperature (Kelvin) from enthalpy
       !!
       !! ** Method  :   Formula (Bitz and Lipscomb, 1999)
@@ -784,23 +529,24 @@
       !!
       INTEGER  ::   ji, jk   ! dummy loop indices
-      REAL(wp) ::   ztmelts  ! local scalar 
+      REAL(wp) ::   ztmelts, zaaa, zbbb, zccc, zdiscrim  ! local scalar 
       !!-------------------------------------------------------------------
-      !
-      DO jk = 1, nlay_i             ! Sea ice energy of melting
+      ! Recover ice temperature
+      DO jk = 1, nlay_i
          DO ji = kideb, kiut
-            ztmelts      =  - tmut  * s_i_b(ji,jk) + rtt 
-            q_i_b(ji,jk) =    rhoic * ( cpic * ( ztmelts - t_i_b(ji,jk) )                                 &
-               &                      + lfus * ( 1.0 - (ztmelts-rtt) / MIN( t_i_b(ji,jk)-rtt, -epsi10 ) )   &
-               &                      - rcp  * ( ztmelts-rtt  )  ) 
-         END DO
-      END DO
-      DO jk = 1, nlay_s             ! Snow energy of melting
-         DO ji = kideb, kiut
-            q_s_b(ji,jk) = rhosn * ( cpic * ( rtt - t_s_b(ji,jk) ) + lfus )
-         END DO
-      END DO
-      !
-   END SUBROUTINE lim_thd_enmelt
-
+            ztmelts       =  -tmut * s_i_1d(ji,jk) + rtt
+            ! Conversion q(S,T) -> T (second order equation)
+            zaaa          =  cpic
+            zbbb          =  ( rcp - cpic ) * ( ztmelts - rtt ) + q_i_1d(ji,jk) / rhoic - lfus
+            zccc          =  lfus * ( ztmelts - rtt )
+            zdiscrim      =  SQRT( MAX( zbbb * zbbb - 4._wp * zaaa * zccc, 0._wp ) )
+            t_i_1d(ji,jk) =  rtt - ( zbbb + zdiscrim ) / ( 2._wp * zaaa )
+            
+            ! mask temperature
+            rswitch       =  1._wp - MAX( 0._wp , SIGN( 1._wp , - ht_i_1d(ji) ) ) 
+            t_i_1d(ji,jk) =  rswitch * t_i_1d(ji,jk) + ( 1._wp - rswitch ) * rtt
+         END DO 
+      END DO 
+
+   END SUBROUTINE lim_thd_temp
 
    SUBROUTINE lim_thd_init
@@ -818,7 +564,5 @@
       INTEGER  ::   ios                 ! Local integer output status for namelist read
       NAMELIST/namicethd/ hmelt , hiccrit, fraz_swi, maxfrazb, vfrazb, Cfrazb,   &
-         &                hicmin, hiclim,                                        &
-         &                sbeta  , parlat, hakspl, hibspl, exld,                 &
-         &                hakdif, hnzst  , thth  , parsub, alphs, betas,         & 
+         &                hiclim, hnzst, parsub, betas,                          & 
          &                kappa_i, nconv_i_thd, maxer_i_thd, thcon_i_swi
       !!-------------------------------------------------------------------
@@ -837,5 +581,7 @@
       READ  ( numnam_ice_cfg, namicethd, IOSTAT = ios, ERR = 902 )
 902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicethd in configuration namelist', lwp )
-      WRITE ( numoni, namicethd )
+      IF(lwm) WRITE ( numoni, namicethd )
+
+      IF( lk_cpl .AND. parsub /= 0.0 )   CALL ctl_stop( 'In coupled mode, use parsub = 0. or send dqla' )
       !
       IF(lwp) THEN                          ! control print
@@ -843,22 +589,13 @@
          WRITE(numout,*)'   Namelist of ice parameters for ice thermodynamic computation '
          WRITE(numout,*)'      maximum melting at the bottom                           hmelt        = ', hmelt
-         WRITE(numout,*)'      ice thick. for lateral accretion in NH (SH)             hiccrit(1/2) = ', hiccrit
+         WRITE(numout,*)'      ice thick. for lateral accretion                        hiccrit      = ', hiccrit
          WRITE(numout,*)'      Frazil ice thickness as a function of wind or not       fraz_swi     = ', fraz_swi
          WRITE(numout,*)'      Maximum proportion of frazil ice collecting at bottom   maxfrazb     = ', maxfrazb
          WRITE(numout,*)'      Thresold relative drift speed for collection of frazil  vfrazb       = ', vfrazb
          WRITE(numout,*)'      Squeezing coefficient for collection of frazil          Cfrazb       = ', Cfrazb
-         WRITE(numout,*)'      ice thick. corr. to max. energy stored in brine pocket  hicmin       = ', hicmin  
          WRITE(numout,*)'      minimum ice thickness                                   hiclim       = ', hiclim 
          WRITE(numout,*)'      numerical carac. of the scheme for diffusion in ice '
-         WRITE(numout,*)'      Cranck-Nicholson (=0.5), implicit (=1), explicit (=0)   sbeta        = ', sbeta
-         WRITE(numout,*)'      percentage of energy used for lateral ablation          parlat       = ', parlat
-         WRITE(numout,*)'      slope of distr. for Hakkinen-Mellor lateral melting     hakspl       = ', hakspl  
-         WRITE(numout,*)'      slope of distribution for Hibler lateral melting        hibspl       = ', hibspl
-         WRITE(numout,*)'      exponent for leads-closure rate                         exld         = ', exld
-         WRITE(numout,*)'      coefficient for diffusions of ice and snow              hakdif       = ', hakdif
-         WRITE(numout,*)'      threshold thick. for comp. of eq. thermal conductivity  zhth         = ', thth 
          WRITE(numout,*)'      thickness of the surf. layer in temp. computation       hnzst        = ', hnzst
          WRITE(numout,*)'      switch for snow sublimation  (=1) or not (=0)           parsub       = ', parsub  
-         WRITE(numout,*)'      coefficient for snow density when snow ice formation    alphs        = ', alphs
          WRITE(numout,*)'      coefficient for ice-lead partition of snowfall          betas        = ', betas
          WRITE(numout,*)'      extinction radiation parameter in sea ice (1.0)         kappa_i      = ', kappa_i
@@ -866,8 +603,6 @@
          WRITE(numout,*)'      maximal err. on T for heat diffusion computation        maxer_i_thd  = ', maxer_i_thd
          WRITE(numout,*)'      switch for comp. of thermal conductivity in the ice     thcon_i_swi  = ', thcon_i_swi
+         WRITE(numout,*)'      check heat conservation in the ice/snow                 con_i        = ', con_i
       ENDIF
-      !
-      rcdsn = hakdif * rcdsn 
-      rcdic = hakdif * rcdic
       !
    END SUBROUTINE lim_thd_init
