Index: branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90
===================================================================
--- branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90	(revision 3938)
+++ branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/DIA/diahsb.F90	(revision 3952)
@@ -124,5 +124,5 @@
       
       ! add ssh if not vvl
-#ifndef key_vvl
+#if ! defined key_vvl
      zdiff_v2 = zdiff_v2 + zdiff_v1
      zdiff_hc = zdiff_hc + glob_sum( zsurf(:,:) * ( sshn(:,:) * tsn(:,:,1,jp_tem)   &
@@ -149,5 +149,5 @@
       ENDDO
       ! add ssh if not vvl
-#ifndef key_vvl
+#if ! defined key_vvl
      z_v2 = z_v2 + z_v1
      z_hc = z_hc + glob_sum( zsurf(:,:) * sshn(:,:) * tsn(:,:,1,jp_tem) )
@@ -307,5 +307,5 @@
           frc_t = 0._wp                                           
           frc_s = 0._wp                                                  
-       ENDIF	
+       ENDIF
 
      ELSEIF( TRIM(cdrw) == 'WRITE' ) THEN   ! Create restart file
Index: branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90
===================================================================
--- branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 3938)
+++ branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/LBC/lib_mpp.F90	(revision 3952)
@@ -362,5 +362,5 @@
 
 
-   SUBROUTINE mpp_lnk_3d( ptab, cd_type, psgn, cd_mpp, pval, ldup )
+   SUBROUTINE mpp_lnk_3d( ptab, cd_type, psgn, cd_mpp, pval )
       !!----------------------------------------------------------------------
       !!                  ***  routine mpp_lnk_3d  ***
@@ -390,5 +390,4 @@
       CHARACTER(len=3), OPTIONAL      , INTENT(in   ) ::   cd_mpp   ! fill the overlap area only 
       REAL(wp)        , OPTIONAL      , INTENT(in   ) ::   pval     ! background value (used at closed boundaries)
-      LOGICAL         , OPTIONAL      , INTENT(in   ) ::   ldup     ! duplicate value (used at closed boundaries)
       !!
       INTEGER  ::   ji, jj, jk, jl             ! dummy loop indices
@@ -428,10 +427,4 @@
             ptab( 1 ,:,:) = ptab(jpim1,:,:)
             ptab(jpi,:,:) = ptab(  2  ,:,:)
-         ELSEIF ( nperio == 0 .AND. PRESENT( ldup ) ) THEN
-            ptab(3,:,:) = ptab(2,:,:)
-            ptab(:,3,:) = ptab(:,2,:)
-            ptab(nlci-2,:,:) = ptab(nlci-1,:,:)
-            ptab(:,nlcj-2,:) = ptab(:,nlcj-1,:)
-           
          ELSE                                     !* closed
             IF( .NOT. cd_type == 'F' )   ptab(     1       :jpreci,:,:) = zland    ! south except F-point
@@ -566,5 +559,5 @@
 
 
-   SUBROUTINE mpp_lnk_2d( pt2d, cd_type, psgn, cd_mpp, pval, ldup )
+   SUBROUTINE mpp_lnk_2d( pt2d, cd_type, psgn, cd_mpp, pval )
       !!----------------------------------------------------------------------
       !!                  ***  routine mpp_lnk_2d  ***
@@ -592,5 +585,4 @@
       CHARACTER(len=3), OPTIONAL  , INTENT(in   ) ::   cd_mpp   ! fill the overlap area only 
       REAL(wp)        , OPTIONAL  , INTENT(in   ) ::   pval     ! background value (used at closed boundaries)
-      LOGICAL         , OPTIONAL  , INTENT(in   ) ::   ldup     ! duplicate value (used at closed boundaries)
       !!
       INTEGER  ::   ji, jj, jl   ! dummy loop indices
@@ -629,9 +621,4 @@
             pt2d( 1 ,:) = pt2d(jpim1,:)                                    ! west
             pt2d(jpi,:) = pt2d(  2  ,:)                                    ! east
-         ELSEIF ( nperio == 0 .AND. PRESENT( ldup ) ) THEN
-            pt2d(3,:) = pt2d(2,:)
-            pt2d(:,3) = pt2d(:,2)
-            pt2d(nlci-2,:) = pt2d(nlci-1,:)
-            pt2d(:,nlcj-2) = pt2d(:,nlcj-1)
          ELSE                                     ! closed
             IF( .NOT. cd_type == 'F' )   pt2d(     1       :jpreci,:) = zland    ! south except F-point
@@ -2024,10 +2011,4 @@
       CALL MPI_ALLREDUCE( kice, zwork, jpnij, mpi_integer, mpi_sum, mpi_comm_opa, ierr )
       ndim_rank_ice = SUM( zwork )          
- 
-      !SF ! if there is no ice in the domain, return to the main program (clem modif)
-     !SF  IF ( ndim_rank_ice == 0 ) THEN
-      !SF    DEALLOCATE(kice, zwork)
-     !SF     RETURN
-     !SF  ENDIF
 
       ! Allocate the right size to nrank_north
@@ -2046,5 +2027,5 @@
       ! Create the world group
       CALL MPI_COMM_GROUP( mpi_comm_opa, ngrp_world, ierr )
- 
+
       ! Create the ice group from the world group
       CALL MPI_GROUP_INCL( ngrp_world, ndim_rank_ice, nrank_ice, ngrp_ice, ierr )
Index: branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/LDF/ldfdyn_c3d.h90
===================================================================
--- branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/LDF/ldfdyn_c3d.h90	(revision 3938)
+++ branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/LDF/ldfdyn_c3d.h90	(revision 3952)
@@ -35,8 +35,5 @@
       REAL(wp) ::   zd_max       ! maximum grid spacing over the global domain
       REAL(wp) ::   za00, zc, zd, zetmax, zefmax, zeumax, zevmax   ! local scalars
-      REAL(wp), POINTER, DIMENSION(:)   :: zcoef   
-      INTEGER,  PARAMETER               :: zrim = 5  ! number of grid points over which diffusion is increased linearly
-      REAL(wp), PARAMETER               :: zinc_coef = 0.0 ! coef of diffusion increase  
-      INTEGER  ::   ii0, ii1, ij0, ij1   ! temporary integers
+      REAL(wp), POINTER, DIMENSION(:) :: zcoef   
       !!----------------------------------------------------------------------
       !
@@ -91,17 +88,17 @@
             CALL ldf_dyn_c3d_orca( ld_print )
          ENDIF
-	 
-      	 ! Control print
-         IF(lwp .AND. ld_print ) THEN
-            WRITE(numout,*)
-            WRITE(numout,*) '         3D ahm1 array (k=1)'
-            CALL prihre( ahm1(:,:,1), jpi, jpj, 1, jpi, 1, 1, jpj, 1, 1.e-3, numout )
-            WRITE(numout,*)
-            WRITE(numout,*) '         3D ahm2 array (k=1)'
-            CALL prihre( ahm2(:,:,1), jpi, jpj, 1, jpi, 1, 1, jpj, 1, 1.e-3, numout )
-         ENDIF
-
-      ENDIF
-      
+
+      ENDIF
+      
+      ! Control print
+      IF(lwp .AND. ld_print ) THEN
+         WRITE(numout,*)
+         WRITE(numout,*) '         3D ahm1 array (k=1)'
+         CALL prihre( ahm1(:,:,1), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1.e-3, numout )
+         WRITE(numout,*)
+         WRITE(numout,*) '         3D ahm2 array (k=1)'
+         CALL prihre( ahm2(:,:,1), jpi, jpj, 1, jpi, 20, 1, jpj, 20, 1.e-3, numout )
+      ENDIF
+
 
       ! ahm3 and ahm4 at U- and V-points (used for bilaplacian operator
@@ -175,8 +172,8 @@
             WRITE(numout,*)
             WRITE(numout,*) 'inildf: ahm3 array at level 1'
-            CALL prihre(ahm3(:,:,1  ),jpi,jpj,1,jpi,1,1,jpj,1,1.e-12,numout)
+            CALL prihre(ahm3(:,:,1  ),jpi,jpj,1,jpi,1,1,jpj,1,1.e-3,numout)
             WRITE(numout,*)
             WRITE(numout,*) 'inildf: ahm4 array at level 1'
-            CALL prihre(ahm4(:,:,jpk),jpi,jpj,1,jpi,1,1,jpj,1,1.e-12,numout)
+            CALL prihre(ahm4(:,:,jpk),jpi,jpj,1,jpi,1,1,jpj,1,1.e-3,numout)
          ENDIF
       ENDIF
Index: branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcfwb.F90
===================================================================
--- branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcfwb.F90	(revision 3938)
+++ branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcfwb.F90	(revision 3952)
@@ -98,5 +98,7 @@
             emp (:,:) = emp (:,:) - z_fwf 
             erp (:,:) = erp (:,:) - z_fwf 
-!SF bad            emps(:,:) = emps(:,:) - z_fwf 
+#if defined key_lim2
+            emps(:,:) = emps(:,:) - z_fwf      ! emps is the mass flux in lim2 case
+#endif
          ENDIF
          !
@@ -129,5 +131,7 @@
             emp (:,:) = emp (:,:) + fwfold
             erp (:,:) = erp (:,:) + fwfold
-!SF bad            emps(:,:) = emps(:,:) + fwfold
+#if defined key_lim2
+            emps(:,:) = emps(:,:) + fwfold      ! emps is the mass flux in lim2 case
+#endif
          ENDIF
          !
@@ -171,5 +175,7 @@
             !
             emp (:,:) = emp (:,:) + zerp_cor(:,:)
-!SF bad            emps(:,:) = emps(:,:) + zerp_cor(:,:)
+#if defined key_lim2
+            emps(:,:) = emps(:,:) + zerp_cor(:,:)      ! emps is the mass flux in lim2 case
+#endif
             erp (:,:) = erp (:,:) + zerp_cor(:,:)
             !
Index: branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssr.F90
===================================================================
--- branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssr.F90	(revision 3938)
+++ branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/SBC/sbcssr.F90	(revision 3952)
@@ -176,5 +176,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) )   
+#if defined key_lim3
                      emps(ji,jj) = emps(ji,jj) + zerp
+#else
+                     emps(ji,jj) = emps(ji,jj) + zerp / MAX( sss_m(ji,jj) , 1.e-20 )      ! lim2 case emps is a mass flux
+#endif
                      erp (ji,jj) = zerp / MAX( sss_m(ji,jj), 1.e-20 ) ! converted into an equivalent volume flux (diagnostic only)
                   END DO
@@ -193,4 +197,7 @@
                      IF( ln_sssr_bnd )   zerp = SIGN( 1., zerp ) * MIN( zerp_bnd, ABS(zerp) )
                      emp(ji,jj) = emp (ji,jj) + zerp
+#if defined key_lim2
+                     emps(ji,jj) = emps(ji,jj) + zerp      ! lim2 case: emps is a mass flux
+#endif
                      erp(ji,jj) = zerp
                   END DO
Index: branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90
===================================================================
--- branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 3938)
+++ branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 3952)
@@ -45,5 +45,5 @@
    LOGICAL , PUBLIC ::   ln_qsr_2bd = .TRUE.    !: 2 band         light absorption flag
    LOGICAL , PUBLIC ::   ln_qsr_bio = .FALSE.   !: bio-model      light absorption flag
-   LOGICAL , PUBLIC ::   ln_qsr_ice = .TRUE.    !: light penetration for ice-model LIM3 (clem)
+   LOGICAL , PUBLIC ::   ln_qsr_ice = .FALSE.   !: light penetration for ice-model LIM3 (clem)
    INTEGER , PUBLIC ::   nn_chldta  = 0         !: use Chlorophyll data (=1) or not (=0)
    REAL(wp), PUBLIC ::   rn_abs     = 0.58_wp   !: fraction absorbed in the very near surface (RGB & 2 bands)
Index: branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90
===================================================================
--- branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90	(revision 3938)
+++ branches/2013/dev_r3406_CNRS_LIM3/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90	(revision 3952)
@@ -169,6 +169,9 @@
                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)
+#if defined key_lim3
                sbc_tsc(ji,jj,jp_sal) = emps(ji,jj) * zsrau  ! IOVINO + CLEM
+#else
+               sbc_tsc(ji,jj,jp_sal) = ( emps(ji,jj) - emp(ji,jj) ) * zsrau * tsn(ji,jj,1,jp_sal)
+#endif
             END DO
          END DO
