Index: branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/iceini.F90
===================================================================
--- branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/iceini.F90	(revision 4292)
+++ branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/iceini.F90	(revision 4293)
@@ -71,8 +71,6 @@
          &     'use more ocean levels or less ice/snow layers/categories.' )
 
-                                       ! Open the reference and configuration namelist files and namelist output file 
-      CALL ctl_opn( numnam_ice_ref, 'namelist_ice_ref',    'OLD',     'FORMATTED', 'SEQUENTIAL', -1, numout, lwp ) 
-      CALL ctl_opn( numnam_ice_cfg, 'namelist_ice_cfg',    'OLD',     'FORMATTED', 'SEQUENTIAL', -1, numout, lwp )
-      CALL ctl_opn( numoni,         'output.namelist.ice', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp )
+      !                                ! Open the namelist file 
+      CALL ctl_opn( numnam_ice, 'namelist_ice', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp )
       !
       CALL ice_run                     ! set some ice run parameters
@@ -103,4 +101,6 @@
       ENDIF
       !
+      hi_max(jpl) = 99._wp  ! Set hi_max(jpl) to a big value to ensure that all ice is thinner than hi_max(jpl)
+      !
       CALL lim_sbc_init                ! ice surface boundary condition   
       !
@@ -129,20 +129,13 @@
       !!-------------------------------------------------------------------
       NAMELIST/namicerun/ cn_icerst_in, cn_icerst_out, ln_limdyn, amax, cai, cao, ln_nicep, ln_limdiahsb, ln_limdiaout
-      INTEGER  ::   ios                 ! Local integer output status for namelist read
       !!-------------------------------------------------------------------
       !                    
-      REWIND( numnam_ice_ref )              ! Namelist namicerun in reference namelist : Parameters for ice
-      READ  ( numnam_ice_ref, namicerun, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicerun in reference namelist', lwp )
-
-      REWIND( numnam_ice_cfg )              ! Namelist namicerun in configuration namelist : Parameters for ice
-      READ  ( numnam_ice_cfg, namicerun, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicerun in configuration namelist', lwp )
-      WRITE ( numoni, namicerun )
-      !
-      IF( lk_mpp .AND. ln_nicep ) THEN
-         ln_nicep = .FALSE.
-         CALL ctl_warn( 'ice_run : specific control print for LIM3 desactivated with MPI' )
-      ENDIF
+      REWIND( numnam_ice )                ! Read Namelist namicerun 
+      READ  ( numnam_ice , namicerun )
+      !
+      !IF( lk_mpp .AND. ln_nicep ) THEN
+      !   ln_nicep = .FALSE.
+      !   CALL ctl_warn( 'ice_run : specific control print for LIM3 desactivated with MPI' )
+      !ENDIF
       !
       IF(lwp) THEN                        ! control print
@@ -168,4 +161,6 @@
       !! ** Purpose :   Initializes the ice thickness distribution
       !! ** Method  :   ...
+      !!    Note    : hi_max(jpl) is here set up to a value close to 7 m for
+      !!              limistate (only) and is changed to 99 m in ice_init
       !!------------------------------------------------------------------
       INTEGER  ::   jl, jm               ! dummy loop index
Index: branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/limitd_me.F90
===================================================================
--- branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/limitd_me.F90	(revision 4292)
+++ branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/limitd_me.F90	(revision 4293)
@@ -183,8 +183,4 @@
       ! 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).
-
-      hi_max(jpl) = 999.99
-
       Cp = 0.5 * grav * (rau0-rhoic) * rhoic / rau0                ! proport const for PE
       !
@@ -1481,5 +1477,4 @@
       !! ** input   :   Namelist namiceitdme
       !!-------------------------------------------------------------------
-      INTEGER :: ios                 ! Local integer output status for namelist read
       NAMELIST/namiceitdme/ ridge_scheme_swi, Cs, Cf, fsnowrdg, fsnowrft,& 
          Gstar, astar,                                &
@@ -1489,12 +1484,6 @@
       !!-------------------------------------------------------------------
       !
-      REWIND( numnam_ice_ref )              ! Namelist namicetdme in reference namelist : Ice mechanical ice redistribution
-      READ  ( numnam_ice_ref, namiceitdme, IOSTAT = ios, ERR = 901)
-901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namiceitdme in reference namelist', lwp )
-
-      REWIND( numnam_ice_cfg )              ! Namelist namiceitdme in configuration namelist : Ice mechanical ice redistribution
-      READ  ( numnam_ice_cfg, namiceitdme, IOSTAT = ios, ERR = 902 )
-902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namiceitdme in configuration namelist', lwp )
-      WRITE ( numoni, namiceitdme )
+      REWIND( numnam_ice )                   ! read namiceitdme namelist
+      READ  ( numnam_ice , namiceitdme)
       !
       IF (lwp) THEN                          ! control print
Index: branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/limitd_th.F90
===================================================================
--- branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/limitd_th.F90	(revision 4292)
+++ branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/limitd_th.F90	(revision 4293)
@@ -321,5 +321,5 @@
       ! Tricky trick see limitd_me.F90
       ! will be soon removed, CT
-      ! hi_max(kubnd) = 999.99
+      ! hi_max(kubnd) = 99.
       zhbnew(:,:,:) = 0._wp
 
@@ -402,5 +402,7 @@
                zhbnew(ji,jj,kubnd) = 3._wp * ht_i(ji,jj,kubnd) - 2._wp * zhbnew(ji,jj,kubnd-1)
             ELSE
-               zhbnew(ji,jj,kubnd) = hi_max(kubnd)
+               zhbnew(ji,jj,kubnd) = hi_max(kubnd)  
+               !!? clem bug: since hi_max(jpl)=99, this limit is very high 
+               !!? but I think it is erased in fitline subroutine 
             ENDIF
 
@@ -1009,7 +1011,10 @@
                   !zdaice(ji,jj,jl)  = a_i(ji,jj,jl)
                   !zdvice(ji,jj,jl)  = v_i(ji,jj,jl)
-                  zdaice(ji,jj,jl)  = a_i(ji,jj,jl)/2
-                  zdvice(ji,jj,jl)  = v_i(ji,jj,jl)-zdaice(ji,jj,jl)*(hi_max(jl)+hi_max(jl-1))/2
+                  !zdaice(ji,jj,jl)  = a_i(ji,jj,jl) * 0.5_wp
+                  !zdvice(ji,jj,jl)  = v_i(ji,jj,jl)-zdaice(ji,jj,jl)*(hi_max(jl)+hi_max(jl-1)) * 0.5_wp
                   ! end TECLIM change 
+                  ! clem: how much of a_i you send in cat sup is somewhat arbitrary
+                  zdaice(ji,jj,jl)  = a_i(ji,jj,jl) * ( ht_i(ji,jj,jl) - hi_max(jl) ) / ht_i(ji,jj,jl)  
+                  zdvice(ji,jj,jl)  = v_i(ji,jj,jl) - ( a_i(ji,jj,jl) - zdaice(ji,jj,jl) ) * ( hi_max(jl) - epsi10 )
                ENDIF
             END DO                 ! ji
Index: branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/limupdate1.F90
===================================================================
--- branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/limupdate1.F90	(revision 4292)
+++ branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/limupdate1.F90	(revision 4293)
@@ -198,5 +198,5 @@
 !      !ENDIF
 !
-      zhimax = .3_wp
+      zhimax = 5._wp
       ! first category
       DO jj = 1, jpj
@@ -205,9 +205,9 @@
             !--- thus we recompute a new area while conserving ice volume
             zat_i_old = SUM( old_a_i(ji,jj,:) )
-            zindb     = MAX( 0._wp, SIGN( 1._wp, ABS( d_a_i_trp(ji,jj,1)) - epsi10 ) ) 
-            IF ( ( ABS(d_v_i_trp(ji,jj,1))/MAX(ABS(d_a_i_trp(ji,jj,1)),epsi10)*zindb .GT. zhimax) &
-                 .AND.( ( v_i(ji,jj,1)/MAX(a_i(ji,jj,1),epsi10)*zindb) .GT. zhimax ) &
-                 .AND.( zat_i_old .LT. 1.e-6 ) )  THEN ! new line
-               ht_i(ji,jj,1) = hi_max(1) / 2.0
+            zindb     = MAX( 0._wp, SIGN( 1._wp, ABS( d_a_i_trp(ji,jj,1) ) - epsi10 ) ) 
+            IF( ( ABS( d_v_i_trp(ji,jj,1) ) / MAX( ABS( d_a_i_trp(ji,jj,1) ), epsi10 ) * zindb .GT. zhimax ) &
+              &   .AND.( ( v_i(ji,jj,1) / MAX( a_i(ji,jj,1), epsi10 ) * zindb ) .GT. zhimax ) &
+              &   .AND.( zat_i_old .LT. 1.e-6 ) )  THEN ! new line
+               ht_i(ji,jj,1) = hi_max(1) * 0.5_wp
                a_i (ji,jj,1) = v_i(ji,jj,1) / ht_i(ji,jj,1)
             ENDIF
@@ -228,5 +228,5 @@
 !      !ENDIF
 
-      zhimax = 1._wp
+      zhimax = 20._wp
       ! other categories
       DO jl = 2, jpl
@@ -234,5 +234,5 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-               zindb =  MAX( rzero, SIGN( rone, ABS(d_a_i_trp(ji,jj,jl)) - epsi10 ) ) 
+               zindb =  MAX( rzero, SIGN( rone, ABS( d_a_i_trp(ji,jj,jl) ) - epsi10 ) ) 
                ! this correction is very tricky... sometimes, advection gets wrong i don't know why
                ! it makes problems when the advected volume and concentration do not seem to be 
@@ -242,7 +242,7 @@
                ! which of course is plausible
                ! but fuck! it fucks everything up :)
-               IF ( (ABS(d_v_i_trp(ji,jj,jl))/MAX(ABS(d_a_i_trp(ji,jj,jl)),epsi10)*zindb .GT. zhimax) &
-                    .AND.(v_i(ji,jj,jl)/MAX(a_i(ji,jj,jl),epsi10)*zindb) .GT. zhimax ) THEN
-                  ht_i(ji,jj,jl) = ( hi_max_typ(jl-ice_cat_bounds(jm,1),jm) + hi_max_typ(jl-ice_cat_bounds(jm,1)+1,jm) ) / 2.0
+               IF ( ( ABS( d_v_i_trp(ji,jj,jl) ) / MAX( ABS( d_a_i_trp(ji,jj,jl) ), epsi10 ) * zindb .GT. zhimax ) &
+                  &  .AND. ( v_i(ji,jj,jl) / MAX( a_i(ji,jj,jl), epsi10 ) * zindb ) .GT. zhimax ) THEN
+                  ht_i(ji,jj,jl) = ( hi_max_typ(jl-ice_cat_bounds(jm,1),jm) + hi_max_typ(jl-ice_cat_bounds(jm,1)+1,jm) ) * 0.5_wp
                   a_i (ji,jj,jl) = v_i(ji,jj,jl) / ht_i(ji,jj,jl)
                ENDIF
Index: branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/limupdate2.F90
===================================================================
--- branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/limupdate2.F90	(revision 4292)
+++ branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/LIM_SRC_3/limupdate2.F90	(revision 4293)
@@ -194,5 +194,5 @@
 !      !ENDIF
 
-      zhimax = .3_wp
+      zhimax = 5._wp
       ! first category
       DO jj = 1, jpj
@@ -201,9 +201,9 @@
             !--- thus we recompute a new area while conserving ice volume
             zat_i_old = SUM( old_a_i(ji,jj,:) )
-            zindb     = MAX( 0._wp, SIGN( 1._wp, ABS( d_a_i_thd(ji,jj,1)) - epsi10 ) ) 
-            IF ( ( ABS(d_v_i_thd(ji,jj,1))/MAX(ABS(d_a_i_thd(ji,jj,1)),epsi10)*zindb .GT. zhimax) &
-                 .AND.( ( v_i(ji,jj,1)/MAX(a_i(ji,jj,1),epsi10)*zindb) .GT. zhimax ) &
-                 .AND.( zat_i_old .LT. 1.e-6 ) )  THEN ! new line
-               ht_i(ji,jj,1) = hi_max(1) / 2.0
+            zindb     = MAX( 0._wp, SIGN( 1._wp, ABS( d_a_i_thd(ji,jj,1) ) - epsi10 ) ) 
+            IF ( ( ABS( d_v_i_thd(ji,jj,1) ) / MAX( ABS( d_a_i_thd(ji,jj,1) ),epsi10 ) * zindb .GT. zhimax ) &
+               &  .AND. ( ( v_i(ji,jj,1) / MAX( a_i(ji,jj,1), epsi10 ) * zindb ) .GT. zhimax ) &
+               &  .AND. ( zat_i_old .LT. 1.e-6 ) )  THEN ! new line
+               ht_i(ji,jj,1) = hi_max(1) * 0.5_wp
                a_i (ji,jj,1) = v_i(ji,jj,1) / ht_i(ji,jj,1)
             ENDIF
@@ -223,5 +223,5 @@
 !      !ENDIF
 ! 
-      zhimax = 1._wp
+      zhimax = 20._wp
       ! other categories
       DO jl = 2, jpl
@@ -229,5 +229,5 @@
          DO jj = 1, jpj
             DO ji = 1, jpi
-               zindb =  MAX( rzero, SIGN( rone, ABS(d_a_i_thd(ji,jj,jl)) - epsi10 ) ) 
+               zindb =  MAX( rzero, SIGN( rone, ABS( d_a_i_thd(ji,jj,jl)) - epsi10 ) ) 
               ! this correction is very tricky... sometimes, advection gets wrong i don't know why
                ! it makes problems when the advected volume and concentration do not seem to be 
@@ -237,7 +237,7 @@
                ! which of course is plausible
                ! but fuck! it fucks everything up :)
-               IF ( (ABS(d_v_i_thd(ji,jj,jl))/MAX(ABS(d_a_i_thd(ji,jj,jl)),epsi10)*zindb .GT. zhimax) &
-                    .AND.(v_i(ji,jj,jl)/MAX(a_i(ji,jj,jl),epsi10)*zindb) .GT. zhimax ) THEN
-                  ht_i(ji,jj,jl) = ( hi_max_typ(jl-ice_cat_bounds(jm,1),jm) + hi_max_typ(jl-ice_cat_bounds(jm,1)+1,jm) ) / 2.0
+               IF ( ( ABS( d_v_i_thd(ji,jj,jl) ) / MAX( ABS( d_a_i_thd(ji,jj,jl) ), epsi10 ) * zindb .GT. zhimax ) &
+                  &  .AND. ( v_i(ji,jj,jl) / MAX( a_i(ji,jj,jl), epsi10 ) * zindb ) .GT. zhimax ) THEN
+                  ht_i(ji,jj,jl) = ( hi_max_typ(jl-ice_cat_bounds(jm,1),jm) + hi_max_typ(jl-ice_cat_bounds(jm,1)+1,jm) ) * 0.5_wp
                   a_i (ji,jj,jl) = v_i(ji,jj,jl) / ht_i(ji,jj,jl)
                ENDIF
