Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_2/iceini_2.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_2/iceini_2.F90	(revision 2625)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_2/iceini_2.F90	(revision 2626)
@@ -18,7 +18,8 @@
    USE phycst           ! physical constants
    USE dom_oce          ! ocean domain
+   USE sbc_oce          ! surface boundary condition: ocean
+   USE sbc_ice          ! LIM2 surface boundary condition
    USE dom_ice_2        ! LIM2 ice domain
-   USE sbc_oce          ! surface boundary condition: ocean
-   USE sbc_ice          ! surface boundary condition: ice
+   USE par_ice_2        ! LIM2 parameters
    USE thd_ice_2        ! LIM2 thermodynamical variables
    USE limrhg           ! LIM2 rheology
@@ -66,4 +67,9 @@
       IF( lk_mpp    )   CALL mpp_sum( ierr )
       IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'ice_init_2 : unable to allocate ice arrays' )
+
+      !                                ! adequation jpk versus ice/snow layers
+      IF( jpl > jpk  .OR.  jplayersp1 > jpk  )   CALL ctl_stop( 'STOP',           &
+         &     'ice_init: the 3rd dimension of workspace arrays is too small.',   &
+         &     'use more ocean levels or less ice layers/categories.' )
 
       !                                ! Open the namelist file 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_2/limwri_2.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_2/limwri_2.F90	(revision 2625)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_2/limwri_2.F90	(revision 2626)
@@ -79,5 +79,5 @@
       ALLOCATE( ndex51(jpij), zcmo(jpi,jpj,jpnoumax), STAT=lim_wri_alloc_2)
       !
-      IF( lk_mpp               )   CALL mpp_sum( lim_wri_alloc_2 )
+      IF( lk_mpp               )   CALL mpp_sum ( lim_wri_alloc_2 )
       IF( lim_wri_alloc_2 /= 0 )   CALL ctl_warn('lim_wri_alloc_2: failed to allocate array ndex51')
       !
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_3/iceini.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_3/iceini.F90	(revision 2625)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_3/iceini.F90	(revision 2626)
@@ -65,12 +65,11 @@
       IF( lk_mpp    )   CALL mpp_sum( ierr )
       IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'ice_init : unable to allocate ice arrays' )
-
-      IF( ierr > 0 ) THEN
-         WRITE(numout,*) 
-         WRITE(numout,*) 'ERROR: Allocation of memory failed in nemo_alloc'
-         IF( lk_mpp )   CALL mppstop()
-         STOP
-      END IF
-      !
+      !
+      !                                ! adequation jpk versus ice/snow layers/categories
+      IF( jpl   > jpk  .OR.  jpm    > jpk .OR.                                    &
+          jkmax > jpk  .OR.  nlay_s > jpk      )   CALL ctl_stop( 'STOP',         &
+         &     'ice_init: the 3rd dimension of workspace arrays is too small.',   &
+         &     'use more ocean levels or less ice/snow layers/categories.' )
+
       !                                ! Open the namelist file 
       CALL ctl_opn( numnam_ice, 'namelist_ice', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, lwp )
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90	(revision 2625)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/LIM_SRC_3/limthd.F90	(revision 2626)
@@ -96,5 +96,5 @@
       IF( .NOT. wrk_use(2, 1) ) THEN
          CALL ctl_stop( 'lim_thd : requested workspace arrays unavailable' )   ;   RETURN
-      END IF
+      ENDIF
    
       !------------------------------------------------------------------------------!
@@ -246,5 +246,5 @@
          !------------------------------------------------------------------------------!
 
-         IF( lk_mpp )   CALL mpp_ini_ice( nbpb )
+         IF( lk_mpp )   CALL mpp_ini_ice( nbpb , numout )
 
          IF( nbpb > 0 ) THEN  ! If there is no ice, do nothing.
