Index: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/ice.F90
===================================================================
--- branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/ice.F90	(revision 8504)
+++ branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/ice.F90	(revision 8505)
@@ -192,7 +192,4 @@
    REAL(wp), PUBLIC ::   rn_tmi_ini_s     ! initial temperature
    
-   !                                     !!** ice-thickness distribution namelist (namiceitd) **
-   REAL(wp), PUBLIC ::   rn_himean        !: mean thickness of the domain (used to compute the distribution, nn_itdshp = 2 only)
-
    !                                     !!** ice-dynamics namelist (namicedyn) **
                                           ! -- iceadv -- !
Index: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/iceadv.F90
===================================================================
--- branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/iceadv.F90	(revision 8504)
+++ branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/iceadv.F90	(revision 8505)
@@ -117,9 +117,9 @@
       !----------
       SELECT CASE ( nn_limadv )
-      CASE ( 0 )                    !--  Ultimate-MACHO scheme
+      CASE ( 0 )                    !-- ULTIMATE-MACHO scheme
          CALL ice_adv_umx( kt, u_ice, v_ice,  &
             &              ato_i, v_i, v_s, smv_i, oa_i, a_i, a_ip, v_ip, e_s, e_i )
          
-      CASE ( -1 )                   !-- Prather scheme
+      CASE ( -1 )                   !-- PRATHER scheme
          CALL ice_adv_prather( kt, u_ice, v_ice,  &
             &                  ato_i, v_i, v_s, smv_i, oa_i, a_i, a_ip, v_ip, e_s, e_i )
Index: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icealb.F90
===================================================================
--- branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icealb.F90	(revision 8504)
+++ branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icealb.F90	(revision 8505)
@@ -13,5 +13,5 @@
    !!   alb_init      : initialisation of albedo computation
    !!----------------------------------------------------------------------
-   USE ice     , ONLY : jpl   ! number of ice category
+   USE ice, ONLY: jpl ! sea-ice: number of categories
    USE phycst         ! physical constants
    !
@@ -23,9 +23,9 @@
    PRIVATE
 
-   PUBLIC   ice_alb   ! routine called in iceforcing.F90 and iceupdate.F90
+   PUBLIC   ice_alb_init   ! called in icestp
+   PUBLIC   ice_alb        ! called in iceforcing.F90 and iceupdate.F90
 
    REAL(wp), PUBLIC, PARAMETER ::   rn_alb_oce = 0.066   !: ocean or lead albedo (Pegau and Paulson, Ann. Glac. 2001)
 
-   INTEGER  ::   albd_init = 0       ! control flag for initialization  
    REAL(wp) , PARAMETER ::   rc1    = 0.05    ! snow thickness (only for nn_ice_alb=0)
    REAL(wp) , PARAMETER ::   rc2    = 0.10    !  "        "
@@ -33,8 +33,15 @@
    REAL(wp) , PARAMETER ::   r1_c1 = 1. / rc1
    REAL(wp) , PARAMETER ::   r1_c2 = 1. / rc2
- 
-   !                             !!* namelist namsbc_alb *
-   INTEGER  ::   nn_ice_alb
-   REAL(wp) ::   rn_alb_sdry, rn_alb_smlt, rn_alb_idry, rn_alb_imlt, rn_alb_dpnd
+   !
+   ! ** albedo namelist (namicealb)
+   INTEGER  ::   nn_ice_alb       ! type of albedo scheme: 0: Shine & Henderson-Sellers (JGR 1985)
+   !                                      !                         1: "home made" based on Brandt et al. (JClim 2005)
+   !                                      !                             and Grenfell & Perovich (JGR 2004)
+   !                                      !                         2: Same as 1 but with melt ponds
+   REAL(wp) ::   rn_alb_sdry      ! dry snow albedo
+   REAL(wp) ::   rn_alb_smlt      ! melting snow albedo
+   REAL(wp) ::   rn_alb_idry      ! dry ice albedo
+   REAL(wp) ::   rn_alb_imlt      ! bare puddled ice albedo
+   REAL(wp) ::   rn_alb_dpnd      ! ponded ice albedo
 
    !!----------------------------------------------------------------------
@@ -102,6 +109,4 @@
       REAL(wp), DIMENSION(jpi,jpj,jpl) ::   zafrac_pnd      ! relative ice fraction (effective)
       !!---------------------------------------------------------------------
-
-      IF( albd_init == 0 )   CALL alb_init      ! initialization 
 
       !-----------------------------------------------------
@@ -299,5 +304,5 @@
 
 
-   SUBROUTINE alb_init
+   SUBROUTINE ice_alb_init
       !!----------------------------------------------------------------------
       !!                 ***  ROUTINE alb_init  ***
@@ -311,6 +316,4 @@
       NAMELIST/namicealb/ nn_ice_alb, rn_alb_sdry, rn_alb_smlt, rn_alb_idry, rn_alb_imlt, rn_alb_dpnd
       !!----------------------------------------------------------------------
-      !
-      albd_init = 1                     ! indicate that the initialization has been done
       !
       REWIND( numnam_ice_ref )              ! Namelist namicealb in reference namelist : Albedo parameters
@@ -336,5 +339,5 @@
       ENDIF
       !
-   END SUBROUTINE alb_init
+   END SUBROUTINE ice_alb_init
 
 #else
Index: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icedia.F90
===================================================================
--- branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icedia.F90	(revision 8504)
+++ branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icedia.F90	(revision 8505)
@@ -31,6 +31,6 @@
    PRIVATE
 
-   PUBLIC   ice_dia        ! routine called by icestp.F90
-   PUBLIC   ice_dia_init   ! routine called in icestp.F90
+   PUBLIC   ice_dia        ! called by icestp.F90
+   PUBLIC   ice_dia_init   ! called in icestp.F90
 
    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::   vol_loc_ini, sal_loc_ini, tem_loc_ini ! initial volume, salt and heat contents
@@ -162,25 +162,38 @@
       !!             - Compute coefficients for conversion
       !!---------------------------------------------------------------------------
-      INTEGER            ::   ierror   ! local integer
-      !!
-      !!NAMELIST/namicehsb/ blabla
+      INTEGER            ::   ios, ierror   ! local integer
+      !!
+      NAMELIST/namicediag/ ln_limdiachk, ln_limdiahsb, ln_limctl, iiceprt, jiceprt  
       !!----------------------------------------------------------------------
       !
-      !!REWIND ( numnam_ice )              ! Read Namelist namicehsb 
-      !!READ   ( numnam_ice, namicehsb )
-      !
-      IF(lwp) THEN                   ! Control print
+      REWIND( numnam_ice_ref )      ! Namelist namicediag in reference namelist : Parameters for ice
+      READ  ( numnam_ice_ref, namicediag, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicediag in reference namelist', lwp )
+
+      REWIND( numnam_ice_cfg )      ! Namelist namicediag in configuration namelist : Parameters for ice
+      READ  ( numnam_ice_cfg, namicediag, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicediag in configuration namelist', lwp )
+      IF(lwm) WRITE ( numoni, namicediag )
+      !
+      IF(lwp) THEN                  ! control print
          WRITE(numout,*)
-         WRITE(numout,*) 'ice_dia_init : check the heat and salt budgets'
-         WRITE(numout,*) '~~~~~~~~~~~~'
+         WRITE(numout,*) 'ice_dia_init: ice diagnostics'
+         WRITE(numout,*) ' ~~~~~~~~~~~'
+         WRITE(numout,*) '   Namelist namicediag : '
+         WRITE(numout,*) '      Diagnose online heat/mass/salt budget      ln_limdiachk = ', ln_limdiachk
+         WRITE(numout,*) '      Output          heat/mass/salt budget      ln_limdiahsb = ', ln_limdiahsb
+         WRITE(numout,*) '      control prints for a given grid point         ln_limctl = ', ln_limctl
+         WRITE(numout,*) '         chosen grid point position         (iiceprt,jiceprt) = (', iiceprt,',', jiceprt,')'
       ENDIF
       !      
-      ALLOCATE( vol_loc_ini(jpi,jpj), sal_loc_ini(jpi,jpj), tem_loc_ini(jpi,jpj), STAT=ierror )
-      IF( ierror > 0 )  THEN
-         CALL ctl_stop( 'ice_dia: unable to allocate vol_loc_ini' )
-         RETURN
-      ENDIF
-      !
-      CALL ice_dia_rst( 'READ' )  !* read or initialize all required files
+      IF( ln_limdiahsb ) THEN
+         ALLOCATE( vol_loc_ini(jpi,jpj), sal_loc_ini(jpi,jpj), tem_loc_ini(jpi,jpj), STAT=ierror )
+         IF( ierror > 0 )  THEN
+            CALL ctl_stop( 'ice_dia: unable to allocate vol_loc_ini' )
+            RETURN
+         ENDIF
+         !
+         CALL ice_dia_rst( 'READ' )  !* read or initialize all required files
+      ENDIF
       !
    END SUBROUTINE ice_dia_init
Index: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/iceitd.F90
===================================================================
--- branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/iceitd.F90	(revision 8504)
+++ branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/iceitd.F90	(revision 8505)
@@ -34,6 +34,10 @@
    PRIVATE
 
+   PUBLIC   ice_itd_init  ! called in icestp
    PUBLIC   ice_itd_rem   ! called in icethd
    PUBLIC   ice_itd_reb   ! called in iceerr
+
+   ! ** ice-thickness distribution namelist (namiceitd) **
+   REAL(wp) ::   rn_himean        ! mean thickness of the domain (used to compute the distribution)
 
    !!----------------------------------------------------------------------
@@ -181,5 +185,4 @@
       ENDIF
    
-
       !-----------------------------------------------------------------------------------------------
       !  4) Compute g(h) 
@@ -636,4 +639,60 @@
    END SUBROUTINE ice_itd_reb
 
+   SUBROUTINE ice_itd_init
+      !!------------------------------------------------------------------
+      !!                ***  ROUTINE ice_itd_init ***
+      !!
+      !! ** Purpose :   Initializes the ice thickness distribution
+      !! ** Method  :   ...
+      !! ** input   :   Namelist namiceitd
+      !!-------------------------------------------------------------------
+      INTEGER  ::   jl    ! dummy loop index
+      INTEGER  ::   ios   ! Local integer output status for namelist read
+      REAL(wp) ::   zhmax, znum, zden, zalpha   !   -      -
+      !!
+      NAMELIST/namiceitd/ rn_himean
+      !!------------------------------------------------------------------
+      !
+      REWIND( numnam_ice_ref )      ! Namelist namiceitd in reference namelist : Parameters for ice
+      READ  ( numnam_ice_ref, namiceitd, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namiceitd in reference namelist', lwp )
+
+      REWIND( numnam_ice_cfg )      ! Namelist namiceitd in configuration namelist : Parameters for ice
+      READ  ( numnam_ice_cfg, namiceitd, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namiceitd in configuration namelist', lwp )
+      IF(lwm) WRITE ( numoni, namiceitd )
+      !
+      IF(lwp) THEN                  ! control print
+         WRITE(numout,*)
+         WRITE(numout,*) 'ice_itd_init : Initialization of ice cat distribution '
+         WRITE(numout,*) '~~~~~~~~~~~~'
+         WRITE(numout,*) '   Namelist namicerun : '
+         WRITE(numout,*) '      mean ice thickness in the domain               rn_himean = ', rn_himean
+      ENDIF
+      !
+      !-----------------------------------!
+      !  Thickness categories boundaries  !
+      !-----------------------------------!
+      !
+      zalpha = 0.05_wp              ! max of each category (from h^(-alpha) function)
+      zhmax  = 3._wp * rn_himean
+      DO jl = 1, jpl
+         znum = jpl * ( zhmax+1 )**zalpha
+         zden = REAL( jpl-jl , wp ) * ( zhmax + 1._wp )**zalpha + REAL( jl , wp )
+         hi_max(jl) = ( znum / zden )**(1./zalpha) - 1
+      END DO
+      !
+      DO jl = 1, jpl                ! mean thickness by category
+         hi_mean(jl) = ( hi_max(jl) + hi_max(jl-1) ) * 0.5_wp
+      END DO
+      !
+      hi_max(jpl) = 99._wp          ! set to a big value to ensure that all ice is thinner than hi_max(jpl)
+      !
+      IF(lwp) WRITE(numout,*)
+      IF(lwp) WRITE(numout,*) '   ===>>>   resulting thickness category boundaries :'
+      IF(lwp) WRITE(numout,*) '            hi_max(:)= ', hi_max(0:jpl)
+      !
+   END SUBROUTINE ice_itd_init
+
 #else
    !!----------------------------------------------------------------------
Index: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icestp.F90
===================================================================
--- branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icestp.F90	(revision 8504)
+++ branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icestp.F90	(revision 8505)
@@ -51,4 +51,6 @@
    USE iceist         ! sea-ice: initial state
    USE icethd_sal     ! sea-ice: thermodynamics and salinity
+   USE iceitd         ! sea-ice: remapping thickness distribution
+   USE icealb         ! sea-ice: albedo
    !
    USE bdy_oce , ONLY : ln_bdy   ! flag for bdy
@@ -285,5 +287,5 @@
       ! END MV MP 2016
 
-      IF( ln_limdyn )   CALL ice_rdgrft_init             ! ice thickness distribution initialization for ridging/rafting
+      IF( ln_limdyn )   CALL ice_rdgrft_init  ! ice thickness distribution initialization for ridging/rafting
       !                                ! Initial sea-ice state
       IF( .NOT. ln_rstart ) THEN              ! start from rest: sea-ice deduced from sst
@@ -297,5 +299,7 @@
       CALL ice_update_init                 ! ice surface boundary condition
       !
-      IF( ln_limdiahsb) CALL ice_dia_init  ! initialization for diags
+      CALL ice_alb_init                    ! ice surface albedo
+      !
+      CALL ice_dia_init                    ! initialization for diags
       !
       fr_i  (:,:)   = at_i(:,:)         ! initialisation of sea-ice fraction
@@ -327,5 +331,4 @@
       NAMELIST/namicerun/ jpl, nlay_i, nlay_s, nn_monocat, rn_amax_n, rn_amax_s, cn_icerst_in, cn_icerst_indir,   &
          &                cn_icerst_out, cn_icerst_outdir, ln_limthd, ln_limdyn, nn_limdyn, rn_uice, rn_vice  
-      NAMELIST/namicediag/ ln_limdiachk, ln_limdiahsb, ln_limctl, iiceprt, jiceprt  
       !!-------------------------------------------------------------------
       !
@@ -338,13 +341,4 @@
 902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicerun in configuration namelist', lwp )
       IF(lwm) WRITE ( numoni, namicerun )
-      !
-      REWIND( numnam_ice_ref )      ! Namelist namicediag in reference namelist : Parameters for ice
-      READ  ( numnam_ice_ref, namicediag, IOSTAT = ios, ERR = 903)
-903   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicediag in reference namelist', lwp )
-
-      REWIND( numnam_ice_cfg )      ! Namelist namicediag in configuration namelist : Parameters for ice
-      READ  ( numnam_ice_cfg, namicediag, IOSTAT = ios, ERR = 904 )
-904   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namicediag in configuration namelist', lwp )
-      IF(lwm) WRITE ( numoni, namicediag )
       !
       IF(lwp) THEN                  ! control print
@@ -366,10 +360,4 @@
          WRITE(numout,*) '            =0 advection only with prescribed velocity given by '
          WRITE(numout,*) '               a uniform field        (u,v)_ice = (rn_uice,rn_vice) = (', rn_uice,',', rn_vice,')'
-         WRITE(numout,*)
-         WRITE(numout,*) '   Namelist namicediag : '
-         WRITE(numout,*) '      Diagnose online heat/mass/salt budget      ln_limdiachk = ', ln_limdiachk
-         WRITE(numout,*) '      Output          heat/mass/salt budget      ln_limdiahsb = ', ln_limdiahsb
-         WRITE(numout,*) '      control prints for a given grid point         ln_limctl = ', ln_limctl
-         WRITE(numout,*) '         chosen grid point position         (iiceprt,jiceprt) = (', iiceprt,',', jiceprt,')'
       ENDIF
       !
@@ -412,62 +400,4 @@
       !
    END SUBROUTINE ice_run_init
-
-
-   SUBROUTINE ice_itd_init
-      !!------------------------------------------------------------------
-      !!                ***  ROUTINE ice_itd_init ***
-      !!
-      !! ** Purpose :   Initializes the ice thickness distribution
-      !! ** Method  :   ...
-      !! ** input   :   Namelist namiceitd
-      !!-------------------------------------------------------------------
-      INTEGER  ::   jl    ! dummy loop index
-      INTEGER  ::   ios   ! Local integer output status for namelist read
-      REAL(wp) ::   zc1, zc2, zc3, zx1          ! local scalars
-      REAL(wp) ::   zhmax, znum, zden, zalpha   !   -      -
-      !!
-      NAMELIST/namiceitd/ rn_himean
-      !!------------------------------------------------------------------
-      !
-      REWIND( numnam_ice_ref )      ! Namelist namiceitd in reference namelist : Parameters for ice
-      READ  ( numnam_ice_ref, namiceitd, IOSTAT = ios, ERR = 905)
-905   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namiceitd in reference namelist', lwp )
-
-      REWIND( numnam_ice_cfg )      ! Namelist namiceitd in configuration namelist : Parameters for ice
-      READ  ( numnam_ice_cfg, namiceitd, IOSTAT = ios, ERR = 906 )
-906   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namiceitd in configuration namelist', lwp )
-      IF(lwm) WRITE ( numoni, namiceitd )
-      !
-      IF(lwp) THEN                  ! control print
-         WRITE(numout,*)
-         WRITE(numout,*) 'ice_itd_init : Initialization of ice cat distribution '
-         WRITE(numout,*) '~~~~~~~~~~~~'
-         WRITE(numout,*) '   Namelist namicerun : '
-         WRITE(numout,*) '      mean ice thickness in the domain               rn_himean = ', rn_himean
-      ENDIF
-      !
-      !-----------------------------------!
-      !  Thickness categories boundaries  !
-      !-----------------------------------!
-      !
-      zalpha = 0.05_wp              ! max of each category (from h^(-alpha) function)
-      zhmax  = 3._wp * rn_himean
-      DO jl = 1, jpl
-         znum = jpl * ( zhmax+1 )**zalpha
-         zden = REAL( jpl-jl , wp ) * ( zhmax + 1._wp )**zalpha + REAL( jl , wp )
-         hi_max(jl) = ( znum / zden )**(1./zalpha) - 1
-      END DO
-      !
-      DO jl = 1, jpl                ! mean thickness by category
-         hi_mean(jl) = ( hi_max(jl) + hi_max(jl-1) ) * 0.5_wp
-      END DO
-      !
-      hi_max(jpl) = 99._wp          ! set to a big value to ensure that all ice is thinner than hi_max(jpl)
-      !
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) '   ===>>>   resulting thickness category boundaries :'
-      IF(lwp) WRITE(numout,*) '            hi_max(:)= ', hi_max(0:jpl)
-      !
-   END SUBROUTINE ice_itd_init
 
 
