Index: branches/2012/dev_NOC_2012_rev3555/DOC/TexFiles/Chapters/Chap_SBC.tex
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/DOC/TexFiles/Chapters/Chap_SBC.tex	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/DOC/TexFiles/Chapters/Chap_SBC.tex	(revision 3625)
@@ -1146,5 +1146,5 @@
 \label{SBC_cice}
 
-It is now possible to couple a global NEMO configuration (without AGRIF) to the CICE sea-ice
+It is now possible to couple a regional or global NEMO configuration (without AGRIF) to the CICE sea-ice
 model by using \key{cice}.  The CICE code can be obtained from 
 \href{http://oceans11.lanl.gov/trac/CICE/}{LANL} and the additional 'hadgem3' drivers will be required, 
Index: branches/2012/dev_NOC_2012_rev3555/DOC/TexFiles/Chapters/Introduction.tex
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/DOC/TexFiles/Chapters/Introduction.tex	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/DOC/TexFiles/Chapters/Introduction.tex	(revision 3625)
@@ -63,6 +63,7 @@
 \citep{OASIS2006}. Two-way nesting is also available through an interface to the
 AGRIF package (Adaptative Grid Refinement in \textsc{Fortran}) \citep{Debreu_al_CG2008}.
-The interface code for coupling to an alternative sea ice model (CICE, \citet{Hunke2008}) is now 
-available although this is currently only designed for global domains, without the use of AGRIF.
+The interface code for coupling to an alternative sea ice model (CICE, \citet{Hunke2008})
+has now been upgraded so that it works for both global and regional domains, although AGRIF 
+is still not available.
 
 Other model characteristics are the lateral boundary conditions (chapter~\ref{LBC}).  
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/AMM12/EXP00/namelist
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/AMM12/EXP00/namelist	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/AMM12/EXP00/namelist	(revision 3625)
@@ -137,4 +137,7 @@
                            !  =1 use observed ice-cover      ,
                            !  =2 ice-model used                         ("key_lim3" or "key_lim2)
+   nn_ice_embd = 0         !  =0 levitating ice (no mass exchange, concentration/dilution effect)
+                           !  =1 levitating ice with mass and salt exchange but no presure effect
+                           !  =2 embedded sea-ice (full salt and mass exchanges and pressure)
    ln_dm2dc    = .false.   !  daily mean to diurnal cycle on short wave
    ln_rnf      = .true.    !  runoffs                                   (T => fill namsbc_rnf)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/AMM12_PISCES/EXP00/namelist
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/AMM12_PISCES/EXP00/namelist	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/AMM12_PISCES/EXP00/namelist	(revision 3625)
@@ -137,4 +137,7 @@
                            !  =1 use observed ice-cover      ,
                            !  =2 ice-model used                         ("key_lim3" or "key_lim2)
+   nn_ice_embd = 0         !  =0 levitating ice (no mass exchange, concentration/dilution effect)
+                           !  =1 levitating ice with mass and salt exchange but no presure effect
+                           !  =2 embedded sea-ice (full salt and mass exchanges and pressure)
    ln_dm2dc    = .false.   !  daily mean to diurnal cycle on short wave
    ln_rnf      = .true.    !  runoffs                                   (T => fill namsbc_rnf)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/GYRE/EXP00/namelist
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/GYRE/EXP00/namelist	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/GYRE/EXP00/namelist	(revision 3625)
@@ -137,4 +137,7 @@
                            !  =1 use observed ice-cover      ,
                            !  =2 ice-model used                         ("key_lim3" or "key_lim2)
+   nn_ice_embd = 0         !  =0 levitating ice (no mass exchange, concentration/dilution effect)
+                           !  =1 levitating ice with mass and salt exchange but no presure effect
+                           !  =2 embedded sea-ice (full salt and mass exchanges and pressure)
    ln_dm2dc    = .false.   !  daily mean to diurnal cycle on short wave
    ln_rnf      = .false.   !  runoffs                                   (T => fill namsbc_rnf)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef.xml
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef.xml	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/iodef.xml	(revision 3625)
@@ -124,5 +124,5 @@
 
 	<field id="empmr"        description="Net Upward Water Flux"                                        unit="kg/m2/s"  />
-	<field id="empsmr"       description="concentration/dilution water flux"                            unit="kg/m2/s"  />
+	<field id="saltflx"      description="Downward Salt Flux"                                           unit="PSU/m2/s" />
 	<field id="snowpre"      description="Snow precipitation"                                           unit="kg/m2/s"  />
 	<field id="runoffs"      description="River Runoffs"                                                unit="Kg/m2/s"  />
@@ -145,4 +145,5 @@
 	<field id="qsb_oce"      description="Sensible Downward Heat Flux over open ocean"                  unit="W/m2"     />
 	<field id="qla_oce"      description="Latent Downward Heat Flux over open ocean"                    unit="W/m2"     />
+	<field id="qhc_oce"      description="Downward Heat Content of E-P over open ocean"                 unit="W/m2"     />
 	<field id="taum_oce"     description="wind stress module over open ocean"                           unit="N/m2"     />
 
@@ -173,4 +174,7 @@
 	<field id="v_imasstr"    description="Sea-ice mass transport along j-axis"                          unit="kg/s"     />
 
+	<!-- available if not defined key_vvl -->
+	<field id="emp_x_sst"      description="Concentration/Dilution term on SST"                         unit="kgC/m2/s" />
+	<field id="emp_x_sss"      description="Concentration/Dilution term on SSS"                       unit="kgPSU/m2/s" />
 	<!-- available key_coupled -->
 	<field id="snow_ao_cea"  description="Snow over ice-free ocean (cell average)"                      unit="kg/m2/s"  />
@@ -1016,5 +1020,5 @@
 	  <field ref="empmr"        name="sowaflup"  />
 	  <field ref="qsr"          name="soshfldo"  />
-	  <field ref="empsmr"       name="sowaflcd"  />
+	  <field ref="saltflx"      name="sosfldow"  />
 	  <field ref="qt"           name="sohefldo"  />
 	  <field ref="mldr10_1"     name="somxl010"  />
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/ORCA2_LIM/EXP00/namelist	(revision 3625)
@@ -137,4 +137,7 @@
                            !  =1 use observed ice-cover      ,
                            !  =2 ice-model used                         ("key_lim3" or "key_lim2)
+   nn_ice_embd = 0         !  =0 levitating ice (no mass exchange, concentration/dilution effect)
+                           !  =1 levitating ice with mass and salt exchange but no presure effect
+                           !  =2 embedded sea-ice (full salt and mass exchanges and pressure)
    ln_dm2dc    = .false.   !  daily mean to diurnal cycle on short wave
    ln_rnf      = .true.    !  runoffs                                   (T => fill namsbc_rnf)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/CONFIG/ORCA2_OFF_PISCES/EXP00/namelist	(revision 3625)
@@ -137,4 +137,7 @@
                            !  =1 use observed ice-cover      ,
                            !  =2 ice-model used                         ("key_lim3" or "key_lim2)
+   nn_ice_embd = 0         !  =0 levitating ice (no mass exchange, concentration/dilution effect)
+                           !  =1 levitating ice with mass and salt exchange but no presure effect
+                           !  =2 embedded sea-ice (full salt and mass exchanges and pressure)
    ln_dm2dc    = .false.   !  daily mean to diurnal cycle on short wave
    ln_rnf      = .true.    !  runoffs                                   (T => fill namsbc_rnf)
@@ -650,4 +653,6 @@
    sn_mld  = 'dyna_grid_T' ,    120            , 'somixhgt' ,  .true.    , .true. ,   'yearly'  , ''       , ''
    sn_emp  = 'dyna_grid_T' ,    120            , 'sowaflcd' ,  .true.    , .true. ,   'yearly'  , ''       , ''
+!  sn_emp  = 'dyna_grid_T' ,    120            , 'sowaflup' ,  .true.    , .true. ,   'yearly'  , ''       , '' ! v3.5+
+!  sn_sfx  = 'dyna_grid_T' ,    120            , 'sosfldow' ,  .true.    , .true. ,   'yearly'  , ''       , '' ! v3.5+
    sn_ice  = 'dyna_grid_T' ,    120            , 'soicecov' ,  .true.    , .true. ,   'yearly'  , ''       , ''
    sn_qsr  = 'dyna_grid_T' ,    120            , 'soshfldo' ,  .true.    , .true. ,   'yearly'  , ''       , ''
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/ice_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/ice_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/ice_2.F90	(revision 3625)
@@ -19,6 +19,6 @@
    PUBLIC    ice_alloc_2  !  Called in iceini_2.F90
 
-   INTEGER , PUBLIC ::   numit     !: ice iteration index
-   REAL(wp), PUBLIC ::   rdt_ice   !: ice time step
+   INTEGER , PUBLIC ::   numit        !: ice iteration index
+   REAL(wp), PUBLIC ::   rdt_ice      !: ice time step
 
    !                                                                     !!* namicerun read in iceini  *
@@ -98,6 +98,8 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qstoif        !: Energy stored in the brine pockets
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fbif          !: Heat flux at the ice base
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdmsnif       !: Variation of snow mass
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdmicif       !: Variation of ice mass
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdm_snw       !: Variation of snow mass over 1 time step           [Kg/m2]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdq_snw       !: Heat content associated with rdm_snw              [J/m2]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdm_ice       !: Variation of ice  mass over 1 time step           [Kg/m2]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdq_ice       !: Heat content associated with rdm_ice              [J/m2]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qldif         !: heat balance of the lead (or of the open ocean)
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qcmif         !: Energy needed to freeze the ocean surface layer
@@ -153,5 +155,6 @@
 
       ALLOCATE(phicif(jpi,jpj) , pfrld  (jpi,jpj) , qstoif (jpi,jpj) ,     &
-         &     fbif  (jpi,jpj) , rdmsnif(jpi,jpj) , rdmicif(jpi,jpj) ,     &
+         &     fbif  (jpi,jpj) , rdm_snw(jpi,jpj) , rdq_snw(jpi,jpj) ,     &
+         &                       rdm_ice(jpi,jpj) , rdq_ice(jpi,jpj) ,     &
          &     qldif (jpi,jpj) , qcmif  (jpi,jpj) , fdtcn  (jpi,jpj) ,     &
          &     qdtcn (jpi,jpj) , thcm   (jpi,jpj)                    , STAT=ierr(4) )
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/iceini_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/iceini_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/iceini_2.F90	(revision 3625)
@@ -13,21 +13,22 @@
    !!   'key_lim2' :                                  LIM 2.0 sea-ice model
    !!----------------------------------------------------------------------
-   !!   ice_init_2       : sea-ice model initialization
-   !!   ice_run_2        : Definition some run parameter for ice model
+   !!   ice_init_2    : sea-ice model initialization
+   !!   ice_run_2     : Definition some run parameter for ice model
    !!----------------------------------------------------------------------
-   USE phycst           ! physical constants
-   USE dom_oce          ! ocean domain
-   USE sbc_oce          ! surface boundary condition: ocean
-   USE sbc_ice          ! LIM2 surface boundary condition
-   USE dom_ice_2        ! LIM2 ice domain
-   USE par_ice_2        ! LIM2 parameters
-   USE thd_ice_2        ! LIM2 thermodynamical variables
-   USE ice_2            ! LIM2 ice variable
-   USE limmsh_2         ! LIM2 mesh
-   USE limistate_2      ! LIM2 initial state
-   USE limrst_2         ! LIM2 restart
-   USE limsbc_2         ! LIM2 surface boundary condition
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
+   USE phycst         ! physical constants
+   USE dom_oce        ! ocean domain
+   USE sbc_oce        ! surface boundary condition: ocean
+   USE sbc_ice        ! LIM2 surface boundary condition
+   USE dom_ice_2      ! LIM2 ice domain
+   USE par_ice_2      ! LIM2 parameters
+   USE thd_ice_2      ! LIM2 thermodynamical variables
+   USE ice_2          ! LIM2 ice variable
+   USE limmsh_2       ! LIM2 mesh
+   USE limistate_2    ! LIM2 initial state
+   USE limrst_2       ! LIM2 restart
+   USE limsbc_2       ! LIM2 surface boundary condition
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limadv_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limadv_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limadv_2.F90	(revision 3625)
@@ -14,6 +14,6 @@
    !!   'key_lim2'                                    LIM 2.0 sea-ice model
    !!----------------------------------------------------------------------
-   !!   lim_adv_x_2  : advection of sea ice on x axis
-   !!   lim_adv_y_2  : advection of sea ice on y axis
+   !!   lim_adv_x_2   : advection of sea ice on x axis
+   !!   lim_adv_y_2   : advection of sea ice on y axis
    !!----------------------------------------------------------------------
    USE dom_oce
@@ -21,8 +21,9 @@
    USE ice_2
    USE lbclnk
-   USE in_out_manager     ! I/O manager
-   USE lib_mpp            ! MPP library
-   USE wrk_nemo           ! work arrays
-   USE prtctl             ! Print control
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE prtctl         ! Print control
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limdia_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limdia_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limdia_2.F90	(revision 3625)
@@ -24,4 +24,5 @@
    USE in_out_manager  ! I/O manager
    USE lib_mpp         ! MPP library
+   USE lib_fortran     ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limdmp_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limdmp_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limdmp_2.F90	(revision 3625)
@@ -19,4 +19,5 @@
    USE in_out_manager  ! I/O manager
    USE lib_mpp         ! MPP library
+   USE lib_fortran     ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limdyn_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limdyn_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limdyn_2.F90	(revision 3625)
@@ -31,4 +31,5 @@
    USE in_out_manager   ! I/O manager
    USE prtctl           ! Print control
+   USE lib_fortran      ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limhdf_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limhdf_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limhdf_2.F90	(revision 3625)
@@ -21,4 +21,5 @@
    USE prtctl           ! Print control
    USE in_out_manager   ! I/O manager
+   USE lib_fortran      ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limistate_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limistate_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limistate_2.F90	(revision 3625)
@@ -27,4 +27,5 @@
    USE iom
    USE in_out_manager
+   USE lib_fortran     ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limmsh_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limmsh_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limmsh_2.F90	(revision 3625)
@@ -23,4 +23,5 @@
    USE wrk_nemo         ! work arrays
 #endif
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limrhg_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limrhg_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limrhg_2.F90	(revision 3625)
@@ -30,4 +30,6 @@
    USE in_out_manager ! I/O manager
    USE prtctl         ! Print control
+   USE oce     , ONLY : snwice_mass, snwice_mass_b
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -80,8 +82,9 @@
       REAL(wp) ::   zs21_11, zs21_12, zs21_21, zs21_22
       REAL(wp) ::   zs22_11, zs22_12, zs22_21, zs22_22
+      REAL(wp) ::   zintb, zintn
       REAL(wp), POINTER, DIMENSION(:,:) ::   zfrld, zmass, zcorl
       REAL(wp), POINTER, DIMENSION(:,:) ::   za1ct, za2ct, zresr
       REAL(wp), POINTER, DIMENSION(:,:) ::   zc1u, zc1v, zc2u, zc2v
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zsang
+      REAL(wp), POINTER, DIMENSION(:,:) ::   zsang, zpice
       REAL(wp), POINTER, DIMENSION(:,:) ::   zu0, zv0
       REAL(wp), POINTER, DIMENSION(:,:) ::   zu_n, zv_n
@@ -93,5 +96,5 @@
       
       CALL wrk_alloc( jpi,jpj, zfrld, zmass, zcorl, za1ct, za2ct, zresr )
-      CALL wrk_alloc( jpi,jpj, zc1u , zc1v , zc2u , zc2v , zsang )
+      CALL wrk_alloc( jpi,jpj, zc1u , zc1v , zc2u , zc2v , zsang, zpice )
       CALL wrk_alloc( jpi,jpj+2, zu0, zv0, zu_n, zv_n, zu_a, zv_a, zviszeta, zviseta, kjstart = 0 )
       CALL wrk_alloc( jpi,jpj+2, zzfrld, zztms, zi1, zi2, zmasst, zpresh, kjstart = 0 )
@@ -129,4 +132,20 @@
 !i    zviszeta(:,jpj+1) = 0._wp    ;    zviseta(:,jpj+1) = 0._wp
 
+      IF( nn_ice_embd == 2 ) THEN             !== embedded sea ice: compute representative ice top surface ==!
+          !
+          ! average interpolation coeff as used in dynspg = (1/nn_fsbc) * {SUM[n/nn_fsbc], n=0,nn_fsbc-1}
+          !                                               = (1/nn_fsbc)^2 * {SUM[n], n=0,nn_fsbc-1}
+         zintn = REAL( nn_fsbc - 1 ) / REAL( nn_fsbc ) * 0.5_wp
+          !
+          ! average interpolation coeff as used in dynspg = (1/nn_fsbc) * {SUM[1-n/nn_fsbc], n=0,nn_fsbc-1}
+          !                                               = (1/nn_fsbc)^2 * (nn_fsbc^2 - {SUM[n], n=0,nn_fsbc-1})
+         zintb = REAL( nn_fsbc + 1 ) / REAL( nn_fsbc ) * 0.5_wp
+          !
+         zpice(:,:) = ssh_m(:,:) + (  zintn * snwice_mass(:,:) +  zintb * snwice_mass_b(:,:)  ) * r1_rau0
+          !
+         !
+      ELSE                                    !== non-embedded sea ice: use ocean surface for slope calculation ==!
+         zpice(:,:) = ssh_m(:,:)
+      ENDIF
 
       ! Ice mass, ice strength, and wind stress at the center            |
@@ -196,8 +215,8 @@
 
             ! Gradient of the sea surface height
-            zgsshx =  (   (ssh_m(ji  ,jj  ) - ssh_m(ji-1,jj  ))/e1u(ji-1,jj  )   &
-               &       +  (ssh_m(ji  ,jj-1) - ssh_m(ji-1,jj-1))/e1u(ji-1,jj-1)   ) * 0.5_wp
-            zgsshy =  (   (ssh_m(ji  ,jj  ) - ssh_m(ji  ,jj-1))/e2v(ji  ,jj-1)   &
-               &       +  (ssh_m(ji-1,jj  ) - ssh_m(ji-1,jj-1))/e2v(ji-1,jj-1)   ) * 0.5_wp
+            zgsshx =  (   (zpice(ji  ,jj  ) - zpice(ji-1,jj  ))/e1u(ji-1,jj  )   &
+               &       +  (zpice(ji  ,jj-1) - zpice(ji-1,jj-1))/e1u(ji-1,jj-1)   ) * 0.5_wp
+            zgsshy =  (   (zpice(ji  ,jj  ) - zpice(ji  ,jj-1))/e2v(ji  ,jj-1)   &
+               &       +  (zpice(ji-1,jj  ) - zpice(ji-1,jj-1))/e2v(ji-1,jj-1)   ) * 0.5_wp
 
             ! Computation of the velocity field taking into account the ice-ice interaction.                                 
@@ -575,5 +594,5 @@
 
       CALL wrk_dealloc( jpi,jpj, zfrld, zmass, zcorl, za1ct, za2ct, zresr )
-      CALL wrk_dealloc( jpi,jpj, zc1u , zc1v , zc2u , zc2v , zsang )
+      CALL wrk_dealloc( jpi,jpj, zc1u , zc1v , zc2u , zc2v , zsang, zpice )
       CALL wrk_dealloc( jpi,jpj+2, zu0, zv0, zu_n, zv_n, zu_a, zv_a, zviszeta, zviseta, kjstart = 0 )
       CALL wrk_dealloc( jpi,jpj+2, zzfrld, zztms, zi1, zi2, zmasst, zpresh, kjstart = 0 )
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limsbc_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limsbc_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limsbc_2.F90	(revision 3625)
@@ -9,5 +9,6 @@
    !!            3.3  ! 2009-05 (G. Garric, C. Bricaud) addition of the lim2_evp case
    !!             -   ! 2010-11 (G. Madec) ice-ocean stress computed at each ocean time-step
-   !!            4.0  ! 2011-01  (A. R. Porter, STFC Daresbury) dynamical allocation
+   !!           3.3.1 ! 2011-01 (A. R. Porter, STFC Daresbury) dynamical allocation
+   !!            3.5  ! 2012-11 ((G. Madec, Y. Aksenov, A. Coward) salt and heat fluxes associated with e-p
    !!----------------------------------------------------------------------
 #if defined key_lim2
@@ -28,5 +29,6 @@
    USE sbc_oce          ! surface boundary condition: ocean
    USE sbccpl
-
+   USE cpl_oasis3, ONLY : lk_cpl
+   USE oce       , ONLY : sshn, sshb, snwice_mass, snwice_mass_b, snwice_fmass 
    USE albedo           ! albedo parameters
    USE lbclnk           ! ocean lateral boundary condition - MPP exchanges
@@ -37,5 +39,5 @@
    USE iom              ! I/O library
    USE prtctl           ! Print control
-   USE cpl_oasis3, ONLY : lk_cpl
+   USE lib_fortran      ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -88,8 +90,8 @@
       !!              - Update the fluxes provided to the ocean
       !!     
-      !! ** Outputs : - qsr     : sea heat flux:     solar 
-      !!              - qns     : sea heat flux: non solar
-      !!              - emp     : freshwater budget: volume flux 
-      !!              - emps    : freshwater budget: concentration/dillution 
+      !! ** Outputs : - qsr     : sea heat flux    : solar 
+      !!              - qns     : sea heat flux    : non solar (including heat content of the mass flux)
+      !!              - emp     : freshwater budget: mass flux 
+      !!              - sfx     : freshwater budget: salt flux due to Freezing/Melting
       !!              - utau    : sea surface i-stress (ocean referential)
       !!              - vtau    : sea surface j-stress (ocean referential)
@@ -107,6 +109,8 @@
       INTEGER  ::   ifvt, i1mfr, idfr, iflt    !   -       -
       INTEGER  ::   ial, iadv, ifral, ifrdv    !   -       -
-      REAL(wp) ::   zqsr, zqns, zfm            ! local scalars
-      REAL(wp) ::   zinda, zfons, zemp         !   -      -
+      REAL(wp) ::   zqsr,     zqns,   zfmm     ! local scalars
+      REAL(wp) ::   zinda,    zfsalt, zemp     !   -      -
+      REAL(wp) ::   zemp_snw, zqhc,   zcd      !   -      -
+      REAL(wp) ::   zswitch                    !   -      -
       REAL(wp), POINTER, DIMENSION(:,:)   ::   zqnsoce       ! 2D workspace
       REAL(wp), POINTER, DIMENSION(:,:,:) ::   zalb, zalbp   ! 2D/3D workspace
@@ -115,4 +119,10 @@
       CALL wrk_alloc( jpi, jpj, zqnsoce )
       CALL wrk_alloc( jpi, jpj, 1, zalb, zalbp )
+
+      SELECT CASE( nn_ice_embd )                 ! levitating or embedded sea-ice option
+        CASE( 0    )   ;   zswitch = 1           ! (0) standard levitating sea-ice : salt exchange only
+        CASE( 1, 2 )   ;   zswitch = 0           ! (1) levitating sea-ice: salt and volume exchange but no pressure effect
+                                                 ! (2) embedded sea-ice : salt and volume fluxes and pressure
+      END SELECT                                 !    
 
       !------------------------------------------!
@@ -133,22 +143,24 @@
             ifrdv   = ( 1  - ifral * ( 1 - ial ) ) * iadv 
 
-!!$            zinda   = 1.0 - AINT( pfrld(ji,jj) )                   !   = 0. if pure ocean else 1. (at previous time)
-!!$
-!!$            i1mfr   = 1.0 - AINT(  frld(ji,jj) )                   !   = 0. if pure ocean else 1. (at current  time)
-!!$
-!!$            IF( phicif(ji,jj) <= 0. ) THEN   ;   ifvt = zinda      !   = 1. if (snow and no ice at previous time) else 0. ???
-!!$            ELSE                             ;   ifvt = 0.
+!!$            attempt to explain the tricky flags set above....
+!!$            zinda   = 1.0 - AINT( pfrld(ji,jj) )                   ! = 0. if ice-free ocean else 1. (after ice adv, but before ice thermo)
+!!$            i1mfr   = 1.0 - AINT(  frld(ji,jj) )                   ! = 0. if ice-free ocean else 1. (after ice thermo)
+!!$
+!!$            IF( phicif(ji,jj) <= 0. ) THEN   ;   ifvt = zinda      ! = zinda if previous thermodynamic step overmelted the ice???
+!!$            ELSE                             ;   ifvt = 0.         ! 
 !!$            ENDIF
 !!$
-!!$            IF( frld(ji,jj) >= pfrld(ji,jj) ) THEN   ;   idfr = 0.  !   = 0. if lead fraction increases from previous to current
+!!$            IF( frld(ji,jj) >= pfrld(ji,jj) ) THEN   ;   idfr = 0.  !   = 0. if lead fraction increases due to ice thermodynamics
 !!$            ELSE                                     ;   idfr = 1.   
 !!$            ENDIF
 !!$
-!!$            iflt    = zinda  * (1 - i1mfr) * (1 - ifvt )    !   = 1. if ice (not only snow) at previous and pure ocean at current
+!!$            iflt    = zinda  * (1 - i1mfr) * (1 - ifvt )    !   = 1. if ice (not only snow) at previous time and ice-free ocean currently
 !!$
 !!$            ial     = ifvt   * i1mfr    +    ( 1 - ifvt ) * idfr
+!!$                    = i1mfr if ifvt = 1 i.e. 
+!!$                    = idfr  if ifvt = 0
 !!$!                 snow no ice   ice         ice or nothing  lead fraction increases
 !!$!                 at previous   now           at previous
-!!$!                -> ice aera increases  ???         -> ice aera decreases ???
+!!$!                -> ice area increases  ???         -> ice area decreases ???
 !!$
 !!$            iadv    = ( 1  - i1mfr ) * zinda
@@ -174,15 +186,57 @@
 #endif            
             !  computation the non solar heat flux at ocean surface
-            zqns    =  - ( 1. - thcm(ji,jj) ) * zqsr   &   ! part of the solar energy used in leads
-               &       + iflt    * ( fscmbq(ji,jj) + ffltbif(ji,jj) )                            &
-               &       + ifral   * ( ial * qcmif(ji,jj) + (1 - ial) * qldif(ji,jj) ) * r1_rdtice    &
-               &       + ifrdv   * ( qfvbq(ji,jj) + qdtcn(ji,jj) )                   * r1_rdtice 
-
-            fsbbq(ji,jj) = ( 1.0 - ( ifvt + iflt ) ) * fscmbq(ji,jj)     ! ???
-            !
+            zqns    =  - ( 1. - thcm(ji,jj) ) * zqsr                                              &   ! part of the solar energy used in leads
+               &       + iflt    * ( fscmbq(ji,jj) + ffltbif(ji,jj) )                             &
+               &       + ifral   * ( ial * qcmif(ji,jj) + (1 - ial) * qldif(ji,jj) ) * r1_rdtice  &
+               &       + ifrdv   * (       qfvbq(ji,jj) +             qdtcn(ji,jj) ) * r1_rdtice 
+
+            fsbbq(ji,jj) = ( 1.0 - ( ifvt + iflt ) ) * fscmbq(ji,jj)     ! store residual heat flux (to put into the ocean at the next time-step)
+            zqhc = ( rdq_snw(ji,jj)                                     &
+                 & + rdq_ice(ji,jj) * ( 1.- zswitch) ) * r1_rdtice       ! heat flux due to snow ( & ice heat content, 
+            !                                                            !           if ice/ocean mass exchange active) 
             qsr  (ji,jj) = zqsr                                          ! solar heat flux 
-            qns  (ji,jj) = zqns - fdtcn(ji,jj)                           ! non solar heat flux
+            qns  (ji,jj) = zqns - fdtcn(ji,jj) + zqhc                    ! non solar heat flux 
+            !
+            !                          !------------------------------------------!
+            !                          !  mass and salt flux at the ocean surface !
+            !                          !------------------------------------------!
+            !
+            ! mass flux at the ocean-atmosphere interface (open ocean fraction = leads area)
+#if defined key_coupled
+            !                                                  ! coupled mode: 
+            zemp = + emp_tot(ji,jj)                            &     ! net mass flux over the grid cell (ice+ocean area)
+               &   - emp_ice(ji,jj) * ( 1. - pfrld(ji,jj) )          ! minus the mass flux intercepted by sea-ice
+#else
+            !                                                  ! forced  mode: 
+            zemp = + emp(ji,jj)     *         frld(ji,jj)      &     ! mass flux over open ocean fraction 
+               &   - tprecip(ji,jj) * ( 1. -  frld(ji,jj) )    &     ! liquid precip. over ice reaches directly the ocean
+               &   + sprecip(ji,jj) * ( 1. - pfrld(ji,jj) )          ! snow is intercepted by sea-ice (previous frld)
+#endif            
+            !
+            ! mass flux at the ocean/ice interface (sea ice fraction)
+            zemp_snw = rdm_snw(ji,jj) * r1_rdtice                    ! snow melting = pure water that enters the ocean
+            zfmm     = rdm_ice(ji,jj) * r1_rdtice                    ! Freezing minus Melting (F-M)
+
+            ! salt flux at the ice/ocean interface (sea ice fraction) [PSU*kg/m2/s]
+            zfsalt = - sice_0(ji,jj) * zfmm                          ! F-M salt exchange
+            zcd    =   soce_0(ji,jj) * zfmm                          ! concentration/dilution term due to F-M
+            !
+            ! salt flux only       : add concentration dilution term in salt flux  and no  F-M term in volume flux
+            ! salt and mass fluxes : non concentration dilution term in salt flux  and add F-M term in volume flux
+            sfx (ji,jj) = zfsalt +                  zswitch  * zcd   ! salt flux (+ C/D if no ice/ocean mass exchange)
+            emp (ji,jj) = zemp   + zemp_snw + ( 1.- zswitch) * zfmm  ! mass flux (+ F/M mass flux if ice/ocean mass exchange)
+            !
          END DO
       END DO
+      !                                !------------------------------------------!
+      !                                !    mass of snow and ice per unit area    !
+      !                                !------------------------------------------!
+      IF( nn_ice_embd /= 0 ) THEN      ! embedded sea-ice (mass required)
+         snwice_mass_b(:,:) = snwice_mass(:,:)                  ! save mass from the previous ice time step
+         !                                                      ! new mass per unit area
+         snwice_mass  (:,:) = tms(:,:) * ( rhosn * hsnif(:,:) + rhoic * hicif(:,:)  ) * ( 1.0 - frld(:,:) )
+         !                                                      ! time evolution of snow+ice mass
+         snwice_fmass (:,:) = ( snwice_mass(:,:) - snwice_mass_b(:,:) ) / rdt_ice
+      ENDIF
 
       CALL iom_put( 'hflx_ice_cea', - fdtcn(:,:) )      
@@ -190,38 +244,8 @@
       CALL iom_put( 'qsr_io_cea', fstric(:,:) * (1.e0 - pfrld(:,:)) )
 
-      !------------------------------------------!
-      !      mass flux at the ocean surface      !
-      !------------------------------------------!
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            !
-#if defined key_coupled
-            ! freshwater exchanges at the ice-atmosphere / ocean interface (coupled mode)
-            zemp = emp_tot(ji,jj) - emp_ice(ji,jj) * ( 1. - pfrld(ji,jj) )    &   ! 
-               &   + rdmsnif(ji,jj) * r1_rdtice                                   !  freshwaterflux due to snow melting 
-#else
-            !  computing freshwater exchanges at the ice/ocean interface
-            zemp = + emp(ji,jj)     *         frld(ji,jj)      &   !  e-p budget over open ocean fraction 
-               &   - tprecip(ji,jj) * ( 1. -  frld(ji,jj) )    &   !  liquid precipitation reaches directly the ocean
-               &   + sprecip(ji,jj) * ( 1. - pfrld(ji,jj) )    &   !  change in ice cover within the time step
-               &   + rdmsnif(ji,jj) * r1_rdtice                    !  freshwater flux due to snow melting 
-#endif            
-            !
-            !  computing salt exchanges at the ice/ocean interface
-            zfons = ( soce_0(ji,jj) - sice_0(ji,jj) ) * ( rdmicif(ji,jj) * r1_rdtice ) 
-            !
-            !  converting the salt flux from ice to a freshwater flux from ocean
-            zfm  = zfons / ( sss_m(ji,jj) + epsi16 )
-            !
-            emps(ji,jj) = zemp + zfm      ! surface ocean concentration/dilution effect (use on SSS evolution)
-            emp (ji,jj) = zemp            ! surface ocean volume flux (use on sea-surface height evolution)
-            !
-         END DO
-      END DO
-
       IF( lk_diaar5 ) THEN       ! AR5 diagnostics
-         CALL iom_put( 'isnwmlt_cea'  ,                 rdmsnif(:,:) * r1_rdtice )
-         CALL iom_put( 'fsal_virt_cea',   soce_0(:,:) * rdmicif(:,:) * r1_rdtice )
-         CALL iom_put( 'fsal_real_cea', - sice_0(:,:) * rdmicif(:,:) * r1_rdtice )
+         CALL iom_put( 'isnwmlt_cea'  ,                 rdm_snw(:,:) * r1_rdtice )
+         CALL iom_put( 'fsal_virt_cea',   soce_0(:,:) * rdm_ice(:,:) * r1_rdtice )
+         CALL iom_put( 'fsal_real_cea', - sice_0(:,:) * rdm_ice(:,:) * r1_rdtice )
       ENDIF
 
@@ -243,5 +267,5 @@
       IF(ln_ctl) THEN            ! control print
          CALL prt_ctl(tab2d_1=qsr   , clinfo1=' lim_sbc: qsr    : ', tab2d_2=qns   , clinfo2=' qns     : ')
-         CALL prt_ctl(tab2d_1=emp   , clinfo1=' lim_sbc: emp    : ', tab2d_2=emps  , clinfo2=' emps    : ')
+         CALL prt_ctl(tab2d_1=emp   , clinfo1=' lim_sbc: emp    : ', tab2d_2=sfx   , clinfo2=' sfx     : ')
          CALL prt_ctl(tab2d_1=utau  , clinfo1=' lim_sbc: utau   : ', mask1=umask,   &
             &         tab2d_2=vtau  , clinfo2=' vtau    : '        , mask2=vmask )
@@ -439,4 +463,17 @@
          END WHERE
       ENDIF
+      !                                      ! embedded sea ice
+      IF( nn_ice_embd /= 0 ) THEN            ! mass exchanges between ice and ocean (case 1 or 2) set the snow+ice mass
+         snwice_mass  (:,:) = tms(:,:) * ( rhosn * hsnif(:,:) + rhoic * hicif(:,:)  ) * ( 1.0 - frld(:,:) )
+         snwice_mass_b(:,:) = snwice_mass(:,:)
+      ELSE
+         snwice_mass  (:,:) = 0.e0           ! no mass exchanges
+         snwice_mass_b(:,:) = 0.e0           ! no mass exchanges
+      ENDIF
+      IF( nn_ice_embd == 2 .AND.          &  ! full embedment (case 2) & no restart : 
+         &   .NOT.ln_rstart ) THEN           ! deplete the initial ssh below sea-ice area
+         sshn(:,:) = sshn(:,:) - snwice_mass(:,:) * r1_rau0
+         sshb(:,:) = sshb(:,:) - snwice_mass(:,:) * r1_rau0
+      ENDIF
       !
    END SUBROUTINE lim_sbc_init_2
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limthd_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limthd_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limthd_2.F90	(revision 3625)
@@ -13,27 +13,28 @@
    !!   'key_lim2' :                                  LIM 2.0 sea-ice model
    !!----------------------------------------------------------------------
-   !!   lim_thd_2      : thermodynamic of sea ice
-   !!   lim_thd_init_2 : initialisation of sea-ice thermodynamic
+   !!   lim_thd_2       : thermodynamic of sea ice
+   !!   lim_thd_init_2  : initialisation of sea-ice thermodynamic
    !!----------------------------------------------------------------------
-   USE phycst          ! physical constants
-   USE dom_oce         ! ocean space and time domain variables
+   USE phycst           ! physical constants
+   USE dom_oce          ! ocean space and time domain variables
    USE domvvl
    USE lbclnk
-   USE in_out_manager  ! I/O manager
+   USE in_out_manager   ! I/O manager
    USE lib_mpp
-   USE wrk_nemo        ! work arrays
-   USE iom             ! IOM library
-   USE ice_2           ! LIM sea-ice variables
-   USE sbc_oce         ! 
-   USE sbc_ice         ! 
-   USE thd_ice_2       ! LIM thermodynamic sea-ice variables
-   USE dom_ice_2       ! LIM sea-ice domain
+   USE wrk_nemo         ! work arrays
+   USE iom              ! IOM library
+   USE ice_2            ! LIM sea-ice variables
+   USE sbc_oce          ! 
+   USE sbc_ice          ! 
+   USE thd_ice_2        ! LIM thermodynamic sea-ice variables
+   USE dom_ice_2        ! LIM sea-ice domain
    USE limthd_zdf_2
    USE limthd_lac_2
    USE limtab_2
-   USE prtctl          ! Print control
-   USE cpl_oasis3, ONLY : lk_cpl
-   USE diaar5, ONLY :   lk_diaar5
-      
+   USE prtctl           ! Print control
+   USE cpl_oasis3, ONLY :   lk_cpl
+   USE diaar5    , ONLY :   lk_diaar5
+   USE lib_fortran      ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
+   
    IMPLICIT NONE
    PRIVATE
@@ -55,5 +56,4 @@
    !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
-
 CONTAINS
 
@@ -89,6 +89,4 @@
       REAL(wp) ::   za , zh, zthsnice    !
       REAL(wp) ::   zfric_u              ! friction velocity 
-      REAL(wp) ::   zfnsol               ! total non solar heat
-      REAL(wp) ::   zfontn               ! heat flux from snow thickness
       REAL(wp) ::   zfntlat, zpareff     ! test. the val. of lead heat budget
 
@@ -129,5 +127,4 @@
       zdvolif(:,:) = 0.e0   ! total variation of ice volume
       zdvonif(:,:) = 0.e0   ! transformation of snow to sea-ice volume
-!      zdvonif(:,:) = 0.e0   ! lateral variation of ice volume
       zlicegr(:,:) = 0.e0   ! lateral variation of ice volume
       zdvomif(:,:) = 0.e0   ! variation of ice volume at bottom due to melting only
@@ -137,6 +134,8 @@
       ffltbif(:,:) = 0.e0   ! linked with fstric
       qfvbq  (:,:) = 0.e0   ! linked with fstric
-      rdmsnif(:,:) = 0.e0   ! variation of snow mass per unit area
-      rdmicif(:,:) = 0.e0   ! variation of ice mass per unit area
+      rdm_snw(:,:) = 0.e0   ! variation of snow mass over 1 time step
+      rdq_snw(:,:) = 0.e0   ! heat content associated with rdm_snw
+      rdm_ice(:,:) = 0.e0   ! variation of ice mass over 1 time step
+      rdq_ice(:,:) = 0.e0   ! heat content associated with rdm_ice
       zmsk (:,:,:) = 0.e0
 
@@ -199,9 +198,7 @@
       !--------------------------------------------------------------------------
 
-      sst_m(:,:) = sst_m(:,:) + rt0
-
-!CDIR NOVERRCHK
-      DO jj = 1, jpj
-!CDIR NOVERRCHK
+      !CDIR NOVERRCHK
+      DO jj = 1, jpj
+         !CDIR NOVERRCHK
          DO ji = 1, jpi
             zthsnice       = hsnif(ji,jj) + hicif(ji,jj)
@@ -217,24 +214,18 @@
             !  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_m(ji,jj) - tfu(ji,jj) ) 
+            fdtcn(ji,jj)  = zindb * rau0 * rcp * 0.006  * zfric_u * ( sst_m(ji,jj) + rt0 - tfu(ji,jj) ) 
             qdtcn(ji,jj)  = zindb * fdtcn(ji,jj) * frld(ji,jj) * rdt_ice
                         
             !  partial computation of the lead energy budget (qldif)
 #if defined key_coupled 
-            qldif(ji,jj)   = tms(ji,jj) * rdt_ice                                             &
+            qldif(ji,jj)   = tms(ji,jj) * rdt_ice                                                  &
                &    * (   ( qsr_tot(ji,jj) - qsr_ice(ji,jj,1) * zfricp ) * ( 1.0 - thcm(ji,jj) )   &
                &        + ( qns_tot(ji,jj) - qns_ice(ji,jj,1) * zfricp )                           &
                &        + frld(ji,jj) * ( fdtcn(ji,jj) + ( 1.0 - zindb ) * fsbbq(ji,jj) )   )
 #else
-            zfontn         = ( sprecip(ji,jj) / rhosn ) * xlsn  !   energy for melting solid precipitation
-            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) )   &
-               &                        * frld(ji,jj) * rdt_ice    
-!!$            qldif(ji,jj)   = tms(ji,jj) * rdt_ice * frld(ji,jj) 
-!!$               &           * ( qsr(ji,jj) * ( 1.0 - thcm(ji,jj) )      &
-!!$               &             + qns(ji,jj)  + fdtcn(ji,jj) - zfontn     &
-!!$               &             + ( 1.0 - zindb ) * fsbbq(ji,jj)      )   &
+            qldif(ji,jj)   = tms(ji,jj) * rdt_ice * frld(ji,jj)                    &
+               &                        * (  qsr(ji,jj) * ( 1.0 - thcm(ji,jj) )    &
+               &                           + qns(ji,jj)  +  fdtcn(ji,jj)           &
+               &                           + ( 1.0 - zindb ) * fsbbq(ji,jj)      )
 #endif
             !  parlat : percentage of energy used for lateral ablation (0.0) 
@@ -246,6 +237,5 @@
             
             !  energy needed to bring ocean surface layer until its freezing
-            qcmif  (ji,jj) =  rau0 * rcp * fse3t_m(ji,jj,1)   &
-                &          * ( tfu(ji,jj) - sst_m(ji,jj) ) * ( 1 - zinda )
+            qcmif  (ji,jj) =  rau0 * rcp * fse3t_m(ji,jj,1) * ( tfu(ji,jj) - sst_m(ji,jj) - rt0 ) * ( 1 - zinda )
             
             !  calculate oceanic heat flux.
@@ -257,6 +247,4 @@
       END DO
       
-      sst_m(:,:) = sst_m(:,:) - rt0
-               
       !         Select icy points and fulfill arrays for the vectorial grid.
       !----------------------------------------------------------------------
@@ -312,6 +300,9 @@
          CALL tab_2d_1d_2( nbpb, qldif_1d   (1:nbpb)     , qldif      , jpi, jpj, npb(1:nbpb) )
          CALL tab_2d_1d_2( nbpb, qstbif_1d  (1:nbpb)     , qstoif     , jpi, jpj, npb(1:nbpb) )
-         CALL tab_2d_1d_2( nbpb, rdmicif_1d (1:nbpb)     , rdmicif    , jpi, jpj, npb(1:nbpb) )
+         CALL tab_2d_1d_2( nbpb, rdm_ice_1d (1:nbpb)     , rdm_ice    , jpi, jpj, npb(1:nbpb) )
+         CALL tab_2d_1d_2( nbpb, rdq_ice_1d (1:nbpb)     , rdq_ice    , jpi, jpj, npb(1:nbpb) )
          CALL tab_2d_1d_2( nbpb, dmgwi_1d   (1:nbpb)     , dmgwi      , jpi, jpj, npb(1:nbpb) )
+         CALL tab_2d_1d_2( nbpb, rdm_snw_1d (1:nbpb)     , rdm_snw    , jpi, jpj, npb(1:nbpb) )
+         CALL tab_2d_1d_2( nbpb, rdq_snw_1d (1:nbpb)     , rdq_snw    , jpi, jpj, npb(1:nbpb) )
          CALL tab_2d_1d_2( nbpb, qlbbq_1d   (1:nbpb)     , zqlbsbq    , jpi, jpj, npb(1:nbpb) )
          !
@@ -332,7 +323,9 @@
          CALL tab_1d_2d_2( nbpb, qfvbq      , npb, qfvbq_1d  (1:nbpb)     , jpi, jpj )
          CALL tab_1d_2d_2( nbpb, qstoif     , npb, qstbif_1d (1:nbpb)     , jpi, jpj )
-         CALL tab_1d_2d_2( nbpb, rdmicif    , npb, rdmicif_1d(1:nbpb)     , jpi, jpj )
+         CALL tab_1d_2d_2( nbpb, rdm_ice    , npb, rdm_ice_1d(1:nbpb)     , jpi, jpj )
+         CALL tab_1d_2d_2( nbpb, rdq_ice    , npb, rdq_ice_1d(1:nbpb)     , jpi, jpj )
          CALL tab_1d_2d_2( nbpb, dmgwi      , npb, dmgwi_1d  (1:nbpb)     , jpi, jpj )
-         CALL tab_1d_2d_2( nbpb, rdmsnif    , npb, rdmsnif_1d(1:nbpb)     , jpi, jpj )
+         CALL tab_1d_2d_2( nbpb, rdm_snw    , npb, rdm_snw_1d(1:nbpb)     , jpi, jpj )
+         CALL tab_1d_2d_2( nbpb, rdq_snw    , npb, rdq_snw_1d(1:nbpb)     , jpi, jpj )
          CALL tab_1d_2d_2( nbpb, zdvosif    , npb, dvsbq_1d  (1:nbpb)     , jpi, jpj )
          CALL tab_1d_2d_2( nbpb, zdvobif    , npb, dvbbq_1d  (1:nbpb)     , jpi, jpj )
@@ -393,5 +386,5 @@
       IF( nbpac > 0 ) THEN
          !
-         zlicegr(:,:) = rdmicif(:,:)		! to output the lateral sea-ice growth 
+         zlicegr(:,:) = rdm_ice(:,:)		! to output the lateral sea-ice growth 
          !...Put the variable in a 1-D array for lateral accretion
          CALL tab_2d_1d_2( nbpac, frld_1d   (1:nbpac)     , frld       , jpi, jpj, npac(1:nbpac) )
@@ -404,5 +397,6 @@
          CALL tab_2d_1d_2( nbpac, qcmif_1d  (1:nbpac)     , qcmif      , jpi, jpj, npac(1:nbpac) )
          CALL tab_2d_1d_2( nbpac, qstbif_1d (1:nbpac)     , qstoif     , jpi, jpj, npac(1:nbpac) )
-         CALL tab_2d_1d_2( nbpac, rdmicif_1d(1:nbpac)     , rdmicif    , jpi, jpj, npac(1:nbpac) )
+         CALL tab_2d_1d_2( nbpac, rdm_ice_1d(1:nbpac)     , rdm_ice    , jpi, jpj, npac(1:nbpac) )
+         CALL tab_2d_1d_2( nbpac, rdq_ice_1d(1:nbpac)     , rdq_ice    , jpi, jpj, npac(1:nbpac) )
          CALL tab_2d_1d_2( nbpac, dvlbq_1d  (1:nbpac)     , zdvolif    , jpi, jpj, npac(1:nbpac) )
          CALL tab_2d_1d_2( nbpac, tfu_1d    (1:nbpac)     , tfu        , jpi, jpj, npac(1:nbpac) )
@@ -418,5 +412,6 @@
          CALL tab_1d_2d_2( nbpac, tbif(:,:,3), npac(1:nbpac), tbif_1d   (1:nbpac , 3 ), jpi, jpj )
          CALL tab_1d_2d_2( nbpac, qstoif     , npac(1:nbpac), qstbif_1d (1:nbpac)     , jpi, jpj )
-         CALL tab_1d_2d_2( nbpac, rdmicif    , npac(1:nbpac), rdmicif_1d(1:nbpac)     , jpi, jpj )
+         CALL tab_1d_2d_2( nbpac, rdm_ice    , npac(1:nbpac), rdm_ice_1d(1:nbpac)     , jpi, jpj )
+         CALL tab_1d_2d_2( nbpac, rdq_ice    , npac(1:nbpac), rdq_ice_1d(1:nbpac)     , jpi, jpj )
          CALL tab_1d_2d_2( nbpac, zdvolif    , npac(1:nbpac), dvlbq_1d  (1:nbpac)     , jpi, jpj )
          !
@@ -449,11 +444,11 @@
       CALL iom_put( 'iceprod_cea' , hicifp (:,:) * zztmp     )   ! Ice produced               [m/s]
       IF( lk_diaar5 ) THEN
-         CALL iom_put( 'snowmel_cea' , rdmsnif(:,:) * zztmp     )   ! Snow melt                  [kg/m2/s]
+         CALL iom_put( 'snowmel_cea' , rdm_snw(:,:) * zztmp     )   ! Snow melt                  [kg/m2/s]
          zztmp = rhoic / rdt_ice
          CALL iom_put( 'sntoice_cea' , zdvonif(:,:) * zztmp     )   ! Snow to Ice transformation [kg/m2/s]
          CALL iom_put( 'ticemel_cea' , zdvosif(:,:) * zztmp     )   ! Melt at Sea Ice top        [kg/m2/s]
          CALL iom_put( 'bicemel_cea' , zdvomif(:,:) * zztmp     )   ! Melt at Sea Ice bottom     [kg/m2/s]
-         zlicegr(:,:) = MAX( 0.e0, rdmicif(:,:)-zlicegr(:,:) )
-         CALL iom_put( 'licepro_cea' , zlicegr(:,:) * zztmp     )   ! Latereal sea ice growth    [kg/m2/s]
+         zlicegr(:,:) = MAX( 0.e0, rdm_ice(:,:)-zlicegr(:,:) )
+         CALL iom_put( 'licepro_cea' , zlicegr(:,:) * zztmp     )   ! Lateral sea ice growth     [kg/m2/s]
       ENDIF
       !
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limthd_lac_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limthd_lac_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limthd_lac_2.F90	(revision 3625)
@@ -7,13 +7,14 @@
 
    !!----------------------------------------------------------------------
-   !!   lim_lat_acr_2   : lateral accretion of ice
-   !!----------------------------------------------------------------------
-   USE par_oce          ! ocean parameters
+   !!   lim_lat_acr_2 : lateral accretion of ice
+   !!----------------------------------------------------------------------
+   USE par_oce        ! ocean parameters
    USE phycst
    USE thd_ice_2
    USE ice_2
    USE limistate_2 
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -145,6 +146,6 @@
          frld_1d   (ji) = MAX( zfrlnew , zfrlmin(ji) )
          !--computation of the remaining part of ice thickness which has been already used
-         zdhicbot(ji) =  ( frld_1d(ji) - zfrlnew ) * zhice0(ji) / ( 1.0 - zfrlmin(ji) ) & 
-                      -  (  ( 1.0 - zfrrate ) / ( 1.0 - frld_1d(ji) ) )  * ( zqbgow(ji) / xlic ) 
+         zdhicbot(ji) =  ( frld_1d(ji) - zfrlnew ) * zhice0(ji) / ( 1.0 - zfrlmin(ji) )   & 
+            &         -  (  ( 1.0 - zfrrate ) / ( 1.0 - frld_1d(ji) ) )  * ( zqbgow(ji) / xlic ) 
       END DO
  
@@ -196,5 +197,5 @@
             &          ) / zah
          
-         tbif_1d(ji,3) =     (  iiceform * ( zhnews2 - zdh3 )                                          * zta1  &
+         tbif_1d(ji,3) =     ( iiceform * ( zhnews2 - zdh3 )                                           * zta1  &
             &              + ( iiceform * zdh3 + ( 1 - iiceform ) * zdh1 )                             * zta2  &
             &              + ( iiceform * ( zhnews2 - zdh5 ) + ( 1 - iiceform ) * ( zhnews2 - zdh1 ) ) * zta3  & 
@@ -217,5 +218,6 @@
       DO ji = kideb , kiut
          dvlbq_1d  (ji) = ( 1. - frld_1d(ji) ) * h_ice_1d(ji) - ( 1. - zfrl_old(ji) ) * zhice_old(ji)
-         rdmicif_1d(ji) = rdmicif_1d(ji) + rhoic * dvlbq_1d(ji)
+         rdm_ice_1d(ji) = rdm_ice_1d(ji) + rhoic * dvlbq_1d(ji)
+         rdq_ice_1d(ji) = rdq_ice_1d(ji) + rcpic * dvlbq_1d(ji) * ( tfu_1d(ji) - rt0 )      ! heat content relative to rt0
       END DO
       
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limthd_zdf_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limthd_zdf_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limthd_zdf_2.F90	(revision 3625)
@@ -18,9 +18,10 @@
    USE ice_2
    USE limistate_2
+   USE cpl_oasis3, ONLY : lk_cpl
    USE in_out_manager
    USE lib_mpp          ! MPP library
    USE wrk_nemo         ! work arrays
-   USE cpl_oasis3, ONLY : lk_cpl
-      
+   USE lib_fortran      ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
+    
    IMPLICIT NONE
    PRIVATE
@@ -86,5 +87,5 @@
       REAL(wp), POINTER, DIMENSION(:) ::   zrcpdt         ! h_su*rho_su*cp_su/dt(h_su being the thick. of surf. layer)
       REAL(wp), POINTER, DIMENSION(:) ::   zts_old        ! previous surface temperature
-      REAL(wp), POINTER, DIMENSION(:) ::   zidsn , z1midsn , zidsnic ! tempory variables
+      REAL(wp), POINTER, DIMENSION(:) ::   zidsn , z1midsn , zidsnic ! temporary variables
       REAL(wp), POINTER, DIMENSION(:) ::   zfnet          ! net heat flux at the top surface( incl. conductive heat flux)
       REAL(wp), POINTER, DIMENSION(:) ::   zsprecip       ! snow accumulation
@@ -98,62 +99,68 @@
       REAL(wp), POINTER, DIMENSION(:) ::   zep            ! internal temperature of the 2nd layer of the snow/ice system
       REAL(wp), DIMENSION(3) :: & 
-          zplediag  &    ! principle diagonal, subdiag. and supdiag. of the 
+            zplediag  &    ! principle diagonal, subdiag. and supdiag. of the 
           , zsubdiag  &    ! tri-diagonal matrix coming from the computation
           , zsupdiag  &    ! of the temperatures inside the snow-ice system
           , zsmbr          ! second member
-       REAL(wp) :: & 
-          zhsu     &     ! thickness of surface layer
-          , zhe      &     ! effective thickness for compu. of equ. thermal conductivity
-          , zheshth  &     ! = zhe / thth
-          , zghe     &     ! correction factor of the thermal conductivity
-          , zumsb    &     ! parameter for numerical method to solve heat-diffusion eq.
-          , zkhsn    &     ! conductivity at the snow layer
-          , zkhic    &     ! conductivity at the ice layers
-          , zkint    &     ! equivalent conductivity at the snow-ice interface
-          , zkhsnint &     ! = zkint*dt / (hsn*rhosn*cpsn)  
-          , zkhicint &     ! = 2*zkint*dt / (hic*rhoic*cpic)
-          , zpiv1 , zpiv2  &       ! tempory scalars used to solve the tri-diagonal system
-          , zb2 , zd2 , zb3 , zd3 &
+       REAL(wp) ::    &
+            zhsu      &    ! thickness of surface layer
+          , zhe       &    ! effective thickness for compu. of equ. thermal conductivity
+          , zheshth   &    ! = zhe / thth
+          , zghe      &    ! correction factor of the thermal conductivity
+          , zumsb     &    ! parameter for numerical method to solve heat-diffusion eq.
+          , zkhsn     &    ! conductivity at the snow layer
+          , zkhic     &    ! conductivity at the ice layers
+          , zkint     &    ! equivalent conductivity at the snow-ice interface
+          , zkhsnint  &    ! = zkint*dt / (hsn*rhosn*cpsn)  
+          , zkhicint  &    ! = 2*zkint*dt / (hic*rhoic*cpic)
+          , zpiv1, zpiv2 & ! temporary scalars used to solve the tri-diagonal system
+          , zb2, zd2  &    ! temporary scalars used to solve the tri-diagonal system
+          , zb3, zd3  &    ! temporary scalars used to solve the tri-diagonal system
           , ztint          ! equivalent temperature at the snow-ice interface
-       REAL(wp) :: & 
-          zexp      &     ! exponential function of the ice thickness
-          , zfsab     &     ! part of solar radiation stored in brine pockets
-          , zfts      &     ! value of energy balance function when the temp. equal surf. temp.
-          , zdfts     &     ! value of derivative of ztfs when the temp. equal surf. temp.
-          , zdts      &     ! surface temperature increment
-          , zqsnw_mlt &     ! energy needed to melt snow
-          , zdhsmlt   &     ! change in snow thickness due to melt
-          , zhsn      &     ! snow thickness (previous+accumulation-melt)
-          , zqsn_mlt_rem &  ! remaining heat coming from snow melting
-          , zqice_top_mlt & ! energy used to melt ice at top surface
-          , zdhssub      &  ! change in snow thick. due to sublimation or evaporation
-          , zdhisub      &  ! change in ice thick. due to sublimation or evaporation    
-          , zdhsn        &  ! snow ice thickness increment
-          , zdtsn        &  ! snow internal temp. increment
-          , zdtic        &  ! ice internal temp. increment
+       REAL(wp) ::    & 
+            zexp      &    ! exponential function of the ice thickness
+          , zfsab     &    ! part of solar radiation stored in brine pockets
+          , zfts      &    ! value of energy balance function when the temp. equal surf. temp.
+          , zdfts     &    ! value of derivative of ztfs when the temp. equal surf. temp.
+          , zdts      &    ! surface temperature increment
+          , zqsnw_mlt &    ! energy needed to melt snow
+          , zdhsmlt   &    ! change in snow thickness due to melt
+          , zhsn      &    ! snow thickness (previous+accumulation-melt)
+          , zqsn_mlt_rem & ! remaining heat coming from snow melting
+          , zqice_top_mlt &! energy used to melt ice at top surface
+          , zdhssub   &    ! change in snow thick. due to sublimation or evaporation
+          , zdhisub   &    ! change in ice thick. due to sublimation or evaporation    
+          , zdhsn     &    ! snow ice thickness increment
+          , zdtsn     &    ! snow internal temp. increment
+          , zdtic     &    ! ice internal temp. increment
           , zqnes          ! conductive energy due to ice melting in the first ice layer
-       REAL(wp) :: & 
-          ztbot     &      ! temperature at the bottom surface
-          , zfcbot    &      ! conductive heat flux at bottom surface
-          , zqice_bot &      ! energy used for bottom melting/growing
-          , zqice_bot_mlt &  ! energy used for bottom melting
-          , zqstbif_bot  &  ! part of energy stored in brine pockets used for bottom melting
-          , zqstbif_old  &  ! tempory var. for zqstbif_bot
-          , zdhicmlt      &  ! change in ice thickness due to bottom melting
-          , zdhicm        &  ! change in ice thickness var. 
-          , zdhsnm        &  ! change in snow thickness var. 
-          , zhsnfi        &  ! snow thickness var. 
-          , zc1, zpc1, zc2, zpc2, zp1, zp2 & ! tempory variables
-          , ztb2, ztb3
-       REAL(wp) :: & 
-          zdrmh         &   ! change in snow/ice thick. after snow-ice formation
-          , zhicnew       &   ! new ice thickness
-          , zhsnnew       &   ! new snow thickness
-          , zquot , ztneq &   ! tempory temp. variables
-          , zqice, zqicetot & ! total heat inside the snow/ice system
-          , zdfrl         &   ! change in ice concentration
-          , zdvsnvol      &   ! change in snow volume
-          , zdrfrl1, zdrfrl2 &  ! tempory scalars
-          , zihsn, zidhb, zihic, zihe, zihq, ziexp, ziqf, zihnf, zibmlt, ziqr, zihgnew, zind
+       REAL(wp) ::    & 
+            ztbot     &    ! temperature at the bottom surface
+          , zfcbot    &    ! conductive heat flux at bottom surface
+          , zqice_bot &    ! energy used for bottom melting/growing
+          , zqice_bot_mlt &! energy used for bottom melting
+          , zqstbif_bot  & ! part of energy stored in brine pockets used for bottom melting
+          , zqstbif_old  & ! temporary var. for zqstbif_bot
+          , zdhicmlt  &    ! change in ice thickness due to bottom melting
+          , zdhicm    &    ! change in ice thickness var. 
+          , zdhsnm    &    ! change in snow thickness var. 
+          , zhsnfi    &    ! snow thickness var. 
+          , zc1, zpc1 &    ! temporary variables
+          , zc2, zpc2 &    ! temporary variables
+          , zp1, zp2  &    ! temporary variables
+          , ztb2, ztb3     ! temporary variables
+       REAL(wp) ::    & 
+            zdrmh     &    ! change in snow/ice thick. after snow-ice formation
+          , zhicnew   &    ! new ice thickness
+          , zhsnnew   &    ! new snow thickness
+          , zquot     &
+          , ztneq     &    ! temporary temp. variables
+          , zqice     &
+          , zqicetot  &    ! total heat inside the snow/ice system
+          , zdfrl     &    ! change in ice concentration
+          , zdvsnvol  &    ! change in snow volume
+          , zdrfrl1, zdrfrl2, zihsn, zidhb, zihic &  ! temporary scalars
+          , zihe, zihq, ziexp, ziqf, zihnf        &  ! temporary scalars
+          , zibmlt, ziqr, zihgnew, zind, ztmp        ! temporary scalars
        !!----------------------------------------------------------------------
        CALL wrk_alloc( jpij, ztsmlt, ztbif  , zksn    , zkic    , zksndh , zfcsu  , zfcsudt , zi0      , z1mi0   , zqmax    )
@@ -169,16 +176,14 @@
        
        DO ji = kideb , kiut
+          ! do nothing if the snow (ice) thickness falls below its minimum thickness
           zihsn = MAX( zzero , SIGN( zone , hsndif - h_snow_1d(ji) ) )
           zihic = MAX( zzero , SIGN( zone , hicdif - h_ice_1d(ji) ) )
-          !--computation of energy due to surface melting
-          zqcmlts(ji) = ( MAX ( zzero ,  &
-             &                   rcpsn * h_snow_1d(ji) * ( tbif_1d(ji,1) - rt0_snow ) ) ) * ( 1.0 - zihsn )
-          !--computation of energy due to bottom melting
-          zqcmltb(ji) = ( MAX( zzero , &
-             &                  rcpic * ( tbif_1d(ji,2) - rt0_ice ) * ( h_ice_1d(ji) / 2. ) ) &
-             &           + MAX( zzero , &
-             &                  rcpic * ( tbif_1d(ji,3) - rt0_ice ) * ( h_ice_1d(ji) / 2. ) ) &
-             &           ) * ( 1.0 - zihic  )
-          !--limitation of  snow/ice system internal temperature
+          !--energy required to bring snow to its melting point (rt0_snow)
+          zqcmlts(ji) = ( MAX ( zzero , rcpsn * h_snow_1d(ji) * ( tbif_1d(ji,1) - rt0_snow ) ) ) * ( 1.0 - zihsn )
+          !--energy required to bring ice to its melting point (rt0_ice)
+          zqcmltb(ji) = ( MAX( zzero , rcpic * ( tbif_1d(ji,2) - rt0_ice ) * ( h_ice_1d(ji) / 2. ) )  &
+             &          + MAX( zzero , rcpic * ( tbif_1d(ji,3) - rt0_ice ) * ( h_ice_1d(ji) / 2. ) )  &
+             &          ) * ( 1.0 - zihic  )
+          !--limitation of snow/ice system internal temperature
           tbif_1d(ji,1)   = MIN( rt0_snow, tbif_1d(ji,1) )
           tbif_1d(ji,2)   = MIN( rt0_ice , tbif_1d(ji,2) )
@@ -480,5 +485,8 @@
           dvsbq_1d(ji) =  ( 1.0 - frld_1d(ji) ) * ( h_snow_1d(ji) - zhsnw_old(ji) - zsprecip(ji) )
           dvsbq_1d(ji) =  MIN( zzero , dvsbq_1d(ji) )
-          rdmsnif_1d(ji) =  rhosn * dvsbq_1d(ji)
+          ztmp = rhosn * dvsbq_1d(ji)
+          rdm_snw_1d(ji) =  ztmp
+          !--heat content of the water provided to the ocean (referenced to rt0)
+          rdq_snw_1d(ji) =  cpic * ztmp * ( rt0_snow - rt0 )
           !-- If the snow is completely melted the remaining heat is used to melt ice
           zqsn_mlt_rem  = MAX( zzero , -zhsn ) * xlsn
@@ -623,9 +631,17 @@
           !---updating new ice thickness and computing the newly formed ice mass
           zhicnew   =  zihgnew * zhicnew
-          rdmicif_1d(ji) =  rdmicif_1d(ji) + ( 1.0 - frld_1d(ji) ) * ( zhicnew - h_ice_1d(ji) ) * rhoic
+          ztmp    =  ( 1.0 - frld_1d(ji) ) * ( zhicnew - h_ice_1d(ji) ) * rhoic
+          rdm_ice_1d(ji) =  rdm_ice_1d(ji) + ztmp
+          !---heat content of the water provided to the ocean (referenced to rt0)
+          !   use of rt0_ice is OK for melting ice; in the case of freezing, tfu_1d should be used. 
+          !   This is done in 9.5 section (see below)
+          rdq_ice_1d(ji) =  cpic * ztmp * ( rt0_ice - rt0 )
           !---updating new snow thickness and computing the newly formed snow mass
           zhsnfi   = zhsn + zdhsnm
           h_snow_1d(ji) = MAX( zzero , zhsnfi )
-          rdmsnif_1d(ji) =  rdmsnif_1d(ji) + ( 1.0 - frld_1d(ji) ) * ( h_snow_1d(ji) - zhsn ) * rhosn
+          ztmp = ( 1.0 - frld_1d(ji) ) * ( h_snow_1d(ji) - zhsn ) * rhosn
+          rdm_snw_1d(ji) = rdm_snw_1d(ji) + ztmp
+          !---updating the heat content of the water provided to the ocean (referenced to rt0)
+          rdq_snw_1d(ji) = rdq_snw_1d(ji) + cpic * ztmp * ( rt0_snow - rt0 )
           !--remaining energy in case of total ablation
           zqocea(ji) = - ( zihsn * xlic * zdhicm + xlsn * ( zhsnfi - h_snow_1d(ji) ) ) * ( 1.0 - frld_1d(ji) )
@@ -659,4 +675,8 @@
           tbif_1d(ji,3) =  zihgnew * ztb3 + ( 1.0 - zihgnew ) * tfu_1d(ji)
           h_ice_1d(ji)  =  zhicnew
+          ! update the ice heat content given to the ocean in freezing case 
+          ! (part due to difference between rt0_ice and tfu_1d)
+          ztmp = ( 1. - zidhb ) * rhoic * dvbbq_1d(ji)
+          rdq_ice_1d(ji) = rdq_ice_1d(ji) + cpic * ztmp * ( tfu_1d(ji) - rt0_ice )
        END DO
 
@@ -700,6 +720,11 @@
           dmgwi_1d(ji) = dmgwi_1d(ji) + ( 1.0 -frld_1d(ji) ) * ( h_snow_1d(ji) - zhsnnew ) * rhosn
           !---  volume change of ice and snow (used for ocean-ice freshwater flux computation)
-          rdmicif_1d(ji) = rdmicif_1d(ji) + ( 1.0 - frld_1d(ji) )   * ( zhicnew - h_ice_1d (ji) ) * rhoic
-          rdmsnif_1d(ji) = rdmsnif_1d(ji) + ( 1.0 - frld_1d(ji) )   * ( zhsnnew - h_snow_1d(ji) ) * rhosn
+          ztmp = ( 1.0 - frld_1d(ji) ) * ( zhicnew - h_ice_1d (ji) ) * rhoic
+          rdm_ice_1d(ji) = rdm_ice_1d(ji) + ztmp
+          rdq_ice_1d(ji) = rdq_ice_1d(ji) + cpic * ztmp * ( tfu_1d(ji) - rt0 )
+          !!gm BUG ??   snow ==>  only needed for nn_ice_embd == 0  (standard levitating sea-ice)
+          ztmp = ( 1.0 - frld_1d(ji) )   * ( zhsnnew - h_snow_1d(ji) ) * rhosn
+          rdm_snw_1d(ji) = rdm_snw_1d(ji) + ztmp
+          rdq_snw_1d(ji) = rdq_snw_1d(ji) + cpic * ztmp * ( rt0_snow - rt0 )
 
           !---  Actualize new snow and ice thickness.
@@ -748,8 +773,28 @@
           !--variation of ice volume and ice mass 
           dvlbq_1d(ji)   = zihic * ( zfrl_old(ji) - frld_1d(ji) ) * h_ice_1d(ji)
-          rdmicif_1d(ji) = rdmicif_1d(ji) + dvlbq_1d(ji) * rhoic
+          ztmp = dvlbq_1d(ji) * rhoic
+          rdm_ice_1d(ji) = rdm_ice_1d(ji) + ztmp
+!!gm
+!!gm   This should be split in two parts:
+!!gm         1-  heat required to bring sea-ice to tfu  : this part should be added to the heat flux taken from the ocean
+!!gm                 cpic * ztmp * 0.5 * ( tbif_1d(ji,2) + tbif_1d(ji,3) - 2.* rt0_ice )
+!!gm         2-  heat content of lateral ablation referenced to rt0 : this part only put in rdq_ice_1d
+!!gm                 cpic * ztmp * ( rt0_ice - rt0 )
+!!gm   Currently we put all the heat in rdq_ice_1d
+          rdq_ice_1d(ji) = rdq_ice_1d(ji) + cpic * ztmp * 0.5 * ( tbif_1d(ji,2) + tbif_1d(ji,3) - 2.* rt0 )
+          !
           !--variation of snow volume and snow mass 
-          zdvsnvol    = zihsn * ( zfrl_old(ji) - frld_1d(ji) ) * h_snow_1d(ji)
-          rdmsnif_1d(ji) = rdmsnif_1d(ji) + zdvsnvol * rhosn
+          zdvsnvol = zihsn * ( zfrl_old(ji) - frld_1d(ji) ) * h_snow_1d(ji)
+          ztmp     = zdvsnvol * rhosn
+          rdm_snw_1d(ji) = rdm_snw_1d(ji) + ztmp
+!!gm
+!!gm   This should be split in two parts:
+!!gm         1-  heat required to bring snow to tfu  : this part should be added to the heat flux taken from the ocean
+!!gm                 cpic * ztmp * ( tbif_1d(ji,1) - rt0_snow )
+!!gm         2-  heat content of lateral ablation referenced to rt0 : this part only put in rdq_snw_1d
+!!gm                 cpic * ztmp * ( rt0_snow - rt0 )
+!!gm   Currently we put all the heat in rdq_snw_1d
+          rdq_snw_1d(ji) = rdq_snw_1d(ji) + cpic * ztmp * ( tbif_1d(ji,1) - rt0 )
+
           h_snow_1d(ji)  = ziqf * h_snow_1d(ji)
 
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limwri_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limwri_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limwri_2.F90	(revision 3625)
@@ -13,6 +13,6 @@
    !!----------------------------------------------------------------------
    !!----------------------------------------------------------------------
-   !!   lim_wri_2      : write of the diagnostics variables in ouput file 
-   !!   lim_wri_init_2 : initialization and namelist read
+   !!   lim_wri_2       : write of the diagnostics variables in ouput file 
+   !!   lim_wri_init_2  : initialization and namelist read
    !!   lim_wri_state_2 : write for initial state or/and abandon:
    !!                     > output.init.nc (if ninist = 1 in namelist)
@@ -26,11 +26,12 @@
    USE ice_2
 
-   USE dianam          ! build name of file (routine)
+   USE dianam           ! build name of file (routine)
    USE lbclnk
    USE in_out_manager
-   USE lib_mpp         ! MPP library
-   USE wrk_nemo        ! work arrays
+   USE lib_mpp          ! MPP library
+   USE wrk_nemo         ! work arrays
    USE iom
    USE ioipsl
+   USE lib_fortran      ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -173,5 +174,5 @@
             zcmo(ji,jj,13) = qns(ji,jj)
             ! See thersf for the coefficient
-            zcmo(ji,jj,14) = - emps(ji,jj) * rday * ( sss_m(ji,jj) + epsi16 ) / soce    !!gm ???
+            zcmo(ji,jj,14) = - sfx (ji,jj) * rday * ( sss_m(ji,jj) + epsi16 ) / soce    !!gm ???
             zcmo(ji,jj,15) = utau_ice(ji,jj)
             zcmo(ji,jj,16) = vtau_ice(ji,jj)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limwri_dimg_2.h90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limwri_dimg_2.h90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/limwri_dimg_2.h90	(revision 3625)
@@ -118,5 +118,5 @@
           zcmo(ji,jj,13) = qns(ji,jj)
           ! See thersf for the coefficient
-          zcmo(ji,jj,14) = - emps(ji,jj) * rday * ( sss_m(ji,jj) + epsi16 ) / soce
+          zcmo(ji,jj,14) = - sfx (ji,jj) * rday * ( sss_m(ji,jj) + epsi16 ) / soce
           zcmo(ji,jj,15) = utau_ice(ji,jj)
           zcmo(ji,jj,16) = vtau_ice(ji,jj)
@@ -161,5 +161,5 @@
                 rcmoy(ji,jj,13) = qns(ji,jj)
                 ! See thersf for the coefficient
-                rcmoy(ji,jj,14) = - emps(ji,jj) * rday * ( sss_m(ji,jj) + epsi16 ) / soce
+                rcmoy(ji,jj,14) = - sfx (ji,jj) * rday * ( sss_m(ji,jj) + epsi16 ) / soce
                 rcmoy(ji,jj,15) = utau_ice(ji,jj)
                 rcmoy(ji,jj,16) = vtau_ice(ji,jj)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/thd_ice_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/thd_ice_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_2/thd_ice_2.F90	(revision 3625)
@@ -68,6 +68,8 @@
       qstbif_1d   ,     &  !:    "                  "      qstoif
       fbif_1d     ,     &  !:    "                  "      fbif
-      rdmicif_1d  ,     &  !:    "                  "      rdmicif
-      rdmsnif_1d  ,     &  !:    "                  "      rdmsnif
+      rdm_ice_1d  ,     &  !:    "                  "      rdm_ice
+      rdq_ice_1d  ,     &  !:    "                  "      rdq_ice
+      rdm_snw_1d  ,     &  !:    "                  "      rdm_snw
+      rdq_snw_1d  ,     &  !:    "                  "      rdq_snw
       qlbbq_1d    ,     &  !:    "                  "      qlbsbq
       dmgwi_1d    ,     &  !:    "                  "      dmgwi
@@ -108,5 +110,6 @@
          &      qstbif_1d(jpij),  fbif_1d(jpij),  Stat=ierr(2))
          !
-      ALLOCATE( rdmicif_1d(jpij), rdmsnif_1d(jpij), qlbbq_1d(jpij),   &
+      ALLOCATE( rdm_ice_1d(jpij), rdq_ice_1d(jpij)                  , &
+         &      rdm_snw_1d(jpij), rdq_snw_1d(jpij), qlbbq_1d(jpij)  , &
          &      dmgwi_1d(jpij)  , dvsbq_1d(jpij)  , rdvomif_1d(jpij), &
          &      dvbbq_1d(jpij)  , dvlbq_1d(jpij)  , dvnbq_1d(jpij)  , &
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/dom_ice.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/dom_ice.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/dom_ice.F90	(revision 3625)
@@ -9,5 +9,6 @@
    USE par_ice        ! LIM-3 parameter
    USE in_out_manager ! I/O manager
-   USE lib_mpp         ! MPP library
+   USE lib_mpp        ! MPP library
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -30,5 +31,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/ice.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/ice.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/ice.F90	(revision 3625)
@@ -9,9 +9,9 @@
 #if defined key_lim3
    !!----------------------------------------------------------------------
-   !!   'key_lim3' :                                   LIM3 sea-ice model
-   !!----------------------------------------------------------------------
-   USE par_ice          ! LIM sea-ice parameters
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp         ! MPP library
+   !!   'key_lim3'                                      LIM-3 sea-ice model
+   !!----------------------------------------------------------------------
+   USE par_ice        ! LIM sea-ice parameters
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
 
    IMPLICIT NONE
@@ -158,9 +158,10 @@
    !! * Share Module variables
    !!--------------------------------------------------------------------------
-   INTEGER , PUBLIC ::   nstart    !: iteration number of the begining of the run 
-   INTEGER , PUBLIC ::   nlast     !: iteration number of the end of the run 
-   INTEGER , PUBLIC ::   nitrun    !: number of iteration
-   INTEGER , PUBLIC ::   numit     !: iteration number
-   REAL(wp), PUBLIC ::   rdt_ice   !: ice time step
+   INTEGER , PUBLIC ::   nstart      !: iteration number of the begining of the run 
+   INTEGER , PUBLIC ::   nlast       !: iteration number of the end of the run 
+   INTEGER , PUBLIC ::   nitrun      !: number of iteration
+   INTEGER , PUBLIC ::   numit       !: iteration number
+   REAL(wp), PUBLIC ::   rdt_ice     !: ice time step
+   REAL(wp), PUBLIC ::   r1_rdtice   !: = 1. / rdt_ice
 
    !                                          !!** ice-dynamic namelist (namicedyn) **
@@ -201,8 +202,7 @@
    !                                              !!** ice-salinity namelist (namicesal) **
    INTEGER , PUBLIC ::   num_sal     = 1           !: salinity configuration used in the model
-   !                                               ! 1 - s constant in space and time
+   !                                               ! 1 - constant salinity in both space and time
    !                                               ! 2 - prognostic salinity (s(z,t))
    !                                               ! 3 - salinity profile, constant in time
-   !                                               ! 4 - salinity variations affect only ice thermodynamics
    INTEGER , PUBLIC ::   sal_prof    = 1           !: salinity profile or not 
    INTEGER , PUBLIC ::   thcon_i_swi = 1           !: thermal conductivity: =1 Untersteiner (1964) ; =2 Pringle et al (2007)
@@ -264,6 +264,8 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   phicif      !: Old ice thickness
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fbif        !: Heat flux at the ice base
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdmsnif     !: Variation of snow mass
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdmicif     !: Variation of ice mass
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdm_snw     !: Variation of snow mass over 1 time step     [Kg/m2]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdq_snw     !: Heat content associated with rdm_snw        [J/m2]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdm_ice     !: Variation of ice mass over 1 time step      [Kg/m2]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rdq_ice     !: Heat content associated with rdm_ice        [J/m2]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qldif       !: heat balance of the lead (or of the open ocean)
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qcmif       !: Energy needed to bring the ocean to freezing 
@@ -276,13 +278,13 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qfvbq       !: store energy in case of total lateral ablation (?)
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   dmgwi       !: Variation of the mass of snow ice
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fsalt_res   !: Residual salt flux due to correction of ice thickness
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fsbri       !: Salt flux due to brine rejection
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fsalt_rpo   !: Salt flux associated with porous ridged ice formation
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fheat_rpo   !: Heat flux associated with porous ridged ice formation
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sfx_thd     !: salt flux due to ice growth/melt                      [PSU/m2/s]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sfx_bri     !: salt flux due to brine rejection                      [PSU/m2/s]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sfx_mec     !: salt flux due to porous ridged ice formation          [PSU/m2/s]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sfx_res     !: residual salt flux due to correction of ice thickness [PSU/m2/s]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fhbri       !: heat flux due to brine rejection
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fmmec       !: Mass flux due to snow loss during compression
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fseqv       !: Equivalent salt flux due to ice growth/melt
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fhmec       !: Heat flux due to snow loss during compression
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fheat_res   !: Residual heat flux due to correction of ice thickness
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fheat_mec   !: heat flux associated with porous ridged ice formation [???]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fheat_res   !: residual heat flux due to correction of ice thickness
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fmmec       !: mass flux due to snow loss during compression         [Kg/m2/s]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   fhmec       !: heat flux due to snow loss during compression
 
    ! temporary arrays for dummy version of the code
@@ -415,5 +417,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2010)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2010)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -444,14 +446,15 @@
 
       ii = ii + 1
-      ALLOCATE( firic    (jpi,jpj) , fcsic  (jpi,jpj) , fleic    (jpi,jpj) , qlatic   (jpi,jpj) ,     &
-         &      rdvosif  (jpi,jpj) , rdvobif(jpi,jpj) , fdvolif  (jpi,jpj) , rdvonif  (jpi,jpj) ,     &
-         &      sist     (jpi,jpj) , icethi (jpi,jpj) , t_bo     (jpi,jpj) , hicifp   (jpi,jpj) ,     &
-         &      frld     (jpi,jpj) , pfrld  (jpi,jpj) , phicif   (jpi,jpj) , fbif     (jpi,jpj) ,     &
-         &      rdmsnif  (jpi,jpj) , rdmicif(jpi,jpj) , qldif    (jpi,jpj) , qcmif    (jpi,jpj) ,     &
-         &      fdtcn    (jpi,jpj) , qdtcn  (jpi,jpj) , fstric   (jpi,jpj) , fscmbq   (jpi,jpj) ,     &
-         &      ffltbif  (jpi,jpj) , fsbbq  (jpi,jpj) , qfvbq    (jpi,jpj) , dmgwi    (jpi,jpj) ,     &
-         &      fsalt_res(jpi,jpj) , fsbri  (jpi,jpj) , fsalt_rpo(jpi,jpj) , fheat_rpo(jpi,jpj) ,     &
-         &      fhbri    (jpi,jpj) , fmmec  (jpi,jpj) , fseqv    (jpi,jpj) , fhmec    (jpi,jpj) ,     &
-         &      fheat_res(jpi,jpj)                                                              , STAT=ierr(ii) )
+      ALLOCATE( firic    (jpi,jpj) , fcsic  (jpi,jpj) , fleic  (jpi,jpj) , qlatic   (jpi,jpj) ,     &
+         &      rdvosif  (jpi,jpj) , rdvobif(jpi,jpj) , fdvolif(jpi,jpj) , rdvonif  (jpi,jpj) ,     &
+         &      sist     (jpi,jpj) , icethi (jpi,jpj) , t_bo   (jpi,jpj) , hicifp   (jpi,jpj) ,     &
+         &      frld     (jpi,jpj) , pfrld  (jpi,jpj) , phicif (jpi,jpj) , fbif     (jpi,jpj) ,     &
+         &      rdm_snw  (jpi,jpj) , rdq_snw(jpi,jpj) , rdm_ice(jpi,jpj) , rdq_ice  (jpi,jpj) ,     &
+         &                                              qldif  (jpi,jpj) , qcmif    (jpi,jpj) ,     &
+         &      fdtcn    (jpi,jpj) , qdtcn  (jpi,jpj) , fstric (jpi,jpj) , fscmbq   (jpi,jpj) ,     &
+         &      ffltbif  (jpi,jpj) , fsbbq  (jpi,jpj) , qfvbq  (jpi,jpj) , dmgwi    (jpi,jpj) ,     &
+         &      sfx_res  (jpi,jpj) , sfx_bri(jpi,jpj) , sfx_mec(jpi,jpj) , fheat_mec(jpi,jpj) ,     &
+         &      fhbri    (jpi,jpj) , fmmec  (jpi,jpj) , sfx_thd(jpi,jpj) , fhmec    (jpi,jpj) ,     &
+         &      fheat_res(jpi,jpj)                                                            , STAT=ierr(ii) )
 
       ii = ii + 1
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/iceini.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/iceini.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/iceini.F90	(revision 3625)
@@ -10,26 +10,27 @@
 #if defined key_lim3
    !!----------------------------------------------------------------------
-   !!   'key_lim3' :                                   LIM sea-ice model
-   !!----------------------------------------------------------------------
-   !!   ice_init       : sea-ice model initialization
-   !!----------------------------------------------------------------------
-   USE phycst           ! physical constants
-   USE dom_oce          ! ocean domain
-   USE sbc_oce          ! Surface boundary condition: ocean fields
-   USE sbc_ice          ! Surface boundary condition: ice   fields
-   USE ice              ! LIM variables
-   USE par_ice          ! LIM parameters
-   USE dom_ice          ! LIM domain
-   USE thd_ice          ! LIM thermodynamical variables
-   USE limitd_me        ! LIM ice thickness distribution
-   USE limmsh           ! LIM mesh
-   USE limistate        ! LIM initial state
-   USE limrst           ! LIM restart
-   USE limthd           ! LIM ice thermodynamics
-   USE limthd_sal       ! LIM ice thermodynamics: salinity
-   USE limvar           ! LIM variables
-   USE limsbc           ! LIM surface boundary condition
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
+   !!   'key_lim3'                                     LIM sea-ice model
+   !!----------------------------------------------------------------------
+   !!   ice_init      : sea-ice model initialization
+   !!----------------------------------------------------------------------
+   USE phycst         ! physical constants
+   USE dom_oce        ! ocean domain
+   USE sbc_oce        ! Surface boundary condition: ocean fields
+   USE sbc_ice        ! Surface boundary condition: ice   fields
+   USE ice            ! LIM variables
+   USE par_ice        ! LIM parameters
+   USE dom_ice        ! LIM domain
+   USE thd_ice        ! LIM thermodynamical variables
+   USE limitd_me      ! LIM ice thickness distribution
+   USE limmsh         ! LIM mesh
+   USE limistate      ! LIM initial state
+   USE limrst         ! LIM restart
+   USE limthd         ! LIM ice thermodynamics
+   USE limthd_sal     ! LIM ice thermodynamics: salinity
+   USE limvar         ! LIM variables
+   USE limsbc         ! LIM surface boundary condition
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -39,5 +40,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -79,5 +80,6 @@
       CALL lim_thd_sal_init            ! set ice salinity parameters
       !
-      rdt_ice = nn_fsbc * rdttra(1)    ! sea-ice timestep
+      rdt_ice   = nn_fsbc * rdttra(1)  ! sea-ice timestep
+      r1_rdtice = 1._wp / rdt_ice      ! sea-ice timestep inverse
       !
       CALL lim_msh                     ! ice mesh initialization
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limadv.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limadv.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limadv.F90	(revision 3625)
@@ -15,12 +15,13 @@
    !!   lim_adv_y  : advection of sea ice on y axis
    !!----------------------------------------------------------------------
-   USE dom_oce          ! ocean domain
-   USE dom_ice          ! LIM-3 domain
-   USE ice              ! LIM-3 variables
-   USE lbclnk           ! lateral boundary condition - MPP exchanges
-   USE in_out_manager   ! I/O manager
-   USE prtctl           ! Print control
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
+   USE dom_oce        ! ocean domain
+   USE ice            ! LIM-3 variables
+   USE dom_ice        ! LIM-3 domain
+   USE lbclnk         ! lateral boundary condition - MPP exchanges
+   USE in_out_manager ! I/O manager
+   USE prtctl         ! Print control
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -37,5 +38,5 @@
 #  include "vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -88,5 +89,5 @@
             zs2new  = MIN(  2.0 * zslpmax - 0.3334 * ABS( zs1new ),      &
                &            MAX( ABS( zs1new ) - zslpmax, psxx(ji,jj) )  )
-            zin0    = ( 1.0 - MAX( rzero, sign ( rone, -zslpmax) ) ) * tms(ji,jj)   ! Case of empty boxes & Apply mask
+            zin0    = ( 1.0 - MAX( rzero, SIGN( rone, -zslpmax) ) ) * tms(ji,jj)   ! Case of empty boxes & Apply mask
 
             ps0 (ji,jj) = zslpmax  
@@ -273,5 +274,5 @@
             zs2new  = MIN(  ( 2.0 * zslpmax - 0.3334 * ABS( zs1new ) ),   &
                &             MAX( ABS( zs1new )-zslpmax, psyy(ji,jj) )  )
-            zin0    = ( 1.0 - MAX( rzero, sign ( rone, -zslpmax) ) ) * tms(ji,jj)   ! Case of empty boxes & Apply mask
+            zin0    = ( 1.0 - MAX( rzero, SIGN( rone, -zslpmax) ) ) * tms(ji,jj)   ! Case of empty boxes & Apply mask
             !
             ps0 (ji,jj) = zslpmax  
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limcons.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limcons.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limcons.F90	(revision 3625)
@@ -10,14 +10,15 @@
 #if defined key_lim3
    !!----------------------------------------------------------------------
-   !!   'key_lim3' :                                   LIM3 sea-ice model
+   !!   'key_lim3'                                      LIM-3 sea-ice model
    !!----------------------------------------------------------------------
-   !!    lim_cons   :   checks whether energy, mass and salt are conserved 
+   !!    lim_cons     :   checks whether energy, mass and salt are conserved 
    !!----------------------------------------------------------------------
-   USE par_ice          ! LIM-3 parameter
-   USE ice              ! LIM-3 variables
-   USE dom_ice          ! LIM-3 domain
-   USE dom_oce          ! ocean domain
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
+   USE par_ice        ! LIM-3 parameter
+   USE ice            ! LIM-3 variables
+   USE dom_ice        ! LIM-3 domain
+   USE dom_oce        ! ocean domain
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -29,5 +30,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limdia.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limdia.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limdia.F90	(revision 3625)
@@ -11,17 +11,18 @@
    !!   'key_lim3'                                       LIM3 sea-ice model
    !!----------------------------------------------------------------------
-   !!   lim_dia        : computation and output of the time evolution of keys variables
-   !!   lim_dia_init   : initialization and namelist read
-   !!----------------------------------------------------------------------
-   USE ice             ! LIM-3: sea-ice variable
-   USE par_ice         ! LIM-3: ice parameters
-   USE dom_ice         ! LIM-3: sea-ice domain
-   USE dom_oce         ! ocean domain
-   USE sbc_oce         ! surface boundary condition: ocean fields
-   USE daymod          ! model calendar
-   USE phycst          ! physical constant
-   USE in_out_manager  ! I/O manager
-   USE lib_mpp         ! MPP library
-   
+   !!   lim_dia       : computation and output of the time evolution of keys variables
+   !!   lim_dia_init  : initialization and namelist read
+   !!----------------------------------------------------------------------
+   USE ice            ! LIM-3: sea-ice variable
+   USE par_ice        ! LIM-3: ice parameters
+   USE dom_ice        ! LIM-3: sea-ice domain
+   USE dom_oce        ! ocean domain
+   USE sbc_oce        ! surface boundary condition: ocean fields
+   USE daymod         ! model calendar
+   USE phycst         ! physical constant
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
+
    IMPLICIT NONE
    PRIVATE
@@ -70,10 +71,11 @@
       !!              the temporal evolution of some key variables
       !!-------------------------------------------------------------------
-      INTEGER  ::   jv, ji, jj, jl   ! dummy loop indices
-      REAL(wp) ::   zshift_date      ! date from the minimum ice extent
-      REAL(wp) ::   zday, zday_min   ! current day, day of minimum extent
-      REAL(wp) ::   zafy, zamy       ! temporary area of fy and my ice
+      INTEGER  ::   jv, ji, jj, jl       ! dummy loop indices
+      INTEGER  ::   ii0, ii1, ij0, ij1   ! temporary integer
+      REAL(wp) ::   zshift_date          ! date from the minimum ice extent
+      REAL(wp) ::   zday, zday_min       ! current day, day of minimum extent
+      REAL(wp) ::   zafy, zamy           ! temporary area of fy and my ice
       REAL(wp) ::   zindb
-      REAL(wp), DIMENSION(jpinfmx) ::   vinfor           ! temporary working space 
+      REAL(wp), DIMENSION(jpinfmx) ::   vinfor   ! 1D workspace 
       !!-------------------------------------------------------------------
 
@@ -105,5 +107,5 @@
             IF( tms(ji,jj) == 1 ) THEN
                vinfor(3)  = vinfor(3)  + at_i(ji,jj)*aire(ji,jj) * 1.e-12_wp !ice area
-               IF (at_i(ji,jj).GT.0.15) vinfor(5) = vinfor(5) + aire(ji,jj) * 1.e-12_wp !ice extent
+               IF ( at_i(ji,jj) > 0.15 )   vinfor(5) = vinfor(5) + aire(ji,jj) * 1.e-12_wp !ice extent
                vinfor(7)  = vinfor(7)  + vt_i(ji,jj)*aire(ji,jj) * 1.e-12_wp !ice volume
                vinfor(9)  = vinfor(9)  + vt_s(ji,jj)*aire(ji,jj) * 1.e-12_wp !snow volume
@@ -111,9 +113,9 @@
                vinfor(29) = vinfor(29) + smt_i(ji,jj)*vt_i(ji,jj)*aire(ji,jj) * 1.e-12_wp !mean salinity
                ! the computation of this diagnostic is not reliable
-               vinfor(31) = vinfor(31) + vt_i(ji,jj)*( u_ice(ji,jj)*u_ice(ji,jj) + & 
-                  v_ice(ji,jj)*v_ice(ji,jj) )*aire(ji,jj)/1.0e12 
-               vinfor(53) = vinfor(53) + emps(ji,jj)*aire(ji,jj) * 1.e-12_wp !salt flux
-               vinfor(55) = vinfor(55) + fsbri(ji,jj)*aire(ji,jj) * 1.e-12_wp !brine drainage flux
-               vinfor(57) = vinfor(57) + fseqv(ji,jj)*aire(ji,jj) * 1.e-12_wp !equivalent salt flux
+               vinfor(31) = vinfor(31) + vt_i(ji,jj) * (  u_ice(ji,jj)*u_ice(ji,jj)   & 
+                  &                                     + v_ice(ji,jj)*v_ice(ji,jj) ) * aire(ji,jj) * 1.e-12 
+               vinfor(53) = vinfor(53) + sfx (ji,jj)*aire(ji,jj) * 1.e-12_wp !salt flux
+               vinfor(55) = vinfor(55) + sfx_bri(ji,jj)*aire(ji,jj) * 1.e-12_wp !brine drainage flux
+               vinfor(57) = vinfor(57) + sfx_thd(ji,jj)*aire(ji,jj) * 1.e-12_wp !equivalent salt flux
                vinfor(59) = vinfor(59) +(sst_m(ji,jj)+rt0)*at_i(ji,jj)*aire(ji,jj) * 1.e-12_wp  !SST
                vinfor(61) = vinfor(61) + sss_m(ji,jj)*at_i(ji,jj)*aire(ji,jj) * 1.e-12_wp  !SSS
@@ -180,5 +182,5 @@
                vinfor(43) = vinfor(43) + diag_dyn_gr(ji,jj)*aire(ji,jj) * 1.e-12_wp 
                vinfor(45) = vinfor(45) + dv_dt_thd(ji,jj,5)*aire(ji,jj) * 1.e-12_wp
-               vinfor(47) = vinfor(47) + v_newice(ji,jj) *aire(ji,jj) * 1.e-12_wp / rdt_ice ! volume acc in OW
+               vinfor(47) = vinfor(47) + v_newice(ji,jj) *aire(ji,jj) * 1.e-12_wp * r1_rdtice   ! volume acc in OW
             ENDIF
          END DO
@@ -231,18 +233,20 @@
       vinfor(51) = zindb*vinfor(51) / MAX(vinfor(27),epsi06)
 
-      !! Fram Strait Export
-      !! 83 = area export
-      !! 84 = volume export
-      !! Fram strait in ORCA2 = 5 points
-      !! export = -v_ice*e1t*ddtb*at_i or -v_ice*e1t*ddtb*at_i*h_i
-      jj = 136 ! C grid
-      vinfor(83) = 0.0
-      vinfor(84) = 0.0
-      DO ji = 134, 138
-         vinfor(83) = vinfor(83) - v_ice(ji,jj) * & 
-            e1t(ji,jj)*at_i(ji,jj)*rdt_ice * 1.e-12_wp
-         vinfor(84) = vinfor(84) - v_ice(ji,jj) * & 
-            e1t(ji,jj)*vt_i(ji,jj)*rdt_ice * 1.e-12_wp
-      END DO
+      IF( cp_cfg == "orca" ) THEN   !* ORCA configuration : Fram Strait Export
+         SELECT CASE ( jp_cfg )
+         CASE ( 2 )                          ! ORCA_R2
+            ij0 = 136   ;   ij1 = 136              ! Fram strait : 83 = area export
+            ii0 = 134   ;   ii1 = 138              !               84 = volume export
+            DO jj = mj0(ij0),mj1(ij1)
+               DO ji = mi0(ii0),mi1(ii1)
+                  vinfor(83) = vinfor(83) - v_ice(ji,jj) * e1t(ji,jj)*at_i(ji,jj)*rdt_ice * 1.e-12_wp
+                  vinfor(84) = vinfor(84) - v_ice(ji,jj) * e1t(ji,jj)*vt_i(ji,jj)*rdt_ice * 1.e-12_wp
+               END DO
+            END DO
+         END SELECT
+!!gm   just above, this is NOT the correct way of evaluating the transport !
+!!gm        mass of snow is missing and v_ice should be the mean between jj and jj+1
+!!gm   Other ORCA configurations should be added
+      ENDIF
 
       !!-------------------------------------------------------------------
@@ -264,7 +268,7 @@
                vinfor(32) = vinfor(32) + vt_i(ji,jj)*( u_ice(ji,jj)*u_ice(ji,jj) + & 
                   v_ice(ji,jj)*v_ice(ji,jj) )*aire(ji,jj)/1.0e12 !ice vel
-               vinfor(54) = vinfor(54) + at_i(ji,jj)*emps(ji,jj)*aire(ji,jj) * 1.e-12_wp ! Total salt flux
-               vinfor(56) = vinfor(56) + at_i(ji,jj)*fsbri(ji,jj)*aire(ji,jj) * 1.e-12_wp ! Brine drainage salt flux
-               vinfor(58) = vinfor(58) + at_i(ji,jj)*fseqv(ji,jj)*aire(ji,jj) * 1.e-12_wp ! Equivalent salt flux
+               vinfor(54) = vinfor(54) + sfx (ji,jj)*aire(ji,jj) * 1.e-12_wp ! Total salt flux
+               vinfor(56) = vinfor(56) + sfx_bri(ji,jj)*aire(ji,jj) * 1.e-12_wp ! Brine drainage salt flux
+               vinfor(58) = vinfor(58) + sfx_thd(ji,jj)*aire(ji,jj) * 1.e-12_wp ! Equivalent salt flux
                vinfor(60) = vinfor(60) +(sst_m(ji,jj)+rt0)*at_i(ji,jj)*aire(ji,jj) * 1.e-12_wp  !SST
                vinfor(62) = vinfor(62) + sss_m(ji,jj)*at_i(ji,jj)*aire(ji,jj) * 1.e-12_wp  !SSS
@@ -331,5 +335,5 @@
                vinfor(44) = vinfor(44) + diag_dyn_gr(ji,jj)*aire(ji,jj) * 1.e-12_wp 
                vinfor(46) = vinfor(46) + dv_dt_thd(ji,jj,5)*aire(ji,jj) * 1.e-12_wp
-               vinfor(48) = vinfor(48) + v_newice(ji,jj) *aire(ji,jj) * 1.e-12_wp / rdt_ice ! volume acc in OW
+               vinfor(48) = vinfor(48) + v_newice(ji,jj) *aire(ji,jj) * 1.e-12_wp * r1_rdtice   ! volume acc in OW
             ENDIF
          END DO
@@ -345,6 +349,6 @@
          END DO
       END DO
-      zindb      = 1.0 - MAX(0.0,SIGN(1.0,-vinfor(4))) !
-      vinfor(64) = zindb * vinfor(64) / MAX(vinfor(4),epsi06) ! divide by ice extt
+      zindb      = 1._wp - MAX(  0._wp , SIGN( 1._wp , -vinfor(4) )  )   !
+      vinfor(64) = zindb * vinfor(64) / MAX( vinfor(4) , epsi06 )   ! divide by ice extt
       !! 2.2) Diagnostics dependent on age
       !!------------------------------------
@@ -368,8 +372,8 @@
                   ENDIF
                END DO ! jl
-               IF ((at_i(ji,jj).GT.0.15).AND.(zafy.GT.zamy)) THEN
+               IF ( at_i(ji,jj)  >  0.15  .AND. zafy  >  zamy ) THEN
                   vinfor(22) = vinfor(22) + aire(ji,jj) * 1.e-12_wp ! Seasonal ice extent
                ENDIF
-               IF ((at_i(ji,jj).GT.0.15).AND.(zafy.LE.zamy)) THEN
+               IF ( at_i(ji,jj)  >  0.15  .AND. zafy <= zamy ) THEN
                   vinfor(24) = vinfor(24) + aire(ji,jj) * 1.e-12_wp ! Perennial ice extent
                ENDIF
@@ -377,8 +381,8 @@
          END DO ! jj
       END DO ! ji
-      zindb      = 1.0 - MAX(0.0,SIGN(1.0,-vinfor(26))) !=0 if no multiyear ice 1 if yes
-      vinfor(50) = zindb*vinfor(50) / MAX(vinfor(26),epsi06)
-      zindb      = 1.0 - MAX(0.0,SIGN(1.0,-vinfor(28))) !=0 if no multiyear ice 1 if yes
-      vinfor(52) = zindb*vinfor(52) / MAX(vinfor(28),epsi06)
+      zindb      = 1.0 - MAX(  0.0,SIGN( 1._wp , -vinfor(26) )  )     !=0 if no multiyear ice 1 if yes
+      vinfor(50) = zindb * vinfor(50) / MAX( vinfor(26) , epsi06 )
+      zindb      = 1.0 - MAX(  0._wp , SIGN( 1._wp , -vinfor(28) )  ) !=0 if no multiyear ice 1 if yes
+      vinfor(52) = zindb * vinfor(52) / MAX( vinfor(28) , epsi06 )
 
       !  Accumulation before averaging 
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limdyn.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limdyn.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limdyn.F90	(revision 3625)
@@ -15,17 +15,18 @@
    !!    lim_dyn_init : initialization and namelist read
    !!----------------------------------------------------------------------
-   USE phycst           ! physical constants
-   USE dom_oce          ! ocean space and time domain
-   USE sbc_oce          ! Surface boundary condition: ocean fields
-   USE sbc_ice          ! Surface boundary condition: ice   fields
-   USE ice              ! LIM-3 variables
-   USE par_ice          ! LIM-3 parameters
-   USE dom_ice          ! LIM-3 domain
-   USE limrhg           ! LIM-3 rheology
-   USE lbclnk           ! lateral boundary conditions - MPP exchanges
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
-   USE in_out_manager   ! I/O manager
-   USE prtctl           ! Print control
+   USE phycst         ! physical constants
+   USE dom_oce        ! ocean space and time domain
+   USE sbc_oce        ! Surface boundary condition: ocean fields
+   USE sbc_ice        ! Surface boundary condition: ice   fields
+   USE ice            ! LIM-3 variables
+   USE par_ice        ! LIM-3 parameters
+   USE dom_ice        ! LIM-3 domain
+   USE limrhg         ! LIM-3 rheology
+   USE lbclnk         ! lateral boundary conditions - MPP exchanges
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE in_out_manager ! I/O manager
+   USE prtctl         ! Print control
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -37,5 +38,5 @@
 #  include "vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limhdf.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limhdf.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limhdf.F90	(revision 3625)
@@ -12,13 +12,14 @@
    !!   'key_lim3'                                      LIM3 sea-ice model
    !!----------------------------------------------------------------------
-   !!   lim_hdf  : diffusion trend on sea-ice variable
+   !!   lim_hdf       : diffusion trend on sea-ice variable
    !!----------------------------------------------------------------------
-   USE dom_oce          ! ocean domain
-   USE ice              ! LIM-3: ice variables
-   USE lbclnk           ! lateral boundary condition - MPP exchanges
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
-   USE prtctl           ! Print control
-   USE in_out_manager   ! I/O manager
+   USE dom_oce        ! ocean domain
+   USE ice            ! LIM-3: ice variables
+   USE lbclnk         ! lateral boundary condition - MPP exchanges
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE prtctl         ! Print control
+   USE in_out_manager ! I/O manager
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -34,5 +35,5 @@
 #  include "vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2010)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2010)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limistate.F90	(revision 3625)
@@ -26,4 +26,5 @@
    USE lib_mpp          ! MPP library
    USE wrk_nemo         ! work arrays
+   USE lib_fortran      ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -48,5 +49,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limitd_me.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limitd_me.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limitd_me.F90	(revision 3625)
@@ -10,22 +10,23 @@
 #if defined key_lim3
    !!----------------------------------------------------------------------
-   !!   'key_lim3' :                                    LIM3 sea-ice model
+   !!   'key_lim3'                                      LIM-3 sea-ice model
    !!----------------------------------------------------------------------
-   USE par_oce          ! ocean parameters
-   USE dom_oce          ! ocean domain
-   USE phycst           ! physical constants (ocean directory) 
-   USE sbc_oce          ! surface boundary condition: ocean fields
-   USE thd_ice          ! LIM thermodynamics
-   USE ice              ! LIM variables
-   USE par_ice          ! LIM parameters
-   USE dom_ice          ! LIM domain
-   USE limthd_lac       ! LIM
-   USE limvar           ! LIM
-   USE limcons          ! LIM
-   USE in_out_manager   ! I/O manager
-   USE lbclnk           ! lateral boundary condition - MPP exchanges
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
-   USE prtctl           ! Print control
+   USE par_oce        ! ocean parameters
+   USE dom_oce        ! ocean domain
+   USE phycst         ! physical constants (ocean directory) 
+   USE sbc_oce        ! surface boundary condition: ocean fields
+   USE thd_ice        ! LIM thermodynamics
+   USE ice            ! LIM variables
+   USE par_ice        ! LIM parameters
+   USE dom_ice        ! LIM domain
+   USE limthd_lac     ! LIM
+   USE limvar         ! LIM
+   USE limcons        ! LIM
+   USE in_out_manager ! I/O manager
+   USE lbclnk         ! lateral boundary condition - MPP exchanges
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE prtctl         ! Print control
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -38,7 +39,7 @@
    PUBLIC   lim_itd_me_alloc        ! called by iceini.F90
 
-   REAL(wp)  ::   epsi11 = 1.e-11_wp   ! constant values
-   REAL(wp)  ::   epsi10 = 1.e-10_wp   ! constant values
-   REAL(wp)  ::   epsi06 = 1.e-06_wp   ! constant values
+   REAL(wp) ::   epsi11 = 1.e-11_wp   ! constant values
+   REAL(wp) ::   epsi10 = 1.e-10_wp   ! constant values
+   REAL(wp) ::   epsi06 = 1.e-06_wp   ! constant values
 
    !-----------------------------------------------------------------------
@@ -47,8 +48,8 @@
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   asum     ! sum of total ice and open water area
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   aksum    ! ratio of area removed to area ridged
-
+   !
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   athorn   ! participation function; fraction of ridging/
    !                                                           !  closing associated w/ category n
-
+   !
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   hrmin    ! minimum ridge thickness
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   hrmax    ! maximum ridge thickness
@@ -70,4 +71,5 @@
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   dvirdgdt   ! rate of ice volume ridged (m/s)
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   opening    ! rate of opening due to divergence/shear (1/s)
+   !
    !!----------------------------------------------------------------------
    !! NEMO/LIM3 3.3 , UCL - NEMO Consortium (2010)
@@ -126,7 +128,7 @@
       INTEGER ::   ji, jj, jk, jl   ! dummy loop index
       INTEGER ::   niter, nitermax = 20   ! local integer 
-      LOGICAL  ::   asum_error              ! flag for asum .ne. 1
-      INTEGER  ::   iterate_ridging         ! if true, repeat the ridging
-      REAL(wp) ::   w1, tmpfac, dti         ! local scalar
+      LOGICAL  ::   asum_error            ! flag for asum .ne. 1
+      INTEGER  ::   iterate_ridging       ! if true, repeat the ridging
+      REAL(wp) ::   w1, tmpfac            ! local scalar
       CHARACTER (len = 15) ::   fieldid
       REAL(wp), POINTER, DIMENSION(:,:) ::   closing_net     ! net rate at which area is removed    (1/s)
@@ -152,12 +154,12 @@
       ! 1) Thickness categories boundaries, ice / o.w. concentrations, init_ons
       !-----------------------------------------------------------------------------!
-      ! Set hi_max(ncat) to a big value to ensure that all ridged ice 
-      ! is thinner than hi_max(ncat).
+      ! Set hi_max(ncat) to a big value to ensure that all ridged ice is thinner than hi_max(ncat).
 
       hi_max(jpl) = 999.99
 
-      Cp = 0.5 * grav * (rau0-rhoic) * rhoic / rau0      ! proport const for PE
-      CALL lim_itd_me_ridgeprep ! prepare ridging
-
+      Cp = 0.5 * grav * (rau0-rhoic) * rhoic / rau0                ! proport const for PE
+      !
+      CALL lim_itd_me_ridgeprep                                    ! prepare ridging
+      !
       IF( con_i)   CALL lim_column_sum( jpl, v_i, vt_i_init )      ! conservation check
 
@@ -166,8 +168,8 @@
             msnow_mlt(ji,jj) = 0._wp
             esnow_mlt(ji,jj) = 0._wp
-            dardg1dt (ji,jj)  = 0._wp
-            dardg2dt (ji,jj)  = 0._wp
-            dvirdgdt (ji,jj)  = 0._wp
-            opening  (ji,jj)  = 0._wp
+            dardg1dt (ji,jj) = 0._wp
+            dardg2dt (ji,jj) = 0._wp
+            dvirdgdt (ji,jj) = 0._wp
+            opening  (ji,jj) = 0._wp
 
             !-----------------------------------------------------------------------------!
@@ -201,5 +203,5 @@
             ! to give asum = 1.0 after ridging.
 
-            divu_adv(ji,jj) = ( 1._wp - asum(ji,jj) ) / rdt_ice  ! asum found in ridgeprep
+            divu_adv(ji,jj) = ( 1._wp - asum(ji,jj) ) * r1_rdtice  ! asum found in ridgeprep
 
             IF( divu_adv(ji,jj) < 0._wp )   closing_net(ji,jj) = MAX( closing_net(ji,jj), -divu_adv(ji,jj) )
@@ -207,6 +209,5 @@
             ! 2.3 opning
             !------------
-            ! Compute the (non-negative) opening rate that will give 
-            ! asum = 1.0 after ridging.
+            ! Compute the (non-negative) opening rate that will give asum = 1.0 after ridging.
             opning(ji,jj) = closing_net(ji,jj) + divu_adv(ji,jj)
          END DO
@@ -257,5 +258,5 @@
                   IF ( a_i(ji,jj,jl) > epsi11 .AND. athorn(ji,jj,jl) > 0._wp )THEN
                      w1 = athorn(ji,jj,jl) * closing_gross(ji,jj) * rdt_ice
-                     IF ( w1 > a_i(ji,jj,jl) ) THEN
+                     IF ( w1  >  a_i(ji,jj,jl) ) THEN
                         tmpfac = a_i(ji,jj,jl) / w1
                         closing_gross(ji,jj) = closing_gross(ji,jj) * tmpfac
@@ -291,5 +292,5 @@
                ELSE
                   iterate_ridging    = 1
-                  divu_adv   (ji,jj) = (1._wp - asum(ji,jj)) / rdt_ice
+                  divu_adv   (ji,jj) = (1._wp - asum(ji,jj)) * r1_rdtice
                   closing_net(ji,jj) = MAX( 0._wp, -divu_adv(ji,jj) )
                   opning     (ji,jj) = MAX( 0._wp,  divu_adv(ji,jj) )
@@ -308,5 +309,5 @@
 
          IF( iterate_ridging == 1 ) THEN
-            IF( niter .GT. nitermax ) THEN
+            IF( niter  >  nitermax ) THEN
                WRITE(numout,*) ' ALERTE : non-converging ridging scheme '
                WRITE(numout,*) ' niter, iterate_ridging ', niter, iterate_ridging
@@ -323,6 +324,4 @@
       ! Update fresh water and heat fluxes due to snow melt.
 
-      dti = 1._wp / rdt_ice
-
       asum_error = .false. 
 
@@ -330,16 +329,16 @@
          DO ji = 1, jpi
 
-            IF (ABS(asum(ji,jj) - 1.0) .GT. epsi11) asum_error = .true.
-
-            dardg1dt(ji,jj) = dardg1dt(ji,jj) * dti
-            dardg2dt(ji,jj) = dardg2dt(ji,jj) * dti
-            dvirdgdt(ji,jj) = dvirdgdt(ji,jj) * dti
-            opening (ji,jj) = opening (ji,jj) * dti
+            IF( ABS( asum(ji,jj) - 1.0 ) > epsi11 )   asum_error = .true.
+
+            dardg1dt(ji,jj) = dardg1dt(ji,jj) * r1_rdtice
+            dardg2dt(ji,jj) = dardg2dt(ji,jj) * r1_rdtice
+            dvirdgdt(ji,jj) = dvirdgdt(ji,jj) * r1_rdtice
+            opening (ji,jj) = opening (ji,jj) * r1_rdtice
 
             !-----------------------------------------------------------------------------!
             ! 5) Heat, salt and freshwater fluxes
             !-----------------------------------------------------------------------------!
-            fmmec(ji,jj) = fmmec(ji,jj) + msnow_mlt(ji,jj) * dti     ! fresh water source for ocean
-            fhmec(ji,jj) = fhmec(ji,jj) + esnow_mlt(ji,jj) * dti     ! heat sink for ocean
+            fmmec(ji,jj) = fmmec(ji,jj) + msnow_mlt(ji,jj) * r1_rdtice     ! fresh water source for ocean
+            fhmec(ji,jj) = fhmec(ji,jj) + esnow_mlt(ji,jj) * r1_rdtice     ! heat sink for ocean
 
          END DO
@@ -349,5 +348,5 @@
       DO jj = 1, jpj
          DO ji = 1, jpi
-            IF (ABS(asum(ji,jj) - 1.0) .GT. epsi11) THEN ! there is a bug
+            IF( ABS( asum(ji,jj) - 1._wp )  >  epsi11 ) THEN   ! there is a bug
                WRITE(numout,*) ' '
                WRITE(numout,*) ' ALERTE : Ridging error: total area = ', asum(ji,jj)
@@ -391,5 +390,5 @@
       d_oa_i_trp (:,:,:)   = oa_i (:,:,:)   - old_oa_i (:,:,:)
       d_smv_i_trp(:,:,:)   = 0._wp
-      IF(  num_sal == 2  .OR.  num_sal == 4  )   d_smv_i_trp(:,:,:)  = smv_i(:,:,:) - old_smv_i(:,:,:)
+      IF(  num_sal == 2  )   d_smv_i_trp(:,:,:)  = smv_i(:,:,:) - old_smv_i(:,:,:)
 
       IF(ln_ctl) THEN     ! Control print
@@ -430,13 +429,13 @@
 
       ! update of fields will be made later in lim update
-      u_ice(:,:)    = old_u_ice(:,:)
-      v_ice(:,:)    = old_v_ice(:,:)
-      a_i(:,:,:)    = old_a_i(:,:,:)
-      v_s(:,:,:)    = old_v_s(:,:,:)
-      v_i(:,:,:)    = old_v_i(:,:,:)
-      e_s(:,:,:,:)  = old_e_s(:,:,:,:)
-      e_i(:,:,:,:)  = old_e_i(:,:,:,:)
-      oa_i(:,:,:)   = old_oa_i(:,:,:)
-      IF(  num_sal == 2  .OR.  num_sal == 4  )   smv_i(:,:,:)  = old_smv_i(:,:,:)
+      u_ice(:,:)   = old_u_ice(:,:)
+      v_ice(:,:)   = old_v_ice(:,:)
+      a_i(:,:,:)   = old_a_i(:,:,:)
+      v_s(:,:,:)   = old_v_s(:,:,:)
+      v_i(:,:,:)   = old_v_i(:,:,:)
+      e_s(:,:,:,:) = old_e_s(:,:,:,:)
+      e_i(:,:,:,:) = old_e_i(:,:,:,:)
+      oa_i(:,:,:)  = old_oa_i(:,:,:)
+      IF(  num_sal == 2  )   smv_i(:,:,:) = old_smv_i(:,:,:)
 
       !----------------------------------------------------!
@@ -465,23 +464,23 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-               IF ( ( old_v_i(ji,jj,jl) < epsi06 ) .AND. &
-                  ( d_v_i_trp(ji,jj,jl) > epsi06 ) ) THEN
-                  old_v_i(ji,jj,jl)     = d_v_i_trp(ji,jj,jl)
-                  d_v_i_trp(ji,jj,jl)   = 0._wp
-                  old_a_i(ji,jj,jl)     = d_a_i_trp(ji,jj,jl)
-                  d_a_i_trp(ji,jj,jl)   = 0._wp
-                  old_v_s(ji,jj,jl)     = d_v_s_trp(ji,jj,jl)
-                  d_v_s_trp(ji,jj,jl)   = 0._wp
-                  old_e_s(ji,jj,1,jl)   = d_e_s_trp(ji,jj,1,jl)
-                  d_e_s_trp(ji,jj,1,jl) = 0._wp
-                  old_oa_i(ji,jj,jl)    = d_oa_i_trp(ji,jj,jl)
-                  d_oa_i_trp(ji,jj,jl)  = 0._wp
-                  IF(  num_sal == 2  .OR.  num_sal == 4  )   old_smv_i(ji,jj,jl)   = d_smv_i_trp(ji,jj,jl)
-                  d_smv_i_trp(ji,jj,jl) = 0._wp
+               IF(  old_v_i  (ji,jj,jl) < epsi06  .AND. &
+                    d_v_i_trp(ji,jj,jl) > epsi06    ) THEN
+                  old_v_i   (ji,jj,jl)   = d_v_i_trp(ji,jj,jl)
+                  d_v_i_trp (ji,jj,jl)   = 0._wp
+                  old_a_i   (ji,jj,jl)   = d_a_i_trp(ji,jj,jl)
+                  d_a_i_trp (ji,jj,jl)   = 0._wp
+                  old_v_s   (ji,jj,jl)   = d_v_s_trp(ji,jj,jl)
+                  d_v_s_trp (ji,jj,jl)   = 0._wp
+                  old_e_s   (ji,jj,1,jl) = d_e_s_trp(ji,jj,1,jl)
+                  d_e_s_trp (ji,jj,1,jl) = 0._wp
+                  old_oa_i  (ji,jj,jl)   = d_oa_i_trp(ji,jj,jl)
+                  d_oa_i_trp(ji,jj,jl)   = 0._wp
+                  IF(  num_sal == 2  )   old_smv_i(ji,jj,jl) = d_smv_i_trp(ji,jj,jl)
+                  d_smv_i_trp(ji,jj,jl)  = 0._wp
                ENDIF
             END DO
          END DO
       END DO
-
+      !
       CALL wrk_dealloc( jpi, jpj, closing_net, divu_adv, opning, closing_gross, msnow_mlt, esnow_mlt, vt_i_init, vt_i_final )
       !
@@ -612,13 +611,13 @@
                   ! present
                   zworka(ji,jj) = 4.0 * strength(ji,jj)              &
-                     + strength(ji-1,jj) * tms(ji-1,jj) &  
-                     + strength(ji+1,jj) * tms(ji+1,jj) &  
-                     + strength(ji,jj-1) * tms(ji,jj-1) &  
-                     + strength(ji,jj+1) * tms(ji,jj+1)    
+                     &          + strength(ji-1,jj) * tms(ji-1,jj) &  
+                     &          + strength(ji+1,jj) * tms(ji+1,jj) &  
+                     &          + strength(ji,jj-1) * tms(ji,jj-1) &  
+                     &          + strength(ji,jj+1) * tms(ji,jj+1)    
 
                   zw1 = 4.0 + tms(ji-1,jj) + tms(ji+1,jj) + tms(ji,jj-1) + tms(ji,jj+1)
                   zworka(ji,jj) = zworka(ji,jj) / zw1
                ELSE
-                  zworka(ji,jj) = 0.0
+                  zworka(ji,jj) = 0._wp
                ENDIF
             END DO
@@ -1048,6 +1047,6 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-               IF (aicen_init(ji,jj,jl1) .GT. epsi11 .AND. athorn(ji,jj,jl1) .GT. 0.0       &
-                  .AND. closing_gross(ji,jj) > 0.0) THEN
+               IF( aicen_init(ji,jj,jl1)  >  epsi11  .AND.  athorn(ji,jj,jl1)  >  0._wp       &
+                  .AND. closing_gross(ji,jj) > 0._wp ) THEN
                   icells = icells + 1
                   indxi(icells) = ji
@@ -1130,5 +1129,5 @@
             ! Salinity
             !-------------
-            smsw(ji,jj)  = sss_m(ji,jj) * vsw(ji,jj) * rhoic / rau0       ! salt content of water frozen in voids
+            smsw(ji,jj)  = sss_m(ji,jj) * vsw(ji,jj) * rhoic / rau0       ! salt content of seawater frozen in voids
 
             zsrdg2       = srdg1(ji,jj) + smsw(ji,jj)                     ! salt content of new ridge
@@ -1137,6 +1136,8 @@
             
             !                                                             ! excess of salt is flushed into the ocean
-            fsalt_rpo(ji,jj) = fsalt_rpo(ji,jj) + ( zsrdg2 - srdg2(ji,jj) ) * rhoic / rdt_ice
-
+            sfx_mec(ji,jj) = sfx_mec(ji,jj) + ( zsrdg2 - srdg2(ji,jj) ) * rhoic * r1_rdtice
+
+            rdm_ice(ji,jj) = rdm_ice(ji,jj) + vsw(ji,jj) * rhoic / rau0   ! increase in ice volume du to seawater frozen in voids
+            
             !------------------------------------            
             ! 3.6 Increment ridging diagnostics
@@ -1148,6 +1149,6 @@
             dardg1dt   (ji,jj) = dardg1dt(ji,jj) + ardg1(ji,jj) + arft1(ji,jj)
             dardg2dt   (ji,jj) = dardg2dt(ji,jj) + ardg2(ji,jj) + arft2(ji,jj)
-            diag_dyn_gr(ji,jj) = diag_dyn_gr(ji,jj) + ( vrdg2(ji,jj) + virft(ji,jj) ) / rdt_ice
-            opening    (ji,jj) = opening (ji,jj) + opning(ji,jj)*rdt_ice
+            diag_dyn_gr(ji,jj) = diag_dyn_gr(ji,jj) + ( vrdg2(ji,jj) + virft(ji,jj) ) * r1_rdtice
+            opening    (ji,jj) = opening (ji,jj) + opning(ji,jj) * rdt_ice
 
             IF( con_i )   vice_init(ji,jj) = vice_init(ji,jj) + vrdg2(ji,jj) - vrdg1(ji,jj)
@@ -1156,5 +1157,4 @@
             ! 3.7 Put the snow somewhere in the ocean
             !------------------------------------------            
-
             !  Place part of the snow lost by ridging into the ocean. 
             !  Note that esnow_mlt < 0; the ocean must cool to melt snow.
@@ -1179,7 +1179,6 @@
             !           ij looping 1-icells
 
-            dhr(ji,jj)  = hrmax(ji,jj,jl1) - hrmin(ji,jj,jl1)
+            dhr (ji,jj) = hrmax(ji,jj,jl1) - hrmin(ji,jj,jl1)
             dhr2(ji,jj) = hrmax(ji,jj,jl1) * hrmax(ji,jj,jl1) - hrmin(ji,jj,jl1) * hrmin(ji,jj,jl1)
-
 
          END DO                 ! ij
@@ -1211,5 +1210,5 @@
 
                ! heat flux
-               fheat_rpo(ji,jj) = fheat_rpo(ji,jj) + ( ersw(ji,jj,jk) - zdummy0 ) / rdt_ice
+               fheat_mec(ji,jj) = fheat_mec(ji,jj) + ( ersw(ji,jj,jk) - zdummy0 ) * r1_rdtice
 
                ! Correct dimensions to avoid big values
@@ -1275,23 +1274,23 @@
                ! Transfer area, volume, and energy accordingly.
 
-               IF (hrmin(ji,jj,jl1) .GE. hi_max(jl2) .OR.        &
-                  hrmax(ji,jj,jl1) .LE. hi_max(jl2-1)) THEN
-                  hL = 0.0
-                  hR = 0.0
+               IF( hrmin(ji,jj,jl1) >= hi_max(jl2)  .OR.        &
+                   hrmax(ji,jj,jl1) <= hi_max(jl2-1) ) THEN
+                  hL = 0._wp
+                  hR = 0._wp
                ELSE
-                  hL = MAX (hrmin(ji,jj,jl1), hi_max(jl2-1))
-                  hR = MIN (hrmax(ji,jj,jl1), hi_max(jl2))
+                  hL = MAX( hrmin(ji,jj,jl1), hi_max(jl2-1) )
+                  hR = MIN( hrmax(ji,jj,jl1), hi_max(jl2)   )
                ENDIF
 
                ! fraction of ridged ice area and volume going to n2
-               farea = (hR-hL) / dhr(ji,jj) 
-               fvol(ji,jj) = (hR*hR - hL*hL) / dhr2(ji,jj)
-
-               a_i  (ji,jj,jl2)   = a_i  (ji,jj,jl2)   + ardg2 (ji,jj) * farea
-               v_i  (ji,jj,jl2)   = v_i  (ji,jj,jl2)   + vrdg2 (ji,jj) * fvol(ji,jj)
-               v_s  (ji,jj,jl2)   = v_s  (ji,jj,jl2)   + vsrdg (ji,jj) * fvol(ji,jj) * fsnowrdg
+               farea = ( hR - hL ) / dhr(ji,jj) 
+               fvol(ji,jj) = ( hR*hR - hL*hL ) / dhr2(ji,jj)
+
+               a_i  (ji,jj  ,jl2) = a_i  (ji,jj  ,jl2) + ardg2 (ji,jj) * farea
+               v_i  (ji,jj  ,jl2) = v_i  (ji,jj  ,jl2) + vrdg2 (ji,jj) * fvol(ji,jj)
+               v_s  (ji,jj  ,jl2) = v_s  (ji,jj  ,jl2) + vsrdg (ji,jj) * fvol(ji,jj) * fsnowrdg
                e_s  (ji,jj,1,jl2) = e_s  (ji,jj,1,jl2) + esrdg (ji,jj) * fvol(ji,jj) * fsnowrdg
-               smv_i(ji,jj,jl2)   = smv_i(ji,jj,jl2)   + srdg2 (ji,jj) * fvol(ji,jj)
-               oa_i (ji,jj,jl2)   = oa_i (ji,jj,jl2)   + oirdg2(ji,jj) * farea
+               smv_i(ji,jj  ,jl2) = smv_i(ji,jj  ,jl2) + srdg2 (ji,jj) * fvol(ji,jj)
+               oa_i (ji,jj  ,jl2) = oa_i (ji,jj  ,jl2) + oirdg2(ji,jj) * farea
 
             END DO ! ij
@@ -1317,15 +1316,15 @@
                ! Compute the fraction of rafted ice area and volume going to 
                ! thickness category jl2, transfer area, volume, and energy accordingly.
-
-               IF (hraft(ji,jj,jl1) .LE. hi_max(jl2) .AND.        &
-                  hraft(ji,jj,jl1) .GT. hi_max(jl2-1)) THEN
-                  a_i(ji,jj,jl2) = a_i(ji,jj,jl2) + arft2(ji,jj)
-                  v_i(ji,jj,jl2) = v_i(ji,jj,jl2) + virft(ji,jj)
-                  v_s(ji,jj,jl2) = v_s(ji,jj,jl2) + vsrft(ji,jj)*fsnowrft
-                  e_s(ji,jj,1,jl2) = e_s(ji,jj,1,jl2) + esrft(ji,jj)*fsnowrft
-                  smv_i(ji,jj,jl2) = smv_i(ji,jj,jl2) + smrft(ji,jj)    
-                  oa_i(ji,jj,jl2)  = oa_i(ji,jj,jl2)  + oirft2(ji,jj)    
+               !
+               IF( hraft(ji,jj,jl1) <= hi_max(jl2)  .AND.        &
+                   hraft(ji,jj,jl1) >  hi_max(jl2-1) ) THEN
+                  a_i  (ji,jj  ,jl2) = a_i  (ji,jj  ,jl2) + arft2 (ji,jj)
+                  v_i  (ji,jj  ,jl2) = v_i  (ji,jj  ,jl2) + virft (ji,jj)
+                  v_s  (ji,jj  ,jl2) = v_s  (ji,jj  ,jl2) + vsrft (ji,jj) * fsnowrft
+                  e_s  (ji,jj,1,jl2) = e_s  (ji,jj,1,jl2) + esrft (ji,jj) * fsnowrft
+                  smv_i(ji,jj  ,jl2) = smv_i(ji,jj  ,jl2) + smrft (ji,jj)    
+                  oa_i (ji,jj  ,jl2) = oa_i (ji,jj  ,jl2) + oirft2(ji,jj)    
                ENDIF ! hraft
-
+               !
             END DO ! ij
 
@@ -1336,6 +1335,6 @@
                   ji = indxi(ij)
                   jj = indxj(ij)
-                  IF (hraft(ji,jj,jl1) .LE. hi_max(jl2) .AND.        &
-                     hraft(ji,jj,jl1) .GT. hi_max(jl2-1)) THEN
+                  IF(  hraft(ji,jj,jl1)  <=  hi_max(jl2)   .AND.        &
+                       hraft(ji,jj,jl1)  >   hi_max(jl2-1)  ) THEN
                      e_i(ji,jj,jk,jl2) = e_i(ji,jj,jk,jl2) + eirft(ji,jj,jk)
                   ENDIF
@@ -1504,5 +1503,5 @@
             DO jj = 1 , jpj
                DO ji = 1 , jpi
-!!gm                  xtmp = e_i(ji,jj,jk,jl) / area(ji,jj) / rdt_ice
+!!gm                  xtmp = e_i(ji,jj,jk,jl) / area(ji,jj) * r1_rdtice
 !!gm                  xtmp = xtmp * unit_fac
                   ! fheat_res(ji,jj) = fheat_res(ji,jj) - xtmp
@@ -1524,8 +1523,8 @@
                ! fluxes are positive to the ocean
                ! here the flux has to be negative for the ocean
-!!gm               xtmp = ( rhosn*cpic*( rtt-t_s(ji,jj,1,jl) ) + rhosn*lfus ) / rdt_ice
+!!gm               xtmp = ( rhosn*cpic*( rtt-t_s(ji,jj,1,jl) ) + rhosn*lfus ) * r1_rdtice
                !           fheat_res(ji,jj) = fheat_res(ji,jj) - xtmp
 
-!!gm               xtmp = ( rhosn*cpic*( rtt-t_s(ji,jj,1,jl) ) + rhosn*lfus ) / rdt_ice !RB   ???????
+!!gm               xtmp = ( rhosn*cpic*( rtt-t_s(ji,jj,1,jl) ) + rhosn*lfus ) * r1_rdtice !RB   ???????
 
                t_s(ji,jj,1,jl) = rtt * zmask(ji,jj) + t_s(ji,jj,1,jl) * ( 1 - zmask(ji,jj) )
@@ -1536,15 +1535,9 @@
 
                !           xtmp = (rhoi*vicen(i,j,n) + rhos*vsnon(i,j,n)) / dt
-               !           fresh(i,j)      = fresh(i,j)      + xtmp
-               !           fresh_hist(i,j) = fresh_hist(i,j) + xtmp
-
-               !           fsalt_res(ji,jj)  = fsalt_res(ji,jj) + ( sss_m(ji,jj)                  ) * & 
-               !                               rhosn * v_s(ji,jj,jl) / rdt_ice
-
-               !           fsalt_res(ji,jj)  = fsalt_res(ji,jj) + ( sss_m(ji,jj) - sm_i(ji,jj,jl) ) * & 
-               !                               rhoic * v_i(ji,jj,jl) / rdt_ice
-
-               !           emps(i,j)      = emps(i,j)      + xtmp
-               !           fsalt_hist(i,j) = fsalt_hist(i,j) + xtmp
+               !           sfx_res(ji,jj)  = sfx_res(ji,jj) + ( sss_m(ji,jj)                  )   &
+               !                                            * rhosn * v_s(ji,jj,jl) * r1_rdtice
+               !           sfx_res(ji,jj)  = sfx_res(ji,jj) + ( sss_m(ji,jj) - sm_i(ji,jj,jl) )   & 
+               !                                            * rhoic * v_i(ji,jj,jl) * r1_rdtice
+               !           sfx (i,j)      = sfx (i,j)      + xtmp
 
                ato_i(ji,jj)    = a_i  (ji,jj,jl) *       zmask(ji,jj)   + ato_i(ji,jj)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limitd_th.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limitd_th.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limitd_th.F90	(revision 3625)
@@ -2,6 +2,5 @@
    !!======================================================================
    !!                       ***  MODULE limitd_th ***
-   !!              Thermodynamics of ice thickness distribution
-   !!                   computation of changes in g(h)      
+   !!   LIM3 ice model : ice thickness distribution: Thermodynamics
    !!======================================================================
    !! History :   -   !          (W. H. Lipscomb and E.C. Hunke) CICE (c) original code
@@ -20,18 +19,19 @@
    !!   lim_itd_shiftice :
    !!----------------------------------------------------------------------
-   USE dom_ice          ! LIM-3 domain
-   USE par_oce          ! ocean parameters
-   USE dom_oce          ! ocean domain
-   USE phycst           ! physical constants (ocean directory) 
-   USE thd_ice          ! LIM-3 thermodynamic variables
-   USE ice              ! LIM-3 variables
-   USE par_ice          ! LIM-3 parameters
-   USE limthd_lac       ! LIM-3 lateral accretion
-   USE limvar           ! LIM-3 variables
-   USE limcons          ! LIM-3 conservation
-   USE prtctl           ! Print control
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
+   USE par_oce        ! ocean parameters
+   USE dom_oce        ! ocean domain
+   USE phycst         ! physical constants (ocean directory) 
+   USE ice            ! LIM-3 variables
+   USE par_ice        ! LIM-3 parameters
+   USE dom_ice        ! LIM-3 domain
+   USE thd_ice        ! LIM-3 thermodynamic variables
+   USE limthd_lac     ! LIM-3 lateral accretion
+   USE limvar         ! LIM-3 variables
+   USE limcons        ! LIM-3 conservation
+   USE prtctl         ! Print control
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -49,5 +49,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2010)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2010)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -101,12 +101,12 @@
 
       !- Trend terms
-      d_a_i_thd (:,:,:)  = a_i(:,:,:)   - old_a_i(:,:,:) 
-      d_v_s_thd (:,:,:)  = v_s(:,:,:)   - old_v_s(:,:,:)
-      d_v_i_thd (:,:,:)  = v_i(:,:,:)   - old_v_i(:,:,:)  
+      d_a_i_thd(:,:,:)   = a_i(:,:,:)   - old_a_i(:,:,:) 
+      d_v_s_thd(:,:,:)   = v_s(:,:,:)   - old_v_s(:,:,:)
+      d_v_i_thd(:,:,:)   = v_i(:,:,:)   - old_v_i(:,:,:)  
       d_e_s_thd(:,:,:,:) = e_s(:,:,:,:) - old_e_s(:,:,:,:) 
       d_e_i_thd(:,:,:,:) = e_i(:,:,:,:) - old_e_i(:,:,:,:)
 
       d_smv_i_thd(:,:,:) = 0._wp
-      IF( num_sal == 2 .OR. num_sal == 4 )   d_smv_i_thd(:,:,:) = smv_i(:,:,:) - old_smv_i(:,:,:)
+      IF( num_sal == 2  )   d_smv_i_thd(:,:,:) = smv_i(:,:,:) - old_smv_i(:,:,:)
 
       IF(ln_ctl) THEN   ! Control print
@@ -143,11 +143,11 @@
 
       !- Recover Old values
-      a_i(:,:,:)   = old_a_i (:,:,:)
-      v_s(:,:,:)   = old_v_s (:,:,:)
-      v_i(:,:,:)   = old_v_i (:,:,:)
-      e_s(:,:,:,:) = old_e_s (:,:,:,:)
-      e_i(:,:,:,:) = old_e_i (:,:,:,:)
-      !
-      IF( num_sal == 2 .OR. num_sal == 4 )   smv_i(:,:,:)       = old_smv_i (:,:,:)
+      a_i(:,:,:)   = old_a_i(:,:,:)
+      v_s(:,:,:)   = old_v_s(:,:,:)
+      v_i(:,:,:)   = old_v_i(:,:,:)
+      e_s(:,:,:,:) = old_e_s(:,:,:,:)
+      e_i(:,:,:,:) = old_e_i(:,:,:,:)
+      !
+      IF( num_sal == 2 )   smv_i(:,:,:) = old_smv_i(:,:,:)
       !
    END SUBROUTINE lim_itd_th
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limmsh.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limmsh.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limmsh.F90	(revision 3625)
@@ -10,5 +10,5 @@
    !!   'key_lim3'                                      LIM3 sea-ice model
    !!----------------------------------------------------------------------
-   !!   lim_msh   : definition of the ice mesh
+   !!   lim_msh       : definition of the ice mesh
    !!----------------------------------------------------------------------
    USE phycst         ! physical constants
@@ -18,4 +18,5 @@
    USE lbclnk         ! lateral boundary condition - MPP exchanges
    USE lib_mpp        ! MPP library
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -25,5 +26,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limrhg.F90	(revision 3625)
@@ -15,24 +15,26 @@
    !!   'key_lim2' AND NOT 'key_lim2_vp'            EVP LIM-2 sea-ice model
    !!----------------------------------------------------------------------
-   !!   lim_rhg   : computes ice velocities
+   !!   lim_rhg       : computes ice velocities
    !!----------------------------------------------------------------------
-   USE phycst           ! Physical constant
-   USE par_oce          ! Ocean parameters
-   USE dom_oce          ! Ocean domain
-   USE sbc_oce          ! Surface boundary condition: ocean fields
-   USE sbc_ice          ! Surface boundary condition: ice fields
-   USE lbclnk           ! Lateral Boundary Condition / MPP link
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
-   USE in_out_manager   ! I/O manager
-   USE prtctl           ! Print control
+   USE phycst         ! Physical constant
+   USE oce     , ONLY :  snwice_mass, snwice_mass_b
+   USE par_oce        ! Ocean parameters
+   USE dom_oce        ! Ocean domain
+   USE sbc_oce        ! Surface boundary condition: ocean fields
+   USE sbc_ice        ! Surface boundary condition: ice fields
 #if defined key_lim3
-   USE ice              ! LIM-3: ice variables
-   USE dom_ice          ! LIM-3: ice domain
-   USE limitd_me        ! LIM-3: 
+   USE ice            ! LIM-3: ice variables
+   USE dom_ice        ! LIM-3: ice domain
+   USE limitd_me      ! LIM-3: 
 #else
-   USE ice_2            ! LIM2: ice variables
-   USE dom_ice_2        ! LIM2: ice domain
+   USE ice_2          ! LIM-2: ice variables
+   USE dom_ice_2      ! LIM-2: ice domain
 #endif
+   USE lbclnk         ! Lateral Boundary Condition / MPP link
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE in_out_manager ! I/O manager
+   USE prtctl         ! Print control
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -47,5 +49,5 @@
 #  include "vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -124,4 +126,5 @@
       REAL(wp) ::   zindb         ! ice (1) or not (0)      
       REAL(wp) ::   zdummy        ! dummy argument
+      REAL(wp) ::   zintb, zintn  ! dummy argument
 
       REAL(wp), POINTER, DIMENSION(:,:) ::   zpresh           ! temporary array for ice strength
@@ -144,4 +147,7 @@
       REAL(wp), POINTER, DIMENSION(:,:) ::   zs12             ! Non-diagonal stress tensor component zs12
       REAL(wp), POINTER, DIMENSION(:,:) ::   zu_ice, zv_ice, zresr   ! Local error on velocity
+      REAL(wp), POINTER, DIMENSION(:,:) ::   zpice            ! array used for the calculation of ice surface slope:
+                                                              !   ocean surface (ssh_m) if ice is not embedded
+                                                              !   ice top surface if ice is embedded
       
       !!-------------------------------------------------------------------
@@ -150,5 +156,5 @@
       CALL wrk_alloc( jpi,jpj, zc1   , u_oce1, u_oce2, u_ice2, zusw  , v_oce1 , v_oce2, v_ice1                )
       CALL wrk_alloc( jpi,jpj, zf1   , deltat, zu_ice, zf2   , deltac, zv_ice , zdd   , zdt    , zds          )
-      CALL wrk_alloc( jpi,jpj, zdd   , zdt   , zds   , zs1   , zs2   , zs12   , zresr                         )
+      CALL wrk_alloc( jpi,jpj, zdd   , zdt   , zds   , zs1   , zs2   , zs12   , zresr , zpice                 )
 
 #if  defined key_lim2 && ! defined key_lim2_vp
@@ -231,4 +237,20 @@
       !  v_oce2: ocean v component on v points                        
 
+      IF( nn_ice_embd == 2 ) THEN             !== embedded sea ice: compute representative ice top surface ==!
+          !                                            
+          ! average interpolation coeff as used in dynspg = (1/nn_fsbc) * {SUM[n/nn_fsbc], n=0,nn_fsbc-1}
+          !                                               = (1/nn_fsbc)^2 * {SUM[n], n=0,nn_fsbc-1}
+         zintn = REAL( nn_fsbc - 1 ) / REAL( nn_fsbc ) * 0.5_wp     
+          !
+          ! average interpolation coeff as used in dynspg = (1/nn_fsbc) * {SUM[1-n/nn_fsbc], n=0,nn_fsbc-1}
+          !                                               = (1/nn_fsbc)^2 * (nn_fsbc^2 - {SUM[n], n=0,nn_fsbc-1})
+         zintb = REAL( nn_fsbc + 1 ) / REAL( nn_fsbc ) * 0.5_wp
+          !
+         zpice(:,:) = ssh_m(:,:) + (  zintn * snwice_mass(:,:) +  zintb * snwice_mass_b(:,:)  ) * r1_rau0
+          !
+      ELSE                                    !== non-embedded sea ice: use ocean surface for slope calculation ==!
+         zpice(:,:) = ssh_m(:,:)
+      ENDIF
+
       DO jj = k_j1+1, k_jpj-1
          DO ji = fs_2, fs_jpim1
@@ -273,6 +295,6 @@
             ! include it later
 
-            zdsshx =  ( ssh_m(ji+1,jj) - ssh_m(ji,jj) ) / e1u(ji,jj)
-            zdsshy =  ( ssh_m(ji,jj+1) - ssh_m(ji,jj) ) / e2v(ji,jj)
+            zdsshx =  ( zpice(ji+1,jj) - zpice(ji,jj) ) / e1u(ji,jj)
+            zdsshy =  ( zpice(ji,jj+1) - zpice(ji,jj) ) / e2v(ji,jj)
 
             za1ct(ji,jj) = ztagnx - zmass1(ji,jj) * grav * zdsshx
@@ -746,5 +768,5 @@
       CALL wrk_dealloc( jpi,jpj, zc1   , u_oce1, u_oce2, u_ice2, zusw  , v_oce1 , v_oce2, v_ice1                )
       CALL wrk_dealloc( jpi,jpj, zf1   , deltat, zu_ice, zf2   , deltac, zv_ice , zdd   , zdt    , zds          )
-      CALL wrk_dealloc( jpi,jpj, zdd   , zdt   , zds   , zs1   , zs2   , zs12   , zresr                         )
+      CALL wrk_dealloc( jpi,jpj, zdd   , zdt   , zds   , zs1   , zs2   , zs12   , zresr , zpice                 )
 
    END SUBROUTINE lim_rhg
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limrst.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limrst.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limrst.F90	(revision 3625)
@@ -12,17 +12,18 @@
    !!   'key_lim3' :                                   LIM sea-ice model
    !!----------------------------------------------------------------------
-   !!   lim_rst_opn     : open ice restart file
-   !!   lim_rst_write   : write of the restart file 
-   !!   lim_rst_read    : read  the restart file 
-   !!----------------------------------------------------------------------
-   USE ice              ! sea-ice variables
-   USE par_ice          ! sea-ice parameters
-   USE dom_oce          ! ocean domain
-   USE sbc_oce          ! Surface boundary condition: ocean fields
-   USE sbc_ice          ! Surface boundary condition: ice fields
-   USE in_out_manager   ! I/O manager
-   USE iom              ! I/O library
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
+   !!   lim_rst_opn   : open ice restart file
+   !!   lim_rst_write : write of the restart file 
+   !!   lim_rst_read  : read  the restart file 
+   !!----------------------------------------------------------------------
+   USE ice            ! sea-ice variables
+   USE par_ice        ! sea-ice parameters
+   USE dom_oce        ! ocean domain
+   USE sbc_oce        ! Surface boundary condition: ocean fields
+   USE sbc_ice        ! Surface boundary condition: ice fields
+   USE in_out_manager ! I/O manager
+   USE iom            ! I/O library
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -37,5 +38,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -402,7 +403,7 @@
                      zsmax = 4.5_wp
                      zsmin = 3.5_wp
-                     IF( sm_i(ji,jj,jl) .LT. zsmin ) THEN
+                     IF(     sm_i(ji,jj,jl) < zsmin ) THEN
                         zalpha = 1._wp
-                     ELSEIF( sm_i(ji,jj,jl) .LT.zsmax ) THEN
+                     ELSEIF( sm_i(ji,jj,jl) < zsmax ) THEN
                         zalpha = sm_i(ji,jj,jl) / ( zsmin - zsmax ) + zsmax / ( zsmax - zsmin )
                      ELSE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limsbc.F90	(revision 3625)
@@ -9,5 +9,6 @@
    !!            3.3  ! 2010-05 (G. Madec) decrease ocean & ice reference salinities in the Baltic sea
    !!                 !                  + simplification of the ice-ocean stress calculation
-   !!            4.0  ! 2011-02 (G. Madec) dynamical allocation
+   !!            3.4  ! 2011-02 (G. Madec) dynamical allocation
+   !!            3.5  ! 2012-10 (A. Coward, G. Madec) salt fluxes ; ice+snow mass
    !!----------------------------------------------------------------------
 #if defined key_lim3
@@ -34,4 +35,7 @@
    USE prtctl           ! Print control
    USE cpl_oasis3, ONLY : lk_cpl
+   USE oce,        ONLY : sshn, sshb, snwice_mass, snwice_mass_b, snwice_fmass, sshu_b, sshv_b, sshu_n, sshv_n, sshf_n
+   USE dom_ice,    ONLY : tms
+   USE lib_fortran      ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -42,5 +46,4 @@
    PUBLIC   lim_sbc_tau    ! called by sbc_ice_lim
 
-   REAL(wp)  ::   r1_rdtice            ! = 1. / rdt_ice 
    REAL(wp)  ::   epsi16 = 1.e-16_wp   ! constant values
    REAL(wp)  ::   rzero  = 0._wp    
@@ -54,5 +57,5 @@
 #  include "vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -86,5 +89,5 @@
       !!              - qns     : sea heat flux: non solar
       !!              - emp     : freshwater budget: volume flux 
-      !!              - emps    : freshwater budget: concentration/dillution 
+      !!              - sfx     : salt flux 
       !!              - fr_i    : ice fraction
       !!              - tn_ice  : sea-ice surface temperature
@@ -97,13 +100,12 @@
       !
       INTEGER  ::   ji, jj           ! dummy loop indices
-      INTEGER  ::   ierr             ! local integer
-      INTEGER  ::   ifvt, i1mfr, idfr               ! some switches
-      INTEGER  ::   iflt, ial, iadv, ifral, ifrdv
-      REAL(wp) ::   zinda, zfons, zpme              ! local scalars
-      REAL(wp), POINTER, DIMENSION(:,:) ::   zfcm1 , zfcm2    ! solar/non solar heat fluxes
-      REAL(wp), POINTER, DIMENSION(:,:,:) ::   zalb, zalbp   ! 2D/3D workspace
+      INTEGER  ::   ierr, ifvt, i1mfr, idfr           ! local integer
+      INTEGER  ::   iflt, ial , iadv , ifral, ifrdv   !   -      -
+      REAL(wp) ::   zinda, zemp, zemp_snow, zfmm      ! local scalars
+      REAL(wp) ::   zemp_snw                          !   -      -
+      REAL(wp) ::   zfcm1 , zfcm2                     !   -      -
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::   zalb, zalbp     ! 2D/3D workspace
       !!---------------------------------------------------------------------
       
-      CALL wrk_alloc( jpi, jpj, zfcm1 , zfcm2 )
       IF( lk_cpl )   CALL wrk_alloc( jpi, jpj, jpl, zalb, zalbp )
 
@@ -139,5 +141,5 @@
 
             !   computation the solar flux at ocean surface
-            zfcm1(ji,jj)   = pfrld(ji,jj) * qsr(ji,jj)  + ( 1. - pfrld(ji,jj) ) * fstric(ji,jj)
+            zfcm1   = pfrld(ji,jj) * qsr(ji,jj)  + ( 1._wp - pfrld(ji,jj) ) * fstric(ji,jj)
             ! fstric     Solar flux transmitted trough the ice
             ! qsr        Net short wave heat flux on free ocean
@@ -146,46 +148,35 @@
 
             !  computation the non solar heat flux at ocean surface
-            zfcm2(ji,jj) = - zfcm1(ji,jj)                  &
-               &           + iflt    * ( fscmbq(ji,jj) )   & ! total abl -> fscmbq is given to the ocean
-               ! fscmbq and ffltbif are obsolete
-               !              &           + iflt * ffltbif(ji,jj) !!! only if one category is used
-               &           + ifral   * ( ial * qcmif(ji,jj) + (1 - ial) * qldif(ji,jj) ) * r1_rdtice   &
-               &           + ifrdv   * ( qfvbq(ji,jj) + qdtcn(ji,jj) )                   * r1_rdtice   &
-               &           + fhmec(ji,jj)     & ! new contribution due to snow melt in ridging!!
-               &           + fheat_rpo(ji,jj) & ! contribution from ridge formation
-               &           + fheat_res(ji,jj)
-            ! fscmbq  Part of the solar radiation transmitted through the ice and going to the ocean
-            !         computed in limthd_zdf.F90
-            ! ffltbif Total heat content of the ice (brine pockets+ice) / delta_t
+            zfcm2 = - zfcm1                                                                     & ! ???
+               &    + iflt    * fscmbq(ji,jj)                                                   & ! total ablation: heat given to the ocean
+               &    + ifral   * ( ial * qcmif(ji,jj) + (1 - ial) * qldif(ji,jj) ) * r1_rdtice   &
+               &    + ifrdv   * (       qfvbq(ji,jj) +             qdtcn(ji,jj) ) * r1_rdtice   &
+               &    + fhmec(ji,jj)                                                              & ! snow melt when ridging
+               &    + fheat_mec(ji,jj)                                                          & ! ridge formation
+               &    + fheat_res(ji,jj)                                                            ! residual heat flux
             ! qcmif   Energy needed to bring the ocean surface layer until its freezing (ok)
             ! qldif   heat balance of the lead (or of the open ocean)
-            ! qfvbq   i think this is wrong!
-            ! ---> Array used to store energy in case of total lateral ablation
-            ! qfvbq latent heat uptake/release after accretion/ablation
-            ! qdtcn Energy from the turbulent oceanic heat flux heat flux coming in the lead
-
-            IF ( num_sal == 2 ) zfcm2(ji,jj) = zfcm2(ji,jj) + &
-               fhbri(ji,jj) ! new contribution due to brine drainage 
-
-            ! bottom radiative component is sent to the computation of the
-            ! oceanic heat flux
-            fsbbq(ji,jj) = ( 1.0 - ( ifvt + iflt ) ) * fscmbq(ji,jj)     
+            ! qfvbq   latent heat uptake/release after accretion/ablation
+            ! qdtcn   Energy from the turbulent oceanic heat flux heat flux coming in the lead
+
+            IF( num_sal == 2 )   zfcm2 = zfcm2 + fhbri(ji,jj)    ! add contribution due to brine drainage 
+
+            ! bottom radiative component is sent to the computation of the oceanic heat flux
+            fsbbq(ji,jj) = ( 1._wp - ( ifvt + iflt ) ) * fscmbq(ji,jj)     
 
             ! used to compute the oceanic heat flux at the next time step
-            qsr(ji,jj) = zfcm1(ji,jj)                                       ! solar heat flux 
-            qns(ji,jj) = zfcm2(ji,jj) - fdtcn(ji,jj)                        ! non solar heat flux
+            qsr(ji,jj) = zfcm1                                       ! solar heat flux 
+            qns(ji,jj) = zfcm2 - fdtcn(ji,jj)                        ! non solar heat flux
             !                           ! fdtcn : turbulent oceanic heat flux
 
-            !!gm   this IF prevents the vertorisation of the whole loop
+!!gm   this IF prevents the vertorisation of the whole loop
             IF ( ( ji == jiindx ) .AND. ( jj == jjindx) ) THEN
                WRITE(numout,*) ' lim_sbc : heat fluxes '
                WRITE(numout,*) ' qsr       : ', qsr(jiindx,jjindx)
-               WRITE(numout,*) ' zfcm1     : ', zfcm1(jiindx,jjindx)
                WRITE(numout,*) ' pfrld     : ', pfrld(jiindx,jjindx)
                WRITE(numout,*) ' fstric    : ', fstric (jiindx,jjindx)
                WRITE(numout,*)
                WRITE(numout,*) ' qns       : ', qns(jiindx,jjindx)
-               WRITE(numout,*) ' zfcm2     : ', zfcm2(jiindx,jjindx)
-               WRITE(numout,*) ' zfcm1     : ', zfcm1(jiindx,jjindx)
+               WRITE(numout,*) ' fdtcn     : ', fdtcn(jiindx,jjindx)
                WRITE(numout,*) ' ifral     : ', ifral
                WRITE(numout,*) ' ial       : ', ial  
@@ -202,9 +193,9 @@
                WRITE(numout,*) ' fdtcn     : ', fdtcn(jiindx,jjindx)
                WRITE(numout,*) ' fhmec     : ', fhmec(jiindx,jjindx)
-               WRITE(numout,*) ' fheat_rpo : ', fheat_rpo(jiindx,jjindx)
+               WRITE(numout,*) ' fheat_mec : ', fheat_mec(jiindx,jjindx)
                WRITE(numout,*) ' fhbri     : ', fhbri(jiindx,jjindx)
                WRITE(numout,*) ' fheat_res : ', fheat_res(jiindx,jjindx)
             ENDIF
-            !!gm   end
+!!gm   end
          END DO
       END DO
@@ -227,43 +218,39 @@
 
             !  computing freshwater exchanges at the ice/ocean interface
-            zpme = - emp(ji,jj)     * ( 1.0 - at_i(ji,jj)          )  &   ! evaporation over oceanic fraction
-               &   + tprecip(ji,jj) *         at_i(ji,jj)             &   ! all precipitation reach the ocean
-               &   - sprecip(ji,jj) * ( 1. - (pfrld(ji,jj)**betas) )  &   ! except solid precip intercepted by sea-ice
-               &   - rdmsnif(ji,jj) * r1_rdtice                       &   ! freshwaterflux due to snow melting 
-               &   + fmmec(ji,jj)                                         ! snow falling when ridging
-
-
-            !  computing salt exchanges at the ice/ocean interface
-            !  sice should be the same as computed with the ice model
-            zfons =  ( soce_0(ji,jj) - sice_0(ji,jj) ) * rdmicif(ji,jj) * r1_rdtice 
-            ! SOCE
-            zfons =  ( sss_m (ji,jj) - sice_0(ji,jj) ) * rdmicif(ji,jj) * r1_rdtice
-
-            !CT useless            !  salt flux for constant salinity
-            !CT useless            fsalt(ji,jj)      =  zfons / ( sss_m(ji,jj) + epsi16 ) + fsalt_res(ji,jj)
-            !  salt flux for variable salinity
-            zinda             = 1.0 - MAX( rzero , SIGN( rone , - ( 1.0 - pfrld(ji,jj) ) ) )
-            !  correcting brine and salt fluxes
-            fsbri(ji,jj)      =  zinda*fsbri(ji,jj)
-            !  converting the salt fluxes from ice to a freshwater flux from ocean
-            fsalt_res(ji,jj)  =  fsalt_res(ji,jj) / ( sss_m(ji,jj) + epsi16 )
-            fseqv(ji,jj)      =  fseqv(ji,jj)     / ( sss_m(ji,jj) + epsi16 )
-            fsbri(ji,jj)      =  fsbri(ji,jj)     / ( sss_m(ji,jj) + epsi16 )
-            fsalt_rpo(ji,jj)  =  fsalt_rpo(ji,jj) / ( sss_m(ji,jj) + epsi16 )
-
-            !  freshwater mass exchange (positive to the ice, negative for the ocean ?)
-            !  actually it's a salt flux (so it's minus freshwater flux)
-            !  if sea ice grows, zfons is positive, fsalt also
-            !  POSITIVE SALT FLUX FROM THE ICE TO THE OCEAN
-            !  POSITIVE FRESHWATER FLUX FROM THE OCEAN TO THE ICE [kg.m-2.s-1]
-
-            emp(ji,jj) = - zpme 
+            zemp =   emp(ji,jj)     * ( 1.0 - at_i(ji,jj)          )  &   ! evaporation over oceanic fraction
+               &   - tprecip(ji,jj) *         at_i(ji,jj)             &   ! all precipitation reach the ocean
+               &   + sprecip(ji,jj) * ( 1. - (pfrld(ji,jj)**betas) )  &   ! except solid precip intercepted by sea-ice
+               &   - fmmec(ji,jj)                                         ! snow falling when ridging
+
+            ! mass flux at the ocean/ice interface (sea ice fraction)
+            zemp_snw = rdm_snw(ji,jj) * r1_rdtice                         ! snow melting = pure water that enters the ocean
+            zfmm     = rdm_ice(ji,jj) * r1_rdtice                         ! Freezing minus mesting  
+
+            emp(ji,jj) = zemp + zemp_snw + zfmm  ! mass flux + F/M mass flux (always ice/ocean mass exchange)
+            
+            !  correcting brine salt fluxes   (zinda = 1  if pfrld=1 , =0 otherwise)
+            zinda        = 1.0 - MAX( rzero , SIGN( rone , - ( 1.0 - pfrld(ji,jj) ) ) )
+            sfx_bri(ji,jj) = zinda * sfx_bri(ji,jj)
          END DO
       END DO
 
+      !------------------------------------------!
+      !      salt flux at the ocean surface      !
+      !------------------------------------------!
+
       IF( num_sal == 2 ) THEN      ! variable ice salinity: brine drainage included in the salt flux
-         emps(:,:) = fsbri(:,:) + fseqv(:,:) + fsalt_res(:,:) + fsalt_rpo(:,:) + emp(:,:)
+         sfx(:,:) = sfx_thd(:,:) + sfx_res(:,:) + sfx_mec(:,:) + sfx_bri(:,:)
       ELSE                         ! constant ice salinity:
-         emps(:,:) =              fseqv(:,:) + fsalt_res(:,:) + fsalt_rpo(:,:) + emp(:,:)
+         sfx(:,:) = sfx_thd(:,:) + sfx_res(:,:) + sfx_mec(:,:)
+      ENDIF
+      !-----------------------------------------------!
+      !   mass of snow and ice per unit area          !
+      !-----------------------------------------------!
+      IF( nn_ice_embd /= 0 ) THEN                               ! embedded sea-ice (mass required)
+         snwice_mass_b(:,:) = snwice_mass(:,:)                  ! save mass from the previous ice time step
+         !                                                      ! new mass per unit area
+         snwice_mass  (:,:) = tms(:,:) * ( rhosn * vt_s(:,:) + rhoic * vt_i(:,:)  ) 
+         !                                                      ! time evolution of snow+ice mass
+         snwice_fmass (:,:) = ( snwice_mass(:,:) - snwice_mass_b(:,:) ) * r1_rdtice
       ENDIF
 
@@ -285,10 +272,9 @@
       IF(ln_ctl) THEN
          CALL prt_ctl( tab2d_1=qsr   , clinfo1=' lim_sbc: qsr    : ', tab2d_2=qns , clinfo2=' qns     : ' )
-         CALL prt_ctl( tab2d_1=emp   , clinfo1=' lim_sbc: emp    : ', tab2d_2=emps, clinfo2=' emps    : ' )
+         CALL prt_ctl( tab2d_1=emp   , clinfo1=' lim_sbc: emp    : ', tab2d_2=sfx , clinfo2=' sfx     : ' )
          CALL prt_ctl( tab2d_1=fr_i  , clinfo1=' lim_sbc: fr_i   : ' )
          CALL prt_ctl( tab3d_1=tn_ice, clinfo1=' lim_sbc: tn_ice : ', kdim=jpl )
       ENDIF
       !
-      CALL wrk_dealloc( jpi, jpj, zfcm1 , zfcm2 )
       IF( lk_cpl )   CALL wrk_dealloc( jpi, jpj, jpl, zalb, zalbp )
       ! 
@@ -383,4 +369,6 @@
       !!-------------------------------------------------------------------
       !
+      INTEGER  ::   ji, jj                          ! dummy loop indices
+      REAL(wp) ::   zcoefu, zcoefv, zcoeff          ! local scalar
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) 'lim_sbc_init : LIM-3 sea-ice - surface boundary condition'
@@ -389,6 +377,4 @@
       !                                      ! allocate lim_sbc array
       IF( lim_sbc_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'lim_sbc_init : unable to allocate standard arrays' )
-      !
-      r1_rdtice = 1. / rdt_ice
       !
       soce_0(:,:) = soce                     ! constant SSS and ice salinity used in levitating sea-ice case
@@ -402,4 +388,48 @@
          END WHERE
       ENDIF
+      !                                      ! embedded sea ice
+      IF( nn_ice_embd /= 0 ) THEN            ! mass exchanges between ice and ocean (case 1 or 2) set the snow+ice mass
+         snwice_mass  (:,:) = tms(:,:) * ( rhosn * vt_s(:,:) + rhoic * vt_i(:,:)  )
+         snwice_mass_b(:,:) = snwice_mass(:,:)
+      ELSE
+         snwice_mass  (:,:) = 0.0_wp         ! no mass exchanges
+         snwice_mass_b(:,:) = 0.0_wp         ! no mass exchanges
+      ENDIF
+      IF( nn_ice_embd == 2  .AND.         &  ! full embedment (case 2) & no restart
+         &  .NOT. ln_rstart ) THEN           ! deplete the initial ssh below sea-ice area
+         sshn(:,:) = sshn(:,:) - snwice_mass(:,:) * r1_rau0
+         sshb(:,:) = sshb(:,:) - snwice_mass(:,:) * r1_rau0
+         !
+         ! Note: Changed the initial values of sshb and sshn=>  need to recompute ssh[u,v,f]_[b,n] 
+         !       which were previously set in domvvl
+         IF ( lk_vvl ) THEN            ! Is this necessary? embd 2 should be restricted to vvl only???
+            DO jj = 1, jpjm1
+               DO ji = 1, jpim1                    ! caution: use of Vector Opt. not possible
+                  zcoefu = 0.5  * umask(ji,jj,1) / ( e1u(ji,jj) * e2u(ji,jj) )
+                  zcoefv = 0.5  * vmask(ji,jj,1) / ( e1v(ji,jj) * e2v(ji,jj) )
+                  zcoeff = 0.25 * umask(ji,jj,1) * umask(ji,jj+1,1)
+                  sshu_b(ji,jj) = zcoefu * ( e1t(ji  ,jj) * e2t(ji  ,jj) * sshb(ji  ,jj)     &
+                     &                     + e1t(ji+1,jj) * e2t(ji+1,jj) * sshb(ji+1,jj) )
+                  sshv_b(ji,jj) = zcoefv * ( e1t(ji,jj  ) * e2t(ji,jj  ) * sshb(ji,jj  )     &
+                     &                     + e1t(ji,jj+1) * e2t(ji,jj+1) * sshb(ji,jj+1) )
+                  sshu_n(ji,jj) = zcoefu * ( e1t(ji  ,jj) * e2t(ji  ,jj) * sshn(ji  ,jj)     &
+                     &                     + e1t(ji+1,jj) * e2t(ji+1,jj) * sshn(ji+1,jj) )
+                  sshv_n(ji,jj) = zcoefv * ( e1t(ji,jj  ) * e2t(ji,jj  ) * sshn(ji,jj  )     &
+                     &                     + e1t(ji,jj+1) * e2t(ji,jj+1) * sshn(ji,jj+1) )
+               END DO
+            END DO
+            CALL lbc_lnk( sshu_b, 'U', 1. )   ;   CALL lbc_lnk( sshu_n, 'U', 1. )
+            CALL lbc_lnk( sshv_b, 'V', 1. )   ;   CALL lbc_lnk( sshv_n, 'V', 1. )
+            DO jj = 1, jpjm1
+               DO ji = 1, jpim1      ! NO Vector Opt.
+                  sshf_n(ji,jj) = 0.5  * umask(ji,jj,1) * umask(ji,jj+1,1)                   &
+                       &               / ( e1f(ji,jj  ) * e2f(ji,jj  ) )                     &
+                       &               * ( e1u(ji,jj  ) * e2u(ji,jj  ) * sshu_n(ji,jj  )     &
+                       &                 + e1u(ji,jj+1) * e2u(ji,jj+1) * sshu_n(ji,jj+1) )
+               END DO
+            END DO
+            CALL lbc_lnk( sshf_n, 'F', 1. )
+          ENDIF
+      ENDIF
       !
    END SUBROUTINE lim_sbc_init
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limtab.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limtab.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limtab.F90	(revision 3625)
@@ -2,5 +2,5 @@
    !!======================================================================
    !!                       ***  MODULE limtab   ***
-   !!   LIM : transform 1D (2D) array to a 2D (1D) table
+   !!   LIM ice model : transform 1D (2D) array to a 2D (1D) table
    !!======================================================================
 #if defined key_lim3
@@ -20,5 +20,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2010)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2010)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90	(revision 3625)
@@ -8,5 +8,5 @@
    !!            3.0  ! 2005-11 (M. Vancoppenolle)  LIM-3 : Multi-layer thermodynamics + salinity variations
    !!             -   ! 2007-04 (M. Vancoppenolle) add lim_thd_glohec, lim_thd_con_dh and lim_thd_con_dif
-   !!            3.2  ! 2009-07 (M. Vancoppenolle, Y. Aksenov, G. Madec) bug correction in rdmsnif
+   !!            3.2  ! 2009-07 (M. Vancoppenolle, Y. Aksenov, G. Madec) bug correction in rdm_snw
    !!            3.3  ! 2010-11 (G. Madec) corrected snow melting heat (due to factor betas)
    !!            4.0  ! 2011-02 (G. Madec) dynamical allocation
@@ -16,27 +16,28 @@
    !!   'key_lim3'                                      LIM3 sea-ice model
    !!----------------------------------------------------------------------
-   !!   lim_thd        : thermodynamic of sea ice
-   !!   lim_thd_init   : initialisation of sea-ice thermodynamic
+   !!   lim_thd       : thermodynamic of sea ice
+   !!   lim_thd_init  : initialisation of sea-ice thermodynamic
    !!----------------------------------------------------------------------
-   USE phycst          ! physical constants
-   USE dom_oce         ! ocean space and time domain variables
-   USE ice             ! LIM: sea-ice variables
-   USE par_ice         ! LIM: sea-ice parameters
-   USE sbc_oce         ! Surface boundary condition: ocean fields
-   USE sbc_ice         ! Surface boundary condition: ice fields
-   USE thd_ice         ! LIM thermodynamic sea-ice variables
-   USE dom_ice         ! LIM sea-ice domain
-   USE domvvl          ! domain: variable volume level
-   USE limthd_dif      ! LIM: thermodynamics, vertical diffusion
-   USE limthd_dh       ! LIM: thermodynamics, ice and snow thickness variation
-   USE limthd_sal      ! LIM: thermodynamics, ice salinity
-   USE limthd_ent      ! LIM: thermodynamics, ice enthalpy redistribution
-   USE limtab          ! LIM: 1D <==> 2D transformation
-   USE limvar          ! LIM: sea-ice variables
-   USE lbclnk          ! lateral boundary condition - MPP links
-   USE lib_mpp         ! MPP library
-   USE wrk_nemo        ! work arrays
-   USE in_out_manager  ! I/O manager
-   USE prtctl          ! Print control
+   USE phycst         ! physical constants
+   USE dom_oce        ! ocean space and time domain variables
+   USE ice            ! LIM: sea-ice variables
+   USE par_ice        ! LIM: sea-ice parameters
+   USE sbc_oce        ! Surface boundary condition: ocean fields
+   USE sbc_ice        ! Surface boundary condition: ice fields
+   USE thd_ice        ! LIM thermodynamic sea-ice variables
+   USE dom_ice        ! LIM sea-ice domain
+   USE domvvl         ! domain: variable volume level
+   USE limthd_dif     ! LIM: thermodynamics, vertical diffusion
+   USE limthd_dh      ! LIM: thermodynamics, ice and snow thickness variation
+   USE limthd_sal     ! LIM: thermodynamics, ice salinity
+   USE limthd_ent     ! LIM: thermodynamics, ice enthalpy redistribution
+   USE limtab         ! LIM: 1D <==> 2D transformation
+   USE limvar         ! LIM: sea-ice variables
+   USE lbclnk         ! lateral boundary condition - MPP links
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE in_out_manager ! I/O manager
+   USE prtctl         ! Print control
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -110,5 +111,5 @@
                   e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) / ( area(ji,jj) * MAX( v_i(ji,jj,jl) , epsi06 ) ) * nlay_i
                   !0 if no ice and 1 if yes
-                  zindb = 1.0 - MAX ( 0.0 , SIGN ( 1.0 , - ht_i(ji,jj,jl) ) ) 
+                  zindb = 1.0 - MAX(  0.0 , SIGN( 1.0 , - ht_i(ji,jj,jl) )  ) 
                   !convert units ! very important that this line is here
                   e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * unit_fac * zindb 
@@ -122,5 +123,5 @@
                   e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) / ( area(ji,jj) * MAX( v_s(ji,jj,jl) , epsi06 ) ) * nlay_s
                   !0 if no ice and 1 if yes
-                  zindb = 1.0 - MAX ( 0.0 , SIGN ( 1.0 , - ht_s(ji,jj,jl) ) ) 
+                  zindb = 1.0 - MAX(  0.0 , SIGN( 1.0 , - ht_s(ji,jj,jl) )  ) 
                   !convert units ! very important that this line is here
                   e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) * unit_fac * zindb 
@@ -140,10 +141,10 @@
       ffltbif(:,:) = 0.e0   ! linked with fstric
       qfvbq  (:,:) = 0.e0   ! linked with fstric
-      rdmsnif(:,:) = 0.e0   ! variation of snow mass per unit area
-      rdmicif(:,:) = 0.e0   ! variation of ice mass per unit area
+      rdm_snw(:,:) = 0.e0   ! variation of snow mass per unit area
+      rdm_ice(:,:) = 0.e0   ! variation of ice mass per unit area
       hicifp (:,:) = 0.e0   ! daily thermodynamic ice production. 
-      fsbri  (:,:) = 0.e0   ! brine flux contribution to salt flux to the ocean
+      sfx_bri(:,:) = 0.e0   ! brine flux contribution to salt flux to the ocean
       fhbri  (:,:) = 0.e0   ! brine flux contribution to heat flux to the ocean
-      fseqv  (:,:) = 0.e0   ! equivalent salt flux to the ocean due to ice/growth decay
+      sfx_thd(:,:) = 0.e0   ! equivalent salt flux to the ocean due to ice/growth decay
 
       !-----------------------------------
@@ -273,25 +274,23 @@
             CALL tab_2d_1d( nbpb, fr2_i0_1d  (1:nbpb), fr2_i0          , jpi, jpj, npb(1:nbpb) )
             CALL tab_2d_1d( nbpb, qnsr_ice_1d(1:nbpb), qns_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
-
 #if ! defined key_coupled
-            CALL tab_2d_1d( nbpb, qla_ice_1d (1:nbpb), qla_ice(:,:,jl)    , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, dqla_ice_1d(1:nbpb), dqla_ice(:,:,jl)   , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, qla_ice_1d (1:nbpb), qla_ice(:,:,jl) , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, dqla_ice_1d(1:nbpb), dqla_ice(:,:,jl), jpi, jpj, npb(1:nbpb) )
 #endif
-
-            CALL tab_2d_1d( nbpb, dqns_ice_1d(1:nbpb), dqns_ice(:,:,jl)   , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, t_bo_b     (1:nbpb), t_bo       , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, sprecip_1d (1:nbpb), sprecip    , jpi, jpj, npb(1:nbpb) ) 
-            CALL tab_2d_1d( nbpb, fbif_1d    (1:nbpb), fbif       , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, qldif_1d   (1:nbpb), qldif      , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, rdmicif_1d (1:nbpb), rdmicif    , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, rdmsnif_1d (1:nbpb), rdmsnif    , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, dmgwi_1d   (1:nbpb), dmgwi      , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, qlbbq_1d   (1:nbpb), zqlbsbq    , jpi, jpj, npb(1:nbpb) )
-
-            CALL tab_2d_1d( nbpb, fseqv_1d   (1:nbpb), fseqv      , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, fsbri_1d   (1:nbpb), fsbri      , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, fhbri_1d   (1:nbpb), fhbri      , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, fstbif_1d  (1:nbpb), fstric     , jpi, jpj, npb(1:nbpb) )
-            CALL tab_2d_1d( nbpb, qfvbq_1d   (1:nbpb), qfvbq      , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, dqns_ice_1d(1:nbpb), dqns_ice(:,:,jl), jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, t_bo_b     (1:nbpb), t_bo            , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, sprecip_1d (1:nbpb), sprecip         , jpi, jpj, npb(1:nbpb) ) 
+            CALL tab_2d_1d( nbpb, fbif_1d    (1:nbpb), fbif            , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, qldif_1d   (1:nbpb), qldif           , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, rdm_ice_1d (1:nbpb), rdm_ice         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, rdm_snw_1d (1:nbpb), rdm_snw         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, dmgwi_1d   (1:nbpb), dmgwi           , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, qlbbq_1d   (1:nbpb), zqlbsbq         , jpi, jpj, npb(1:nbpb) )
+
+            CALL tab_2d_1d( nbpb, sfx_thd_1d (1:nbpb), sfx_thd         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, sfx_bri_1d (1:nbpb), sfx_bri         , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, fhbri_1d   (1:nbpb), fhbri           , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, fstbif_1d  (1:nbpb), fstric          , jpi, jpj, npb(1:nbpb) )
+            CALL tab_2d_1d( nbpb, qfvbq_1d   (1:nbpb), qfvbq           , jpi, jpj, npb(1:nbpb) )
 
             !--------------------------------
@@ -331,41 +330,37 @@
             !--------------------------------
 
-            CALL tab_1d_2d( nbpb, at_i        , npb, at_i_b(1:nbpb), jpi, jpj )
-            CALL tab_1d_2d( nbpb, ht_i(:,:,jl), npb, ht_i_b(1:nbpb), jpi, jpj )
-            CALL tab_1d_2d( nbpb, ht_s(:,:,jl), npb, ht_s_b(1:nbpb), jpi, jpj )
-            CALL tab_1d_2d( nbpb, a_i (:,:,jl), npb, a_i_b(1:nbpb) , jpi, jpj )
-            CALL tab_1d_2d( nbpb, t_su(:,:,jl), npb, t_su_b(1:nbpb), jpi, jpj )
-            CALL tab_1d_2d( nbpb, sm_i(:,:,jl), npb, sm_i_b(1:nbpb), jpi, jpj )
-
+               CALL tab_1d_2d( nbpb, at_i          , npb, at_i_b    (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, ht_i(:,:,jl)  , npb, ht_i_b    (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, ht_s(:,:,jl)  , npb, ht_s_b    (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, a_i (:,:,jl)  , npb, a_i_b     (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, t_su(:,:,jl)  , npb, t_su_b    (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, sm_i(:,:,jl)  , npb, sm_i_b    (1:nbpb)   , jpi, jpj )
             DO jk = 1, nlay_s
-               CALL tab_1d_2d( nbpb, t_s(:,:,jk,jl), npb, t_s_b(1:nbpb,jk), jpi, jpj)
-               CALL tab_1d_2d( nbpb, e_s(:,:,jk,jl), npb, q_s_b(1:nbpb,jk), jpi, jpj)
+               CALL tab_1d_2d( nbpb, t_s(:,:,jk,jl), npb, t_s_b     (1:nbpb,jk), jpi, jpj)
+               CALL tab_1d_2d( nbpb, e_s(:,:,jk,jl), npb, q_s_b     (1:nbpb,jk), jpi, jpj)
             END DO
-
             DO jk = 1, nlay_i
-               CALL tab_1d_2d( nbpb, t_i(:,:,jk,jl), npb, t_i_b(1:nbpb,jk), jpi, jpj)
-               CALL tab_1d_2d( nbpb, e_i(:,:,jk,jl), npb, q_i_b(1:nbpb,jk), jpi, jpj)
-               CALL tab_1d_2d( nbpb, s_i(:,:,jk,jl), npb, s_i_b(1:nbpb,jk), jpi, jpj)
+               CALL tab_1d_2d( nbpb, t_i(:,:,jk,jl), npb, t_i_b     (1:nbpb,jk), jpi, jpj)
+               CALL tab_1d_2d( nbpb, e_i(:,:,jk,jl), npb, q_i_b     (1:nbpb,jk), jpi, jpj)
+               CALL tab_1d_2d( nbpb, s_i(:,:,jk,jl), npb, s_i_b     (1:nbpb,jk), jpi, jpj)
             END DO
-
-            CALL tab_1d_2d( nbpb, fstric , npb, fstbif_1d (1:nbpb), jpi, jpj )
-            CALL tab_1d_2d( nbpb, qldif  , npb, qldif_1d  (1:nbpb), jpi, jpj )
-            CALL tab_1d_2d( nbpb, qfvbq  , npb, qfvbq_1d  (1:nbpb), jpi, jpj )
-            CALL tab_1d_2d( nbpb, rdmicif, npb, rdmicif_1d(1:nbpb), jpi, jpj )
-            CALL tab_1d_2d( nbpb, rdmsnif, npb, rdmsnif_1d(1:nbpb), jpi, jpj )
-            CALL tab_1d_2d( nbpb, dmgwi  , npb, dmgwi_1d  (1:nbpb), jpi, jpj )
-            CALL tab_1d_2d( nbpb, rdvosif, npb, dvsbq_1d  (1:nbpb), jpi, jpj )
-            CALL tab_1d_2d( nbpb, rdvobif, npb, dvbbq_1d  (1:nbpb), jpi, jpj )
-            CALL tab_1d_2d( nbpb, fdvolif, npb, dvlbq_1d  (1:nbpb), jpi, jpj )
-            CALL tab_1d_2d( nbpb, rdvonif, npb, dvnbq_1d  (1:nbpb), jpi, jpj ) 
-            CALL tab_1d_2d( nbpb, fseqv  , npb, fseqv_1d  (1:nbpb), jpi, jpj )
+               CALL tab_1d_2d( nbpb, fstric        , npb, fstbif_1d (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, qldif         , npb, qldif_1d  (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, qfvbq         , npb, qfvbq_1d  (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, rdm_ice       , npb, rdm_ice_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, rdm_snw       , npb, rdm_snw_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, dmgwi         , npb, dmgwi_1d  (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, rdvosif       , npb, dvsbq_1d  (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, rdvobif       , npb, dvbbq_1d  (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, fdvolif       , npb, dvlbq_1d  (1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, rdvonif       , npb, dvnbq_1d  (1:nbpb)   , jpi, jpj ) 
+               CALL tab_1d_2d( nbpb, sfx_thd       , npb, sfx_thd_1d(1:nbpb)   , jpi, jpj )
             !
             IF( num_sal == 2 ) THEN
-               CALL tab_1d_2d( nbpb, fsbri, npb, fsbri_1d(1:nbpb), jpi, jpj )
-               CALL tab_1d_2d( nbpb, fhbri, npb, fhbri_1d(1:nbpb), jpi, jpj )
+               CALL tab_1d_2d( nbpb, sfx_bri       , npb, sfx_bri_1d(1:nbpb)   , jpi, jpj )
+               CALL tab_1d_2d( nbpb, fhbri         , npb, fhbri_1d  (1:nbpb)   , jpi, jpj )
             ENDIF
             !
-            !+++++
-            !temporary stuff for a dummy version
+            !+++++       temporary stuff for a dummy version
             CALL tab_1d_2d( nbpb, dh_i_surf2D, npb, dh_i_surf(1:nbpb)      , jpi, jpj )
             CALL tab_1d_2d( nbpb, dh_i_bott2D, npb, dh_i_bott(1:nbpb)      , jpi, jpj )
@@ -389,9 +384,8 @@
       ! 5.1) Ice heat content              
       !------------------------
-      ! Enthalpies are global variables we have to readjust the units
+      ! Enthalpies are global variables we have to readjust the units (heat content in 10^9 Joules)
       zcoef = 1._wp / ( unit_fac * REAL( nlay_i ) )
       DO jl = 1, jpl
          DO jk = 1, nlay_i
-            ! Multiply by volume, divide by nlayers so that heat content in 10^9 Joules
             e_i(:,:,jk,jl) = e_i(:,:,jk,jl) * area(:,:) * a_i(:,:,jl) * ht_i(:,:,jl) * zcoef
          END DO
@@ -401,9 +395,8 @@
       ! 5.2) Snow heat content              
       !------------------------
-      ! Enthalpies are global variables we have to readjust the units
+      ! Enthalpies are global variables we have to readjust the units (heat content in 10^9 Joules)
       zcoef = 1._wp / ( unit_fac * REAL( nlay_s ) )
       DO jl = 1, jpl
          DO jk = 1, nlay_s
-            ! Multiply by volume, so that heat content in 10^9 Joules
             e_s(:,:,jk,jl) = e_s(:,:,jk,jl) * area(:,:) * a_i(:,:,jl) * ht_s(:,:,jl) * zcoef
          END DO
@@ -419,5 +412,5 @@
       !--------------------------------------------
       d_v_i_thd(:,:,:) = v_i      (:,:,:) - old_v_i(:,:,:)    ! ice volumes 
-      dv_dt_thd(:,:,:) = d_v_i_thd(:,:,:) / rdt_ice * 86400.0
+      dv_dt_thd(:,:,:) = d_v_i_thd(:,:,:) * r1_rdtice * rday
 
       IF( con_i )   fbif(:,:) = fbif(:,:) + zqlbsbq(:,:)
@@ -488,7 +481,7 @@
       !
       IF(lwp) WRITE(numout,*) ' lim_thd_glohec '
-      IF(lwp) WRITE(numout,*) ' qt_i_in : ', eti(jiindex_1d,jl) / rdt_ice
-      IF(lwp) WRITE(numout,*) ' qt_s_in : ', ets(jiindex_1d,jl) / rdt_ice
-      IF(lwp) WRITE(numout,*) ' qt_in   : ', ( eti(jiindex_1d,jl) + ets(jiindex_1d,jl) ) / rdt_ice
+      IF(lwp) WRITE(numout,*) ' qt_i_in : ', eti(jiindex_1d,jl) * r1_rdtice
+      IF(lwp) WRITE(numout,*) ' qt_s_in : ', ets(jiindex_1d,jl) * r1_rdtice
+      IF(lwp) WRITE(numout,*) ' qt_in   : ', ( eti(jiindex_1d,jl) + ets(jiindex_1d,jl) ) * r1_rdtice
       !
    END SUBROUTINE lim_thd_glohec
@@ -538,5 +531,5 @@
       !--------------------
       DO ji = kideb, kiut
-         cons_error(ji,jl) = ABS( dq_i(ji,jl) / rdt_ice + sum_fluxq(ji,jl) )
+         cons_error(ji,jl) = ABS( dq_i(ji,jl) * r1_rdtice + sum_fluxq(ji,jl) )
       END DO
 
@@ -597,5 +590,5 @@
             WRITE(numout,*) ' cons_error : ', cons_error(ji,jl)
             WRITE(numout,*) ' surf_error : ', surf_error(ji,jl)
-            WRITE(numout,*) ' dq_i       : ', - dq_i(ji,jl) / rdt_ice
+            WRITE(numout,*) ' dq_i       : ', - dq_i(ji,jl) * r1_rdtice
             WRITE(numout,*) ' Fdt        : ', sum_fluxq(ji,jl)
             WRITE(numout,*)
@@ -631,9 +624,9 @@
             WRITE(numout,*)
             WRITE(numout,*) ' Layer by layer ... '
-            WRITE(numout,*) ' dq_snow : ', ( qt_s_fin(ji,jl) - qt_s_in(ji,jl) ) / rdt_ice
+            WRITE(numout,*) ' dq_snow : ', ( qt_s_fin(ji,jl) - qt_s_in(ji,jl) ) * r1_rdtice
             WRITE(numout,*) ' dfc_snow  : ', fc_s(ji,1) - fc_s(ji,0)
             DO jk = 1, nlay_i
                WRITE(numout,*) ' layer  : ', jk
-               WRITE(numout,*) ' dq_ice : ', dq_i_layer(ji,jk) / rdt_ice  
+               WRITE(numout,*) ' dq_ice : ', dq_i_layer(ji,jk) * r1_rdtice  
                WRITE(numout,*) ' radab  : ', radab(ji,jk)
                WRITE(numout,*) ' dfc_i  : ', fc_i(ji,jk) - fc_i(ji,jk-1)
@@ -681,5 +674,5 @@
          fatm      (ji,jl) = qnsr_ice_1d(ji) + qsr_ice_1d(ji)                       ! total heat flux
          sum_fluxq (ji,jl) = fatm(ji,jl) + fbif_1d(ji) - ftotal_fin(ji) - fstroc(zji,zjj,jl) 
-         cons_error(ji,jl) = ABS( dq_i(ji,jl) / rdt_ice + sum_fluxq(ji,jl) )
+         cons_error(ji,jl) = ABS( dq_i(ji,jl) * r1_rdtice + sum_fluxq(ji,jl) )
       END DO
 
@@ -688,5 +681,5 @@
       !--------------------
       DO ji = kideb, kiut
-         cons_error(ji,jl) = ABS( dq_i(ji,jl) / rdt_ice + sum_fluxq(ji,jl) )
+         cons_error(ji,jl) = ABS( dq_i(ji,jl) * r1_rdtice + sum_fluxq(ji,jl) )
       END DO
 
@@ -722,7 +715,7 @@
             WRITE(numout,*) ' * '
             WRITE(numout,*) ' Ftotal     : ', sum_fluxq(ji,jl)
-            WRITE(numout,*) ' dq_t       : ', - dq_i(ji,jl) / rdt_ice
-            WRITE(numout,*) ' dq_i       : ', - ( qt_i_fin(ji,jl) - qt_i_in(ji,jl) ) / rdt_ice
-            WRITE(numout,*) ' dq_s       : ', - ( qt_s_fin(ji,jl) - qt_s_in(ji,jl) ) / rdt_ice
+            WRITE(numout,*) ' dq_t       : ', - dq_i(ji,jl) * r1_rdtice
+            WRITE(numout,*) ' dq_i       : ', - ( qt_i_fin(ji,jl) - qt_i_in(ji,jl) ) * r1_rdtice
+            WRITE(numout,*) ' dq_s       : ', - ( qt_s_fin(ji,jl) - qt_s_in(ji,jl) ) * r1_rdtice
             WRITE(numout,*) ' cons_error : ', cons_error(ji,jl)
             WRITE(numout,*) ' * '
@@ -734,10 +727,10 @@
             WRITE(numout,*) ' * '
             WRITE(numout,*) ' Heat contents --- : '
-            WRITE(numout,*) ' qt_s_in    : ', qt_s_in(ji,jl) / rdt_ice
-            WRITE(numout,*) ' qt_i_in    : ', qt_i_in(ji,jl) / rdt_ice
-            WRITE(numout,*) ' qt_in      : ', ( qt_i_in(ji,jl) + qt_s_in(ji,jl) ) / rdt_ice
-            WRITE(numout,*) ' qt_s_fin   : ', qt_s_fin(ji,jl) / rdt_ice
-            WRITE(numout,*) ' qt_i_fin   : ', qt_i_fin(ji,jl) / rdt_ice
-            WRITE(numout,*) ' qt_fin     : ', ( qt_i_fin(ji,jl) + qt_s_fin(ji,jl) ) / rdt_ice
+            WRITE(numout,*) ' qt_s_in    : ', qt_s_in(ji,jl) * r1_rdtice
+            WRITE(numout,*) ' qt_i_in    : ', qt_i_in(ji,jl) * r1_rdtice
+            WRITE(numout,*) ' qt_in      : ', ( qt_i_in(ji,jl) + qt_s_in(ji,jl) ) * r1_rdtice
+            WRITE(numout,*) ' qt_s_fin   : ', qt_s_fin(ji,jl) * r1_rdtice
+            WRITE(numout,*) ' qt_i_fin   : ', qt_i_fin(ji,jl) * r1_rdtice
+            WRITE(numout,*) ' qt_fin     : ', ( qt_i_fin(ji,jl) + qt_s_fin(ji,jl) ) * r1_rdtice
             WRITE(numout,*) ' * '
             WRITE(numout,*) ' Ice variables --- : '
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_dh.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_dh.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_dh.F90	(revision 3625)
@@ -7,5 +7,6 @@
    !!                 ! 2005-06 (M. Vancoppenolle) 3D version 
    !!            3.2  ! 2009-07 (M. Vancoppenolle, Y. Aksenov, G. Madec) bug correction in rdmsnif & rdmicif
-   !!            4.0  ! 2011-02 (G. Madec) dynamical allocation
+   !!            3.4  ! 2011-02 (G. Madec) dynamical allocation
+   !!            3.5  ! 2012-10 (G. Madec & co) salt flux + bug fixes 
    !!----------------------------------------------------------------------
 #if defined key_lim3
@@ -13,15 +14,16 @@
    !!   'key_lim3'                                      LIM3 sea-ice model
    !!----------------------------------------------------------------------
-   !!   lim_thd_dh  : vertical accr./abl. and lateral ablation of sea ice
-   !!----------------------------------------------------------------------
-   USE par_oce          ! ocean parameters
-   USE phycst           ! physical constants (OCE directory) 
-   USE sbc_oce          ! Surface boundary condition: ocean fields
-   USE ice              ! LIM variables
-   USE par_ice          ! LIM parameters
-   USE thd_ice          ! LIM thermodynamics
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
+   !!   lim_thd_dh    : vertical accr./abl. and lateral ablation of sea ice
+   !!----------------------------------------------------------------------
+   USE par_oce        ! ocean parameters
+   USE phycst         ! physical constants (OCE directory) 
+   USE sbc_oce        ! Surface boundary condition: ocean fields
+   USE ice            ! LIM variables
+   USE par_ice        ! LIM parameters
+   USE thd_ice        ! LIM thermodynamics
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -37,5 +39,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2010)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -71,5 +73,5 @@
       !! 
       INTEGER  ::   ji , jk        ! dummy loop indices
-      INTEGER  ::   zji, zjj       ! 2D corresponding indices to ji
+      INTEGER  ::   ii, ij       ! 2D corresponding indices to ji
       INTEGER  ::   isnow          ! switch for presence (1) or absence (0) of snow
       INTEGER  ::   isnowic        ! snow ice formation not
@@ -102,8 +104,8 @@
       REAL(wp), POINTER, DIMENSION(:) ::   zfmass_i    ! 
 
-      REAL(wp), POINTER, DIMENSION(:) ::   zdh_s_mel     ! snow melt 
-      REAL(wp), POINTER, DIMENSION(:) ::   zdh_s_pre     ! snow precipitation 
-      REAL(wp), POINTER, DIMENSION(:) ::   zdh_s_sub     ! snow sublimation
-      REAL(wp), POINTER, DIMENSION(:) ::   zfsalt_melt   ! salt flux due to ice melt
+      REAL(wp), POINTER, DIMENSION(:) ::   zdh_s_mel   ! snow melt 
+      REAL(wp), POINTER, DIMENSION(:) ::   zdh_s_pre   ! snow precipitation 
+      REAL(wp), POINTER, DIMENSION(:) ::   zdh_s_sub   ! snow sublimation
+      REAL(wp), POINTER, DIMENSION(:) ::   zsfx_melt   ! salt flux due to ice melt
 
       REAL(wp), POINTER, DIMENSION(:,:) ::   zdeltah
@@ -126,12 +128,12 @@
 
       CALL wrk_alloc( jpij, zh_i, zh_s, ztfs, zhsold, zqprec, zqfont_su, zqfont_bo, z_f_surf, zhgnew, zfmass_i )
-      CALL wrk_alloc( jpij, zdh_s_mel, zdh_s_pre, zdh_s_sub, zfsalt_melt, zfdt_init, zfdt_final, zqt_i, zqt_s, zqt_dummy )
+      CALL wrk_alloc( jpij, zdh_s_mel, zdh_s_pre, zdh_s_sub, zsfx_melt, zfdt_init, zfdt_final, zqt_i, zqt_s, zqt_dummy )
       CALL wrk_alloc( jpij, zinnermelt, zfbase, zdq_i )
       CALL wrk_alloc( jpij, jkmax, zdeltah, zqt_i_lay )
 
-      zfsalt_melt(:)  = 0._wp
-      ftotal_fin(:)   = 0._wp
-      zfdt_init(:)    = 0._wp
-      zfdt_final(:)   = 0._wp
+      zsfx_melt (:) = 0._wp
+      ftotal_fin(:) = 0._wp
+      zfdt_init (:) = 0._wp
+      zfdt_final(:) = 0._wp
 
       DO ji = kideb, kiut
@@ -145,8 +147,8 @@
       !
       DO ji = kideb, kiut
-         isnow         = INT( 1.0 - MAX ( 0.0 , SIGN ( 1.0 , - ht_s_b(ji) ) ) )
-         ztfs(ji)      = isnow * rtt + ( 1.0 - isnow ) * rtt
-         z_f_surf(ji)  = qnsr_ice_1d(ji) + ( 1.0 - i0(ji) ) * qsr_ice_1d(ji) - fc_su(ji)
-         z_f_surf(ji)  = MAX( zzero , z_f_surf(ji) ) * MAX( zzero , SIGN( zone , t_su_b(ji) - ztfs(ji) ) )
+         isnow         = INT(  1.0 - MAX(  0.0 , SIGN( 1.0 , - ht_s_b(ji) )  )  )
+         ztfs     (ji) = isnow * rtt + ( 1.0 - isnow ) * rtt
+         z_f_surf (ji) = qnsr_ice_1d(ji) + ( 1.0 - i0(ji) ) * qsr_ice_1d(ji) - fc_su(ji)
+         z_f_surf (ji) = MAX(  zzero , z_f_surf(ji)  ) * MAX(  zzero , SIGN( zone , t_su_b(ji) - ztfs(ji) )  )
          zfdt_init(ji) = ( z_f_surf(ji) + MAX( fbif_1d(ji) + qlbbq_1d(ji) + fc_bo_i(ji),0.0 ) ) * rdt_ice
       END DO ! ji
@@ -240,10 +242,10 @@
          zhsnew         =  ht_s_b(ji) + dh_s_tot(ji)
          ! If snow is still present zhn = 1, else zhn = 0
-         zhn            =  1.0 - MAX( zzero , SIGN( zone , - zhsnew ) )
+         zhn            =  1.0 - MAX(  zzero , SIGN( zone , - zhsnew )  )
          ht_s_b(ji)     =  MAX( zzero , zhsnew )
          ! Volume and mass variations of snow
-         dvsbq_1d  (ji) =  a_i_b(ji) * ( ht_s_b(ji) - zhsold(ji) - zdh_s_mel(ji) )
+         dvsbq_1d  (ji) =  a_i_b(ji) * ( ht_s_b(ji) - zhsold(ji) - zdh_s_pre(ji) )
          dvsbq_1d  (ji) =  MIN( zzero, dvsbq_1d(ji) )
-         rdmsnif_1d(ji) =  rdmsnif_1d(ji) + rhosn * dvsbq_1d(ji)
+         rdm_snw_1d(ji) =  rdm_snw_1d(ji) + rhosn * dvsbq_1d(ji)
       END DO ! ji
 
@@ -253,5 +255,5 @@
       DO ji = kideb, kiut 
          dh_i_surf(ji) =  0._wp
-         z_f_surf (ji) =  zqfont_su(ji) / rdt_ice ! heat conservation test
+         z_f_surf (ji) =  zqfont_su(ji) * r1_rdtice   ! heat conservation test
          zdq_i    (ji) =  0._wp
       END DO ! ji
@@ -262,17 +264,14 @@
             zdeltah  (ji,jk) = - zqfont_su(ji) / q_i_b(ji,jk)
             !                                                    ! recompute heat available
-            zqfont_su(ji)    = MAX( 0.0 , - zh_i(ji) - zdeltah(ji,jk) ) * q_i_b(ji,jk) 
+            zqfont_su(ji   ) = MAX( 0.0 , - zh_i(ji) - zdeltah(ji,jk) ) * q_i_b(ji,jk) 
             !                                                    ! melt of layer jk cannot be higher than its thickness
             zdeltah  (ji,jk) = MAX( zdeltah(ji,jk) , - zh_i(ji) )
             !                                                    ! update surface melt
-            dh_i_surf(ji)    = dh_i_surf(ji) + zdeltah(ji,jk) 
+            dh_i_surf(ji   ) = dh_i_surf(ji) + zdeltah(ji,jk) 
             !                                                    ! for energy conservation
-            zdq_i    (ji)    = zdq_i(ji) + zdeltah(ji,jk) * q_i_b(ji,jk) / rdt_ice
+            zdq_i    (ji   ) = zdq_i(ji) + zdeltah(ji,jk) * q_i_b(ji,jk) * r1_rdtice
             !
-            ! contribution to ice-ocean salt flux 
-            zji = MOD( npb(ji) - 1 , jpi ) + 1
-            zjj =    ( npb(ji) - 1 ) / jpi + 1
-            zfsalt_melt(ji) = zfsalt_melt(ji) + ( sss_m(zji,zjj) - sm_i_b(ji) ) * a_i_b(ji)    &
-               &                              * MIN( zdeltah(ji,jk) , 0.e0 ) * rhoic / rdt_ice 
+            !                                                    ! contribution to ice-ocean salt flux 
+            zsfx_melt(ji)  = zsfx_melt(ji) - sm_i_b(ji) * a_i_b(ji) * MIN( zdeltah(ji,jk) , 0._wp ) * rhoic * r1_rdtice 
          END DO
       END DO
@@ -290,5 +289,5 @@
             IF( z_f_surf(ji) + zdq_i(ji) .GE. 1.0e-3  ) THEN!
                WRITE(numout,*) ' ALERTE heat loss for surface melt '
-               WRITE(numout,*) ' zji, zjj, jl :', zji, zjj, jl
+               WRITE(numout,*) ' ii, ij, jl :', ii, ij, jl
                WRITE(numout,*) ' ht_i_b       : ', ht_i_b(ji)
                WRITE(numout,*) ' z_f_surf     : ', z_f_surf(ji)
@@ -299,5 +298,5 @@
                WRITE(numout,*) ' qlbbq_1d     : ', qlbbq_1d(ji)
                WRITE(numout,*) ' s_i_new      : ', s_i_new(ji)
-               WRITE(numout,*) ' sss_m        : ', sss_m(zji,zjj)
+               WRITE(numout,*) ' sss_m        : ', sss_m(ii,ij)
             ENDIF
          END DO
@@ -338,5 +337,5 @@
          DO ji = kideb, kiut
             ! In case of disparition of the snow, we have to update the snow temperatures
-            zhisn  =  MAX( zzero , SIGN( zone, - ht_s_b(ji) ) )
+            zhisn  =  MAX(  zzero , SIGN( zone, - ht_s_b(ji) )  )
             t_s_b(ji,jk) = ( 1.0 - zhisn ) * t_s_b(ji,jk) + zhisn * rtt
             q_s_b(ji,jk) = ( 1.0 - zhisn ) * q_s_b(ji,jk)
@@ -358,7 +357,7 @@
       ! 4.1 Basal growth - (a) salinity not varying in time 
       !-----------------------------------------------------
-      IF(  num_sal /= 2  .AND.  num_sal /= 4  ) THEN
-         DO ji = kideb, kiut
-            IF(  ( fc_bo_i(ji) + fbif_1d(ji) + qlbbq_1d(ji) ) < 0.0  ) THEN
+      IF(  num_sal /= 2  ) THEN   ! ice salinity constant in time
+         DO ji = kideb, kiut
+            IF(  ( fc_bo_i(ji) + fbif_1d(ji) + qlbbq_1d(ji) ) < 0._wp  ) THEN
                s_i_new(ji)         =  sm_i_b(ji)
                ! Melting point in K
@@ -371,5 +370,5 @@
                   &                           - rcp  * ( ztmelts - rtt )                                 )
                ! Basal growth rate = - F*dt / q
-               dh_i_bott(ji)       =  - rdt_ice*( fc_bo_i(ji) + fbif_1d(ji) + qlbbq_1d(ji) ) / q_i_b(ji,nlay_i+1) 
+               dh_i_bott(ji)       =  - rdt_ice * ( fc_bo_i(ji) + fbif_1d(ji) + qlbbq_1d(ji) ) / q_i_b(ji,nlay_i+1) 
             ENDIF
          END DO
@@ -379,9 +378,8 @@
       ! 4.1 Basal growth - (b) salinity varying in time 
       !-------------------------------------------------
-      IF(  num_sal == 2 .OR.  num_sal == 4  ) THEN
-         ! the growth rate (dh_i_bott) is function of the new ice
-         ! heat content (q_i_b(nlay_i+1)). q_i_b depends on the new ice 
-         ! salinity (snewice). snewice depends on dh_i_bott
-         ! it converges quickly, so, no problem
+      IF(  num_sal == 2  ) THEN
+         ! the growth rate (dh_i_bott) is function of the new ice heat content (q_i_b(nlay_i+1)). 
+         ! q_i_b depends on the new ice salinity (snewice). 
+         ! snewice depends on dh_i_bott ; it converges quickly, so, no problem
          ! See Vancoppenolle et al., OM08 for more info on this
 
@@ -394,6 +392,6 @@
             DO ji = kideb, kiut
                IF(  fc_bo_i(ji) + fbif_1d(ji) + qlbbq_1d(ji) < 0.e0  ) THEN
-                  zji = MOD( npb(ji) - 1, jpi ) + 1
-                  zjj = ( npb(ji) - 1 ) / jpi + 1
+                  ii = MOD( npb(ji) - 1, jpi ) + 1
+                  ij = ( npb(ji) - 1 ) / jpi + 1
                   ! Melting point in K
                   ztmelts             =   - tmut * s_i_new(ji) + rtt 
@@ -408,5 +406,5 @@
                   ! zswi12 (1) if dh_i_bott/rdt .LT. 3.6e-7 and .GT. 2.0e-8
                   ! zswi1  (1) if dh_i_bott/rdt .LT. 2.0e-8
-                  zgrr   = MIN( 1.0e-3, MAX ( dh_i_bott(ji) / rdt_ice , epsi13 ) )
+                  zgrr   = MIN( 1.0e-3, MAX ( dh_i_bott(ji) * r1_rdtice , epsi13 ) )
                   zswi2  = MAX( zzero , SIGN( zone , zgrr - 3.6e-7 ) ) 
                   zswi12 = MAX( zzero , SIGN( zone , zgrr - 2.0e-8 ) ) * ( 1.0 - zswi2 )
@@ -414,6 +412,6 @@
                   zfracs = zswi1  * 0.12 + zswi12 * ( 0.8925 + 0.0568 * LOG( 100.0 * zgrr ) )   &
                      &                   + zswi2  * 0.26 / ( 0.26 + 0.74 * EXP ( - 724300.0 * zgrr ) ) 
-                  zds         = zfracs * sss_m(zji,zjj) - s_i_new(ji)
-                  s_i_new(ji) = zfracs * sss_m(zji,zjj)
+                  zds         = zfracs * sss_m(ii,ij) - s_i_new(ji)
+                  s_i_new(ji) = zfracs * sss_m(ii,ij)
                ENDIF ! fc_bo_i
             END DO ! ji
@@ -432,5 +430,5 @@
                   &                            - rcp * ( ztmelts - rtt )                                    )
                ! Basal growth rate = - F*dt / q
-               dh_i_bott(ji)       =  - rdt_ice*( fc_bo_i(ji) + fbif_1d(ji) + qlbbq_1d(ji) ) / q_i_b(ji,nlay_i+1) 
+               dh_i_bott(ji)       =  - rdt_ice * ( fc_bo_i(ji) + fbif_1d(ji) + qlbbq_1d(ji) ) / q_i_b(ji,nlay_i+1)
                ! Salinity update
                ! entrapment during bottom growth
@@ -453,5 +451,5 @@
             s_i_new(ji)   =  s_i_b(ji,nlay_i)
             zqfont_bo(ji) =  rdt_ice * ( fc_bo_i(ji) + fbif_1d(ji) + qlbbq_1d(ji) )
-            zfbase(ji)    =  zqfont_bo(ji) / rdt_ice     ! heat conservation test
+            zfbase(ji)    =  zqfont_bo(ji) * r1_rdtice     ! heat conservation test
             zdq_i(ji)     =  0._wp
             dh_i_bott(ji) =  0._wp
@@ -461,22 +459,19 @@
       DO jk = nlay_i, 1, -1
          DO ji = kideb, kiut
-            IF (  ( fc_bo_i(ji) + fbif_1d(ji) + qlbbq_1d(ji) ) .GE. 0.0  ) THEN
-               ztmelts            =   - tmut * s_i_b(ji,jk) + rtt 
-               IF( t_i_b(ji,jk) >= ztmelts ) THEN
-                  zdeltah(ji,jk)  = - zh_i(ji)
-                  dh_i_bott(ji)   = dh_i_bott(ji) + zdeltah(ji,jk)
-                  zinnermelt(ji)   = 1._wp
-               ELSE  ! normal ablation
-                  zdeltah(ji,jk)  = - zqfont_bo(ji) / q_i_b(ji,jk)
-                  zqfont_bo(ji)   = MAX( 0.0 , - zh_i(ji) - zdeltah(ji,jk) ) * q_i_b(ji,jk)
-                  zdeltah(ji,jk)  = MAX(zdeltah(ji,jk), - zh_i(ji) )
-                  dh_i_bott(ji)   = dh_i_bott(ji) + zdeltah(ji,jk)
-                  zdq_i(ji)       = zdq_i(ji) + zdeltah(ji,jk) * q_i_b(ji,jk) / rdt_ice
-                  ! contribution to salt flux
-                  zji             = MOD( npb(ji) - 1, jpi ) + 1
-                  zjj             = ( npb(ji) - 1 ) / jpi + 1
-                  zfsalt_melt(ji) = zfsalt_melt(ji) + ( sss_m(zji,zjj) - sm_i_b(ji)   ) * a_i_b(ji)   &
-                     &                              * MIN( zdeltah(ji,jk) , 0.0 ) * rhoic / rdt_ice 
+            IF(  fc_bo_i(ji) + fbif_1d(ji) + qlbbq_1d(ji)  >=  0._wp  ) THEN
+               ztmelts = - tmut * s_i_b(ji,jk) + rtt 
+               IF( t_i_b(ji,jk) >= ztmelts ) THEN   !!gm : a comment is needed
+                  zdeltah   (ji,jk) = - zh_i(ji)
+                  dh_i_bott (ji   ) = dh_i_bott(ji) + zdeltah(ji,jk)
+                  zinnermelt(ji   ) = 1._wp
+               ELSE                                  ! normal ablation
+                  zdeltah  (ji,jk) = - zqfont_bo(ji) / q_i_b(ji,jk)
+                  zqfont_bo(ji   ) = MAX( 0.0 , - zh_i(ji) - zdeltah(ji,jk) ) * q_i_b(ji,jk)
+                  zdeltah  (ji,jk) = MAX(zdeltah(ji,jk), - zh_i(ji) )
+                  dh_i_bott(ji   ) = dh_i_bott(ji) + zdeltah(ji,jk)
+                  zdq_i    (ji   ) = zdq_i(ji) + zdeltah(ji,jk) * q_i_b(ji,jk) * r1_rdtice
                ENDIF
+               ! contribution to salt flux
+               zsfx_melt(ji) = zsfx_melt(ji) - sm_i_b(ji) * a_i_b(ji) * MIN( zdeltah(ji,jk) , 0._wp ) * rhoic * r1_rdtice 
             ENDIF
          END DO ! ji
@@ -493,5 +488,5 @@
                ENDIF
                IF ( zfbase(ji) + zdq_i(ji) .GE. 1.0e-3  ) THEN
-                  WRITE(numout,*) ' ALERTE heat loss for basal melt : zji, zjj, jl :', zji, zjj, jl
+                  WRITE(numout,*) ' ALERTE heat loss for basal melt : ii, ij, jl :', ii, ij, jl
                   WRITE(numout,*) ' ht_i_b    : ', ht_i_b(ji)
                   WRITE(numout,*) ' zfbase    : ', zfbase(ji)
@@ -502,5 +497,5 @@
                   WRITE(numout,*) ' qlbbq_1d  : ', qlbbq_1d(ji)
                   WRITE(numout,*) ' s_i_new   : ', s_i_new(ji)
-                  WRITE(numout,*) ' sss_m     : ', sss_m(zji,zjj)
+                  WRITE(numout,*) ' sss_m     : ', sss_m(ii,ij)
                   WRITE(numout,*) ' dh_i_bott : ', dh_i_bott(ji)
                   WRITE(numout,*) ' innermelt : ', INT( zinnermelt(ji) )
@@ -531,5 +526,5 @@
          !                     ! excessive energy is sent to lateral ablation
          fsup     (ji) =  rhoic * lfus * at_i_b(ji) / MAX( 1.0 - at_i_b(ji) , epsi13 )   &
-            &                          * ( zdhbf - dh_i_bott(ji) ) / rdt_ice
+            &                          * ( zdhbf - dh_i_bott(ji) ) * r1_rdtice
          dh_i_bott(ji)  = zdhbf
          !                     !since ice volume is only used for outputs, we keep it global for all categories
@@ -538,9 +533,9 @@
          zhgnew   (ji) = ht_i_b(ji) + dh_i_surf(ji) + dh_i_bott(ji)
          !                     ! diagnostic ( bottom ice growth )
-         zji = MOD( npb(ji) - 1, jpi ) + 1
-         zjj = ( npb(ji) - 1 ) / jpi + 1
-         diag_bot_gr(zji,zjj) = diag_bot_gr(zji,zjj) + MAX(dh_i_bott(ji),0.0)*a_i_b(ji) / rdt_ice
-         diag_sur_me(zji,zjj) = diag_sur_me(zji,zjj) + MIN(dh_i_surf(ji),0.0)*a_i_b(ji) / rdt_ice
-         diag_bot_me(zji,zjj) = diag_bot_me(zji,zjj) + MIN(dh_i_bott(ji),0.0)*a_i_b(ji) / rdt_ice
+         ii = MOD( npb(ji) - 1, jpi ) + 1
+         ij = ( npb(ji) - 1 ) / jpi + 1
+         diag_bot_gr(ii,ij) = diag_bot_gr(ii,ij) + MAX(dh_i_bott(ji),0.0)*a_i_b(ji) * r1_rdtice
+         diag_sur_me(ii,ij) = diag_sur_me(ii,ij) + MIN(dh_i_surf(ji),0.0)*a_i_b(ji) * r1_rdtice
+         diag_bot_me(ii,ij) = diag_bot_me(ii,ij) + MIN(dh_i_bott(ji),0.0)*a_i_b(ji) * r1_rdtice
       END DO
 
@@ -548,11 +543,10 @@
       ! 5.2 More than available ice melts
       !-----------------------------------
-      ! then heat applied minus heat content at previous time step
-      ! should equal heat remaining 
+      ! then heat applied minus heat content at previous time step should equal heat remaining 
       !
       DO ji = kideb, kiut
          ! Adapt the remaining energy if too much ice melts
          !--------------------------------------------------
-         zihgnew    =  1.0 - MAX( zzero , SIGN( zone , - zhgnew(ji) ) ) !1 if ice
+         zihgnew =  1.0 - MAX( zzero , SIGN( zone , - zhgnew(ji) ) )   ! =1 if ice
          ! 0 if no more ice
          zhgnew    (ji) =         zihgnew   * zhgnew(ji)      ! ice thickness is put to 0
@@ -562,10 +556,10 @@
          ! If snow remains, energy is used to melt snow
          zhni =  ht_s_b(ji)      ! snow depth at previous time step
-         zihg =  MAX( zzero , SIGN ( zone , - ht_s_b(ji) ) ) ! 0 if snow 
+         zihg =  MAX(  zzero , SIGN ( zone , - ht_s_b(ji) )  )   ! =0 if snow 
 
          ! energy of melting of remaining snow
          zqt_s(ji) =    ( 1. - zihg ) * zqt_s(ji) / MAX( zhni, epsi13 )
          zdhnm     =  - ( 1. - zihg ) * ( 1. - zihgnew ) * zfdt_final(ji) / MAX( zqt_s(ji) , epsi13 )
-         zhnfi          =  zhni + zdhnm
+         zhnfi     =  zhni + zdhnm
          zfdt_final(ji) =  MAX( zfdt_final(ji) + zqt_s(ji) * zdhnm , 0.0 )
          ht_s_b(ji)     =  MAX( zzero , zhnfi )
@@ -581,14 +575,14 @@
          !
          !                                              ! mass variation cumulated over category
-         rdmsnif_1d(ji) = rdmsnif_1d(ji) + zzfmass_s                     ! snow 
-         rdmicif_1d(ji) = rdmicif_1d(ji) + zzfmass_i                     ! ice 
+         rdm_snw_1d(ji) = rdm_snw_1d(ji) + zzfmass_s                     ! snow 
+         rdm_ice_1d(ji) = rdm_ice_1d(ji) + zzfmass_i                     ! ice 
 
          ! Remaining heat to the ocean 
          !---------------------------------
-         focea(ji)  = - zfdt_final(ji) / rdt_ice         ! focea is in W.m-2 * dt
-
-      END DO
-
-      ftotal_fin (:) = zfdt_final(:)  / rdt_ice
+         focea(ji)  = - zfdt_final(ji) * r1_rdtice         ! focea is in W.m-2 * dt
+
+      END DO
+
+      ftotal_fin (:) = zfdt_final(:)  * r1_rdtice
 
       !---------------------------
@@ -596,26 +590,18 @@
       !---------------------------
       DO ji = kideb, kiut
-         zihgnew    =  1.0 - MAX( zzero , SIGN( zone , - zhgnew(ji) ) )   !1 if ice
-
+         zihgnew    =  1.0 - MAX( zzero , SIGN( zone , - zhgnew(ji) ) )   ! =1 if ice
+         !
          ! Salt flux
-         zji = MOD( npb(ji) - 1, jpi ) + 1
-         zjj = ( npb(ji) - 1 ) / jpi + 1
-         ! new lines
-         IF( num_sal == 4 ) THEN
-            fseqv_1d(ji) = fseqv_1d(ji) +        zihgnew  * zfsalt_melt(ji)                                &
-               &                        + (1.0 - zihgnew) * zfmass_i(ji) * ( sss_m(zji,zjj) - bulk_sal   ) / rdt_ice
-         ELSE
-            fseqv_1d(ji) = fseqv_1d(ji) +        zihgnew  * zfsalt_melt(ji)                                &
-               &                        + (1.0 - zihgnew) * zfmass_i(ji) * ( sss_m(zji,zjj) - sm_i_b(ji) ) / rdt_ice
-         ENDIF
+         sfx_thd_1d(ji) = sfx_thd_1d(ji) +        zihgnew  * zsfx_melt(ji)               &
+            &                            - (1.0 - zihgnew) * zfmass_i (ji) * sm_i_b(ji)  * r1_rdtice
+         !
          ! Heat flux
          ! excessive bottom ablation energy (fsup) - 0 except if jpl = 1
-         ! excessive total ablation energy (focea) sent to the ocean
+         ! excessive total  ablation energy (focea) sent to the ocean
          qfvbq_1d(ji)  = qfvbq_1d(ji) + fsup(ji) + ( 1.0 - zihgnew ) * focea(ji) * a_i_b(ji) * rdt_ice
 
-         zihic   = 1.0 - MAX( zzero , SIGN( zone , -ht_i_b(ji) ) )
-         ! equals 0 if ht_i = 0, 1 if ht_i gt 0
+         zihic   = 1.0 - MAX(  zzero , SIGN( zone , -ht_i_b(ji) )  )      ! equals 0 if ht_i = 0, 1 if ht_i gt 0
          fscbq_1d(ji) =  a_i_b(ji) * fstbif_1d(ji)
-         qldif_1d(ji)  = qldif_1d(ji) + fsup(ji) + ( 1.0 - zihgnew ) * focea(ji)    * a_i_b(ji) * rdt_ice   &
+         qldif_1d(ji)  = qldif_1d(ji) + fsup(ji) + ( 1.0 - zihgnew ) * focea   (ji) * a_i_b(ji) * rdt_ice   &
             &                                    + ( 1.0 - zihic   ) * fscbq_1d(ji)             * rdt_ice
       END DO  ! ji
@@ -656,29 +642,25 @@
          dmgwi_1d  (ji) = dmgwi_1d(ji) + a_i_b(ji) * ( ht_s_b(ji) - zhnnew ) * rhosn
 
-         rdmicif_1d(ji) = rdmicif_1d(ji) + a_i_b(ji) * ( zhgnew(ji) - ht_i_b(ji) ) * rhoic 
-         rdmsnif_1d(ji) = rdmsnif_1d(ji) + a_i_b(ji) * ( zhnnew     - ht_s_b(ji) ) * rhosn
+         ! All snow is thrown in the ocean, and seawater is taken to replace the volume
+         rdm_ice_1d(ji) = rdm_ice_1d(ji) + a_i_b(ji) * ( zhgnew(ji) - ht_i_b(ji) ) * rhoic * ( 1. - rhosn / rhoic )
+         rdm_snw_1d(ji) = rdm_snw_1d(ji) + a_i_b(ji) * ( zhnnew     - ht_s_b(ji) ) * rhosn
 
          !        Equivalent salt flux (1) Snow-ice formation component
          !        -----------------------------------------------------
-         zji = MOD( npb(ji) - 1, jpi ) + 1
-         zjj =    ( npb(ji) - 1 ) / jpi + 1
-
-         IF( num_sal /= 2 ) THEN   ;   zsm_snowice = sm_i_b(ji)
-         ELSE                      ;   zsm_snowice = ( rhoic - rhosn ) / rhoic * sss_m(zji,zjj) 
+         ii = MOD( npb(ji) - 1, jpi ) + 1
+         ij =    ( npb(ji) - 1 ) / jpi + 1
+
+         IF( num_sal == 2 ) THEN   ;   zsm_snowice = sss_m(ii,ij) * ( rhoic - rhosn ) / rhoic
+         ELSE                      ;   zsm_snowice = sm_i_b(ji)   
          ENDIF
-         IF( num_sal == 4 ) THEN
-            fseqv_1d(ji) = fseqv_1d(ji) + ( sss_m(zji,zjj) - bulk_sal    ) * a_i_b(ji)   &
-               &                        * ( zhgnew(ji) - ht_i_b(ji) ) * rhoic / rdt_ice
-         ELSE
-            fseqv_1d(ji) = fseqv_1d(ji) + ( sss_m(zji,zjj) - zsm_snowice ) * a_i_b(ji)   &
-               &                        * ( zhgnew(ji) - ht_i_b(ji) ) * rhoic / rdt_ice
-         ENDIF
+         sfx_thd_1d(ji) = sfx_thd_1d(ji) - zsm_snowice * a_i_b(ji) * dh_snowice(ji) * rhoic * r1_rdtice
+         !
          ! entrapment during snow ice formation
          i_ice_switch = 1.0 - MAX( 0.e0 , SIGN( 1.0 , - ht_i_b(ji) + 1.0e-6 ) )
          isnowic      = 1.0 - MAX( 0.e0 , SIGN( 1.0 , - dh_snowice(ji)      ) ) * i_ice_switch
-         IF(  num_sal == 2  .OR.  num_sal == 4  )   &
-            dsm_i_si_1d(ji) = ( zsm_snowice*dh_snowice(ji) &
-            &               + sm_i_b(ji) * ht_i_b(ji) / MAX( ht_i_b(ji) + dh_snowice(ji), epsi13)   &
-            &               - sm_i_b(ji) ) * isnowic     
+         IF(  num_sal == 2  )   &
+            dsm_i_si_1d(ji) = (  zsm_snowice * dh_snowice(ji)    &
+            &                  + sm_i_b(ji) * ht_i_b(ji) / MAX( ht_i_b(ji) + dh_snowice(ji), epsi13 )   &
+            &                  - sm_i_b(ji)  ) * isnowic     
 
          !  Actualize new snow and ice thickness.
@@ -690,12 +672,12 @@
 
          ! diagnostic ( snow ice growth )
-         zji = MOD( npb(ji) - 1, jpi ) + 1
-         zjj =    ( npb(ji) - 1 ) / jpi + 1
-         diag_sni_gr(zji,zjj)  = diag_sni_gr(zji,zjj) + dh_snowice(ji)*a_i_b(ji) / rdt_ice
+         ii = MOD( npb(ji) - 1, jpi ) + 1
+         ij =    ( npb(ji) - 1 ) / jpi + 1
+         diag_sni_gr(ii,ij)  = diag_sni_gr(ii,ij) + dh_snowice(ji)*a_i_b(ji) * r1_rdtice
          !
       END DO !ji
       !
       CALL wrk_dealloc( jpij, zh_i, zh_s, ztfs, zhsold, zqprec, zqfont_su, zqfont_bo, z_f_surf, zhgnew, zfmass_i )
-      CALL wrk_dealloc( jpij, zdh_s_mel, zdh_s_pre, zdh_s_sub, zfsalt_melt, zfdt_init, zfdt_final, zqt_i, zqt_s, zqt_dummy )
+      CALL wrk_dealloc( jpij, zdh_s_mel, zdh_s_pre, zdh_s_sub, zsfx_melt, zfdt_init, zfdt_final, zqt_i, zqt_s, zqt_dummy )
       CALL wrk_dealloc( jpij, zinnermelt, zfbase, zdq_i )
       CALL wrk_dealloc( jpij, jkmax, zdeltah, zqt_i_lay )
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_dif.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_dif.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_dif.F90	(revision 3625)
@@ -15,12 +15,13 @@
    !!   'key_lim3'                                      LIM3 sea-ice model
    !!----------------------------------------------------------------------
-   USE par_oce          ! ocean parameters
-   USE phycst           ! physical constants (ocean directory) 
-   USE ice              ! LIM-3 variables
-   USE par_ice          ! LIM-3 parameters
-   USE thd_ice          ! LIM-3: thermodynamics
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
+   USE par_oce        ! ocean parameters
+   USE phycst         ! physical constants (ocean directory) 
+   USE ice            ! LIM-3 variables
+   USE par_ice        ! LIM-3 parameters
+   USE thd_ice        ! LIM-3: thermodynamics
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -33,5 +34,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -147,6 +148,5 @@
       REAL(wp), DIMENSION(kiut,jkmax+2) ::   zdiagbis
       REAL(wp), DIMENSION(kiut,jkmax+2,3) ::   ztrid   ! tridiagonal system terms
-      !!------------------------------------------------------------------
-      
+      !!------------------------------------------------------------------     
       ! 
       !------------------------------------------------------------------------------!
@@ -156,5 +156,5 @@
       DO ji = kideb , kiut
          ! is there snow or not
-         isnow(ji)= INT(  1._wp - MAX( 0._wp , SIGN(1._wp, - ht_s_b(ji) ) )  )
+         isnow(ji)= INT(  1._wp - MAX(  0._wp , SIGN(1._wp, - ht_s_b(ji) )  )  )
          ! surface temperature of fusion
 !!gm ???  ztfs(ji) = rtt !!!????
@@ -201,5 +201,5 @@
       DO ji = kideb , kiut
          ! switches
-         isnow(ji) = INT(  1._wp - MAX( 0._wp , SIGN( 1._wp , - ht_s_b(ji) ) )  ) 
+         isnow(ji) = INT(  1._wp - MAX(  0._wp , SIGN( 1._wp , - ht_s_b(ji) )  )  ) 
          ! hs > 0, isnow = 1
          zhsu (ji) = hnzst  ! threshold for the computation of i0
@@ -262,6 +262,6 @@
       ! just to check energy conservation
       DO ji = kideb, kiut
-         ii                = MOD( npb(ji) - 1, jpi ) + 1
-         ij                = ( npb(ji) - 1 ) / jpi + 1
+         ii = MOD( npb(ji) - 1 , jpi ) + 1
+         ij =    ( npb(ji) - 1 ) / jpi + 1
          fstroc(ii,ij,jl) = zradtr_i(ji,nlay_i)
       END DO
@@ -273,5 +273,4 @@
          END DO
       END DO
-
 
       !
@@ -662,7 +661,7 @@
 
             ! surface temperature
-            isnow(ji)     = INT(1.0-max(0.0,sign(1.0,-ht_s_b(ji))))
+            isnow(ji)     = INT(  1.0 - MAX( 0.0 , SIGN( 1.0 , -ht_s_b(ji) )  )  )
             ztsuoldit(ji) = t_su_b(ji)
-            IF (t_su_b(ji) .LT. ztfs(ji)) &
+            IF( t_su_b(ji) < ztfs(ji) )   &
                t_su_b(ji) = ( zindtbis(ji,numeqmin(ji)) - ztrid(ji,numeqmin(ji),3)* ( isnow(ji)*t_s_b(ji,1)   &
                &          + (1.0-isnow(ji))*t_i_b(ji,1) ) ) / zdiagbis(ji,numeqmin(ji))  
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_ent.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_ent.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_ent.F90	(revision 3625)
@@ -16,17 +16,18 @@
    !!   'key_lim3'                                      LIM3 sea-ice model
    !!----------------------------------------------------------------------
-   !!   lim_thd_ent : ice redistribution of enthalpy
+   !!   lim_thd_ent   : ice redistribution of enthalpy
    !!----------------------------------------------------------------------
-   USE par_oce          ! ocean parameters
-   USE dom_oce          ! domain variables
-   USE domain           !
-   USE phycst           ! physical constants
-   USE ice              ! LIM variables
-   USE par_ice          ! LIM parameters
-   USE thd_ice          ! LIM thermodynamics
-   USE limvar           ! LIM variables
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
+   USE par_oce        ! ocean parameters
+   USE dom_oce        ! domain variables
+   USE domain         !
+   USE phycst         ! physical constants
+   USE ice            ! LIM variables
+   USE par_ice        ! LIM parameters
+   USE thd_ice        ! LIM thermodynamics
+   USE limvar         ! LIM variables
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -43,5 +44,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -408,13 +409,13 @@
       IF ( con_i ) THEN
          DO ji = kideb, kiut
-            IF ( ABS ( zqts_in(ji) - zqts_fin(ji) ) / rdt_ice .GT. 1.0e-6 ) THEN
+            IF ( ABS ( zqts_in(ji) - zqts_fin(ji) ) * r1_rdtice  >  1.0e-6 ) THEN
                zji                 = MOD( npb(ji) - 1, jpi ) + 1
                zjj                 = ( npb(ji) - 1 ) / jpi + 1
                WRITE(numout,*) ' violation of heat conservation : ',             &
-                  ABS ( zqts_in(ji) - zqts_fin(ji) ) / rdt_ice
+                  ABS ( zqts_in(ji) - zqts_fin(ji) ) * r1_rdtice
                WRITE(numout,*) ' ji, jj   : ', zji, zjj
                WRITE(numout,*) ' ht_s_b   : ', ht_s_b(ji)
-               WRITE(numout,*) ' zqts_in  : ', zqts_in(ji) / rdt_ice
-               WRITE(numout,*) ' zqts_fin : ', zqts_fin(ji) / rdt_ice
+               WRITE(numout,*) ' zqts_in  : ', zqts_in (ji) * r1_rdtice
+               WRITE(numout,*) ' zqts_fin : ', zqts_fin(ji) * r1_rdtice
                WRITE(numout,*) ' dh_snowice : ', dh_snowice(ji)
                WRITE(numout,*) ' dh_s_tot : ', dh_s_tot(ji)
@@ -526,5 +527,5 @@
          ! bottom formation temperature
          ztform = t_i_b(ji,nlay_i)
-         IF ( ( num_sal .EQ. 2 ) .OR. ( num_sal .EQ. 4 ) ) ztform = t_bo_b(ji)
+         IF(  num_sal == 2  )   ztform = t_bo_b(ji)
          qm0(ji,nbot0(ji)) = ( 1.0 - icboswi(ji) )*qm0(ji,nbot0(ji))             &   ! case of melting ice
             &              + icboswi(ji) * rhoic * ( cpic*(ztmelts-ztform)       &   ! case of forming ice
@@ -622,12 +623,12 @@
       !
       DO ji = kideb, kiut
-         IF ( ABS ( zqti_in(ji) - zqti_fin(ji) ) / rdt_ice .GT. 1.0e-6 ) THEN
+         IF ( ABS ( zqti_in(ji) - zqti_fin(ji) ) * r1_rdtice  >  1.0e-6 ) THEN
             zji                 = MOD( npb(ji) - 1, jpi ) + 1
             zjj                 = ( npb(ji) - 1 ) / jpi + 1
-            WRITE(numout,*) ' violation of heat conservation : ', ABS ( zqti_in(ji) - zqti_fin(ji) ) / rdt_ice
+            WRITE(numout,*) ' violation of heat conservation : ', ABS ( zqti_in(ji) - zqti_fin(ji) ) * r1_rdtice
             WRITE(numout,*) ' ji, jj   : ', zji, zjj
             WRITE(numout,*) ' ht_i_b   : ', ht_i_b(ji)
-            WRITE(numout,*) ' zqti_in  : ', zqti_in(ji) / rdt_ice
-            WRITE(numout,*) ' zqti_fin : ', zqti_fin(ji) / rdt_ice
+            WRITE(numout,*) ' zqti_in  : ', zqti_in (ji) * r1_rdtice
+            WRITE(numout,*) ' zqti_fin : ', zqti_fin(ji) * r1_rdtice
             WRITE(numout,*) ' dh_i_bott: ', dh_i_bott(ji)
             WRITE(numout,*) ' dh_i_surf: ', dh_i_surf(ji)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_lac.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_lac.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_lac.F90	(revision 3625)
@@ -13,20 +13,21 @@
    !!   'key_lim3'                                      LIM3 sea-ice model
    !!----------------------------------------------------------------------
-   !!   lim_lat_acr    : lateral accretion of ice
-   !!----------------------------------------------------------------------
-   USE par_oce          ! ocean parameters
-   USE dom_oce          ! domain variables
-   USE phycst           ! physical constants
-   USE sbc_oce          ! Surface boundary condition: ocean fields
-   USE sbc_ice          ! Surface boundary condition: ice fields
-   USE thd_ice          ! LIM thermodynamics
-   USE dom_ice          ! LIM domain
-   USE par_ice          ! LIM parameters
-   USE ice              ! LIM variables
-   USE limtab           ! LIM 2D <==> 1D
-   USE limcons          ! LIM conservation
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
+   !!   lim_lat_acr   : lateral accretion of ice
+   !!----------------------------------------------------------------------
+   USE par_oce        ! ocean parameters
+   USE dom_oce        ! domain variables
+   USE phycst         ! physical constants
+   USE sbc_oce        ! Surface boundary condition: ocean fields
+   USE sbc_ice        ! Surface boundary condition: ice fields
+   USE thd_ice        ! LIM thermodynamics
+   USE dom_ice        ! LIM domain
+   USE par_ice        ! LIM parameters
+   USE ice            ! LIM variables
+   USE limtab         ! LIM 2D <==> 1D
+   USE limcons        ! LIM conservation
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -45,5 +46,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -77,10 +78,11 @@
       !!               update ht_s_b, ht_i_b and tbif_1d(:,:)      
       !!------------------------------------------------------------------------
-      INTEGER ::   ji,jj,jk,jl,jm   ! dummy loop indices
-      INTEGER ::   layer, nbpac     ! local integers 
-      INTEGER ::   zji, zjj, iter   !   -       -
-      REAL(wp)  ::   ztmelts, zdv, zqold, zfrazb, zweight, zalphai, zindb, zde  ! local scalars
+      INTEGER  ::   ji,jj,jk,jl,jm   ! dummy loop indices
+      INTEGER  ::   layer, nbpac     ! local integers 
+      INTEGER  ::   zji, zjj, iter   !   -       -
+      REAL(wp) ::   ztmelts, zdv, zqold, zfrazb, zweight, zalphai, zindb, zde   ! local scalars
       REAL(wp) ::   zgamafr, zvfrx, zvgx, ztaux, ztwogp, zf , zhicol_new        !   -      -
       REAL(wp) ::   ztenagm, zvfry, zvgy, ztauy, zvrel2, zfp, zsqcd , zhicrit   !   -      -
+      REAL(wp) ::   zcoef                                                       !   -      -
       LOGICAL  ::   iterate_frazil   ! iterate frazil ice collection thickness
       CHARACTER (len = 15) :: fieldid
@@ -143,9 +145,9 @@
       ! 1) Conservation check and changes in each ice category
       !------------------------------------------------------------------------------!
-      IF ( con_i ) THEN
-         CALL lim_column_sum (jpl, v_i, vt_i_init)
-         CALL lim_column_sum (jpl, v_s, vt_s_init)
-         CALL lim_column_sum_energy (jpl, nlay_i, e_i, et_i_init)
-         CALL lim_column_sum (jpl,   e_s(:,:,1,:) , et_s_init)
+      IF( con_i ) THEN
+         CALL lim_column_sum        ( jpl, v_i          , vt_i_init)
+         CALL lim_column_sum        ( jpl, v_s          , vt_s_init)
+         CALL lim_column_sum_energy ( jpl, nlay_i , e_i , et_i_init)
+         CALL lim_column_sum        ( jpl, e_s(:,:,1,:) , et_s_init)
       ENDIF
 
@@ -158,9 +160,7 @@
                DO ji = 1, jpi
                   !Energy of melting q(S,T) [J.m-3]
-                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) / &
-                     MAX( area(ji,jj) * v_i(ji,jj,jl) ,  epsi10 ) * &
-                     nlay_i
-                  zindb      = 1.0-MAX(0.0,SIGN(1.0,-v_i(ji,jj,jl))) !0 if no ice and 1 if yes
-                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl)*unit_fac*zindb
+                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) / MAX( area(ji,jj) * v_i(ji,jj,jl) ,  epsi10 ) * nlay_i
+                  zindb = 1._wp - MAX(  0._wp , SIGN( 1._wp , -v_i(ji,jj,jl) )  )   !0 if no ice and 1 if yes
+                  e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * unit_fac * zindb
                END DO
             END DO
@@ -182,19 +182,15 @@
       ! 
 
-      zvrel(:,:) = 0.0
+      zvrel(:,:) = 0._wp
 
       ! Default new ice thickness 
-      DO jj = 1, jpj
-         DO ji = 1, jpi
-            hicol(ji,jj) = hiccrit(1)
-         END DO
-      END DO
-
-      IF (fraz_swi.eq.1.0) THEN
+      hicol(:,:) = hiccrit(1)
+
+      IF( fraz_swi == 1._wp ) THEN
 
          !--------------------
          ! Physical constants
          !--------------------
-         hicol(:,:) = 0.0
+         hicol(:,:) = 0._wp
 
          zhicrit = 0.04 ! frazil ice thickness
@@ -211,8 +207,8 @@
                   !-------------
                   ! C-grid wind stress components
-                  ztaux         = ( utau_ice(ji-1,jj  ) * tmu(ji-1,jj  ) &
-                     &          +   utau_ice(ji  ,jj  ) * tmu(ji  ,jj  ) ) / 2.0
-                  ztauy         = ( vtau_ice(ji  ,jj-1) * tmv(ji  ,jj-1) &
-                     &          +   vtau_ice(ji  ,jj  ) * tmv(ji  ,jj  ) ) / 2.0
+                  ztaux         = ( utau_ice(ji-1,jj  ) * tmu(ji-1,jj  )   &
+                     &          +   utau_ice(ji  ,jj  ) * tmu(ji  ,jj  ) ) * 0.5_wp
+                  ztauy         = ( vtau_ice(ji  ,jj-1) * tmv(ji  ,jj-1)   &
+                     &          +   vtau_ice(ji  ,jj  ) * tmv(ji  ,jj  ) ) * 0.5_wp
                   ! Square root of wind stress
                   ztenagm       =  SQRT( SQRT( ztaux * ztaux + ztauy * ztauy ) )
@@ -228,9 +224,9 @@
                   !-------------------
                   ! C-grid ice velocity
-                  zindb = MAX(0.0, SIGN(1.0, at_i(ji,jj) ))
-                  zvgx  = zindb * ( u_ice(ji-1,jj  ) * tmu(ji-1,jj  ) &
-                     + u_ice(ji,jj    ) * tmu(ji  ,jj  ) ) / 2.0
-                  zvgy  = zindb * ( v_ice(ji  ,jj-1) * tmv(ji  ,jj-1) &
-                     + v_ice(ji,jj    ) * tmv(ji  ,jj  ) ) / 2.0
+                  zindb = MAX(  0._wp, SIGN( 1._wp , at_i(ji,jj) )  )
+                  zvgx  = zindb * (  u_ice(ji-1,jj  ) * tmu(ji-1,jj  )    &
+                     &             + u_ice(ji,jj    ) * tmu(ji  ,jj  )  ) * 0.5_wp
+                  zvgy  = zindb * (  v_ice(ji  ,jj-1) * tmv(ji  ,jj-1)    &
+                     &             + v_ice(ji,jj    ) * tmv(ji  ,jj  )  ) * 0.5_wp
 
                   !-----------------------------------
@@ -238,8 +234,7 @@
                   !-----------------------------------
                   ! absolute relative velocity
-                  zvrel2        = MAX( ( zvfrx - zvgx ) * ( zvfrx - zvgx ) + &
-                     ( zvfry - zvgy ) * ( zvfry - zvgy )   &
-                     , 0.15 * 0.15 )
-                  zvrel(ji,jj)  = SQRT(zvrel2)
+                  zvrel2 = MAX(  ( zvfrx - zvgx ) * ( zvfrx - zvgx )   &
+                     &         + ( zvfry - zvgy ) * ( zvfry - zvgy ) , 0.15 * 0.15 )
+                  zvrel(ji,jj)  = SQRT( zvrel2 )
 
                   !---------------------
@@ -247,7 +242,12 @@
                   !---------------------
                   hicol(ji,jj) = zhicrit + 0.1 
-                  hicol(ji,jj) = zhicrit + hicol(ji,jj) /      & 
-                     ( hicol(ji,jj) * hicol(ji,jj) - &
-                     zhicrit * zhicrit ) * ztwogp * zvrel2
+                  hicol(ji,jj) = zhicrit +   hicol(ji,jj)    &
+                     &                   / ( hicol(ji,jj) * hicol(ji,jj) -  zhicrit * zhicrit ) * ztwogp * zvrel2
+
+!!gm better coding: above: hicol(ji,jj) * hicol(ji,jj) = (zhicrit + 0.1)*(zhicrit + 0.1)
+!!gm                                                   = zhicrit**2 + 0.2*zhicrit +0.01
+!!gm                therefore the 2 lines with hicol can be replaced by 1 line:
+!!gm              hicol(ji,jj) = zhicrit + (zhicrit + 0.1) / ( 0.2 * zhicrit + 0.01 ) * ztwogp * zvrel2
+!!gm further more (zhicrit + 0.1)/(0.2 * zhicrit + 0.01 )*ztwogp can be computed one for all outside the DO loop
 
                   iter = 1
@@ -284,17 +284,13 @@
       DO jj = 1, jpj
          DO ji = 1, jpi
-            IF ( tms(ji,jj) * ( qcmif(ji,jj) - qldif(ji,jj) ) > 0.e0 ) THEN
+            IF ( tms(ji,jj) * ( qcmif(ji,jj) - qldif(ji,jj) )  >  0._wp ) THEN
                nbpac = nbpac + 1
                npac( nbpac ) = (jj - 1) * jpi + ji
-               IF ( (ji.eq.jiindx).AND.(jj.eq.jjindx) ) THEN
-                  jiindex_1d = nbpac
-               ENDIF
+               IF( ji == jiindx .AND. jj == jjindx )   jiindex_1d = nbpac
             ENDIF
          END DO
       END DO
 
-      IF( ln_nicep ) THEN
-         WRITE(numout,*) 'lim_thd_lac : nbpac = ', nbpac
-      ENDIF
+      IF( ln_nicep )   WRITE(numout,*) 'lim_thd_lac : nbpac = ', nbpac
 
       !------------------------------
@@ -306,33 +302,22 @@
       IF ( nbpac > 0 ) THEN
 
-         CALL tab_2d_1d( nbpac, zat_i_ac  (1:nbpac)     , at_i         ,       &
-            jpi, jpj, npac(1:nbpac) )
+         CALL tab_2d_1d( nbpac, zat_i_ac  (1:nbpac)     , at_i         , jpi, jpj, npac(1:nbpac) )
          DO jl = 1, jpl
-            CALL tab_2d_1d( nbpac, za_i_ac(1:nbpac,jl)  , a_i(:,:,jl)  ,       &
-               jpi, jpj, npac(1:nbpac) )
-            CALL tab_2d_1d( nbpac, zv_i_ac(1:nbpac,jl)  , v_i(:,:,jl)  ,       &
-               jpi, jpj, npac(1:nbpac) )
-            CALL tab_2d_1d( nbpac, zoa_i_ac(1:nbpac,jl) , oa_i(:,:,jl) ,       &
-               jpi, jpj, npac(1:nbpac) )
-            CALL tab_2d_1d( nbpac, zsmv_i_ac(1:nbpac,jl), smv_i(:,:,jl),       &
-               jpi, jpj, npac(1:nbpac) )
+            CALL tab_2d_1d( nbpac, za_i_ac  (1:nbpac,jl), a_i  (:,:,jl), jpi, jpj, npac(1:nbpac) )
+            CALL tab_2d_1d( nbpac, zv_i_ac  (1:nbpac,jl), v_i  (:,:,jl), jpi, jpj, npac(1:nbpac) )
+            CALL tab_2d_1d( nbpac, zoa_i_ac (1:nbpac,jl), oa_i (:,:,jl), jpi, jpj, npac(1:nbpac) )
+            CALL tab_2d_1d( nbpac, zsmv_i_ac(1:nbpac,jl), smv_i(:,:,jl), jpi, jpj, npac(1:nbpac) )
             DO jk = 1, nlay_i
-               CALL tab_2d_1d( nbpac, ze_i_ac(1:nbpac,jk,jl), e_i(:,:,jk,jl) , &
-                  jpi, jpj, npac(1:nbpac) )
+               CALL tab_2d_1d( nbpac, ze_i_ac(1:nbpac,jk,jl), e_i(:,:,jk,jl) , jpi, jpj, npac(1:nbpac) )
             END DO ! jk
          END DO ! jl
 
-         CALL tab_2d_1d( nbpac, qldif_1d  (1:nbpac)     , qldif ,              &
-            jpi, jpj, npac(1:nbpac) )
-         CALL tab_2d_1d( nbpac, qcmif_1d  (1:nbpac)     , qcmif ,              &
-            jpi, jpj, npac(1:nbpac) )
-         CALL tab_2d_1d( nbpac, t_bo_b    (1:nbpac)     , t_bo  ,              &
-            jpi, jpj, npac(1:nbpac) )
-         CALL tab_2d_1d( nbpac, fseqv_1d  (1:nbpac)     , fseqv ,              &
-            jpi, jpj, npac(1:nbpac) )
-         CALL tab_2d_1d( nbpac, hicol_b   (1:nbpac)     , hicol ,              &
-            jpi, jpj, npac(1:nbpac) )
-         CALL tab_2d_1d( nbpac, zvrel_ac  (1:nbpac)     , zvrel ,              &
-            jpi, jpj, npac(1:nbpac) )
+         CALL tab_2d_1d( nbpac, qldif_1d  (1:nbpac)     , qldif  , jpi, jpj, npac(1:nbpac) )
+         CALL tab_2d_1d( nbpac, qcmif_1d  (1:nbpac)     , qcmif  , jpi, jpj, npac(1:nbpac) )
+         CALL tab_2d_1d( nbpac, t_bo_b    (1:nbpac)     , t_bo   , jpi, jpj, npac(1:nbpac) )
+         CALL tab_2d_1d( nbpac, sfx_thd_1d(1:nbpac)     , sfx_thd, jpi, jpj, npac(1:nbpac) )
+         CALL tab_2d_1d( nbpac, rdm_ice_1d(1:nbpac)     , rdm_ice, jpi, jpj, npac(1:nbpac) )
+         CALL tab_2d_1d( nbpac, hicol_b   (1:nbpac)     , hicol  , jpi, jpj, npac(1:nbpac) )
+         CALL tab_2d_1d( nbpac, zvrel_ac  (1:nbpac)     , zvrel  , jpi, jpj, npac(1:nbpac) )
 
          !------------------------------------------------------------------------------!
@@ -344,7 +329,7 @@
          !----------------------
          DO ji = 1, nbpac
-            zh_newice(ji)     = hiccrit(1)
-         END DO
-         IF ( fraz_swi .EQ. 1.0 ) zh_newice(:) = hicol_b(:)
+            zh_newice(ji) = hiccrit(1)
+         END DO
+         IF( fraz_swi == 1.0 )   zh_newice(:) = hicol_b(:)
 
          !----------------------
@@ -352,22 +337,17 @@
          !----------------------
 
-         IF ( num_sal .EQ. 1 ) THEN
-            zs_newice(:)      =   bulk_sal
-         ENDIF ! num_sal
-
-         IF ( ( num_sal .EQ. 2 ) .OR. ( num_sal .EQ. 4 ) ) THEN
-
-            DO ji = 1, nbpac
-               zs_newice(ji)  =   MIN( 4.606 + 0.91 / zh_newice(ji) , s_i_max )
-               zji            =   MOD( npac(ji) - 1, jpi ) + 1
-               zjj            =   ( npac(ji) - 1 ) / jpi + 1
-               zs_newice(ji)  =   MIN( 0.5*sss_m(zji,zjj) , zs_newice(ji) )
-            END DO ! jl
-
-         ENDIF ! num_sal
-
-         IF ( num_sal .EQ. 3 ) THEN
-            zs_newice(:)      =   2.3
-         ENDIF ! num_sal
+         SELECT CASE ( num_sal )
+         CASE ( 1 )                    ! Sice = constant 
+            zs_newice(:) = bulk_sal
+         CASE ( 2 )                    ! Sice = F(z,t) [Vancoppenolle et al (2005)]
+            DO ji = 1, nbpac
+               zji =   MOD( npac(ji) - 1 , jpi ) + 1
+               zjj =      ( npac(ji) - 1 ) / jpi + 1
+               zs_newice(ji) = MIN(  4.606 + 0.91 / zh_newice(ji) , s_i_max , 0.5 * sss_m(zji,zjj)  )
+            END DO
+         CASE ( 3 )                    ! Sice = F(z) [multiyear ice]
+            zs_newice(:) =   2.3
+         END SELECT
+
 
          !-------------------------
@@ -376,12 +356,10 @@
          ! We assume that new ice is formed at the seawater freezing point
          DO ji = 1, nbpac
-            ztmelts           = - tmut * zs_newice(ji) + rtt ! Melting point (K)
-            ze_newice(ji)     =   rhoic * ( cpic * ( ztmelts - t_bo_b(ji) )    &
-               + lfus * ( 1.0 - ( ztmelts - rtt )   &
-               / ( t_bo_b(ji) - rtt ) )           &
-               - rcp * ( ztmelts-rtt ) )
-            ze_newice(ji)     =   MAX( ze_newice(ji) , 0.0 ) +                 &
-               MAX( 0.0 , SIGN( 1.0 , - ze_newice(ji) ) )   & 
-               * rhoic * lfus
+            ztmelts       = - tmut * zs_newice(ji) + rtt                  ! Melting point (K)
+            ze_newice(ji) =   rhoic * (  cpic * ( ztmelts - t_bo_b(ji) )                             &
+               &                       + lfus * ( 1.0 - ( ztmelts - rtt ) / ( t_bo_b(ji) - rtt ) )   &
+               &                       - rcp  *         ( ztmelts - rtt )  )
+            ze_newice(ji) =   MAX( ze_newice(ji) , 0._wp )    &
+               &          +   MAX(  0.0 , SIGN( 1.0 , - ze_newice(ji) )  ) * rhoic * lfus
          END DO ! ji
          !----------------
@@ -389,5 +367,5 @@
          !----------------
          DO ji = 1, nbpac
-            zo_newice(ji)     = 0.0
+            zo_newice(ji) = 0._wp
          END DO ! ji
 
@@ -396,5 +374,5 @@
          !--------------------------
          DO ji = 1, nbpac
-            zqbgow(ji)        = qldif_1d(ji) - qcmif_1d(ji) !<0
+            zqbgow(ji) = qldif_1d(ji) - qcmif_1d(ji)     !<0
          END DO ! ji
 
@@ -403,10 +381,9 @@
          !-------------------
          DO ji = 1, nbpac
-            zv_newice(ji)     = - zqbgow(ji) / ze_newice(ji)
+            zv_newice(ji) = - zqbgow(ji) / ze_newice(ji)
 
             ! A fraction zfrazb of frazil ice is accreted at the ice bottom
-            zfrazb        = ( TANH ( Cfrazb * ( zvrel_ac(ji) - vfrazb ) )     & 
-               + 1.0 ) / 2.0 * maxfrazb
-            zdh_frazb(ji) = zfrazb*zv_newice(ji)
+            zfrazb        = ( TANH ( Cfrazb * ( zvrel_ac(ji) - vfrazb ) ) + 1.0 ) * 0.5 * maxfrazb
+            zdh_frazb(ji) =         zfrazb   * zv_newice(ji)
             zv_newice(ji) = ( 1.0 - zfrazb ) * zv_newice(ji)
          END DO
@@ -415,21 +392,9 @@
          ! Salt flux due to new ice growth
          !---------------------------------
-         IF ( ( num_sal .EQ. 4 ) ) THEN 
-            DO ji = 1, nbpac
-               zji            = MOD( npac(ji) - 1, jpi ) + 1
-               zjj            = ( npac(ji) - 1 ) / jpi + 1
-               fseqv_1d(ji)   = fseqv_1d(ji) +                                     &
-                  ( sss_m(zji,zjj) - bulk_sal      ) * rhoic *       &
-                  zv_newice(ji) / rdt_ice
-            END DO
-         ELSE
-            DO ji = 1, nbpac
-               zji            = MOD( npac(ji) - 1, jpi ) + 1
-               zjj            = ( npac(ji) - 1 ) / jpi + 1
-               fseqv_1d(ji)   = fseqv_1d(ji) +                                     &
-                  ( sss_m(zji,zjj) - zs_newice(ji) ) * rhoic *       &
-                  zv_newice(ji) / rdt_ice
-            END DO ! ji
-         ENDIF
+         ! note that for constant salinity zs_newice() = bulk_sal (see top of the subroutine)
+         DO ji = 1, nbpac
+            sfx_thd_1d(ji) = sfx_thd_1d(ji) - zs_newice(ji) * rhoic * zv_newice(ji) * r1_rdtice
+            rdm_ice_1d(ji) = rdm_ice_1d(ji) +                 rhoic * zv_newice(ji)
+         END DO ! ji
 
          !------------------------------------
@@ -437,17 +402,16 @@
          !------------------------------------
          DO ji = 1, nbpac
-            ! Volume
-            zji                  = MOD( npac(ji) - 1, jpi ) + 1
-            zjj                  = ( npac(ji) - 1 ) / jpi + 1
-            vt_i_init(zji,zjj)   = vt_i_init(zji,zjj) + zv_newice(ji)
-            ! Energy
-            zde                  = ze_newice(ji) / unit_fac
-            zde                  = zde * area(zji,zjj) * zv_newice(ji)
-            et_i_init(zji,zjj)   = et_i_init(zji,zjj) + zde
+            zji = MOD( npac(ji) - 1 , jpi ) + 1
+            zjj =    ( npac(ji) - 1 ) / jpi + 1
+            !
+            zde = ze_newice(ji) / unit_fac * area(zji,zjj) * zv_newice(ji)
+            !
+            vt_i_init(zji,zjj) = vt_i_init(zji,zjj) + zv_newice(ji)             ! volume
+            et_i_init(zji,zjj) = et_i_init(zji,zjj) + zde                       ! Energy
+
          END DO
 
          ! keep new ice volume in memory
-         CALL tab_1d_2d( nbpac, v_newice , npac(1:nbpac), zv_newice(1:nbpac) , &
-            jpi, jpj )
+         CALL tab_1d_2d( nbpac, v_newice , npac(1:nbpac), zv_newice(1:nbpac) , jpi, jpj )
 
          !-----------------
@@ -455,9 +419,8 @@
          !-----------------
          DO ji = 1, nbpac
-            za_newice(ji)     = zv_newice(ji) / zh_newice(ji)
-            ! diagnostic
-            zji                  = MOD( npac(ji) - 1, jpi ) + 1
-            zjj                  = ( npac(ji) - 1 ) / jpi + 1
-            diag_lat_gr(zji,zjj) = zv_newice(ji) / rdt_ice
+            zji = MOD( npac(ji) - 1 , jpi ) + 1
+            zjj =    ( npac(ji) - 1 ) / jpi + 1
+            za_newice(ji) = zv_newice(ji) / zh_newice(ji)
+            diag_lat_gr(zji,zjj) = zv_newice(ji) * r1_rdtice
          END DO !ji
 
@@ -476,16 +439,14 @@
          !-------------------------------------------
          ! If lateral ice growth gives an ice concentration gt 1, then
-         ! we keep the excessive volume in memory and attribute it later
-         ! to bottom accretion
-         DO ji = 1, nbpac
-            ! vectorize
-            IF ( za_newice(ji) .GT. ( 1.0 - zat_i_ac(ji) ) ) THEN
-               zda_res(ji)    = za_newice(ji) - (1.0 - zat_i_ac(ji) )
-               zdv_res(ji)    = zda_res(ji) * zh_newice(ji) 
-               za_newice(ji)  = za_newice(ji) - zda_res(ji)
-               zv_newice(ji)  = zv_newice(ji) - zdv_res(ji)
+         ! we keep the excessive volume in memory and attribute it later to bottom accretion
+         DO ji = 1, nbpac
+            IF ( za_newice(ji)  >  ( 1._wp - zat_i_ac(ji) ) ) THEN
+               zda_res(ji)   = za_newice(ji) - (1.0 - zat_i_ac(ji) )
+               zdv_res(ji)   = zda_res  (ji) * zh_newice(ji) 
+               za_newice(ji) = za_newice(ji) - zda_res  (ji)
+               zv_newice(ji) = zv_newice(ji) - zdv_res  (ji)
             ELSE
-               zda_res(ji) = 0.0
-               zdv_res(ji) = 0.0
+               zda_res(ji) = 0._wp
+               zdv_res(ji) = 0._wp
             ENDIF
          END DO ! ji
@@ -497,6 +458,6 @@
          DO jl = 1, jpl
             DO ji = 1, nbpac
-               IF(  hi_max   (jl-1)  <  zh_newice(ji)   .AND.   &
-                  & zh_newice(ji)    <= hi_max   (jl)         ) THEN
+               IF(  hi_max   (jl-1)  <   zh_newice(ji)   .AND.   &
+                  & zh_newice(ji)    <=  hi_max   (jl)         ) THEN
                   za_i_ac (ji,jl) = za_i_ac (ji,jl) + za_newice(ji)
                   zv_i_ac (ji,jl) = zv_i_ac (ji,jl) + zv_newice(ji)
@@ -504,6 +465,6 @@
                   zcatac  (ji)    = jl
                ENDIF
-            END DO ! ji
-         END DO ! jl
+            END DO
+         END DO
 
          !----------------------------------
@@ -521,5 +482,5 @@
             DO ji = 1, nbpac
                jl = zcatac(ji)
-               zqold   = ze_i_ac(ji,jk,jl) ! [ J.m-3 ]
+               zqold   = ze_i_ac(ji,jk,jl)      ! [ J.m-3 ]
                zalphai = MIN( zhice_old(ji,jl) *   jk       / nlay_i , zh_newice(ji) )   &
                   &    - MIN( zhice_old(ji,jl) * ( jk - 1 ) / nlay_i , zh_newice(ji) )
@@ -527,5 +488,5 @@
                   + ( 1.0 - zswinew(ji) ) * ( za_old(ji,jl)  * zqold * zhice_old(ji,jl) / nlay_i   &
                   + za_newice(ji)  * ze_newice(ji) * zalphai                                       &
-                  + za_newice(ji)  * ze_newice(ji) * zdhex(ji) / nlay_i ) / ( ( zv_i_ac(ji,jl) ) / nlay_i )
+                  + za_newice(ji)  * ze_newice(ji) * zdhex(ji) / nlay_i ) / ( zv_i_ac(ji,jl) / nlay_i )
             END DO
          END DO
@@ -567,5 +528,5 @@
                zdhicbot (ji,jl) = zdv_res(ji)    / MAX( za_i_ac(ji,jl) , epsi10 ) * zindb    &
                   &             +  zindb * zdh_frazb(ji)                               ! frazil ice may coalesce
-               zdummy(ji,jl)    = zv_i_ac(ji,jl)/MAX(za_i_ac(ji,jl),epsi10)*zindb      ! thickness of residual ice
+               zdummy(ji,jl)    = zv_i_ac(ji,jl) / MAX( za_i_ac(ji,jl) , epsi10 ) * zindb      ! thickness of residual ice
             END DO
          END DO
@@ -628,8 +589,8 @@
          ! Update salinity
          !-----------------
-         IF(  num_sal == 2  .OR.  num_sal == 4  ) THEN
+         IF(  num_sal == 2  ) THEN      ! Sice = F(z,t)
             DO jl = 1, jpl
                DO ji = 1, nbpac
-                  zindb = 1._wp - MAX( 0._wp , SIGN( 1._wp , - zv_i_ac(ji,jl) ) )  ! 0 if no ice and 1 if yes
+                  zindb = 1._wp - MAX( 0._wp , SIGN( 1._wp , - zv_i_ac(ji,jl) ) )   ! 0 if no ice and 1 if yes
                   zdv   = zv_i_ac(ji,jl) - zv_old(ji,jl)
                   zsmv_i_ac(ji,jl) = ( zsmv_i_ac(ji,jl) + zdv * zs_newice(ji) ) * zindb
@@ -645,5 +606,5 @@
             CALL tab_1d_2d( nbpac, v_i (:,:,jl), npac(1:nbpac), zv_i_ac (1:nbpac,jl), jpi, jpj )
             CALL tab_1d_2d( nbpac, oa_i(:,:,jl), npac(1:nbpac), zoa_i_ac(1:nbpac,jl), jpi, jpj )
-            IF (  num_sal == 2  .OR.  num_sal == 4  )   &
+            IF (  num_sal == 2  )   &
                CALL tab_1d_2d( nbpac, smv_i (:,:,jl), npac(1:nbpac), zsmv_i_ac(1:nbpac,jl) , jpi, jpj )
             DO jk = 1, nlay_i
@@ -651,5 +612,6 @@
             END DO
          END DO
-         CALL tab_1d_2d( nbpac, fseqv , npac(1:nbpac), fseqv_1d  (1:nbpac) , jpi, jpj )
+         CALL tab_1d_2d( nbpac, sfx_thd, npac(1:nbpac), sfx_thd_1d(1:nbpac), jpi, jpj )
+         CALL tab_1d_2d( nbpac, rdm_ice, npac(1:nbpac), rdm_ice_1d(1:nbpac), jpi, jpj )
          !
       ENDIF ! nbpac > 0
@@ -660,5 +622,5 @@
       DO jl = 1, jpl
          DO jk = 1, nlay_i          ! heat content in 10^9 Joules
-            e_i(:,:,jk,jl) = e_i(:,:,jk,jl) * area(:,:) * v_i(:,:,jl) / nlay_i  / unit_fac 
+            e_i(:,:,jk,jl) = e_i(:,:,jk,jl) * area(:,:) * v_i(:,:,jl) / nlay_i / unit_fac 
          END DO
       END DO
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_sal.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_sal.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limthd_sal.F90	(revision 3625)
@@ -12,16 +12,17 @@
    !!   'key_lim3'                                      LIM-3 sea-ice model
    !!----------------------------------------------------------------------
-   !!   lim_thd_sal : salinity variations in the ice
-   !!----------------------------------------------------------------------
-   USE par_oce          ! ocean parameters
-   USE phycst           ! physical constants (ocean directory)
-   USE sbc_oce          ! Surface boundary condition: ocean fields
-   USE ice              ! LIM variables
-   USE par_ice          ! LIM parameters
-   USE thd_ice          ! LIM thermodynamics
-   USE limvar           ! LIM variables
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
+   !!   lim_thd_sal   : salinity variations in the ice
+   !!----------------------------------------------------------------------
+   USE par_oce        ! ocean parameters
+   USE phycst         ! physical constants (ocean directory)
+   USE sbc_oce        ! Surface boundary condition: ocean fields
+   USE ice            ! LIM variables
+   USE par_ice        ! LIM parameters
+   USE thd_ice        ! LIM thermodynamics
+   USE limvar         ! LIM variables
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -32,5 +33,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -44,14 +45,12 @@
       !! ** Purpose :   computes new salinities in the ice
       !!
-      !! ** Method  :  4 possibilities
-      !!               -> num_sal = 1 -> constant salinity for z,t
-      !!               -> num_sal = 2 -> S = S(z,t) [simple Vancoppenolle et al 2005]
-      !!               -> num_sal = 3 -> S = S(z)   [multiyear ice]
-      !!               -> num_sal = 4 -> S = S(h)   [Cox and Weeks 74]
+      !! ** Method  :  3 possibilities
+      !!               -> num_sal = 1 -> Sice = cst    [ice salinity constant in both time & space] 
+      !!               -> num_sal = 2 -> Sice = S(z,t) [Vancoppenolle et al. 2005]
+      !!               -> num_sal = 3 -> Sice = S(z)   [multiyear ice]
       !!---------------------------------------------------------------------
-      INTEGER, INTENT(in) ::  kideb, kiut   ! thickness category index
+      INTEGER, INTENT(in) ::   kideb, kiut   ! thickness category index
       !
       INTEGER  ::   ji, jk     ! dummy loop indices 
-      INTEGER  ::   zji, zjj   ! local integers
       REAL(wp) ::   zsold, iflush, iaccrbo, igravdr, isnowic, i_ice_switch,  ztmelts   ! local scalars
       REAL(wp) ::   zaaa, zbbb, zccc, zdiscrim   ! local scalars
@@ -64,17 +63,10 @@
       ! 1) Constant salinity, constant in time                                       |
       !------------------------------------------------------------------------------|
-!!gm comment: if num_sal = 1 s_i_b and sm_i_b can be set to bulk_sal one for all in the initialisation phase !!
-      IF( num_sal == 1 ) THEN
-         !
-         DO jk = 1, nlay_i
-            DO ji = kideb, kiut
-               s_i_b(ji,jk) =  bulk_sal
-            END DO ! ji
-         END DO ! jk
-         !
-         DO ji = kideb, kiut
-            sm_i_b(ji)      =  bulk_sal 
-         END DO ! ji
-         !
+!!gm comment: if num_sal = 1 s_i_new, s_i_b and sm_i_b can be set to bulk_sal one for all in the initialisation phase !!
+!!gm           ===>>>   simplification of almost all test on num_sal value
+      IF(  num_sal == 1  ) THEN
+            s_i_b  (kideb:kiut,1:nlay_i) =  bulk_sal
+            sm_i_b (kideb:kiut)          =  bulk_sal 
+            s_i_new(kideb:kiut)          =  bulk_sal
       ENDIF
 
@@ -83,5 +75,5 @@
       !------------------------------------------------------------------------------|
 
-      IF(  num_sal == 2  .OR.  num_sal == 4  ) THEN
+      IF(  num_sal == 2  ) THEN
 
          !---------------------------------
@@ -118,5 +110,5 @@
             dsm_i_gd_1d(ji) = - igravdr * MAX( sm_i_b(ji) - sal_G , 0._wp ) / time_G * rdt_ice 
             !                                   ! drainage by flushing  
-            dsm_i_fl_1d(ji) = - iflush * MAX( sm_i_b(ji) - sal_F , 0._wp ) / time_F * rdt_ice
+            dsm_i_fl_1d(ji) = - iflush  * MAX( sm_i_b(ji) - sal_F , 0._wp ) / time_F * rdt_ice
 
             !-----------------
@@ -133,6 +125,6 @@
          END DO ! ji
 
-         ! Salinity profile
-         CALL lim_var_salprof1d( kideb, kiut )
+         CALL lim_var_salprof1d( kideb, kiut )         ! Salinity profile
+
 
          !----------------------------
@@ -143,9 +135,9 @@
 !!gm useless
             ! iflush  : 1 if summer 
-            iflush  =  MAX( 0._wp , SIGN ( 1._wp , t_su_b(ji) - rtt ) ) 
+            iflush  =  MAX( 0._wp , SIGN( 1._wp , t_su_b(ji) - rtt        )  ) 
             ! igravdr : 1 if t_su lt t_bo
-            igravdr =  MAX( 0._wp , SIGN ( 1._wp , t_bo_b(ji) - t_su_b(ji) ) ) 
+            igravdr =  MAX( 0._wp , SIGN( 1._wp , t_bo_b(ji) - t_su_b(ji) )  ) 
             ! iaccrbo : 1 if bottom accretion
-            iaccrbo =  MAX( 0._wp , SIGN ( 1._wp , dh_i_bott(ji) ) )
+            iaccrbo =  MAX( 0._wp , SIGN( 1._wp , dh_i_bott(ji)           )  )
 !!gm end useless
             !
@@ -157,9 +149,8 @@
          !----------------------------
          DO ji = kideb, kiut
-            i_ice_switch = 1._wp - MAX ( 0._wp, SIGN( 1._wp , - ht_i_b(ji) ) )
-            fsbri_1d(ji) = fsbri_1d(ji) - i_ice_switch * rhoic * a_i_b(ji) * ht_i_b(ji)         &
-               &         * ( MAX(dsm_i_gd_1d(ji) + dsm_i_fl_1d(ji), sm_i_b(ji) - zsiold(ji) ) ) / rdt_ice
-            IF( num_sal == 4 ) fsbri_1d(ji) = 0._wp
-         END DO ! ji
+            i_ice_switch = 1._wp - MAX(  0._wp, SIGN( 1._wp , - ht_i_b(ji) )  )
+            sfx_bri_1d(ji) = sfx_bri_1d(ji) - i_ice_switch * rhoic * a_i_b(ji) * ht_i_b(ji)         &
+               &           * ( MAX( dsm_i_gd_1d(ji) + dsm_i_fl_1d(ji) , sm_i_b(ji) - zsiold(ji) ) ) * r1_rdtice
+         END DO
 
          ! Only necessary for conservation check since salinity is modified
@@ -179,5 +170,5 @@
          END DO
          !
-      ENDIF ! num_sal .EQ. 2
+      ENDIF 
 
       !------------------------------------------------------------------------------|
@@ -185,49 +176,14 @@
       !------------------------------------------------------------------------------|
 
-      IF( num_sal == 3 )   CALL lim_var_salprof1d( kideb, kiut )
-
-      !------------------------------------------------------------------------------|
-      !  Module 4 : Constant salinity varying in time                                |
-      !------------------------------------------------------------------------------|
-
-      IF( num_sal == 5 ) THEN      ! Cox and Weeks, 1974
-         !
-         DO ji = kideb, kiut
-            zsold = sm_i_b(ji)
-            IF( ht_i_b(ji) < 0.4 ) THEN
-               sm_i_b(ji) = 14.24 - 19.39 * ht_i_b(ji) 
-            ELSE
-               sm_i_b(ji) =  7.88 - 1.59 * ht_i_b(ji)
-               sm_i_b(ji) = MIN( sm_i_b(ji) , zsold )  
-            ENDIF
-            IF( ht_i_b(ji) > 3.06918239 ) THEN 
-               sm_i_b(ji) = 3._wp
-            ENDIF
-            DO jk = 1, nlay_i
-               s_i_b(ji,jk)   = sm_i_b(ji)
-            END DO
-         END DO
-         !
-      ENDIF ! num_sal
+      IF(  num_sal == 3  )   CALL lim_var_salprof1d( kideb, kiut )
+
 
       !------------------------------------------------------------------------------|
       ! 5) Computation of salt flux due to Bottom growth
       !------------------------------------------------------------------------------|
-
-      IF ( num_sal == 4 ) THEN
-         DO ji = kideb, kiut
-            zji = MOD( npb(ji) - 1 , jpi ) + 1
-            zjj =    ( npb(ji) - 1 ) / jpi + 1
-            fseqv_1d(ji) = fseqv_1d(ji) + ( sss_m(zji,zjj) - bulk_sal    )               &
-               &                        * rhoic * a_i_b(ji) * MAX( dh_i_bott(ji) , 0.0 ) / rdt_ice
-         END DO
-      ELSE
-         DO ji = kideb, kiut
-            zji = MOD( npb(ji) - 1 , jpi ) + 1
-            zjj =    ( npb(ji) - 1 ) / jpi + 1
-            fseqv_1d(ji) = fseqv_1d(ji) + ( sss_m(zji,zjj) - s_i_new(ji) )               &
-               &                        * rhoic * a_i_b(ji) * MAX( dh_i_bott(ji) , 0.0 ) / rdt_ice
-         END DO
-      ENDIF
+      ! note: s_i_new = bulk_sal in constant salinity case
+      DO ji = kideb, kiut
+         sfx_thd_1d(ji) = sfx_thd_1d(ji) - s_i_new(ji) * rhoic * a_i_b(ji) * MAX( dh_i_bott(ji) , 0._wp ) * r1_rdtice
+      END DO
       !
       CALL wrk_dealloc( jpij, ze_init, zhiold, zsiold )
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limtrp.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limtrp.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limtrp.F90	(revision 3625)
@@ -14,17 +14,18 @@
    !!   lim_trp      : advection/diffusion process of sea ice
    !!----------------------------------------------------------------------
-   USE phycst          ! physical constant
-   USE dom_oce         ! ocean domain
-   USE sbc_oce         ! ocean surface boundary condition
-   USE par_ice         ! LIM-3 parameter
-   USE dom_ice         ! LIM-3 domain
-   USE ice             ! LIM-3 variables
-   USE limadv          ! LIM-3 advection
-   USE limhdf          ! LIM-3 horizontal diffusion
-   USE in_out_manager  ! I/O manager
-   USE lbclnk          ! lateral boundary conditions -- MPP exchanges
-   USE lib_mpp         ! MPP library
-   USE wrk_nemo        ! work arrays
-   USE prtctl          ! Print control
+   USE phycst         ! physical constant
+   USE dom_oce        ! ocean domain
+   USE sbc_oce        ! ocean surface boundary condition
+   USE par_ice        ! ice parameter
+   USE dom_ice        ! ice domain
+   USE ice            ! ice variables
+   USE limadv         ! ice advection
+   USE limhdf         ! ice horizontal diffusion
+   USE in_out_manager ! I/O manager
+   USE lbclnk         ! lateral boundary conditions -- MPP exchanges
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE prtctl         ! Print control
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -45,5 +46,5 @@
 #  include "vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -128,5 +129,5 @@
          zusnit = 1.0 / REAL( initad ) 
          IF( zcfl > 0.5 .AND. lwp )   &
-            WRITE(numout,*) 'lim_trp_2 : CFL violation at day ', nday, ', cfl = ', zcfl,   &
+            WRITE(numout,*) 'lim_trp   : CFL violation at day ', nday, ', cfl = ', zcfl,   &
                &                        ': the ice time stepping is split in two'
 
@@ -174,39 +175,39 @@
          ELSE
             DO jk = 1, initad
-               CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0ow (:,:), sxopw(:,:),   &             !--- ice open water area
+               CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0ow (:,:), sxopw(:,:),   &             !--- ice open water area
                   &                                       sxxopw(:,:), syopw(:,:), syyopw(:,:), sxyopw(:,:)  )
-               CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0ow (:,:), sxopw(:,:),   &
+               CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0ow (:,:), sxopw(:,:),   &
                   &                                       sxxopw(:,:), syopw(:,:), syyopw(:,:), sxyopw(:,:)  )
                DO jl = 1, jpl
-                  CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0ice(:,:,jl), sxice(:,:,jl),   &    !--- ice volume  ---
+                  CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0ice(:,:,jl), sxice(:,:,jl),   &    !--- ice volume  ---
                      &                                       sxxice(:,:,jl), syice(:,:,jl), syyice(:,:,jl), sxyice(:,:,jl)  )
-                  CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0ice(:,:,jl), sxice(:,:,jl),   &
+                  CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0ice(:,:,jl), sxice(:,:,jl),   &
                      &                                       sxxice(:,:,jl), syice(:,:,jl), syyice(:,:,jl), sxyice(:,:,jl)  )
-                  CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0sn (:,:,jl), sxsn (:,:,jl),   &    !--- snow volume  ---
+                  CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0sn (:,:,jl), sxsn (:,:,jl),   &    !--- snow volume  ---
                      &                                       sxxsn (:,:,jl), sysn (:,:,jl), syysn (:,:,jl), sxysn (:,:,jl)  )
-                  CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0sn (:,:,jl), sxsn (:,:,jl),   &
+                  CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0sn (:,:,jl), sxsn (:,:,jl),   &
                      &                                       sxxsn (:,:,jl), sysn (:,:,jl), syysn (:,:,jl), sxysn (:,:,jl)  )
-                  CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0sm (:,:,jl), sxsal(:,:,jl),   &    !--- ice salinity ---
+                  CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0sm (:,:,jl), sxsal(:,:,jl),   &    !--- ice salinity ---
                      &                                       sxxsal(:,:,jl), sysal(:,:,jl), syysal(:,:,jl), sxysal(:,:,jl)  )
-                  CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0sm (:,:,jl), sxsal(:,:,jl),   &
+                  CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0sm (:,:,jl), sxsal(:,:,jl),   &
                      &                                       sxxsal(:,:,jl), sysal(:,:,jl), syysal(:,:,jl), sxysal(:,:,jl)  )
 
-                  CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0oi (:,:,jl), sxage(:,:,jl),   &   !--- ice age      ---
+                  CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0oi (:,:,jl), sxage(:,:,jl),   &   !--- ice age      ---
                      &                                       sxxage(:,:,jl), syage(:,:,jl), syyage(:,:,jl), sxyage(:,:,jl)  )
-                  CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0oi (:,:,jl), sxage(:,:,jl),   &
+                  CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0oi (:,:,jl), sxage(:,:,jl),   &
                      &                                       sxxage(:,:,jl), syage(:,:,jl), syyage(:,:,jl), sxyage(:,:,jl)  )
-                  CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0a  (:,:,jl), sxa  (:,:,jl),   &   !--- ice concentrations ---
+                  CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0a  (:,:,jl), sxa  (:,:,jl),   &   !--- ice concentrations ---
                      &                                       sxxa  (:,:,jl), sya  (:,:,jl), syya  (:,:,jl), sxya  (:,:,jl)  )
-                  CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0a  (:,:,jl), sxa  (:,:,jl),   &
+                  CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0a  (:,:,jl), sxa  (:,:,jl),   &
                      &                                       sxxa  (:,:,jl), sya  (:,:,jl), syya  (:,:,jl), sxya  (:,:,jl)  )
-                  CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0c0 (:,:,jl), sxc0 (:,:,jl),   &  !--- snow heat contents ---
+                  CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0c0 (:,:,jl), sxc0 (:,:,jl),   &  !--- snow heat contents ---
                      &                                       sxxc0 (:,:,jl), syc0 (:,:,jl), syyc0 (:,:,jl), sxyc0 (:,:,jl)  )
-                  CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0c0 (:,:,jl), sxc0 (:,:,jl),   &
+                  CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0c0 (:,:,jl), sxc0 (:,:,jl),   &
                      &                                       sxxc0 (:,:,jl), syc0 (:,:,jl), syyc0 (:,:,jl), sxyc0 (:,:,jl)  )
                   DO layer = 1, nlay_i                                                           !--- ice heat contents ---
-                     CALL lim_adv_y( zusnit, v_ice, rzero, zsm, zs0e(:,:,layer,jl), sxe (:,:,layer,jl),   & 
+                     CALL lim_adv_y( zusnit, v_ice, rone , zsm, zs0e(:,:,layer,jl), sxe (:,:,layer,jl),   & 
                         &                                       sxxe(:,:,layer,jl), sye (:,:,layer,jl),   &
                         &                                       syye(:,:,layer,jl), sxye(:,:,layer,jl) )
-                     CALL lim_adv_x( zusnit, u_ice, rone , zsm, zs0e(:,:,layer,jl), sxe (:,:,layer,jl),   & 
+                     CALL lim_adv_x( zusnit, u_ice, rzero, zsm, zs0e(:,:,layer,jl), sxe (:,:,layer,jl),   & 
                         &                                       sxxe(:,:,layer,jl), sye (:,:,layer,jl),   &
                         &                                       syye(:,:,layer,jl), sxye(:,:,layer,jl) )
@@ -392,12 +393,10 @@
 
                   ! Ice salinity and age
-                  zsal = MAX( MIN( (rhoic-rhosn)/rhoic*sss_m(ji,jj)  , &
-                     zusvoic * zs0sm(ji,jj,jl) ), s_i_min ) * v_i(ji,jj,jl)
-                  IF ( ( num_sal .EQ. 2 ) .OR. ( num_sal .EQ. 4 ) ) & 
-                     smv_i(ji,jj,jl) = zindic*zsal + (1.0-zindic)*0.0
-
-                  zage = MAX( MIN( zbigval, zs0oi(ji,jj,jl) / & 
-                     MAX( a_i(ji,jj,jl), epsi16 )  ), 0.0 ) * a_i(ji,jj,jl)
-                  oa_i (ji,jj,jl)  = zindic*zage 
+                  zsal = MAX( MIN(  (rhoic-rhosn)/rhoic*sss_m(ji,jj) ,   &
+                     &              zusvoic * zs0sm(ji,jj,jl)         ) , s_i_min ) * v_i(ji,jj,jl)
+                  IF(  num_sal == 2  )   smv_i(ji,jj,jl) = zindic * zsal + (1.0-zindic) * 0._wp
+
+                  zage = MAX(  MIN( zbigval, zs0oi(ji,jj,jl) / MAX( a_i(ji,jj,jl), epsi16 ) ), 0._wp  ) * a_i(ji,jj,jl)
+                  oa_i (ji,jj,jl)  = zindic * zage 
 
                   ! Snow heat content
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limupdate.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limupdate.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limupdate.F90	(revision 3625)
@@ -12,28 +12,28 @@
    !!    lim_update   : computes update of sea-ice global variables from trend terms
    !!----------------------------------------------------------------------
-   USE limrhg          ! ice rheology
-
-   USE dom_oce
-   USE oce             ! dynamics and tracers variables
-   USE in_out_manager
-   USE sbc_oce         ! Surface boundary condition: ocean fields
-   USE sbc_ice         ! Surface boundary condition: ice fields
-   USE dom_ice
-   USE phycst          ! physical constants
-   USE ice
-   USE limdyn
-   USE limtrp
-   USE limthd
-   USE limsbc
-   USE limdia
-   USE limwri
-   USE limrst
-   USE thd_ice         ! LIM thermodynamic sea-ice variables
-   USE par_ice
-   USE limitd_th
-   USE limvar
-   USE prtctl           ! Print control
-   USE lbclnk           ! lateral boundary condition - MPP exchanges
-   USE wrk_nemo         ! work arrays
+   USE dom_oce        ! ocean domain
+   USE oce            ! dynamics and tracers variables
+   USE sbc_oce        ! Surface boundary condition: ocean fields
+   USE sbc_ice        ! Surface boundary condition: ice fields
+   USE phycst         ! physical constants
+   USE ice            ! ice variables 
+   USE par_ice        ! ice parameters
+   USE thd_ice        ! ice thermodynamic variables
+   USE dom_ice        ! ice domain
+   USE limrhg         ! ice rheology
+   USE limdyn         ! ice dynamics
+   USE limtrp         ! ice transport
+   USE limthd         ! ice thermodynamics
+   USE limsbc         ! ice-oce surface boundary conditions
+   USE limdia         ! ice diagnostics
+   USE limwri         ! ice outputs
+   USE limrst         ! ice restart
+   USE limitd_th      ! ice thickness distribution (thermodynamics)
+   USE limvar         ! ice variables
+   USE prtctl         ! Print control
+   USE in_out_manager ! I/O manager
+   USE lbclnk         ! lateral boundary condition - MPP exchanges
+   USE wrk_nemo       ! work arrays
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -54,5 +54,5 @@
 #  include "vectopt_loop_substitute.h90"
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -190,24 +190,22 @@
 
                   ! is there any ice left ?
-                  zindic        = MAX( rzero, SIGN( rone, v_i(ji,jj,jl) - epsi10 ) ) 
+                  zindic = MAX( rzero , SIGN( rone, v_i(ji,jj,jl) - epsi10 ) ) 
                   !=1 if hi > 1e-3 and 0 if not
-                  zdvres        = MAX(0.0,-v_i(ji,jj,jl)) !residual volume if too much ice was molten
+                  zdvres = MAX( 0.0 , -v_i(ji,jj,jl) ) !residual volume if too much ice was molten
                   !this quantity is positive
-                  v_i(ji,jj,jl) = zindic*v_i(ji,jj,jl)    !ice volume cannot be negative
+                  v_i(ji,jj,jl) = zindic * v_i(ji,jj,jl)    !ice volume cannot be negative
                   !correct thermodynamic ablation
-                  d_v_i_thd(ji,jj,jl)  = zindic  *  d_v_i_thd(ji,jj,jl) + (1.0-zindic) * (-zviold - d_v_i_trp(ji,jj,jl)) 
+                  d_v_i_thd(ji,jj,jl) = zindic  *  d_v_i_thd(ji,jj,jl) + (1.0-zindic) * (-zviold - d_v_i_trp(ji,jj,jl)) 
                   ! THIS IS NEW
-                  d_a_i_thd(ji,jj,jl)  = zindic  *  d_a_i_thd(ji,jj,jl) + & 
-                     (1.0-zindic) * (-old_a_i(ji,jj,jl)) 
+                  d_a_i_thd(ji,jj,jl) = zindic  *  d_a_i_thd(ji,jj,jl) + (1.0-zindic) * (-old_a_i(ji,jj,jl)) 
 
                   !residual salt flux if ice is over-molten
-                  fsalt_res(ji,jj)  = fsalt_res(ji,jj) + ( sss_m(ji,jj) - sm_i(ji,jj,jl) ) * & 
-                     ( rhoic * zdvres / rdt_ice )
-                  !             fheat_res(ji,jj)  = fheat_res(ji,jj) + rhoic * lfus * zdvres / rdt_ice
+                  sfx_res(ji,jj)  = sfx_res(ji,jj) - sm_i(ji,jj,jl) * ( rhoic * zdvres * r1_rdtice )
+                  !             fheat_res(ji,jj)  = fheat_res(ji,jj) + rhoic * lfus * zdvres * r1_rdtice
 
                   ! is there any snow left ?
-                  zindsn        = MAX( rzero, SIGN( rone, v_s(ji,jj,jl) - epsi10 ) ) 
-                  zvsold        = v_s(ji,jj,jl)
-                  zdvres        = MAX(0.0,-v_s(ji,jj,jl)) !residual volume if too much ice was molten
+                  zindsn = MAX(  rzero, SIGN( rone , v_s(ji,jj,jl) - epsi10 )  ) 
+                  zvsold = v_s(ji,jj,jl)
+                  zdvres = MAX( 0.0 , -v_s(ji,jj,jl) )   !residual volume if too much ice was molten
                   !this quantity is positive
                   v_s(ji,jj,jl) = zindsn*v_s(ji,jj,jl)    !snow volume cannot be negative
@@ -215,10 +213,7 @@
                   d_v_s_thd(ji,jj,jl)  = zindsn  *  d_v_s_thd(ji,jj,jl) + & 
                      (1.0-zindsn) * (-zvsold - d_v_s_trp(ji,jj,jl)) 
-                  !unsure correction on salt flux.... maybe future will tell it was not that right
-
-                  !residual salt flux if snow is over-molten
-                  fsalt_res(ji,jj)  = fsalt_res(ji,jj) + sss_m(ji,jj) * ( rhosn * zdvres / rdt_ice )
-                  !this flux will be positive if snow was over-molten
-                  !             fheat_res(ji,jj)  = fheat_res(ji,jj) + rhosn * lfus * zdvres / rdt_ice
+
+                  !no salt flux when snow is over-molten
+                  !             fheat_res(ji,jj)  = fheat_res(ji,jj) + rhosn * lfus * zdvres * r1_rdtice
                ENDIF
             END DO !ji
@@ -229,9 +224,7 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-               IF ( ABS(fsalt_res(ji,jj)) .GT. 1.0 ) THEN 
-                  WRITE(numout,*) ' ALERTE 1000 : residual salt flux of -> ', &
-                     fsalt_res(ji,jj)
-                  WRITE(numout,*) ' ji, jj : ', ji, jj, ' gphit, glamt : ', &
-                     gphit(ji,jj), glamt(ji,jj)
+               IF(  ABS( sfx_res(ji,jj) )  >  1._wp  ) THEN 
+                  WRITE(numout,*) ' ALERTE 1000 : residual salt flux of -> ', sfx_res(ji,jj)
+                  WRITE(numout,*) ' ji, jj : ', ji, jj, ' gphit, glamt : ', gphit(ji,jj), glamt(ji,jj)
                ENDIF
             END DO
@@ -277,7 +270,7 @@
       ENDIF
 
-      at_i(:,:) = 0._wp
-      DO jl = 1, jpl
-         at_i(:,:) = a_i(:,:,jl) + at_i(:,:)
+      at_i(:,:) = a_i(:,:,1)
+      DO jl = 2, jpl
+         at_i(:,:) = at_i(:,:) + a_i(:,:,jl)
       END DO
 
@@ -306,5 +299,5 @@
       !--------------
 
-      IF(  num_sal == 2  .OR.  num_sal == 4  ) THEN      ! general case
+      IF(  num_sal == 2  ) THEN      ! Prognostic salinity [Sice=F(z,t)]
          !
          IF( ln_nicep ) THEN  
@@ -317,5 +310,5 @@
             WRITE(numout,*) ' v_s : ', v_s(jiindx, jjindx, 1:jpl)
          ENDIF
-
+         !
          smv_i(:,:,:) = smv_i(:,:,:) + d_smv_i_thd(:,:,:) + d_smv_i_trp(:,:,:)
          !
@@ -352,6 +345,6 @@
                .AND.( ( v_i(ji,jj,1)/MAX(a_i(ji,jj,1),epsi10)*zindb).GT.zhimax ) &
                .AND.( zat_i_old.LT.zacrith ) )  THEN ! new line
-               z_prescr_hi      = hi_max(1) / 2.0
-               a_i(ji,jj,1)     = v_i(ji,jj,1) / z_prescr_hi
+               z_prescr_hi  = hi_max(1) * 0.5_wp
+               a_i(ji,jj,1) = v_i(ji,jj,1) / z_prescr_hi
             ENDIF
          END DO
@@ -412,7 +405,7 @@
       ENDIF
 
-      at_i(:,:) = 0._wp
-      DO jl = 1, jpl
-         at_i(:,:) = a_i(:,:,jl) + at_i(:,:)
+      at_i(:,:) = a_i(:,:,1)
+      DO jl = 2, jpl
+         at_i(:,:) = at_i(:,:) + a_i(:,:,jl)
       END DO
 
@@ -452,7 +445,7 @@
       ENDIF
 
-      at_i(:,:) = 0._wp
-      DO jl = 1, jpl
-         at_i(:,:) = a_i(:,:,jl) + at_i(:,:)
+      at_i(:,:) = a_i(:,:,1)
+      DO jl = 2, jpl
+         at_i(:,:) = at_i(:,:) + a_i(:,:,jl)
       END DO
 
@@ -616,11 +609,10 @@
             DO ji = 1, jpi
                IF ( internal_melt(ji,jj,jl) == 1 ) THEN
-                  v_s(ji,jj,jl)   = 0.0
-                  e_s(ji,jj,1,jl) = 0.0
+                  v_s(ji,jj,jl)   = 0._wp
+                  e_s(ji,jj,1,jl) = 0._wp
                   !   ! release heat
-                  fheat_res(ji,jj) = fheat_res(ji,jj)  &
-                     + ze_s * v_s(ji,jj,jl) / rdt_ice
+                  fheat_res(ji,jj) = fheat_res(ji,jj) + ze_s  * v_s(ji,jj,jl) * r1_rdtice
                   ! release mass
-                  rdmsnif(ji,jj) =  rdmsnif(ji,jj) + rhosn * v_s(ji,jj,jl)
+                  rdm_snw  (ji,jj) = rdm_snw  (ji,jj) + rhosn * v_s(ji,jj,jl)
                ENDIF
             END DO
@@ -648,5 +640,5 @@
                !                ENDIF
                IF ((oa_i(ji,jj,jl)-1.0)*86400.0.gt.(rdt_ice*numit*a_i(ji,jj,jl))) THEN
-                  oa_i(ji,jj,jl) = rdt_ice*numit/86400.0*a_i(ji,jj,jl)
+                  oa_i(ji,jj,jl) = rdt_ice * numit / 86400.0 * a_i(ji,jj,jl)
                ENDIF
                oa_i(ji,jj,jl) = zindb*zindic*oa_i(ji,jj,jl)
@@ -657,5 +649,5 @@
                !             v_s(ji,jj,jl)  = MAX( zindb * v_s(ji,jj,jl), 0.0) 
                ! snow thickness cannot be smaller than 1e-6
-               v_s(ji,jj,jl)  = zindsn*v_s(ji,jj,jl)*zindb
+               v_s(ji,jj,jl)  = zindsn * v_s(ji,jj,jl) * zindb
                v_s(ji,jj,jl)  = v_s(ji,jj,jl) *  MAX( 0.0 , SIGN( 1.0 , v_s(ji,jj,jl) - epsi06 ) )
 
@@ -737,21 +729,18 @@
       !---------------------
 
-      IF ( ( num_sal .EQ. 2 ) .OR. ( num_sal .EQ. 4 ) ) THEN ! general case
-
+      IF(  num_sal == 2  ) THEN      ! Prognostic salinity [Sice=F(z,t)]
+         !
          DO jl = 1, jpl
             DO jk = 1, nlay_i
                DO jj = 1, jpj 
-                  DO ji = 1, jpi
-                     ! salinity stays in bounds
-                     smv_i(ji,jj,jl)  =  MAX(MIN((rhoic-rhosn)/rhoic*sss_m(ji,jj),smv_i(ji,jj,jl)), &
-                        0.1 * v_i(ji,jj,jl) )
+                  DO ji = 1, jpi           ! salinity stays in bounds
+                     smv_i(ji,jj,jl)  =  MAX(MIN((rhoic-rhosn)/rhoic*sss_m(ji,jj),smv_i(ji,jj,jl)), 0.1 * v_i(ji,jj,jl) )
                      i_ice_switch    =  1.0-MAX(0.0,SIGN(1.0,-v_i(ji,jj,jl)))
-                     smv_i(ji,jj,jl)  = i_ice_switch*smv_i(ji,jj,jl) + &
-                        0.1*(1.0-i_ice_switch)*v_i(ji,jj,jl)
+                     smv_i(ji,jj,jl)  = i_ice_switch*smv_i(ji,jj,jl) + 0.1*(1.0-i_ice_switch)*v_i(ji,jj,jl)
                   END DO ! ji
                END DO ! jj
             END DO !jk
          END DO !jl
-
+         !
       ENDIF
 
@@ -796,17 +785,10 @@
       !-----------------------------------------------------
       zamax = amax
-      ! 2.13.1) individual concentrations cannot exceed zamax
-      !------------------------------------------------------
-
-      at_i(:,:) = 0.0
-      DO jl = 1, jpl
-         at_i(:,:) = a_i(:,:,jl) + at_i(:,:)
-      END DO
-
-      ! 2.13.2) Total ice concentration cannot exceed zamax
-      !----------------------------------------------------
+      ! 2.13.1) total (and thus individual) concentrations cannot exceed zamax
+      !-----------------------------------------------------------------------
+
       at_i(:,:) = a_i(:,:,1)
       DO jl = 2, jpl
-         at_i(:,:) = a_i(:,:,jl) + at_i(:,:)
+         at_i(:,:) = at_i(:,:) + a_i(:,:,jl)
       END DO
 
@@ -815,8 +797,9 @@
 
             ! 0) Excessive area ?
-            z_da_ex =  MAX( at_i(ji,jj) - zamax , 0.0 )        
+            z_da_ex =  MAX( at_i(ji,jj) - zamax , 0._wp )        
 
             ! 1) Count the number of existing categories
             DO jl  = 1, jpl
+!!cr : comment the second line of zindb definition, and use epsi04 in the 1st one
                zindb   =  MAX( rzero, SIGN( rone, v_i(ji,jj,jl) - epsi03 ) ) 
                zindb   =  MAX( rzero, SIGN( rone, v_i(ji,jj,jl) ) ) 
@@ -839,5 +822,5 @@
       at_i(:,:) = a_i(:,:,1)
       DO jl = 2, jpl
-         at_i(:,:) = a_i(:,:,jl) + at_i(:,:)
+         at_i(:,:) = at_i(:,:) + a_i(:,:,jl)
       END DO
 
@@ -894,5 +877,5 @@
       at_i(:,:) = a_i(:,:,1)
       DO jl = 2, jpl
-         at_i(:,:) = a_i(:,:,jl) + at_i(:,:)
+         at_i(:,:) = at_i(:,:) + a_i(:,:,jl)
       END DO
 
@@ -902,4 +885,6 @@
       ! Ice drift
       !------------
+!!gm  BUG ? I don't understand this : it may have a wrong impact on the ice edge advection
+!!gm  and any way there is much faster way to code that...
       DO jj = 2, jpjm1
          DO ji = fs_2, fs_jpim1
@@ -913,4 +898,6 @@
       END DO
       !mask velocities
+!!gm BUG ?  here the mask are the one of the beginning of the time step, no? 
+!!gm        whereas at this level they should have been updated... To be checked 
       u_ice(:,:) = u_ice(:,:) * tmu(:,:)
       v_ice(:,:) = v_ice(:,:) * tmv(:,:)
@@ -1021,5 +1008,5 @@
          CALL prt_ctl(tab2d_1=fmmec  , clinfo1= ' lim_update : fmmec : ', tab2d_2=fhmec     , clinfo2= ' fhmec     : ')
          CALL prt_ctl(tab2d_1=sst_m  , clinfo1= ' lim_update : sst   : ', tab2d_2=sss_m     , clinfo2= ' sss       : ')
-         CALL prt_ctl(tab2d_1=fhbri  , clinfo1= ' lim_update : fhbri : ', tab2d_2=fheat_rpo , clinfo2= ' fheat_rpo : ')
+         CALL prt_ctl(tab2d_1=fhbri  , clinfo1= ' lim_update : fhbri : ', tab2d_2=fheat_mec , clinfo2= ' fheat_mec : ')
 
          CALL prt_ctl_info(' ')
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limvar.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limvar.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limvar.F90	(revision 3625)
@@ -43,14 +43,15 @@
    !!   lim_var_bv        :
    !!----------------------------------------------------------------------
-   USE par_oce          ! ocean parameters
-   USE phycst           ! physical constants (ocean directory) 
-   USE sbc_oce          ! Surface boundary condition: ocean fields
-   USE ice              ! LIM variables
-   USE par_ice          ! LIM parameters
-   USE dom_ice          ! LIM domain
-   USE thd_ice          ! LIM thermodynamics
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
-   USE wrk_nemo         ! work arrays
+   USE par_oce        ! ocean parameters
+   USE phycst         ! physical constants (ocean directory) 
+   USE sbc_oce        ! Surface boundary condition: ocean fields
+   USE ice            ! ice variables
+   USE par_ice        ! ice parameters
+   USE thd_ice        ! ice variables (thermodynamics)
+   USE dom_ice        ! ice domain
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -73,5 +74,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -182,5 +183,5 @@
       END DO
 
-      IF(  num_sal == 2  .OR.  num_sal == 4  )THEN
+      IF(  num_sal == 2  )THEN
          DO jl = 1, jpl
             DO jj = 1, jpj
@@ -309,11 +310,10 @@
       ! Vertically constant, constant in time
       !---------------------------------------
-      IF( num_sal == 1 )   s_i(:,:,:,:) = bulk_sal
+      IF(  num_sal == 1  )   s_i(:,:,:,:) = bulk_sal
 
       !-----------------------------------
       ! Salinity profile, varying in time
       !-----------------------------------
-
-      IF(   num_sal == 2  .OR.   num_sal == 4   ) THEN
+      IF(  num_sal == 2  ) THEN
          !
          DO jk = 1, nlay_i
@@ -331,5 +331,5 @@
          dummy_fac0 = 1._wp / ( s_i_0 - s_i_1 )       ! Weighting factor between zs_zero and zs_inf
          dummy_fac1 = s_i_1 / ( s_i_1 - s_i_0 )
-
+         !
          zalpha(:,:,:) = 0._wp
          DO jl = 1, jpl
@@ -347,5 +347,5 @@
             END DO
          END DO
-
+         !
          dummy_fac = 1._wp / nlay_i                   ! Computation of the profile
          DO jl = 1, jpl
@@ -361,5 +361,5 @@
             END DO ! jk
          END DO ! jl
-
+         !
       ENDIF ! num_sal
 
@@ -368,5 +368,5 @@
       !-------------------------------------------------------
 
-      IF( num_sal == 3 ) THEN      ! Schwarzacher (1959) multiyear salinity profile (mean = 2.30)
+      IF(  num_sal == 3  ) THEN      ! Schwarzacher (1959) multiyear salinity profile (mean = 2.30)
          !
          sm_i(:,:,:) = 2.30_wp
@@ -380,5 +380,5 @@
             END DO
          END DO
-
+         !
       ENDIF ! num_sal
       !
@@ -447,5 +447,5 @@
       !------------------------------------------------------
 
-      IF(  num_sal == 2  .OR.  num_sal == 4  ) THEN
+      IF(  num_sal == 2  ) THEN
          !
          DO ji = kideb, kiut          ! Slope of the linear profile zs_zero
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limwri.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limwri.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limwri.F90	(revision 3625)
@@ -25,4 +25,5 @@
    USE wrk_nemo        ! work arrays
    USE par_ice
+   USE lib_fortran     ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -51,5 +52,5 @@
    REAL(wp)  ::   zone   = 1._wp      
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -245,6 +246,6 @@
             zcmo(ji,jj,25) = et_i(ji,jj)
             zcmo(ji,jj,26) = et_s(ji,jj)
-            zcmo(ji,jj,28) = fsbri(ji,jj)
-            zcmo(ji,jj,29) = fseqv(ji,jj)
+            zcmo(ji,jj,28) = sfx_bri(ji,jj)
+            zcmo(ji,jj,29) = sfx_thd(ji,jj)
 
             zcmo(ji,jj,30) = bv_i(ji,jj)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limwri_dimg.h90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limwri_dimg.h90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/limwri_dimg.h90	(revision 3625)
@@ -111,5 +111,5 @@
          zcmo(ji,jj,13) = qns(ji,jj)
          ! See thersf for the coefficient
-         zcmo(ji,jj,14) = - emps(ji,jj) * rday * ( sss_m(ji,jj) + epsi16 ) / soce
+         zcmo(ji,jj,14) = - sfx (ji,jj) * rday      ! converted in Kg/m2/day = mm/day
          zcmo(ji,jj,15) = utau_ice(ji,jj)
          zcmo(ji,jj,16) = vtau_ice(ji,jj)
@@ -154,5 +154,5 @@
                rcmoy(ji,jj,13) = qns(ji,jj)
                ! See thersf for the coefficient
-               rcmoy(ji,jj,14) = - emps(ji,jj) * rday * ( sss_m(ji,jj) + epsi16 ) / soce
+               rcmoy(ji,jj,14) = - sfx (ji,jj) * rday      ! converted in mm/day
                rcmoy(ji,jj,15) = utau_ice(ji,jj)
                rcmoy(ji,jj,16) = vtau_ice(ji,jj)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/thd_ice.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/thd_ice.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/LIM_SRC_3/thd_ice.F90	(revision 3625)
@@ -8,5 +8,5 @@
    USE par_ice        ! LIM-3 parameters
    USE in_out_manager ! I/O manager
-   USE lib_mpp         ! MPP library
+   USE lib_mpp        ! MPP library
 
    IMPLICIT NONE
@@ -66,6 +66,6 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   at_i_b        !: <==> the 2D  frld
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   fbif_1d       !: <==> the 2D  fbif
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   rdmicif_1d    !: <==> the 2D  rdmicif
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   rdmsnif_1d    !: <==> the 2D  rdmsnif
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   rdm_ice_1d    !: <==> the 2D  rdm_ice
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   rdm_snw_1d    !: <==> the 2D  rdm_snw
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   qlbbq_1d      !: <==> the 2D  qlbsbq
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   dmgwi_1d      !: <==> the 2D  dmgwi
@@ -83,8 +83,8 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   i0            !: fraction of radiation transmitted to the ice
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   old_ht_i_b    !: Ice thickness at the beginnning of the time step [m]
-    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::  old_ht_s_b    !: Snow thickness at the beginning of the time step [m]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   fsbri_1d      !: Salt flux due to brine drainage
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   old_ht_s_b    !: Snow thickness at the beginning of the time step [m]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   sfx_bri_1d    !: <==> the 2D sfx_bri
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   fhbri_1d      !: Heat flux due to brine drainage
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   fseqv_1d      !: Equivalent Salt flux due to ice growth/decay
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   sfx_thd_1d    !: <==> the 2D sfx_thd
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   dsm_i_fl_1d   !: Ice salinity variations due to flushing
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   dsm_i_gd_1d   !: Ice salinity variations due to gravity drainage
@@ -138,5 +138,5 @@
 
    !!----------------------------------------------------------------------
-   !! NEMO/LIM3 4.0 , UCL - NEMO Consortium (2011)
+   !! NEMO/LIM3 3.4 , UCL - NEMO Consortium (2011)
    !! $Id$
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
@@ -160,5 +160,5 @@
       !
       ALLOCATE( sprecip_1d (jpij) , frld_1d    (jpij) , at_i_b     (jpij) ,     &
-         &      fbif_1d    (jpij) , rdmicif_1d (jpij) , rdmsnif_1d (jpij) ,     &
+         &      fbif_1d    (jpij) , rdm_ice_1d (jpij) , rdm_snw_1d (jpij) ,     &
          &      qlbbq_1d   (jpij) , dmgwi_1d   (jpij) , dvsbq_1d   (jpij) ,     &
          &      dvbbq_1d   (jpij) , dvlbq_1d   (jpij) , dvnbq_1d   (jpij) ,     &
@@ -166,5 +166,5 @@
          &      tatm_ice_1d(jpij) , fsup       (jpij) , focea      (jpij) ,     &   
          &      i0         (jpij) , old_ht_i_b (jpij) , old_ht_s_b (jpij) ,     &  
-         &      fsbri_1d   (jpij) , fhbri_1d   (jpij) , fseqv_1d   (jpij) ,     &
+         &      sfx_bri_1d (jpij) , fhbri_1d   (jpij) , sfx_thd_1d (jpij) ,     &
          &      dsm_i_fl_1d(jpij) , dsm_i_gd_1d(jpij) , dsm_i_se_1d(jpij) ,     &     
          &      dsm_i_si_1d(jpij) , hicol_b    (jpij)                     , STAT=ierr(2) )
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OFF_SRC/dtadyn.F90	(revision 3625)
@@ -52,5 +52,5 @@
    LOGICAL            ::   ln_degrad  = .false. !: degradation option enabled or not 
 
-   INTEGER  , PARAMETER ::   jpfld = 19     ! maximum number of files to read
+   INTEGER  , PARAMETER ::   jpfld = 20     ! maximum number of fields to read
    INTEGER  , SAVE      ::   jf_tem         ! index of temperature
    INTEGER  , SAVE      ::   jf_sal         ! index of salinity
@@ -72,4 +72,5 @@
    INTEGER  , SAVE      ::   jf_eiv         ! index of v-eiv
    INTEGER  , SAVE      ::   jf_eiw         ! index of w-eiv
+   INTEGER  , SAVE      ::   jf_sfx         ! index of downward salt flux
 
    TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_dyn  ! structure of input fields (file informations, fields read)
@@ -250,11 +251,12 @@
       un (:,:,:)       = sf_dyn(jf_uwd)%fnow(:,:,:) * umask(:,:,:)    ! u-velocity
       vn (:,:,:)       = sf_dyn(jf_vwd)%fnow(:,:,:) * vmask(:,:,:)    ! v-velocity 
-      IF( .NOT.ln_dynwzv ) &                                           ! w-velocity read in file 
+      IF( .NOT.ln_dynwzv ) &                                          ! w-velocity read in file 
          wn (:,:,:)    = sf_dyn(jf_wwd)%fnow(:,:,:) * tmask(:,:,:)    
       hmld(:,:)        = sf_dyn(jf_mld)%fnow(:,:,1) * tmask(:,:,1)    ! mixed layer depht
       wndm(:,:)        = sf_dyn(jf_wnd)%fnow(:,:,1) * tmask(:,:,1)    ! wind speed - needed for gas exchange
       emp (:,:)        = sf_dyn(jf_emp)%fnow(:,:,1) * tmask(:,:,1)    ! E-P
-      emps(:,:)        = emp(:,:) 
-      fr_i(:,:)        = sf_dyn(jf_ice)%fnow(:,:,1) * tmask(:,:,1)     ! Sea-ice fraction
+      sfx (:,:)        = 0.0_wp      ! enable testing with old inputs ! downward salt flux 
+!     sfx (:,:)        = sf_dyn(jf_sfx)%fnow(:,:,1) * tmask(:,:,1)    ! downward salt flux (v3.5+)
+      fr_i(:,:)        = sf_dyn(jf_ice)%fnow(:,:,1) * tmask(:,:,1)    ! Sea-ice fraction
       qsr (:,:)        = sf_dyn(jf_qsr)%fnow(:,:,1) * tmask(:,:,1)    ! solar radiation
 
@@ -302,5 +304,5 @@
          CALL prt_ctl(tab2d_1=fr_i             , clinfo1=' fr_i    - : ', mask1=tmask, ovlap=1 )
          CALL prt_ctl(tab2d_1=hmld             , clinfo1=' hmld    - : ', mask1=tmask, ovlap=1 )
-         CALL prt_ctl(tab2d_1=emps             , clinfo1=' emps    - : ', mask1=tmask, ovlap=1 )
+         CALL prt_ctl(tab2d_1=sfx              , clinfo1=' sfx     - : ', mask1=tmask, ovlap=1 )
          CALL prt_ctl(tab2d_1=wndm             , clinfo1=' wspd    - : ', mask1=tmask, ovlap=1 )
          CALL prt_ctl(tab2d_1=qsr              , clinfo1=' qsr     - : ', mask1=tmask, ovlap=1 )
@@ -330,10 +332,10 @@
       TYPE(FLD_N) :: sn_tem, sn_sal, sn_mld, sn_emp, sn_ice, sn_qsr, sn_wnd  ! informations about the fields to be read
       TYPE(FLD_N) :: sn_uwd, sn_vwd, sn_wwd, sn_avt, sn_ubl, sn_vbl          !   "                                 "
-      TYPE(FLD_N) :: sn_ahu, sn_ahv, sn_ahw, sn_eiu, sn_eiv, sn_eiw          !   "                                 "
+      TYPE(FLD_N) :: sn_ahu, sn_ahv, sn_ahw, sn_eiu, sn_eiv, sn_eiw, sn_sfx  !   "                                 "
       !
       NAMELIST/namdta_dyn/cn_dir, ln_dynwzv, ln_dynbbl, ln_degrad,    &
          &                sn_tem, sn_sal, sn_mld, sn_emp, sn_ice, sn_qsr, sn_wnd,  &
          &                sn_uwd, sn_vwd, sn_wwd, sn_avt, sn_ubl, sn_vbl,          &
-         &                sn_ahu, sn_ahv, sn_ahw, sn_eiu, sn_eiv, sn_eiw
+         &                sn_ahu, sn_ahv, sn_ahw, sn_eiu, sn_eiv, sn_eiw, sn_sfx
 
       !!----------------------------------------------------------------------
@@ -348,4 +350,6 @@
       sn_mld  = FLD_N( 'dyna_grid_T' ,    120    , 'somixght' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
       sn_emp  = FLD_N( 'dyna_grid_T' ,    120    , 'sowaflcd' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
+!!    sn_emp  = FLD_N( 'dyna_grid_T' ,    120    , 'sowaflup' ,  .true.    , .true. ,   'yearly'  , ''       , ''         ) ! v3.5+
+      sn_sfx  = FLD_N( 'dyna_grid_T' ,    120    , 'sosfldow' ,  .true.    , .true. ,   'yearly'  , ''       , ''         ) ! v3.5+
       sn_ice  = FLD_N( 'dyna_grid_T' ,    120    , 'soicecov' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
       sn_qsr  = FLD_N( 'dyna_grid_T' ,    120    , 'soshfldo' ,  .true.    , .true. ,   'yearly'  , ''       , ''         )
@@ -426,4 +430,7 @@
         ENDIF
       ENDIF
+      ! Salt flux and concntration/dilution terms (new from v3.5) !! disabled to allow testing with old input files
+!!    jf_sfx = jfld + 1    ;    jfld = jfld + 1
+!!    slf_d(jf_sfx) = sn_sfx
   
       ALLOCATE( sf_dyn(jfld), STAT=ierr )         ! set sf structure
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ASM/asmtrj.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ASM/asmtrj.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ASM/asmtrj.F90	(revision 3625)
@@ -213,5 +213,5 @@
          !                                   ! Output trajectory fields
          CALL iom_rstput( it, it, inum, 'emp'   , emp    )
-         CALL iom_rstput( it, it, inum, 'emps'  , emps   )
+         CALL iom_rstput( it, it, inum, 'sfx'   , sfx    )
          CALL iom_rstput( it, it, inum, 'un'    , un     )
          CALL iom_rstput( it, it, inum, 'vn'    , vn     )
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90	(revision 3625)
@@ -83,7 +83,7 @@
       z_frc_trd_s =           SUM( sbc_tsc(:,:,jp_sal) * surf(:,:) )     ! salt fluxes
       ! Add penetrative solar radiation
-      IF( ln_traqsr )   z_frc_trd_t = z_frc_trd_t + ro0cpr * SUM( qsr     (:,:) * surf(:,:) )
+      IF( ln_traqsr )   z_frc_trd_t = z_frc_trd_t + r1_rau0_rcp * SUM( qsr     (:,:) * surf(:,:) )
       ! Add geothermal heat flux
-      IF( ln_trabbc )   z_frc_trd_t = z_frc_trd_t + ro0cpr * SUM( qgh_trd0(:,:) * surf(:,:) )
+      IF( ln_trabbc )   z_frc_trd_t = z_frc_trd_t + r1_rau0_rcp * SUM( qgh_trd0(:,:) * surf(:,:) )
       IF( lk_mpp ) THEN
          CALL mpp_sum( z_frc_trd_v )
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DIA/diawri.F90	(revision 3625)
@@ -400,21 +400,16 @@
          CALL histdef( nid_T, "sossheig", "Sea Surface Height"                 , "m"      ,   &  ! ssh
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-!!$#if defined key_lim3 || defined key_lim2 
-!!$         ! sowaflup = sowaflep + sorunoff + sowafldp + a term associated to
-!!$         !    internal damping to Levitus that can be diagnosed from others
-!!$         ! sowaflcd = sowaflep + sorunoff + sowafldp + iowaflup
-!!$         CALL histdef( nid_T, "iowaflup", "Ice=>ocean net freshwater"          , "kg/m2/s",   &  ! fsalt
-!!$            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-!!$         CALL histdef( nid_T, "sowaflep", "atmos=>ocean net freshwater"        , "kg/m2/s",   &  ! fmass
-!!$            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-!!$#endif
          CALL histdef( nid_T, "sowaflup", "Net Upward Water Flux"              , "Kg/m2/s",   &  ! (emp-rnf)
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-!!$         CALL histdef( nid_T, "sorunoff", "Runoffs"                            , "Kg/m2/s",   &  ! runoffs
-!!$            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-         CALL histdef( nid_T, "sowaflcd", "concentration/dilution water flux"  , "kg/m2/s",   &  ! (emps-rnf)
-            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
-         CALL histdef( nid_T, "sosalflx", "Surface Salt Flux"                  , "Kg/m2/s",   &  ! (emps-rnf) * sn
-            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
+         CALL histdef( nid_T, "sosfldow", "downward salt flux"                 , "PSU/m2/s",  &  ! sfx
+            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
+#if ! defined key_vvl
+         CALL histdef( nid_T, "sosst_cd", "Concentration/Dilution term on temperature"        &  ! emp * tsn(:,:,1,jp_tem)
+            &                                                                  , "KgC/m2/s",  &  ! sosst_cd
+            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
+         CALL histdef( nid_T, "sosss_cd", "Concentration/Dilution term on salinity"           &  ! emp * tsn(:,:,1,jp_sal)
+            &                                                                  , "KgPSU/m2/s",&  ! sosss_cd
+            &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
+#endif
          CALL histdef( nid_T, "sohefldo", "Net Downward Heat Flux"             , "W/m2"   ,   &  ! qns + qsr
             &          jpi, jpj, nh_T, 1  , 1, 1  , -99 , 32, clop, zsto, zout )
@@ -602,13 +597,14 @@
       CALL histwrite( nid_T, "sosaline", it, tsn(:,:,1,jp_sal), ndim_hT, ndex_hT )   ! sea surface salinity
       CALL histwrite( nid_T, "sossheig", it, sshn          , ndim_hT, ndex_hT )   ! sea surface height
-!!$#if  defined key_lim3 || defined key_lim2 
-!!$      CALL histwrite( nid_T, "iowaflup", it, fsalt(:,:)    , ndim_hT, ndex_hT )   ! ice=>ocean water flux
-!!$      CALL histwrite( nid_T, "sowaflep", it, fmass(:,:)    , ndim_hT, ndex_hT )   ! atmos=>ocean water flux
-!!$#endif
       CALL histwrite( nid_T, "sowaflup", it, ( emp-rnf )   , ndim_hT, ndex_hT )   ! upward water flux
-!!$      CALL histwrite( nid_T, "sorunoff", it, runoff        , ndim_hT, ndex_hT )   ! runoff
-      CALL histwrite( nid_T, "sowaflcd", it, ( emps-rnf )  , ndim_hT, ndex_hT )   ! c/d water flux
-      zw2d(:,:) = ( emps(:,:) - rnf(:,:) ) * tsn(:,:,1,jp_sal) * tmask(:,:,1)
-      CALL histwrite( nid_T, "sosalflx", it, zw2d          , ndim_hT, ndex_hT )   ! c/d salt flux
+      CALL histwrite( nid_T, "sosfldow", it, sfx           , ndim_hT, ndex_hT )   ! downward salt flux 
+                                                                                  ! (includes virtual salt flux beneath ice 
+                                                                                  ! in linear free surface case)
+#if ! defined key_vvl
+      zw2d(:,:) = emp (:,:) * tsn(:,:,1,jp_tem)
+      CALL histwrite( nid_T, "sosst_cd", it, zw2d, ndim_hT, ndex_hT )             ! c/d term on sst
+      zw2d(:,:) = emp (:,:) * tsn(:,:,1,jp_sal)
+      CALL histwrite( nid_T, "sosss_cd", it, zw2d, ndim_hT, ndex_hT )             ! c/d term on sss
+#endif
       CALL histwrite( nid_T, "sohefldo", it, qns + qsr     , ndim_hT, ndex_hT )   ! total heat flux
       CALL histwrite( nid_T, "soshfldo", it, qsr           , ndim_hT, ndex_hT )   ! solar heat flux
@@ -782,5 +778,5 @@
       !!----------------------------------------------------------------------
       ! 
-      IF( nn_timing == 1 )   CALL timing_start('dia_wri_state')
+!     IF( nn_timing == 1 )   CALL timing_start('dia_wri_state') ! not sure this works for routines not called in first timestep
 
       ! 0. Initialisation
@@ -879,5 +875,5 @@
 #endif
        
-      IF( nn_timing == 1 )   CALL timing_stop('dia_wri_state')
+!     IF( nn_timing == 1 )   CALL timing_stop('dia_wri_state') ! not sure this works for routines not called in first timestep
       ! 
 
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DIA/diawri_dimg.h90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DIA/diawri_dimg.h90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DIA/diawri_dimg.h90	(revision 3625)
@@ -54,5 +54,6 @@
     !!  level 14: qct(:,:)                 equivalent flux due to treshold SST
     !!  level 15: fbt(:,:)                 feedback term .
-    !!  level 16: ( emps(:,:) - rnf(:,:) ) concentration/dilution water flux
+    !!  level 16: ( emp * sss )            concentration/dilution term on salinity
+    !!  level 17: ( emp * sst )            concentration/dilution term on temperature
     !!  level 17: fsalt(:,:)               Ice=>ocean net freshwater
     !!  level 18: gps(:,:)                 the surface pressure (m).
@@ -107,5 +108,5 @@
 
 
-    inbsel = 17
+    inbsel = 18
 
     IF( inbsel >  jpk ) THEN
@@ -172,5 +173,6 @@
        !        fsel(:,:,14) = fsel(:,:,14) + qct(:,:)
        !        fsel(:,:,15) = fsel(:,:,15) + fbt(:,:)
-       fsel(:,:,16) = fsel(:,:,16) + ( emps(:,:)-rnf(:,:) ) 
+       fsel(:,:,16) = fsel(:,:,16) + ( emp(:,:)*tsn(:,:,1,jp_sal) ) 
+       fsel(:,:,17) = fsel(:,:,17) + ( emp(:,:)*tsn(:,:,1,jp_tem) ) 
        !
        ! Output of dynamics and tracer fields and selected fields
@@ -240,5 +242,6 @@
           !         fsel(:,:,14) =  qct(:,:)
           !         fsel(:,:,15) =  fbt(:,:)
-          fsel(:,:,16) = ( emps(:,:)-rnf(:,:) ) * tmask(:,:,1) 
+          fsel(:,:,16) = ( emp(:,:)-tsn(:,:,1,jp_sal) ) * tmask(:,:,1) 
+          fsel(:,:,17) = ( emp(:,:)-tsn(:,:,1,jp_tem) ) * tmask(:,:,1) 
           !
           !         qct(:,:) = 0._wp
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DOM/closea.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DOM/closea.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DOM/closea.F90	(revision 3625)
@@ -18,4 +18,5 @@
    USE oce             ! dynamics and tracers
    USE dom_oce         ! ocean space and time domain
+   USE phycst
    USE in_out_manager  ! I/O manager
    USE sbc_oce         ! ocean surface boundary conditions
@@ -173,10 +174,10 @@
       !!      put as run-off in open ocean.
       !!
-      !! ** Action  :   emp, emps   updated surface freshwater fluxes at kt
+      !! ** Action  :   emp   updated surface freshwater flux at kt
       !!----------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt   ! ocean model time step
       !
       INTEGER                     ::   ji, jj, jc, jn   ! dummy loop indices
-      REAL(wp)                    ::   zze2
+      REAL(wp)                    ::   zze2, zcoef, zcoef1
       REAL(wp), DIMENSION (jpncs) ::   zfwf 
       !!----------------------------------------------------------------------
@@ -214,5 +215,5 @@
       ENDIF
       !                                                   !--------------------!
-      !                                                   !  update emp, emps  !
+      !                                                   !  update emp        !
       zfwf = 0.e0                                         !--------------------!
       DO jc = 1, jpncs
@@ -235,6 +236,8 @@
          IF( ncstt(jc) == 0 ) THEN 
             ! water/evap excess is shared by all open ocean
-            emp (:,:) = emp (:,:) + zfwf(jc) / surf(jpncs+1)
-            emps(:,:) = emps(:,:) + zfwf(jc) / surf(jpncs+1)
+            zcoef  = zfwf(jc) / surf(jpncs+1)
+            zcoef1 = rcp * zcoef
+            emp(:,:) = emp(:,:) + zcoef
+            qns(:,:) = qns(:,:) - zcoef1 * sst_m(:,:)
          ELSEIF( ncstt(jc) == 1 ) THEN 
             ! Excess water in open sea, at outflow location, excess evap shared
@@ -245,13 +248,15 @@
                   IF (      ji > 1 .AND. ji < jpi   &
                       .AND. jj > 1 .AND. jj < jpj ) THEN 
-                      emp (ji,jj) = emp (ji,jj) + zfwf(jc) /   &
-                         (FLOAT(ncsnr(jc)) * e1t(ji,jj) * e2t(ji,jj))
-                      emps(ji,jj) = emps(ji,jj) + zfwf(jc) /   &
-                          (FLOAT(ncsnr(jc)) * e1t(ji,jj) * e2t(ji,jj))
+                      zcoef  = zfwf(jc) / ( REAL(ncsnr(jc), wp) * e1t(ji,jj) * e2t(ji,jj) )
+                      zcoef1 = rcp * zcoef
+                      emp(ji,jj) = emp(ji,jj) + zcoef
+                      qns(ji,jj) = qns(ji,jj) - zcoef1 * sst_m(ji,jj)
                   END IF 
                 END DO 
             ELSE 
-                emp (:,:) = emp (:,:) + zfwf(jc) / surf(jpncs+1)
-                emps(:,:) = emps(:,:) + zfwf(jc) / surf(jpncs+1)
+                zcoef  = zfwf(jc) / surf(jpncs+1)
+                zcoef1 = rcp * zcoef
+                emp(:,:) = emp(:,:) + zcoef
+                qns(:,:) = qns(:,:) - zcoef1 * sst_m(:,:)
             ENDIF
          ELSEIF( ncstt(jc) == 2 ) THEN 
@@ -262,8 +267,8 @@
                   ji = mi0(ncsir(jc,jn))
                   jj = mj0(ncsjr(jc,jn)) ! Location of outflow in open ocean
-                  emp (ji,jj) = emp (ji,jj) + zfwf(jc)   &
-                      / (FLOAT(ncsnr(jc)) *  e1t(ji,jj) * e2t(ji,jj) )
-                  emps(ji,jj) = emps(ji,jj) + zfwf(jc)   &
-                      / (FLOAT(ncsnr(jc)) *  e1t(ji,jj) * e2t(ji,jj) )
+                  zcoef  = zfwf(jc) / ( REAL(ncsnr(jc), wp) * e1t(ji,jj) * e2t(ji,jj) )
+                  zcoef1 = rcp * zcoef
+                  emp(ji,jj) = emp(ji,jj) + zcoef
+                  qns(ji,jj) = qns(ji,jj) - zcoef1 * sst_m(ji,jj)
                 END DO 
             ENDIF 
@@ -272,6 +277,8 @@
          DO jj = ncsj1(jc), ncsj2(jc)
             DO ji = ncsi1(jc), ncsi2(jc)
-               emp (ji,jj) = emp (ji,jj) - zfwf(jc) / surf(jc)
-               emps(ji,jj) = emps(ji,jj) - zfwf(jc) / surf(jc)
+               zcoef  = zfwf(jc) / surf(jc)
+               zcoef1 = rcp * zcoef
+               emp(ji,jj) = emp(ji,jj) - zcoef
+               qns(ji,jj) = qns(ji,jj) + zcoef1 * sst_m(ji,jj)
             END DO  
          END DO 
@@ -280,5 +287,4 @@
       !
       CALL lbc_lnk( emp , 'T', 1. )
-      CALL lbc_lnk( emps, 'T', 1. )
       !
    END SUBROUTINE sbc_clo
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DOM/phycst.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DOM/phycst.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DOM/phycst.F90	(revision 3625)
@@ -27,62 +27,65 @@
    REAL(wp), PUBLIC ::   rsmall = 0.5 * EPSILON( 1.e0 )         !: smallest real computer value
    
-   REAL(wp), PUBLIC ::   rday = 24.*60.*60.       !: day (s)
-   REAL(wp), PUBLIC ::   rsiyea                   !: sideral year (s)
-   REAL(wp), PUBLIC ::   rsiday                   !: sideral day (s)
-   REAL(wp), PUBLIC ::   raamo =  12._wp          !: number of months in one year
-   REAL(wp), PUBLIC ::   rjjhh =  24._wp          !: number of hours in one day
-   REAL(wp), PUBLIC ::   rhhmm =  60._wp          !: number of minutes in one hour
-   REAL(wp), PUBLIC ::   rmmss =  60._wp          !: number of seconds in one minute
-!! REAL(wp), PUBLIC ::   omega = 7.292115083046061e-5_wp ,  &  !: change the last digit!
-   REAL(wp), PUBLIC ::   omega                    !: earth rotation parameter
-   REAL(wp), PUBLIC ::   ra    = 6371229._wp      !: earth radius (meter)
-   REAL(wp), PUBLIC ::   grav  = 9.80665_wp       !: gravity (m/s2)
-   
-   REAL(wp), PUBLIC ::   rtt      = 273.16_wp     !: triple point of temperature (Kelvin)
-   REAL(wp), PUBLIC ::   rt0      = 273.15_wp     !: freezing point of water (Kelvin)
+   REAL(wp), PUBLIC ::   rday = 24.*60.*60.     !: day                                [s]
+   REAL(wp), PUBLIC ::   rsiyea                 !: sideral year                       [s]
+   REAL(wp), PUBLIC ::   rsiday                 !: sideral day                        [s]
+   REAL(wp), PUBLIC ::   raamo =  12._wp        !: number of months in one year
+   REAL(wp), PUBLIC ::   rjjhh =  24._wp        !: number of hours in one day
+   REAL(wp), PUBLIC ::   rhhmm =  60._wp        !: number of minutes in one hour
+   REAL(wp), PUBLIC ::   rmmss =  60._wp        !: number of seconds in one minute
+   REAL(wp), PUBLIC ::   omega                  !: earth rotation parameter           [s-1]
+   REAL(wp), PUBLIC ::   ra    = 6371229._wp    !: earth radius                       [m]
+   REAL(wp), PUBLIC ::   grav  = 9.80665_wp     !: gravity                            [m/s2]
+   
+   REAL(wp), PUBLIC ::   rtt      = 273.16_wp        !: triple point of temperature   [Kelvin]
+   REAL(wp), PUBLIC ::   rt0      = 273.15_wp        !: freezing point of fresh water [Kelvin]
 #if defined key_lim3
-   REAL(wp), PUBLIC ::   rt0_snow = 273.16_wp     !: melting point of snow  (Kelvin)
-   REAL(wp), PUBLIC ::   rt0_ice  = 273.16_wp     !: melting point of ice   (Kelvin)
-#else
-   REAL(wp), PUBLIC ::   rt0_snow = 273.15_wp     !: melting point of snow  (Kelvin)
-   REAL(wp), PUBLIC ::   rt0_ice  = 273.05_wp     !: melting point of ice   (Kelvin)
-#endif
-
+   REAL(wp), PUBLIC ::   rt0_snow = 273.16_wp        !: melting point of snow         [Kelvin]
+   REAL(wp), PUBLIC ::   rt0_ice  = 273.16_wp        !: melting point of ice          [Kelvin]
+#else
+   REAL(wp), PUBLIC ::   rt0_snow = 273.15_wp        !: melting point of snow         [Kelvin]
+   REAL(wp), PUBLIC ::   rt0_ice  = 273.05_wp        !: melting point of ice          [Kelvin]
+#endif
 #if defined key_cice
-   REAL(wp), PUBLIC ::   rau0     = 1026._wp      !: reference volumic mass (density)  (kg/m3)
-#else
-   REAL(wp), PUBLIC ::   rau0     = 1035._wp      !: reference volumic mass (density)  (kg/m3)
-#endif
-   REAL(wp), PUBLIC ::   rau0r                    !: reference specific volume         (m3/kg)
-   REAL(wp), PUBLIC ::   rcp      =    4.e+3_wp   !: ocean specific heat
-   REAL(wp), PUBLIC ::   ro0cpr                   !: = 1. / ( rau0 * rcp )
+   REAL(wp), PUBLIC ::   rau0     = 1026._wp         !: volumic mass of reference     [kg/m3]
+#else
+   REAL(wp), PUBLIC ::   rau0     = 1035._wp         !: volumic mass of reference     [kg/m3]
+#endif
+   REAL(wp), PUBLIC ::   r1_rau0                     !: = 1. / rau0                   [m3/kg]
+   REAL(wp), PUBLIC ::   rauw     = 1000._wp         !: volumic mass of pure water    [m3/kg]
+   REAL(wp), PUBLIC ::   rcp      =    4.e3_wp       !: ocean specific heat           [J/Kelvin]
+   REAL(wp), PUBLIC ::   r1_rcp                      !: = 1. / rcp                    [Kelvin/J]
+   REAL(wp), PUBLIC ::   r1_rau0_rcp                 !: = 1. / ( rau0 * rcp )
+
+   REAL(wp), PUBLIC ::   rhosn    =  330._wp         !: volumic mass of snow          [kg/m3]
+   REAL(wp), PUBLIC ::   emic     =    0.97_wp       !: emissivity of snow or ice
+   REAL(wp), PUBLIC ::   sice     =    6.0_wp        !: salinity of ice               [psu]
+   REAL(wp), PUBLIC ::   soce     =   34.7_wp        !: salinity of sea               [psu]
+   REAL(wp), PUBLIC ::   cevap    =    2.5e+6_wp     !: latent heat of evaporation (water)
+   REAL(wp), PUBLIC ::   srgamma  =    0.9_wp        !: correction factor for solar radiation (Oberhuber, 1974)
+   REAL(wp), PUBLIC ::   vkarmn   =    0.4_wp        !: von Karman constant
+   REAL(wp), PUBLIC ::   stefan   =    5.67e-8_wp    !: Stefan-Boltzmann constant 
 
 #if defined key_lim3 || defined key_cice
-   REAL(wp), PUBLIC ::   rcdsn   =   0.31_wp      !: thermal conductivity of snow
-   REAL(wp), PUBLIC ::   rcdic   =   2.034396_wp  !: thermal conductivity of fresh ice
-   REAL(wp), PUBLIC ::   cpic    = 2067.0         !: specific heat of sea ice
-   REAL(wp), PUBLIC ::   lsub    = 2.834e+6       !: pure ice latent heat of sublimation (J.kg-1)
-   REAL(wp), PUBLIC ::   lfus    = 0.334e+6       !: latent heat of fusion of fresh ice   (J.kg-1)
-   REAL(wp), PUBLIC ::   rhoic   = 917._wp        !: volumic mass of sea ice (kg/m3)
-   REAL(wp), PUBLIC ::   tmut    =   0.054        !: decrease of seawater meltpoint with salinity
-#else
-   REAL(wp), PUBLIC ::   rcdsn   =   0.22_wp      !: conductivity of the snow
-   REAL(wp), PUBLIC ::   rcdic   =   2.034396_wp  !: conductivity of the ice
-   REAL(wp), PUBLIC ::   rcpsn   =   6.9069e+5_wp !: density times specific heat for snow
-   REAL(wp), PUBLIC ::   rcpic   =   1.8837e+6_wp !: volumetric latent heat fusion of sea ice
-   REAL(wp), PUBLIC ::   lfus    =   0.3337e+6    !: latent heat of fusion of fresh ice   (J.kg-1) 	
-   REAL(wp), PUBLIC ::   xlsn    = 110.121e+6_wp  !: volumetric latent heat fusion of snow
-   REAL(wp), PUBLIC ::   xlic    = 300.33e+6_wp   !: volumetric latent heat fusion of ice
-   REAL(wp), PUBLIC ::   xsn     =   2.8e+6       !: latent heat of sublimation of snow
-   REAL(wp), PUBLIC ::   rhoic   = 900._wp        !: volumic mass of sea ice (kg/m3)
-#endif
-   REAL(wp), PUBLIC ::   rhosn   = 330._wp        !: volumic mass of snow (kg/m3)
-   REAL(wp), PUBLIC ::   emic    =   0.97_wp      !: emissivity of snow or ice
-   REAL(wp), PUBLIC ::   sice    =   6.0_wp       !: reference salinity of ice (psu)
-   REAL(wp), PUBLIC ::   soce    =  34.7_wp       !: reference salinity of sea (psu)
-   REAL(wp), PUBLIC ::   cevap   =   2.5e+6_wp    !: latent heat of evaporation (water)
-   REAL(wp), PUBLIC ::   srgamma =   0.9_wp       !: correction factor for solar radiation (Oberhuber, 1974)
-   REAL(wp), PUBLIC ::   vkarmn  =   0.4_wp       !: von Karman constant
-   REAL(wp), PUBLIC ::   stefan  =   5.67e-8_wp   !: Stefan-Boltzmann constant 
+   REAL(wp), PUBLIC ::   rhoic    =  917._wp         !: volumic mass of sea ice                               [kg/m3]
+   REAL(wp), PUBLIC ::   rcdic    =    2.034396_wp   !: thermal conductivity of fresh ice
+   REAL(wp), PUBLIC ::   rcdsn    =    0.31_wp       !: thermal conductivity of snow
+   REAL(wp), PUBLIC ::   cpic     = 2067.0_wp        !: specific heat for ice 
+   REAL(wp), PUBLIC ::   lsub     =    2.834e+6_wp   !: pure ice latent heat of sublimation                   [J/kg]
+   REAL(wp), PUBLIC ::   lfus     =    0.334e+6_wp   !: latent heat of fusion of fresh ice                    [J/kg]
+   REAL(wp), PUBLIC ::   tmut     =    0.054_wp      !: decrease of seawater meltpoint with salinity
+   REAL(wp), PUBLIC ::   xlsn                        !: = lfus*rhosn (volumetric latent heat fusion of snow)  [J/m3]
+#else
+   REAL(wp), PUBLIC ::   rhoic    =  900._wp         !: volumic mass of sea ice                               [kg/m3]
+   REAL(wp), PUBLIC ::   rcdic    =    2.034396_wp   !: conductivity of the ice                               [W/m/K]
+   REAL(wp), PUBLIC ::   rcpic    =    1.8837e+6_wp  !: volumetric specific heat for ice                      [J/m3/K]
+   REAL(wp), PUBLIC ::   cpic                        !: = rcpic / rhoic  (specific heat for ice)              [J/Kg/K]
+   REAL(wp), PUBLIC ::   rcdsn    =    0.22_wp       !: conductivity of the snow                              [W/m/K]
+   REAL(wp), PUBLIC ::   rcpsn    =    6.9069e+5_wp  !: volumetric specific heat for snow                     [J/m3/K]
+   REAL(wp), PUBLIC ::   xlsn     =  110.121e+6_wp   !: volumetric latent heat fusion of snow                 [J/m3]
+   REAL(wp), PUBLIC ::   lfus                        !: = xlsn / rhosn   (latent heat of fusion of fresh ice) [J/Kg]
+   REAL(wp), PUBLIC ::   xlic     =  300.33e+6_wp    !: volumetric latent heat fusion of ice                  [J/m3]
+   REAL(wp), PUBLIC ::   xsn      =    2.8e+6_wp     !: volumetric latent heat of sublimation of snow         [J/m3]
+#endif
    !!----------------------------------------------------------------------
    !! NEMO/OPA 3.3 , NEMO Consortium (2010)
@@ -102,21 +105,11 @@
       !!----------------------------------------------------------------------
 
-      !                                   ! Define additional parameters
-      rsiyea = 365.25 * rday * 2. * rpi / 6.283076
-      rsiday = rday / ( 1. + rday / rsiyea )
-#if defined key_cice
-      omega =  7.292116e-05
-#else
-      omega  = 2. * rpi / rsiday 
-#endif
-
-      rau0r  = 1. /   rau0  
-      ro0cpr = 1. / ( rau0 * rcp )
-
-
-      IF(lwp) THEN                        ! control print
-         WRITE(numout,*)
-         WRITE(numout,*) ' phy_cst : initialization of ocean parameters and constants'
-         WRITE(numout,*) ' ~~~~~~~'
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) ' phy_cst : initialization of ocean parameters and constants'
+      IF(lwp) WRITE(numout,*) ' ~~~~~~~'
+
+      ! Ocean Parameters
+      ! ----------------
+      IF(lwp) THEN
          WRITE(numout,*) '       Domain info'
          WRITE(numout,*) '          dimension of model'
@@ -131,46 +124,76 @@
          WRITE(numout,*) '             jpnij   : ', jpnij
          WRITE(numout,*) '          lateral domain boundary condition type : jperio  = ', jperio
-         WRITE(numout,*)
-         WRITE(numout,*) '       Constants'
-         WRITE(numout,*)
-         WRITE(numout,*) '          mathematical constant                 rpi = ', rpi
-         WRITE(numout,*) '          day                                rday   = ', rday,   ' s'
-         WRITE(numout,*) '          sideral year                       rsiyea = ', rsiyea, ' s'
-         WRITE(numout,*) '          sideral day                        rsiday = ', rsiday, ' s'
-         WRITE(numout,*) '          omega                              omega  = ', omega,  ' s-1'
-         WRITE(numout,*)
-         WRITE(numout,*) '          nb of months per year               raamo = ', raamo, ' months'
-         WRITE(numout,*) '          nb of hours per day                 rjjhh = ', rjjhh, ' hours'
-         WRITE(numout,*) '          nb of minutes per hour              rhhmm = ', rhhmm, ' mn'
-         WRITE(numout,*) '          nb of seconds per minute            rmmss = ', rmmss, ' s'
-         WRITE(numout,*)
-         WRITE(numout,*) '          earth radius                         ra   = ', ra, ' m'
-         WRITE(numout,*) '          gravity                              grav = ', grav , ' m/s^2'
-         WRITE(numout,*)
-         WRITE(numout,*) '          triple point of temperature      rtt      = ', rtt     , ' K'
-         WRITE(numout,*) '          freezing point of water          rt0      = ', rt0     , ' K'
-         WRITE(numout,*) '          melting point of snow            rt0_snow = ', rt0_snow, ' K'
-         WRITE(numout,*) '          melting point of ice             rt0_ice  = ', rt0_ice , ' K'
-         WRITE(numout,*)
-         WRITE(numout,*) '          ocean reference volumic mass       rau0   = ', rau0 , ' kg/m^3'
-         WRITE(numout,*) '          ocean reference specific volume    rau0r  = ', rau0r, ' m^3/Kg'
-         WRITE(numout,*) '          ocean specific heat                rcp    = ', rcp
-         WRITE(numout,*) '                       1. / ( rau0 * rcp ) = ro0cpr = ', ro0cpr
+      ENDIF
+
+      ! Define constants
+      ! ----------------
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '       Constants'
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '          mathematical constant                 rpi = ', rpi
+
+      rsiyea = 365.25_wp * rday * 2._wp * rpi / 6.283076_wp
+      rsiday = rday / ( 1._wp + rday / rsiyea )
+#if defined key_cice
+      omega  = 7.292116e-05
+#else
+      omega  = 2._wp * rpi / rsiday 
+#endif
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '          day                                rday   = ', rday,   ' s'
+      IF(lwp) WRITE(numout,*) '          sideral year                       rsiyea = ', rsiyea, ' s'
+      IF(lwp) WRITE(numout,*) '          sideral day                        rsiday = ', rsiday, ' s'
+      IF(lwp) WRITE(numout,*) '          omega                              omega  = ', omega,  ' s^-1'
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '          nb of months per year               raamo = ', raamo, ' months'
+      IF(lwp) WRITE(numout,*) '          nb of hours per day                 rjjhh = ', rjjhh, ' hours'
+      IF(lwp) WRITE(numout,*) '          nb of minutes per hour              rhhmm = ', rhhmm, ' mn'
+      IF(lwp) WRITE(numout,*) '          nb of seconds per minute            rmmss = ', rmmss, ' s'
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '          earth radius                         ra   = ', ra, ' m'
+      IF(lwp) WRITE(numout,*) '          gravity                              grav = ', grav , ' m/s^2'
+
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '          triple point of temperature      rtt      = ', rtt     , ' K'
+      IF(lwp) WRITE(numout,*) '          freezing point of water          rt0      = ', rt0     , ' K'
+      IF(lwp) WRITE(numout,*) '          melting point of snow            rt0_snow = ', rt0_snow, ' K'
+      IF(lwp) WRITE(numout,*) '          melting point of ice             rt0_ice  = ', rt0_ice , ' K'
+
+      r1_rau0     = 1._wp / rau0
+      r1_rcp      = 1._wp / rcp
+      r1_rau0_rcp = 1._wp / ( rau0 * rcp )
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '          volumic mass of pure water          rauw  = ', rauw   , ' kg/m^3'
+      IF(lwp) WRITE(numout,*) '          volumic mass of reference           rau0  = ', rau0   , ' kg/m^3'
+      IF(lwp) WRITE(numout,*) '          1. / rau0                        r1_rau0  = ', r1_rau0, ' m^3/kg'
+      IF(lwp) WRITE(numout,*) '          ocean specific heat                 rcp   = ', rcp    , ' J/Kelvin'
+      IF(lwp) WRITE(numout,*) '          1. / ( rau0 * rcp )           r1_rau0_rcp = ', r1_rau0_rcp
+
+
+#if defined key_lim3 || defined key_cice
+      xlsn = lfus * rhosn        ! volumetric latent heat fusion of snow [J/m3]
+#else
+      cpic = rcpic / rhoic       ! specific heat for ice   [J/Kg/K]
+      lfus = xlsn / rhosn        ! latent heat of fusion of fresh ice
+#endif
+
+      IF(lwp) THEN
          WRITE(numout,*)
          WRITE(numout,*) '          thermal conductivity of the snow          = ', rcdsn   , ' J/s/m/K'
          WRITE(numout,*) '          thermal conductivity of the ice           = ', rcdic   , ' J/s/m/K'
-#if defined key_lim3
          WRITE(numout,*) '          fresh ice specific heat                   = ', cpic    , ' J/kg/K'
          WRITE(numout,*) '          latent heat of fusion of fresh ice / snow = ', lfus    , ' J/kg'
+#if defined key_lim3 || defined key_cice
          WRITE(numout,*) '          latent heat of subl.  of fresh ice / snow = ', lsub    , ' J/kg'
-#elif defined key_cice
-         WRITE(numout,*) '          latent heat of fusion of fresh ice / snow = ', lfus    , ' J/kg'
 #else
          WRITE(numout,*) '          density times specific heat for snow      = ', rcpsn   , ' J/m^3/K' 
          WRITE(numout,*) '          density times specific heat for ice       = ', rcpic   , ' J/m^3/K'
          WRITE(numout,*) '          volumetric latent heat fusion of sea ice  = ', xlic    , ' J/m' 
-         WRITE(numout,*) '          volumetric latent heat fusion of snow     = ', xlsn    , ' J/m' 
          WRITE(numout,*) '          latent heat of sublimation of snow        = ', xsn     , ' J/kg' 
 #endif
+         WRITE(numout,*) '          volumetric latent heat fusion of snow     = ', xlsn    , ' J/m^3' 
          WRITE(numout,*) '          density of sea ice                        = ', rhoic   , ' kg/m^3'
          WRITE(numout,*) '          density of snow                           = ', rhosn   , ' kg/m^3'
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg.F90	(revision 3625)
@@ -81,6 +81,7 @@
       !
       INTEGER  ::   ji, jj, jk                             ! dummy loop indices
-      REAL(wp) ::   z2dt, zg_2                             ! temporary scalar
+      REAL(wp) ::   z2dt, zg_2, zintp, zgrau0r             ! temporary scalar
       REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrdu, ztrdv
+      REAL(wp), POINTER, DIMENSION(:,:)   ::  zpice
       !!----------------------------------------------------------------------
       !
@@ -117,4 +118,28 @@
             END DO
          END DO
+      ENDIF
+
+      IF( nn_ice_embd == 2 ) THEN             !== embedded sea ice: Pressure gradient due to snow-ice mass ==!
+         CALL wrk_alloc( jpi, jpj, zpice )
+         !                                            
+         zintp = REAL( MOD( kt-1, nn_fsbc ) ) / REAL( nn_fsbc )
+         zgrau0r     = - grav * r1_rau0
+         zpice(:,:) = (  zintp * snwice_mass(:,:) + ( 1.- zintp ) * snwice_mass_b(:,:)  ) * zgrau0r
+         DO jj = 2, jpjm1
+            DO ji = fs_2, fs_jpim1   ! vector opt.
+               spgu(ji,jj) = ( zpice(ji+1,jj) - zpice(ji,jj) ) / e1u(ji,jj)
+               spgv(ji,jj) = ( zpice(ji,jj+1) - zpice(ji,jj) ) / e2v(ji,jj)
+            END DO
+         END DO
+         DO jk = 1, jpkm1                             ! Add the surface pressure trend to the general trend
+            DO jj = 2, jpjm1
+               DO ji = fs_2, fs_jpim1   ! vector opt.
+                  ua(ji,jj,jk) = ua(ji,jj,jk) + spgu(ji,jj)
+                  va(ji,jj,jk) = va(ji,jj,jk) + spgv(ji,jj)
+               END DO
+            END DO
+         END DO
+         !
+         CALL wrk_dealloc( jpi, jpj, zpice )
       ENDIF
 
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_exp.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_exp.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_exp.F90	(revision 3625)
@@ -61,5 +61,5 @@
       !
       INTEGER  ::   ji, jj, jk, jl   ! dummy loop indices
-      REAL(wp) ::   zrau0r, zlavmr, zua, zva   ! local scalars
+      REAL(wp) ::   zlavmr, zua, zva   ! local scalars
       REAL(wp), POINTER, DIMENSION(:,:,:) ::  zwx, zwy, zwz, zww
       !!----------------------------------------------------------------------
@@ -75,5 +75,4 @@
       ENDIF
 
-      zrau0r = 1. / rau0               ! Local constant initialization
       zlavmr = 1. / REAL( nn_zdfexp )
 
@@ -81,6 +80,6 @@
       DO jj = 2, jpjm1                 ! Surface boundary condition
          DO ji = 2, jpim1
-            zwy(ji,jj,1) = ( utau_b(ji,jj) + utau(ji,jj) ) * zrau0r
-            zww(ji,jj,1) = ( vtau_b(ji,jj) + vtau(ji,jj) ) * zrau0r
+            zwy(ji,jj,1) = ( utau_b(ji,jj) + utau(ji,jj) ) * r1_rau0
+            zww(ji,jj,1) = ( vtau_b(ji,jj) + vtau(ji,jj) ) * r1_rau0
          END DO  
       END DO  
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_imp.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_imp.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_imp.F90	(revision 3625)
@@ -161,5 +161,5 @@
          DO ji = fs_2, fs_jpim1   ! vector opt.
             ua(ji,jj,1) = ub(ji,jj,1) + p2dt * (  ua(ji,jj,1) + 0.5_wp * ( utau_b(ji,jj) + utau(ji,jj) )   &
-               &                                                       / ( fse3u(ji,jj,1) * rau0       )  )
+               &                                                       * r1_rau0 / fse3u(ji,jj,1)       )
          END DO
       END DO
@@ -247,5 +247,5 @@
          DO ji = fs_2, fs_jpim1   ! vector opt.
             va(ji,jj,1) = vb(ji,jj,1) + p2dt * (  va(ji,jj,1) + 0.5_wp * ( vtau_b(ji,jj) + vtau(ji,jj) )   &
-               &                                                       / ( fse3v(ji,jj,1) * rau0       )  )
+               &                                                       * r1_rau0 / fse3v(ji,jj,1)       )
          END DO
       END DO
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/IOM/prtctl.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/IOM/prtctl.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/IOM/prtctl.F90	(revision 3625)
@@ -8,4 +8,7 @@
    !!----------------------------------------------------------------------
    USE dom_oce          ! ocean space and time domain variables
+#if defined key_nemocice_decomp
+   USE ice_domain_size, only: nx_global, ny_global
+#endif
    USE in_out_manager   ! I/O manager
    USE lib_mpp          ! distributed memory computing
@@ -431,8 +434,9 @@
       !  array (cf. par_oce.F90).
 
+#if defined key_nemocice_decomp
+      ijpi = ( nx_global+2-2*jpreci + (isplt-1) ) / isplt + 2*jpreci
+      ijpj = ( ny_global+2-2*jprecj + (jsplt-1) ) / jsplt + 2*jprecj 
+#else
       ijpi = ( jpiglo-2*jpreci + (isplt-1) ) / isplt + 2*jpreci
-#if defined key_nemocice_decomp
-      ijpj = ( jpjglo+1-2*jprecj + (jsplt-1) ) / jsplt + 2*jprecj 
-#else
       ijpj = ( jpjglo-2*jprecj + (jsplt-1) ) / jsplt + 2*jprecj
 #endif
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 3625)
@@ -120,5 +120,6 @@
 
    ! variables used in case of sea-ice
-   INTEGER, PUBLIC ::   ncomm_ice       !: communicator made by the processors with sea-ice
+   INTEGER, PUBLIC ::   ncomm_ice       !: communicator made by the processors with sea-ice (public so that it can be freed in limthd)
+   INTEGER ::   ngrp_iworld     !  group ID for the world processors (for rheology)
    INTEGER ::   ngrp_ice        !  group ID for the ice processors (for rheology)
    INTEGER ::   ndim_rank_ice   !  number of 'ice' processors
@@ -1978,5 +1979,5 @@
       !!      ndim_rank_ice = number of processors with ice
       !!      nrank_ice (ndim_rank_ice) = ice processors
-      !!      ngrp_world = group ID for the world processors
+      !!      ngrp_iworld = group ID for the world processors
       !!      ngrp_ice = group ID for the ice processors
       !!      ncomm_ice = communicator for the ice procs.
@@ -2027,8 +2028,8 @@
 
       ! Create the world group
-      CALL MPI_COMM_GROUP( mpi_comm_opa, ngrp_world, ierr )
+      CALL MPI_COMM_GROUP( mpi_comm_opa, ngrp_iworld, ierr )
 
       ! Create the ice group from the world group
-      CALL MPI_GROUP_INCL( ngrp_world, ndim_rank_ice, nrank_ice, ngrp_ice, ierr )
+      CALL MPI_GROUP_INCL( ngrp_iworld, ndim_rank_ice, nrank_ice, ngrp_ice, ierr )
 
       ! Create the ice communicator , ie the pool of procs with sea-ice
@@ -2037,6 +2038,9 @@
       ! Find proc number in the world of proc 0 in the north
       ! The following line seems to be useless, we just comment & keep it as reminder
-      ! CALL MPI_GROUP_TRANSLATE_RANKS(ngrp_ice,1,0,ngrp_world,n_ice_root,ierr)
-      !
+      ! CALL MPI_GROUP_TRANSLATE_RANKS(ngrp_ice,1,0,ngrp_iworld,n_ice_root,ierr)
+      !
+      CALL MPI_GROUP_FREE(ngrp_ice, ierr)
+      CALL MPI_GROUP_FREE(ngrp_iworld, ierr)
+
       DEALLOCATE(kice, zwork)
       !
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/LDF/ldfslp.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/LDF/ldfslp.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/LDF/ldfslp.F90	(revision 3625)
@@ -16,21 +16,22 @@
    !!   'key_ldfslp'                      Rotation of lateral mixing tensor
    !!----------------------------------------------------------------------
-   !!   ldf_slp_grif : calculates the triads of isoneutral slopes (Griffies operator)
-   !!   ldf_slp      : calculates the slopes of neutral surface   (Madec operator)
-   !!   ldf_slp_mxl  : calculates the slopes at the base of the mixed layer (Madec operator)
-   !!   ldf_slp_init : initialization of the slopes computation
+   !!   ldf_slp_grif  : calculates the triads of isoneutral slopes (Griffies operator)
+   !!   ldf_slp       : calculates the slopes of neutral surface   (Madec operator)
+   !!   ldf_slp_mxl   : calculates the slopes at the base of the mixed layer (Madec operator)
+   !!   ldf_slp_init  : initialization of the slopes computation
    !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE ldftra_oce      ! lateral diffusion: traceur
-   USE ldfdyn_oce      ! lateral diffusion: dynamics
-   USE phycst          ! physical constants
-   USE zdfmxl          ! mixed layer depth
-   USE eosbn2          ! equation of states
-   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE in_out_manager  ! I/O manager
-   USE prtctl          ! Print control
-   USE wrk_nemo        ! work arrays
-   USE timing          ! Timing
+   USE oce            ! ocean dynamics and tracers
+   USE dom_oce        ! ocean space and time domain
+   USE ldftra_oce     ! lateral diffusion: traceur
+   USE ldfdyn_oce     ! lateral diffusion: dynamics
+   USE phycst         ! physical constants
+   USE zdfmxl         ! mixed layer depth
+   USE eosbn2         ! equation of states
+   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
+   USE in_out_manager ! I/O manager
+   USE prtctl         ! Print control
+   USE wrk_nemo       ! work arrays
+   USE timing         ! Timing
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/albedo.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/albedo.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/albedo.F90	(revision 3625)
@@ -12,12 +12,13 @@
 
    !!----------------------------------------------------------------------
-   !!   albedo_ice  : albedo for   ice (clear and overcast skies)
-   !!   albedo_oce  : albedo for ocean (clear and overcast skies)
-   !!   albedo_init : initialisation of albedo computation
-   !!----------------------------------------------------------------------
-   USE phycst          ! physical constants
-   USE in_out_manager  ! I/O manager
-   USE lib_mpp         ! MPP library
-   USE wrk_nemo        ! work arrays
+   !!   albedo_ice    : albedo for   ice (clear and overcast skies)
+   !!   albedo_oce    : albedo for ocean (clear and overcast skies)
+   !!   albedo_init   : initialisation of albedo computation
+   !!----------------------------------------------------------------------
+   USE phycst         ! physical constants
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_ice.F90	(revision 3625)
@@ -94,6 +94,6 @@
    ! finally, arrays corresponding to different ice categories
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   a_i                !: category ice fraction
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   topmelt           !: category topmelt
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   botmelt           !: category botmelt
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   topmelt            !: category topmelt
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   botmelt            !: category botmelt
 #endif
 
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbc_oce.F90	(revision 3625)
@@ -40,5 +40,9 @@
    LOGICAL , PUBLIC ::   ln_apr_dyn  = .FALSE.   !: Atmospheric pressure forcing used on dynamics (ocean & ice)
    LOGICAL , PUBLIC ::   ln_icebergs = .FALSE.   !: Icebergs
-   INTEGER , PUBLIC ::   nn_ice      = 0         !: flag on ice in the surface boundary condition (=0/1/2/3)
+   INTEGER , PUBLIC ::   nn_ice      = 0         !: flag for ice in the surface boundary condition (=0/1/2/3)
+   INTEGER , PUBLIC ::   nn_ice_embd = 0         !: flag for levitating/embedding sea-ice in the ocean
+   !                                             !: =0 levitating ice (no mass exchange, concentration/dilution effect)
+   !                                             !: =1 levitating ice with mass and salt exchange but no presure effect
+   !                                             !: =2 embedded sea-ice (full salt and mass exchanges and pressure)
    INTEGER , PUBLIC ::   nn_fwb      = 0         !: FreshWater Budget: 
    !                                             !:  = 0 unchecked 
@@ -62,5 +66,5 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   qns_tot           !: total non solar heat flux (over sea and ice) [W/m2]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   emp    , emp_b    !: freshwater budget: volume flux               [Kg/m2/s]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   emps   , emps_b   !: freshwater budget: concentration/dillution   [Kg/m2/s]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   sfx    , sfx_b    !: salt flux                                    [PSU/m2/s]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   emp_tot           !: total E-P over ocean and ice                 [Kg/m2/s]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   rnf    , rnf_b    !: river runoff   [Kg/m2/s]  
@@ -106,8 +110,8 @@
          &      vtau(jpi,jpj) , vtau_b(jpi,jpj) , wndm(jpi,jpj) , STAT=ierr(1) ) 
          !
-      ALLOCATE( qns_tot(jpi,jpj) , qns   (jpi,jpj) , qns_b(jpi,jpj),        &
-         &      qsr_tot(jpi,jpj) , qsr   (jpi,jpj) ,                        &
-         &      emp    (jpi,jpj) , emp_b (jpi,jpj) ,                        &
-         &      emps   (jpi,jpj) , emps_b(jpi,jpj) , emp_tot(jpi,jpj) , STAT=ierr(2) )
+      ALLOCATE( qns_tot(jpi,jpj) , qns  (jpi,jpj) , qns_b(jpi,jpj),        &
+         &      qsr_tot(jpi,jpj) , qsr  (jpi,jpj) ,                        &
+         &      emp    (jpi,jpj) , emp_b(jpi,jpj) ,                        &
+         &      sfx    (jpi,jpj) , sfx_b(jpi,jpj) , emp_tot(jpi,jpj) , STAT=ierr(2) )
          !
       ALLOCATE( rnf  (jpi,jpj) , sbc_tsc  (jpi,jpj,jpts) , qsr_hc  (jpi,jpj,jpk) ,     &
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcana.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcana.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcana.F90	(revision 3625)
@@ -60,5 +60,5 @@
       !!
       !! ** Action  : - set the ocean surface boundary condition, i.e.  
-      !!                   utau, vtau, taum, wndm, qns, qsr, emp, emps
+      !!                   utau, vtau, taum, wndm, qns, qsr, emp
       !!----------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt       ! ocean time step
@@ -89,8 +89,8 @@
          nn_tau000 = MAX( nn_tau000, 1 )     ! must be >= 1
          !
-         qns (:,:) = rn_qns0
+         emp (:,:) = rn_emp0
+         sfx (:,:) = 0.0_wp
+         qns (:,:) = rn_qns0 - emp(:,:) * sst_m(:,:) * rcp      ! including heat content associated with mass flux at SST
          qsr (:,:) = rn_qsr0
-         emp (:,:) = rn_emp0
-         emps(:,:) = rn_emp0
          !
          utau(:,:) = rn_utau0
@@ -130,5 +130,5 @@
       !!
       !! ** Action  : - set the ocean surface boundary condition, i.e.   
-      !!                   utau, vtau, taum, wndm, qns, qsr, emp, emps
+      !!                   utau, vtau, taum, wndm, qns, qsr, emp, sfx
       !!
       !! Reference : Hazeleger, W., and S. Drijfhout, JPO, 30, 677-695, 2000.
@@ -211,5 +211,4 @@
          END DO
       END DO
-      emps(:,:) = emp(:,:)
 
       ! Compute the emp flux such as its integration on the whole domain at each time is zero
@@ -224,7 +223,8 @@
       ENDIF
 
-      !salinity terms
-      emp (:,:) = emp(:,:) - zsumemp * tmask(:,:,1)
-      emps(:,:) = emp(:,:)
+      ! freshwater (mass flux) and update of qns with heat content of emp
+      emp (:,:) = emp(:,:) - zsumemp * tmask(:,:,1)        ! freshwater flux (=0 in domain average)
+      sfx (:,:) = 0.0_wp                                   ! no salt flux
+      qns (:,:) = qns(:,:) - emp(:,:) * sst_m(:,:) * rcp   ! evap and precip are at SST
 
 
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_clio.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_clio.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_clio.F90	(revision 3625)
@@ -12,22 +12,23 @@
 
    !!----------------------------------------------------------------------
-   !!   sbc_blk_clio   : CLIO bulk formulation: read and update required input fields
-   !!   blk_clio_oce   : ocean CLIO bulk formulea: compute momentum, heat and freswater fluxes for the ocean
-   !!   blk_ice_clio   : ice   CLIO bulk formulea: compute momentum, heat and freswater fluxes for the sea-ice
+   !!   sbc_blk_clio     : CLIO bulk formulation: read and update required input fields
+   !!   blk_clio_oce     : ocean CLIO bulk formulea: compute momentum, heat and freswater fluxes for the ocean
+   !!   blk_ice_clio     : ice   CLIO bulk formulea: compute momentum, heat and freswater fluxes for the sea-ice
    !!   blk_clio_qsr_oce : shortwave radiation for ocean computed from the cloud cover
    !!   blk_clio_qsr_ice : shortwave radiation for ice   computed from the cloud cover
-   !!   flx_blk_declin : solar declinaison
+   !!   flx_blk_declin   : solar declination
    !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE phycst          ! physical constants
-   USE fldread         ! read input fields
-   USE sbc_oce         ! Surface boundary condition: ocean fields
-   USE iom             ! I/O manager library
-   USE in_out_manager  ! I/O manager
-   USE lib_mpp         ! distribued memory computing library
-   USE wrk_nemo        ! work arrays
-   USE timing          ! Timing
-   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
+   USE oce            ! ocean dynamics and tracers
+   USE dom_oce        ! ocean space and time domain
+   USE phycst         ! physical constants
+   USE fldread        ! read input fields
+   USE sbc_oce        ! Surface boundary condition: ocean fields
+   USE iom            ! I/O manager library
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! distribued memory computing library
+   USE wrk_nemo       ! work arrays
+   USE timing         ! Timing
+   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    USE albedo
@@ -50,6 +51,6 @@
    INTEGER , PARAMETER ::   jp_vtau = 2           ! index of wind stress (j-component)      (N/m2)    at V-point
    INTEGER , PARAMETER ::   jp_wndm = 3           ! index of 10m wind module                 (m/s)    at T-point
-   INTEGER , PARAMETER ::   jp_humi = 4           ! index of specific humidity               ( - )
-   INTEGER , PARAMETER ::   jp_ccov = 5           ! index of cloud cover                     ( - )
+   INTEGER , PARAMETER ::   jp_humi = 4           ! index of specific humidity               ( % )
+   INTEGER , PARAMETER ::   jp_ccov = 5           ! index of cloud cover                     ( % )
    INTEGER , PARAMETER ::   jp_tair = 6           ! index of 10m air temperature             (Kelvin)
    INTEGER , PARAMETER ::   jp_prec = 7           ! index of total precipitation (rain+snow) (Kg/m2/s)
@@ -100,14 +101,13 @@
       !!      the i-component of the stress                (N/m2)
       !!      the j-component of the stress                (N/m2)
-      !!      the 10m wind pseed module                    (m/s)
+      !!      the 10m wind speed module                    (m/s)
       !!      the 10m air temperature                      (Kelvin)
-      !!      the 10m specific humidity                    (-)
-      !!      the cloud cover                              (-)
+      !!      the 10m specific humidity                    (%)
+      !!      the cloud cover                              (%)
       !!      the total precipitation (rain+snow)          (Kg/m2/s)
       !!              (2) CALL blk_oce_clio
       !!
       !!      C A U T I O N : never mask the surface stress fields
-      !!                      the stress is assumed to be in the mesh referential
-      !!                      i.e. the (i,j) referential
+      !!                      the stress is assumed to be in the (i,j) mesh referential
       !!
       !! ** Action  :   defined at each time-step at the air-sea interface
@@ -115,8 +115,12 @@
       !!              - taum        wind stress module at T-point
       !!              - wndm        10m wind module at T-point
-      !!              - qns, qsr    non-slor and solar heat flux
-      !!              - emp, emps   evaporation minus precipitation
+      !!              - qns         non-solar heat flux including latent heat of solid 
+      !!                            precip. melting and emp heat content
+      !!              - qsr         solar heat flux
+      !!              - emp         upward mass flux (evap. - precip)
+      !!              - sfx         salt flux; set to zero at nit000 but possibly non-zero
+      !!                            if ice is present (computed in limsbc(_2).F90)
       !!----------------------------------------------------------------------
-      INTEGER, INTENT(in) ::   kt   ! ocean time step
+      INTEGER, INTENT( in  ) ::   kt   ! ocean time step
       !!
       INTEGER  ::   ifpr, jfpr   ! dummy indices
@@ -171,4 +175,6 @@
          ALLOCATE( sbudyko(jpi,jpj) , stauc(jpi,jpj), STAT=ierr3 )
          IF( ierr3 > 0 )   CALL ctl_stop( 'STOP', 'sbc_blk_clio: unable to allocate arrays' )
+         !
+         sfx(:,:) = 0._wp                       ! salt flux; zero unless ice is present (computed in limsbc(_2).F90)
          !
       ENDIF
@@ -205,6 +211,8 @@
       !!               - taum        wind stress module at T-point
       !!               - wndm        10m wind module at T-point
-      !!               - qns, qsr    non-slor and solar heat flux
-      !!               - emp, emps   evaporation minus precipitation
+      !!               - qns         non-solar heat flux including latent heat of solid 
+      !!                             precip. melting and emp heat content
+      !!               - qsr         solar heat flux
+      !!               - emp         suface mass flux (evap.-precip.)
       !!  ** Nota    :   sf has to be a dummy argument for AGRIF on NEC
       !!----------------------------------------------------------------------
@@ -223,5 +231,5 @@
       REAL(wp) ::   zsst, ztatm, zcco1, zpatm, zcmax, zrmax     !    -         -
       REAL(wp) ::   zrhoa, zev, zes, zeso, zqatm, zevsqr        !    -         -
-      REAL(wp) ::   ztx2, zty2                                  !    -         -
+      REAL(wp) ::   ztx2, zty2, zcevap, zcprec                  !    -         -
       REAL(wp), POINTER, DIMENSION(:,:) ::   zqlw        ! long-wave heat flux over ocean
       REAL(wp), POINTER, DIMENSION(:,:) ::   zqla        ! latent heat flux over ocean
@@ -363,10 +371,17 @@
       !     III    Total FLUXES                                                       !
       ! ----------------------------------------------------------------------------- !
-
-!CDIR COLLAPSE
-      emp (:,:) = zqla(:,:) / cevap - sf(jp_prec)%fnow(:,:,1) / rday * tmask(:,:,1)
-      qns (:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)         ! Downward Non Solar flux
-      emps(:,:) = emp(:,:)
-      !
+      zcevap = rcp /  cevap    ! convert zqla ==> evap (Kg/m2/s) ==> m/s ==> W/m2
+      zcprec = rcp /  rday     ! convert prec ( mm/day ==> m/s)  ==> W/m2
+
+!CDIR COLLAPSE
+      emp(:,:) = zqla(:,:) / cevap                                        &   ! freshwater flux
+         &     - sf(jp_prec)%fnow(:,:,1) / rday * tmask(:,:,1)
+      !
+!CDIR COLLAPSE
+      qns(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)                        &   ! Downward Non Solar flux
+         &     - zqla(:,:)             * pst(:,:) * zcevap                &   ! remove evap.   heat content at SST in Celcius
+         &     + sf(jp_prec)%fnow(:,:,1) * sf(jp_tair)%fnow(:,:,1) * zcprec   ! add    precip. heat content at Tair in Celcius
+      ! NB: if sea-ice model, the snow precip are computed and the associated heat is added to qns (see blk_ice_clio)
+
       CALL iom_put( "qlw_oce",   zqlw )   ! output downward longwave  heat over the ocean
       CALL iom_put( "qsb_oce", - zqsb )   ! output downward sensible  heat over the ocean
@@ -407,12 +422,13 @@
       !!
       !!  ** Action  :   call albedo_oce/albedo_ice to compute ocean/ice albedo 
-      !!          computation of snow precipitation
-      !!          computation of solar flux at the ocean and ice surfaces
-      !!          computation of the long-wave radiation for the ocean and sea/ice
-      !!          computation of turbulent heat fluxes over water and ice
-      !!          computation of evaporation over water
-      !!          computation of total heat fluxes sensitivity over ice (dQ/dT)
-      !!          computation of latent heat flux sensitivity over ice (dQla/dT)
-      !!
+      !!               - 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]
@@ -594,5 +610,5 @@
       !
       ! ----------------------------------------------------------------------------- !
-      !    Total FLUXES                                                       !
+      !    Total FLUXES                                                               !
       ! ----------------------------------------------------------------------------- !
       !
@@ -601,4 +617,13 @@
 !CDIR COLLAPSE
       p_tpr(:,:)   = sf(jp_prec)%fnow(:,:,1) / rday                     ! total precipitation [kg/m2/s]
+      !
+      ! ----------------------------------------------------------------------------- !
+      !    Correct the OCEAN non solar flux with the existence of solid precipitation !
+      ! ---------------=====--------------------------------------------------------- !
+!CDIR COLLAPSE
+      qns(:,:) = qns(:,:)                                                           &   ! update the non-solar heat flux with:
+         &     - p_spr(:,:) * lfus                                                  &   ! remove melting solid precip
+         &     + p_spr(:,:) * MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow - rt0 ) * cpic &   ! add solid P at least below melting
+         &     - p_spr(:,:) * sf(jp_tair)%fnow(:,:,1)                        * rcp      ! remove solid precip. at Tair
       !
 !!gm : not necessary as all input data are lbc_lnk...
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_core.F90	(revision 3625)
@@ -52,5 +52,5 @@
    INTEGER , PARAMETER ::   jp_wndi = 1           ! index of 10m wind velocity (i-component) (m/s)    at T-point
    INTEGER , PARAMETER ::   jp_wndj = 2           ! index of 10m wind velocity (j-component) (m/s)    at T-point
-   INTEGER , PARAMETER ::   jp_humi = 3           ! index of specific humidity               ( - )
+   INTEGER , PARAMETER ::   jp_humi = 3           ! index of specific humidity               ( % )
    INTEGER , PARAMETER ::   jp_qsr  = 4           ! index of solar heat                      (W/m2)
    INTEGER , PARAMETER ::   jp_qlw  = 5           ! index of Long wave                       (W/m2)
@@ -69,5 +69,5 @@
    REAL(wp), PARAMETER ::   Stef =    5.67e-8     ! Stefan Boltzmann constant
    REAL(wp), PARAMETER ::   Cice =    1.63e-3     ! transfer coefficient over ice
-   REAL(wp), PARAMETER ::   albo =    0.066       ! ocean albedo assumed to be contant
+   REAL(wp), PARAMETER ::   albo =    0.066       ! ocean albedo assumed to be constant
 
    !                                  !!* Namelist namsbc_core : CORE bulk parameters
@@ -96,24 +96,23 @@
       !!      the 10m wind velocity (i-component) (m/s)    at T-point
       !!      the 10m wind velocity (j-component) (m/s)    at T-point
-      !!      the specific humidity               ( - )
+      !!      the 10m or 2m specific humidity     ( % )
       !!      the solar heat                      (W/m2)
       !!      the Long wave                       (W/m2)
-      !!      the 10m air temperature             (Kelvin)
+      !!      the 10m or 2m air temperature       (Kelvin)
       !!      the total precipitation (rain+snow) (Kg/m2/s)
       !!      the snow (solid prcipitation)       (kg/m2/s)
-      !!   OPTIONAL parameter (see ln_taudif namelist flag):
-      !!      the tau diff associated to HF tau   (N/m2)   at T-point 
+      !!      the tau diff associated to HF tau   (N/m2)   at T-point   (ln_taudif=T)
       !!              (2) CALL blk_oce_core
       !!
       !!      C A U T I O N : never mask the surface stress fields
-      !!                      the stress is assumed to be in the mesh referential
-      !!                      i.e. the (i,j) referential
+      !!                      the stress is assumed to be in the (i,j) mesh referential
       !!
       !! ** Action  :   defined at each time-step at the air-sea interface
       !!              - utau, vtau  i- and j-component of the wind stress
-      !!              - taum        wind stress module at T-point
-      !!              - wndm        10m wind module at T-point
-      !!              - qns, qsr    non-slor and solar heat flux
-      !!              - emp, emps   evaporation minus precipitation
+      !!              - taum, wndm  wind stress and 10m wind modules at T-point
+      !!              - qns, qsr    non-solar and solar heat fluxes
+      !!              - emp         upward mass flux (evapo. - precip.)
+      !!              - sfx         salt flux due to freezing/melting (non-zero only if ice is present)
+      !!                            (set in limsbc(_2).F90)
       !!----------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt   ! ocean time step
@@ -125,7 +124,6 @@
       CHARACTER(len=100) ::  cn_dir   !   Root directory for location of core files
       TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i     ! array of namelist informations on the fields to read
-      TYPE(FLD_N) ::   sn_wndi, sn_wndj, sn_humi, sn_qsr       ! informations about the fields to be read
-      TYPE(FLD_N) ::   sn_qlw , sn_tair, sn_prec, sn_snow      !   "                                 "
-      TYPE(FLD_N) ::   sn_tdif                                 !   "                                 "
+      TYPE(FLD_N) ::   sn_wndi, sn_wndj, sn_humi, sn_qsr             ! informations about the fields to be read
+      TYPE(FLD_N) ::   sn_qlw , sn_tair, sn_prec, sn_snow, sn_tdif   !       -                       -
       NAMELIST/namsbc_core/ cn_dir , ln_2m  , ln_taudif, rn_pfac,           &
          &                  sn_wndi, sn_wndj, sn_humi  , sn_qsr ,           &
@@ -181,9 +179,11 @@
          CALL fld_fill( sf, slf_i, cn_dir, 'sbc_blk_core', 'flux formulation for ocean surface boundary condition', 'namsbc_core' )
          !
-      ENDIF
-
-      CALL fld_read( kt, nn_fsbc, sf )        ! input fields provided at the current time-step
-
-      !                                                        ! surface ocean fluxes computed with CLIO bulk formulea
+         sfx(:,:) = 0._wp                          ! salt flux; zero unless ice is present (computed in limsbc(_2).F90)
+         !
+      ENDIF
+
+      CALL fld_read( kt, nn_fsbc, sf )             ! input fields provided at the current time-step
+
+      !                                            ! compute the surface ocean fluxes using CORE bulk formulea
       IF( MOD( kt - 1, nn_fsbc ) == 0 )   CALL blk_oce_core( sf, sst_m, ssu_m, ssv_m )
 
@@ -221,5 +221,5 @@
       !!              - qns     : Non Solar heat flux over the ocean    (W/m2)
       !!              - evap    : Evaporation over the ocean            (kg/m2/s)
-      !!              - emp(s)  : evaporation minus precipitation       (kg/m2/s)
+      !!              - emp     : evaporation minus precipitation       (kg/m2/s)
       !!
       !!  ** Nota  :   sf has to be a dummy argument for AGRIF on NEC
@@ -252,5 +252,5 @@
       zcoef_qsatw = 0.98 * 640380. / rhoa
       
-      zst(:,:) = pst(:,:) + rt0      ! converte Celcius to Kelvin (and set minimum value far above 0 K)
+      zst(:,:) = pst(:,:) + rt0      ! convert SST from Celcius to Kelvin (and set minimum value far above 0 K)
 
       ! ----------------------------------------------------------------------------- !
@@ -378,13 +378,19 @@
      
 !CDIR COLLAPSE
-      qns(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)      ! Downward Non Solar flux
-!CDIR COLLAPSE
-      emp(:,:) = zevap(:,:) - sf(jp_prec)%fnow(:,:,1) * rn_pfac * tmask(:,:,1)
-!CDIR COLLAPSE
-      emps(:,:) = emp(:,:)
+      emp (:,:) = (  zevap(:,:)                                          &   ! mass flux (evap. - precip.)
+         &         - sf(jp_prec)%fnow(:,:,1) * rn_pfac  ) * tmask(:,:,1)
+!CDIR COLLAPSE
+      qns(:,:) = zqlw(:,:) - zqsb(:,:) - zqla(:,:)                       &   ! Downward Non Solar flux
+         &     - sf(jp_snow)%fnow(:,:,1) * lfus                          &   ! remove latent melting heat for solid precip
+         &     - zevap(:,:) * pst(:,:) * rcp                             &   ! remove evap heat content at SST
+         &     + ( sf(jp_prec)%fnow(:,:,1) - sf(jp_snow)%fnow(:,:,1) )   &   ! add liquid precip heat content at Tair
+         &     * ( sf(jp_tair)%fnow(:,:,1) - rt0 ) * rcp                 &   
+         &     + sf(jp_snow)%fnow(:,:,1)                                 &   ! add solid  precip heat content at min(Tair,Tsnow)
+         &     * ( MIN( sf(jp_tair)%fnow(:,:,1), rt0_snow ) - rt0 ) * cpic 
       !
       CALL iom_put( "qlw_oce",   zqlw )                 ! output downward longwave heat over the ocean
       CALL iom_put( "qsb_oce", - zqsb )                 ! output downward sensible heat over the ocean
       CALL iom_put( "qla_oce", - zqla )                 ! output downward latent   heat over the ocean
+      CALL iom_put( "qhc_oce",   qns-zqlw+zqsb+zqla )   ! output downward heat content of E-P over the ocean
       CALL iom_put( "qns_oce",   qns  )                 ! output downward non solar heat over the ocean
       !
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_mfs.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_mfs.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcblk_mfs.F90	(revision 3625)
@@ -84,5 +84,5 @@
       !!              - wndm        10m wind module at T-point
       !!              - qns, qsr    non-slor and solar heat flux
-      !!              - emp, emps   evaporation minus precipitation
+      !!              - emp         evaporation minus precipitation
       !!----------------------------------------------------------------------
       REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::  sh_now   ! specific humidity at T-point 
@@ -258,5 +258,4 @@
            emp (:,:) = evap(:,:) - sf(jp_prec)%fnow(:,:,1) * tmask(:,:,1)
 !CDIR COLLAPSE
-           emps(:,:) = emp(:,:)
 
          CALL iom_put( "qlw_oce",   qbw  )                 ! output downward longwave heat over the ocean
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbccpl.F90	(revision 3625)
@@ -664,6 +664,8 @@
       !! ** Action  :   update  utau, vtau   ocean stress at U,V grid 
       !!                        taum, wndm   wind stres and wind speed module at T-point
-      !!                        qns , qsr    non solar and solar ocean heat fluxes   ('ocean only case)
-      !!                        emp = emps   evap. - precip. (- runoffs) (- calving) ('ocean only case)
+      !!                        qns          non solar heat fluxes including emp heat content    (ocean only case)
+      !!                                     and the latent heat flux of solid precip. melting
+      !!                        qsr          solar ocean heat fluxes   (ocean only case)
+      !!                        emp          upward mass flux [evap. - precip. (- runoffs) (- calving)] (ocean only case)
       !!----------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt       ! ocean model time step index
@@ -777,5 +779,5 @@
          ! Stress module can be negative when received (interpolation problem)
          IF( llnewtau ) THEN 
-            frcv(jpr_taum)%z3(:,:,1) = MAX( 0.0e0, frcv(jpr_taum)%z3(:,:,1) )
+            frcv(jpr_taum)%z3(:,:,1) = MAX( 0._wp, frcv(jpr_taum)%z3(:,:,1) )
          ENDIF
       ENDIF
@@ -821,16 +823,5 @@
          !                                                   ! ========================= !
          !
-         !                                                       ! non solar heat flux over the ocean (qns)
-         IF( srcv(jpr_qnsoce)%laction )   qns(:,:) = frcv(jpr_qnsoce)%z3(:,:,1)
-         IF( srcv(jpr_qnsmix)%laction )   qns(:,:) = frcv(jpr_qnsmix)%z3(:,:,1)
-         ! add the latent heat of solid precip. melting
-         IF( srcv(jpr_snow  )%laction )   qns(:,:) = qns(:,:) - frcv(jpr_snow)%z3(:,:,1) * lfus              
-
-         !                                                       ! solar flux over the ocean          (qsr)
-         IF( srcv(jpr_qsroce)%laction )   qsr(:,:) = frcv(jpr_qsroce)%z3(:,:,1)
-         IF( srcv(jpr_qsrmix)%laction )   qsr(:,:) = frcv(jpr_qsrmix)%z3(:,:,1)
-         IF( ln_dm2dc )   qsr(:,:) = sbc_dcy( qsr )                           ! modify qsr to include the diurnal cycle
-         !
-         !                                                       ! total freshwater fluxes over the ocean (emp, emps)
+         !                                                       ! total freshwater fluxes over the ocean (emp)
          SELECT CASE( TRIM( sn_rcv_emp%cldes ) )                                    ! evaporation - precipitation
          CASE( 'conservative' )
@@ -863,5 +854,18 @@
 !!gm  end of internal cooking
          !
-         emps(:,:) = emp(:,:)                                        ! concentration/dilution = emp
+         !                                                       ! non solar heat flux over the ocean (qns)
+         IF( srcv(jpr_qnsoce)%laction )   qns(:,:) = frcv(jpr_qnsoce)%z3(:,:,1)
+         IF( srcv(jpr_qnsmix)%laction )   qns(:,:) = frcv(jpr_qnsmix)%z3(:,:,1)
+         ! add the latent heat of solid precip. melting
+         IF( srcv(jpr_snow  )%laction )   THEN                         ! update qns over the free ocean with:
+              qns(:,:) = qns(:,:) - frcv(jpr_snow)%z3(:,:,1) * lfus  & ! energy for melting solid precipitation over the free ocean
+           &           - emp(:,:) * sst_m(:,:) * rcp                   ! remove heat content due to mass flux (assumed to be at SST)
+         ENDIF
+
+         !                                                       ! solar flux over the ocean          (qsr)
+         IF( srcv(jpr_qsroce)%laction )   qsr(:,:) = frcv(jpr_qsroce)%z3(:,:,1)
+         IF( srcv(jpr_qsrmix)%laction )   qsr(:,:) = frcv(jpr_qsrmix)%z3(:,:,1)
+         IF( ln_dm2dc )   qsr(:,:) = sbc_dcy( qsr )                           ! modify qsr to include the diurnal cycle
+         !
   
       ENDIF
@@ -1141,5 +1145,5 @@
 
       zicefr(:,:) = 1.- p_frld(:,:)
-      IF( lk_diaar5 )   zcptn(:,:) = rcp * tsn(:,:,1,jp_tem)
+      zcptn(:,:) = rcp * sst_m(:,:)
       !
       !                                                      ! ========================= !
@@ -1233,6 +1237,9 @@
             &                                                   +          pist(:,:,1)   * zicefr(:,:) ) )
       END SELECT
-      ztmp(:,:) = p_frld(:,:) * sprecip(:,:) * lfus               ! add the latent heat of solid precip. melting
-      qns_tot(:,:) = qns_tot(:,:) - ztmp(:,:)                     ! over free ocean 
+      ztmp(:,:) = p_frld(:,:) * sprecip(:,:) * lfus
+      qns_tot(:,:) = qns_tot(:,:)                         &            ! qns_tot update over free ocean with:
+         &          - ztmp(:,:)                           &            ! remove the latent heat flux of solid precip. melting
+         &          - (  emp_tot(:,:)                     &            ! remove the heat content of mass flux (assumed to be at SST)
+         &             - emp_ice(:,:) * zicefr(:,:)  ) * zcptn(:,:) 
       IF( lk_diaar5 )   CALL iom_put( 'hflx_snow_cea', ztmp + sprecip(:,:) * zcptn(:,:) )   ! heat flux from snow (cell average)
 !!gm
@@ -1254,5 +1261,5 @@
       !                                                      ! ========================= !
       CASE( 'oce only' )
-         qsr_tot(:,:  ) = MAX(0.0,frcv(jpr_qsroce)%z3(:,:,1))
+         qsr_tot(:,:  ) = MAX( 0._wp , frcv(jpr_qsroce)%z3(:,:,1) )
       CASE( 'conservative' )
          qsr_tot(:,:  ) = frcv(jpr_qsrmix)%z3(:,:,1)
@@ -1357,5 +1364,5 @@
             ztmp3(:,:,1:jpl) = tn_ice(:,:,1:jpl) * a_i(:,:,1:jpl)
          CASE( 'no' )
-            ztmp3(:,:,:) = 0.0
+            ztmp3(:,:,:) = 0._wp
             DO jl=1,jpl
                ztmp3(:,:,1) = ztmp3(:,:,1) + tn_ice(:,:,jl) * a_i(:,:,jl)
@@ -1409,5 +1416,5 @@
             ztmp4(:,:,1:jpl) =  ht_s(:,:,1:jpl) * a_i(:,:,1:jpl)
          CASE( 'no' )
-            ztmp3(:,:,:) = 0.0   ;  ztmp4(:,:,:) = 0.0
+            ztmp3(:,:,:) = 0._wp   ;  ztmp4(:,:,:) = 0._wp
             DO jl=1,jpl
                ztmp3(:,:,1) = ztmp3(:,:,1) + ht_i(:,:,jl) * a_i(:,:,jl)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcflx.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcflx.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcflx.F90	(revision 3625)
@@ -61,6 +61,5 @@
       !!
       !!      CAUTION :  - never mask the surface stress fields
-      !!                 - the stress is assumed to be in the mesh referential
-      !!                   i.e. the (i,j) referential
+      !!                 - the stress is assumed to be in the (i,j) mesh referential
       !!
       !! ** Action  :   update at each time-step
@@ -68,6 +67,9 @@
       !!              - taum        wind stress module at T-point
       !!              - wndm        10m wind module at T-point
-      !!              - qns, qsr    non-slor and solar heat flux
-      !!              - emp, emps   evaporation minus precipitation
+      !!              - qns         non solar heat flux including heat flux due to emp
+      !!              - qsr         solar heat flux
+      !!              - emp         upward mass flux (evap. - precip.)
+      !!              - sfx         salt flux; set to zero at nit000 but possibly non-zero
+      !!                            if ice is present (computed in limsbc(_2).F90)
       !!----------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt   ! ocean time step
@@ -121,4 +123,6 @@
          CALL fld_fill( sf, slf_i, cn_dir, 'sbc_flx', 'flux formulation for ocean surface boundary condition', 'namsbc_flx' )
          !
+         sfx(:,:) = 0.0_wp                         ! salt flux due to freezing/melting (non-zero only if ice is present; set in limsbc(_2).F90)
+         !
       ENDIF
 
@@ -139,4 +143,7 @@
             END DO
          END DO
+         !                                                        ! add to qns the heat due to e-p
+         qns(:,:) = qns(:,:) - emp(:,:) * sst_m(:,:) * rcp        ! mass flux is at SST
+         !
          !                                                        ! module of wind stress and wind speed at T-point
          zcoef = 1. / ( zrhoa * zcdrag )
@@ -154,6 +161,4 @@
          CALL lbc_lnk( taum(:,:), 'T', 1. )   ;   CALL lbc_lnk( wndm(:,:), 'T', 1. )
 
-         emps(:,:) = emp (:,:)                                    ! Initialization of emps (needed when no ice model)
-                  
          IF( nitend-nit000 <= 100 .AND. lwp ) THEN                ! control print (if less than 100 time-step asked)
             WRITE(numout,*) 
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcfwb.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcfwb.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcfwb.F90	(revision 3625)
@@ -59,4 +59,5 @@
       !!                =3 global mean of emp set to zero at each nn_fsbc time step
       !!                   & spread out over erp area depending its sign
+      !! Note: if sea ice is embedded it is taken into account when computing the budget 
       !!----------------------------------------------------------------------
       INTEGER, INTENT( in ) ::   kt       ! ocean time-step index
@@ -64,8 +65,9 @@
       INTEGER, INTENT( in ) ::   kn_fwb   ! ocean time-step index
       !
-      INTEGER  ::   inum, ikty, iyear   ! local integers
-      REAL(wp) ::   z_fwf, z_fwf_nsrf, zsum_fwf, zsum_erp   ! local scalars
-      REAL(wp) ::   zsurf_neg, zsurf_pos, zsurf_tospread    !   -      -
-      REAL(wp), POINTER, DIMENSION(:,:) ::   ztmsk_neg, ztmsk_pos, ztmsk_tospread, z_wgt, zerp_cor
+      INTEGER  ::   inum, ikty, iyear     ! local integers
+      REAL(wp) ::   z_fwf, z_fwf_nsrf, zsum_fwf, zsum_erp                ! local scalars
+      REAL(wp) ::   zsurf_neg, zsurf_pos, zsurf_tospread, zcoef          !   -      -
+      REAL(wp), POINTER, DIMENSION(:,:) ::   ztmsk_neg, ztmsk_pos, z_wgt ! 2D workspaces
+      REAL(wp), POINTER, DIMENSION(:,:) ::   ztmsk_tospread, zerp_cor    !   -      -
       !!----------------------------------------------------------------------
       !
@@ -87,4 +89,10 @@
          !
          area = glob_sum( e1e2t(:,:) )           ! interior global domain surface
+         !
+#if ! defined key_lim2 &&  ! defined key_lim3 && ! defined key_cice 
+         snwice_mass_b(:,:) = 0.e0               ! no sea-ice model is being used : no snow+ice mass
+         snwice_mass  (:,:) = 0.e0
+#endif
+         !
       ENDIF
       
@@ -95,12 +103,13 @@
          !
          IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN
-            z_fwf = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) ) ) / area   ! sum over the global domain
-            emp (:,:) = emp (:,:) - z_fwf 
-            emps(:,:) = emps(:,:) - z_fwf 
+            z_fwf = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) -  snwice_fmass(:,:) ) ) / area   ! sum over the global domain
+            zcoef = z_fwf * rcp
+            emp(:,:) = emp(:,:) - z_fwf 
+            qns(:,:) = qns(:,:) + zcoef * sst_m(:,:)  ! account for change to the heat budget due to fw correction
          ENDIF
          !
       CASE ( 2 )                             !==  fwf budget adjusted from the previous year  ==!
          !
-         IF( kt == nit000 ) THEN                   ! initialisation
+         IF( kt == nit000 ) THEN                      ! initialisation
             !                                         ! Read the corrective factor on precipitations (fwfold)
             CALL ctl_opn( inum, 'EMPave_old.dat', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. )
@@ -117,6 +126,7 @@
          ikty = 365 * 86400 / rdttra(1)    !!bug  use of 365 days leap year or 360d year !!!!!!!
          IF( MOD( kt, ikty ) == 0 ) THEN
-            a_fwb_b = a_fwb
-            a_fwb   = glob_sum( e1e2t(:,:) * sshn(:,:) )   ! sum over the global domain
+            a_fwb_b = a_fwb                           ! mean sea level taking into account the ice+snow
+                                                      ! sum over the global domain
+            a_fwb   = glob_sum( e1e2t(:,:) * ( sshn(:,:) + snwice_mass(:,:) * r1_rau0 ) )
             a_fwb   = a_fwb * 1.e+3 / ( area * 86400. * 365. )     ! convert in Kg/m3/s = mm/s
 !!gm        !                                                      !!bug 365d year 
@@ -125,10 +135,11 @@
          ENDIF
          ! 
-         IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN      ! correct the freshwater fluxes
-            emp (:,:) = emp (:,:) + fwfold
-            emps(:,:) = emps(:,:) + fwfold
-         ENDIF
-         !
-         IF( kt == nitend .AND. lwp ) THEN         ! save fwfold value in a file
+         IF( MOD( kt-1, kn_fsbc ) == 0 ) THEN         ! correct the freshwater fluxes
+            zcoef = fwfold * rcp
+            emp(:,:) = emp(:,:) + fwfold
+            qns(:,:) = qns(:,:) - zcoef * sst_m(:,:)  ! account for change to the heat budget due to fw correction
+         ENDIF
+         !
+         IF( kt == nitend .AND. lwp ) THEN            ! save fwfold value in a file
             CALL ctl_opn( inum, 'EMPave.dat', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE., narea )
             WRITE( inum, "(24X,I8,2ES24.16)" ) nyear, a_fwb_b, a_fwb
@@ -143,8 +154,8 @@
             ztmsk_neg(:,:) = tmask_i(:,:) - ztmsk_pos(:,:)
             !
-            zsurf_neg = glob_sum( e1e2t(:,:)*ztmsk_neg(:,:) )   ! Area filled by <0 and >0 erp 
+            zsurf_neg = glob_sum( e1e2t(:,:)*ztmsk_neg(:,:) )  ! Area filled by <0 and >0 erp 
             zsurf_pos = glob_sum( e1e2t(:,:)*ztmsk_pos(:,:) )
-            !                                                  ! fwf global mean 
-            z_fwf = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) ) ) / area
+            !                                                  ! fwf global mean (excluding ocean to ice/snow exchanges) 
+            z_fwf     = glob_sum( e1e2t(:,:) * ( emp(:,:) - rnf(:,:) - snwice_fmass(:,:) ) ) / area
             !            
             IF( z_fwf < 0._wp ) THEN         ! spread out over >0 erp area to increase evaporation
@@ -160,5 +171,5 @@
             z_fwf_nsrf =  zsum_fwf / ( zsurf_tospread + rsmall )
             !                                                  ! weight to respect erp field 2D structure 
-            zsum_erp = glob_sum( ztmsk_tospread(:,:) * erp(:,:) * e1e2t(:,:) )
+            zsum_erp   = glob_sum( ztmsk_tospread(:,:) * erp(:,:) * e1e2t(:,:) )
             z_wgt(:,:) = ztmsk_tospread(:,:) * erp(:,:) / ( zsum_erp + rsmall )
             !                                                  ! final correction term to apply
@@ -168,7 +179,7 @@
             CALL lbc_lnk( zerp_cor, 'T', 1. )
             !
-            emp (:,:) = emp (:,:) + zerp_cor(:,:)
-            emps(:,:) = emps(:,:) + zerp_cor(:,:)
-            erp (:,:) = erp (:,:) + zerp_cor(:,:)
+            emp(:,:) = emp(:,:) + zerp_cor(:,:)
+            qns(:,:) = qns(:,:) - zerp_cor(:,:) * rcp * sst_m(:,:)  ! account for change to the heat budget due to fw correction
+            erp(:,:) = erp(:,:) + zerp_cor(:,:)
             !
             IF( nprint == 1 .AND. lwp ) THEN                   ! control print
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_cice.F90	(revision 3625)
@@ -15,5 +15,5 @@
    USE dom_oce         ! ocean space and time domain
    USE domvvl
-   USE phycst, only : rcp, rau0
+   USE phycst, only : rcp, rau0, r1_rau0, rhosn, rhoic
    USE in_out_manager  ! I/O manager
    USE lib_mpp         ! distributed memory computing library
@@ -37,5 +37,5 @@
    USE ice_gather_scatter
    USE ice_calendar, only: dt
-   USE ice_state, only: aice,aicen,uvel,vvel,vsnon,vicen
+   USE ice_state, only: aice,aicen,uvel,vvel,vsno,vsnon,vice,vicen
    USE ice_flux, only: strax,stray,strocnx,strocny,frain,fsnow,  &
                 sst,sss,uocn,vocn,ss_tltx,ss_tlty,fsalt_gbm,     &
@@ -59,4 +59,7 @@
    PUBLIC cice_sbc_final  ! routine called by sbc_final
    PUBLIC sbc_ice_cice    ! routine called by sbc
+
+   INTEGER , PARAMETER ::   ji_off = INT ( (jpiglo - nx_global) / 2 )
+   INTEGER , PARAMETER ::   jj_off = INT ( (jpjglo - ny_global) / 2 )
 
    INTEGER , PARAMETER ::   jpfld   = 13   ! maximum number of files to read 
@@ -107,5 +110,5 @@
       !! ** Action  : - time evolution of the CICE sea-ice model
       !!              - update all sbc variables below sea-ice:
-      !!                utau, vtau, qns , qsr, emp , emps
+      !!                utau, vtau, qns , qsr, emp , sfx
       !!---------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt      ! ocean time step
@@ -143,10 +146,13 @@
       !! ** Purpose: Initialise ice related fields for NEMO and coupling
       !!
-      INTEGER, INTENT( in  ) ::   nsbc ! surface forcing type
-      !!---------------------------------------------------------------------
-
-      INTEGER  ::   ji, jj, jpl                        ! dummy loop indices
+      INTEGER, INTENT( in  ) ::   nsbc                ! surface forcing type
+      REAL(wp), DIMENSION(:,:), POINTER :: ztmp1, ztmp2
+      REAL(wp) ::   zcoefu, zcoefv, zcoeff            ! local scalar
+      INTEGER  ::   ji, jj, jl                        ! dummy loop indices
+      !!---------------------------------------------------------------------
 
       IF( nn_timing == 1 )  CALL timing_start('cice_sbc_init')
+      !
+      CALL wrk_alloc( jpi,jpj, ztmp1, ztmp2 )
       !
       IF(lwp) WRITE(numout,*)'cice_sbc_init'
@@ -182,6 +188,6 @@
       CALL cice2nemo(aice,fr_i, 'T', 1. )
       IF ( (nsbc == 2).OR.(nsbc == 5) ) THEN
-         DO jpl=1,ncat
-            CALL cice2nemo(aicen(:,:,jpl,:),a_i(:,:,jpl), 'T', 1. )
+         DO jl=1,ncat
+            CALL cice2nemo(aicen(:,:,jl,:),a_i(:,:,jl), 'T', 1. )
          ENDDO
       ENDIF
@@ -198,4 +204,53 @@
       CALL lbc_lnk ( fr_iu , 'U', 1. )
       CALL lbc_lnk ( fr_iv , 'V', 1. )
+
+      !                                      ! embedded sea ice
+      IF( nn_ice_embd /= 0 ) THEN            ! mass exchanges between ice and ocean (case 1 or 2) set the snow+ice mass
+         CALL cice2nemo(vsno(:,:,:),ztmp1,'T', 1. )
+         CALL cice2nemo(vice(:,:,:),ztmp2,'T', 1. )
+         snwice_mass  (:,:) = ( rhosn * ztmp1(:,:) + rhoic * ztmp2(:,:)  )
+         snwice_mass_b(:,:) = snwice_mass(:,:)
+      ELSE
+         snwice_mass  (:,:) = 0.0_wp         ! no mass exchanges
+         snwice_mass_b(:,:) = 0.0_wp         ! no mass exchanges
+      ENDIF
+      IF( nn_ice_embd == 2 .AND.          &  ! full embedment (case 2) & no restart : 
+         &   .NOT.ln_rstart ) THEN           ! deplete the initial ssh belew sea-ice area
+         sshn(:,:) = sshn(:,:) - snwice_mass(:,:) * r1_rau0
+         sshb(:,:) = sshb(:,:) - snwice_mass(:,:) * r1_rau0
+         !
+         ! Note: Changed the initial values of sshb and sshn=>  need to recompute ssh[u,v,f]_[b,n] 
+         !       which were previously set in domvvl
+         IF ( lk_vvl ) THEN            ! Is this necessary? embd 2 should be restricted to vvl only???
+            DO jj = 1, jpjm1
+               DO ji = 1, jpim1                    ! caution: use of Vector Opt. not possible
+                  zcoefu = 0.5  * umask(ji,jj,1) / ( e1u(ji,jj) * e2u(ji,jj) )
+                  zcoefv = 0.5  * vmask(ji,jj,1) / ( e1v(ji,jj) * e2v(ji,jj) )
+                  zcoeff = 0.25 * umask(ji,jj,1) * umask(ji,jj+1,1)
+                  sshu_b(ji,jj) = zcoefu * ( e1t(ji  ,jj) * e2t(ji  ,jj) * sshb(ji  ,jj)     &
+                     &                     + e1t(ji+1,jj) * e2t(ji+1,jj) * sshb(ji+1,jj) )
+                  sshv_b(ji,jj) = zcoefv * ( e1t(ji,jj  ) * e2t(ji,jj  ) * sshb(ji,jj  )     &
+                     &                     + e1t(ji,jj+1) * e2t(ji,jj+1) * sshb(ji,jj+1) )
+                  sshu_n(ji,jj) = zcoefu * ( e1t(ji  ,jj) * e2t(ji  ,jj) * sshn(ji  ,jj)     &
+                     &                     + e1t(ji+1,jj) * e2t(ji+1,jj) * sshn(ji+1,jj) )
+                  sshv_n(ji,jj) = zcoefv * ( e1t(ji,jj  ) * e2t(ji,jj  ) * sshn(ji,jj  )     &
+                     &                     + e1t(ji,jj+1) * e2t(ji,jj+1) * sshn(ji,jj+1) )
+               END DO
+            END DO
+            CALL lbc_lnk( sshu_b, 'U', 1. )   ;   CALL lbc_lnk( sshu_n, 'U', 1. )
+            CALL lbc_lnk( sshv_b, 'V', 1. )   ;   CALL lbc_lnk( sshv_n, 'V', 1. )
+            DO jj = 1, jpjm1
+               DO ji = 1, jpim1      ! NO Vector Opt.
+                  sshf_n(ji,jj) = 0.5  * umask(ji,jj,1) * umask(ji,jj+1,1)                   &
+                       &               / ( e1f(ji,jj  ) * e2f(ji,jj  ) )                     &
+                       &               * ( e1u(ji,jj  ) * e2u(ji,jj  ) * sshu_n(ji,jj  )     &
+                       &                 + e1u(ji,jj+1) * e2u(ji,jj+1) * sshu_n(ji,jj+1) )
+               END DO
+            END DO
+            CALL lbc_lnk( sshf_n, 'F', 1. )
+          ENDIF
+      ENDIF
+ 
+      CALL wrk_dealloc( jpi,jpj, ztmp1, ztmp2 )
       !
       IF( nn_timing == 1 )  CALL timing_stop('cice_sbc_init')
@@ -212,12 +267,13 @@
       INTEGER, INTENT(in   ) ::   nsbc ! surface forcing type
 
-      INTEGER  ::   ji, jj, jpl                   ! dummy loop indices      
-      REAL(wp), DIMENSION(:,:), POINTER :: ztmp
+      INTEGER  ::   ji, jj, jl                   ! dummy loop indices      
+      REAL(wp), DIMENSION(:,:), POINTER :: ztmp, zpice
       REAL(wp), DIMENSION(:,:,:), POINTER :: ztmpn
+      REAL(wp) ::   zintb, zintn  ! dummy argument
       !!---------------------------------------------------------------------
 
       IF( nn_timing == 1 )  CALL timing_start('cice_sbc_in')
       !
-      CALL wrk_alloc( jpi,jpj, ztmp )
+      CALL wrk_alloc( jpi,jpj, ztmp, zpice )
       CALL wrk_alloc( jpi,jpj,ncat, ztmpn )
 
@@ -259,6 +315,6 @@
 ! Surface downward latent heat flux (CI_5)
          IF (nsbc == 2) THEN
-            DO jpl=1,ncat
-               ztmpn(:,:,jpl)=qla_ice(:,:,1)*a_i(:,:,jpl)
+            DO jl=1,ncat
+               ztmpn(:,:,jl)=qla_ice(:,:,1)*a_i(:,:,jl)
             ENDDO
          ELSE
@@ -269,12 +325,12 @@
                DO ji=1,jpi
                   IF (fr_i(ji,jj).eq.0.0) THEN
-                     DO jpl=1,ncat
-                        ztmpn(ji,jj,jpl)=0.0
+                     DO jl=1,ncat
+                        ztmpn(ji,jj,jl)=0.0
                      ENDDO
                      ! This will then be conserved in CICE
                      ztmpn(ji,jj,1)=qla_ice(ji,jj,1)
                   ELSE
-                     DO jpl=1,ncat
-                        ztmpn(ji,jj,jpl)=qla_ice(ji,jj,1)*a_i(ji,jj,jpl)/fr_i(ji,jj)
+                     DO jl=1,ncat
+                        ztmpn(ji,jj,jl)=qla_ice(ji,jj,1)*a_i(ji,jj,jl)/fr_i(ji,jj)
                      ENDDO
                   ENDIF
@@ -282,24 +338,24 @@
             ENDDO
          ENDIF
-         DO jpl=1,ncat
-            CALL nemo2cice(ztmpn(:,:,jpl),flatn_f(:,:,jpl,:),'T', 1. )
+         DO jl=1,ncat
+            CALL nemo2cice(ztmpn(:,:,jl),flatn_f(:,:,jl,:),'T', 1. )
 
 ! GBM conductive flux through ice (CI_6)
 !  Convert to GBM
             IF (nsbc == 2) THEN
-               ztmp(:,:) = botmelt(:,:,jpl)*a_i(:,:,jpl)
+               ztmp(:,:) = botmelt(:,:,jl)*a_i(:,:,jl)
             ELSE
-               ztmp(:,:) = botmelt(:,:,jpl)
+               ztmp(:,:) = botmelt(:,:,jl)
             ENDIF
-            CALL nemo2cice(ztmp,fcondtopn_f(:,:,jpl,:),'T', 1. )
+            CALL nemo2cice(ztmp,fcondtopn_f(:,:,jl,:),'T', 1. )
 
 ! GBM surface heat flux (CI_7)
 !  Convert to GBM
             IF (nsbc == 2) THEN
-               ztmp(:,:) = (topmelt(:,:,jpl)+botmelt(:,:,jpl))*a_i(:,:,jpl) 
+               ztmp(:,:) = (topmelt(:,:,jl)+botmelt(:,:,jl))*a_i(:,:,jl) 
             ELSE
-               ztmp(:,:) = (topmelt(:,:,jpl)+botmelt(:,:,jpl))
+               ztmp(:,:) = (topmelt(:,:,jl)+botmelt(:,:,jl))
             ENDIF
-            CALL nemo2cice(ztmp,fsurfn_f(:,:,jpl,:),'T', 1. )
+            CALL nemo2cice(ztmp,fsurfn_f(:,:,jl,:),'T', 1. )
          ENDDO
 
@@ -383,10 +439,27 @@
       CALL nemo2cice(ztmp,vocn,'F', -1. )
 
+      IF( nn_ice_embd == 2 ) THEN             !== embedded sea ice: compute representative ice top surface ==!
+          !
+          ! average interpolation coeff as used in dynspg = (1/nn_fsbc) * {SUM[n/nn_fsbc], n=0,nn_fsbc-1}
+          !                                               = (1/nn_fsbc)^2 * {SUM[n], n=0,nn_fsbc-1}
+         zintn = REAL( nn_fsbc - 1 ) / REAL( nn_fsbc ) * 0.5_wp
+          !
+          ! average interpolation coeff as used in dynspg = (1/nn_fsbc) * {SUM[1-n/nn_fsbc], n=0,nn_fsbc-1}
+          !                                               = (1/nn_fsbc)^2 * (nn_fsbc^2 - {SUM[n], n=0,nn_fsbc-1})
+         zintb = REAL( nn_fsbc + 1 ) / REAL( nn_fsbc ) * 0.5_wp
+          !
+         zpice(:,:) = ssh_m(:,:) + (  zintn * snwice_mass(:,:) +  zintb * snwice_mass_b(:,:)  ) * r1_rau0
+          !
+         !
+      ELSE                                    !== non-embedded sea ice: use ocean surface for slope calculation ==!
+         zpice(:,:) = ssh_m(:,:)
+      ENDIF
+
 ! x comp and y comp of sea surface slope (on F points)
 ! T point to F point
       DO jj=1,jpjm1
          DO ji=1,jpim1
-            ztmp(ji,jj)=0.5 * (  (ssh_m(ji+1,jj  )-ssh_m(ji,jj  ))/e1u(ji,jj  )   &
-                               + (ssh_m(ji+1,jj+1)-ssh_m(ji,jj+1))/e1u(ji,jj+1) ) & 
+            ztmp(ji,jj)=0.5 * (  (zpice(ji+1,jj  )-zpice(ji,jj  ))/e1u(ji,jj  )   &
+                               + (zpice(ji+1,jj+1)-zpice(ji,jj+1))/e1u(ji,jj+1) ) & 
                             *  fmask(ji,jj,1)
          ENDDO
@@ -397,6 +470,6 @@
       DO jj=1,jpjm1
          DO ji=1,jpim1
-            ztmp(ji,jj)=0.5 * (  (ssh_m(ji  ,jj+1)-ssh_m(ji  ,jj))/e2v(ji  ,jj)   &
-                               + (ssh_m(ji+1,jj+1)-ssh_m(ji+1,jj))/e2v(ji+1,jj) ) &
+            ztmp(ji,jj)=0.5 * (  (zpice(ji  ,jj+1)-zpice(ji  ,jj))/e2v(ji  ,jj)   &
+                               + (zpice(ji+1,jj+1)-zpice(ji+1,jj))/e2v(ji+1,jj) ) &
                             *  fmask(ji,jj,1)
          ENDDO
@@ -420,11 +493,11 @@
       INTEGER, INTENT( in  ) ::   nsbc ! surface forcing type
       
-      INTEGER  ::   ji, jj, jpl                 ! dummy loop indices
-      REAL(wp), DIMENSION(:,:), POINTER :: ztmp
+      INTEGER  ::   ji, jj, jl                 ! dummy loop indices
+      REAL(wp), DIMENSION(:,:), POINTER :: ztmp1, ztmp2
       !!---------------------------------------------------------------------
 
       IF( nn_timing == 1 )  CALL timing_start('cice_sbc_out')
       !
-      CALL wrk_alloc( jpi,jpj, ztmp )
+      CALL wrk_alloc( jpi,jpj, ztmp1, ztmp2 )
       
       IF( kt == nit000 )  THEN
@@ -433,10 +506,10 @@
       
 ! x comp of ocean-ice stress 
-      CALL cice2nemo(strocnx,ztmp,'F', -1. )
+      CALL cice2nemo(strocnx,ztmp1,'F', -1. )
       ss_iou(:,:)=0.0
 ! F point to U point
       DO jj=2,jpjm1
          DO ji=2,jpim1
-            ss_iou(ji,jj) = 0.5 * ( ztmp(ji,jj-1) + ztmp(ji,jj) ) * umask(ji,jj,1)
+            ss_iou(ji,jj) = 0.5 * ( ztmp1(ji,jj-1) + ztmp1(ji,jj) ) * umask(ji,jj,1)
          ENDDO
       ENDDO
@@ -444,5 +517,5 @@
 
 ! y comp of ocean-ice stress 
-      CALL cice2nemo(strocny,ztmp,'F', -1. )
+      CALL cice2nemo(strocny,ztmp1,'F', -1. )
       ss_iov(:,:)=0.0
 ! F point to V point
@@ -450,5 +523,5 @@
       DO jj=1,jpjm1
          DO ji=2,jpim1
-            ss_iov(ji,jj) = 0.5 * ( ztmp(ji-1,jj) + ztmp(ji,jj) ) * vmask(ji,jj,1)
+            ss_iov(ji,jj) = 0.5 * ( ztmp1(ji-1,jj) + ztmp1(ji,jj) ) * vmask(ji,jj,1)
          ENDDO
       ENDDO
@@ -473,44 +546,23 @@
          emp(:,:)  = (1.0-fr_i(:,:))*emp(:,:)        
       ELSE IF (nsbc ==5) THEN
-! emp_tot is set in sbc_cpl_ice_flx (call from cice_sbc_in above) 
+! emp_tot is set in sbc_cpl_ice_flx (called from cice_sbc_in above) 
+! This is currently as required with the coupling fields from the UM atmosphere
          emp(:,:) = emp_tot(:,:)+tprecip(:,:)*fr_i(:,:) 
       ENDIF
 
-! Subtract fluxes from CICE to get freshwater equivalent flux used in 
-! salinity calculation
-      CALL cice2nemo(fresh_gbm,ztmp,'T', 1. )
-      emps(:,:)=emp(:,:)-ztmp(:,:)
-! Note the 1000.0 is to convert from kg salt to g salt (needed for PSU)
-      CALL cice2nemo(fsalt_gbm,ztmp,'T', 1. )
-      DO jj=1,jpj
-         DO ji=1,jpi
-            IF (sss_m(ji,jj).gt.0.0) THEN
-               emps(ji,jj)=emps(ji,jj)+ztmp(ji,jj)*1000.0/sss_m(ji,jj)
-            ENDIF
-         ENDDO
-      ENDDO
-
-! No longer remove precip over ice from free surface calculation on basis that the
-! weight of the precip will affect the free surface even if it falls on the ice
-! (same to the argument that freezing / melting of ice doesn't change the free surface) 
-! Sublimation from the ice is treated in a similar way (included in emp but not emps)  
-!
-! This should not be done in the variable volume case
-
-      IF (.NOT. lk_vvl) THEN
-
-         emp(:,:)  = emp(:,:) - tprecip(:,:)*fr_i(:,:)
-
-! Take sublimation into account
-         IF (nsbc == 5 ) THEN 
-            emp(:,:) = emp(:,:) + ( emp_ice(:,:) + sprecip(:,:) )
-         ELSE IF (nsbc == 2 ) THEN
-            emp(:,:) = emp(:,:) - qla_ice(:,:,1) / Lsub
-         ENDIF
-
-      ENDIF
-
+      CALL cice2nemo(fresh_gbm,ztmp1,'T', 1. )
+      CALL cice2nemo(fsalt_gbm,ztmp2,'T', 1. )
+
+! Check to avoid unphysical expression when ice is forming (ztmp1 negative)
+! Otherwise we are effectively allowing ice of higher salinity than the ocean to form
+! which has to be compensated for by the ocean salinity potentially going negative
+! This check breaks conservation but seems reasonable until we have prognostic ice salinity
+! Note the 1000.0 below is to convert from kg salt to g salt (needed for PSU)
+      WHERE (ztmp1(:,:).lt.0.0) ztmp2(:,:)=MAX(ztmp2(:,:),ztmp1(:,:)*sss_m(:,:)/1000.0)
+      sfx(:,:)=ztmp2(:,:)*1000.0
+      emp(:,:)=emp(:,:)-ztmp1(:,:)
+ 
       CALL lbc_lnk( emp , 'T', 1. )
-      CALL lbc_lnk( emps , 'T', 1. )
+      CALL lbc_lnk( sfx , 'T', 1. )
 
 ! Solar penetrative radiation and non solar surface heat flux
@@ -532,6 +584,6 @@
 ! Now add in ice / snow related terms
 ! [fswthru will be zero unless running with calc_Tsfc=T in CICE]
-      CALL cice2nemo(fswthru_gbm,ztmp,'T', 1. )
-      qsr(:,:)=qsr(:,:)+ztmp(:,:)
+      CALL cice2nemo(fswthru_gbm,ztmp1,'T', 1. )
+      qsr(:,:)=qsr(:,:)+ztmp1(:,:)
       CALL lbc_lnk( qsr , 'T', 1. )
 
@@ -542,6 +594,6 @@
       ENDDO
 
-      CALL cice2nemo(fhocn_gbm,ztmp,'T', 1. )
-      qns(:,:)=qns(:,:)+nfrzmlt(:,:)+ztmp(:,:)
+      CALL cice2nemo(fhocn_gbm,ztmp1,'T', 1. )
+      qns(:,:)=qns(:,:)+nfrzmlt(:,:)+ztmp1(:,:)
 
       CALL lbc_lnk( qns , 'T', 1. )
@@ -551,6 +603,6 @@
       CALL cice2nemo(aice,fr_i,'T', 1. )
       IF ( (nsbc == 2).OR.(nsbc == 5) ) THEN
-         DO jpl=1,ncat
-            CALL cice2nemo(aicen(:,:,jpl,:),a_i(:,:,jpl), 'T', 1. )
+         DO jl=1,ncat
+            CALL cice2nemo(aicen(:,:,jl,:),a_i(:,:,jl), 'T', 1. )
          ENDDO
       ENDIF
@@ -568,7 +620,16 @@
       CALL lbc_lnk ( fr_iv , 'V', 1. )
 
+      !                                      ! embedded sea ice
+      IF( nn_ice_embd /= 0 ) THEN            ! mass exchanges between ice and ocean (case 1 or 2) set the snow+ice mass
+         CALL cice2nemo(vsno(:,:,:),ztmp1,'T', 1. )
+         CALL cice2nemo(vice(:,:,:),ztmp2,'T', 1. )
+         snwice_mass  (:,:) = ( rhosn * ztmp1(:,:) + rhoic * ztmp2(:,:)  )
+         snwice_mass_b(:,:) = snwice_mass(:,:)
+         snwice_fmass (:,:) = ( snwice_mass(:,:) - snwice_mass_b(:,:) ) / dt
+      ENDIF
+
 ! Release work space
 
-      CALL wrk_dealloc( jpi,jpj, ztmp )
+      CALL wrk_dealloc( jpi,jpj, ztmp1, ztmp2 )
       !
       IF( nn_timing == 1 )  CALL timing_stop('cice_sbc_out')
@@ -587,5 +648,5 @@
       !!---------------------------------------------------------------------
 
-      INTEGER  ::   jpl                        ! dummy loop index
+      INTEGER  ::   jl                        ! dummy loop index
       INTEGER  ::   ierror
 
@@ -610,7 +671,7 @@
 ! Snow and ice thicknesses (CO_2 and CO_3)
 
-      DO jpl = 1,ncat
-         CALL cice2nemo(vsnon(:,:,jpl,:),ht_s(:,:,jpl),'T', 1. )
-         CALL cice2nemo(vicen(:,:,jpl,:),ht_i(:,:,jpl),'T', 1. )
+      DO jl = 1,ncat
+         CALL cice2nemo(vsnon(:,:,jl,:),ht_s(:,:,jl),'T', 1. )
+         CALL cice2nemo(vicen(:,:,jl,:),ht_i(:,:,jl),'T', 1. )
       ENDDO
       !
@@ -780,4 +841,5 @@
       REAL(wp), DIMENSION(jpi,jpj) :: pn
 #if !defined key_nemocice_decomp
+      REAL(wp), DIMENSION(jpiglo,jpjglo) :: png2
       REAL (kind=dbl_kind), dimension(nx_global,ny_global) :: pcg
 #endif
@@ -798,7 +860,7 @@
       ! Copy local domain data from NEMO to CICE field
       pc(:,:,1)=0.0
-      DO jj=2,ny_block
-         DO ji=2,nx_block
-            pc(ji,jj,1)=pn(ji,jj-1)
+      DO jj=2,ny_block-1
+         DO ji=2,nx_block-1
+            pc(ji,jj,1)=pn(ji-1+ji_off,jj-1+jj_off)
          ENDDO
       ENDDO
@@ -824,8 +886,13 @@
 !        pcg(:,:)=0.0
          DO jn=1,jpnij
-            DO jj=1,nlcjt(jn)-1
-               DO ji=2,nlcit(jn)-1
-                  pcg(ji+nimppt(jn)-2,jj+njmppt(jn)-1)=png(ji,jj,jn)       
+            DO jj=nldjt(jn),nlejt(jn)
+               DO ji=nldit(jn),nleit(jn)
+                  png2(ji+nimppt(jn)-1,jj+njmppt(jn)-1)=png(ji,jj,jn)
                ENDDO
+            ENDDO
+         ENDDO
+         DO jj=1,ny_global
+            DO ji=1,nx_global
+               pcg(ji,jj)=png2(ji+ji_off,jj+jj_off)
             ENDDO
          ENDDO
@@ -922,5 +989,5 @@
       DO jj=1,jpjm1
          DO ji=1,jpim1
-            pn(ji,jj)=pc(ji,jj+1,1)
+            pn(ji,jj)=pc(ji+1-ji_off,jj+1-jj_off,1)
          ENDDO
       ENDDO
@@ -936,11 +1003,13 @@
 ! Need to make sure this is robust to changes in NEMO halo rows....
 ! (may be OK but not spent much time thinking about it)
+! Note that non-existent pcg elements may be used below, but
+! the lbclnk call on pn will replace these with sensible values
 
       IF (nproc==0) THEN
          png(:,:,:)=0.0
          DO jn=1,jpnij
-            DO jj=1,nlcjt(jn)-1
-               DO ji=2,nlcit(jn)-1
-                  png(ji,jj,jn)=pcg(ji+nimppt(jn)-2,jj+njmppt(jn)-1)      
+            DO jj=nldjt(jn),nlejt(jn)
+               DO ji=nldit(jn),nleit(jn)
+                  png(ji,jj,jn)=pcg(ji+nimppt(jn)-1-ji_off,jj+njmppt(jn)-1-jj_off)
                ENDDO
             ENDDO
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_if.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_if.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_if.F90	(revision 3625)
@@ -5,20 +5,21 @@
    !!                   covered area using ice-if model
    !!======================================================================
-   !! History :  3.0   !  2006-06  (G. Madec)  Original code
+   !! History :  3.0  !  2006-06  (G. Madec)  Original code
    !!----------------------------------------------------------------------
 
    !!----------------------------------------------------------------------
-   !!   sbc_ice_if     : update sbc in ice-covered area
+   !!   sbc_ice_if    : update sbc in ice-covered area
    !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE phycst          ! physical constants
-   USE eosbn2          ! equation of state
-   USE sbc_oce         ! surface boundary condition: ocean fields
+   USE oce            ! ocean dynamics and tracers
+   USE dom_oce        ! ocean space and time domain
+   USE phycst         ! physical constants
+   USE eosbn2         ! equation of state
+   USE sbc_oce        ! surface boundary condition: ocean fields
    USE sbccpl
-   USE fldread         ! read input field
-   USE iom             ! I/O manager library
-   USE in_out_manager  ! I/O manager
-   USE lib_mpp         ! MPP library
+   USE fldread        ! read input field
+   USE iom            ! I/O manager library
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -51,5 +52,5 @@
       !!                taum, wndm : remain unchanged
       !!                qns, qsr   : update heat flux below sea-ice
-      !!                emp, emps  : update freshwater flux below sea-ice
+      !!                emp, sfx   : update freshwater flux below sea-ice
       !!                fr_i       : update the ice fraction
       !!---------------------------------------------------------------------
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim.F90	(revision 3625)
@@ -10,5 +10,5 @@
    !!             -   ! 2008-04  (G. Madec)  sltyle and lim_ctl routine
    !!            3.3  ! 2010-11  (G. Madec) ice-ocean stress always computed at each ocean time-step
-   !!            4.0  ! 2011-01  (A Porter)  dynamical allocation
+   !!            3.4  ! 2011-01  (A Porter)  dynamical allocation
    !!----------------------------------------------------------------------
 #if defined key_lim3
@@ -88,5 +88,5 @@
       !! ** Action  : - time evolution of the LIM sea-ice model
       !!              - update all sbc variables below sea-ice:
-      !!                utau, vtau, taum, wndm, qns , qsr, emp , emps
+      !!                utau, vtau, taum, wndm, qns , qsr, emp , sfx 
       !!---------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt      ! ocean time step
@@ -170,25 +170,25 @@
 
          !                                           ! intialisation to zero    !!gm is it truly necessary ???
-         d_a_i_thd  (:,:,:)   = 0.e0   ;   d_a_i_trp  (:,:,:)   = 0.e0
-         d_v_i_thd  (:,:,:)   = 0.e0   ;   d_v_i_trp  (:,:,:)   = 0.e0
-         d_e_i_thd  (:,:,:,:) = 0.e0   ;   d_e_i_trp  (:,:,:,:) = 0.e0
-         d_v_s_thd  (:,:,:)   = 0.e0   ;   d_v_s_trp  (:,:,:)   = 0.e0
-         d_e_s_thd  (:,:,:,:) = 0.e0   ;   d_e_s_trp  (:,:,:,:) = 0.e0
-         d_smv_i_thd(:,:,:)   = 0.e0   ;   d_smv_i_trp(:,:,:)   = 0.e0
-         d_oa_i_thd (:,:,:)   = 0.e0   ;   d_oa_i_trp (:,:,:)   = 0.e0
-         !
-         fseqv    (:,:) = 0.e0
-         fsbri    (:,:) = 0.e0     ;   fsalt_res(:,:) = 0.e0
-         fsalt_rpo(:,:) = 0.e0
-         fhmec    (:,:) = 0.e0     ;   fhbri    (:,:) = 0.e0
-         fmmec    (:,:) = 0.e0     ;   fheat_res(:,:) = 0.e0
-         fheat_rpo(:,:) = 0.e0     ;   focea2D  (:,:) = 0.e0
-         fsup2D   (:,:) = 0.e0
+         d_a_i_thd  (:,:,:)   = 0._wp   ;   d_a_i_trp  (:,:,:)   = 0._wp
+         d_v_i_thd  (:,:,:)   = 0._wp   ;   d_v_i_trp  (:,:,:)   = 0._wp
+         d_e_i_thd  (:,:,:,:) = 0._wp   ;   d_e_i_trp  (:,:,:,:) = 0._wp
+         d_v_s_thd  (:,:,:)   = 0._wp   ;   d_v_s_trp  (:,:,:)   = 0._wp
+         d_e_s_thd  (:,:,:,:) = 0._wp   ;   d_e_s_trp  (:,:,:,:) = 0._wp
+         d_smv_i_thd(:,:,:)   = 0._wp   ;   d_smv_i_trp(:,:,:)   = 0._wp
+         d_oa_i_thd (:,:,:)   = 0._wp   ;   d_oa_i_trp (:,:,:)   = 0._wp
+         !
+         sfx    (:,:) = 0._wp
+         sfx_bri(:,:) = 0._wp   ;   sfx_mec  (:,:) = 0._wp   ;   sfx_res  (:,:) = 0._wp
+         fhbri  (:,:) = 0._wp   ;   fheat_mec(:,:) = 0._wp   ;   fheat_res(:,:) = 0._wp
+         fhmec  (:,:) = 0._wp   ;   
+         fmmec  (:,:) = 0._wp     
+         focea2D(:,:) = 0._wp
+         fsup2D (:,:) = 0._wp
          ! 
-         diag_sni_gr(:,:) = 0.e0   ;   diag_lat_gr(:,:) = 0.e0
-         diag_bot_gr(:,:) = 0.e0   ;   diag_dyn_gr(:,:) = 0.e0
-         diag_bot_me(:,:) = 0.e0   ;   diag_sur_me(:,:) = 0.e0
+         diag_sni_gr(:,:) = 0._wp   ;   diag_lat_gr(:,:) = 0._wp
+         diag_bot_gr(:,:) = 0._wp   ;   diag_dyn_gr(:,:) = 0._wp
+         diag_bot_me(:,:) = 0._wp   ;   diag_sur_me(:,:) = 0._wp
          ! dynamical invariants
-         delta_i(:,:) = 0.e0       ;   divu_i(:,:) = 0.e0       ;   shear_i(:,:) = 0.e0
+         delta_i(:,:) = 0._wp       ;   divu_i(:,:) = 0._wp       ;   shear_i(:,:) = 0._wp
 
                           CALL lim_rst_opn( kt )     ! Open Ice restart file
@@ -196,6 +196,5 @@
          IF( ln_nicep )   CALL lim_prt_state( jiindx, jjindx, 1, ' - Beginning the time step - ' )   ! control print
          !
-         IF( .NOT. lk_c1d ) THEN
-                                                     ! Ice dynamics & transport (not in 1D case)
+         IF( .NOT. lk_c1d ) THEN                     ! Ice dynamics & transport (except in 1D case)
                           CALL lim_dyn( kt )              ! Ice dynamics    ( rheology/dynamics )
                           CALL lim_trp( kt )              ! Ice transport   ( Advection/diffusion )
@@ -210,5 +209,5 @@
                           CALL lim_var_bv                 ! bulk brine volume (diag)
                           CALL lim_thd( kt )              ! Ice thermodynamics 
-                          zcoef = rdt_ice / 86400.e0      !  Ice natural aging
+                          zcoef = rdt_ice /rday           !  Ice natural aging
                           oa_i(:,:,:) = oa_i(:,:,:) + a_i(:,:,:) * zcoef
                           CALL lim_var_glo2eqv            ! this CALL is maybe not necessary (Martin)
@@ -268,5 +267,5 @@
 
       inb_altests = 10
-      inb_alp(:)  = 0
+      inb_alp(:)  =  0
 
       ! Alert if incompatible volume and concentration
@@ -277,5 +276,5 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-               IF(  v_i(ji,jj,jl) /= 0.e0   .AND.   a_i(ji,jj,jl) == 0.e0   ) THEN
+               IF(  v_i(ji,jj,jl) /= 0._wp   .AND.   a_i(ji,jj,jl) == 0._wp   ) THEN
                   WRITE(numout,*) ' ALERTE 2 :   Incompatible volume and concentration '
                   WRITE(numout,*) ' at_i     ', at_i(ji,jj)
@@ -297,5 +296,5 @@
       DO jj = 1, jpj
          DO ji = 1, jpi
-            IF(   ht_i(ji,jj,jl) .GT. 50.0   ) THEN
+            IF(   ht_i(ji,jj,jl)  >  50._wp   ) THEN
                CALL lim_prt_state( ji, jj, 2, ' ALERTE 3 :   Very thick ice ' )
                inb_alp(ialert_id) = inb_alp(ialert_id) + 1
@@ -309,6 +308,6 @@
       DO jj = 1, jpj
          DO ji = 1, jpi
-            IF(   MAX( ABS( u_ice(ji,jj) ), ABS( v_ice(ji,jj) ) ) .GT. 0.5  .AND.  &
-               &  at_i(ji,jj) .GT. 0.e0   ) THEN
+            IF(   MAX( ABS( u_ice(ji,jj) ), ABS( v_ice(ji,jj) ) ) > 0.5  .AND.  &
+               &  at_i(ji,jj) > 0._wp   ) THEN
                CALL lim_prt_state( ji, jj, 1, ' ALERTE 4 :   Very fast ice ' )
                WRITE(numout,*) ' ice strength             : ', strength(ji,jj)
@@ -332,5 +331,5 @@
       DO jj = 1, jpj
          DO ji = 1, jpi
-            IF(   tms(ji,jj) .LE. 0.0   .AND.   at_i(ji,jj) .GT. 0.e0   ) THEN 
+            IF(   tms(ji,jj) <= 0._wp   .AND.   at_i(ji,jj) > 0._wp   ) THEN 
                CALL lim_prt_state( ji, jj, 1, ' ALERTE 6 :   Ice on continents ' )
                WRITE(numout,*) ' masks s, u, v        : ', tms(ji,jj), tmu(ji,jj), tmv(ji,jj) 
@@ -356,7 +355,7 @@
             DO ji = 1, jpi
 !!gm  test twice sm_i ...  ????  bug?
-               IF( ( ( ABS( sm_i(ji,jj,jl) ) .LT. 0.50) .OR. &
-                     ( ABS( sm_i(ji,jj,jl) ) .LT. 0.50) ) .AND. &
-                             ( a_i(ji,jj,jl) .GT. 0.e0 ) ) THEN
+               IF( ( ( ABS( sm_i(ji,jj,jl) ) < 0.5 )   .OR.  &
+                     ( ABS( sm_i(ji,jj,jl) ) < 0.5 ) ) .AND. &
+                             ( a_i(ji,jj,jl) > 0._wp ) ) THEN
 !                 CALL lim_prt_state(ji,jj,1, ' ALERTE 7 :   Very fresh ice ' )
 !                 WRITE(numout,*) ' sst                  : ', sst_m(ji,jj)
@@ -377,7 +376,7 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-               IF ( ( ( ABS( o_i(ji,jj,jl) ) .GT. rdt_ice ) .OR. &
-                      ( ABS( o_i(ji,jj,jl) ) .LT. 0.00) ) .AND. &
-                             ( a_i(ji,jj,jl) .GT. 0.0 ) ) THEN
+               IF ( ( ( ABS( o_i(ji,jj,jl) ) > rdt_ice ) .OR. &
+                      ( ABS( o_i(ji,jj,jl) ) < 0._wp) ) .AND. &
+                             ( a_i(ji,jj,jl) > 0._wp ) ) THEN
                   CALL lim_prt_state( ji, jj, 1, ' ALERTE 9 :   Wrong ice age ')
                   inb_alp(ialert_id) = inb_alp(ialert_id) + 1
@@ -392,5 +391,5 @@
       DO jj = 1, jpj
          DO ji = 1, jpi
-            IF( ABS( emps(ji,jj) ) .GT. 1.0e-2 ) THEN
+            IF( ABS( sfx (ji,jj) ) .GT. 1.0e-2 ) THEN
                CALL lim_prt_state( ji, jj, 3, ' ALERTE 5 :   High salt flux ' )
                DO jl = 1, jpl
@@ -412,5 +411,5 @@
       DO jj = 1, jpj
          DO ji = 1, jpi
-            IF(   ABS( qns(ji,jj) ) .GT. 1500.0   .AND.  ( at_i(ji,jj) .GT. 0.0 ) )  THEN
+            IF(   ABS( qns(ji,jj) ) > 1500._wp  .AND.  at_i(ji,jj) > 0._wp  )  THEN
                !
                WRITE(numout,*) ' ALERTE 8 :   Very high non-solar heat flux'
@@ -429,5 +428,5 @@
                WRITE(numout,*) ' fdtcn     : ', fdtcn(ji,jj) 
                WRITE(numout,*) ' fhmec     : ', fhmec(ji,jj) 
-               WRITE(numout,*) ' fheat_rpo : ', fheat_rpo(ji,jj) 
+               WRITE(numout,*) ' fheat_mec : ', fheat_mec(ji,jj) 
                WRITE(numout,*) ' fheat_res : ', fheat_res(ji,jj) 
                WRITE(numout,*) ' fhbri     : ', fhbri(ji,jj) 
@@ -450,6 +449,6 @@
                DO ji = 1, jpi
                   ztmelts    =  -tmut * s_i(ji,jj,jk,jl) + rtt
-                  IF( t_i(ji,jj,jk,jl) .GE. ztmelts  .AND.  v_i(ji,jj,jl) .GT. 1.e-6   &
-                     &                               .AND.  a_i(ji,jj,jl) .GT. 0.e0    ) THEN
+                  IF( t_i(ji,jj,jk,jl) >= ztmelts  .AND.  v_i(ji,jj,jl) > 1.e-6   &
+                     &                             .AND.  a_i(ji,jj,jl) > 0._wp   ) THEN
                      WRITE(numout,*) ' ALERTE 10 :   Very warm ice'
                      WRITE(numout,*) ' ji, jj, jk, jl : ', ji, jj, jk, jl
@@ -606,11 +605,11 @@
         WRITE(numout,*) ' - Heat / FW fluxes '
         WRITE(numout,*) '   ~~~~~~~~~~~~~~~~ '
-!       WRITE(numout,*) ' fsbri      : ', fsbri(ki,kj)
-!       WRITE(numout,*) ' fseqv      : ', fseqv(ki,kj)
+!       WRITE(numout,*) ' sfx_bri    : ', sfx_bri  (ki,kj)
+!       WRITE(numout,*) ' sfx        : ', sfx      (ki,kj)
 !       WRITE(numout,*) ' fsalt_res  : ', fsalt_res(ki,kj)
-        WRITE(numout,*) ' fmmec      : ', fmmec(ki,kj)
-        WRITE(numout,*) ' fhmec      : ', fhmec(ki,kj)
-        WRITE(numout,*) ' fhbri      : ', fhbri(ki,kj)
-        WRITE(numout,*) ' fheat_rpo  : ', fheat_rpo(ki,kj)
+        WRITE(numout,*) ' fmmec      : ', fmmec    (ki,kj)
+        WRITE(numout,*) ' fhmec      : ', fhmec    (ki,kj)
+        WRITE(numout,*) ' fhbri      : ', fhbri    (ki,kj)
+        WRITE(numout,*) ' fheat_mec  : ', fheat_mec(ki,kj)
         WRITE(numout,*) 
         WRITE(numout,*) ' sst        : ', sst_m(ki,kj)  
@@ -621,8 +620,8 @@
         WRITE(numout,*) ' utau_ice   : ', utau_ice(ki,kj) 
         WRITE(numout,*) ' vtau_ice   : ', vtau_ice(ki,kj)
-        WRITE(numout,*) ' utau       : ', utau(ki,kj) 
-        WRITE(numout,*) ' vtau       : ', vtau(ki,kj)
-        WRITE(numout,*) ' oc. vel. u : ', u_oce(ki,kj)
-        WRITE(numout,*) ' oc. vel. v : ', v_oce(ki,kj)
+        WRITE(numout,*) ' utau       : ', utau    (ki,kj) 
+        WRITE(numout,*) ' vtau       : ', vtau    (ki,kj)
+        WRITE(numout,*) ' oc. vel. u : ', u_oce   (ki,kj)
+        WRITE(numout,*) ' oc. vel. v : ', v_oce   (ki,kj)
      ENDIF
 
@@ -640,16 +639,15 @@
         WRITE(numout,*)
         WRITE(numout,*) ' - Heat fluxes at bottom interface ***'
-        WRITE(numout,*) ' qsr        : ', qsr(ki,kj)
-        WRITE(numout,*) ' qns        : ', qns(ki,kj)
+        WRITE(numout,*) ' qsr       : ', qsr(ki,kj)
+        WRITE(numout,*) ' qns       : ', qns(ki,kj)
         WRITE(numout,*)
         WRITE(numout,*) ' - Salt fluxes at bottom interface ***'
-        WRITE(numout,*) ' emps       : ', emps(ki,kj)
-        WRITE(numout,*) ' emp        : ', emp(ki,kj)
-        WRITE(numout,*) ' fsbri      : ', fsbri(ki,kj)
-        WRITE(numout,*) ' fseqv      : ', fseqv(ki,kj)
-        WRITE(numout,*) ' fsalt_res  : ', fsalt_res(ki,kj)
-        WRITE(numout,*) ' fsalt_rpo  : ', fsalt_rpo(ki,kj)
+        WRITE(numout,*) ' emp       : ', emp    (ki,kj)
+        WRITE(numout,*) ' sfx_bri   : ', sfx_bri(ki,kj)
+        WRITE(numout,*) ' sfx       : ', sfx    (ki,kj)
+        WRITE(numout,*) ' sfx_res   : ', sfx_res(ki,kj)
+        WRITE(numout,*) ' sfx_mec   : ', sfx_mec(ki,kj)
         WRITE(numout,*) ' - Heat fluxes at bottom interface ***'
-        WRITE(numout,*) ' fheat_res  : ', fheat_res(ki,kj)
+        WRITE(numout,*) ' fheat_res : ', fheat_res(ki,kj)
         WRITE(numout,*)
         WRITE(numout,*) ' - Momentum fluxes '
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcice_lim_2.F90	(revision 3625)
@@ -82,5 +82,5 @@
       !! ** Action  : - time evolution of the LIM sea-ice model
       !!              - update all sbc variables below sea-ice:
-      !!                utau, vtau, taum, wndm, qns , qsr, emp , emps
+      !!                utau, vtau, taum, wndm, qns , qsr, emp , sfx 
       !!---------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt      ! ocean time step
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 3625)
@@ -12,4 +12,5 @@
    !!             -   ! 2010-10  (J. Chanut, C. Bricaud, G. Madec)  add the surface pressure forcing
    !!            3.4  ! 2011-11  (C. Harris) CICE added as an option
+   !!            3.5  ! 2012-11  (A. Coward, G. Madec) Rethink of heat, mass and salt surface fluxes
    !!----------------------------------------------------------------------
 
@@ -84,6 +85,7 @@
       INTEGER ::   icpt   ! local integer
       !!
-      NAMELIST/namsbc/ nn_fsbc   , ln_ana , ln_flx  , ln_blk_clio, ln_blk_core, ln_cpl,   &
-         &             ln_blk_mfs, ln_apr_dyn, nn_ice , ln_dm2dc, ln_rnf, ln_ssr     , nn_fwb, ln_cdgw
+      NAMELIST/namsbc/ nn_fsbc   , ln_ana    , ln_flx,  ln_blk_clio, ln_blk_core, ln_cpl,   &
+         &             ln_blk_mfs, ln_apr_dyn, nn_ice,  nn_ice_embd, ln_dm2dc   , ln_rnf,   &
+         &             ln_ssr    , nn_fwb    , ln_cdgw
       !!----------------------------------------------------------------------
 
@@ -121,4 +123,5 @@
          WRITE(numout,*) '              Patm gradient added in ocean & ice Eqs.    ln_apr_dyn  = ', ln_apr_dyn
          WRITE(numout,*) '              ice management in the sbc (=0/1/2/3)       nn_ice      = ', nn_ice 
+         WRITE(numout,*) '              ice-ocean embedded/levitating (=0/1/2)     nn_ice_embd = ', nn_ice_embd
          WRITE(numout,*) '              daily mean to diurnal cycle qsr            ln_dm2dc    = ', ln_dm2dc 
          WRITE(numout,*) '              runoff / runoff mouths                     ln_rnf      = ', ln_rnf
@@ -136,9 +139,12 @@
          IF( sbc_rnf_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'sbc_init : unable to allocate sbc_rnf arrays' )
          nkrnf         = 0
-         rnf     (:,:) = 0.e0
-         rnfmsk  (:,:) = 0.e0
-         rnfmsk_z(:)   = 0.e0
+         rnf     (:,:) = 0.0_wp
+         rnfmsk  (:,:) = 0.0_wp
+         rnfmsk_z(:)   = 0.0_wp
       ENDIF
       IF( nn_ice == 0  )   fr_i(:,:) = 0.e0        ! no ice in the domain, ice fraction is always zero
+
+      sfx(:,:) = 0.0_wp                            ! the salt flux due to freezing/melting will be computed (i.e. will be non-zero) 
+                                                   ! only if sea-ice is present
 
       !                                            ! restartability   
@@ -157,6 +163,8 @@
       IF( nn_ice == 4 .AND. .NOT.( ln_blk_core .OR. lk_cpl ) )   &
          &   CALL ctl_stop( 'CICE sea-ice model requires ln_blk_core or lk_cpl' )
-      IF( nn_ice == 4 .AND. ( .NOT. ( cp_cfg == 'orca' ) .OR. lk_agrif ) )   &
-         &   CALL ctl_stop( 'CICE sea-ice model currently only available in a global ORCA configuration without AGRIF' )
+      IF( nn_ice == 4 .AND. lk_agrif )   &
+         &   CALL ctl_stop( 'CICE sea-ice model not currently available with AGRIF' )
+      IF( ( nn_ice == 3 .OR. nn_ice == 4 ) .AND. nn_ice_embd == 0 )   &
+         &   CALL ctl_stop( 'LIM3 and CICE sea-ice models require nn_ice_embd = 2 or 3' )
       
       IF( ln_dm2dc )   nday_qsr = -1   ! initialisation flag
@@ -226,6 +234,6 @@
       !! ** Action  : - set the ocean surface boundary condition at before and now 
       !!                time step, i.e.  
-      !!                utau_b, vtau_b, qns_b, qsr_b, emp_n, emps_b, qrp_b, erp_b
-      !!                utau  , vtau  , qns  , qsr  , emp  , emps  , qrp  , erp
+      !!                utau_b, vtau_b, qns_b, qsr_b, emp_n, sfx_b, qrp_b, erp_b
+      !!                utau  , vtau  , qns  , qsr  , emp  , sfx  , qrp  , erp
       !!              - updte the ice fraction : fr_i
       !!----------------------------------------------------------------------
@@ -243,6 +251,6 @@
          ! The 3D heat content due to qsr forcing is treated in traqsr
          ! qsr_b (:,:) = qsr (:,:)
-         emp_b (:,:) = emp (:,:)
-         emps_b(:,:) = emps(:,:)
+         emp_b(:,:) = emp(:,:)
+         sfx_b(:,:) = sfx(:,:)
       ENDIF
       !                                            ! ---------------------------------------- !
@@ -262,5 +270,5 @@
                                                             
       SELECT CASE( nsbc )                                ! Compute ocean surface boundary condition
-      !                                                  ! (i.e. utau,vtau, qns, qsr, emp, emps)
+      !                                                  ! (i.e. utau,vtau, qns, qsr, emp, sfx)
       CASE(  0 )   ;   CALL sbc_gyre    ( kt )                    ! analytical formulation : GYRE configuration
       CASE(  1 )   ;   CALL sbc_ana     ( kt )                    ! analytical formulation : uniform sbc
@@ -314,7 +322,12 @@
             CALL iom_get( numror, jpdom_autoglo, 'qns_b' , qns_b  )   ! before non solar heat flux (T-point)
             ! The 3D heat content due to qsr forcing is treated in traqsr
-            ! CALL iom_get( numror, jpdom_autoglo, 'qsr_b' , qsr_b  )   ! before     solar heat flux (T-point)
-            CALL iom_get( numror, jpdom_autoglo, 'emp_b' , emp_b  )   ! before     freshwater flux (T-point)
-            CALL iom_get( numror, jpdom_autoglo, 'emps_b', emps_b )   ! before C/D freshwater flux (T-point)
+            ! CALL iom_get( numror, jpdom_autoglo, 'qsr_b' , qsr_b  ) ! before     solar heat flux (T-point)
+            CALL iom_get( numror, jpdom_autoglo, 'emp_b', emp_b  )    ! before     freshwater flux (T-point)
+            ! To ensure restart capability with 3.3x/3.4 restart files    !! to be removed in v3.6
+            IF( iom_varid( numror, 'sfx_b', ldstop = .FALSE. ) > 0 ) THEN
+               CALL iom_get( numror, jpdom_autoglo, 'sfx_b', sfx_b )  ! before salt flux (T-point)
+            ELSE
+               sfx_b (:,:) = sfx(:,:)
+            ENDIF
          ELSE                                                   !* no restart: set from nit000 values
             IF(lwp) WRITE(numout,*) '          nit000-1 surface forcing fields set to nit000'
@@ -322,7 +335,6 @@
             vtau_b(:,:) = vtau(:,:)
             qns_b (:,:) = qns (:,:)
-            ! qsr_b (:,:) = qsr (:,:)
-            emp_b (:,:) = emp (:,:)
-            emps_b(:,:) = emps(:,:)
+            emp_b (:,:) = emp(:,:)
+            sfx_b (:,:) = sfx(:,:)
          ENDIF
       ENDIF
@@ -340,5 +352,5 @@
          ! CALL iom_rstput( kt, nitrst, numrow, 'qsr_b'  , qsr  )
          CALL iom_rstput( kt, nitrst, numrow, 'emp_b'  , emp  )
-         CALL iom_rstput( kt, nitrst, numrow, 'emps_b' , emps )
+         CALL iom_rstput( kt, nitrst, numrow, 'sfx_b' , sfx )
       ENDIF
 
@@ -348,5 +360,7 @@
       IF( MOD( kt-1, nn_fsbc ) == 0 ) THEN
          CALL iom_put( "empmr" , emp  - rnf )                   ! upward water flux
-         CALL iom_put( "empsmr", emps - rnf )                   ! c/d water flux
+         CALL iom_put( "saltflx", sfx  )                        ! downward salt flux  
+                                                                ! (includes virtual salt flux beneath ice 
+                                                                ! in linear free surface case)
          CALL iom_put( "qt"    , qns  + qsr )                   ! total heat flux 
          CALL iom_put( "qns"   , qns        )                   ! solar heat flux
@@ -365,5 +379,5 @@
          CALL prt_ctl(tab2d_1=fr_i             , clinfo1=' fr_i     - : ', mask1=tmask, ovlap=1 )
          CALL prt_ctl(tab2d_1=(emp-rnf)        , clinfo1=' emp-rnf  - : ', mask1=tmask, ovlap=1 )
-         CALL prt_ctl(tab2d_1=(emps-rnf)       , clinfo1=' emps-rnf - : ', mask1=tmask, ovlap=1 )
+         CALL prt_ctl(tab2d_1=(sfx-rnf)        , clinfo1=' sfx-rnf  - : ', mask1=tmask, ovlap=1 )
          CALL prt_ctl(tab2d_1=qns              , clinfo1=' qns      - : ', mask1=tmask, ovlap=1 )
          CALL prt_ctl(tab2d_1=qsr              , clinfo1=' qsr      - : ', mask1=tmask, ovlap=1 )
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcrnf.F90	(revision 3625)
@@ -56,5 +56,4 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   rnf_tsc_b, rnf_tsc  !: before and now T & S runoff contents   [K.m/s & PSU.m/s]
    
-   REAL(wp) ::   r1_rau0   ! = 1 / rau0 
 
    TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_rnf       ! structure: river runoff (file information, fields read)
@@ -83,4 +82,5 @@
    END FUNCTION sbc_rnf_alloc
 
+
    SUBROUTINE sbc_rnf( kt )
       !!----------------------------------------------------------------------
@@ -96,5 +96,5 @@
       !!----------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt          ! ocean time step
-      !!
+      !
       INTEGER  ::   ji, jj   ! dummy loop indices
       !!----------------------------------------------------------------------
@@ -127,7 +127,7 @@
          !
          IF( MOD( kt - 1, nn_fsbc ) == 0 ) THEN
-            rnf(:,:) = rn_rfact * ( sf_rnf(1)%fnow(:,:,1) )  
             !
-            r1_rau0 = 1._wp / rau0
+            rnf(:,:) = rn_rfact * ( sf_rnf(1)%fnow(:,:,1) )       ! updated runoff value at time step kt
+            !
             !                                                     ! set temperature & salinity content of runoffs
             IF( ln_rnf_tem ) THEN                                       ! use runoffs temperature data
@@ -199,5 +199,4 @@
       !!
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
-      REAL(wp) ::   r1_rau0   ! local scalar
       REAL(wp) ::   zfact     ! local scalar
       !!----------------------------------------------------------------------
@@ -205,5 +204,4 @@
       zfact = 0.5_wp
       !
-      r1_rau0 = 1._wp / rau0
       IF( ln_rnf_depth ) THEN      !==   runoff distributed over several levels   ==!
          IF( lk_vvl ) THEN             ! variable volume case 
@@ -252,10 +250,10 @@
       INTEGER           ::   ji, jj, jk    ! dummy loop indices
       INTEGER           ::   ierror, inum  ! temporary integer
-      !! 
+      !
       NAMELIST/namsbc_rnf/ cn_dir, ln_rnf_emp, ln_rnf_depth, ln_rnf_tem, ln_rnf_sal,   &
          &                 sn_rnf, sn_cnf    , sn_s_rnf    , sn_t_rnf  , sn_dep_rnf,   &  
          &                 ln_rnf_mouth      , rn_hrnf     , rn_avt_rnf, rn_rfact  
       !!----------------------------------------------------------------------
-
+      !
       !                                   ! ============
       !                                   !   Namelist
@@ -273,5 +271,5 @@
       REWIND ( numnam )                         ! Read Namelist namsbc_rnf
       READ   ( numnam, namsbc_rnf )
-
+      !
       !                                         ! Control print
       IF(lwp) THEN
@@ -286,5 +284,5 @@
          WRITE(numout,*) '      multiplicative factor for runoff           rn_rfact     = ', rn_rfact    
       ENDIF
-
+      !
       !                                   ! ==================
       !                                   !   Type of runoff
@@ -395,6 +393,5 @@
             nkrnf = 2
             DO WHILE( nkrnf /= jpkm1 .AND. gdepw_0(nkrnf+1) < rn_hrnf )   ;   nkrnf = nkrnf + 1   ;   END DO
-            IF( ln_sco )   &
-               CALL ctl_warn( 'sbc_rnf: number of levels over which Kz is increased is computed for zco...' )
+            IF( ln_sco )   CALL ctl_warn( 'sbc_rnf: number of levels over which Kz is increased is computed for zco...' )
          ENDIF
          IF(lwp) WRITE(numout,*)
@@ -414,5 +411,5 @@
          nkrnf = 0
       ENDIF
-
+      !
    END SUBROUTINE sbc_rnf_init
 
@@ -438,5 +435,4 @@
       !!                rnfmsk_z vertical structure
       !!----------------------------------------------------------------------
-      !
       INTEGER            ::   inum        ! temporary integers
       CHARACTER(len=140) ::   cl_rnfile   ! runoff file name
@@ -446,17 +442,17 @@
       IF(lwp) WRITE(numout,*) 'rnf_mouth : river mouth mask'
       IF(lwp) WRITE(numout,*) '~~~~~~~~~ '
-
+      !
       cl_rnfile = TRIM( cn_dir )//TRIM( sn_cnf%clname )
       IF( .NOT. sn_cnf%ln_clim ) THEN   ;   WRITE(cl_rnfile, '(a,"_y",i4)' ) TRIM( cl_rnfile ), nyear    ! add year
          IF( sn_cnf%cltype == 'monthly' )   WRITE(cl_rnfile, '(a,"m",i2)'  ) TRIM( cl_rnfile ), nmonth   ! add month
       ENDIF
-  
+      !
       ! horizontal mask (read in NetCDF file)
       CALL iom_open ( cl_rnfile, inum )                           ! open file
       CALL iom_get  ( inum, jpdom_data, sn_cnf%clvar, rnfmsk )    ! read the river mouth array
       CALL iom_close( inum )                                      ! close file
-      
+      !
       IF( nclosea == 1 )    CALL clo_rnf( rnfmsk )                ! closed sea inflow set as ruver mouth
-
+      !
       rnfmsk_z(:)   = 0._wp                                        ! vertical structure 
       rnfmsk_z(1)   = 1.0
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssr.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssr.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssr.F90	(revision 3625)
@@ -9,17 +9,18 @@
 
    !!----------------------------------------------------------------------
-   !!   sbc_ssr        : add to sbc a restoring term toward SST/SSS climatology
-   !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and tracers
-   USE dom_oce         ! ocean space and time domain
-   USE sbc_oce         ! surface boundary condition
-   USE phycst          ! physical constants
-   USE sbcrnf          ! surface boundary condition : runoffs
-   USE fldread         ! read input fields
-   USE iom             ! I/O manager
-   USE in_out_manager  ! I/O manager
-   USE lib_mpp         ! distribued memory computing library
-   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE timing          ! Timing
+   !!   sbc_ssr       : add to sbc a restoring term toward SST/SSS climatology
+   !!----------------------------------------------------------------------
+   USE oce            ! ocean dynamics and tracers
+   USE dom_oce        ! ocean space and time domain
+   USE sbc_oce        ! surface boundary condition
+   USE phycst         ! physical constants
+   USE sbcrnf         ! surface boundary condition : runoffs
+   USE fldread        ! read input fields
+   USE iom            ! I/O manager
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! distribued memory computing library
+   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
+   USE timing         ! Timing
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -63,6 +64,6 @@
       !!              - at each nscb time step
       !!                   add a retroaction term on qns    (nn_sstr = 1)
-      !!                   add a damping term on emps       (nn_sssr = 1)
-      !!                   add a damping term on emp & emps (nn_sssr = 2)
+      !!                   add a damping term on sfx        (nn_sssr = 1)
+      !!                   add a damping term on emp        (nn_sssr = 2)
       !!---------------------------------------------------------------------
       INTEGER, INTENT(in   ) ::   kt   ! ocean time step
@@ -156,5 +157,5 @@
             !                                      ! ========================= !
             !
-            IF( nn_sstr == 1 ) THEN                   !* Temperature restoring term
+            IF( nn_sstr == 1 ) THEN                                   !* Temperature restoring term
 !CDIR COLLAPSE
                DO jj = 1, jpj
@@ -168,5 +169,5 @@
             ENDIF
             !
-            IF( nn_sssr == 1 ) THEN                   !* Salinity damping term (salt flux, emps only)
+            IF( nn_sssr == 1 ) THEN                                   !* Salinity damping term (salt flux only (sfx))
                zsrp = rn_deds / rday                                  ! from [mm/day] to [kg/m2/s]
 !CDIR COLLAPSE
@@ -174,13 +175,12 @@
                   DO ji = 1, jpi
                      zerp = zsrp * ( 1. - 2.*rnfmsk(ji,jj) )   &      ! No damping in vicinity of river mouths
-                        &        * ( sss_m(ji,jj) - sf_sss(1)%fnow(ji,jj,1) )   &
-                        &        / ( sss_m(ji,jj) + 1.e-20   )
-                     emps(ji,jj) = emps(ji,jj) + zerp
-                     erp( ji,jj) = zerp
+                        &        * ( sss_m(ji,jj) - sf_sss(1)%fnow(ji,jj,1) ) 
+                     sfx(ji,jj) = sfx(ji,jj) + zerp                 ! salt flux
+                     erp(ji,jj) = zerp / MAX( sss_m(ji,jj), 1.e-20 ) ! converted into an equivalent volume flux (diagnostic only)
                   END DO
                END DO
                CALL iom_put( "erp", erp )                             ! freshwater flux damping
                !
-            ELSEIF( nn_sssr == 2 ) THEN               !* Salinity damping term (volume flux, emp and emps)
+            ELSEIF( nn_sssr == 2 ) THEN                               !* Salinity damping term (volume flux (emp) and associated heat flux (qns)
                zsrp = rn_deds / rday                                  ! from [mm/day] to [kg/m2/s]
                zerp_bnd = rn_sssr_bnd / rday                          !       -              -    
@@ -190,9 +190,9 @@
                      zerp = zsrp * ( 1. - 2.*rnfmsk(ji,jj) )   &      ! No damping in vicinity of river mouths
                         &        * ( sss_m(ji,jj) - sf_sss(1)%fnow(ji,jj,1) )   &
-                        &        / ( sss_m(ji,jj) + 1.e-20   )
+                        &        / MAX(  sss_m(ji,jj), 1.e-20   )
                      IF( ln_sssr_bnd )   zerp = SIGN( 1., zerp ) * MIN( zerp_bnd, ABS(zerp) )
-                     emp (ji,jj) = emp (ji,jj) + zerp
-                     emps(ji,jj) = emps(ji,jj) + zerp
-                     erp (ji,jj) = zerp
+                     emp(ji,jj) = emp (ji,jj) + zerp
+                     qns(ji,jj) = qns(ji,jj) - zerp * rcp * sst_m(ji,jj)
+                     erp(ji,jj) = zerp
                   END DO
                END DO
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/eosbn2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/eosbn2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/eosbn2.F90	(revision 3625)
@@ -121,5 +121,4 @@
       REAL(wp) ::   zd , zc , zaw, za    !   -      -
       REAL(wp) ::   zb1, za1, zkw, zk0   !   -      -
-      REAL(wp) ::   zrau0r               !   -      -
       REAL(wp), POINTER, DIMENSION(:,:,:) :: zws
       !!----------------------------------------------------------------------
@@ -133,5 +132,4 @@
       !
       CASE( 0 )                !==  Jackett and McDougall (1994) formulation  ==!
-         zrau0r = 1.e0 / rau0
 !CDIR NOVERRCHK
          zws(:,:,:) = SQRT( ABS( pts(:,:,:,jp_sal) ) )
@@ -174,5 +172,5 @@
                   ! masked in situ density anomaly
                   prd(ji,jj,jk) = (  zrhop / (  1.0_wp - zh / ( zk0 - zh * ( za - zh * zb ) )  )    &
-                     &             - rau0  ) * zrau0r * tmask(ji,jj,jk)
+                     &             - rau0  ) * r1_rau0 * tmask(ji,jj,jk)
                END DO
             END DO
@@ -254,5 +252,5 @@
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
       REAL(wp) ::   zt, zs, zh, zsr, zr1, zr2, zr3, zr4, zrhop, ze, zbw   ! local scalars
-      REAL(wp) ::   zb, zd, zc, zaw, za, zb1, za1, zkw, zk0, zrau0r       !   -      -
+      REAL(wp) ::   zb, zd, zc, zaw, za, zb1, za1, zkw, zk0               !   -      -
       REAL(wp), POINTER, DIMENSION(:,:,:) :: zws
       !!----------------------------------------------------------------------
@@ -265,5 +263,4 @@
       !
       CASE( 0 )                !==  Jackett and McDougall (1994) formulation  ==!
-         zrau0r = 1.e0 / rau0
 !CDIR NOVERRCHK
          zws(:,:,:) = SQRT( ABS( pts(:,:,:,jp_sal) ) )
@@ -309,5 +306,5 @@
                   ! masked in situ density anomaly
                   prd(ji,jj,jk) = (  zrhop / (  1.0_wp - zh / ( zk0 - zh * ( za - zh * zb ) )  )    &
-                     &             - rau0  ) * zrau0r * tmask(ji,jj,jk)
+                     &             - rau0  ) * r1_rau0 * tmask(ji,jj,jk)
                END DO
             END DO
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_muscl.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_muscl.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_muscl.F90	(revision 3625)
@@ -14,17 +14,18 @@
    !!                   and vertical advection trends using MUSCL scheme
    !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and active tracers
-   USE dom_oce         ! ocean space and time domain
-   USE trdmod_oce      ! tracers trends 
-   USE trdtra      ! tracers trends 
-   USE in_out_manager  ! I/O manager
-   USE dynspg_oce      ! choice/control of key cpp for surface pressure gradient
-   USE trabbl          ! tracers: bottom boundary layer
-   USE lib_mpp         ! distribued memory computing
-   USE lbclnk          ! ocean lateral boundary condition (or mpp link) 
-   USE diaptr          ! poleward transport diagnostics
-   USE trc_oce         ! share passive tracers/Ocean variables
-   USE wrk_nemo        ! Memory Allocation
-   USE timing          ! Timing
+   USE oce            ! ocean dynamics and active tracers
+   USE dom_oce        ! ocean space and time domain
+   USE trdmod_oce     ! tracers trends 
+   USE trdtra         ! tracers trends 
+   USE in_out_manager ! I/O manager
+   USE dynspg_oce     ! choice/control of key cpp for surface pressure gradient
+   USE trabbl         ! tracers: bottom boundary layer
+   USE lib_mpp        ! distribued memory computing
+   USE lbclnk         ! ocean lateral boundary condition (or mpp link) 
+   USE diaptr         ! poleward transport diagnostics
+   USE trc_oce        ! share passive tracers/Ocean variables
+   USE wrk_nemo       ! Memory Allocation
+   USE timing         ! Timing
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_muscl2.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_muscl2.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_muscl2.F90	(revision 3625)
@@ -25,5 +25,5 @@
    USE wrk_nemo        ! Memory Allocation
    USE timing          ! Timing
-
+   USE lib_fortran     ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_qck.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_qck.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_qck.F90	(revision 3625)
@@ -28,4 +28,5 @@
    USE wrk_nemo        ! Memory Allocation
    USE timing          ! Timing
+   USE lib_fortran     ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_tvd.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_tvd.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_tvd.F90	(revision 3625)
@@ -17,21 +17,20 @@
 
    !!----------------------------------------------------------------------
-   !!   tra_adv_tvd  : update the tracer trend with the horizontal
-   !!                  and vertical advection trends using a TVD scheme
-   !!   nonosc       : compute monotonic tracer fluxes by a nonoscillatory
-   !!                  algorithm 
-   !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and active tracers
-   USE dom_oce         ! ocean space and time domain
-   USE trdmod_oce      ! tracers trends
-   USE trdtra          ! tracers trends
-   USE in_out_manager  ! I/O manager
-   USE dynspg_oce      ! choice/control of key cpp for surface pressure gradient
-   USE lib_mpp         ! MPP library
-   USE lbclnk          ! ocean lateral boundary condition (or mpp link) 
-   USE diaptr          ! poleward transport diagnostics
-   USE trc_oce         ! share passive tracers/Ocean variables
-   USE wrk_nemo        ! Memory Allocation
-   USE timing          ! Timing
+   !!   tra_adv_tvd   : update the tracer trend with the 3D advection trends using a TVD scheme
+   !!   nonosc        : compute monotonic tracer fluxes by a non-oscillatory algorithm 
+   !!----------------------------------------------------------------------
+   USE oce            ! ocean dynamics and active tracers
+   USE dom_oce        ! ocean space and time domain
+   USE trdmod_oce     ! tracers trends
+   USE trdtra         ! tracers trends
+   USE in_out_manager ! I/O manager
+   USE dynspg_oce     ! choice/control of key cpp for surface pressure gradient
+   USE lib_mpp        ! MPP library
+   USE lbclnk         ! ocean lateral boundary condition (or mpp link) 
+   USE diaptr         ! poleward transport diagnostics
+   USE trc_oce        ! share passive tracers/Ocean variables
+   USE wrk_nemo       ! Memory Allocation
+   USE timing         ! Timing
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_ubs.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_ubs.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_ubs.F90	(revision 3625)
@@ -12,16 +12,17 @@
    !!                 advection trends using a third order biaised scheme  
    !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and active tracers
-   USE dom_oce         ! ocean space and time domain
-   USE trdmod_oce         ! ocean space and time domain
+   USE oce            ! ocean dynamics and active tracers
+   USE dom_oce        ! ocean space and time domain
+   USE trdmod_oce     ! ocean space and time domain
    USE trdtra
    USE lib_mpp
-   USE lbclnk          ! ocean lateral boundary condition (or mpp link)
-   USE in_out_manager  ! I/O manager
-   USE diaptr          ! poleward transport diagnostics
-   USE dynspg_oce      ! choice/control of key cpp for surface pressure gradient
-   USE trc_oce         ! share passive tracers/Ocean variables
-   USE wrk_nemo        ! Memory Allocation
-   USE timing          ! Timing
+   USE lbclnk         ! ocean lateral boundary condition (or mpp link)
+   USE in_out_manager ! I/O manager
+   USE diaptr         ! poleward transport diagnostics
+   USE dynspg_oce     ! choice/control of key cpp for surface pressure gradient
+   USE trc_oce        ! share passive tracers/Ocean variables
+   USE wrk_nemo       ! Memory Allocation
+   USE timing         ! Timing
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/trabbc.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/trabbc.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/trabbc.F90	(revision 3625)
@@ -155,5 +155,5 @@
          CASE ( 1 )                          !* constant flux
             IF(lwp) WRITE(numout,*) '      *** constant heat flux  =   ', rn_geoflx_cst
-            qgh_trd0(:,:) = ro0cpr * rn_geoflx_cst
+            qgh_trd0(:,:) = r1_rau0_rcp * rn_geoflx_cst
             !
          CASE ( 2 )                          !* variable geothermal heat flux : read the geothermal fluxes in mW/m2
@@ -162,5 +162,5 @@
             CALL iom_get  ( inum, jpdom_data, 'heatflow', qgh_trd0 )
             CALL iom_close( inum )
-            qgh_trd0(:,:) = ro0cpr * qgh_trd0(:,:) * 1.e-3     ! conversion in W/m2
+            qgh_trd0(:,:) = r1_rau0_rcp * qgh_trd0(:,:) * 1.e-3     ! conversion in W/m2
             !
          CASE DEFAULT
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 3625)
@@ -147,5 +147,5 @@
          !                                        ! ============================================== !
          DO jk = 1, jpkm1
-            qsr_hc(:,:,jk) = ro0cpr * ( etot3(:,:,jk) - etot3(:,:,jk+1) )
+            qsr_hc(:,:,jk) = r1_rau0_rcp * ( etot3(:,:,jk) - etot3(:,:,jk+1) )
          END DO
          !                                        Add to the general trend
@@ -219,5 +219,5 @@
                !
                DO jk = 1, nksr                                        ! compute and add qsr trend to ta
-                  qsr_hc(:,:,jk) = ro0cpr * ( zea(:,:,jk) - zea(:,:,jk+1) )
+                  qsr_hc(:,:,jk) = r1_rau0_rcp * ( zea(:,:,jk) - zea(:,:,jk+1) )
                END DO
                zea(:,:,nksr+1:jpk) = 0.e0     ! below 400m set to zero
@@ -236,6 +236,6 @@
             !
             IF( lk_vvl ) THEN                                  !* variable volume
-               zz0   =        rn_abs   * ro0cpr
-               zz1   = ( 1. - rn_abs ) * ro0cpr
+               zz0   =        rn_abs   * r1_rau0_rcp
+               zz1   = ( 1. - rn_abs ) * r1_rau0_rcp
                DO jk = 1, nksr                    ! solar heat absorbed at T-point in the top 400m 
                   DO jj = 1, jpj
@@ -463,5 +463,5 @@
                   !
                   DO jk = 1, nksr
-                     etot3(:,:,jk) = ro0cpr * ( zea(:,:,jk) - zea(:,:,jk+1) ) 
+                     etot3(:,:,jk) = r1_rau0_rcp * ( zea(:,:,jk) - zea(:,:,jk+1) ) 
                   END DO
                   etot3(:,:,nksr+1:jpk) = 0.e0                ! below 400m set to zero
@@ -484,6 +484,6 @@
                IF(lwp) WRITE(numout,*) '        key_vvl: light distribution will be computed at each time step'
             ELSE                                ! constant volume: computes one for all
-               zz0 =        rn_abs   * ro0cpr
-               zz1 = ( 1. - rn_abs ) * ro0cpr
+               zz0 =        rn_abs   * r1_rau0_rcp
+               zz1 = ( 1. - rn_abs ) * r1_rau0_rcp
                DO jk = 1, nksr                    !*  solar heat absorbed at T-point computed once for all
                   DO jj = 1, jpj                              ! top 400 meters
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90	(revision 3625)
@@ -60,4 +60,6 @@
       !!         at the surface by evaporation, precipitations and runoff (E-P-R); 
       !!      (3) Fwe, tracer carried with the water that is exchanged. 
+      !!            - salinity    : salt flux only due to freezing/melting
+      !!            sa = sa +  sfx / rau0 / e3t  for k=1
       !!
       !!      Fext, flux through the air-sea interface for temperature and salt: 
@@ -84,9 +86,11 @@
       !!            (Tp P - Te E) + SST (P-E) = 0 when Tp=Te=SST
       !!            - salinity    : evaporation, precipitation and runoff
-      !!         water has a zero salinity (Fwe=0), thus only Fwi remains:
-      !!            sa = sa + emp * sn / e3t   for k=1
+      !!         water has a zero salinity  but there is a salt flux due to 
+      !!         freezing/melting, thus:
+      !!            sa = sa + emp * sn / rau0 / e3t   for k=1
+      !!                    + sfx    / rau0 / e3t
       !!         where emp, the surface freshwater budget (evaporation minus
       !!         precipitation minus runoff) given in kg/m2/s is divided
-      !!         by 1035 kg/m3 (density of ocena water) to obtain m/s.    
+      !!         by rau0 = 1020 kg/m3 (density of sea water) to obtain m/s.    
       !!         Note: even though Fwe does not appear explicitly for 
       !!         temperature in this routine, the heat carried by the water
@@ -109,5 +113,5 @@
       !!
       INTEGER  ::   ji, jj, jk, jn           ! dummy loop indices  
-      REAL(wp) ::   zfact, z1_e3t, zsrau, zdep
+      REAL(wp) ::   zfact, z1_e3t, zdep
       REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrdt, ztrds
       !!----------------------------------------------------------------------
@@ -120,6 +124,4 @@
          IF(lwp) WRITE(numout,*) '~~~~~~~ '
       ENDIF
-
-      zsrau = 1. / rau0             ! initialization
 
       IF( l_trdtra )   THEN                    !* Save ta and sa trends
@@ -163,22 +165,24 @@
                                                    ! evaporation, precipitation and qns, but not river runoff 
                                                
-      IF( lk_vvl ) THEN                            ! Variable Volume case
+      IF( lk_vvl ) THEN                            ! Variable Volume case  ==>> heat content of mass flux is in qns
          DO jj = 1, jpj
             DO ji = 1, jpi 
-               ! temperature : heat flux + cooling/heating effet of EMP flux
-               sbc_tsc(ji,jj,jp_tem) = ro0cpr * qns(ji,jj) - zsrau * emp(ji,jj) * tsn(ji,jj,1,jp_tem)
-               ! concent./dilut. effect due to sea-ice melt/formation and (possibly) SSS restoration
-               sbc_tsc(ji,jj,jp_sal) = ( emps(ji,jj) - emp(ji,jj) ) * zsrau * tsn(ji,jj,1,jp_sal)
+               sbc_tsc(ji,jj,jp_tem) = r1_rau0_rcp * qns(ji,jj)                              ! non solar heat flux
+               sbc_tsc(ji,jj,jp_sal) = r1_rau0     * sfx(ji,jj)                              ! salt flux due to freezing/melting
             END DO
          END DO
-      ELSE                                         ! Constant Volume case
+      ELSE                                         ! Constant Volume case ==>> Concentration dilution effect
          DO jj = 2, jpj
             DO ji = fs_2, fs_jpim1   ! vector opt.
                ! temperature : heat flux
-               sbc_tsc(ji,jj,jp_tem) = ro0cpr * qns(ji,jj)
-               ! salinity    : salt flux + concent./dilut. effect (both in emps)
-               sbc_tsc(ji,jj,jp_sal) = zsrau * emps(ji,jj) * tsn(ji,jj,1,jp_sal)
+               sbc_tsc(ji,jj,jp_tem) = r1_rau0_rcp * qns(ji,jj)                          &   ! non solar heat flux
+                  &                  + r1_rau0     * emp(ji,jj)  * tsn(ji,jj,1,jp_tem)       ! concent./dilut. effect
+               ! salinity    : salt flux + concent./dilut. effect (both in sfx)
+               sbc_tsc(ji,jj,jp_sal) = r1_rau0  * (  sfx(ji,jj)                          &   ! salt flux (freezing/melting)
+                  &                                + emp(ji,jj) * tsn(ji,jj,1,jp_sal) )      ! concent./dilut. effect
             END DO
          END DO
+         CALL iom_put( "emp_x_sst", emp (:,:) * tsn(:,:,1,jp_tem) )                          ! c/d term on sst
+         CALL iom_put( "emp_x_sss", emp (:,:) * tsn(:,:,1,jp_sal) )                          ! c/d term on sss
       ENDIF
       ! Concentration dilution effect on (t,s) due to evapouration, precipitation and qns, but not river runoff  
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfgls.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfgls.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfgls.F90	(revision 3625)
@@ -12,7 +12,7 @@
    !!   'key_zdfgls'                 Generic Length Scale vertical physics
    !!----------------------------------------------------------------------
-   !!   zdf_gls      : update momentum and tracer Kz from a gls scheme
-   !!   zdf_gls_init : initialization, namelist read, and parameters control
-   !!   gls_rst      : read/write gls restart in ocean restart file
+   !!   zdf_gls       : update momentum and tracer Kz from a gls scheme
+   !!   zdf_gls_init  : initialization, namelist read, and parameters control
+   !!   gls_rst       : read/write gls restart in ocean restart file
    !!----------------------------------------------------------------------
    USE oce            ! ocean dynamics and active tracers 
@@ -31,4 +31,5 @@
    USE iom            ! I/O manager library
    USE timing         ! Timing
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -167,5 +168,5 @@
             ! 
             ! surface friction 
-            ustars2(ji,jj) = rau0r * taum(ji,jj) * tmask(ji,jj,1)
+            ustars2(ji,jj) = r1_rau0 * taum(ji,jj) * tmask(ji,jj,1)
             !
             ! bottom friction (explicit before friction)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfkpp.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfkpp.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfkpp.F90	(revision 3625)
@@ -15,24 +15,25 @@
    !!   'key_zdfkpp'                                             KPP scheme
    !!----------------------------------------------------------------------
-   !!   zdf_kpp      : update momentum and tracer Kz from a kpp scheme
-   !!   zdf_kpp_init : initialization, namelist read, and parameters control
-   !!   tra_kpp      : compute and add to the T & S trend the non-local flux
-   !!   trc_kpp      : compute and add to the passive tracer trend the non-local flux (lk_top=T)
+   !!   zdf_kpp       : update momentum and tracer Kz from a kpp scheme
+   !!   zdf_kpp_init  : initialization, namelist read, and parameters control
+   !!   tra_kpp       : compute and add to the T & S trend the non-local flux
+   !!   trc_kpp       : compute and add to the passive tracer trend the non-local flux (lk_top=T)
    !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and active tracers 
-   USE dom_oce         ! ocean space and time domain
-   USE zdf_oce         ! ocean vertical physics
-   USE sbc_oce         ! surface boundary condition: ocean
-   USE phycst          ! physical constants
-   USE eosbn2          ! equation of state
-   USE zdfddm          ! double diffusion mixing
-   USE in_out_manager  ! I/O manager
-   USE lib_mpp         ! MPP library
-   USE wrk_nemo        ! work arrays
-   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE prtctl          ! Print control
-   USE trdmod_oce      ! ocean trends definition
-   USE trdtra          ! tracers trends
-   USE timing          ! Timing
+   USE oce            ! ocean dynamics and active tracers 
+   USE dom_oce        ! ocean space and time domain
+   USE zdf_oce        ! ocean vertical physics
+   USE sbc_oce        ! surface boundary condition: ocean
+   USE phycst         ! physical constants
+   USE eosbn2         ! equation of state
+   USE zdfddm         ! double diffusion mixing
+   USE in_out_manager ! I/O manager
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
+   USE prtctl         ! Print control
+   USE trdmod_oce     ! ocean trends definition
+   USE trdtra         ! tracers trends
+   USE timing         ! Timing
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
@@ -426,9 +427,11 @@
             zBosol(ji,jj) = grav * zthermal * qsr(ji,jj)
             ! Non radiative surface buoyancy force
-            zBo   (ji,jj) = grav * zthermal * qns(ji,jj) -  grav * zhalin * ( emps(ji,jj)-rnf(ji,jj) ) 
+            zBo   (ji,jj) = grav * zthermal * qns(ji,jj) -  grav * zhalin * ( emp(ji,jj)-rnf(ji,jj) )  &
+               &                                         -  grav * rbeta * rcs * sfx(ji,jj)
             ! Surface Temperature flux for non-local term
-            wt0(ji,jj) = - ( qsr(ji,jj) + qns(ji,jj) )* ro0cpr * tmask(ji,jj,1)
+            wt0(ji,jj) = - ( qsr(ji,jj) + qns(ji,jj) )* r1_rau0_rcp * tmask(ji,jj,1)
             ! Surface salinity flux for non-local term
-            ws0(ji,jj) = - ( ( emps(ji,jj)-rnf(ji,jj) ) * tsn(ji,jj,1,jp_sal) * rcs ) * tmask(ji,jj,1) 
+            ws0(ji,jj) = - ( ( emp(ji,jj)-rnf(ji,jj) ) * tsn(ji,jj,1,jp_sal)                          &
+               &             + sfx(ji,jj)                                     ) * rcs * tmask(ji,jj,1) 
          ENDDO
       ENDDO
@@ -1324,5 +1327,5 @@
                DO ji = fs_2, fs_jpim1
                   ! Surface tracer flux for non-local term 
-                  zflx = - ( emps(ji,jj) * tra(ji,jj,1,jn) * rcs ) * tmask(ji,jj,1)
+                  zflx = - ( sfx (ji,jj) * tra(ji,jj,1,jn) * rcs ) * tmask(ji,jj,1)
                   ! compute the trend
                   ztra = - ( ghats(ji,jj,jk  ) * fsavs(ji,jj,jk  )   &
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfric.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfric.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfric.F90	(revision 3625)
@@ -17,16 +17,17 @@
    !!   'key_zdfric'                                             Kz = f(Ri)
    !!----------------------------------------------------------------------
-   !!   zdf_ric      : update momentum and tracer Kz from the Richardson
+   !!   zdf_ric       : update momentum and tracer Kz from the Richardson
    !!                  number computation
-   !!   zdf_ric_init : initialization, namelist read, & parameters control
-   !!----------------------------------------------------------------------
-   USE oce                   ! ocean dynamics and tracers variables
-   USE dom_oce               ! ocean space and time domain variables
-   USE zdf_oce               ! ocean vertical physics
-   USE in_out_manager        ! I/O manager
-   USE lbclnk                ! ocean lateral boundary condition (or mpp link)
-   USE lib_mpp               ! MPP library
-   USE wrk_nemo              ! work arrays
-   USE timing                ! Timing
+   !!   zdf_ric_init  : initialization, namelist read, & parameters control
+   !!----------------------------------------------------------------------
+   USE oce            ! ocean dynamics and tracers variables
+   USE dom_oce        ! ocean space and time domain variables
+   USE zdf_oce        ! ocean vertical physics
+   USE in_out_manager ! I/O manager
+   USE lbclnk         ! ocean lateral boundary condition (or mpp link)
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE timing         ! Timing
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    USE eosbn2, ONLY : nn_eos
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftke.F90	(revision 3625)
@@ -31,9 +31,9 @@
    !!   'key_zdftke'                                   TKE vertical physics
    !!----------------------------------------------------------------------
-   !!   zdf_tke      : update momentum and tracer Kz from a tke scheme
-   !!   tke_tke      : tke time stepping: update tke at now time step (en)
-   !!   tke_avn      : compute mixing length scale and deduce avm and avt
-   !!   zdf_tke_init : initialization, namelist read, and parameters control
-   !!   tke_rst      : read/write tke restart in ocean restart file
+   !!   zdf_tke       : update momentum and tracer Kz from a tke scheme
+   !!   tke_tke       : tke time stepping: update tke at now time step (en)
+   !!   tke_avn       : compute mixing length scale and deduce avm and avt
+   !!   zdf_tke_init  : initialization, namelist read, and parameters control
+   !!   tke_rst       : read/write tke restart in ocean restart file
    !!----------------------------------------------------------------------
    USE oce            ! ocean: dynamics and active tracers variables
@@ -52,4 +52,5 @@
    USE wrk_nemo       ! work arrays
    USE timing         ! Timing
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftmx.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftmx.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/ZDF/zdftmx.F90	(revision 3625)
@@ -12,19 +12,20 @@
    !!   'key_zdftmx'                                  Tidal vertical mixing
    !!----------------------------------------------------------------------
-   !!   zdf_tmx      : global     momentum & tracer Kz with tidal induced Kz
-   !!   tmx_itf      : Indonesian momentum & tracer Kz with tidal induced Kz 
-   !!----------------------------------------------------------------------
-   USE oce             ! ocean dynamics and tracers variables
-   USE dom_oce         ! ocean space and time domain variables
-   USE zdf_oce         ! ocean vertical physics variables
-   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE eosbn2          ! ocean equation of state
-   USE phycst          ! physical constants
-   USE prtctl          ! Print control
-   USE in_out_manager  ! I/O manager
-   USE iom             ! I/O Manager
-   USE lib_mpp         ! MPP library
-   USE wrk_nemo        ! work arrays
-   USE timing          ! Timing
+   !!   zdf_tmx       : global     momentum & tracer Kz with tidal induced Kz
+   !!   tmx_itf       : Indonesian momentum & tracer Kz with tidal induced Kz 
+   !!----------------------------------------------------------------------
+   USE oce            ! ocean dynamics and tracers variables
+   USE dom_oce        ! ocean space and time domain variables
+   USE zdf_oce        ! ocean vertical physics variables
+   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
+   USE eosbn2         ! ocean equation of state
+   USE phycst         ! physical constants
+   USE prtctl         ! Print control
+   USE in_out_manager ! I/O manager
+   USE iom            ! I/O Manager
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo       ! work arrays
+   USE timing         ! Timing
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 3625)
@@ -46,4 +46,7 @@
    USE mppini          ! shared/distributed memory setting (mpp_init routine)
    USE domain          ! domain initialization             (dom_init routine)
+#if defined key_nemocice_decomp
+   USE ice_domain_size, only: nx_global, ny_global
+#endif
    USE obcini          ! open boundary cond. initialization (obc_ini routine)
    USE bdyini          ! open boundary cond. initialization (bdy_init routine)
@@ -259,8 +262,9 @@
       ! than variables
       IF( Agrif_Root() ) THEN
+#if defined key_nemocice_decomp
+         jpi = ( nx_global+2-2*jpreci + (jpni-1) ) / jpni + 2*jpreci ! first  dim.
+         jpj = ( ny_global+2-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj ! second dim. 
+#else
          jpi = ( jpiglo-2*jpreci + (jpni-1) ) / jpni + 2*jpreci   ! first  dim.
-#if defined key_nemocice_decomp
-         jpj = ( jpjglo+1-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj ! second dim. 
-#else
          jpj = ( jpjglo-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj   ! second dim.
 #endif
@@ -322,7 +326,5 @@
       IF( lk_bdy        )   CALL     tide_init      ! Open boundaries initialisation of tidal harmonic forcing
 
-                            CALL flush(numout)
                             CALL dyn_nept_init  ! simplified form of Neptune effect
-                            CALL flush(numout)
 
                             CALL  istate_init   ! ocean initial state (Dynamics and tracers)
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/oce.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/oce.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/oce.F90	(revision 3625)
@@ -47,4 +47,12 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   gru , grv    !: horizontal gradient of rd at bottom u-point
 
+   !! arrays relating to embedding ice in the ocean. These arrays need to be declared 
+   !! even if no ice model is required. In the no ice model or traditional levitating 
+   !! ice cases they contain only zeros
+   !! ---------------------
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   snwice_mass        !: mass of snow and ice at current  ice time step   [Kg/m2]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   snwice_mass_b      !: mass of snow and ice at previous ice time step   [Kg/m2]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   snwice_fmass       !: time evolution of mass of snow+ice               [Kg/m2/s]
+
    !!----------------------------------------------------------------------
    !! NEMO/OPA 4.0 , NEMO Consortium (2011)
@@ -58,5 +66,5 @@
       !!                   ***  FUNCTION oce_alloc  ***
       !!----------------------------------------------------------------------
-      INTEGER :: ierr(2)
+      INTEGER :: ierr(3)
       !!----------------------------------------------------------------------
       !
@@ -69,13 +77,16 @@
          &      rn2b (jpi,jpj,jpk)      , rn2  (jpi,jpj,jpk)                              , STAT=ierr(1) )
          !
-      ALLOCATE(rhd (jpi,jpj,jpk) ,                                         &
-         &     rhop(jpi,jpj,jpk) ,                                         &
-         &     sshb  (jpi,jpj)   , sshn  (jpi,jpj) , ssha  (jpi,jpj) ,     &
-         &     sshu_b(jpi,jpj)   , sshu_n(jpi,jpj) , sshu_a(jpi,jpj) ,     &
-         &     sshv_b(jpi,jpj)   , sshv_n(jpi,jpj) , sshv_a(jpi,jpj) ,     &
-         &                         sshf_n(jpi,jpj) ,                       &
-         &     spgu  (jpi,jpj)   , spgv(jpi,jpj)   ,                       &
-         &     gtsu(jpi,jpj,jpts), gtsv(jpi,jpj,jpts),                     &
-         &     gru(jpi,jpj)      , grv(jpi,jpj)                      , STAT=ierr(2) )
+      ALLOCATE( rhd (jpi,jpj,jpk) ,                                         &
+         &      rhop(jpi,jpj,jpk) ,                                         &
+         &      sshb  (jpi,jpj)   , sshn  (jpi,jpj) , ssha  (jpi,jpj) ,     &
+         &      sshu_b(jpi,jpj)   , sshu_n(jpi,jpj) , sshu_a(jpi,jpj) ,     &
+         &      sshv_b(jpi,jpj)   , sshv_n(jpi,jpj) , sshv_a(jpi,jpj) ,     &
+         &                          sshf_n(jpi,jpj) ,                       &
+         &      spgu  (jpi,jpj)   , spgv(jpi,jpj)   ,                       &
+         &      gtsu(jpi,jpj,jpts), gtsv(jpi,jpj,jpts),                     &
+         &      gru(jpi,jpj)      , grv(jpi,jpj)                      , STAT=ierr(2) )
+         !
+      ALLOCATE( snwice_mass(jpi,jpj)  , snwice_mass_b(jpi,jpj),             &
+         &      snwice_fmass(jpi,jpj), STAT= ierr(3) )
          !
       oce_alloc = MAXVAL( ierr )
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zrem.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zrem.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zrem.F90	(revision 3625)
@@ -4,7 +4,7 @@
    !! TOP :   PISCES Compute remineralization/scavenging of organic compounds
    !!======================================================================
-   !! History :   1.0  !  2004     (O. Aumont) Original code
-   !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!             3.4  !  2011-06  (O. Aumont, C. Ethe) Quota model for iron
+   !! History :  1.0  !  2004     (O. Aumont) Original code
+   !!            2.0  !  2007-12  (C. Ethe, G. Madec)  F90
+   !!            3.4  !  2011-06  (O. Aumont, C. Ethe) Quota model for iron
    !!----------------------------------------------------------------------
 #if defined key_pisces
@@ -17,13 +17,14 @@
    !!   p4z_rem_alloc :  Allocate remineralisation variables
    !!----------------------------------------------------------------------
-   USE oce_trc         !  shared variables between ocean and passive tracers
-   USE trc             !  passive tracers common variables 
-   USE sms_pisces      !  PISCES Source Minus Sink variables
-   USE p4zopt          !  optical model
-   USE p4zche          !  chemical model
-   USE p4zprod         !  Growth rate of the 2 phyto groups
-   USE p4zmeso         !  Sources and sinks of mesozooplankton
-   USE p4zint          !  interpolation and computation of various fields
-   USE prtctl_trc      !  print control for debugging
+   USE oce_trc        !  shared variables between ocean and passive tracers
+   USE trc            !  passive tracers common variables 
+   USE sms_pisces     !  PISCES Source Minus Sink variables
+   USE p4zopt         !  optical model
+   USE p4zche         !  chemical model
+   USE p4zprod        !  Growth rate of the 2 phyto groups
+   USE p4zmeso        !  Sources and sinks of mesozooplankton
+   USE p4zint         !  interpolation and computation of various fields
+   USE prtctl_trc     !  print control for debugging
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsink.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsink.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsink.F90	(revision 3625)
@@ -19,4 +19,5 @@
    USE prtctl_trc      !  print control for debugging
    USE iom             !  I/O manager
+   USE lib_fortran     ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
 
    IMPLICIT NONE
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/SED/sedchem.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/SED/sedchem.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/SED/sedchem.F90	(revision 3625)
@@ -1,4 +1,4 @@
 MODULE sedchem
-
+   !
 #if defined key_sed 
    !!======================================================================
@@ -6,9 +6,8 @@
    !! sediment :   Variable for chemistry of the CO2 cycle
    !!======================================================================
-   !!   modules used
-   USE sed     ! sediment global variable
+   USE sed            ! sediment global variable
    USE sedarr
-
-   !! * Accessibility
+   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)  
+
    PUBLIC sed_chem   
 
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90	(revision 3625)
@@ -63,5 +63,5 @@
       REAL(wp) ::   zsrau, zse3t   ! temporary scalars
       CHARACTER (len=22) :: charout
-      REAL(wp), POINTER, DIMENSION(:,:  ) :: zemps
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zsfx
       REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrtrd
       !!---------------------------------------------------------------------
@@ -70,5 +70,5 @@
       !
       ! Allocate temporary workspace
-                      CALL wrk_alloc( jpi, jpj,      zemps  )
+                      CALL wrk_alloc( jpi, jpj,      zsfx   )
       IF( l_trdtrc )  CALL wrk_alloc( jpi, jpj, jpk, ztrtrd )
 
@@ -80,13 +80,13 @@
 
 
-      IF( lk_offline ) THEN          ! emps in dynamical files contains emps - rnf
-         zemps(:,:) = emps(:,:)  
+      IF( lk_offline ) THEN          ! sfx in dynamical files contains sfx  - rnf
+         zsfx(:,:) = sfx(:,:)  
       ELSE                           ! Concentration dilution effect on tracer due to evaporation, precipitation, and river runoff
          IF( lk_vvl ) THEN                      ! volume variable
-            zemps(:,:) = emps(:,:) - emp(:,:)   
-!!ch         zemps(:,:) = 0.
+            zsfx(:,:) = sfx(:,:) - emp(:,:)   
+!!ch         zsfx(:,:) = 0.
          ELSE                                   ! linear free surface
-            IF( ln_rnf ) THEN  ;  zemps(:,:) = emps(:,:) - rnf(:,:)   !  E-P-R
-            ELSE               ;  zemps(:,:) = emps(:,:)
+            IF( ln_rnf ) THEN  ;  zsfx(:,:) = sfx(:,:) - rnf(:,:)   !  E-P-R
+            ELSE               ;  zsfx(:,:) = sfx(:,:)
             ENDIF 
          ENDIF 
@@ -102,5 +102,5 @@
             DO ji = fs_2, fs_jpim1   ! vector opt.
                zse3t = 1. / fse3t(ji,jj,1)
-               tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zemps(ji,jj) *  zsrau * trn(ji,jj,1,jn) * zse3t
+               tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zsfx(ji,jj) *  zsrau * trn(ji,jj,1,jn) * zse3t
             END DO
          END DO
@@ -117,5 +117,5 @@
                                            CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
       ENDIF
-                      CALL wrk_dealloc( jpi, jpj,      zemps  )
+                      CALL wrk_dealloc( jpi, jpj,      zsfx   )
       IF( l_trdtrc )  CALL wrk_dealloc( jpi, jpj, jpk, ztrtrd )
       !
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90	(revision 3625)
@@ -227,5 +227,5 @@
    USE sbc_oce , ONLY :   emp        =>    emp        !: freshwater budget: volume flux               [Kg/m2/s]
    USE sbc_oce , ONLY :   emp_b      =>    emp_b      !: freshwater budget: volume flux               [Kg/m2/s]
-   USE sbc_oce , ONLY :   emps       =>    emps       !: freshwater budget: concentration/dillution   [Kg/m2/s]
+   USE sbc_oce , ONLY :   sfx        =>    sfx        !: downward salt flux                          [PSU/m2/s]
    USE sbc_oce , ONLY :   rnf        =>    rnf        !: river runoff   [Kg/m2/s]
    USE sbc_oce , ONLY :   ln_dm2dc   =>    ln_dm2dc   !: Daily mean to Diurnal Cycle short wave (qsr) 
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/trc.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 3625)
@@ -133,5 +133,5 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::  fr_i_tm    !: average ice fraction     [m/s]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::  emp_tm     !: freshwater budget: volume flux [Kg/m2/s]
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::  emps_tm    !: freshwater budget:concentration/dilution [Kg/m2/s]
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::  sfx_tm     !: downward salt flux [PSU/m2/s]
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::  emp_b_hold !: hold emp from the beginning of each sub-stepping[m]  
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::  qsr_tm     !: solar radiation average [m]
@@ -173,5 +173,5 @@
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  hdivb_temp, rotb_temp
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::  hmld_temp, qsr_temp, fr_i_temp,wndm_temp
-   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::  emp_temp, emps_temp, emp_b_temp
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::  emp_temp, sfx_temp, emp_b_temp
    !
 #if defined key_trabbl
Index: branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/trcsub.F90
===================================================================
--- branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/trcsub.F90	(revision 3614)
+++ branches/2012/dev_NOC_2012_rev3555/NEMOGCM/NEMO/TOP_SRC/trcsub.F90	(revision 3625)
@@ -121,5 +121,5 @@
           fr_i_tm  (:,:)         = fr_i_tm  (:,:)         + fr_i  (:,:)
           emp_tm   (:,:)         = emp_tm   (:,:)         + emp   (:,:) 
-          emps_tm  (:,:)         = emps_tm  (:,:)         + emps  (:,:)
+          sfx_tm   (:,:)         = sfx_tm   (:,:)         + sfx   (:,:)
           qsr_tm   (:,:)         = qsr_tm   (:,:)         + qsr   (:,:)
           wndm_tm  (:,:)         = wndm_tm  (:,:)         + wndm  (:,:)
@@ -209,5 +209,5 @@
          emp_temp   (:,:)        = emp   (:,:)
          emp_b_temp (:,:)        = emp_b (:,:)
-         emps_temp  (:,:)        = emps  (:,:)
+         sfx_temp   (:,:)        = sfx   (:,:)
          qsr_temp   (:,:)        = qsr   (:,:)
          wndm_temp  (:,:)        = wndm  (:,:)
@@ -313,5 +313,5 @@
          fr_i_tm  (:,:)          = fr_i_tm    (:,:)       + fr_i  (:,:)
          emp_tm   (:,:)          = emp_tm     (:,:)       + emp   (:,:) 
-         emps_tm  (:,:)          = emps_tm    (:,:)       + emps  (:,:)
+         sfx_tm   (:,:)          = sfx_tm     (:,:)       + sfx   (:,:)
          qsr_tm   (:,:)          = qsr_tm     (:,:)       + qsr   (:,:)
          wndm_tm  (:,:)          = wndm_tm    (:,:)       + wndm  (:,:)
@@ -332,5 +332,5 @@
             qsr   (:,:)          = qsr_tm     (:,:) * r1_ndttrc 
             emp   (:,:)          = emp_tm     (:,:) * r1_ndttrc 
-            emps  (:,:)          = emps_tm    (:,:) * r1_ndttrc 
+            sfx   (:,:)          = sfx_tm     (:,:) * r1_ndttrc 
             fr_i  (:,:)          = fr_i_tm    (:,:) * r1_ndttrc
 # if defined key_trabbl
@@ -348,5 +348,5 @@
             qsr   (:,:)          = qsr_tm     (:,:) * r1_ndttrcp1 
             emp   (:,:)          = emp_tm     (:,:) * r1_ndttrcp1 
-            emps  (:,:)          = emps_tm    (:,:) * r1_ndttrcp1 
+            sfx   (:,:)          = sfx_tm     (:,:) * r1_ndttrcp1 
             fr_i  (:,:)          = fr_i_tm    (:,:) * r1_ndttrcp1 
 # if defined key_trabbl
@@ -498,5 +498,5 @@
          CALL lbc_lnk( emp   (:,:)         , 'T', 1. ) 
          CALL lbc_lnk( emp_b (:,:)         , 'T', 1. ) 
-         CALL lbc_lnk( emps  (:,:)         , 'T', 1. ) 
+         CALL lbc_lnk( sfx   (:,:)         , 'T', 1. ) 
          CALL lbc_lnk( qsr   (:,:)         , 'T', 1. ) 
          CALL lbc_lnk( wndm  (:,:)         , 'T', 1. ) 
@@ -598,5 +598,5 @@
       fr_i_tm(:,:) = 0._wp
       emp_tm (:,:) = 0._wp
-      emps_tm(:,:) = 0._wp
+      sfx_tm(:,:)  = 0._wp
       qsr_tm (:,:) = 0._wp
       wndm_tm(:,:) = 0._wp
@@ -705,5 +705,5 @@
       fr_i  (:,:)     =  fr_i_temp  (:,:)
       emp   (:,:)     =  emp_temp   (:,:)
-      emps  (:,:)     =  emps_temp  (:,:)
+      sfx   (:,:)     =  sfx_temp   (:,:)
       emp_b (:,:)     =  emp_b_temp (:,:)
       qsr   (:,:)     =  qsr_temp   (:,:)
@@ -824,5 +824,5 @@
       fr_i_tm    (:,:) = fr_i  (:,:)
       emp_tm     (:,:) = emp   (:,:)
-      emps_tm    (:,:) = emps  (:,:)
+      sfx_tm     (:,:) = sfx   (:,:)
       qsr_tm     (:,:) = qsr   (:,:)
       wndm_tm    (:,:) = wndm  (:,:)
@@ -1053,5 +1053,5 @@
          &      rnf_temp(jpi,jpj)           ,  h_rnf_temp(jpi,jpj) ,     &
          &      tsn_temp(jpi,jpj,jpk,2)     ,  emp_b_temp(jpi,jpj),      &
-         &      emp_temp(jpi,jpj)           ,  emps_temp(jpi,jpj) ,      &
+         &      emp_temp(jpi,jpj)           ,  sfx_temp(jpi,jpj)  ,      &
          &      hmld_temp(jpi,jpj)          ,  qsr_temp(jpi,jpj) ,       &
          &      fr_i_temp(jpi,jpj)          ,  fr_i_tm(jpi,jpj) ,        &
@@ -1101,5 +1101,5 @@
          &      sshv_n_tm(jpi,jpj)          ,  sshv_b_hold(jpi,jpj),     &
          &      tsn_tm(jpi,jpj,jpk,2)       ,                            &
-         &      emp_tm(jpi,jpj)             ,  emps_tm(jpi,jpj) ,        &
+         &      emp_tm(jpi,jpj)             ,  sfx_tm(jpi,jpj)  ,        &
          &      emp_b_hold(jpi,jpj)         ,                            &
          &      hmld_tm(jpi,jpj)            ,  qsr_tm(jpi,jpj) ,         &
