Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limitd_th.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limitd_th.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limitd_th.F90	(revision 5357)
@@ -91,11 +91,11 @@
       !!------------------------------------------------------------------
 
-      CALL wrk_alloc( jpi,jpj, zremap_flag )    ! integer
-      CALL wrk_alloc( jpi,jpj,jpl-1, zdonor )   ! integer
+      CALL wrk_alloc( jpi,jpj, zremap_flag )
+      CALL wrk_alloc( jpi,jpj,jpl-1, zdonor )
       CALL wrk_alloc( jpi,jpj,jpl, zdhice, g0, g1, hL, hR, zht_i_b, dummy_es )
       CALL wrk_alloc( jpi,jpj,jpl-1, zdaice, zdvice )   
       CALL wrk_alloc( jpi,jpj,jpl+1, zhbnew, kkstart = 0 )   
       CALL wrk_alloc( (jpi+1)*(jpj+1), zvetamin, zvetamax )   
-      CALL wrk_alloc( (jpi+1)*(jpj+1), nind_i, nind_j )   ! integer 
+      CALL wrk_alloc( (jpi+1)*(jpj+1), nind_i, nind_j ) 
       CALL wrk_alloc( jpi,jpj, zhb0,zhb1,vt_i_init,vt_i_final,vt_s_init,vt_s_final,et_i_init,et_i_final,et_s_init,et_s_final )
 
@@ -128,7 +128,7 @@
                rswitch           = MAX( 0.0, SIGN( 1.0, a_i(ji,jj,jl) - epsi10 ) )     !0 if no ice and 1 if yes
                ht_i(ji,jj,jl)    = v_i(ji,jj,jl) / MAX( a_i(ji,jj,jl), epsi10 ) * rswitch
-               rswitch           = MAX( 0.0, SIGN( 1.0, a_i_b(ji,jj,jl) - epsi10) )    !0 if no ice and 1 if yes
+               rswitch           = MAX( 0.0, SIGN( 1.0, a_i_b(ji,jj,jl) - epsi10) )
                zht_i_b(ji,jj,jl) = v_i_b(ji,jj,jl) / MAX( a_i_b(ji,jj,jl), epsi10 ) * rswitch
-               zdhice(ji,jj,jl) = ht_i(ji,jj,jl) - zht_i_b(ji,jj,jl) 
+               IF( a_i(ji,jj,jl) > epsi10 )   zdhice(ji,jj,jl) = ht_i(ji,jj,jl) - zht_i_b(ji,jj,jl) ! clem: useless IF statement? 
             END DO
          END DO
@@ -172,11 +172,11 @@
             !
             zhbnew(ii,ij,jl) = hi_max(jl)
-            IF ( a_i_b(ii,ij,jl) > epsi10 .AND. a_i_b(ii,ij,jl+1) > epsi10 ) THEN
+            IF    ( a_i_b(ii,ij,jl) > epsi10 .AND. a_i_b(ii,ij,jl+1) > epsi10 ) THEN
                !interpolate between adjacent category growth rates
                zslope           = ( zdhice(ii,ij,jl+1) - zdhice(ii,ij,jl) ) / ( zht_i_b(ii,ij,jl+1) - zht_i_b(ii,ij,jl) )
                zhbnew(ii,ij,jl) = hi_max(jl) + zdhice(ii,ij,jl) + zslope * ( hi_max(jl) - zht_i_b(ii,ij,jl) )
-            ELSEIF ( a_i_b(ii,ij,jl) > epsi10) THEN
+            ELSEIF( a_i_b(ii,ij,jl) > epsi10) THEN
                zhbnew(ii,ij,jl) = hi_max(jl) + zdhice(ii,ij,jl)
-            ELSEIF ( a_i_b(ii,ij,jl+1) > epsi10) THEN
+            ELSEIF( a_i_b(ii,ij,jl+1) > epsi10) THEN
                zhbnew(ii,ij,jl) = hi_max(jl) + zdhice(ii,ij,jl+1)
             ENDIF
@@ -187,13 +187,20 @@
             ii = nind_i(ji)
             ij = nind_j(ji)
-            IF( a_i(ii,ij,jl) > epsi10 .AND. ht_i(ii,ij,jl) >= zhbnew(ii,ij,jl) ) THEN
+
+            ! clem: we do not want ht_i to be too close to either HR or HL otherwise a division by nearly 0 is possible 
+            ! in lim_itd_fitline in the case (HR-HL) = 3(Hice - HL) or = 3(HR - Hice)
+            IF    ( a_i(ii,ij,jl  ) > epsi10 .AND. ht_i(ii,ij,jl  ) > ( zhbnew(ii,ij,jl) - epsi10 ) ) THEN
                zremap_flag(ii,ij) = 0
-            ELSEIF( a_i(ii,ij,jl+1) > epsi10 .AND. ht_i(ii,ij,jl+1) <= zhbnew(ii,ij,jl) ) THEN
+            ELSEIF( a_i(ii,ij,jl+1) > epsi10 .AND. ht_i(ii,ij,jl+1) < ( zhbnew(ii,ij,jl) + epsi10 ) ) THEN
                zremap_flag(ii,ij) = 0
             ENDIF
 
             !- 4.3 Check that each zhbnew does not exceed maximal values hi_max  
+            IF( zhbnew(ii,ij,jl) < hi_max(jl-1) ) zremap_flag(ii,ij) = 0
             IF( zhbnew(ii,ij,jl) > hi_max(jl+1) ) zremap_flag(ii,ij) = 0
-            IF( zhbnew(ii,ij,jl) < hi_max(jl-1) ) zremap_flag(ii,ij) = 0
+            ! clem bug: why is not the following instead?
+            !!IF( zhbnew(ii,ij,jl) < hi_max(jl-1) ) zremap_flag(ii,ij) = 0
+            !!IF( zhbnew(ii,ij,jl) > hi_max(jl  ) ) zremap_flag(ii,ij) = 0
+ 
          END DO
 
@@ -219,15 +226,20 @@
       DO jj = 1, jpj
          DO ji = 1, jpi
-            zhb0(ji,jj) = hi_max(0) ! 0eme
-            zhb1(ji,jj) = hi_max(1) ! 1er
-
-            zhbnew(ji,jj,klbnd-1) = 0._wp
+            zhb0(ji,jj) = hi_max(0)
+            zhb1(ji,jj) = hi_max(1)
 
             IF( a_i(ji,jj,kubnd) > epsi10 ) THEN
                zhbnew(ji,jj,kubnd) = MAX( hi_max(kubnd-1), 3._wp * ht_i(ji,jj,kubnd) - 2._wp * zhbnew(ji,jj,kubnd-1) )
             ELSE
-               zhbnew(ji,jj,kubnd) = hi_max(kubnd)  
-               !!? clem bug: since hi_max(jpl)=99, this limit is very high 
-               !!? but I think it is erased in fitline subroutine 
+!clem bug               zhbnew(ji,jj,kubnd) = hi_max(kubnd)  
+               zhbnew(ji,jj,kubnd) = hi_max(kubnd-1) ! not used anyway
+            ENDIF
+
+            ! clem: we do not want ht_i_b to be too close to either HR or HL otherwise a division by nearly 0 is possible 
+            ! in lim_itd_fitline in the case (HR-HL) = 3(Hice - HL) or = 3(HR - Hice)
+            IF    ( zht_i_b(ji,jj,klbnd) < ( zhb0(ji,jj) + epsi10 ) )  THEN
+               zremap_flag(ji,jj) = 0
+            ELSEIF( zht_i_b(ji,jj,klbnd) > ( zhb1(ji,jj) - epsi10 ) )  THEN
+               zremap_flag(ji,jj) = 0
             ENDIF
 
@@ -248,19 +260,19 @@
 
          IF( a_i(ii,ij,klbnd) > epsi10 ) THEN
+
             zdh0 = zdhice(ii,ij,klbnd) !decrease of ice thickness in the lower category
-            IF( zdh0 < 0.0 ) THEN !remove area from category 1
+
+            IF( zdh0 < 0.0 ) THEN      !remove area from category 1
                zdh0 = MIN( -zdh0, hi_max(klbnd) )
-
                !Integrate g(1) from 0 to dh0 to estimate area melted
                zetamax = MIN( zdh0, hR(ii,ij,klbnd) ) - hL(ii,ij,klbnd)
+
                IF( zetamax > 0.0 ) THEN
-                  zx1  = zetamax
-                  zx2  = 0.5 * zetamax * zetamax 
-                  zda0 = g1(ii,ij,klbnd) * zx2 + g0(ii,ij,klbnd) * zx1 !ice area removed
-                  ! Constrain new thickness <= ht_i
-                  zdamax = a_i(ii,ij,klbnd) * (1.0 - ht_i(ii,ij,klbnd) / zht_i_b(ii,ij,klbnd) ) ! zdamax > 0
-                  !ice area lost due to melting of thin ice
-                  zda0   = MIN( zda0, zdamax )
-
+                  zx1    = zetamax
+                  zx2    = 0.5 * zetamax * zetamax 
+                  zda0   = g1(ii,ij,klbnd) * zx2 + g0(ii,ij,klbnd) * zx1                        ! ice area removed
+                  zdamax = a_i(ii,ij,klbnd) * (1.0 - ht_i(ii,ij,klbnd) / zht_i_b(ii,ij,klbnd) ) ! Constrain new thickness <= ht_i                
+                  zda0   = MIN( zda0, zdamax )                                                  ! ice area lost due to melting 
+                                                                                                !     of thin ice (zdamax > 0)
                   ! Remove area, conserving volume
                   ht_i(ii,ij,klbnd) = ht_i(ii,ij,klbnd) * a_i(ii,ij,klbnd) / ( a_i(ii,ij,klbnd) - zda0 )
@@ -269,11 +281,10 @@
                ENDIF
 
-            ELSE ! if ice accretion ! a_i > epsi10; zdh0 > 0
+            ELSE ! if ice accretion zdh0 > 0
+               ! zhbnew was 0, and is shifted to the right to account for thin ice growth in openwater (F0 = f1)
                zhbnew(ii,ij,klbnd-1) = MIN( zdh0, hi_max(klbnd) ) 
-               ! zhbnew was 0, and is shifted to the right to account for thin ice
-               ! growth in openwater (F0 = f1)
-            ENDIF ! zdh0 
-
-         ENDIF ! a_i > epsi10
+            ENDIF
+
+         ENDIF
 
       END DO
@@ -303,12 +314,10 @@
 
             IF (zhbnew(ii,ij,jl) > hi_max(jl)) THEN ! transfer from jl to jl+1
-
                ! left and right integration limits in eta space
                zvetamin(ji) = MAX( hi_max(jl), hL(ii,ij,jl) ) - hL(ii,ij,jl)
-               zvetamax(ji) = MIN (zhbnew(ii,ij,jl), hR(ii,ij,jl) ) - hL(ii,ij,jl)
+               zvetamax(ji) = MIN( zhbnew(ii,ij,jl), hR(ii,ij,jl) ) - hL(ii,ij,jl)
                zdonor(ii,ij,jl) = jl
 
-            ELSE  ! zhbnew(jl) <= hi_max(jl) ; transfer from jl+1 to jl
-
+            ELSE                                    ! zhbnew(jl) <= hi_max(jl) ; transfer from jl+1 to jl
                ! left and right integration limits in eta space
                zvetamin(ji) = 0.0
@@ -316,5 +325,5 @@
                zdonor(ii,ij,jl) = jl + 1
 
-            ENDIF  ! zhbnew(jl) > hi_max(jl)
+            ENDIF
 
             zetamax = MAX( zvetamax(ji), zvetamin(ji) ) ! no transfer if etamax < etamin
@@ -333,5 +342,5 @@
 
          END DO
-      END DO ! jl klbnd -> kubnd - 1
+      END DO
 
       !!----------------------------------------------------------------------------------------------
@@ -375,11 +384,11 @@
       ENDIF
 
-      CALL wrk_dealloc( jpi,jpj, zremap_flag )    ! integer
-      CALL wrk_dealloc( jpi,jpj,jpl-1, zdonor )   ! integer
+      CALL wrk_dealloc( jpi,jpj, zremap_flag )
+      CALL wrk_dealloc( jpi,jpj,jpl-1, zdonor )
       CALL wrk_dealloc( jpi,jpj,jpl, zdhice, g0, g1, hL, hR, zht_i_b, dummy_es )
       CALL wrk_dealloc( jpi,jpj,jpl-1, zdaice, zdvice )   
       CALL wrk_dealloc( jpi,jpj,jpl+1, zhbnew, kkstart = 0 )   
       CALL wrk_dealloc( (jpi+1)*(jpj+1), zvetamin, zvetamax )   
-      CALL wrk_dealloc( (jpi+1)*(jpj+1), nind_i, nind_j )   ! integer 
+      CALL wrk_dealloc( (jpi+1)*(jpj+1), nind_i, nind_j ) 
       CALL wrk_dealloc( jpi,jpj, zhb0,zhb1,vt_i_init,vt_i_final,vt_s_init,vt_s_final,et_i_init,et_i_final,et_s_init,et_s_final )
 
@@ -406,5 +415,5 @@
       INTEGER , DIMENSION(jpi,jpj), INTENT(in   ) ::   zremap_flag  !
       !
-      INTEGER ::   ji,jj           ! horizontal indices
+      INTEGER  ::   ji,jj        ! horizontal indices
       REAL(wp) ::   zh13         ! HbL + 1/3 * (HbR - HbL)
       REAL(wp) ::   zh23         ! HbL + 2/3 * (HbR - HbL)
@@ -413,18 +422,15 @@
       !!------------------------------------------------------------------
       !
-      !
       DO jj = 1, jpj
          DO ji = 1, jpi
             !
             IF( zremap_flag(ji,jj) == 1 .AND. a_i(ji,jj,num_cat) > epsi10   &
-               &                        .AND. hice(ji,jj)        > 0._wp     ) THEN
+               &                        .AND. hice(ji,jj)        > 0._wp )  THEN
 
                ! Initialize hL and hR
-
                hL(ji,jj) = HbL(ji,jj)
                hR(ji,jj) = HbR(ji,jj)
 
                ! Change hL or hR if hice falls outside central third of range
-
                zh13 = 1.0 / 3.0 * ( 2.0 * hL(ji,jj) + hR(ji,jj) )
                zh23 = 1.0 / 3.0 * ( hL(ji,jj) + 2.0 * hR(ji,jj) )
@@ -435,5 +441,4 @@
 
                ! Compute coefficients of g(eta) = g0 + g1*eta
-
                zdhr = 1._wp / (hR(ji,jj) - hL(ji,jj))
                zwk1 = 6._wp * a_i(ji,jj,num_cat) * zdhr
@@ -442,10 +447,10 @@
                g1(ji,jj) = 2._wp * zdhr * zwk1 * ( zwk2 - 0.5 )
                !
-            ELSE                   ! remap_flag = .false. or a_i < epsi10 
+            ELSE  ! remap_flag = .false. or a_i < epsi10 
                hL(ji,jj) = 0._wp
                hR(ji,jj) = 0._wp
                g0(ji,jj) = 0._wp
                g1(ji,jj) = 0._wp
-            ENDIF                  ! a_i > epsi10
+            ENDIF
             !
          END DO
@@ -471,5 +476,5 @@
 
       INTEGER ::   ji, jj, jl, jl2, jl1, jk   ! dummy loop indices
-      INTEGER ::   ii, ij          ! indices when changing from 2D-1D is done
+      INTEGER ::   ii, ij                     ! indices when changing from 2D-1D is done
 
       REAL(wp), POINTER, DIMENSION(:,:,:) ::   zaTsfn
@@ -484,15 +489,10 @@
       INTEGER, POINTER, DIMENSION(:) ::   nind_i, nind_j   ! compressed indices for i/j directions
 
-      INTEGER ::   nbrem             ! number of cells with ice to transfer
-
-      LOGICAL ::   zdaice_negative         ! true if daice < -puny
-      LOGICAL ::   zdvice_negative         ! true if dvice < -puny
-      LOGICAL ::   zdaice_greater_aicen    ! true if daice > aicen
-      LOGICAL ::   zdvice_greater_vicen    ! true if dvice > vicen
+      INTEGER  ::   nbrem             ! number of cells with ice to transfer
       !!------------------------------------------------------------------
 
       CALL wrk_alloc( jpi,jpj,jpl, zaTsfn )
       CALL wrk_alloc( jpi,jpj, zworka )
-      CALL wrk_alloc( (jpi+1)*(jpj+1), nind_i, nind_j )   ! integer
+      CALL wrk_alloc( (jpi+1)*(jpj+1), nind_i, nind_j )
 
       !----------------------------------------------------------------------------------------------
@@ -504,85 +504,6 @@
       END DO
 
-!clem: I think the following is wrong (if enabled, it creates negative concentration/volume around -epsi10)
-!      !----------------------------------------------------------------------------------------------
-!      ! 2) Check for daice or dvice out of range, allowing for roundoff error
-!      !----------------------------------------------------------------------------------------------
-!      ! Note: zdaice < 0 or zdvice < 0 usually happens when category jl
-!      ! has a small area, with h(n) very close to a boundary.  Then
-!      ! the coefficients of g(h) are large, and the computed daice and
-!      ! dvice can be in error. If this happens, it is best to transfer
-!      ! either the entire category or nothing at all, depending on which
-!      ! side of the boundary hice(n) lies.
-!      !-----------------------------------------------------------------
-!      DO jl = klbnd, kubnd-1
-!
-!         zdaice_negative = .false.
-!         zdvice_negative = .false.
-!         zdaice_greater_aicen = .false.
-!         zdvice_greater_vicen = .false.
-!
-!         DO jj = 1, jpj
-!            DO ji = 1, jpi
-!
-!               IF (zdonor(ji,jj,jl) > 0) THEN
-!                  jl1 = zdonor(ji,jj,jl)
-!
-!                  IF (zdaice(ji,jj,jl) < 0.0) THEN
-!                     IF (zdaice(ji,jj,jl) > -epsi10) THEN
-!                        IF ( ( jl1 == jl   .AND. ht_i(ji,jj,jl1) >  hi_max(jl) ) .OR.  &
-!                             ( jl1 == jl+1 .AND. ht_i(ji,jj,jl1) <= hi_max(jl) ) ) THEN
-!                           zdaice(ji,jj,jl) = a_i(ji,jj,jl1)  ! shift entire category
-!                           zdvice(ji,jj,jl) = v_i(ji,jj,jl1)
-!                        ELSE
-!                           zdaice(ji,jj,jl) = 0.0 ! shift no ice
-!                           zdvice(ji,jj,jl) = 0.0
-!                        ENDIF
-!                     ELSE
-!                        zdaice_negative = .true.
-!                     ENDIF
-!                  ENDIF
-!
-!                  IF (zdvice(ji,jj,jl) < 0.0) THEN
-!                     IF (zdvice(ji,jj,jl) > -epsi10 ) THEN
-!                        IF ( ( jl1 == jl   .AND. ht_i(ji,jj,jl1) >  hi_max(jl) ) .OR.  &
-!                             ( jl1 == jl+1 .AND. ht_i(ji,jj,jl1) <= hi_max(jl) ) ) THEN
-!                           zdaice(ji,jj,jl) = a_i(ji,jj,jl1) ! shift entire category
-!                           zdvice(ji,jj,jl) = v_i(ji,jj,jl1) 
-!                        ELSE
-!                           zdaice(ji,jj,jl) = 0.0    ! shift no ice
-!                           zdvice(ji,jj,jl) = 0.0
-!                        ENDIF
-!                    ELSE
-!                       zdvice_negative = .true.
-!                    ENDIF
-!                 ENDIF
-!
-!                  ! If daice is close to aicen, set daice = aicen.
-!                  IF (zdaice(ji,jj,jl) > a_i(ji,jj,jl1) - epsi10 ) THEN
-!                     IF (zdaice(ji,jj,jl) < a_i(ji,jj,jl1)+epsi10) THEN
-!                        zdaice(ji,jj,jl) = a_i(ji,jj,jl1)
-!                        zdvice(ji,jj,jl) = v_i(ji,jj,jl1) 
-!                    ELSE
-!                       zdaice_greater_aicen = .true.
-!                    ENDIF
-!                  ENDIF
-!
-!                  IF (zdvice(ji,jj,jl) > v_i(ji,jj,jl1)-epsi10) THEN
-!                     IF (zdvice(ji,jj,jl) < v_i(ji,jj,jl1)+epsi10) THEN
-!                        zdaice(ji,jj,jl) = a_i(ji,jj,jl1)
-!                        zdvice(ji,jj,jl) = v_i(ji,jj,jl1) 
-!                     ELSE
-!                        zdvice_greater_vicen = .true.
-!                     ENDIF
-!                  ENDIF
-!
-!               ENDIF               ! donor > 0
-!            END DO
-!         END DO
-!
-!      END DO
-!clem
       !-------------------------------------------------------------------------------
-      ! 3) Transfer volume and energy between categories
+      ! 2) Transfer volume and energy between categories
       !-------------------------------------------------------------------------------
 
@@ -604,6 +525,6 @@
 
             jl1 = zdonor(ii,ij,jl)
-            rswitch       = MAX( 0._wp , SIGN( 1._wp , v_i(ii,ij,jl1) - epsi20 ) )
-            zworka(ii,ij) = zdvice(ii,ij,jl) / MAX( v_i(ii,ij,jl1), epsi20 ) * rswitch
+            rswitch       = MAX( 0._wp , SIGN( 1._wp , v_i(ii,ij,jl1) - epsi10 ) )
+            zworka(ii,ij) = zdvice(ii,ij,jl) / MAX( v_i(ii,ij,jl1), epsi10 ) * rswitch
             IF( jl1 == jl) THEN   ;   jl2 = jl1+1
             ELSE                  ;   jl2 = jl 
@@ -613,5 +534,4 @@
             ! Ice areas
             !--------------
-
             a_i(ii,ij,jl1) = a_i(ii,ij,jl1) - zdaice(ii,ij,jl)
             a_i(ii,ij,jl2) = a_i(ii,ij,jl2) + zdaice(ii,ij,jl)
@@ -620,5 +540,4 @@
             ! Ice volumes
             !--------------
-
             v_i(ii,ij,jl1) = v_i(ii,ij,jl1) - zdvice(ii,ij,jl) 
             v_i(ii,ij,jl2) = v_i(ii,ij,jl2) + zdvice(ii,ij,jl)
@@ -627,5 +546,4 @@
             ! Snow volumes
             !--------------
-
             zdvsnow        = v_s(ii,ij,jl1) * zworka(ii,ij)
             v_s(ii,ij,jl1) = v_s(ii,ij,jl1) - zdvsnow
@@ -635,5 +553,4 @@
             ! Snow heat content  
             !--------------------
-
             zdesnow            = e_s(ii,ij,1,jl1) * zworka(ii,ij)
             e_s(ii,ij,1,jl1)   = e_s(ii,ij,1,jl1) - zdesnow
@@ -643,5 +560,4 @@
             ! Ice age 
             !--------------
-
             zdo_aice           = oa_i(ii,ij,jl1) * zdaice(ii,ij,jl)
             oa_i(ii,ij,jl1)    = oa_i(ii,ij,jl1) - zdo_aice
@@ -651,5 +567,4 @@
             ! Ice salinity
             !--------------
-
             zdsm_vice          = smv_i(ii,ij,jl1) * zworka(ii,ij)
             smv_i(ii,ij,jl1)   = smv_i(ii,ij,jl1) - zdsm_vice
@@ -659,5 +574,4 @@
             ! Surface temperature
             !---------------------
-
             zdaTsf             = t_su(ii,ij,jl1) * zdaice(ii,ij,jl)
             zaTsfn(ii,ij,jl1)  = zaTsfn(ii,ij,jl1) - zdaTsf
@@ -710,5 +624,5 @@
       CALL wrk_dealloc( jpi,jpj,jpl, zaTsfn )
       CALL wrk_dealloc( jpi,jpj, zworka )
-      CALL wrk_dealloc( (jpi+1)*(jpj+1), nind_i, nind_j )   ! integer
+      CALL wrk_dealloc( (jpi+1)*(jpj+1), nind_i, nind_j )
       !
    END SUBROUTINE lim_itd_shiftice
@@ -859,5 +773,5 @@
       ENDIF
       !
-      CALL wrk_dealloc( jpi,jpj,jpl, zdonor )   ! interger
+      CALL wrk_dealloc( jpi,jpj,jpl, zdonor )
       CALL wrk_dealloc( jpi,jpj,jpl, zdaice, zdvice )
       CALL wrk_dealloc( jpi,jpj, vt_i_init, vt_i_final, vt_s_init, vt_s_final )
Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90	(revision 5357)
@@ -94,5 +94,5 @@
       !!              - fr_i    : ice fraction
       !!              - tn_ice  : sea-ice surface temperature
-      !!              - alb_ice : sea-ice albedo (ln_cpl=T)
+      !!              - alb_ice : sea-ice albedo (only useful in coupled mode)
       !!
       !! References : Goosse, H. et al. 1996, Bul. Soc. Roy. Sc. Liege, 65, 87-90.
@@ -101,9 +101,8 @@
       !!              The ref should be Rousset et al., 2015
       !!---------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt                                   ! number of iteration
-      INTEGER  ::   ji, jj, jl, jk                                  ! dummy loop indices
-      REAL(wp) ::   zemp                                            ! local scalars
-      REAL(wp) ::   zf_mass                                         ! Heat flux associated with mass exchange ice->ocean (W.m-2)
-      REAL(wp) ::   zfcm1                                           ! New solar flux received by the ocean
+      INTEGER, INTENT(in) ::   kt                                  ! number of iteration
+      INTEGER  ::   ji, jj, jl, jk                                 ! dummy loop indices
+      REAL(wp) ::   zqmass                                         ! Heat flux associated with mass exchange ice->ocean (W.m-2)
+      REAL(wp) ::   zqsr                                           ! New solar flux received by the ocean
       !
       REAL(wp), POINTER, DIMENSION(:,:,:) ::   zalb_cs, zalb_os     ! 2D/3D workspace
@@ -126,24 +125,15 @@
             !      heat flux at the ocean surface      !
             !------------------------------------------!
-            ! Solar heat flux reaching the ocean = zfcm1 (W.m-2) 
+            ! Solar heat flux reaching the ocean = zqsr (W.m-2) 
             !---------------------------------------------------
-            IF( ln_cpl ) THEN 
-               !!! LIM2 version zqsr = qsr_tot(ji,jj) + ( fstric(ji,jj) - qsr_ice(ji,jj,1) ) * ( 1.0 - pfrld(ji,jj) )
-               zfcm1 = qsr_tot(ji,jj)
-               DO jl = 1, jpl
-                  zfcm1 = zfcm1 + ( ftr_ice(ji,jj,jl) - qsr_ice(ji,jj,jl) ) * a_i_b(ji,jj,jl)
-               END DO
-            ELSE
-               !!! LIM2 version zqsr = pfrld(ji,jj) * qsr(ji,jj)  + ( 1.  - pfrld(ji,jj) ) * fstric(ji,jj)
-               zfcm1   = pfrld(ji,jj) * qsr(ji,jj)
-               DO jl = 1, jpl
-                  zfcm1   = zfcm1 + a_i_b(ji,jj,jl) * ftr_ice(ji,jj,jl)
-               END DO
-            ENDIF
+            zqsr = qsr_tot(ji,jj)
+            DO jl = 1, jpl
+               zqsr = zqsr - a_i_b(ji,jj,jl) * (  qsr_ice(ji,jj,jl) - ftr_ice(ji,jj,jl) ) 
+            END DO
 
             ! Total heat flux reaching the ocean = hfx_out (W.m-2) 
             !---------------------------------------------------
-            zf_mass        = hfx_thd(ji,jj) + hfx_dyn(ji,jj) + hfx_res(ji,jj) ! heat flux from snow is 0 (T=0 degC)
-            hfx_out(ji,jj) = hfx_out(ji,jj) + zf_mass + zfcm1
+            zqmass         = hfx_thd(ji,jj) + hfx_dyn(ji,jj) + hfx_res(ji,jj) ! heat flux from snow is 0 (T=0 degC)
+            hfx_out(ji,jj) = hfx_out(ji,jj) + zqmass + zqsr
 
             ! Add the residual from heat diffusion equation (W.m-2)
@@ -153,6 +143,6 @@
             ! New qsr and qns used to compute the oceanic heat flux at the next time step
             !---------------------------------------------------
-            qsr(ji,jj) = zfcm1                                      
-            qns(ji,jj) = hfx_out(ji,jj) - zfcm1              
+            qsr(ji,jj) = zqsr                                      
+            qns(ji,jj) = hfx_out(ji,jj) - zqsr              
 
             !------------------------------------------!
@@ -167,15 +157,4 @@
             !                     Even if i see Ice melting as a FW and SALT flux
             !        
-            !  computing freshwater exchanges at the ice/ocean interface
-            IF( ln_cpl ) THEN 
-                zemp =   emp_tot(ji,jj)                                    &   ! net mass flux over grid cell
-                   &   - emp_ice(ji,jj) * ( 1._wp - pfrld(ji,jj) )         &   ! minus the mass flux intercepted by sea ice
-                   &   + sprecip(ji,jj) * ( pfrld(ji,jj) - pfrld(ji,jj)**rn_betas )   !
-            ELSE
-               zemp =   emp(ji,jj)     *           pfrld(ji,jj)            &   ! evaporation over oceanic fraction
-                  &   - tprecip(ji,jj) * ( 1._wp - pfrld(ji,jj) )          &   ! all precipitation reach the ocean
-                  &   + sprecip(ji,jj) * ( 1._wp - pfrld(ji,jj)**rn_betas )       ! except solid precip intercepted by sea-ice
-            ENDIF
-
             ! mass flux from ice/ocean
             wfx_ice(ji,jj) = wfx_bog(ji,jj) + wfx_bom(ji,jj) + wfx_sum(ji,jj) + wfx_sni(ji,jj)   &
@@ -184,5 +163,5 @@
             ! mass flux at the ocean/ice interface
             fmmflx(ji,jj) = - ( wfx_ice(ji,jj) + wfx_snw(ji,jj) ) * r1_rdtice  ! F/M mass flux save at least for biogeochemical model
-            emp(ji,jj)    = zemp - wfx_ice(ji,jj) - wfx_snw(ji,jj)             ! mass flux + F/M mass flux (always ice/ocean mass exchange)
+            emp(ji,jj)    = emp_oce(ji,jj) - wfx_ice(ji,jj) - wfx_snw(ji,jj)   ! mass flux + F/M mass flux (always ice/ocean mass exchange)
             
          END DO
@@ -213,18 +192,11 @@
       tn_ice(:,:,:) = t_su(:,:,:)           ! Ice surface temperature                      
 
-      !------------------------------------------------!
-      !    Snow/ice albedo (only if sent to coupler)   !
-      !------------------------------------------------!
-      IF( ln_cpl ) THEN          ! coupled case
-
-            CALL wrk_alloc( jpi, jpj, jpl, zalb_cs, zalb_os )
-
-            CALL albedo_ice( t_su, ht_i, ht_s, zalb_cs, zalb_os )  ! cloud-sky and overcast-sky ice albedos
-
-            alb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:)
-
-            CALL wrk_dealloc( jpi, jpj, jpl, zalb_cs, zalb_os )
-
-      ENDIF
+      !------------------------------------------------------------------------!
+      !    Snow/ice albedo (only if sent to coupler, useless in forced mode)   !
+      !------------------------------------------------------------------------!
+      CALL wrk_alloc( jpi, jpj, jpl, zalb_cs, zalb_os )    
+      CALL albedo_ice( t_su, ht_i, ht_s, zalb_cs, zalb_os )  ! cloud-sky and overcast-sky ice albedos
+      alb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:)
+      CALL wrk_dealloc( jpi, jpj, jpl, zalb_cs, zalb_os )
 
       ! conservation test
Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90	(revision 5357)
@@ -48,6 +48,6 @@
    PRIVATE
 
-   PUBLIC   lim_thd        ! called by limstp module
-   PUBLIC   lim_thd_init   ! called by sbc_lim_init
+   PUBLIC   lim_thd         ! called by limstp module
+   PUBLIC   lim_thd_init    ! called by sbc_lim_init
 
    !! * Substitutions
@@ -90,7 +90,5 @@
       REAL(wp), PARAMETER :: zch        = 0.0057_wp       ! heat transfer coefficient
       !
-      REAL(wp), POINTER, DIMENSION(:,:) ::  zqsr, zqns
       !!-------------------------------------------------------------------
-      CALL wrk_alloc( jpi,jpj, zqsr, zqns )
 
       IF( nn_timing == 1 )  CALL timing_start('limthd')
@@ -134,25 +132,4 @@
       ! 2) Partial computation of forcing for the thermodynamic sea ice model.      !
       !-----------------------------------------------------------------------------!
-
-      !--- Ocean solar and non solar fluxes to be used in zqld
-      IF ( .NOT. ln_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
-
       DO jj = 1, jpj
          DO ji = 1, jpi
@@ -165,21 +142,7 @@
             !           !  temperature and turbulent mixing (McPhee, 1992)
             !
-
             ! --- 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 ( ln_cpl ) THEN
-               zqld =  tmask(ji,jj,1) * rdt_ice *  &
-                  &    (   zqsr(ji,jj) * frq_m(ji,jj) + zqns(ji,jj)                     &   ! pfrld already included in coupled mode
-                  &    + ( pfrld(ji,jj)**rn_betas - pfrld(ji,jj) ) * sprecip(ji,jj) *   &   ! heat content of precip
-                  &      ( cpic * ( MIN( tatm_ice(ji,jj), rt0_snow ) - rt0 ) - lfus )   &
-                  &    + ( 1._wp - pfrld(ji,jj) ) * ( tprecip(ji,jj) - sprecip(ji,jj) ) * rcp * ( tatm_ice(ji,jj) - rt0 ) )
-            ELSE
-               zqld =  tmask(ji,jj,1) * rdt_ice *  &
-                  &      ( pfrld(ji,jj) * ( zqsr(ji,jj) * frq_m(ji,jj) + zqns(ji,jj) )   &
-                  &    + ( pfrld(ji,jj)**rn_betas - pfrld(ji,jj) ) * sprecip(ji,jj) *    &  ! heat content of precip
-                  &      ( cpic * ( MIN( tatm_ice(ji,jj), rt0_snow ) - rt0 ) - lfus )    &
-                  &    + ( 1._wp - pfrld(ji,jj) ) * ( tprecip(ji,jj) - sprecip(ji,jj) ) * rcp * ( tatm_ice(ji,jj) - rt0 ) )
-            ENDIF
+            zqld =  tmask(ji,jj,1) * rdt_ice *  &
+               &    ( pfrld(ji,jj) * qsr_oce(ji,jj) * frq_m(ji,jj) + pfrld(ji,jj) * qns_oce(ji,jj) + qemp_oce(ji,jj) )
 
             ! --- Energy needed to bring ocean surface layer until its freezing (<0, J.m-2) --- !
@@ -208,34 +171,17 @@
             ! Net heat flux on top of ice-ocean [W.m-2]
             ! -----------------------------------------
-            !     heat flux at the ocean surface + precip
-            !   + heat flux at the ice   surface 
-            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 ) - rt0 ) - lfus )  &
-               &    +   ( 1._wp - pfrld(ji,jj) ) * ( tprecip(ji,jj) - sprecip(ji,jj) ) * rcp * ( tatm_ice(ji,jj) - rt0 )          &
-               ! heat flux above the ice
-               &    +   SUM(    a_i_b(ji,jj,:)   * ( qns_ice(ji,jj,:) + qsr_ice(ji,jj,:) ) )
+            hfx_in(ji,jj) = qns_tot(ji,jj) + qsr_tot(ji,jj) 
 
             ! -----------------------------------------------------------------------------
-            ! Net heat flux that is retroceded to the ocean or taken from the ocean [W.m-2]
+            ! Net heat flux on top of the ocean after ice thermo (1st step) [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) * zqns(ji,jj)                                                                            &
-               ! latent heat of precip (note that precip is included in qns but not in qns_ice)
-               &    +      ( pfrld(ji,jj)**rn_betas - pfrld(ji,jj) ) * sprecip(ji,jj)       &
-               &         * ( cpic * ( MIN( tatm_ice(ji,jj), rt0_snow ) - rt0 ) - lfus )  &
-               &    +      ( 1._wp - pfrld(ji,jj) ) * ( tprecip(ji,jj) - sprecip(ji,jj) ) * rcp * ( tatm_ice(ji,jj) - rt0 )       &
-               ! 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)
-
+            hfx_out(ji,jj) =   pfrld(ji,jj) * qns_oce(ji,jj) + qemp_oce(ji,jj)  &  ! Non solar heat flux received by the ocean               
+               &             - qlead(ji,jj) * r1_rdtice                         &  ! heat flux taken from the ocean where there is open water ice formation
+               &             - at_i(ji,jj) * fhtur(ji,jj)                       &  ! heat flux taken by turbulence
+               &             - at_i(ji,jj) *  fhld(ji,jj)                          ! heat flux taken during bottom growth/melt 
+                                                                                   !    (fhld should be 0 while bott growth)
          END DO
       END DO
@@ -410,6 +356,4 @@
       IF( ln_limdiahsb ) CALL lim_cons_hsm(1, 'limthd', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
 
-      CALL wrk_dealloc( jpi,jpj, zqsr, zqns )
-
       !------------------------------------------------------------------------------|
       !  6) Transport of ice between thickness categories.                           |
@@ -470,4 +414,5 @@
    END SUBROUTINE lim_thd 
 
+ 
    SUBROUTINE lim_thd_temp( kideb, kiut )
       !!-----------------------------------------------------------------------
@@ -568,5 +513,5 @@
          END DO
          
-         CALL tab_2d_1d( nbpb, tatm_ice_1d(1:nbpb), tatm_ice(:,:)   , jpi, jpj, npb(1:nbpb) )
+         CALL tab_2d_1d( nbpb, qprec_ice_1d(1:nbpb), qprec_ice(:,:) , jpi, jpj, npb(1:nbpb) )
          CALL tab_2d_1d( nbpb, qsr_ice_1d (1:nbpb), qsr_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
          CALL tab_2d_1d( nbpb, fr1_i0_1d  (1:nbpb), fr1_i0          , jpi, jpj, npb(1:nbpb) )
@@ -574,8 +519,5 @@
          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. ln_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, evap_ice_1d (1:nbpb), evap_ice(:,:,jl), jpi, jpj, npb(1:nbpb) )
          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_1d     (1:nbpb), t_bo            , jpi, jpj, npb(1:nbpb) )
Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limthd_dh.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limthd_dh.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limthd_dh.F90	(revision 5357)
@@ -29,5 +29,10 @@
    PRIVATE
 
-   PUBLIC   lim_thd_dh   ! called by lim_thd
+   PUBLIC   lim_thd_dh      ! called by lim_thd
+   PUBLIC   lim_thd_snwblow ! called in sbcblk/sbccpl and here
+
+   INTERFACE lim_thd_snwblow
+      MODULE PROCEDURE lim_thd_snwblow_1d, lim_thd_snwblow_2d
+   END INTERFACE
 
    !!----------------------------------------------------------------------
@@ -71,6 +76,5 @@
       REAL(wp) ::   zfdum       
       REAL(wp) ::   zfracs       ! fractionation coefficient for bottom salt entrapment
-      REAL(wp) ::   zcoeff       ! dummy argument for snowfall partitioning over ice and leads
-      REAL(wp) ::   zs_snic  ! snow-ice salinity
+      REAL(wp) ::   zs_snic      ! snow-ice salinity
       REAL(wp) ::   zswi1        ! switch for computation of bottom salinity
       REAL(wp) ::   zswi12       ! switch for computation of bottom salinity
@@ -103,4 +107,5 @@
       REAL(wp), POINTER, DIMENSION(:) ::   zqh_s       ! total snow heat content (J.m-2)
       REAL(wp), POINTER, DIMENSION(:) ::   zq_s        ! total snow enthalpy     (J.m-3)
+      REAL(wp), POINTER, DIMENSION(:) ::   zsnw        ! distribution of snow after wind blowing
 
       REAL(wp) :: zswitch_sal
@@ -118,5 +123,5 @@
 
       CALL wrk_alloc( jpij, zqprec, zq_su, zq_bo, zf_tt, zq_rema )
-      CALL wrk_alloc( jpij, zdh_s_mel, zdh_s_pre, zdh_s_sub, zqh_i, zqh_s, zq_s )
+      CALL wrk_alloc( jpij, zdh_s_mel, zdh_s_pre, zdh_s_sub, zqh_i, zqh_s, zq_s, zsnw )
       CALL wrk_alloc( jpij, nlay_i, zdeltah, zh_i )
       CALL wrk_alloc( jpij, nlay_i, icount )
@@ -219,4 +224,5 @@
 
       zdeltah(:,:) = 0._wp
+      CALL lim_thd_snwblow( 1. - at_i_1d, zsnw ) ! snow distribution over ice after wind blowing
       DO ji = kideb, kiut
          !-----------
@@ -224,8 +230,7 @@
          !-----------
          ! thickness change
-         zcoeff = ( 1._wp - ( 1._wp - at_i_1d(ji) )**rn_betas ) / at_i_1d(ji) 
-         zdh_s_pre(ji) = zcoeff * sprecip_1d(ji) * rdt_ice * r1_rhosn
-         ! enthalpy of the precip (>0, J.m-3) (tatm_ice is now in K)
-         zqprec   (ji) = rhosn * ( cpic * ( rt0 - MIN( tatm_ice_1d(ji), rt0_snow) ) + lfus )   
+         zdh_s_pre(ji) = zsnw(ji) * sprecip_1d(ji) * rdt_ice * r1_rhosn / at_i_1d(ji)
+         ! enthalpy of the precip (>0, J.m-3)
+         zqprec   (ji) = - qprec_ice_1d(ji)   
          IF( sprecip_1d(ji) == 0._wp ) zqprec(ji) = 0._wp
          ! heat flux from snow precip (>0, W.m-2)
@@ -280,26 +285,22 @@
       ! clem comment: ice should also sublimate
       zdeltah(:,:) = 0._wp
-      IF( ln_cpl ) THEN
-         ! coupled mode: sublimation already included in emp_ice (to do in limsbc_ice)
-         zdh_s_sub(:)      =  0._wp 
-      ELSE
-         ! forced  mode: snow thickness change due to sublimation
-         DO ji = kideb, kiut
-            zdh_s_sub(ji)  =  MAX( - ht_s_1d(ji) , - qla_ice_1d(ji) / ( rhosn * lsub ) * rdt_ice )
-            ! Heat flux by sublimation [W.m-2], < 0
-            !      sublimate first snow that had fallen, then pre-existing snow
-            zdeltah(ji,1)  = MAX( zdh_s_sub(ji), - zdh_s_pre(ji) )
-            hfx_sub_1d(ji) = hfx_sub_1d(ji) + ( zdeltah(ji,1) * zqprec(ji) + ( zdh_s_sub(ji) - zdeltah(ji,1) ) * q_s_1d(ji,1)  &
-               &                              ) * a_i_1d(ji) * r1_rdtice
-            ! Mass flux by sublimation
-            wfx_sub_1d(ji) =  wfx_sub_1d(ji) - rhosn * a_i_1d(ji) * zdh_s_sub(ji) * r1_rdtice
-            ! new snow thickness
-            ht_s_1d(ji)    =  MAX( 0._wp , ht_s_1d(ji) + zdh_s_sub(ji) )
-            ! update precipitations after sublimation and correct sublimation
-            zdh_s_pre(ji) = zdh_s_pre(ji) + zdeltah(ji,1)
-            zdh_s_sub(ji) = zdh_s_sub(ji) - zdeltah(ji,1)
-         END DO
-      ENDIF
-
+      ! coupled mode: sublimation is set to 0 (evap_ice = 0) until further notice
+      ! forced  mode: snow thickness change due to sublimation
+      DO ji = kideb, kiut
+         zdh_s_sub(ji)  =  MAX( - ht_s_1d(ji) , - evap_ice_1d(ji) * r1_rhosn * rdt_ice )
+         ! Heat flux by sublimation [W.m-2], < 0
+         !      sublimate first snow that had fallen, then pre-existing snow
+         zdeltah(ji,1)  = MAX( zdh_s_sub(ji), - zdh_s_pre(ji) )
+         hfx_sub_1d(ji) = hfx_sub_1d(ji) + ( zdeltah(ji,1) * zqprec(ji) + ( zdh_s_sub(ji) - zdeltah(ji,1) ) * q_s_1d(ji,1)  &
+            &                              ) * a_i_1d(ji) * r1_rdtice
+         ! Mass flux by sublimation
+         wfx_sub_1d(ji) =  wfx_sub_1d(ji) - rhosn * a_i_1d(ji) * zdh_s_sub(ji) * r1_rdtice
+         ! new snow thickness
+         ht_s_1d(ji)    =  MAX( 0._wp , ht_s_1d(ji) + zdh_s_sub(ji) )
+         ! update precipitations after sublimation and correct sublimation
+         zdh_s_pre(ji) = zdh_s_pre(ji) + zdeltah(ji,1)
+         zdh_s_sub(ji) = zdh_s_sub(ji) - zdeltah(ji,1)
+      END DO
+      
       ! --- Update snow diags --- !
       DO ji = kideb, kiut
@@ -689,5 +690,5 @@
       
       CALL wrk_dealloc( jpij, zqprec, zq_su, zq_bo, zf_tt, zq_rema )
-      CALL wrk_dealloc( jpij, zdh_s_mel, zdh_s_pre, zdh_s_sub, zqh_i, zqh_s, zq_s )
+      CALL wrk_dealloc( jpij, zdh_s_mel, zdh_s_pre, zdh_s_sub, zqh_i, zqh_s, zq_s, zsnw )
       CALL wrk_dealloc( jpij, nlay_i, zdeltah, zh_i )
       CALL wrk_dealloc( jpij, nlay_i, icount )
@@ -695,4 +696,22 @@
       !
    END SUBROUTINE lim_thd_dh
+
+
+   !!--------------------------------------------------------------------------
+   !! INTERFACE lim_thd_snwblow
+   !! ** Purpose :   Compute distribution of precip over the ice
+   !!--------------------------------------------------------------------------
+   SUBROUTINE lim_thd_snwblow_2d( pin, pout )
+      REAL(wp), DIMENSION(:,:), INTENT(in)  :: pin   ! previous fraction lead ( pfrld or (1. - a_i_b) )
+      REAL(wp), DIMENSION(:,:), INTENT(out) :: pout
+      pout = ( 1._wp - ( pin )**rn_betas )
+   END SUBROUTINE lim_thd_snwblow_2d
+
+   SUBROUTINE lim_thd_snwblow_1d( pin, pout )
+      REAL(wp), DIMENSION(:), INTENT(in)  :: pin
+      REAL(wp), DIMENSION(:), INTENT(out) :: pout
+      pout = ( 1._wp - ( pin )**rn_betas )
+   END SUBROUTINE lim_thd_snwblow_1d
+
    
 #else
Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limthd_dif.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limthd_dif.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limthd_dif.F90	(revision 5357)
@@ -24,5 +24,4 @@
    USE wrk_nemo       ! work arrays
    USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
-   USE sbc_oce, ONLY : ln_cpl
 
    IMPLICIT NONE
@@ -746,6 +745,4 @@
       !-------------------------------------------------------------------------!
       DO ji = kideb, kiut
-         ! forced mode only : update of latent heat fluxes (sublimation) (always >=0, upward flux) 
-         IF( .NOT. ln_cpl) qla_ice_1d (ji) = MAX( 0._wp, qla_ice_1d (ji) + dqla_ice_1d(ji) * ( t_su_1d(ji) - ztsub(ji) ) )
          !                                ! surface ice conduction flux
          isnow(ji)       = 1._wp - MAX( 0._wp, SIGN( 1._wp, -ht_s_1d(ji) ) )
Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limwri.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limwri.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/limwri.F90	(revision 5357)
@@ -176,5 +176,5 @@
       CALL iom_put( "utau_ice"    , utau_ice            )        ! wind stress over ice along i-axis at I-point
       CALL iom_put( "vtau_ice"    , vtau_ice            )        ! wind stress over ice along j-axis at I-point
-      CALL iom_put( "snowpre"     , sprecip             )        ! snow precipitation 
+      CALL iom_put( "snowpre"     , sprecip * 86400.    )        ! snow precipitation 
       CALL iom_put( "micesalt"    , smt_i               )        ! mean ice salinity
 
@@ -232,5 +232,5 @@
       CALL iom_put ('hfxdif'     , hfx_dif(:,:)         )   !  
       CALL iom_put ('hfxopw'     , hfx_opw(:,:)         )   !  
-      CALL iom_put ('hfxtur'     , fhtur(:,:) * at_i(:,:) ) ! turbulent heat flux at ice base 
+      CALL iom_put ('hfxtur'     , fhtur(:,:) * SUM(a_i_b(:,:,:), dim=3) ) ! turbulent heat flux at ice base 
       CALL iom_put ('hfxdhc'     , diag_heat(:,:)       )   ! Heat content variation in snow and ice 
       CALL iom_put ('hfxspr'     , hfx_spr(:,:)         )   ! Heat content of snow precip 
Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/thd_ice.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/thd_ice.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/LIM_SRC_3/thd_ice.F90	(revision 5357)
@@ -89,7 +89,6 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   fhld_1d       !: <==> the 2D  fhld
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   dqns_ice_1d   !: <==> the 2D  dqns_ice
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   qla_ice_1d    !: <==> the 2D  qla_ice
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   dqla_ice_1d   !: <==> the 2D  dqla_ice
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   tatm_ice_1d   !: <==> the 2D  tatm_ice
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   evap_ice_1d   !: <==> the 2D  evap_ice
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   qprec_ice_1d  !: <==> the 2D  qprec_ice
    !                                                     ! to reintegrate longwave flux inside the ice thermodynamics
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   i0            !: fraction of radiation transmitted to the ice
@@ -153,6 +152,6 @@
          &      fhld_1d    (jpij) , wfx_sub_1d (jpij) , wfx_bog_1d (jpij) , wfx_bom_1d(jpij) ,  &
          &      wfx_sum_1d(jpij)  , wfx_sni_1d (jpij) , wfx_opw_1d (jpij) , wfx_res_1d(jpij) ,  &
-         &      dqns_ice_1d(jpij) , qla_ice_1d (jpij) , dqla_ice_1d(jpij) ,                     &
-         &      tatm_ice_1d(jpij) , i0         (jpij) ,                                         &  
+         &      dqns_ice_1d(jpij) , evap_ice_1d (jpij),                                         &
+         &      qprec_ice_1d(jpij), i0         (jpij) ,                                         &  
          &      sfx_bri_1d (jpij) , sfx_bog_1d (jpij) , sfx_bom_1d (jpij) , sfx_sum_1d (jpij),  &
          &      sfx_sni_1d (jpij) , sfx_opw_1d (jpij) , sfx_res_1d (jpij) ,                     &
Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90	(revision 5357)
@@ -213,6 +213,6 @@
          CALL iom_get( numror, jpdom_autoglo, 'sshb'   , sshb    )
 ! EM Attention Ceci doit etre reimplemente correctement
-!EM         IF( lk_lim3 .OR. ( nn_components == jp_iam_opa ) )   CALL iom_get( numror, jpdom_autoglo, 'fse3t_b', fse3t_b(:,:,:) )
-         CALL iom_get( numror, jpdom_autoglo, 'fse3t_b', fse3t_b(:,:,:) )
+         IF( lk_lim3 .OR. ( nn_components == jp_iam_opa ) )   CALL iom_get( numror, jpdom_autoglo, 'fse3t_b', fse3t_b(:,:,:) )
+!clem         CALL iom_get( numror, jpdom_autoglo, 'fse3t_b', fse3t_b(:,:,:) )
       ELSE
          neuler = 0
Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90	(revision 5357)
@@ -69,8 +69,22 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   fr1_i0         !: Solar surface transmission parameter, thick ice  [-]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   fr2_i0         !: Solar surface transmission parameter, thin ice   [-]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   emp_ice        !: sublimation - precip over sea ice            [kg/m2]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   emp_ice        !: sublimation - precip over sea ice          [kg/m2/s]
 
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   topmelt            !: category topmelt
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   botmelt            !: category botmelt
+
+#if defined  key_lim3
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   evap_ice       !: sublimation                              [kg/m2/s]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   devap_ice      !: sublimation sensitivity                [kg/m2/s/K]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   qns_oce        !: non solar heat flux over ocean              [W/m2]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   qsr_oce        !: non solar heat flux over ocean              [W/m2]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   qemp_oce       !: heat flux of precip and evap over ocean     [W/m2]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   qemp_ice       !: heat flux of precip and evap over ice       [W/m2]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   qprec_ice      !: heat flux of precip over ice                [J/m3]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   emp_oce        !: evap - precip over ocean                 [kg/m2/s]
+#endif
+#if defined key_lim3 || defined key_lim2
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   wndm_ice       !: wind speed module at T-point                 [m/s]
+#endif
 
 #if defined key_cice
@@ -100,6 +114,5 @@
 #endif
 
-#if defined key_lim3 || defined key_cice
-   ! not used with LIM2
+#if defined key_cice
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   tatm_ice       !: air temperature [K]
 #endif
@@ -125,13 +138,14 @@
       ALLOCATE( qns_ice (jpi,jpj,jpl) , qsr_ice (jpi,jpj,jpl) ,     &
          &      qla_ice (jpi,jpj,jpl) , dqla_ice(jpi,jpj,jpl) ,     &
-         &      dqns_ice(jpi,jpj,jpl) , tn_ice  (jpi,jpj,jpl) ,     &
-         &      alb_ice (jpi,jpj,jpl) ,                             &
-         &      utau_ice(jpi,jpj)     , vtau_ice(jpi,jpj)     ,     &
+         &      dqns_ice(jpi,jpj,jpl) , tn_ice  (jpi,jpj,jpl) , alb_ice (jpi,jpj,jpl) ,   &
+         &      utau_ice(jpi,jpj)     , vtau_ice(jpi,jpj)     , wndm_ice(jpi,jpj)     ,   &
          &      fr1_i0  (jpi,jpj)     , fr2_i0  (jpi,jpj)     ,     &
-#if defined key_lim3
-         &      tatm_ice(jpi,jpj)     ,                             &
-#endif
 #if defined key_lim2
          &      a_i(jpi,jpj,jpl)      ,                             &
+#endif
+#if defined key_lim3
+         &      evap_ice(jpi,jpj,jpl) , devap_ice(jpi,jpj,jpl) , qprec_ice(jpi,jpj) ,  &
+         &      qemp_ice(jpi,jpj)     , qemp_oce(jpi,jpj)      ,                       &
+         &      qns_oce (jpi,jpj)     , qsr_oce (jpi,jpj)      , emp_oce (jpi,jpj)  ,  &
 #endif
          &      emp_ice(jpi,jpj)      ,  STAT= ierr(1) )
Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_clio.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_clio.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_clio.F90	(revision 5357)
@@ -46,4 +46,6 @@
    PUBLIC sbc_blk_clio        ! routine called by sbcmod.F90 
    PUBLIC blk_ice_clio        ! routine called by sbcice_lim.F90 
+   PUBLIC blk_ice_clio_tau    ! routine called by sbcice_lim.F90 
+   PUBLIC blk_ice_clio_flx    ! routine called by sbcice_lim.F90 
 
    INTEGER , PARAMETER ::   jpfld   = 7           ! maximum number of files to read 
@@ -399,5 +401,4 @@
    END SUBROUTINE blk_oce_clio
 
-
    SUBROUTINE blk_ice_clio(  pst   , palb_cs, palb_os, palb,  &
       &                      p_taui, p_tauj, p_qns , p_qsr,   &
@@ -405,27 +406,16 @@
       &                      p_tpr , p_spr ,                  &
       &                      p_fr1 , p_fr2 , cd_grid, pdim  )
+
       !!---------------------------------------------------------------------------
       !!                     ***  ROUTINE blk_ice_clio  ***
-      !!                 
+      !!
       !!  ** Purpose :   Computation of the heat fluxes at ocean and snow/ice
       !!       surface the solar heat at ocean and snow/ice surfaces and the 
       !!       sensitivity of total heat fluxes to the SST variations
       !!         
-      !!  ** Method  :   The flux of heat at the ice and ocean surfaces are derived
-      !!       from semi-empirical ( or bulk ) formulae which relate the flux to 
-      !!       the properties of the surface and of the lower atmosphere. Here, we
-      !!       follow the work of Oberhuber, 1988   
-      !!
-      !!  ** Action  :   call albedo_oce/albedo_ice to compute ocean/ice albedo 
-      !!               - snow precipitation
-      !!               - solar flux at the ocean and ice surfaces
-      !!               - the long-wave radiation for the ocean and sea/ice
-      !!               - turbulent heat fluxes over water and ice
-      !!               - evaporation over water
-      !!               - total heat fluxes sensitivity over ice (dQ/dT)
-      !!               - latent heat flux sensitivity over ice (dQla/dT)
-      !!               - qns  :  modified the non solar heat flux over the ocean
-      !!                         to take into account solid precip latent heat flux
+      !!  ** Action  :   Call of blk_ice_clio_tau and blk_ice_clio_flx
+      !!
       !!----------------------------------------------------------------------
+
       REAL(wp), INTENT(in   ), DIMENSION(:,:,:)   ::   pst      ! ice surface temperature                   [Kelvin]
       REAL(wp), INTENT(in   ), DIMENSION(:,:,:)   ::   palb_cs  ! ice albedo (clear    sky) (alb_ice_cs)         [-]
@@ -445,9 +435,108 @@
       CHARACTER(len=1), INTENT(in   )             ::   cd_grid  ! type of sea-ice grid ("C" or "B" grid)
       INTEGER, INTENT(in   )                      ::   pdim     ! number of ice categories
+
+      CALL blk_ice_clio_tau( p_taui, p_tauj, cd_grid )
+      CALL blk_ice_clio_flx(  pst   , palb_cs, palb_os, palb,        &
+         &                    p_qns , p_qsr, p_qla , p_dqns, p_dqla, &
+         &                    p_tpr , p_spr ,p_fr1 , p_fr2 , pdim  )
+
+   END SUBROUTINE blk_ice_clio
+
+   SUBROUTINE blk_ice_clio_tau( p_taui, p_tauj, cd_grid )
+      !!---------------------------------------------------------------------------
+      !!                     ***  ROUTINE blk_ice_clio_tau  ***
+      !!                 
+      !!  ** Purpose :   Computation momentum flux at the ice-atm interface  
+      !!         
+      !!  ** Method  :   Read utau from a forcing file. Rearrange if C-grid
+      !!
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_taui   ! surface ice stress at I-point (i-component) [N/m2]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_tauj   ! surface ice stress at I-point (j-component) [N/m2]
+      CHARACTER(len=1), INTENT(in   )             ::   cd_grid  ! type of sea-ice grid ("C" or "B" grid)
+      !!
+      INTEGER  ::   ji, jj    ! dummy loop indices
+      REAL(wp) ::   zcoef
+      !!
+      !!---------------------------------------------------------------------
+      !
+
+      IF( nn_timing == 1 )  CALL timing_start('blk_ice_clio_tau')
+
+      SELECT CASE( cd_grid )
+
+      CASE( 'C' )                          ! C-grid ice dynamics
+
+         zcoef  = cai / cao                         ! Change from air-sea stress to air-ice stress
+         p_taui(:,:) = zcoef * utau(:,:)
+         p_tauj(:,:) = zcoef * vtau(:,:)
+
+      CASE( 'I' )                          ! I-grid ice dynamics:  I-point (i.e. F-point lower-left corner)
+
+         zcoef  = 0.5_wp * cai / cao                ! Change from air-sea stress to air-ice stress
+         DO jj = 2, jpj         ! stress from ocean U- and V-points to ice U,V point
+            DO ji = 2, jpi   ! I-grid : no vector opt.
+               p_taui(ji,jj) = zcoef * ( utau(ji-1,jj  ) + utau(ji-1,jj-1) )
+               p_tauj(ji,jj) = zcoef * ( vtau(ji  ,jj-1) + vtau(ji-1,jj-1) )
+            END DO
+         END DO
+
+         CALL lbc_lnk( p_taui(:,:), 'I', -1. )   ;   CALL lbc_lnk( p_tauj(:,:), 'I', -1. )   ! I-point
+
+      END SELECT
+
+      IF(ln_ctl) THEN
+         CALL prt_ctl(tab2d_1=p_taui , clinfo1=' blk_ice_clio: p_taui : ', tab2d_2=p_tauj , clinfo2=' p_tauj : ')
+      ENDIF
+
+      IF( nn_timing == 1 )  CALL timing_stop('blk_ice_clio_tau')
+
+   END SUBROUTINE blk_ice_clio_tau
+
+   SUBROUTINE blk_ice_clio_flx(  pst   , palb_cs, palb_os, palb,  &
+      &                          p_qns , p_qsr, p_qla , p_dqns, p_dqla, &
+      &                          p_tpr , p_spr ,p_fr1 , p_fr2 , pdim  )
+      !!---------------------------------------------------------------------------
+      !!                     ***  ROUTINE blk_ice_clio_flx ***
+      !!                 
+      !!  ** Purpose :   Computation of the heat fluxes at ocean and snow/ice
+      !!       surface the solar heat at ocean and snow/ice surfaces and the 
+      !!       sensitivity of total heat fluxes to the SST variations
+      !!         
+      !!  ** Method  :   The flux of heat at the ice and ocean surfaces are derived
+      !!       from semi-empirical ( or bulk ) formulae which relate the flux to 
+      !!       the properties of the surface and of the lower atmosphere. Here, we
+      !!       follow the work of Oberhuber, 1988   
+      !!
+      !!  ** Action  :   call albedo_oce/albedo_ice to compute ocean/ice albedo 
+      !!               - snow precipitation
+      !!               - solar flux at the ocean and ice surfaces
+      !!               - the long-wave radiation for the ocean and sea/ice
+      !!               - turbulent heat fluxes over water and ice
+      !!               - evaporation over water
+      !!               - total heat fluxes sensitivity over ice (dQ/dT)
+      !!               - latent heat flux sensitivity over ice (dQla/dT)
+      !!               - qns  :  modified the non solar heat flux over the ocean
+      !!                         to take into account solid precip latent heat flux
+      !!----------------------------------------------------------------------
+      REAL(wp), INTENT(in   ), DIMENSION(:,:,:)   ::   pst      ! ice surface temperature                   [Kelvin]
+      REAL(wp), INTENT(in   ), DIMENSION(:,:,:)   ::   palb_cs  ! ice albedo (clear    sky) (alb_ice_cs)         [-]
+      REAL(wp), INTENT(in   ), DIMENSION(:,:,:)   ::   palb_os  ! ice albedo (overcast sky) (alb_ice_os)         [-]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   palb     ! ice albedo (actual value)                      [-]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_qns    ! non solar heat flux over ice (T-point)      [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_qsr    !     solar heat flux over ice (T-point)      [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_qla    ! latent    heat flux over ice (T-point)      [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_dqns   ! non solar heat sensistivity  (T-point)      [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(:,:,:)   ::   p_dqla   ! latent    heat sensistivity  (T-point)      [W/m2]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_tpr    ! total precipitation          (T-point)   [Kg/m2/s]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_spr    ! solid precipitation          (T-point)   [Kg/m2/s]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_fr1    ! 1sr fraction of qsr penetration in ice         [-]
+      REAL(wp), INTENT(  out), DIMENSION(jpi,jpj) ::   p_fr2    ! 2nd fraction of qsr penetration in ice         [-]
+      INTEGER, INTENT(in   )                      ::   pdim     ! number of ice categories
       !!
       INTEGER  ::   ji, jj, jl    ! dummy loop indices
       INTEGER  ::   ijpl          ! number of ice categories (size of 3rd dim of input arrays)
       !!
-      REAL(wp) ::   zcoef, zmt1, zmt2, zmt3, ztatm3     ! temporary scalars
+      REAL(wp) ::   zmt1, zmt2, zmt3, ztatm3                    ! temporary scalars
       REAL(wp) ::   ztaevbk, zind1, zind2, zind3, ztamr         !    -         -
       REAL(wp) ::   zesi, zqsati, zdesidt                       !    -         -
@@ -463,5 +552,5 @@
       !!---------------------------------------------------------------------
       !
-      IF( nn_timing == 1 )  CALL timing_start('blk_ice_clio')
+      IF( nn_timing == 1 )  CALL timing_start('blk_ice_clio_flx')
       !
       CALL wrk_alloc( jpi,jpj, ztatm, zqatm, zevsqr, zrhoa )
@@ -471,32 +560,9 @@
       zpatm = 101000.                        ! atmospheric pressure  (assumed constant  here)
 
-#if defined key_lim3      
-      tatm_ice(:,:) = sf(jp_tair)%fnow(:,:,1)   ! LIM3: make Tair available in sea-ice. WARNING allocated after call to ice_init
-#endif
-      !                                                        ! surface ocean fluxes computed with CLIO bulk formulea
-      !------------------------------------!
-      !   momentum fluxes  (utau, vtau )   !
-      !------------------------------------!
-
-      SELECT CASE( cd_grid )
-      CASE( 'C' )                          ! C-grid ice dynamics
-         zcoef  = cai / cao                         ! Change from air-sea stress to air-ice stress
-         p_taui(:,:) = zcoef * utau(:,:)
-         p_tauj(:,:) = zcoef * vtau(:,:)
-      CASE( 'I' )                          ! I-grid ice dynamics:  I-point (i.e. F-point lower-left corner)
-         zcoef  = 0.5_wp * cai / cao                ! Change from air-sea stress to air-ice stress
-         DO jj = 2, jpj         ! stress from ocean U- and V-points to ice U,V point
-            DO ji = 2, jpi   ! I-grid : no vector opt.
-               p_taui(ji,jj) = zcoef * ( utau(ji-1,jj  ) + utau(ji-1,jj-1) )
-               p_tauj(ji,jj) = zcoef * ( vtau(ji  ,jj-1) + vtau(ji-1,jj-1) )
-            END DO
-         END DO
-         CALL lbc_lnk( p_taui(:,:), 'I', -1. )   ;   CALL lbc_lnk( p_tauj(:,:), 'I', -1. )   ! I-point
-      END SELECT
-
-
+      !--------------------------------------------------------------------------------
       !  Determine cloud optical depths as a function of latitude (Chou et al., 1981).
       !  and the correction factor for taking into account  the effect of clouds 
-      !------------------------------------------------------
+      !--------------------------------------------------------------------------------
+
 !CDIR NOVERRCHK
 !CDIR COLLAPSE
@@ -653,5 +719,4 @@
          CALL prt_ctl(tab3d_1=p_dqla , clinfo1=' blk_ice_clio: p_dqla : ', tab3d_2=pst    , clinfo2=' pst    : ', kdim=ijpl)
          CALL prt_ctl(tab2d_1=p_tpr  , clinfo1=' blk_ice_clio: p_tpr  : ', tab2d_2=p_spr  , clinfo2=' p_spr  : ')
-         CALL prt_ctl(tab2d_1=p_taui , clinfo1=' blk_ice_clio: p_taui : ', tab2d_2=p_tauj , clinfo2=' p_tauj : ')
       ENDIF
 
@@ -659,8 +724,7 @@
       CALL wrk_dealloc( jpi,jpj,pdim, z_qlw, z_qsb )
       !
-      IF( nn_timing == 1 )  CALL timing_stop('blk_ice_clio')
-      !
-   END SUBROUTINE blk_ice_clio
-
+      IF( nn_timing == 1 )  CALL timing_stop('blk_ice_clio_flx')
+      !
+   END SUBROUTINE blk_ice_clio_flx
 
    SUBROUTINE blk_clio_qsr_oce( pqsr_oce )
Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 5357)
@@ -46,4 +46,11 @@
    USE sbc_ice         ! Surface boundary condition: ice fields
    USE lib_fortran     ! to use key_nosignedzero
+#if defined key_lim3
+   USE ice, ONLY       : u_ice, v_ice, jpl, pfrld, a_i_b
+   USE limthd_dh       ! for CALL lim_thd_snwblow
+#elif defined key_lim2
+   USE ice_2, ONLY     : u_ice, v_ice
+   USE par_ice_2
+#endif
 
    IMPLICIT NONE
@@ -51,5 +58,8 @@
 
    PUBLIC   sbc_blk_core         ! routine called in sbcmod module
-   PUBLIC   blk_ice_core         ! routine called in sbc_ice_lim module
+#if defined key_lim2 || defined key_lim3
+   PUBLIC   blk_ice_core_tau     ! routine called in sbc_ice_lim module
+   PUBLIC   blk_ice_core_flx     ! routine called in sbc_ice_lim module
+#endif
    PUBLIC   blk_ice_meanqsr      ! routine called in sbc_ice_lim module
    PUBLIC   turb_core_2z         ! routine calles in sbcblk_mfs module
@@ -376,5 +386,6 @@
       emp (:,:) = (  zevap(:,:)                                          &   ! mass flux (evap. - precip.)
          &         - sf(jp_prec)%fnow(:,:,1) * rn_pfac  ) * tmask(:,:,1)
-      qns(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)                                &   ! Downward Non Solar flux
+      !
+      qns(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)                                &   ! Downward Non Solar 
          &     - sf(jp_snow)%fnow(:,:,1) * rn_pfac * lfus                         &   ! remove latent melting heat for solid precip
          &     - zevap(:,:) * pst(:,:) * rcp                                      &   ! remove evap heat content at SST
@@ -383,4 +394,9 @@
          &     + sf(jp_snow)%fnow(:,:,1) * rn_pfac                                &   ! add solid  precip heat content at min(Tair,Tsnow)
          &     * ( MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow ) - rt0 ) * cpic * tmask(:,:,1)
+      !
+#if defined key_lim3
+      qns_oce(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)                                ! non solar without emp (only needed by LIM3)
+      qsr_oce(:,:) = qsr(:,:)
+#endif
       !
       CALL iom_put( "qlw_oce",   zqlw )                 ! output downward longwave heat over the ocean
@@ -406,81 +422,37 @@
  
    
-   SUBROUTINE blk_ice_core(  pst   , pui   , pvi   , palb ,   &
-      &                      p_taui, p_tauj, p_qns , p_qsr,   &
-      &                      p_qla , p_dqns, p_dqla,          &
-      &                      p_tpr , p_spr ,                  &
-      &                      p_fr1 , p_fr2 , cd_grid, pdim  ) 
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE blk_ice_core  ***
+#if defined key_lim2 || defined key_lim3
+   SUBROUTINE blk_ice_core_tau
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE blk_ice_core_tau  ***
       !!
       !! ** Purpose :   provide the surface boundary condition over sea-ice
       !!
-      !! ** Method  :   compute momentum, heat and freshwater exchanged
-      !!                between atmosphere and sea-ice using CORE bulk
-      !!                formulea, ice variables and read atmmospheric fields.
+      !! ** Method  :   compute momentum using CORE bulk
+      !!                formulea, ice variables and read atmospheric fields.
       !!                NB: ice drag coefficient is assumed to be a constant
-      !! 
-      !! caution : the net upward water flux has with mm/day unit
-      !!---------------------------------------------------------------------
-      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   pst      ! ice surface temperature (>0, =rt0 over land) [Kelvin]
-      REAL(wp), DIMENSION(:,:)  , INTENT(in   ) ::   pui      ! ice surface velocity (i- and i- components      [m/s]
-      REAL(wp), DIMENSION(:,:)  , INTENT(in   ) ::   pvi      !    at I-point (B-grid) or U & V-point (C-grid)
-      REAL(wp), DIMENSION(:,:,:), INTENT(in   ) ::   palb     ! ice albedo (all skies)                            [%]
-      REAL(wp), DIMENSION(:,:)  , INTENT(  out) ::   p_taui   ! i- & j-components of surface ice stress        [N/m2]
-      REAL(wp), DIMENSION(:,:)  , INTENT(  out) ::   p_tauj   !   at I-point (B-grid) or U & V-point (C-grid)
-      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   p_qns    ! non solar heat flux over ice (T-point)         [W/m2]
-      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   p_qsr    !     solar heat flux over ice (T-point)         [W/m2]
-      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   p_qla    ! latent    heat flux over ice (T-point)         [W/m2]
-      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   p_dqns   ! non solar heat sensistivity  (T-point)         [W/m2]
-      REAL(wp), DIMENSION(:,:,:), INTENT(  out) ::   p_dqla   ! latent    heat sensistivity  (T-point)         [W/m2]
-      REAL(wp), DIMENSION(:,:)  , INTENT(  out) ::   p_tpr    ! total precipitation          (T-point)      [Kg/m2/s]
-      REAL(wp), DIMENSION(:,:)  , INTENT(  out) ::   p_spr    ! solid precipitation          (T-point)      [Kg/m2/s]
-      REAL(wp), DIMENSION(:,:)  , INTENT(  out) ::   p_fr1    ! 1sr fraction of qsr penetration in ice (T-point)  [%]
-      REAL(wp), DIMENSION(:,:)  , INTENT(  out) ::   p_fr2    ! 2nd fraction of qsr penetration in ice (T-point)  [%]
-      CHARACTER(len=1)          , INTENT(in   ) ::   cd_grid  ! ice grid ( C or B-grid)
-      INTEGER                   , INTENT(in   ) ::   pdim     ! number of ice categories
-      !!
-      INTEGER  ::   ji, jj, jl    ! dummy loop indices
-      INTEGER  ::   ijpl          ! number of ice categories (size of 3rd dim of input arrays)
-      REAL(wp) ::   zst2, zst3
-      REAL(wp) ::   zcoef_wnorm, zcoef_wnorm2, zcoef_dqlw, zcoef_dqla, zcoef_dqsb
-      REAL(wp) ::   zztmp                                        ! temporary variable
-      REAL(wp) ::   zwnorm_f, zwndi_f , zwndj_f                  ! relative wind module and components at F-point
-      REAL(wp) ::             zwndi_t , zwndj_t                  ! relative wind components at T-point
-      !!
-      REAL(wp), DIMENSION(:,:)  , POINTER ::   z_wnds_t          ! wind speed ( = | U10m - U_ice | ) at T-point
-      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_qlw             ! long wave heat flux over ice
-      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_qsb             ! sensible  heat flux over ice
-      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_dqlw            ! long wave heat sensitivity over ice
-      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_dqsb            ! sensible  heat sensitivity over ice
-      !!---------------------------------------------------------------------
-      !
-      IF( nn_timing == 1 )  CALL timing_start('blk_ice_core')
-      !
-      CALL wrk_alloc( jpi,jpj, z_wnds_t )
-      CALL wrk_alloc( jpi,jpj,pdim, z_qlw, z_qsb, z_dqlw, z_dqsb ) 
-
-      ijpl  = pdim                            ! number of ice categories
-
+      !!---------------------------------------------------------------------
+      INTEGER  ::   ji, jj    ! dummy loop indices
+      REAL(wp) ::   zcoef_wnorm, zcoef_wnorm2
+      REAL(wp) ::   zwnorm_f, zwndi_f , zwndj_f               ! relative wind module and components at F-point
+      REAL(wp) ::             zwndi_t , zwndj_t               ! relative wind components at T-point
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('blk_ice_core_tau')
+      !
       ! local scalars ( place there for vector optimisation purposes)
       zcoef_wnorm  = rhoa * Cice
       zcoef_wnorm2 = rhoa * Cice * 0.5
-      zcoef_dqlw   = 4.0 * 0.95 * Stef
-      zcoef_dqla   = -Ls * Cice * 11637800. * (-5897.8)
-      zcoef_dqsb   = rhoa * cpa * Cice
 
 !!gm brutal....
-      z_wnds_t(:,:) = 0.e0
-      p_taui  (:,:) = 0.e0
-      p_tauj  (:,:) = 0.e0
+      utau_ice  (:,:) = 0._wp
+      vtau_ice  (:,:) = 0._wp
+      wndm_ice  (:,:) = 0._wp
 !!gm end
 
-#if defined key_lim3
-      tatm_ice(:,:) = sf(jp_tair)%fnow(:,:,1)   ! LIM3: make Tair available in sea-ice. WARNING allocated after call to ice_init
-#endif
       ! ----------------------------------------------------------------------------- !
       !    Wind components and module relative to the moving ocean ( U10m - U_ice )   !
       ! ----------------------------------------------------------------------------- !
-      SELECT CASE( cd_grid )
+      SELECT CASE( cp_ice_msh )
       CASE( 'I' )                  ! B-grid ice dynamics :   I-point (i.e. F-point with sea-ice indexation)
          !                           and scalar wind at T-point ( = | U10m - U_ice | ) (masked)
@@ -489,48 +461,94 @@
                ! ... scalar wind at I-point (fld being at T-point)
                zwndi_f = 0.25 * (  sf(jp_wndi)%fnow(ji-1,jj  ,1) + sf(jp_wndi)%fnow(ji  ,jj  ,1)   &
-                  &              + sf(jp_wndi)%fnow(ji-1,jj-1,1) + sf(jp_wndi)%fnow(ji  ,jj-1,1)  ) - rn_vfac * pui(ji,jj)
+                  &              + sf(jp_wndi)%fnow(ji-1,jj-1,1) + sf(jp_wndi)%fnow(ji  ,jj-1,1)  ) - rn_vfac * u_ice(ji,jj)
                zwndj_f = 0.25 * (  sf(jp_wndj)%fnow(ji-1,jj  ,1) + sf(jp_wndj)%fnow(ji  ,jj  ,1)   &
-                  &              + sf(jp_wndj)%fnow(ji-1,jj-1,1) + sf(jp_wndj)%fnow(ji  ,jj-1,1)  ) - rn_vfac * pvi(ji,jj)
+                  &              + sf(jp_wndj)%fnow(ji-1,jj-1,1) + sf(jp_wndj)%fnow(ji  ,jj-1,1)  ) - rn_vfac * v_ice(ji,jj)
                zwnorm_f = zcoef_wnorm * SQRT( zwndi_f * zwndi_f + zwndj_f * zwndj_f )
                ! ... ice stress at I-point
-               p_taui(ji,jj) = zwnorm_f * zwndi_f
-               p_tauj(ji,jj) = zwnorm_f * zwndj_f
+               utau_ice(ji,jj) = zwnorm_f * zwndi_f
+               vtau_ice(ji,jj) = zwnorm_f * zwndj_f
                ! ... scalar wind at T-point (fld being at T-point)
-               zwndi_t = sf(jp_wndi)%fnow(ji,jj,1) - rn_vfac * 0.25 * (  pui(ji,jj+1) + pui(ji+1,jj+1)   &
-                  &                                                    + pui(ji,jj  ) + pui(ji+1,jj  )  )
-               zwndj_t = sf(jp_wndj)%fnow(ji,jj,1) - rn_vfac * 0.25 * (  pvi(ji,jj+1) + pvi(ji+1,jj+1)   &
-                  &                                                    + pvi(ji,jj  ) + pvi(ji+1,jj  )  )
-               z_wnds_t(ji,jj)  = SQRT( zwndi_t * zwndi_t + zwndj_t * zwndj_t ) * tmask(ji,jj,1)
+               zwndi_t = sf(jp_wndi)%fnow(ji,jj,1) - rn_vfac * 0.25 * (  u_ice(ji,jj+1) + u_ice(ji+1,jj+1)   &
+                  &                                                    + u_ice(ji,jj  ) + u_ice(ji+1,jj  )  )
+               zwndj_t = sf(jp_wndj)%fnow(ji,jj,1) - rn_vfac * 0.25 * (  v_ice(ji,jj+1) + v_ice(ji+1,jj+1)   &
+                  &                                                    + v_ice(ji,jj  ) + v_ice(ji+1,jj  )  )
+               wndm_ice(ji,jj)  = SQRT( zwndi_t * zwndi_t + zwndj_t * zwndj_t ) * tmask(ji,jj,1)
             END DO
          END DO
-         CALL lbc_lnk( p_taui  , 'I', -1. )
-         CALL lbc_lnk( p_tauj  , 'I', -1. )
-         CALL lbc_lnk( z_wnds_t, 'T',  1. )
+         CALL lbc_lnk( utau_ice, 'I', -1. )
+         CALL lbc_lnk( vtau_ice, 'I', -1. )
+         CALL lbc_lnk( wndm_ice, 'T',  1. )
          !
       CASE( 'C' )                  ! C-grid ice dynamics :   U & V-points (same as ocean)
          DO jj = 2, jpj
             DO ji = fs_2, jpi   ! vect. opt.
-               zwndi_t = (  sf(jp_wndi)%fnow(ji,jj,1) - rn_vfac * 0.5 * ( pui(ji-1,jj  ) + pui(ji,jj) )  )
-               zwndj_t = (  sf(jp_wndj)%fnow(ji,jj,1) - rn_vfac * 0.5 * ( pvi(ji  ,jj-1) + pvi(ji,jj) )  )
-               z_wnds_t(ji,jj)  = SQRT( zwndi_t * zwndi_t + zwndj_t * zwndj_t ) * tmask(ji,jj,1)
+               zwndi_t = (  sf(jp_wndi)%fnow(ji,jj,1) - rn_vfac * 0.5 * ( u_ice(ji-1,jj  ) + u_ice(ji,jj) )  )
+               zwndj_t = (  sf(jp_wndj)%fnow(ji,jj,1) - rn_vfac * 0.5 * ( v_ice(ji  ,jj-1) + v_ice(ji,jj) )  )
+               wndm_ice(ji,jj) = SQRT( zwndi_t * zwndi_t + zwndj_t * zwndj_t ) * tmask(ji,jj,1)
             END DO
          END DO
          DO jj = 2, jpjm1
             DO ji = fs_2, fs_jpim1   ! vect. opt.
-               p_taui(ji,jj) = zcoef_wnorm2 * ( z_wnds_t(ji+1,jj  ) + z_wnds_t(ji,jj) )                          &
-                  &          * ( 0.5 * (sf(jp_wndi)%fnow(ji+1,jj,1) + sf(jp_wndi)%fnow(ji,jj,1) ) - rn_vfac * pui(ji,jj) )
-               p_tauj(ji,jj) = zcoef_wnorm2 * ( z_wnds_t(ji,jj+1  ) + z_wnds_t(ji,jj) )                          &
-                  &          * ( 0.5 * (sf(jp_wndj)%fnow(ji,jj+1,1) + sf(jp_wndj)%fnow(ji,jj,1) ) - rn_vfac * pvi(ji,jj) )
+               utau_ice(ji,jj) = zcoef_wnorm2 * ( wndm_ice(ji+1,jj  ) + wndm_ice(ji,jj) )                          &
+                  &          * ( 0.5 * (sf(jp_wndi)%fnow(ji+1,jj,1) + sf(jp_wndi)%fnow(ji,jj,1) ) - rn_vfac * u_ice(ji,jj) )
+               vtau_ice(ji,jj) = zcoef_wnorm2 * ( wndm_ice(ji,jj+1  ) + wndm_ice(ji,jj) )                          &
+                  &          * ( 0.5 * (sf(jp_wndj)%fnow(ji,jj+1,1) + sf(jp_wndj)%fnow(ji,jj,1) ) - rn_vfac * v_ice(ji,jj) )
             END DO
          END DO
-         CALL lbc_lnk( p_taui  , 'U', -1. )
-         CALL lbc_lnk( p_tauj  , 'V', -1. )
-         CALL lbc_lnk( z_wnds_t, 'T',  1. )
+         CALL lbc_lnk( utau_ice, 'U', -1. )
+         CALL lbc_lnk( vtau_ice, 'V', -1. )
+         CALL lbc_lnk( wndm_ice, 'T',  1. )
          !
       END SELECT
+
+      IF(ln_ctl) THEN
+         CALL prt_ctl(tab2d_1=utau_ice  , clinfo1=' blk_ice_core: utau_ice : ', tab2d_2=vtau_ice  , clinfo2=' vtau_ice : ')
+         CALL prt_ctl(tab2d_1=wndm_ice  , clinfo1=' blk_ice_core: wndm_ice : ')
+      ENDIF
+
+      IF( nn_timing == 1 )  CALL timing_stop('blk_ice_core_tau')
+      
+   END SUBROUTINE blk_ice_core_tau
+
+
+   SUBROUTINE blk_ice_core_flx( ptsu, palb )
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE blk_ice_core_flx  ***
+      !!
+      !! ** Purpose :   provide the surface boundary condition over sea-ice
+      !!
+      !! ** Method  :   compute heat and freshwater exchanged
+      !!                between atmosphere and sea-ice using CORE bulk
+      !!                formulea, ice variables and read atmmospheric fields.
+      !! 
+      !! caution : the net upward water flux has with mm/day unit
+      !!---------------------------------------------------------------------
+      REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   ptsu          ! sea ice surface temperature
+      REAL(wp), DIMENSION(:,:,:), INTENT(in)  ::   palb          ! ice albedo (all skies)
+      !!
+      INTEGER  ::   ji, jj, jl    ! dummy loop indices
+      REAL(wp) ::   zst2, zst3
+      REAL(wp) ::   zcoef_dqlw, zcoef_dqla, zcoef_dqsb
+      REAL(wp) ::   zztmp, z1_lsub                               ! temporary variable
+      !!
+      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_qlw             ! long wave heat flux over ice
+      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_qsb             ! sensible  heat flux over ice
+      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_dqlw            ! long wave heat sensitivity over ice
+      REAL(wp), DIMENSION(:,:,:), POINTER ::   z_dqsb            ! sensible  heat sensitivity over ice
+      REAL(wp), DIMENSION(:,:)  , POINTER ::   zevap, zsnw       ! evaporation and snw distribution after wind blowing (LIM3)
+      !!---------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('blk_ice_core_flx')
+      !
+      CALL wrk_alloc( jpi,jpj,jpl, z_qlw, z_qsb, z_dqlw, z_dqsb ) 
+
+      ! local scalars ( place there for vector optimisation purposes)
+      zcoef_dqlw   = 4.0 * 0.95 * Stef
+      zcoef_dqla   = -Ls * Cice * 11637800. * (-5897.8)
+      zcoef_dqsb   = rhoa * cpa * Cice
 
       zztmp = 1. / ( 1. - albo )
       !                                     ! ========================== !
-      DO jl = 1, ijpl                       !  Loop over ice categories  !
+      DO jl = 1, jpl                        !  Loop over ice categories  !
          !                                  ! ========================== !
          DO jj = 1 , jpj
@@ -539,10 +557,10 @@
                !      I   Radiative FLUXES   !
                ! ----------------------------!
-               zst2 = pst(ji,jj,jl) * pst(ji,jj,jl)
-               zst3 = pst(ji,jj,jl) * zst2
+               zst2 = ptsu(ji,jj,jl) * ptsu(ji,jj,jl)
+               zst3 = ptsu(ji,jj,jl) * zst2
                ! Short Wave (sw)
-               p_qsr(ji,jj,jl) = zztmp * ( 1. - palb(ji,jj,jl) ) * qsr(ji,jj)
+               qsr_ice(ji,jj,jl) = zztmp * ( 1. - palb(ji,jj,jl) ) * qsr(ji,jj)
                ! Long  Wave (lw)
-               z_qlw(ji,jj,jl) = 0.95 * ( sf(jp_qlw)%fnow(ji,jj,1) - Stef * pst(ji,jj,jl) * zst3 ) * tmask(ji,jj,1)
+               z_qlw(ji,jj,jl) = 0.95 * ( sf(jp_qlw)%fnow(ji,jj,1) - Stef * ptsu(ji,jj,jl) * zst3 ) * tmask(ji,jj,1)
                ! lw sensitivity
                z_dqlw(ji,jj,jl) = zcoef_dqlw * zst3                                               
@@ -554,17 +572,17 @@
                ! ... turbulent heat fluxes
                ! Sensible Heat
-               z_qsb(ji,jj,jl) = rhoa * cpa * Cice * z_wnds_t(ji,jj) * ( pst(ji,jj,jl) - sf(jp_tair)%fnow(ji,jj,1) )
+               z_qsb(ji,jj,jl) = rhoa * cpa * Cice * wndm_ice(ji,jj) * ( ptsu(ji,jj,jl) - sf(jp_tair)%fnow(ji,jj,1) )
                ! Latent Heat
-               p_qla(ji,jj,jl) = rn_efac * MAX( 0.e0, rhoa * Ls  * Cice * z_wnds_t(ji,jj)   &                           
-                  &                         * (  11637800. * EXP( -5897.8 / pst(ji,jj,jl) ) / rhoa - sf(jp_humi)%fnow(ji,jj,1)  ) )
-               ! Latent heat sensitivity for ice (Dqla/Dt)
-               IF( p_qla(ji,jj,jl) > 0._wp ) THEN
-                  p_dqla(ji,jj,jl) = rn_efac * zcoef_dqla * z_wnds_t(ji,jj) / ( zst2 ) * EXP( -5897.8 / pst(ji,jj,jl) )
+               qla_ice(ji,jj,jl) = rn_efac * MAX( 0.e0, rhoa * Ls  * Cice * wndm_ice(ji,jj)   &                           
+                  &                         * (  11637800. * EXP( -5897.8 / ptsu(ji,jj,jl) ) / rhoa - sf(jp_humi)%fnow(ji,jj,1)  ) )
+              ! Latent heat sensitivity for ice (Dqla/Dt)
+               IF( qla_ice(ji,jj,jl) > 0._wp ) THEN
+                  dqla_ice(ji,jj,jl) = rn_efac * zcoef_dqla * wndm_ice(ji,jj) / ( zst2 ) * EXP( -5897.8 / ptsu(ji,jj,jl) )
                ELSE
-                  p_dqla(ji,jj,jl) = 0._wp
+                  dqla_ice(ji,jj,jl) = 0._wp
                ENDIF
 
                ! Sensible heat sensitivity (Dqsb_ice/Dtn_ice)
-               z_dqsb(ji,jj,jl) = zcoef_dqsb * z_wnds_t(ji,jj)
+               z_dqsb(ji,jj,jl) = zcoef_dqsb * wndm_ice(ji,jj)
 
                ! ----------------------------!
@@ -572,7 +590,7 @@
                ! ----------------------------!
                ! Downward Non Solar flux
-               p_qns (ji,jj,jl) =     z_qlw (ji,jj,jl) - z_qsb (ji,jj,jl) - p_qla (ji,jj,jl)
+               qns_ice (ji,jj,jl) =     z_qlw (ji,jj,jl) - z_qsb (ji,jj,jl) - qla_ice (ji,jj,jl)
                ! Total non solar heat flux sensitivity for ice
-               p_dqns(ji,jj,jl) = - ( z_dqlw(ji,jj,jl) + z_dqsb(ji,jj,jl) + p_dqla(ji,jj,jl) )
+               dqns_ice(ji,jj,jl) = - ( z_dqlw(ji,jj,jl) + z_dqsb(ji,jj,jl) + dqla_ice(ji,jj,jl) )
             END DO
             !
@@ -581,4 +599,42 @@
       END DO
       !
+      tprecip(:,:) = sf(jp_prec)%fnow(:,:,1) * rn_pfac      ! total precipitation [kg/m2/s]
+      sprecip(:,:) = sf(jp_snow)%fnow(:,:,1) * rn_pfac      ! solid precipitation [kg/m2/s]
+      CALL iom_put( 'snowpre', sprecip * 86400. )                  ! Snow precipitation
+      CALL iom_put( 'precip' , tprecip * 86400. )                  ! Total precipitation
+
+#if defined  key_lim3
+      CALL wrk_alloc( jpi,jpj, zevap, zsnw ) 
+
+      ! --- evaporation --- !
+      z1_lsub = 1._wp / Lsub
+      evap_ice (:,:,:) = qla_ice (:,:,:) * z1_lsub ! sublimation
+      devap_ice(:,:,:) = dqla_ice(:,:,:) * z1_lsub
+      zevap    (:,:)   = emp(:,:) + tprecip(:,:)   ! evaporation over ocean
+
+      ! --- evaporation minus precipitation --- !
+      CALL lim_thd_snwblow( pfrld, zsnw )  ! snow distribution over ice after wind blowing 
+      emp_oce(:,:) = pfrld(:,:) * zevap(:,:) - ( tprecip(:,:) - sprecip(:,:) ) - sprecip(:,:) * (1._wp - zsnw )
+      emp_ice(:,:) = SUM( a_i_b(:,:,:) * evap_ice(:,:,:), dim=3 ) - sprecip(:,:) * zsnw
+      emp_tot(:,:) = emp_oce(:,:) + emp_ice(:,:)
+
+      ! --- heat flux associated with emp --- !
+      qemp_oce(:,:) = - pfrld(:,:) * zevap(:,:) * sst_m(:,:) * rcp                               & ! evap
+         &          + ( tprecip(:,:) - sprecip(:,:) ) * ( sf(jp_tair)%fnow(:,:,1) - rt0 ) * rcp  & ! liquid precip
+         &          +   sprecip(:,:) * ( 1._wp - zsnw ) *                                        & ! solid precip
+         &              ( ( MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow ) - rt0 ) * cpic * tmask(:,:,1) - lfus )
+      qemp_ice(:,:) =   sprecip(:,:) * zsnw *                                                    & ! solid precip (only)
+         &              ( ( MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow ) - rt0 ) * cpic * tmask(:,:,1) - lfus )
+
+      ! --- total solar and non solar fluxes --- !
+      qns_tot(:,:) = pfrld(:,:) * qns_oce(:,:) + SUM( a_i_b(:,:,:) * qns_ice(:,:,:), dim=3 ) + qemp_ice(:,:) + qemp_oce(:,:)
+      qsr_tot(:,:) = pfrld(:,:) * qsr_oce(:,:) + SUM( a_i_b(:,:,:) * qsr_ice(:,:,:), dim=3 )
+
+      ! --- heat content of precip over ice in J/m3 (to be used in 1D-thermo) --- !
+      qprec_ice(:,:) = rhosn * ( ( MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow ) - rt0 ) * cpic * tmask(:,:,1) - lfus )
+
+      CALL wrk_dealloc( jpi,jpj, zevap, zsnw ) 
+#endif
+
       !--------------------------------------------------------------------
       ! FRACTIONs of net shortwave radiation which is not absorbed in the
@@ -586,29 +642,23 @@
       ! ( Maykut and Untersteiner, 1971 ; Ebert and Curry, 1993 )
       !
-      p_fr1(:,:) = ( 0.18 * ( 1.0 - cldf_ice ) + 0.35 * cldf_ice )
-      p_fr2(:,:) = ( 0.82 * ( 1.0 - cldf_ice ) + 0.65 * cldf_ice )
-      !
-      p_tpr(:,:) = sf(jp_prec)%fnow(:,:,1) * rn_pfac      ! total precipitation [kg/m2/s]
-      p_spr(:,:) = sf(jp_snow)%fnow(:,:,1) * rn_pfac      ! solid precipitation [kg/m2/s]
-      CALL iom_put( 'snowpre', p_spr * 86400. )                  ! Snow precipitation
-      CALL iom_put( 'precip' , p_tpr * 86400. )                  ! Total precipitation
+      fr1_i0(:,:) = ( 0.18 * ( 1.0 - cldf_ice ) + 0.35 * cldf_ice )
+      fr2_i0(:,:) = ( 0.82 * ( 1.0 - cldf_ice ) + 0.65 * cldf_ice )
+      !
       !
       IF(ln_ctl) THEN
-         CALL prt_ctl(tab3d_1=p_qla   , clinfo1=' blk_ice_core: p_qla  : ', tab3d_2=z_qsb   , clinfo2=' z_qsb  : ', kdim=ijpl)
-         CALL prt_ctl(tab3d_1=z_qlw   , clinfo1=' blk_ice_core: z_qlw  : ', tab3d_2=p_dqla  , clinfo2=' p_dqla : ', kdim=ijpl)
-         CALL prt_ctl(tab3d_1=z_dqsb  , clinfo1=' blk_ice_core: z_dqsb : ', tab3d_2=z_dqlw  , clinfo2=' z_dqlw : ', kdim=ijpl)
-         CALL prt_ctl(tab3d_1=p_dqns  , clinfo1=' blk_ice_core: p_dqns : ', tab3d_2=p_qsr   , clinfo2=' p_qsr  : ', kdim=ijpl)
-         CALL prt_ctl(tab3d_1=pst     , clinfo1=' blk_ice_core: pst    : ', tab3d_2=p_qns   , clinfo2=' p_qns  : ', kdim=ijpl)
-         CALL prt_ctl(tab2d_1=p_tpr   , clinfo1=' blk_ice_core: p_tpr  : ', tab2d_2=p_spr   , clinfo2=' p_spr  : ')
-         CALL prt_ctl(tab2d_1=p_taui  , clinfo1=' blk_ice_core: p_taui : ', tab2d_2=p_tauj  , clinfo2=' p_tauj : ')
-         CALL prt_ctl(tab2d_1=z_wnds_t, clinfo1=' blk_ice_core: z_wnds_t : ')
+         CALL prt_ctl(tab3d_1=qla_ice , clinfo1=' blk_ice_core: qla_ice  : ', tab3d_2=z_qsb   , clinfo2=' z_qsb    : ', kdim=jpl)
+         CALL prt_ctl(tab3d_1=z_qlw   , clinfo1=' blk_ice_core: z_qlw    : ', tab3d_2=dqla_ice, clinfo2=' dqla_ice : ', kdim=jpl)
+         CALL prt_ctl(tab3d_1=z_dqsb  , clinfo1=' blk_ice_core: z_dqsb   : ', tab3d_2=z_dqlw  , clinfo2=' z_dqlw   : ', kdim=jpl)
+         CALL prt_ctl(tab3d_1=dqns_ice, clinfo1=' blk_ice_core: dqns_ice : ', tab3d_2=qsr_ice , clinfo2=' qsr_ice  : ', kdim=jpl)
+         CALL prt_ctl(tab3d_1=ptsu    , clinfo1=' blk_ice_core: ptsu     : ', tab3d_2=qns_ice , clinfo2=' qns_ice  : ', kdim=jpl)
+         CALL prt_ctl(tab2d_1=tprecip , clinfo1=' blk_ice_core: tprecip  : ', tab2d_2=sprecip , clinfo2=' sprecip  : ')
       ENDIF
 
-      CALL wrk_dealloc( jpi,jpj,   z_wnds_t )
-      CALL wrk_dealloc( jpi,jpj,   pdim, z_qlw, z_qsb, z_dqlw, z_dqsb )
-      !
-      IF( nn_timing == 1 )  CALL timing_stop('blk_ice_core')
-      !
-   END SUBROUTINE blk_ice_core
+      CALL wrk_dealloc( jpi,jpj,jpl, z_qlw, z_qsb, z_dqlw, z_dqsb )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('blk_ice_core_flx')
+      
+   END SUBROUTINE blk_ice_core_flx
+#endif
 
 
Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 5357)
@@ -48,4 +48,8 @@
    USE ice_domain_size, only: ncat
 #endif
+#if defined key_lim3
+   USE limthd_dh       ! for CALL lim_thd_snwblow
+#endif
+
    IMPLICIT NONE
    PRIVATE
@@ -1359,4 +1363,5 @@
       REAL(wp), POINTER, DIMENSION(:,:  ) ::   zemp_tot, zemp_ice, zsprecip, ztprecip, zqns_tot, zqsr_tot
       REAL(wp), POINTER, DIMENSION(:,:,:) ::   zqns_ice, zqsr_ice, zdqns_ice
+      REAL(wp), POINTER, DIMENSION(:,:  ) ::   zevap, zsnw, zqns_oce, zqprec_ice, zqemp_oce ! for LIM3
       !!----------------------------------------------------------------------
       !
@@ -1469,11 +1474,4 @@
             &                                                   +          pist(:,:,1)   * zicefr(:,:) ) )
       END SELECT
-      ztmp(:,:) = p_frld(:,:) * zsprecip(:,:) * lfus
-      zqns_tot(:,:) = zqns_tot(:,:)                       &            ! zqns_tot update over free ocean with:
-         &          - ztmp(:,:)                           &            ! remove the latent heat flux of solid precip. melting
-         &          - (  zemp_tot(:,:)                    &            ! remove the heat content of mass flux (assumed to be at SST)
-         &             - zemp_ice(:,:) * zicefr(:,:)  ) * zcptn(:,:) 
-      IF( iom_use('hflx_snow_cea') )   &
-         CALL iom_put( 'hflx_snow_cea', ztmp + sprecip(:,:) * zcptn(:,:) )   ! heat flux from snow (cell average)
 !!gm
 !!    currently it is taken into account in leads budget but not in the zqns_tot, and thus not in 
@@ -1491,5 +1489,70 @@
       ENDIF
 
+      ztmp(:,:) = p_frld(:,:) * zsprecip(:,:) * lfus
+      IF( iom_use('hflx_snow_cea') )    CALL iom_put( 'hflx_snow_cea', ztmp + sprecip(:,:) * zcptn(:,:) )   ! heat flux from snow (cell average)
+
+#if defined key_lim3
+      CALL wrk_alloc( jpi,jpj, zevap, zsnw, zqns_oce, zqprec_ice, zqemp_oce ) 
+
+      ! --- evaporation --- !
+      ! clem: evap_ice is set to 0 for LIM3 since we still do not know what to do with sublimation
+      ! the problem is: the atm. imposes both mass evaporation and heat removed from the snow/ice
+      !                 but it is incoherent WITH the ice model  
+      DO jl=1,jpl
+         evap_ice(:,:,jl) = 0._wp  ! should be: frcv(jpr_ievp)%z3(:,:,1)
+      ENDDO
+      zevap(:,:) = zemp_tot(:,:) + ztprecip(:,:) ! evaporation over ocean
+
+      ! --- evaporation minus precipitation --- !
+      emp_oce(:,:) = emp_tot(:,:) - emp_ice(:,:)
+
+      ! --- non solar flux over ocean --- !
+      !         note: p_frld cannot be = 0 since we limit the ice concentration to amax
+      zqns_oce = 0._wp
+      WHERE( p_frld /= 0._wp )  zqns_oce(:,:) = ( zqns_tot(:,:) - SUM( a_i * zqns_ice, dim=3 ) ) / p_frld(:,:)
+
+      ! --- heat flux associated with emp --- !
+      CALL lim_thd_snwblow( p_frld, zsnw )  ! snow distribution over ice after wind blowing
+      zqemp_oce(:,:) = -      zevap(:,:)                   * p_frld(:,:)      *   zcptn(:,:)   &      ! evap
+         &             + ( ztprecip(:,:) - zsprecip(:,:) )                    *   zcptn(:,:)   &      ! liquid precip
+         &             +   zsprecip(:,:)                   * ( 1._wp - zsnw ) * ( zcptn(:,:) - lfus ) ! solid precip over ocean
+      qemp_ice(:,:)  = -   frcv(jpr_ievp)%z3(:,:,1)        * zicefr(:,:)      *   zcptn(:,:)   &      ! ice evap
+         &             +   zsprecip(:,:)                   * zsnw             * ( zcptn(:,:) - lfus ) ! solid precip over ice
+
+      ! --- heat content of precip over ice in J/m3 (to be used in 1D-thermo) --- !
+      zqprec_ice(:,:) = rhosn * ( zcptn(:,:) - lfus )
+
+      ! --- total non solar flux --- !
+      zqns_tot(:,:) = zqns_tot(:,:) + qemp_ice(:,:) + zqemp_oce(:,:)
+
+      ! --- in case both coupled/forced are active, we must mix values --- ! 
       IF( ln_mixcpl ) THEN
+         qns_tot(:,:) = qns_tot(:,:) * xcplmask(:,:,0) + zqns_tot(:,:)* zmsk(:,:)
+         qns_oce(:,:) = qns_oce(:,:) * xcplmask(:,:,0) + zqns_oce(:,:)* zmsk(:,:)
+         DO jl=1,jpl
+            qns_ice(:,:,jl) = qns_ice(:,:,jl) * xcplmask(:,:,0) +  zqns_ice(:,:,jl)* zmsk(:,:)
+         ENDDO
+         qprec_ice(:,:) = qprec_ice(:,:) * xcplmask(:,:,0) + zqprec_ice(:,:)* zmsk(:,:)
+         qemp_oce(:,:) = qemp_oce(:,:) * xcplmask(:,:,0) + zqemp_oce(:,:)* zmsk(:,:)
+!!clem         evap_ice(:,:) = evap_ice(:,:) * xcplmask(:,:,0)
+      ELSE
+         qns_tot  (:,:  ) = zqns_tot  (:,:  )
+         qns_oce  (:,:  ) = zqns_oce  (:,:  )
+         qns_ice  (:,:,:) = zqns_ice  (:,:,:)
+         qprec_ice(:,:)   = zqprec_ice(:,:)
+         qemp_oce (:,:)   = zqemp_oce (:,:)
+      ENDIF
+
+      CALL wrk_dealloc( jpi,jpj, zevap, zsnw, zqns_oce, zqprec_ice, zqemp_oce ) 
+
+#else
+
+      ! clem: this formulation is certainly wrong.
+      zqns_tot(:,:) = zqns_tot(:,:)                       &            ! zqns_tot update over free ocean with:
+         &          - ztmp(:,:)                           &            ! remove the latent heat flux of solid precip. melting
+         &          - (  zemp_tot(:,:)                    &            ! remove the heat content of mass flux (assumed to be at SST)
+         &             - zemp_ice(:,:) * zicefr(:,:)  ) * zcptn(:,:) 
+
+     IF( ln_mixcpl ) THEN
          qns_tot(:,:) = qns(:,:) * p_frld(:,:) + SUM( qns_ice(:,:,:) * a_i(:,:,:), dim=3 )   ! total flux from blk
          qns_tot(:,:) = qns_tot(:,:) * xcplmask(:,:,0) +  zqns_tot(:,:)* zmsk(:,:)
@@ -1501,4 +1564,6 @@
          qns_ice(:,:,:) = zqns_ice(:,:,:)
       ENDIF
+
+#endif
 
       !                                                      ! ========================= !
Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90	(revision 5357)
@@ -116,4 +116,5 @@
 
       IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN     !  Ice time-step only
+
          !-----------------------!                                           
          ! --- Bulk Formulae --- !                                           
@@ -125,19 +126,16 @@
          t_bo(:,:) = ( eos_fzp( sss_m ) + rt0 ) * tmask(:,:,1) + rt0 * ( 1._wp - tmask(:,:,1) )  
          !                                                                                      
-         ! Ice albedo
-         CALL wrk_alloc( jpi,jpj    , zutau_ice, zvtau_ice)
-         CALL wrk_alloc( jpi,jpj,jpl, zalb_os, zalb_cs, zalb_ice )
-         CALL albedo_ice( t_su, ht_i, ht_s, zalb_cs, zalb_os )  ! cloud-sky and overcast-sky ice albedos
-
-         ! CORE and COUPLED bulk formulations
-         SELECT CASE( kblk )
-         CASE( jp_core , jp_cpl )
-
-            ! albedo depends on cloud fraction because of non-linear spectral effects
-            zalb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:)
-            ! In CLIO the cloud fraction is read in the climatology and the all-sky albedo 
-            ! (zalb_ice) is computed within the bulk routine
-            
-         END SELECT
+!!clem         ! Ice albedo
+!!clem         CALL wrk_alloc( jpi,jpj,jpl, zalb_os, zalb_cs, zalb_ice )
+!!clem         CALL albedo_ice( t_su, ht_i, ht_s, zalb_cs, zalb_os )  ! cloud-sky and overcast-sky ice albedos
+!!
+!!         ! CORE and COUPLED bulk formulations
+!!         SELECT CASE( kblk )
+!!         CASE( jp_core , jp_cpl )
+!!            ! albedo depends on cloud fraction because of non-linear spectral effects
+!!            zalb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:)
+!!            ! In CLIO the cloud fraction is read in the climatology and the all-sky albedo 
+!!            ! (zalb_ice) is computed within the bulk routine
+!!clem         END SELECT
          
          ! Mask sea ice surface temperature (set to rt0 over land)
@@ -156,22 +154,23 @@
          SELECT CASE( kblk )
          CASE( jp_clio )                                       ! CLIO bulk formulation
-            CALL blk_ice_clio( t_su , zalb_cs    , zalb_os    , zalb_ice  ,               &
-               &                      utau_ice   , vtau_ice   , qns_ice   , qsr_ice   ,   &
-               &                      qla_ice    , dqns_ice   , dqla_ice  ,               &
-               &                      tprecip    , sprecip    ,                           &
-               &                      fr1_i0     , fr2_i0     , cp_ice_msh, jpl  )
-            !         
-            IF( nn_limflx /= 2 )   CALL ice_lim_flx( t_su, zalb_ice, qns_ice, qsr_ice ,   &
-               &                                           dqns_ice, qla_ice, dqla_ice, nn_limflx )
+!!clem            CALL blk_ice_clio( t_su , zalb_cs    , zalb_os    , zalb_ice  ,               &
+!!               &                      utau_ice   , vtau_ice   , qns_ice   , qsr_ice   ,   &
+!!               &                      qla_ice    , dqns_ice   , dqla_ice  ,               &
+!!               &                      tprecip    , sprecip    ,                           &
+!!               &                      fr1_i0     , fr2_i0     , cp_ice_msh, jpl  )
+!!            !         
+!!            IF( nn_limflx /= 2 )   CALL ice_lim_flx( t_su, zalb_ice, qns_ice, qsr_ice ,   &
+!!               &                                           dqns_ice, qla_ice, dqla_ice, nn_limflx )
+            CALL blk_ice_clio_tau( utau_ice, vtau_ice, cp_ice_msh )
 
          CASE( jp_core )                                       ! CORE bulk formulation
-            CALL blk_ice_core( t_su , u_ice     , v_ice     , zalb_ice   ,               &
-               &                      utau_ice  , vtau_ice  , qns_ice    , qsr_ice   ,   &
-               &                      qla_ice   , dqns_ice  , dqla_ice   ,               &
-               &                      tprecip   , sprecip   ,                            &
-               &                      fr1_i0    , fr2_i0    , cp_ice_msh, jpl  )
-               !
-            IF( nn_limflx /= 2 )   CALL ice_lim_flx( t_su, zalb_ice, qns_ice, qsr_ice ,   &
-               &                                           dqns_ice, qla_ice, dqla_ice, nn_limflx )
+!!clem            CALL blk_ice_core( t_su , u_ice     , v_ice     , zalb_ice   ,               &
+!!clem               &                      utau_ice  , vtau_ice  , qns_ice    , qsr_ice   ,   &
+!!clem               &                      qla_ice   , dqns_ice  , dqla_ice   ,               &
+!!clem               &                      tprecip   , sprecip   ,                            &
+!!clem               &                      fr1_i0    , fr2_i0    , cp_ice_msh, jpl  )
+!!clem            IF( nn_limflx /= 2 )   CALL ice_lim_flx( t_su, zalb_ice, qns_ice, qsr_ice ,   &
+!!clem               &                                           dqns_ice, qla_ice, dqla_ice, nn_limflx )
+            CALL blk_ice_core_tau
             !
          CASE ( jp_cpl )
@@ -182,7 +181,9 @@
          
          IF( ln_mixcpl) THEN
+            CALL wrk_alloc( jpi,jpj    , zutau_ice, zvtau_ice)
             CALL sbc_cpl_ice_tau( zutau_ice , zvtau_ice )
             utau_ice(:,:) = utau_ice(:,:) * xcplmask(:,:,0) + zutau_ice(:,:) * ( 1. - xcplmask(:,:,0) )
             vtau_ice(:,:) = vtau_ice(:,:) * xcplmask(:,:,0) + zvtau_ice(:,:) * ( 1. - xcplmask(:,:,0) )
+            CALL wrk_dealloc( jpi,jpj  , zutau_ice, zvtau_ice)
          ENDIF
 
@@ -229,13 +230,39 @@
          phicif(:,:)  = vt_i(:,:)
          
+         ! Ice albedo
+         CALL wrk_alloc( jpi,jpj,jpl, zalb_os, zalb_cs, zalb_ice )
+         CALL albedo_ice( t_su, ht_i, ht_s, zalb_cs, zalb_os )  ! cloud-sky and overcast-sky ice albedos
+ 
          SELECT CASE( kblk )
+         CASE( jp_clio )                                       ! CLIO bulk formulation
+            ! In CLIO the cloud fraction is read in the climatology and the all-sky albedo 
+            ! (zalb_ice) is computed within the bulk routine
+            CALL blk_ice_clio_flx( t_su , zalb_cs, zalb_os  , zalb_ice, qns_ice   , qsr_ice   ,    &
+               &                      qla_ice, dqns_ice   , dqla_ice  , tprecip, sprecip    ,  &
+               &                      fr1_i0     , fr2_i0     , jpl  )
+            !         
+            IF( nn_limflx /= 2 )   CALL ice_lim_flx( t_su, zalb_ice, qns_ice, qsr_ice ,   &
+               &                                           dqns_ice, evap_ice, devap_ice, nn_limflx )
+
+         CASE( jp_core )                                       ! CORE bulk formulation
+            ! albedo depends on cloud fraction because of non-linear spectral effects
+            zalb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:)
+            CALL blk_ice_core_flx( t_su, zalb_ice )
+            IF( nn_limflx /= 2 )   CALL ice_lim_flx( t_su, zalb_ice, qns_ice, qsr_ice ,   &
+               &                                           dqns_ice, evap_ice, devap_ice, nn_limflx )
+
          CASE ( jp_cpl )
+            ! albedo depends on cloud fraction because of non-linear spectral effects
+            zalb_ice(:,:,:) = ( 1. - cldf_ice ) * zalb_cs(:,:,:) + cldf_ice * zalb_os(:,:,:)
             CALL sbc_cpl_ice_flx( p_frld=pfrld, palbi=zalb_ice, psst=sst_m, pist=t_su    )
             IF( nn_limflx == 2 )   CALL ice_lim_flx( t_su, zalb_ice, qns_ice, qsr_ice ,   &
-               &                                           dqns_ice, qla_ice, dqla_ice, nn_limflx )
+               &                                           dqns_ice, evap_ice, devap_ice, nn_limflx )
             ! Latent heat flux is forced to 0 in coupled: it is included in qns (non-solar heat flux)
-            qla_ice  (:,:,:) = 0._wp
-            dqla_ice (:,:,:) = 0._wp
+            evap_ice  (:,:,:) = 0._wp
+            devap_ice (:,:,:) = 0._wp
+
          END SELECT
+         CALL wrk_dealloc( jpi,jpj,jpl, zalb_os, zalb_cs, zalb_ice )
+
          !
          CALL lim_thd( kt )                         ! Ice thermodynamics 
@@ -256,6 +283,4 @@
          IF( ln_icectl )  CALL lim_ctl( kt )        ! alerts in case of model crash
          !
-         CALL wrk_dealloc( jpi,jpj  , zutau_ice, zvtau_ice)
-         CALL wrk_dealloc( jpi,jpj,jpl, zalb_os, zalb_cs, zalb_ice )
          !
       ENDIF   ! End sea-ice time step only
@@ -486,5 +511,5 @@
    
    SUBROUTINE ice_lim_flx( ptn_ice, palb_ice, pqns_ice, pqsr_ice,   &
-         &                          pdqn_ice, pqla_ice, pdql_ice, k_limflx )
+         &                          pdqn_ice, pevap_ice, pdevap_ice, k_limflx )
       !!---------------------------------------------------------------------
       !!                  ***  ROUTINE ice_lim_flx  ***
@@ -504,6 +529,6 @@
       REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pqsr_ice   ! net solar flux
       REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pdqn_ice   ! non solar flux sensitivity
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pqla_ice   ! latent heat flux
-      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pdql_ice   ! latent heat flux sensitivity
+      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pevap_ice  ! sublimation
+      REAL(wp), DIMENSION(:,:,:), INTENT(inout) ::   pdevap_ice ! sublimation sensitivity
       !
       INTEGER  ::   jl      ! dummy loop index
@@ -514,7 +539,7 @@
       REAL(wp), POINTER, DIMENSION(:,:) :: z_qsr_m   ! Mean solar heat flux over all categories
       REAL(wp), POINTER, DIMENSION(:,:) :: z_qns_m   ! Mean non solar heat flux over all categories
-      REAL(wp), POINTER, DIMENSION(:,:) :: z_qla_m   ! Mean latent heat flux over all categories
+      REAL(wp), POINTER, DIMENSION(:,:) :: z_evap_m  ! Mean sublimation over all categories
       REAL(wp), POINTER, DIMENSION(:,:) :: z_dqn_m   ! Mean d(qns)/dT over all categories
-      REAL(wp), POINTER, DIMENSION(:,:) :: z_dql_m   ! Mean d(qla)/dT over all categories
+      REAL(wp), POINTER, DIMENSION(:,:) :: z_devap_m ! Mean d(evap)/dT over all categories
       !!----------------------------------------------------------------------
 
@@ -524,14 +549,14 @@
       SELECT CASE( k_limflx )                              !==  averaged on all ice categories  ==!
       CASE( 0 , 1 )
-         CALL wrk_alloc( jpi,jpj, z_qsr_m, z_qns_m, z_qla_m, z_dqn_m, z_dql_m)
+         CALL wrk_alloc( jpi,jpj, z_qsr_m, z_qns_m, z_evap_m, z_dqn_m, z_devap_m)
          !
          z_qns_m(:,:) = fice_ice_ave ( pqns_ice (:,:,:) )
          z_qsr_m(:,:) = fice_ice_ave ( pqsr_ice (:,:,:) )
          z_dqn_m(:,:) = fice_ice_ave ( pdqn_ice (:,:,:) )
-         z_qla_m(:,:) = fice_ice_ave ( pqla_ice (:,:,:) )
-         z_dql_m(:,:) = fice_ice_ave ( pdql_ice (:,:,:) )
+         z_evap_m(:,:) = fice_ice_ave ( pevap_ice (:,:,:) )
+         z_devap_m(:,:) = fice_ice_ave ( pdevap_ice (:,:,:) )
          DO jl = 1, jpl
             pdqn_ice(:,:,jl) = z_dqn_m(:,:)
-            pdql_ice(:,:,jl) = z_dql_m(:,:)
+            pdevap_ice(:,:,jl) = z_devap_m(:,:)
          END DO
          !
@@ -539,8 +564,8 @@
             pqns_ice(:,:,jl) = z_qns_m(:,:)
             pqsr_ice(:,:,jl) = z_qsr_m(:,:)
-            pqla_ice(:,:,jl) = z_qla_m(:,:)
+            pevap_ice(:,:,jl) = z_evap_m(:,:)
          END DO
          !
-         CALL wrk_dealloc( jpi,jpj, z_qsr_m, z_qns_m, z_qla_m, z_dqn_m, z_dql_m)
+         CALL wrk_dealloc( jpi,jpj, z_qsr_m, z_qns_m, z_evap_m, z_dqn_m, z_devap_m)
       END SELECT
 
@@ -553,5 +578,5 @@
          DO jl = 1, jpl
             pqns_ice(:,:,jl) = pqns_ice(:,:,jl) + pdqn_ice(:,:,jl) * (ptn_ice(:,:,jl) - ztem_m(:,:))
-            pqla_ice(:,:,jl) = pqla_ice(:,:,jl) + pdql_ice(:,:,jl) * (ptn_ice(:,:,jl) - ztem_m(:,:))
+            pevap_ice(:,:,jl) = pevap_ice(:,:,jl) + pdevap_ice(:,:,jl) * (ptn_ice(:,:,jl) - ztem_m(:,:))
             pqsr_ice(:,:,jl) = pqsr_ice(:,:,jl) * ( 1._wp - palb_ice(:,:,jl) ) / ( 1._wp - zalb_m(:,:) ) 
          END DO
@@ -603,5 +628,4 @@
       wfx_spr(:,:) = 0._wp   ;   
       
-      hfx_in (:,:) = 0._wp   ;   hfx_out(:,:) = 0._wp
       hfx_thd(:,:) = 0._wp   ;   
       hfx_snw(:,:) = 0._wp   ;   hfx_opw(:,:) = 0._wp
@@ -620,5 +644,6 @@
       
    END SUBROUTINE sbc_lim_diag0
-      
+
+     
    FUNCTION fice_cell_ave ( ptab )
       !!--------------------------------------------------------------------------
Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90	(revision 5357)
@@ -192,9 +192,6 @@
 
          CASE( jp_core )           ! CORE bulk formulation
-            CALL blk_ice_core( zsist, u_ice      , v_ice      , zalb_ice   ,            &
-               &                      utau_ice   , vtau_ice   , qns_ice    , qsr_ice,   &
-               &                      qla_ice    , dqns_ice   , dqla_ice   ,            &
-               &                      tprecip    , sprecip    ,                         &
-               &                      fr1_i0     , fr2_i0     , cp_ice_msh , jpl  )
+            CALL blk_ice_core_tau
+            CALL blk_ice_core_flx( zsist, zalb_ice )
             IF( ltrcdm2dc_ice )   CALL blk_ice_meanqsr( zalb_ice, qsr_ice_mean, jpl )
 
Index: /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 5356)
+++ /branches/2015/dev_r5218_CNRS17_coupling/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 5357)
@@ -417,5 +417,6 @@
       !                                                           ! (update freshwater fluxes)
 !RBbug do not understand why see ticket 667
-      !clem-bugsal CALL lbc_lnk( emp, 'T', 1. )
+!clem: it looks like it is necessary for the north fold (in certain circumstances). Don't know why.
+      CALL lbc_lnk( emp, 'T', 1. )
       !
       IF( kt == nit000 ) THEN                          !   set the forcing field at nit000 - 1    !
