Index: trunk/NEMO/LIM_SRC_3/limistate.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limistate.F90	(revision 888)
+++ trunk/NEMO/LIM_SRC_3/limistate.F90	(revision 921)
@@ -86,5 +86,5 @@
          zvol, zare, zh, zh1, zh2, zh3, zan, zbn, zas, zbs 
       !--------------------------------------------------------------------
- 
+
       !--------------------------------------------------------------------
       ! 1) Preliminary things 
@@ -113,6 +113,6 @@
       zs0 = 34.e0
       ztf = ABS ( rt0 - 0.0575       * zs0                               &
-               &                    + 1.710523e-03 * zs0 * SQRT( zs0 )   &
-               &                    - 2.154996e-04 * zs0 *zs0          )
+         &                    + 1.710523e-03 * zs0 * SQRT( zs0 )   &
+         &                    - 2.154996e-04 * zs0 *zs0          )
 
       ! constants for heat contents
@@ -179,25 +179,25 @@
       ! -------------
 !!!
-! retour a LIMA_MEC
-!     ! second ice type
-!     zdummy  = hi_max(ice_cat_bounds(2,1)-1)
-!     hi_max(ice_cat_bounds(2,1)-1) = 0.0
-
-!     ! here to change !!!!
-!     jm = 2
-!     DO jl = ice_cat_bounds(jm,1), ice_cat_bounds(jm,2)
-!        zhin (2)     = ( hi_max(jl-1) + hi_max(jl) ) / 2.0
-!        zhin (2)     = ( hi_max_typ(jl-ice_cat_bounds(2,1),jm    ) + &
-!                         hi_max_typ(jl-ice_cat_bounds(2,1) + 1,jm)   ) / 2.0
-!        zgfactorn(2) = zgfactorn(2) + exp(-(zhin(2)-hginn_d)*(zhin(2)-hginn_d)/2.0)
-!        zhis (2)     = ( hi_max(jl-1) + hi_max(jl) ) / 2.0
-!        zhis (2)     = ( hi_max_typ(jl-ice_cat_bounds(2,1),jm    ) + &
-!                         hi_max_typ(jl-ice_cat_bounds(2,1) + 1,jm)   ) / 2.0
-!        zgfactors(2) = zgfactors(2) + exp(-(zhis(2)-hgins_d)*(zhis(2)-hgins_d)/2.0)
-!     END DO ! jl
-!     zgfactorn(2) = aginn_d / zgfactorn(2)
-!     zgfactors(2) = agins_d / zgfactors(2)
-!     hi_max(ice_cat_bounds(2,1)-1) = zdummy
-! END retour a LIMA_MEC
+      ! retour a LIMA_MEC
+      !     ! second ice type
+      !     zdummy  = hi_max(ice_cat_bounds(2,1)-1)
+      !     hi_max(ice_cat_bounds(2,1)-1) = 0.0
+
+      !     ! here to change !!!!
+      !     jm = 2
+      !     DO jl = ice_cat_bounds(jm,1), ice_cat_bounds(jm,2)
+      !        zhin (2)     = ( hi_max(jl-1) + hi_max(jl) ) / 2.0
+      !        zhin (2)     = ( hi_max_typ(jl-ice_cat_bounds(2,1),jm    ) + &
+      !                         hi_max_typ(jl-ice_cat_bounds(2,1) + 1,jm)   ) / 2.0
+      !        zgfactorn(2) = zgfactorn(2) + exp(-(zhin(2)-hginn_d)*(zhin(2)-hginn_d)/2.0)
+      !        zhis (2)     = ( hi_max(jl-1) + hi_max(jl) ) / 2.0
+      !        zhis (2)     = ( hi_max_typ(jl-ice_cat_bounds(2,1),jm    ) + &
+      !                         hi_max_typ(jl-ice_cat_bounds(2,1) + 1,jm)   ) / 2.0
+      !        zgfactors(2) = zgfactors(2) + exp(-(zhis(2)-hgins_d)*(zhis(2)-hgins_d)/2.0)
+      !     END DO ! jl
+      !     zgfactorn(2) = aginn_d / zgfactorn(2)
+      !     zgfactors(2) = agins_d / zgfactors(2)
+      !     hi_max(ice_cat_bounds(2,1)-1) = zdummy
+      ! END retour a LIMA_MEC
 !!!
       DO jj = 1, jpj
@@ -228,5 +228,5 @@
                      zhin(1)          = ( hi_max(jl-1) + hi_max(jl) ) / 2.0
                      a_i(ji,jj,jl)    = zidto * MAX( zgfactorn(1) * exp(-(zhin(1)-hginn_u)* & 
-                                            (zhin(1)-hginn_u)/2.0) , epsi06)
+                        (zhin(1)-hginn_u)/2.0) , epsi06)
                      ! new line
                      a_i(ji,jj,jl)    = zidto * ( zan * zhin(1) * zhin(1) + zbn * zhin(1) )
@@ -239,23 +239,23 @@
 
 !!!
-! retour a LIMA_MEC
-!              !ridged ice
-!              zdummy  = hi_max(ice_cat_bounds(2,1)-1)
-!              hi_max(ice_cat_bounds(2,1)-1) = 0.0
-!              DO jl = ice_cat_bounds(2,1), ice_cat_bounds(2,2) ! loop over ice thickness categories
-!                 zhin(2)          = ( hi_max(jl-1) + hi_max(jl) ) / 2.0
-!                 a_i(ji,jj,jl)    = zidto * MAX( zgfactorn(2) * exp(-(zhin(2)-hginn_d)* &
-!                                    (zhin(2)-hginn_d)/2.0) , epsi06)
-!                 ht_i(ji,jj,jl)   = zidto * zhin(2) 
-!                 v_i(ji,jj,jl)    = ht_i(ji,jj,jl)*a_i(ji,jj,jl)
-!              END DO
-!              hi_max(ice_cat_bounds(2,1)-1) = zdummy
-
-!              !rafted ice
-!              jl = 6
-!              a_i(ji,jj,jl)       = 0.0
-!              ht_i(ji,jj,jl)      = 0.0
-!              v_i(ji,jj,jl)       = 0.0
-! END retour a LIMA_MEC
+               ! retour a LIMA_MEC
+               !              !ridged ice
+               !              zdummy  = hi_max(ice_cat_bounds(2,1)-1)
+               !              hi_max(ice_cat_bounds(2,1)-1) = 0.0
+               !              DO jl = ice_cat_bounds(2,1), ice_cat_bounds(2,2) ! loop over ice thickness categories
+               !                 zhin(2)          = ( hi_max(jl-1) + hi_max(jl) ) / 2.0
+               !                 a_i(ji,jj,jl)    = zidto * MAX( zgfactorn(2) * exp(-(zhin(2)-hginn_d)* &
+               !                                    (zhin(2)-hginn_d)/2.0) , epsi06)
+               !                 ht_i(ji,jj,jl)   = zidto * zhin(2) 
+               !                 v_i(ji,jj,jl)    = ht_i(ji,jj,jl)*a_i(ji,jj,jl)
+               !              END DO
+               !              hi_max(ice_cat_bounds(2,1)-1) = zdummy
+
+               !              !rafted ice
+               !              jl = 6
+               !              a_i(ji,jj,jl)       = 0.0
+               !              ht_i(ji,jj,jl)      = 0.0
+               !              v_i(ji,jj,jl)       = 0.0
+               ! END retour a LIMA_MEC
 !!!
 
@@ -279,5 +279,5 @@
                   o_i(ji,jj,jl)    = zidto * 1.0   + ( 1.0 - zidto )
                   oa_i(ji,jj,jl)   = o_i(ji,jj,jl) * a_i(ji,jj,jl)
-                     
+
                   !------------------------------
                   ! Sea ice surface temperature
@@ -298,5 +298,5 @@
                      ! Multiply by volume, so that heat content in 10^9 Joules
                      e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) * area(ji,jj) * &
-                                        v_s(ji,jj,jl)  / nlay_s
+                        v_s(ji,jj,jl)  / nlay_s
                   END DO !jk
 
@@ -309,19 +309,19 @@
                      s_i(ji,jj,jk,jl) = zidto * sinn + ( 1.0 - zidto ) * 0.1
                      ztmelts          = - tmut * s_i(ji,jj,jk,jl) + rtt !Melting temperature in K
- 
-                  ! heat content per unit volume
+
+                     ! heat content per unit volume
                      e_i(ji,jj,jk,jl) = zidto * rhoic * &
-                     (   cpic    * ( ztmelts - t_i(ji,jj,jk,jl) ) &
-                     +   lfus    * ( 1.0 - (ztmelts-rtt) / MIN((t_i(ji,jj,jk,jl)-rtt),-zeps) ) &
-                     - rcp      * ( ztmelts - rtt ) &
-                     )
-
-                  ! Correct dimensions to avoid big values
+                        (   cpic    * ( ztmelts - t_i(ji,jj,jk,jl) ) &
+                        +   lfus    * ( 1.0 - (ztmelts-rtt) / MIN((t_i(ji,jj,jk,jl)-rtt),-zeps) ) &
+                        - rcp      * ( ztmelts - rtt ) &
+                        )
+
+                     ! Correct dimensions to avoid big values
                      e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) / unit_fac 
 
-                  ! Mutliply by ice volume, and divide by number of layers to get heat content in 10^9 J
+                     ! Mutliply by ice volume, and divide by number of layers to get heat content in 10^9 J
                      e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * & 
-                                  area(ji,jj) * a_i(ji,jj,jl) * ht_i(ji,jj,jl) / &
-                                  nlay_i
+                        area(ji,jj) * a_i(ji,jj,jl) * ht_i(ji,jj,jl) / &
+                        nlay_i
                   END DO ! jk
 
@@ -330,6 +330,6 @@
             ELSE ! on fcor 
 
-            !--- Southern hemisphere
-            !----------------------------------------------------------------
+               !--- Southern hemisphere
+               !----------------------------------------------------------------
 
                !-----------------------
@@ -346,16 +346,16 @@
 
                ELSE ! several categories
-               
-               !level ice
+
+                  !level ice
                   DO jl = ice_cat_bounds(1,1), ice_cat_bounds(1,2) !over thickness categories
 
                      zhis(1)       = ( hi_max(jl-1) + hi_max(jl) ) / 2.0
                      a_i(ji,jj,jl) = zidto * MAX( zgfactors(1) * exp(-(zhis(1)-hgins_u) * & 
-                                        (zhis(1)-hgins_u)/2.0) , epsi06 )
+                        (zhis(1)-hgins_u)/2.0) , epsi06 )
                      ! new line square distribution volume conserving
                      a_i(ji,jj,jl)    = zidto * ( zas * zhis(1) * zhis(1) + zbs * zhis(1) )
                      ht_i(ji,jj,jl)   = zidto * zhis(1) 
                      v_i(ji,jj,jl)    = ht_i(ji,jj,jl)*a_i(ji,jj,jl)
-                  
+
                   END DO ! jl
 
@@ -363,22 +363,22 @@
 
 !!!
-! retour a LIMA_MEC
-!              !ridged ice
-!              zdummy  = hi_max(ice_cat_bounds(2,1)-1)
-!              hi_max(ice_cat_bounds(2,1)-1) = 0.0
-!              DO jl = ice_cat_bounds(2,1), ice_cat_bounds(2,2) !over thickness categories
-!                 zhis(2)       = ( hi_max(jl-1) + hi_max(jl) ) / 2.0
-!                 a_i(ji,jj,jl) = zidto*MAX( zgfactors(2) * exp(-(zhis(2)-hgins_d)*(zhis(2)-hgins_d)/2.0), epsi06 )
-!                 ht_i(ji,jj,jl)   = zidto * zhis(2) 
-!                 v_i(ji,jj,jl)    = ht_i(ji,jj,jl)*a_i(ji,jj,jl)
-!              END DO
-!              hi_max(ice_cat_bounds(2,1)-1) = zdummy
-
-!              !rafted ice
-!              jl = 6
-!              a_i(ji,jj,jl)       = 0.0
-!              ht_i(ji,jj,jl)      = 0.0
-!              v_i(ji,jj,jl)       = 0.0
-! END retour a LIMA_MEC
+               ! retour a LIMA_MEC
+               !              !ridged ice
+               !              zdummy  = hi_max(ice_cat_bounds(2,1)-1)
+               !              hi_max(ice_cat_bounds(2,1)-1) = 0.0
+               !              DO jl = ice_cat_bounds(2,1), ice_cat_bounds(2,2) !over thickness categories
+               !                 zhis(2)       = ( hi_max(jl-1) + hi_max(jl) ) / 2.0
+               !                 a_i(ji,jj,jl) = zidto*MAX( zgfactors(2) * exp(-(zhis(2)-hgins_d)*(zhis(2)-hgins_d)/2.0), epsi06 )
+               !                 ht_i(ji,jj,jl)   = zidto * zhis(2) 
+               !                 v_i(ji,jj,jl)    = ht_i(ji,jj,jl)*a_i(ji,jj,jl)
+               !              END DO
+               !              hi_max(ice_cat_bounds(2,1)-1) = zdummy
+
+               !              !rafted ice
+               !              jl = 6
+               !              a_i(ji,jj,jl)       = 0.0
+               !              ht_i(ji,jj,jl)      = 0.0
+               !              v_i(ji,jj,jl)       = 0.0
+               ! END retour a LIMA_MEC
 !!!
 
@@ -424,5 +424,5 @@
                      ! Multiply by volume, so that heat content in 10^9 Joules
                      e_s(ji,jj,jk,jl) = e_s(ji,jj,jk,jl) * area(ji,jj) * &
-                                        v_s(ji,jj,jl)  / nlay_s
+                        v_s(ji,jj,jl)  / nlay_s
                   END DO
 
@@ -435,19 +435,19 @@
                      s_i(ji,jj,jk,jl) = zidto * sins + ( 1.0 - zidto ) * 0.1
                      ztmelts          = - tmut * s_i(ji,jj,jk,jl) + rtt !Melting temperature in K
- 
-                  ! heat content per unit volume
+
+                     ! heat content per unit volume
                      e_i(ji,jj,jk,jl) = zidto * rhoic * &
-                     (   cpic    * ( ztmelts - t_i(ji,jj,jk,jl) ) &
-                     +   lfus  * ( 1.0 - (ztmelts-rtt) / MIN((t_i(ji,jj,jk,jl)-rtt),-zeps) ) &
-                     - rcp      * ( ztmelts - rtt ) &
-                     )
-
-                  ! Correct dimensions to avoid big values
+                        (   cpic    * ( ztmelts - t_i(ji,jj,jk,jl) ) &
+                        +   lfus  * ( 1.0 - (ztmelts-rtt) / MIN((t_i(ji,jj,jk,jl)-rtt),-zeps) ) &
+                        - rcp      * ( ztmelts - rtt ) &
+                        )
+
+                     ! Correct dimensions to avoid big values
                      e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) / unit_fac 
 
-                  ! Mutliply by ice volume, and divide by number of layers to get heat content in 10^9 J
+                     ! Mutliply by ice volume, and divide by number of layers to get heat content in 10^9 J
                      e_i(ji,jj,jk,jl) = e_i(ji,jj,jk,jl) * & 
-                                     area(ji,jj) * a_i(ji,jj,jl) * ht_i(ji,jj,jl) / &
-                                     nlay_i
+                        area(ji,jj) * a_i(ji,jj,jl) * ht_i(ji,jj,jl) / &
+                        nlay_i
                   END DO !jk
 
@@ -549,5 +549,5 @@
       !!-----------------------------------------------------------------------------
       NAMELIST/namiceini/ ttest, hninn, hginn_u, aginn_u, hginn_d, aginn_d, hnins, &
-                          hgins_u, agins_u, hgins_d, agins_d, sinn, sins
+         hgins_u, agins_u, hgins_d, agins_d, sinn, sins
       !!-----------------------------------------------------------------------------
 
@@ -576,5 +576,5 @@
          WRITE(numout,*) '   initial  ice salinity       in the south     sins       = ', sins
       ENDIF
-            
+
    END SUBROUTINE lim_istate_init
 
