Index: trunk/NEMO/LIM_SRC_2/limthd_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limthd_2.F90	(revision 833)
+++ trunk/NEMO/LIM_SRC_2/limthd_2.F90	(revision 888)
@@ -4,4 +4,8 @@
    !!              LIM thermo ice model : ice thermodynamic
    !!======================================================================
+   !! History :  1.0  !  00-01 (LIM)
+   !!            2.0  !  02-07 (C. Ethe, G. Madec) F90
+   !!            2.0  !  03-08 (C. Ethe)  add lim_thd_init
+   !!---------------------------------------------------------------------
 #if defined key_lim2
    !!----------------------------------------------------------------------
@@ -18,5 +22,6 @@
    USE ice_2           ! LIM sea-ice variables
    USE ice_oce         ! sea-ice/ocean variables
-   USE flx_oce         ! sea-ice/ocean forcings variables 
+   USE sbc_oce         ! 
+   USE sbc_ice         ! 
    USE thd_ice_2       ! LIM thermodynamic sea-ice variables
    USE dom_ice_2       ! LIM sea-ice domain
@@ -30,14 +35,11 @@
    PRIVATE
 
-   !! * Routine accessibility
-   PUBLIC lim_thd_2       ! called by lim_step_2
-
-   !! * Module variables
-   REAL(wp)  ::            &  ! constant values
-      epsi20 = 1.e-20   ,  &
-      epsi16 = 1.e-16   ,  &
-      epsi04 = 1.e-04   ,  &
-      zzero  = 0.e0     ,  &
-      zone   = 1.e0
+   PUBLIC   lim_thd_2  ! called by lim_step
+
+   REAL(wp)  ::   epsi20 = 1.e-20   ,  &  ! constant values
+      &           epsi16 = 1.e-16   ,  &
+      &           epsi04 = 1.e-04   ,  &
+      &           zzero  = 0.e0     ,  &
+      &           zone   = 1.e0
 
    !! * Substitutions
@@ -46,6 +48,6 @@
    !!-------- -------------------------------------------------------------
    !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005) 
-   !! $Header$ 
-   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
+   !! $ Id: $
+   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 
@@ -68,13 +70,8 @@
       !!             - back to the geographic grid
       !!
-      !! ** References :
-      !!       H. Goosse et al. 1996, Bul. Soc. Roy. Sc. Liege, 65, 87-90
-      !!
-      !! History :
-      !!   1.0  !  00-01 (LIM)
-      !!   2.0  !  02-07 (C. Ethe, G. Madec) F90
+      !! References :   Goosse et al. 1996, Bul. Soc. Roy. Sc. Liege, 65, 87-90
       !!---------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt     ! number of iteration
-
+      !!
       INTEGER  ::   ji, jj,    &   ! dummy loop indices
          nbpb  ,               &   ! nb of icy pts for thermo. cal.
@@ -92,12 +89,10 @@
          zfontn             ,  &   ! heat flux from snow thickness
          zfntlat, zpareff          ! test. the val. of lead heat budget
-      REAL(wp), DIMENSION(jpi,jpj) :: &
-         zhicifp            ,  &   ! ice thickness for outputs
-         zqlbsbq                   ! link with lead energy budget qldif
-      REAL(wp), DIMENSION(jpi,jpj,jpk) :: &
-         zmsk                      ! working array
+      REAL(wp), DIMENSION(jpi,jpj) ::   zhicifp,   &  ! ice thickness for outputs
+         &                              zqlbsbq       ! link with lead energy budget qldif
+      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zmsk      ! working array
       !!-------------------------------------------------------------------
 
-      IF( kt == nit000  )   CALL lim_thd_init_2  ! Initialization (first time-step only)
+      IF( kt == nit000 )   CALL lim_thd_init_2  ! Initialization (first time-step only)
    
       !-------------------------------------------!
@@ -173,4 +168,6 @@
       !--------------------------------------------------------------------------
 
+      sst_m(:,:) = sst_m(:,:) + rt0
+
       !CDIR NOVERRCHK
       DO jj = 1, jpj
@@ -188,11 +185,11 @@
             !  temperature and turbulent mixing (McPhee, 1992)
             zfric_u        = MAX ( MIN( SQRT( ust2s(ji,jj) ) , zfric_umax ) , zfric_umin )  ! friction velocity
-            fdtcn(ji,jj)  = zindb * rau0 * rcp * 0.006  * zfric_u * ( sst_io(ji,jj) - tfu(ji,jj) ) 
+            fdtcn(ji,jj)  = zindb * rau0 * rcp * 0.006  * zfric_u * ( sst_m(ji,jj) - tfu(ji,jj) ) 
             qdtcn(ji,jj)  = zindb * fdtcn(ji,jj) * frld(ji,jj) * rdt_ice
                         
             !  partial computation of the lead energy budget (qldif)
             zfontn         = ( sprecip(ji,jj) / rhosn ) * xlsn  !   energy for melting
-            zfnsol         = qnsr_oce(ji,jj)  !  total non solar flux
-            qldif(ji,jj)   = tms(ji,jj) * ( qsr_oce(ji,jj) * ( 1.0 - thcm(ji,jj) )   &
+            zfnsol         = qns(ji,jj)                         !  total non solar flux over the ocean
+            qldif(ji,jj)   = tms(ji,jj) * ( qsr(ji,jj) * ( 1.0 - thcm(ji,jj) )   &
                &                               + zfnsol + fdtcn(ji,jj) - zfontn     &
                &                               + ( 1.0 - zindb ) * fsbbq(ji,jj) )   &
@@ -206,5 +203,5 @@
             
             !  energy needed to bring ocean surface layer until its freezing
-            qcmif  (ji,jj) =  rau0 * rcp * fse3t(ji,jj,1) * ( tfu(ji,jj) - sst_io(ji,jj) ) * ( 1 - zinda )
+            qcmif  (ji,jj) =  rau0 * rcp * fse3t(ji,jj,1) * ( tfu(ji,jj) - sst_m(ji,jj) ) * ( 1 - zinda )
             
             !  calculate oceanic heat flux.
@@ -216,4 +213,5 @@
       END DO
       
+      sst_m(:,:) = sst_m(:,:) - rt0
       
       !         Select icy points and fulfill arrays for the vectorial grid.
@@ -258,5 +256,5 @@
          CALL tab_2d_1d_2( nbpb, fr1_i0_1d  (1:nbpb)     , fr1_i0     , jpi, jpj, npb(1:nbpb) )
          CALL tab_2d_1d_2( nbpb, fr2_i0_1d  (1:nbpb)     , fr2_i0     , jpi, jpj, npb(1:nbpb) )
-         CALL tab_2d_1d_2( nbpb, qnsr_ice_1d(1:nbpb)     , qnsr_ice   , jpi, jpj, npb(1:nbpb) )
+         CALL tab_2d_1d_2( nbpb, qns_ice_1d (1:nbpb)     , qns_ice    , jpi, jpj, npb(1:nbpb) )
 #if ! defined key_coupled
          CALL tab_2d_1d_2( nbpb, qla_ice_1d (1:nbpb)     , qla_ice    , jpi, jpj, npb(1:nbpb) )
@@ -404,5 +402,5 @@
          CALL prt_ctl(tab2d_1=qstoif, clinfo1=' lim_thd: qstoif  : ', tab2d_2=fsbbq , clinfo2=' fsbbq  : ')
       ENDIF
-
+       !
     END SUBROUTINE lim_thd_2
 
@@ -419,7 +417,4 @@
       !!
       !! ** input   :   Namelist namicether
-      !!
-      !! history :
-      !!  8.5  ! 03-08 (C. Ethe) original code
       !!-------------------------------------------------------------------
       NAMELIST/namicethd/ hmelt , hiccrit, hicmin, hiclim, amax  ,        &
