Index: NEMO/branches/UKMO/NEMO_4.0_mirror/src/ICE/icethd.F90
===================================================================
--- NEMO/branches/UKMO/NEMO_4.0_mirror/src/ICE/icethd.F90	(revision 10888)
+++ NEMO/branches/UKMO/NEMO_4.0_mirror/src/ICE/icethd.F90	(revision 11081)
@@ -102,6 +102,4 @@
       ENDIF
       
-      CALL ice_var_glo2eqv
-
       !---------------------------------------------!
       ! computation of friction velocity at T points
@@ -162,6 +160,7 @@
             qlead(ji,jj) = MIN( 0._wp , zqld - ( qsb_ice_bot(ji,jj) * at_i(ji,jj) * rdt_ice ) - zqfr )
 
-            ! If there is ice and leads are warming, then transfer energy from the lead budget and use it for bottom melting 
-            IF( zqld > 0._wp ) THEN
+            ! If there is ice and leads are warming => transfer energy from the lead budget and use it for bottom melting 
+            ! If the grid cell is fully covered by ice (no leads) => transfer energy from the lead budget to the ice bottom budget
+            IF( ( zqld >= 0._wp .AND. at_i(ji,jj) > 0._wp ) .OR. at_i(ji,jj) >= (1._wp - epsi10) ) THEN
                fhld (ji,jj) = rswitch * zqld * r1_rdtice / MAX( at_i(ji,jj), epsi10 ) ! divided by at_i since this is (re)multiplied by a_i in icethd_dh.F90
                qlead(ji,jj) = 0._wp
@@ -178,7 +177,6 @@
       ! In case we bypass open-water ice formation
       IF( .NOT. ln_icedO )  qlead(:,:) = 0._wp
-      ! In case we bypass growing/melting from top and bottom: we suppose ice is impermeable => ocean is isolated from atmosphere
+      ! In case we bypass growing/melting from top and bottom
       IF( .NOT. ln_icedH ) THEN
-         qt_atm_oi  (:,:) = ( 1._wp - at_i_b(:,:) ) * ( qns_oce(:,:) + qsr_oce(:,:) ) + qemp_oce(:,:)
          qsb_ice_bot(:,:) = 0._wp
          fhld       (:,:) = 0._wp
@@ -221,36 +219,32 @@
             dh_i_sub  (1:npti) = 0._wp ; dh_i_bog(1:npti) = 0._wp
             dh_snowice(1:npti) = 0._wp ; dh_s_mlt(1:npti) = 0._wp
-            !
-            IF( ln_icedH ) THEN                                     ! --- growing/melting --- !
-                              CALL ice_thd_zdf                             ! Ice/Snow Temperature profile
-                              CALL ice_thd_dh                              ! Ice/Snow thickness   
-                              CALL ice_thd_pnd                             ! Melt ponds formation
-                              CALL ice_thd_ent( e_i_1d(1:npti,:) )         ! Ice enthalpy remapping
+            !                                      
+                              CALL ice_thd_zdf                      ! --- Ice-Snow temperature --- !
+            !
+            IF( ln_icedH ) THEN                                     ! --- Growing/Melting --- !
+                              CALL ice_thd_dh                           ! Ice-Snow thickness   
+                              CALL ice_thd_pnd                          ! Melt ponds formation
+                              CALL ice_thd_ent( e_i_1d(1:npti,:) )      ! Ice enthalpy remapping
             ENDIF
-            !
                               CALL ice_thd_sal( ln_icedS )          ! --- Ice salinity --- !    
             !
-                              CALL ice_thd_temp                     ! --- temperature update --- !
+                              CALL ice_thd_temp                     ! --- Temperature update --- !
             !
             IF( ln_icedH .AND. ln_virtual_itd ) &
-               &              CALL ice_thd_mono                     ! --- extra lateral melting if virtual_itd --- !
-            !
-            IF( ln_icedA )    CALL ice_thd_da                       ! --- lateral melting --- !
+               &              CALL ice_thd_mono                     ! --- Extra lateral melting if virtual_itd --- !
+            !
+            IF( ln_icedA )    CALL ice_thd_da                       ! --- Lateral melting --- !
             !
                               CALL ice_thd_1d2d( jl, 2 )            ! --- Change units of e_i, e_s from J/m3 to J/m2 --- !
             !                                                       ! --- & Move to 2D arrays --- !
-            !
          ENDIF
          !
       END DO
-
+      !
       IF( ln_icediachk )   CALL ice_cons_hsm(1, 'icethd', rdiag_v, rdiag_s, rdiag_t, rdiag_fv, rdiag_fs, rdiag_ft)
-      !
-                           CALL ice_var_zapsmall           ! --- remove very small ice concentration (<1e-10) --- !
-      !                                                    !     & make sure at_i=SUM(a_i) & ato_i=1 where at_i=0
       !                   
-      IF( jpl > 1      )   CALL ice_itd_rem( kt )          ! --- Transport ice between thickness categories --- !
-      !
-      IF( ln_icedO     )   CALL ice_thd_do                 ! --- frazil ice growing in leads --- !
+      IF( jpl > 1  )          CALL ice_itd_rem( kt )                ! --- Transport ice between thickness categories --- !
+      !
+      IF( ln_icedO )          CALL ice_thd_do                       ! --- Frazil ice growth in leads --- !
       !
       ! controls
