Index: branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90
===================================================================
--- branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 9018)
+++ branches/2017/dev_merge_2017/NEMOGCM/NEMO/OPA_SRC/SBC/sbcmod.F90	(revision 9019)
@@ -33,6 +33,7 @@
    USE sbcblk         ! surface boundary condition: bulk formulation
    USE sbcice_if      ! surface boundary condition: ice-if sea-ice model
-   USE sbcice_lim     ! surface boundary condition: LIM 3.0 sea-ice model
-   USE sbcice_lim_2   ! surface boundary condition: LIM 2.0 sea-ice model
+#if defined key_lim3
+   USE icestp         ! surface boundary condition: LIM 3.0 sea-ice model
+#endif
    USE sbcice_cice    ! surface boundary condition: CICE    sea-ice model
    USE sbcisf         ! surface boundary condition: ice-shelf
@@ -91,6 +92,6 @@
       NAMELIST/namsbc/ nn_fsbc  ,                                                    &
          &             ln_usr   , ln_flx   , ln_blk       ,                          &
-         &             ln_cpl   , ln_mixcpl, nn_components, nn_limflx,               &
-         &             nn_ice   , nn_ice_embd,                                       &
+         &             ln_cpl   , ln_mixcpl, nn_components,                          &
+         &             nn_ice   , ln_ice_embd,                                       &
          &             ln_traqsr, ln_dm2dc ,                                         &
          &             ln_rnf   , nn_fwb   , ln_ssr   , ln_isf    , ln_apr_dyn ,     &
@@ -118,12 +119,10 @@
 #if defined key_agrif
       IF( Agrif_Root() ) THEN                ! AGRIF zoom (cf r1242: possibility to run without ice in fine grid)
-         IF( lk_lim2 )   nn_ice      = 2
-         IF( lk_lim3 )   nn_ice      = 3
-         IF( lk_cice )   nn_ice      = 4
+         IF( lk_lim3 )   nn_ice      = 2
+         IF( lk_cice )   nn_ice      = 3
       ENDIF
 #else
-      IF( lk_lim2 )   nn_ice      = 2
-      IF( lk_lim3 )   nn_ice      = 3
-      IF( lk_cice )   nn_ice      = 4
+      IF( lk_lim3 )   nn_ice      = 2
+      IF( lk_cice )   nn_ice      = 3
 #endif
       !
@@ -141,8 +140,7 @@
          WRITE(numout,*) '         OASIS coupling (with atm or sas)           lk_oasis      = ', lk_oasis
          WRITE(numout,*) '         components of your executable              nn_components = ', nn_components
-         WRITE(numout,*) '         Multicategory heat flux formulation (LIM3) nn_limflx     = ', nn_limflx
          WRITE(numout,*) '      Sea-ice : '
          WRITE(numout,*) '         ice management in the sbc (=0/1/2/3)       nn_ice        = ', nn_ice
-         WRITE(numout,*) '         ice-ocean embedded/levitating (=0/1/2)     nn_ice_embd   = ', nn_ice_embd
+         WRITE(numout,*) '         ice embedded into ocean                    ln_ice_embd   = ', ln_ice_embd
          WRITE(numout,*) '      Misc. options of sbc : '
          WRITE(numout,*) '         Light penetration in temperature Eq.       ln_traqsr     = ', ln_traqsr
@@ -202,40 +200,18 @@
       CASE( 0 )                        !- no ice in the domain
       CASE( 1 )                        !- Ice-cover climatology ("Ice-if" model)  
-      CASE( 2 )                        !- LIM2 ice model
-         IF( .NOT.( ln_blk .OR. ln_cpl ) )   CALL ctl_stop( 'sbc_init : LIM2 sea-ice model requires ln_blk or ln_cpl = T' )
-      CASE( 3 )                        !- LIM3 ice model
-         IF( nn_ice_embd == 0            )   CALL ctl_stop( 'sbc_init : LIM3 sea-ice models require nn_ice_embd = 1 or 2' )
-      CASE( 4 )                        !- CICE ice model
+      CASE( 2 )                        !- LIM3 ice model
+      CASE( 3 )                        !- CICE ice model
          IF( .NOT.( ln_blk .OR. ln_cpl ) )   CALL ctl_stop( 'sbc_init : CICE sea-ice model requires ln_blk or ln_cpl = T' )
-         IF( nn_ice_embd == 0            )   CALL ctl_stop( 'sbc_init : CICE sea-ice models require nn_ice_embd = 1 or 2' )
          IF( lk_agrif                    )   CALL ctl_stop( 'sbc_init : CICE sea-ice model not currently available with AGRIF' ) 
       CASE DEFAULT                     !- not supported
       END SELECT
       !
-      IF( nn_ice == 3 ) THEN           !- LIM3 case: multi-category flux option
-         IF(lwp) WRITE(numout,*)
-         SELECT CASE( nn_limflx )         ! LIM3 Multi-category heat flux formulation
-         CASE ( -1 )
-            IF(lwp) WRITE(numout,*) '   LIM3: use per-category fluxes (nn_limflx = -1) '
-            IF( ln_cpl )   CALL ctl_stop( 'sbc_init : the chosen nn_limflx for LIM3 in coupled mode must be 0 or 2' )
-         CASE ( 0  )
-            IF(lwp) WRITE(numout,*) '   LIM3: use average per-category fluxes (nn_limflx = 0) '
-         CASE ( 1  )
-            IF(lwp) WRITE(numout,*) '   LIM3: use average then redistribute per-category fluxes (nn_limflx = 1) '
-            IF( ln_cpl )   CALL ctl_stop( 'sbc_init : the chosen nn_limflx for LIM3 in coupled mode must be 0 or 2' )
-         CASE ( 2  )
-            IF(lwp) WRITE(numout,*) '   LIM3: Redistribute a single flux over categories (nn_limflx = 2) '
-            IF( .NOT.ln_cpl )   CALL ctl_stop( 'sbc_init : the chosen nn_limflx for LIM3 in forced mode cannot be 2' )
-         CASE DEFAULT
-            CALL ctl_stop( 'sbcmod: LIM3 option, nn_limflx, should be between -1 and 2' )
-         END SELECT
-      ELSE                             ! other sea-ice model
-         IF( nn_limflx >= 0  )   CALL ctl_warn( 'sbc_init : multi-category flux option (nn_limflx) only available in LIM3' )
-      ENDIF
-      !
       !                       !**  allocate and set required variables
       !
       !                             !* allocate sbc arrays
       IF( sbc_oce_alloc() /= 0 )   CALL ctl_stop( 'sbc_init : unable to allocate sbc_oce arrays' )
+#if ! defined key_lim3 && ! defined key_cice
+      IF( sbc_ice_alloc() /= 0 )   CALL ctl_stop( 'sbc_init : unable to allocate sbc_ice arrays' )
+#endif
       !
       IF( .NOT.ln_isf ) THEN        !* No ice-shelf in the domain : allocate and set to zero
@@ -329,5 +305,5 @@
       IF( ln_ssr      )   CALL sbc_ssr_init            ! Sea-Surface Restoring initialization
       !
-      IF( ln_isf      )   CALL sbc_isf_init               ! Compute iceshelves
+      IF( ln_isf      )   CALL sbc_isf_init            ! Compute iceshelves
       !
                           CALL sbc_rnf_init            ! Runof initialization
@@ -335,9 +311,14 @@
       IF( ln_apr_dyn )    CALL sbc_apr_init            ! Atmo Pressure Forcing initialization
       !
-      IF( nn_ice == 3 )   CALL sbc_lim_init            ! LIM3 initialization
-      !
-      IF( nn_ice == 4 )   CALL cice_sbc_init( nsbc )   ! CICE initialization
-      !
-      IF( ln_wave     )   CALL sbc_wave_init              ! surface wave initialisation
+#if defined key_lim3
+      IF( lk_agrif .AND. nn_ice == 0 ) THEN            ! allocate ice arrays in case agrif + ice-model + no-ice in child grid
+                          IF( sbc_ice_alloc() /= 0 )   CALL ctl_stop('STOP', 'sbc_ice_alloc : unable to allocate arrays' )
+      ELSEIF( nn_ice == 2 ) THEN
+                          CALL ice_init                ! ICE initialization
+      ENDIF
+#endif
+      IF( nn_ice == 3 )   CALL cice_sbc_init( nsbc )   ! CICE initialization
+      !
+      IF( ln_wave     )   CALL sbc_wave_init           ! surface wave initialisation
       !
    END SUBROUTINE sbc_init
@@ -428,8 +409,9 @@
       !
       SELECT CASE( nn_ice )                                       ! Update heat and freshwater fluxes over sea-ice areas
-      CASE(  1 )   ;         CALL sbc_ice_if   ( kt )                ! Ice-cover climatology ("Ice-if" model)
-      CASE(  2 )   ;         CALL sbc_ice_lim_2( kt, nsbc )          ! LIM-2 ice model
-      CASE(  3 )   ;         CALL sbc_ice_lim  ( kt, nsbc )          ! LIM-3 ice model
-      CASE(  4 )   ;         CALL sbc_ice_cice ( kt, nsbc )          ! CICE ice model
+      CASE(  1 )   ;         CALL sbc_ice_if   ( kt )             ! Ice-cover climatology ("Ice-if" model)
+#if defined key_lim3
+      CASE(  2 )   ;         CALL ice_stp  ( kt, nsbc )           ! LIM-3 ice model
+#endif
+      CASE(  3 )   ;         CALL sbc_ice_cice ( kt, nsbc )       ! CICE ice model
       END SELECT
 
@@ -539,5 +521,5 @@
       !!---------------------------------------------------------------------
       !
-      IF( nn_ice == 4 )   CALL cice_sbc_final
+      IF( nn_ice == 3 )   CALL cice_sbc_final
       !
    END SUBROUTINE sbc_final
