Index: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/CONFIG/ORCA2_LIM3_PISCES/EXP00/namelist_ice_cfg
===================================================================
--- branches/2017/dev_r8183_ICEMODEL/NEMOGCM/CONFIG/ORCA2_LIM3_PISCES/EXP00/namelist_ice_cfg	(revision 8515)
+++ branches/2017/dev_r8183_ICEMODEL/NEMOGCM/CONFIG/ORCA2_LIM3_PISCES/EXP00/namelist_ice_cfg	(revision 8516)
@@ -1,15 +1,16 @@
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-!! LIM3 configuration namelist: Overwrites SHARED/namelist_ice_lim3_ref
+!! ESIM configuration namelist: Overwrites SHARED/namelist_ice_lim3_ref
 !!              1 - Generic parameters                 (namice_run)
 !!              2 - Ice thickness discretization       (namice_itd)
-!!              3 - Ice ridging/rafting                (namice_rdgrft)
-!!              4 - Ice rheology                       (namice_rhg)
-!!              5 - Ice advection                      (namice_adv)
-!!              6 - Ice thermodynamics                 (namice_thd)
-!!              7 - Ice salinity                       (namice_sal)
-!!              8 - Ice melt ponds                     (namice_mp)
-!!              9 - Ice initialization                 (namice_ini)
-!!             10 - Ice/snow albedos                   (namice_alb)
-!!             11 - Ice diagnostics                    (namice_dia)
+!!              3 - Ice dynamics                       (namice_dyn)
+!!              4 - Ice ridging/rafting                (namice_rdgrft)
+!!              5 - Ice rheology                       (namice_rhg)
+!!              6 - Ice advection                      (namice_adv)
+!!              7 - Ice thermodynamics                 (namice_thd)
+!!              8 - Ice salinity                       (namice_sal)
+!!              9 - Ice melt ponds                     (namice_mp)
+!!             10 - Ice initialization                 (namice_ini)
+!!             11 - Ice/snow albedos                   (namice_alb)
+!!             12 - Ice diagnostics                    (namice_dia)
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 !
@@ -20,4 +21,8 @@
 !------------------------------------------------------------------------------
 &namice_itd     !   Ice discretization
+!------------------------------------------------------------------------------
+/
+!------------------------------------------------------------------------------
+&namice_dyn     !   Ice dynamics
 !------------------------------------------------------------------------------
 /
Index: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/CONFIG/SHARED/namelist_ice_lim3_ref
===================================================================
--- branches/2017/dev_r8183_ICEMODEL/NEMOGCM/CONFIG/SHARED/namelist_ice_lim3_ref	(revision 8515)
+++ branches/2017/dev_r8183_ICEMODEL/NEMOGCM/CONFIG/SHARED/namelist_ice_lim3_ref	(revision 8516)
@@ -3,13 +3,14 @@
 !!              1 - Generic parameters                 (namice_run)
 !!              2 - Ice thickness discretization       (namice_itd)
-!!              3 - Ice ridging/rafting                (namice_rdgrft)
-!!              4 - Ice rheology                       (namice_rhg)
-!!              5 - Ice advection                      (namice_adv)
-!!              6 - Ice thermodynamics                 (namice_thd)
-!!              7 - Ice salinity                       (namice_sal)
-!!              8 - Ice melt ponds                     (namice_mp)
-!!              9 - Ice initialization                 (namice_ini)
-!!             10 - Ice/snow albedos                   (namice_alb)
-!!             11 - Ice diagnostics                    (namice_dia)
+!!              3 - Ice dynamics                       (namice_dyn)
+!!              4 - Ice ridging/rafting                (namice_rdgrft)
+!!              5 - Ice rheology                       (namice_rhg)
+!!              6 - Ice advection                      (namice_adv)
+!!              7 - Ice thermodynamics                 (namice_thd)
+!!              8 - Ice salinity                       (namice_sal)
+!!              9 - Ice melt ponds                     (namice_mp)
+!!             10 - Ice initialization                 (namice_ini)
+!!             11 - Ice/snow albedos                   (namice_alb)
+!!             12 - Ice diagnostics                    (namice_dia)
 !!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 !
@@ -36,4 +37,24 @@
    rn_himean        =   2.0           !  expected domain-average ice thickness (m)
    rn_himin         =   0.1           !  minimum ice thickness (m) used in remapping
+/
+!------------------------------------------------------------------------------
+&namice_dyn     !   Ice dynamics
+!------------------------------------------------------------------------------
+   ln_icedyn        = .true.          !  ice dynamics (T) or not (F) => DO NOT TOUCH UNLESS U KNOW WHAT U DO
+      nn_icedyn     =   2             !     switch for ice dynamics   
+                                      !        2: total
+                                      !        1: advection only (no diffusion, no ridging/rafting)
+                                      !        0: advection only (as 1 but with prescribed velocity, bypass rheology)
+         rn_uice    =   0.00001       !           prescribed ice u-velocity
+         rn_vice    =  -0.00001       !           prescribed ice v-velocity
+   rn_ishlat        =   2.            !  free slip (0) ; partial slip (0-2) ; no slip (2) ; strong slip (>2)
+   rn_cio           =   5.0e-03       !  ice-ocean drag coefficient (-)
+   ln_landfast      = .false.         !  landfast ice parameterization (T or F)                           
+      rn_gamma      =   0.15          !     fraction of ocean depth that ice must reach to initiate landfast
+                                      !        recommended range: [0.1 ; 0.25]
+      rn_icebfr     =  10.            !     maximum bottom stress per unit area of contact (N/m2)                 
+                                      !        a very large value ensures ice velocity=0 even with a small contact area
+                                      !        recommended range: ?? (should be greater than atm-ice stress => >0.1 N/m2)
+      rn_lfrelax    =   1.e-5         !     relaxation time scale to reach static friction (s-1)                 
 /
 !------------------------------------------------------------------------------
@@ -67,30 +88,14 @@
 &namice_rhg     !   Ice rheology
 !------------------------------------------------------------------------------
-   rn_ishlat        =   2.            !  free slip (0) ; partial slip (0-2) ; no slip (2) ; strong slip (>2)
-   rn_cio           =   5.0e-03       !  ice-ocean drag coefficient (-)
-   rn_creepl        =   1.0e-12       !  creep limit (s-1)
-   rn_ecc           =   2.0           !  eccentricity of the elliptical yield curve          
-   nn_nevp          = 120             !  number of EVP subcycles                             
-   rn_relast        =   0.333         !  ratio of elastic timescale to ice time step: Telast = dt_ice * rn_relast 
-                                      !     advised value: 1/3 (rn_nevp=120) or 1/9 (rn_nevp=300)
-   ln_landfast      = .false.         !  landfast ice parameterization (T or F)                           
-      rn_gamma      =   0.15          !     fraction of ocean depth that ice must reach to initiate landfast
-                                      !        recommended range: [0.1 ; 0.25]
-      rn_icebfr     =  10.            !     maximum bottom stress per unit area of contact (N/m2)                 
-                                      !        a very large value ensures ice velocity=0 even with a small contact area
-                                      !        recommended range: ?? (should be greater than atm-ice stress => >0.1 N/m2)
-      rn_lfrelax    =   1.e-5         !     relaxation time scale to reach static friction (s-1)                 
+   ln_rhg_EVP       = .true.          !  EVP rheology
+      rn_creepl     =   1.0e-12       !     creep limit (s-1)
+      rn_ecc        =   2.0           !     eccentricity of the elliptical yield curve          
+      nn_nevp       = 120             !     number of EVP subcycles                             
+      rn_relast     =   0.333         !     ratio of elastic timescale to ice time step: Telast = dt_ice * rn_relast 
+                                      !        advised value: 1/3 (rn_nevp=120) or 1/9 (rn_nevp=300)
 /
 !------------------------------------------------------------------------------
 &namice_adv     !   Ice advection
 !------------------------------------------------------------------------------
-   ln_icedyn        = .true.          !  ice dynamics (T) or not (F) => DO NOT TOUCH UNLESS U KNOW WHAT U DO
-      nn_icedyn     =   2             !     switch for ice dynamics   
-                                      !        2: total
-                                      !        1: advection only (no diffusion, no ridging/rafting)
-                                      !        0: advection only (as 1 but with prescribed velocity, bypass rheology)
-         rn_uice    =   0.00001       !           prescribed ice u-velocity
-         rn_vice    =  -0.00001       !           prescribed ice v-velocity
-                      ! -- ice_adv -- !
    ln_adv_Pra       = .false.         !  Advection scheme (Prather)
    ln_adv_UMx       = .true.          !  Advection scheme (Ultimate-Macho)
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 8515)
+++ branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/ice.F90	(revision 8516)
@@ -163,22 +163,21 @@
    CHARACTER(len=256), PUBLIC ::   cn_icerst_indir !: ice restart input directory
    CHARACTER(len=256), PUBLIC ::   cn_icerst_outdir!: ice restart output directory
+
+   !                                     !!** ice-itd namelist (namice_itd) **
+   REAL(wp), PUBLIC ::   rn_himin         !: minimum ice thickness
    
-   !                                     !!** ice-diagnostics namelist (namice_dia) **
-   LOGICAL , PUBLIC ::   ln_icediachk     !: flag for ice diag (T) or not (F)
-   LOGICAL , PUBLIC ::   ln_icediahsb     !: flag for ice diag (T) or not (F)
-   LOGICAL , PUBLIC ::   ln_icectl        !: flag for sea-ice points output (T) or not (F)
-   INTEGER , PUBLIC ::   iiceprt          !: debug i-point
-   INTEGER , PUBLIC ::   jiceprt          !: debug j-point
-
-   !                                     !!** ice-dynamics namelist (namicedyn) **
+   !                                     !!** ice-dynamics namelist (namice_dyn) **
    LOGICAL , PUBLIC ::   ln_icedyn        !: flag for ice dynamics (T) or not (F)
    INTEGER , PUBLIC ::   nn_icedyn        !: flag for ice dynamics
    REAL(wp), PUBLIC ::   rn_uice          !: prescribed u-vel (case nn_icedyn=0)
    REAL(wp), PUBLIC ::   rn_vice          !: prescribed v-vel (case nn_icedyn=0)
-                                          ! -- iceadv -- !
-   LOGICAL , PUBLIC ::   ln_adv_Pra       !: Prather        advection scheme
-   LOGICAL , PUBLIC ::   ln_adv_UMx       !: Ultimate-Macho advection scheme
-   INTEGER , PUBLIC ::   nn_UMx           !: order of the UMx advection scheme   
-                                          ! -- icerdgrft -- !
+   REAL(wp), PUBLIC ::   rn_ishlat        !: lateral boundary condition for sea-ice
+   REAL(wp), PUBLIC ::   rn_cio           !: drag coefficient for oceanic stress
+   LOGICAL , PUBLIC ::   ln_landfast      !: landfast ice parameterization (T or F) 
+   REAL(wp), PUBLIC ::   rn_gamma         !: fraction of ocean depth that ice must reach to initiate landfast ice
+   REAL(wp), PUBLIC ::   rn_icebfr        !: maximum bottom stress per unit area of contact (landfast ice) 
+   REAL(wp), PUBLIC ::   rn_lfrelax       !: relaxation time scale (s-1) to reach static friction (landfast ice) 
+   !
+   !                                     !!** ice-rdige/raft namelist (namice_rdgrft) **
    LOGICAL , PUBLIC ::   ln_str_H79       !: ice strength parameterization (Hibler79)
    REAL(wp), PUBLIC ::   rn_pstar         !: determines ice strength, Hibler JPO79
@@ -186,16 +185,17 @@
    LOGICAL , PUBLIC ::   ln_str_R75       !: ice strength parameterization (Rothrock75)
    REAL(wp), PUBLIC ::   rn_perdg         !: ridging work divided by pot. energy change in ridging
-                                          ! -- icerhg -- !
-   REAL(wp), PUBLIC ::   rn_ishlat        !: lateral boundary condition for sea-ice
-   REAL(wp), PUBLIC ::   rn_cio           !: drag coefficient for oceanic stress
+   !
+   !                                     !!** ice-rheology namelist (namice_rhg) **
+   LOGICAL , PUBLIC ::   ln_rhg_EVP       !: EVP rheology
    REAL(wp), PUBLIC ::   rn_creepl        !: creep limit : has to be under 1.0e-9
    REAL(wp), PUBLIC ::   rn_ecc           !: eccentricity of the elliptical yield curve
    INTEGER , PUBLIC ::   nn_nevp          !: number of iterations for subcycling
    REAL(wp), PUBLIC ::   rn_relast        !: ratio => telast/rdt_ice (1/3 or 1/9 depending on nb of subcycling nevp) 
-   LOGICAL , PUBLIC ::   ln_landfast      !: landfast ice parameterization (T or F) 
-   REAL(wp), PUBLIC ::   rn_gamma         !: fraction of ocean depth that ice must reach to initiate landfast ice
-   REAL(wp), PUBLIC ::   rn_icebfr        !: maximum bottom stress per unit area of contact (landfast ice) 
-   REAL(wp), PUBLIC ::   rn_lfrelax       !: relaxation time scale (s-1) to reach static friction (landfast ice) 
-
+   !
+   !                                     !!** ice-advection namelist (namice_adv) **
+   LOGICAL , PUBLIC ::   ln_adv_Pra       !: Prather        advection scheme
+   LOGICAL , PUBLIC ::   ln_adv_UMx       !: Ultimate-Macho advection scheme
+   INTEGER , PUBLIC ::   nn_UMx           !: order of the UMx advection scheme   
+   !
    !                                     !!** ice-thermodynamics namelist (namice_thd) **
    LOGICAL , PUBLIC ::   ln_icethd        !: flag for ice thermo (T) or not (F)
@@ -221,7 +221,5 @@
    REAL(wp), PUBLIC ::   rn_vfraz         !: threshold drift speed for collection of bottom frazil ice
    REAL(wp), PUBLIC ::   rn_Cfraz         !: squeezing coefficient for collection of bottom frazil ice
-                                          ! -- iceitd_th -- !
-   REAL(wp), PUBLIC ::   rn_himin         !: minimum ice thickness
-                                          ! --  -- !
+                                          ! -- icethd -- !
    INTEGER , PUBLIC ::   nn_iceflx        !: Redistribute heat flux over ice categories
    !                                      !   =-1  Do nothing (needs N(cat) fluxes)
@@ -254,4 +252,10 @@
    REAL(wp), PUBLIC ::   rn_hpnd          !: prescribed pond depth    (0<rn_hpnd<1), only if nn_pnd_scheme = 0
    ! END MV MP 2016
+   !                                     !!** ice-diagnostics namelist (namice_dia) **
+   LOGICAL , PUBLIC ::   ln_icediachk     !: flag for ice diag (T) or not (F)
+   LOGICAL , PUBLIC ::   ln_icediahsb     !: flag for ice diag (T) or not (F)
+   LOGICAL , PUBLIC ::   ln_icectl        !: flag for sea-ice points output (T) or not (F)
+   INTEGER , PUBLIC ::   iiceprt          !: debug i-point
+   INTEGER , PUBLIC ::   jiceprt          !: debug j-point
 
    !                                     !!** some other parameters 
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 8515)
+++ branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/iceadv.F90	(revision 8516)
@@ -36,11 +36,4 @@
    PUBLIC   ice_adv        ! called by icestp
    PUBLIC   ice_adv_init   ! called by icestp
-
-   INTEGER, PUBLIC ::              nice_dyn   !: choice of the type of advection scheme
-   !                                  ! associated indices:
-   INTEGER, PUBLIC, PARAMETER ::   np_dynNO   = 0   !: no ice dynamics and ice advection
-   INTEGER, PUBLIC, PARAMETER ::   np_dynFULL = 1   !: full ice dynamics  (rheology + advection + ridging/rafting + correction)
-   INTEGER, PUBLIC, PARAMETER ::   np_dyn     = 2   !: no ridging/rafting (rheology + advection                   + correction)
-   INTEGER, PUBLIC, PARAMETER ::   np_dynPURE = 3   !: pure dynamics      (rheology + advection) 
 
    !! * Substitution
@@ -250,5 +243,5 @@
       INTEGER ::   ios   ! Local integer output status for namelist read
       !!
-      NAMELIST/namice_adv/ ln_icedyn, nn_icedyn, rn_uice, rn_vice, ln_adv_Pra, ln_adv_UMx, nn_UMx
+      NAMELIST/namice_adv/ ln_adv_Pra, ln_adv_UMx, nn_UMx
       !!-------------------------------------------------------------------
       !
@@ -267,10 +260,4 @@
          WRITE(numout,*) '~~~~~~~~~~~~'
          WRITE(numout,*) '   Namelist namice_adv'
-         WRITE(numout,*) '      Ice dynamics       (T) or not (F)                         ln_icedyn  = ', ln_icedyn
-         WRITE(numout,*) '         associated switch                                      nn_icedyn  = ', nn_icedyn
-         WRITE(numout,*) '            =2 all processes (default option)'
-         WRITE(numout,*) '            =1 advection only (no ridging/rafting)'
-         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,*) '      advection scheme for ice transport (limtrp)'
          WRITE(numout,*) '         type of advection scheme (Prather)                     ln_adv_Pra = ', ln_adv_Pra 
@@ -279,22 +266,4 @@
       ENDIF
       !
-      !                             ! set the choice of ice dynamics
-      IF( lk_c1d .OR. .NOT. ln_icedyn ) THEN
-         nice_dyn = np_dynNO                    !--- no dynamics
-      ELSE
-         SELECT CASE( nn_icedyn )
-         CASE( 2 )                    
-            IF( nn_monocat /= 2 ) THEN          !--- full dynamics (rheology + advection + ridging/rafting + correction)
-               nice_dyn = np_dynFULL
-            ELSE
-               nice_dyn = np_dyn                !--- dynamics without ridging/rafting
-            ENDIF
-         CASE( 0 , 1 )                          !--- dynamics without ridging/rafting and correction 
-            nice_dyn = np_dynPURE
-         END SELECT
-      ENDIF
-      !                                         !--- simple conservative piling, comparable with LIM2
-      l_piling = nn_icedyn == 1 .OR. ( nn_monocat == 2  .AND.  jpl == 1 )
-      !
       IF ( ( ln_adv_Pra .AND. ln_adv_UMx ) .OR. ( .NOT.ln_adv_Pra .AND. .NOT.ln_adv_UMx ) ) THEN
          CALL ctl_stop( 'ice_adv_init: choose one and only one ice advection scheme (ln_adv_Pra or ln_adv_UMx)' )
Index: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icedyn.F90
===================================================================
--- branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icedyn.F90	(revision 8516)
+++ branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icedyn.F90	(revision 8516)
@@ -0,0 +1,195 @@
+MODULE icedyn
+   !!======================================================================
+   !!                     ***  MODULE  icedyn  ***
+   !!   Sea-Ice dynamics :  
+   !!======================================================================
+   !! history :  4.0  ! 2017-09  (C. Rousset)  original code 
+   !!----------------------------------------------------------------------
+#if defined key_lim3
+   !!----------------------------------------------------------------------
+   !!   'key_lim3'                                       LIM3 sea-ice model
+   !!----------------------------------------------------------------------
+   !!   ice_dyn       : dynamics of sea ice
+   !!   ice_dyn_init  : initialisation of sea-ice dynamics
+   !!----------------------------------------------------------------------
+   USE phycst         ! physical constants
+   USE dom_oce        ! ocean space and time domain
+   USE ice            ! sea-ice: variables
+   USE icerhg         ! sea-ice: rheology
+   USE iceadv         ! sea-ice: advection
+   USE icerdgrft      ! sea-ice: ridging/rafting
+   USE icecor         ! sea-ice: corrections
+   USE icevar         ! sea-ice: operations
+   !
+   USE lbclnk         ! lateral boundary conditions - MPP exchanges
+   USE lib_mpp        ! MPP library
+   USE in_out_manager ! I/O manager
+   USE lib_fortran    ! glob_sum
+   USE timing         ! Timing
+
+   IMPLICIT NONE
+   PRIVATE
+
+   PUBLIC   ice_dyn        ! called by icestp.F90
+   PUBLIC   ice_dyn_init   ! called by icestp.F90
+   
+   INTEGER ::              nice_dyn   ! choice of the type of advection scheme
+   !                                        ! associated indices:
+   INTEGER, PARAMETER ::   np_dynNO   = 0   ! no ice dynamics and ice advection
+   INTEGER, PARAMETER ::   np_dynFULL = 1   ! full ice dynamics  (rheology + advection + ridging/rafting + correction)
+   INTEGER, PARAMETER ::   np_dyn     = 2   ! no ridging/rafting (rheology + advection                   + correction)
+   INTEGER, PARAMETER ::   np_dynPURE = 3   ! pure dynamics      (rheology + advection) 
+
+   !! * Substitutions
+#  include "vectopt_loop_substitute.h90"
+   !!----------------------------------------------------------------------
+   !! NEMO/ICE 4.0 , NEMO Consortium (2017)
+   !! $Id: icedyn.F90 8378 2017-07-26 13:55:59Z clem $
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
+   !!----------------------------------------------------------------------
+CONTAINS
+
+   SUBROUTINE ice_dyn( kt )
+      !!-------------------------------------------------------------------
+      !!               ***  ROUTINE ice_dyn  ***
+      !!               
+      !! ** Purpose :   this routine manages sea ice dynamics
+      !!
+      !! ** Action : - Initialisation of some variables
+      !!             - call ice_rhg
+      !!--------------------------------------------------------------------
+      INTEGER, INTENT(in) ::   kt     ! ice time step
+      !!
+      INTEGER  ::   jl   ! dummy loop indices
+      !!--------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('icedyn')
+      !
+      IF( kt == nit000 .AND. lwp ) THEN
+         WRITE(numout,*)
+         WRITE(numout,*)'ice_dyn: sea-ice dynamics'
+         WRITE(numout,*)'~~~~~~~'
+      ENDIF
+
+      CALL ice_var_agg(1)           ! -- aggregate ice categories
+      !                      
+      IF( ln_landfast ) THEN        ! -- Landfast ice parameterization: define max bottom friction
+         tau_icebfr(:,:) = 0._wp
+         DO jl = 1, jpl
+            WHERE( ht_i(:,:,jl) > ht_n(:,:) * rn_gamma )   tau_icebfr(:,:) = tau_icebfr(:,:) + a_i(:,:,jl) * rn_icebfr
+         END DO
+      ENDIF
+
+      SELECT CASE( nice_dyn )       ! -- Set which dynamics is running
+
+      CASE ( np_dynFULL )          !==  all dynamical processes  ==!
+         CALL ice_rhg   ( kt )          ! -- rheology  
+         CALL ice_adv   ( kt )          ! -- advection of ice
+         CALL ice_rdgrft( kt )          ! -- ridging/rafting 
+         CALL ice_cor   ( kt , 1 )      ! -- Corrections
+
+      CASE ( np_dyn )              !==  pure dynamics only ==!   (no ridging/rafting)   (nono cat. case 2)
+         CALL ice_rhg   ( kt )          ! -- rheology  
+         CALL ice_adv   ( kt )          ! -- advection of ice
+         CALL ice_cor   ( kt , 1 )      ! -- Corrections
+
+      CASE ( np_dynPURE )          !==  pure dynamics only ==!   (nn_icedyn= 1 )
+         CALL ice_rhg   ( kt )          ! -- rheology  
+         CALL ice_adv   ( kt )          ! -- advection of ice
+
+      CASE ( np_dynNO )            !==  prescribed ice velocities ==!   (nn_icedyn= 0 )
+         u_ice(:,:) = rn_uice * umask(:,:,1)
+         v_ice(:,:) = rn_vice * vmask(:,:,1)
+         !!CALL RANDOM_NUMBER(u_ice(:,:))
+         !!CALL RANDOM_NUMBER(v_ice(:,:))
+
+      END SELECT
+      !
+      IF( nn_timing == 1 )   CALL timing_stop('icedyn')
+      !
+   END SUBROUTINE ice_dyn
+
+
+   SUBROUTINE ice_dyn_init
+      !!-------------------------------------------------------------------
+      !!                  ***  ROUTINE ice_dyn_init  ***
+      !!
+      !! ** Purpose : Physical constants and parameters linked to the ice
+      !!      dynamics
+      !!
+      !! ** Method  :  Read the namice_dyn namelist and check the ice-dynamic
+      !!       parameter values called at the first timestep (nit000)
+      !!
+      !! ** input   :   Namelist namice_dyn
+      !!-------------------------------------------------------------------
+      INTEGER ::   ios   ! Local integer output status for namelist read
+      !!
+      NAMELIST/namice_dyn/ ln_icedyn  , nn_icedyn, rn_uice  , rn_vice ,    &
+         &                 rn_ishlat  , rn_cio   ,                         &
+         &                 ln_landfast, rn_gamma , rn_icebfr, rn_lfrelax
+      !!-------------------------------------------------------------------
+      !
+      REWIND( numnam_ice_ref )         ! Namelist namice_dyn in reference namelist : Ice dynamics
+      READ  ( numnam_ice_ref, namice_dyn, IOSTAT = ios, ERR = 901)
+901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namice_dyn in reference namelist', lwp )
+      !
+      REWIND( numnam_ice_cfg )         ! Namelist namice_dyn in configuration namelist : Ice dynamics
+      READ  ( numnam_ice_cfg, namice_dyn, IOSTAT = ios, ERR = 902 )
+902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namice_dyn in configuration namelist', lwp )
+      IF(lwm) WRITE ( numoni, namice_dyn )
+      !
+      IF(lwp) THEN                     ! control print
+         WRITE(numout,*)
+         WRITE(numout,*) 'ice_dyn_init: ice parameters for ice dynamics '
+         WRITE(numout,*) '~~~~~~~~~~~~'
+         WRITE(numout,*) '   Namelist namice_dyn'
+         WRITE(numout,*) '      Ice dynamics       (T) or not (F)                         ln_icedyn  = ', ln_icedyn
+         WRITE(numout,*) '         associated switch                                      nn_icedyn  = ', nn_icedyn
+         WRITE(numout,*) '            =2 all processes (default option)'
+         WRITE(numout,*) '            =1 advection only (no ridging/rafting)'
+         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,*) '      lateral boundary condition for sea ice dynamics        rn_ishlat     = ', rn_ishlat
+         WRITE(numout,*) '      drag coefficient for oceanic stress                    rn_cio        = ', rn_cio
+         WRITE(numout,*) '      Landfast: param (T or F)                               ln_landfast   = ', ln_landfast
+         WRITE(numout,*) '         fraction of ocean depth that ice must reach         rn_gamma      = ', rn_gamma
+         WRITE(numout,*) '         maximum bottom stress per unit area of contact      rn_icebfr     = ', rn_icebfr
+         WRITE(numout,*) '         relax time scale (s-1) to reach static friction     rn_lfrelax    = ', rn_lfrelax
+      ENDIF
+      !                             !== set the choice of ice dynamics ==!
+      SELECT CASE( nn_icedyn )
+      CASE( 2 )                    
+         IF( nn_monocat /= 2 ) THEN          !--- full dynamics (rheology + advection + ridging/rafting + correction)
+            nice_dyn = np_dynFULL
+         ELSE
+            nice_dyn = np_dyn                !--- dynamics without ridging/rafting
+         ENDIF
+      CASE( 1 )                              !--- dynamics without ridging/rafting and correction 
+         nice_dyn = np_dynPURE
+      CASE( 0 )                              !--- prescribed ice velocities (from namelist) 
+         nice_dyn = np_dynNO
+      END SELECT
+      !
+      !                                      !--- Lateral boundary conditions
+      IF     (      rn_ishlat == 0.                ) THEN   ;   IF(lwp) WRITE(numout,*) '   ===>>>   ice lateral  free-slip'
+      ELSEIF (      rn_ishlat == 2.                ) THEN   ;   IF(lwp) WRITE(numout,*) '   ===>>>   ice lateral  no-slip'
+      ELSEIF ( 0. < rn_ishlat .AND. rn_ishlat < 2. ) THEN   ;   IF(lwp) WRITE(numout,*) '   ===>>>   ice lateral  partial-slip'
+      ELSEIF ( 2. < rn_ishlat                      ) THEN   ;   IF(lwp) WRITE(numout,*) '   ===>>>   ice lateral  strong-slip'
+      ENDIF
+      !
+      !                                      !--- NO Landfast ice : set to zero once for all
+      IF( .NOT. ln_landfast )   tau_icebfr(:,:) = 0._wp 
+      !
+      !                                      !--- simple conservative piling, comparable with LIM2
+      l_piling = nn_icedyn == 1 .OR. ( nn_monocat == 2  .AND.  jpl == 1 )
+      !
+   END SUBROUTINE ice_dyn_init
+
+#else
+   !!----------------------------------------------------------------------
+   !!   Default option         Empty module          NO LIM-3 sea-ice model
+   !!----------------------------------------------------------------------
+#endif 
+
+   !!======================================================================
+END MODULE icedyn
Index: branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icerhg.F90
===================================================================
--- branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icerhg.F90	(revision 8515)
+++ branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icerhg.F90	(revision 8516)
@@ -20,5 +20,4 @@
    USE icerhg_evp     ! sea-ice: EVP rheology
    USE icectl         ! sea-ice: control prints
-   USE icevar         ! sea-ice: operations
    !
    USE lbclnk         ! lateral boundary conditions - MPP exchanges
@@ -55,5 +54,4 @@
       INTEGER, INTENT(in) ::   kt     ! ice time step
       !!
-      INTEGER  ::   jl   ! dummy loop indices
       REAL(wp) :: zvi_b, zsmv_b, zei_b, zfs_b, zfw_b, zft_b 
       !!--------------------------------------------------------------------
@@ -66,34 +64,13 @@
          WRITE(numout,*)'~~~~~~~'
       ENDIF
+      !                             ! -- conservation test
+      IF( ln_icediachk   )   CALL ice_cons_hsm(0, 'icerhg', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
 
-      CALL ice_var_agg(1)           ! -- aggregate ice categories
-      !
-      !                             ! -- conservation test
-      IF( ln_icediachk )   CALL ice_cons_hsm(0, 'icerhg', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
-      !                      
-      IF( ln_landfast ) THEN        ! -- Landfast ice parameterization: define max bottom friction
-         tau_icebfr(:,:) = 0._wp
-         DO jl = 1, jpl
-            WHERE( ht_i(:,:,jl) > ht_n(:,:) * rn_gamma )   tau_icebfr(:,:) = tau_icebfr(:,:) + a_i(:,:,jl) * rn_icebfr
-         END DO
-      ENDIF
-      
       ! -----------------------
       ! Rheology (ice dynamics)
       ! -----------------------   
-      IF( nn_icedyn /= 0 ) THEN     ! -- Ice dynamics
-         !
-         CALL ice_rhg_evp( kt, stress1_i, stress2_i, stress12_i, u_ice, v_ice, shear_i, divu_i, delta_i )
-         !
-      ELSE                          ! -- prescribed uniform velocity
-         !
-         u_ice(:,:) = rn_uice * umask(:,:,1)
-         v_ice(:,:) = rn_vice * vmask(:,:,1)
-         !!CALL RANDOM_NUMBER(u_ice(:,:))
-         !!CALL RANDOM_NUMBER(v_ice(:,:))
-         !
-      ENDIF
+      CALL ice_rhg_evp( kt, stress1_i, stress2_i, stress12_i, u_ice, v_ice, shear_i, divu_i, delta_i )
       !
-      !                                                   !- conservation test
+      !                             !- conservation test
       IF( ln_icediachk   )   CALL ice_cons_hsm(1, 'icerhg', zvi_b, zsmv_b, zei_b, zfw_b, zfs_b, zft_b)
       IF( ln_ctl         )   CALL ice_prt3D  ('icerhg')   !- Control prints
@@ -117,6 +94,5 @@
       INTEGER ::   ios   ! Local integer output status for namelist read
       !!
-      NAMELIST/namice_rhg/  rn_ishlat  , rn_cio   , rn_creepl, rn_ecc , nn_nevp, rn_relast,   &
-         &                ln_landfast, rn_gamma , rn_icebfr, rn_lfrelax
+      NAMELIST/namice_rhg/  ln_rhg_EVP, rn_creepl, rn_ecc , nn_nevp, rn_relast
       !!-------------------------------------------------------------------
       !
@@ -135,24 +111,10 @@
          WRITE(numout,*) '~~~~~~~~~~~~'
          WRITE(numout,*) '   Namelist namice_rhg'
-        WRITE(numout,*) '      rheology EVP (icerhg_evp)'
-         WRITE(numout,*) '         lateral boundary condition for sea ice dynamics          rn_ishlat     = ', rn_ishlat
-         WRITE(numout,*) '         drag coefficient for oceanic stress                      rn_cio        = ', rn_cio
+         WRITE(numout,*) '      rheology EVP (icerhg_evp)                                   ln_rhg_EVP    = ', ln_rhg_EVP
          WRITE(numout,*) '         creep limit                                              rn_creepl     = ', rn_creepl
          WRITE(numout,*) '         eccentricity of the elliptical yield curve               rn_ecc        = ', rn_ecc
          WRITE(numout,*) '         number of iterations for subcycling                      nn_nevp       = ', nn_nevp
          WRITE(numout,*) '         ratio of elastic timescale over ice time step            rn_relast     = ', rn_relast
-         WRITE(numout,*) '      Landfast: param (T or F)                                    ln_landfast   = ', ln_landfast
-         WRITE(numout,*) '         fraction of ocean depth that ice must reach              rn_gamma      = ', rn_gamma
-         WRITE(numout,*) '         maximum bottom stress per unit area of contact           rn_icebfr     = ', rn_icebfr
-         WRITE(numout,*) '         relax time scale (s-1) to reach static friction          rn_lfrelax    = ', rn_lfrelax
       ENDIF
-      !
-      IF     (      rn_ishlat == 0.                ) THEN   ;   IF(lwp) WRITE(numout,*) '   ===>>>   ice lateral  free-slip'
-      ELSEIF (      rn_ishlat == 2.                ) THEN   ;   IF(lwp) WRITE(numout,*) '   ===>>>   ice lateral  no-slip'
-      ELSEIF ( 0. < rn_ishlat .AND. rn_ishlat < 2. ) THEN   ;   IF(lwp) WRITE(numout,*) '   ===>>>   ice lateral  partial-slip'
-      ELSEIF ( 2. < rn_ishlat                      ) THEN   ;   IF(lwp) WRITE(numout,*) '   ===>>>   ice lateral  strong-slip'
-      ENDIF
-      !
-      IF( .NOT. ln_landfast )   tau_icebfr(:,:) = 0._wp     ! NO Landfast ice : set to zero one for all
       !
    END SUBROUTINE ice_rhg_init
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 8515)
+++ branches/2017/dev_r8183_ICEMODEL/NEMOGCM/NEMO/LIM_SRC_3/icestp.F90	(revision 8516)
@@ -37,4 +37,5 @@
    USE icerhg         ! sea-ice: rheology
    USE iceadv         ! sea-ice: advection
+   USE icedyn         ! sea-ice: dynamics
    USE icethd         ! sea-ice: thermodynamics
    USE icerdgrft      ! sea-ice: ridging/rafting
@@ -144,24 +145,11 @@
          CALL ice_rst_opn( kt )     ! Open Ice restart file (if necessary) 
          !
-         SELECT CASE( nice_dyn )   
-         CASE ( np_dynFULL )          !==  all dynamical processes  ==!
-            CALL ice_rhg   ( kt )          ! -- rheology  
-            CALL ice_adv   ( kt )          ! -- advection of ice
-            CALL ice_rdgrft( kt )          ! -- ridging/rafting 
-            CALL ice_cor   ( kt , 1 )      ! -- Corrections
-         CASE ( np_dyn )              !==  pure dynamics only ==!   (no ridging/rafting)   (nono cat. case 2)
-            CALL ice_rhg   ( kt )          ! -- rheology  
-            CALL ice_adv   ( kt )          ! -- advection of ice
-            CALL ice_cor   ( kt , 1 )      ! -- Corrections
-         CASE ( np_dynPURE )          !==  pure dynamics only ==!   (nn_icedyn= 0 or 1 )
-            CALL ice_rhg   ( kt )          ! -- rheology  
-            CALL ice_adv   ( kt )          ! -- advection of ice
-         END SELECT
+         IF( ln_icedyn .AND. .NOT.lk_c1d )   CALL ice_dyn( kt )            ! -- Ice dynamics
          !
          !                          !==  lateral boundary conditions  ==!
 #if defined key_agrif
-         IF( .NOT. Agrif_Root()     )   CALL agrif_interp_lim3('T')   ! -- AGRIF 
+         IF( .NOT. Agrif_Root()     )        CALL agrif_interp_lim3('T')   ! -- AGRIF 
 #endif
-         IF( ln_icethd .AND. ln_bdy )   CALL bdy_ice( kt )            ! -- bdy ice thermo
+         IF( ln_icethd .AND. ln_bdy )        CALL bdy_ice( kt )            ! -- bdy ice thermo
          !
          !
@@ -186,5 +174,5 @@
          !    qprec_ice, qevap_ice
          !------------------------------------------------------!
-         CALL ice_forcing_flx( kt, ksbc )
+                                    CALL ice_forcing_flx( kt, ksbc )
 
          !----------------------------!
@@ -269,4 +257,6 @@
       !
       CALL ice_itd_init                ! ice thickness distribution initialization
+      !
+      CALL ice_dyn_init                ! set ice dynamics parameters
       !
       CALL ice_rdgrft_init             ! set ice ridging/rafting parameters
