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 3605)
+++ 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 )
