Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/LBC/cla.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/LBC/cla.F90	(revision 2657)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/LBC/cla.F90	(revision 2658)
@@ -45,13 +45,13 @@
    
    !                                                              !!! profile of hdiv for some straits
-   REAL(wp), DIMENSION (jpk) ::   hdiv_139_101, hdiv_139_101_kt    ! Gibraltar     strait, fixed & time evolving part (i,j)=(172,101)
-   REAL(wp), DIMENSION (jpk) ::   hdiv_139_102                     ! Gibraltar     strait, fixed part only            (i,j)=(139,102)
-   REAL(wp), DIMENSION (jpk) ::   hdiv_141_102, hdiv_141_102_kt    ! Gibraltar     strait, fixed & time evolving part (i,j)=(141,102)
-   REAL(wp), DIMENSION (jpk) ::   hdiv_161_88 , hdiv_161_88_kt     ! Bab-el-Mandeb strait, fixed & time evolving part (i,j)=(161,88)
-   REAL(wp), DIMENSION (jpk) ::   hdiv_161_87                      ! Bab-el-Mandeb strait, fixed part only            (i,j)=(161,87)
-   REAL(wp), DIMENSION (jpk) ::   hdiv_160_89 , hdiv_160_89_kt     ! Bab-el-Mandeb strait, fixed & time evolving part (i,j)=(160,89)
-   REAL(wp), DIMENSION (jpk) ::   hdiv_172_94                      ! Hormuz        strait, fixed part only            (i,j)=(172, 94)
-
-   REAL(wp), DIMENSION (jpk) ::   t_171_94_hor, s_171_94_hor       ! Temperature, salinity in the Hormuz strait
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION (:) ::   hdiv_139_101, hdiv_139_101_kt    ! Gibraltar     strait, fixed & time evolving part (i,j)=(172,101)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION (:) ::   hdiv_139_102                     ! Gibraltar     strait, fixed part only            (i,j)=(139,102)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION (:) ::   hdiv_141_102, hdiv_141_102_kt    ! Gibraltar     strait, fixed & time evolving part (i,j)=(141,102)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION (:) ::   hdiv_161_88 , hdiv_161_88_kt     ! Bab-el-Mandeb strait, fixed & time evolving part (i,j)=(161,88)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION (:) ::   hdiv_161_87                      ! Bab-el-Mandeb strait, fixed part only            (i,j)=(161,87)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION (:) ::   hdiv_160_89 , hdiv_160_89_kt     ! Bab-el-Mandeb strait, fixed & time evolving part (i,j)=(160,89)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION (:) ::   hdiv_172_94                      ! Hormuz        strait, fixed part only            (i,j)=(172, 94)
+
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION (:) ::   t_171_94_hor, s_171_94_hor       ! Temperature, salinity in the Hormuz strait
    
    !! * Substitutions
@@ -178,5 +178,6 @@
       !! ** Action  :   nbab, ngib, nhor   strait inside the local domain or not
       !!---------------------------------------------------------------------
-      REAL(wp) ::   ztemp
+      REAL(wp) ::   ztemp   ! local scalar
+      INTEGER  ::   ierr    ! local integer
       !!---------------------------------------------------------------------
       !
@@ -184,4 +185,17 @@
       IF(lwp) WRITE(numout,*) 'cla_init : cross land advection initialisation '
       IF(lwp) WRITE(numout,*) '~~~~~~~~~'
+      !
+      !                           ! Allocate arrays for this module
+      ALLOCATE( hdiv_139_101(jpk), hdiv_139_101_kt(jpk), &
+                hdiv_139_102(jpk),                       &
+                hdiv_141_102(jpk), hdiv_141_102_kt(jpk), &
+                hdiv_161_88(jpk) , hdiv_161_88_kt(jpk) , &   
+                hdiv_161_87(jpk) ,                       &                     
+                hdiv_160_89(jpk) , hdiv_160_89_kt(jpk),  &
+                hdiv_172_94(jpk) ,                       &
+                t_171_94_hor(jpk), s_171_94_hor(jpk),    &
+                STAT=ierr )
+      IF( lk_mpp    )   CALL ctl_warn( 'cla_init : unable to allocate arrays' )
+      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'cla_init : unable to allocate arrays' )
       !
       IF( .NOT.lk_dynspg_flt )   CALL ctl_stop( 'cla_init: Cross Land Advection works only with lk_dynspg_flt=T ' )
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 2657)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 2658)
@@ -224,5 +224,4 @@
 
       ! Decide on size of grid now that we have our communicator size
-      ! If we're not using dynamic memory then mpp_partition does nothing.
 
 #if   defined key_mpp_mpi   ||   defined key_mpp_shmem
@@ -238,4 +237,5 @@
       jpi = ( jpiglo-2*jpreci + (jpni-1) ) / jpni + 2*jpreci !: first  dim.
       jpj = ( jpjglo-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj !: second dim.
+      jpk = jpkdta                                           !: third dim
       jpim1 = jpi-1                                          !: inner domain indices
       jpjm1 = jpj-1                                          !:   "           "
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_EEL_R2.h90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_EEL_R2.h90	(revision 2657)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_EEL_R2.h90	(revision 2658)
@@ -29,5 +29,4 @@
       jpiglo  = jpidta,      &  !: 1st dimension of global domain --> i
       jpjglo  = jpjdta,      &  !: 2nd    "                  "    --> j
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! zoom starting position
       jpizoom =   1   ,      &  !: left bottom (i,j) indices of the zoom
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_EEL_R5.h90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_EEL_R5.h90	(revision 2657)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_EEL_R5.h90	(revision 2658)
@@ -29,5 +29,4 @@
       jpiglo  = jpidta,      &  !: first  dimension of global domain --> i
       jpjglo  = jpjdta,      &  !: second dimension of global domain --> j
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! zoom starting position
       jpizoom =   1   ,      &  !: left bottom (i,j) indices of the zoom
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_EEL_R6.h90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_EEL_R6.h90	(revision 2657)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_EEL_R6.h90	(revision 2658)
@@ -29,5 +29,4 @@
       jpiglo  = jpidta,      &  !: 1st dimension of global domain --> i
       jpjglo  = jpjdta,      &  !: 2nd    "                  "    --> j
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! starting position of the zoom
       jpizoom =   1   ,      &  !: left bottom (i,j) indices of the zoom
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_GYRE.h90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_GYRE.h90	(revision 2657)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_GYRE.h90	(revision 2658)
@@ -29,5 +29,4 @@
       jpiglo  = jpidta,      &  !: 1st dimension of global domain --> i
       jpjglo  = jpjdta,      &  !: 2nd    "                  "    --> j
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! zoom starting position
       jpizoom =   1   ,      &  !: left bottom (i,j) indices of the zoom
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R025.h90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R025.h90	(revision 2657)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R025.h90	(revision 2658)
@@ -32,5 +32,4 @@
       jpiglo  = jpidta,      &  !: first  dimension of global domain --> i
       jpjglo  = jpjdta,      &  !: second dimension of global domain --> j
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! starting position of the zoom
       jpizoom =   1   ,      &  !: left bottom (i,j) indices of the zoom
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R05.h90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R05.h90	(revision 2657)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R05.h90	(revision 2658)
@@ -36,5 +36,4 @@
       jpiglo  = jpidta,      &  !: 1st dimension of global domain --> i
       jpjglo  = 187   ,      &  !: 2nd     "                 "    --> j 
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! starting position of the zoom
       jpizoom =   1   ,      &  !: left bottom (i,j) indices of the zoom
@@ -53,5 +52,4 @@
       jpiglo  = 562,         &  !: 1st dimension of global domain --> i
       jpjglo  = jpjdta-301+1,&  !: 2nd     "                 "    --> j
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! zoom starting position
       jpizoom =  81   ,      &  !: left bottom (i,j) indices of the zoom
@@ -69,5 +67,4 @@
       jpiglo  = jpidta,      &  !: 1st dimension of global domain --> i
       jpjglo  = jpjdta,      &  !: 2nd     "                 "    --> j
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! zoom starting position    
       jpizoom =   1   ,      &  !: left bottom (i,j) indices of the zoom
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R1.h90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R1.h90	(revision 2657)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R1.h90	(revision 2658)
@@ -35,5 +35,4 @@
       jpiglo  = jpidta,      &  !: first  dimension of global domain --> i
       jpjglo  = jpjdta,      &  !: second dimension of global domain --> j
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! starting position of the zoom
       jpizoom =   1   ,      &  !: left bottom (i,j) indices of the zoom
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R2.h90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R2.h90	(revision 2657)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R2.h90	(revision 2658)
@@ -36,5 +36,4 @@
       jpiglo  = jpidta,      &  !: 1st dimension of global domain --> i
       jpjglo  = 50,          &  !: 2nd    "                  "    --> j
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! zoom starting position
       jpizoom =   1   ,      &  !: left bottom (i,j) indices of the zoom
@@ -52,5 +51,4 @@
       jpiglo  = 142   ,      &  !: 1st dimension of global domain --> i
       jpjglo  = jpjdta-97+1, &  !: 2nd    "                  "    --> j
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! zoom starting position 
       jpizoom =  21   ,      &  !: left bottom (i,j) indices of the zoom
@@ -68,5 +66,4 @@
       jpiglo  = 3     ,      &  !: 1st dimension of global domain --> i
       jpjglo  = 3     ,      &  !: 2nd    "                  "    --> j
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! starting position of the zoom 
       ! jpizoom =   61   ,    &  !: left bottom (i,j) indices of the zoom
@@ -97,5 +94,4 @@
       jpiglo  = jpidta,      &  !: 1st dimension of global domain --> i
       jpjglo  = jpjdta,      &  !: 2nd    "                  "    --> j
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! starting position of the zoom 
       jpizoom =   1   ,      &  !: left bottom (i,j) indices of the zoom
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R4.h90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R4.h90	(revision 2657)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_ORCA_R4.h90	(revision 2658)
@@ -28,5 +28,4 @@
       jpiglo  = jpidta,      &  !: first  dimension of global domain --> i
       jpjglo  = jpjdta,      &  !: second dimension of global domain --> j
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! starting position of the zoom
       jpizoom =   1   ,      &  !: left bottom (i,j) indices of the zoom
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_POMME_R025.h90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_POMME_R025.h90	(revision 2657)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_POMME_R025.h90	(revision 2658)
@@ -36,5 +36,4 @@
       jpiglo  = jpidta,      &  !: first  dimension of global domain --> i
       jpjglo  = jpjdta,      &  !: second dimension of global domain --> j
-      jpk     = jpkdta,      &  !: number of vertical levels
       ! starting position of the zoom
       jpizoom =   1   ,      &  !: left bottom (i,j) indices of the zoom
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_oce.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_oce.F90	(revision 2657)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/par_oce.F90	(revision 2658)
@@ -197,4 +197,5 @@
    INTEGER, PUBLIC  ::   jpi   ! = ( jpiglo-2*jpreci + (jpni-1) ) / jpni + 2*jpreci   !: first  dimension
    INTEGER, PUBLIC  ::   jpj   ! = ( jpjglo-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj   !: second dimension
+   INTEGER, PUBLIC  ::   jpk   ! = jpkdta                                             !: third dimension
    INTEGER, PUBLIC  ::   jpim1 ! = jpi-1                                            !: inner domain indices
    INTEGER, PUBLIC  ::   jpjm1 ! = jpj-1                                            !:   -     -      -
