Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/C14b/trcini_c14b.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/C14b/trcini_c14b.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/C14b/trcini_c14b.F90	(revision 2643)
@@ -17,5 +17,4 @@
    USE trc             ! TOP variables
    USE trcsms_c14b     ! C14 sms trends
-   USE in_out_manager  ! I/O manager
 
    IMPLICIT NONE
@@ -59,6 +58,7 @@
       !!----------------------------------------------------------------------
 
-      !  Control consitency
-      CALL trc_ctl_c14b
+      CALL c14b_alloc()       ! Allocate CFC arrays
+
+      CALL trc_ctl_c14b     !  Control consitency
 
       IF(lwp) WRITE(numout,*) ''
@@ -164,4 +164,17 @@
 
    END SUBROUTINE trc_ini_c14b
+
+   SUBROUTINE c14b_alloc
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE c14b_alloc  ***
+      !!
+      !! ** Purpose :   Allocate all the dynamic arrays of C14b
+      !!----------------------------------------------------------------------
+
+      !                                ! Allocate C14b arrays
+      IF( trc_sms_c14b_alloc() /= 0 )   &
+         &         CALL ctl_stop( 'STOP', 'trc_ini_c14b : unable to allocate C14b arrays' )
+      !
+   END SUBROUTINE c14b_alloc
    
    SUBROUTINE trc_ctl_c14b
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/C14b/trcnam_c14b.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/C14b/trcnam_c14b.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/C14b/trcnam_c14b.F90	(revision 2643)
@@ -16,5 +16,4 @@
    USE trc             ! TOP variables
    USE trcsms_c14b     ! C14b specific variable
-   USE in_out_manager  ! I/O manager
 
    IMPLICIT NONE
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/C14b/trcrst_c14b.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/C14b/trcrst_c14b.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/C14b/trcrst_c14b.F90	(revision 2643)
@@ -17,5 +17,4 @@
    USE trc             ! TOP variables
    USE trcsms_c14b          ! c14b sms trends
-   USE in_out_manager  ! I/O manager
    USE iom
 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/C14b/trcsms_c14b.F90	(revision 2643)
@@ -63,19 +63,4 @@
 CONTAINS
 
-  FUNCTION trc_sms_c14b_alloc()
-     !!----------------------------------------------------------------------
-     !!                  ***  ROUTINE trc_sms_c14b_alloc  ***
-     !!----------------------------------------------------------------------
-     INTEGER :: trc_sms_c14b_alloc  ! Return value
-     !!----------------------------------------------------------------------
-
-     ALLOCATE(fareaz(jpi,jpj ,jpzon), &
-              qtr_c14(jpi,jpj)      , &
-              qint_c14(jpi,jpj)     , Stat=trc_sms_c14b_alloc)
-
-     IF (trc_sms_c14b_alloc /= 0) CALL ctl_warn('trc_sms_c14b_alloc : failed to allocate arrays.')
-
-  END FUNCTION trc_sms_c14b_alloc
-
 
   SUBROUTINE trc_sms_c14b( kt )
@@ -121,30 +106,23 @@
 
      !! * Local declarations
-     INTEGER ::  &
-       ji, jj, jk, jz
-
-     INTEGER ::   &
-       iyear_beg,              &
-       iyear_beg1, iyear_end1, &
-       imonth1, im1, im2,      &
-       iyear_beg2, iyear_end2, &
-       imonth2, in1, in2
+     INTEGER :: ji, jj, jk, jz     ! dummy loop indices 
+
+     INTEGER :: iyear_beg, iyear_beg1, iyear_end1 
+     INTEGER :: iyear_beg2, iyear_end2 
+     INTEGER :: imonth1, im1, in1 
+     INTEGER :: imonth2, im2, in2 
          
-     REAL(wp), DIMENSION(jpzon)   ::  &
-       zonbc14              !: time interp atm C14
-
-     REAL(wp) ::     &
-       zpco2at              !: time interp atm C02
-
-     REAL(wp) ::     &      !: dummy variables
-       zt, ztp, zsk, &
-       zsol ,        &      !: solubility
-       zsch ,        &      !: schmidt number
-       zv2  ,        &      !: wind speed ( square)
-       zpv  ,        &      !: piston velocity 
-       zdemi, ztra
+     REAL(wp), DIMENSION(jpzon) :: zonbc14       !: time interp atm C14 
+     REAL(wp)                   :: zpco2at       !: time interp atm C02 
+
+     REAL(wp) :: zt, ztp, zsk      !: dummy variables
+     REAL(wp) :: zsol              !: solubility
+     REAL(wp) :: zsch              !: schmidt number
+     REAL(wp) :: zv2               !: wind speed ( square)
+     REAL(wp) :: zpv               !: piston velocity 
+     REAL(wp) :: zdemi, ztra
       !!----------------------------------------------------------------------
 
-      IF( wrk_in_use(2, 1) .OR. wrk_in_use(3, 1) )THEN
+      IF( ( wrk_in_use(2, 1) ) .OR. ( wrk_in_use(3, 1) ) ) THEN
          CALL ctl_stop('trc_sms_c14b : requested workspace arrays unavailable.')
          RETURN
@@ -331,10 +309,21 @@
       END IF
 
-      IF( wrk_not_released(2, 1) .OR. wrk_not_released(3, 1) )THEN
-         CALL ctl_stop('trc_sms_c14b : failed to release workspace arrays.')
-      END IF
+      IF( ( wrk_not_released(2, 1)) .OR. ( wrk_not_released(3, 1) ) )   &
+      &   CALL ctl_stop('trc_sms_c14b : failed to release workspace arrays.')
 
     END SUBROUTINE trc_sms_c14b
 
+  INTEGER FUNCTION trc_sms_c14b_alloc()
+     !!----------------------------------------------------------------------
+     !!                  ***  ROUTINE trc_sms_c14b_alloc  ***
+     !!----------------------------------------------------------------------
+
+     ALLOCATE( fareaz(jpi,jpj ,jpzon),     &
+       &       qtr_c14(jpi,jpj)      ,     &
+       &       qint_c14(jpi,jpj)     , STAT=trc_sms_c14b_alloc )
+
+     IF( trc_sms_c14b_alloc /= 0 ) CALL ctl_warn('trc_sms_c14b_alloc : failed to allocate arrays.')
+
+  END FUNCTION trc_sms_c14b_alloc
 #else
     !!----------------------------------------------------------------------
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/CFC/trcini_cfc.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/CFC/trcini_cfc.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/CFC/trcini_cfc.F90	(revision 2643)
@@ -15,6 +15,5 @@
    USE par_trc         ! TOP parameters
    USE trc             ! TOP variables
-   USE trcsms_cfc          ! CFC sms trends
-   USE in_out_manager  ! I/O manager
+   USE trcsms_cfc      ! CFC sms trends
 
    IMPLICIT NONE
@@ -45,6 +44,6 @@
       !! ** Method  : - Read the namcfc namelist and check the parameter values
       !!----------------------------------------------------------------------
-      INTEGER  ::   ji, jj, jn, jl, jm, js
-      REAL(wp) ::   zyy  ,  zyd
+      INTEGER  ::  ji, jj, jn, jl, jm, js
+      REAL(wp) ::  zyy  ,  zyd
       !!----------------------------------------------------------------------
 
@@ -52,4 +51,6 @@
       IF(lwp) WRITE(numout,*) ' trc_ini_cfc: initialisation of CFC chemical model'
       IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~'
+
+      CALL cfc_alloc()       ! Allocate CFC arrays
 
 
@@ -140,4 +141,17 @@
 
    END SUBROUTINE trc_ini_cfc
+
+   SUBROUTINE cfc_alloc
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE cfc_alloc  ***
+      !!
+      !! ** Purpose :   Allocate all the dynamic arrays of CFC
+      !!----------------------------------------------------------------------
+
+      !                                ! Allocate CFC arrays
+      IF( trc_sms_cfc_alloc() /= 0 )   &
+         &           CALL ctl_stop( 'STOP', 'trc_ini_cfc : unable to allocate CFC arrays' )
+      !
+   END SUBROUTINE cfc_alloc
    
 #else
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/CFC/trcnam_cfc.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/CFC/trcnam_cfc.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/CFC/trcnam_cfc.F90	(revision 2643)
@@ -16,5 +16,4 @@
    USE trc             ! TOP variables
    USE trcsms_cfc      ! CFC specific variable
-   USE in_out_manager  ! I/O manager
 
    IMPLICIT NONE
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/CFC/trcrst_cfc.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/CFC/trcrst_cfc.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/CFC/trcrst_cfc.F90	(revision 2643)
@@ -17,5 +17,4 @@
    USE trc             ! TOP variables
    USE trcsms_cfc          ! CFC sms trends
-   USE in_out_manager  ! I/O manager
    USE iom
 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/CFC/trcsms_cfc.F90	(revision 2643)
@@ -60,22 +60,4 @@
 CONTAINS
 
-   FUNCTION trc_sms_cfc_alloc()
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE trc_sms_cfc_alloc  ***
-      !!----------------------------------------------------------------------
-      INTEGER :: trc_sms_cfc_alloc
-      !!----------------------------------------------------------------------
-
-      ALLOCATE(xphem(jpi,jpj),           &
-               qtr_cfc(jpi,jpj,jp_cfc),  &
-               qint_cfc(jpi,jpj,jp_cfc), &
-               Stat=trc_sms_cfc_alloc)
-
-      IF(trc_sms_cfc_alloc /= 0)THEN
-         CALL ctl_warn('trc_sms_cfc_alloc : failed to allocate arrays.')
-      END IF
-
-   END FUNCTION trc_sms_cfc_alloc
-
 
    SUBROUTINE trc_sms_cfc( kt )
@@ -115,5 +97,5 @@
       !!----------------------------------------------------------------------
 
-      IF(wrk_in_use(3, 1))THEN
+      IF( wrk_in_use(3, 1) ) THEN
          CALL ctl_stop('trc_sms_cfc : requested workspace array unavailable.')
          RETURN
@@ -202,10 +184,10 @@
 #if defined key_diatrc 
       ! Save diagnostics , just for CFC11
-# if ! defined key_iomput
+# if  defined key_iomput
+      CALL iom_put( "qtrCFC11"  , qtr_cfc (:,:,1) )
+      CALL iom_put( "qintCFC11" , qint_cfc(:,:,1) )
+# else
       trc2d(:,:,jp_cfc0_2d    ) = qtr_cfc (:,:,1)
       trc2d(:,:,jp_cfc0_2d + 1) = qint_cfc(:,:,1)
-# else
-      CALL iom_put( "qtrCFC11"  , qtr_cfc (:,:,1) )
-      CALL iom_put( "qintCFC11" , qint_cfc(:,:,1) )
 # endif
 #endif
@@ -218,7 +200,5 @@
       END IF
 
-      IF(wrk_not_released(3, 1))THEN
-         CALL ctl_stop('trc_sms_cfc : failed to release workspace array.')
-      END IF
+      IF( wrk_not_released(3, 1) ) CALL ctl_stop('trc_sms_cfc : failed to release workspace array.')
 
    END SUBROUTINE trc_sms_cfc
@@ -272,4 +252,18 @@
    END SUBROUTINE trc_cfc_cst
    
+   INTEGER FUNCTION trc_sms_cfc_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_sms_cfc_alloc  ***
+      !!----------------------------------------------------------------------
+
+      ALLOCATE( xphem(jpi,jpj)          ,    &
+         &      qtr_cfc(jpi,jpj,jp_cfc) ,    &
+         &      qint_cfc(jpi,jpj,jp_cfc),    &
+         &                               STAT=trc_sms_cfc_alloc )
+
+      IF( trc_sms_cfc_alloc /= 0 ) CALL ctl_warn('trc_sms_cfc_alloc : failed to allocate arrays.')
+
+   END FUNCTION trc_sms_cfc_alloc
+
 #else
    !!----------------------------------------------------------------------
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/sms_lobster.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/sms_lobster.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/sms_lobster.F90	(revision 2643)
@@ -112,15 +112,25 @@
       !!        *** ROUTINE sms_lobster_alloc ***
       !!----------------------------------------------------------------------
-      USE lib_mpp, ONLY: ctl_warn
+      USE lib_mpp, ONLY:   ctl_warn   ! MPP library
+      INTEGER :: ierr(3)        ! Local variables
       !!----------------------------------------------------------------------
-      !
-      ALLOCATE( remdmp(jpk,jp_lobster),                                   &
-         &      neln(jpi,jpj),    xze(jpi,jpj),     xpar(jpi,jpj,jpk),    &
-         &      dminl(jpi,jpj),   dmin3(jpi,jpj,jpk),                     &
-         &      sedpocb(jpi,jpj), sedpocn(jpi,jpj), sedpoca(jpi,jpj),     &
-         &      fbod(jpi,jpj),    cmask(jpi,jpj)                    , STAT=sms_lobster_alloc )
-         !
-      IF( sms_lobster_alloc /= 0 )   CALL ctl_warn('sms_lobster_alloc : failed to allocate arrays')
-      !
+
+      ierr(:) = 0
+      !*  Biological parameters
+      ALLOCATE( remdmp(jpk,jp_lobster),                               STAT=ierr(1) )
+
+      !*  Optical parameters
+      ALLOCATE( neln(jpi,jpj)     , xze(jpi,jpj),                         &
+        &       xpar(jpi,jpj,jpk) ,                                   STAT=ierr(2) )
+
+      !*  Sediment parameters
+      ALLOCATE( dminl(jpi,jpj)  , dmin3(jpi,jpj,jpk),                     &
+        &       sedpocb(jpi,jpj), sedpocn(jpi,jpj)  , sedpoca(jpi,jpj),   &
+        &       fbod(jpi,jpj)   , cmask(jpi,jpj)    ,                 STAT=ierr(3) ) 
+
+      sms_lobster_alloc = MAXVAL( ierr )
+  
+      IF( sms_lobster_alloc /= 0 ) CALL ctl_warn('sms_lobster_alloc : failed to allocate arrays.')
+
    END FUNCTION sms_lobster_alloc
 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcbio.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcbio.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcbio.F90	(revision 2643)
@@ -86,5 +86,5 @@
 
 #if defined key_diatrc && defined key_iomput
-      IF( wrk_in_use(3, 2) .OR. wrk_in_use(4, 1) )THEN
+      IF( ( wrk_in_use(3, 2) ) .OR. ( wrk_in_use(4, 1) ) ) THEN
          CALL ctl_stop('trc_bio : requested workspace arrays unavailable.')
          RETURN
@@ -103,11 +103,12 @@
       fbod(:,:) = 0.e0
 #if defined key_diatrc && ! defined key_iomput
+#  if defined key_iomput
+      zw2d  (:,:,:) = 0.e0
+      zw3d(:,:,:,:) = 0.e0
+#  else
       DO jl = jp_lob0_2d, jp_lob1_2d
          trc2d(:,:,jl) = 0.e0
       END DO 
-#endif
-#if defined key_diatrc && defined key_iomput
-      zw2d(:,:,:) = 0.e0
-      zw3d(:,:,:,:) = 0.e0
+#  endif
 #endif
 
@@ -500,7 +501,6 @@
       !
 #if defined key_diatrc && defined key_iomput
-      IF( wrk_not_released(3, 2) .OR. wrk_not_released(4, 1) )THEN
-         CALL ctl_stop('trc_bio : failed to release workspace arrays.')
-      END IF
+      IF( ( wrk_not_released(3, 2) ) .OR. ( wrk_not_released(4, 1) ) )  &
+        &   CALL ctl_stop('trc_bio : failed to release workspace arrays.')
 #endif
       !
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcexp.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcexp.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcexp.F90	(revision 2643)
@@ -101,5 +101,5 @@
             sedpoca(ji,jj) = ( zwork + dminl(ji,jj) * fbod(ji,jj)   &
                &           - sedlam * sedpocn(ji,jj) - sedlostpoc * sedpocn(ji,jj) ) * rdt
-            zgeolpoc = zgeolpoc + sedlostpoc * sedpocn(ji,jj) * e1t(ji,jj) * e2t(ji,jj)
+            zgeolpoc = zgeolpoc + sedlostpoc * sedpocn(ji,jj) * e1e2t(ji,jj)
          END DO
       END DO
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcini_lobster.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcini_lobster.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcini_lobster.F90	(revision 2643)
@@ -21,6 +21,4 @@
    USE trc
    USE lbclnk 
-   USE lib_mpp 
-   USE lib_fortran 
 
    IMPLICIT NONE
@@ -50,16 +48,15 @@
       !!----------------------------------------------------------------------
 
-      IF( wrk_in_use(2, 1) .OR. wrk_in_use(3, 1) )THEN
-         CALL ctl_stop('trc_ini_lobster : requested workspace arrays unavailable.')
-         RETURN
-      END IF
-
-      !  Control consitency
-      CALL trc_ctl_lobster
-
-
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) ' trc_ini_lobster :   LOBSTER biochemical model initialisation'
       IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~~'
+
+
+      CALL lobster_alloc()       ! Allocate LOBSTER arrays
+
+      IF( ( wrk_in_use(2, 1) ) .OR. ( wrk_in_use(3, 1) ) )  THEN
+         CALL ctl_stop('trc_ini_lobster : requested workspace arrays unavailable.')   ;  RETURN
+      ENDIF
+
 
       ! initialization of fields for optical model
@@ -144,5 +141,5 @@
       ! Coastal surface
       ! ---------------
-      areacot = glob_sum( e1t(:,:) * e2t(:,:) * cmask(:,:) )
+      areacot = glob_sum( e1e2t(:,:) * cmask(:,:) )
 
       ! Initialization of tracer concentration in case of  no restart 
@@ -226,5 +223,6 @@
          trn(:,:,30,jp_lob_no3) = 20.01 * tmask(:,:,30)
 
-# elif defined key_gyre
+
+# elif defined key_gyre || defined key_orca_r2
          ! LOBSTER initialisation for GYRE
          ! ----------------------
@@ -259,71 +257,21 @@
       IF(lwp) WRITE(numout,*) ' '
 
-      IF( wrk_not_released(2, 1) .OR. wrk_not_released(3, 1) )THEN
-         CALL ctl_stop('trc_ini_lobster : failed to release workspace arrays.')
-      END IF
+      IF( ( wrk_not_released(2, 1) ) .OR. ( wrk_not_released(3, 1) ) )   &
+        &      CALL ctl_stop('trc_ini_lobster : failed to release workspace arrays.')
 
    END SUBROUTINE trc_ini_lobster
 
-   SUBROUTINE trc_ctl_lobster
-      !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE trc_ctl_lobster  ***
+   SUBROUTINE lobster_alloc
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE lobster_alloc  ***
       !!
-      !! ** Purpose :   control the cpp options, namelist and files 
-      !!----------------------------------------------------------------------
-      INTEGER :: jl, jn
-
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) ' use LOBSTER biological model '
-
-      ! Check number of tracers
-      ! -----------------------
-      IF( jp_lobster /= 6 ) CALL ctl_stop( ' LOBSTER has 6 passive tracers. Change jp_lobster in par_lobster.F90' )
-
-      ! Check tracer names
-      ! ------------------
-      IF(   ctrcnm(jp_lob_det) /= 'DET' .OR. ctrcnm(jp_lob_zoo) /= 'ZOO' .OR.   &
-         &  ctrcnm(jp_lob_phy) /= 'PHY' .OR. ctrcnm(jp_lob_no3) /= 'NO3' .OR.   &
-         &  ctrcnm(jp_lob_nh4) /= 'NH4' .OR. ctrcnm(jp_lob_dom) /= 'DOM' .OR.   &
-         &  ctrcnl(jp_lob_det) /= 'Detritus'                        .OR.   &
-         &  ctrcnl(jp_lob_zoo) /= 'Zooplankton concentration'       .OR.   &
-         &  ctrcnl(jp_lob_phy) /= 'Phytoplankton concentration'     .OR.   &
-         &  ctrcnl(jp_lob_no3) /= 'Nitrate concentration'           .OR.   &
-         &  ctrcnl(jp_lob_nh4) /= 'Ammonium concentration'          .OR.   &
-         &  ctrcnl(jp_lob_dom) /= 'Dissolved organic matter' ) THEN
-         ctrcnm(jp_lob_det)='DET'
-         ctrcnl(jp_lob_det)='Detritus'
-         ctrcnm(jp_lob_zoo)='ZOO'
-         ctrcnl(jp_lob_zoo)='Zooplankton concentration'
-         ctrcnm(jp_lob_phy)='PHY'
-         ctrcnl(jp_lob_phy)='Phytoplankton concentration'
-         ctrcnm(jp_lob_no3)='NO3'
-         ctrcnl(jp_lob_no3)='Nitrate concentration'
-         ctrcnm(jp_lob_nh4)='NH4'
-         ctrcnl(jp_lob_nh4)='Ammonium concentration'
-         ctrcnm(jp_lob_dom)='DOM'
-         ctrcnl(jp_lob_dom)='Dissolved organic matter'
-         IF(lwp) THEN
-            CALL ctl_warn( ' We force tracer names ' )
-            DO jl = 1, jp_lobster
-               jn = jp_lob0 + jl - 1
-               WRITE(numout,*) ' tracer nb: ',jn,' name = ',ctrcnm(jn), ctrcnl(jn)
-            END DO
-            WRITE(numout,*) ' '
-         ENDIF
-      ENDIF
-
-      ! Check tracer units
-      DO jl = 1, jp_lobster
-         jn = jp_lob0 + jl - 1
-         IF( ctrcun(jn) /= 'mmole-N/m3') THEN
-            ctrcun(jn) = 'mmole-N/m3'
-            IF(lwp) THEN
-               CALL ctl_warn( ' We force tracer units ' )
-               WRITE(numout,*) ' tracer  ',ctrcnm(jn), 'UNIT= ',ctrcun(jn)
-            ENDIF
-         ENDIF
-      END DO
-
-   END SUBROUTINE trc_ctl_lobster
+      !! ** Purpose :   Allocate all the dynamic arrays of LOBSTER
+      !!----------------------------------------------------------------------
+
+      !                                ! Allocate LOBSTER arrays
+      IF( sms_lobster_alloc() /= 0 )   &
+      &              CALL ctl_stop( 'STOP', 'trc_ini_lobster : unable to allocate LOBSTER arrays' )
+      !
+   END SUBROUTINE lobster_alloc
 
 #else
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcnam_lobster.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcnam_lobster.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcnam_lobster.F90	(revision 2643)
@@ -16,6 +16,4 @@
    USE trc              ! TOP variables
    USE sms_lobster      ! sms trends
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! MPP library
 
    IMPLICIT NONE
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcopt.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcopt.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcopt.F90	(revision 2643)
@@ -21,5 +21,4 @@
    USE sms_lobster
    USE prtctl_trc      ! Print control for debbuging
-   USE lib_mpp         ! MPP library
 
    IMPLICIT NONE
@@ -69,5 +68,5 @@
       !!---------------------------------------------------------------------
 
-      IF( (wrk_in_use(2, 1,2)) .OR. (wrk_in_use(3, 2,3)) )THEN
+      IF( ( wrk_in_use(2, 1,2)) .OR. ( wrk_in_use(3, 2,3)) )THEN
          CALL ctl_stop('trc_opt : requested workspace arrays unavailable')   ;   RETURN
       END IF
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcrst_lobster.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcrst_lobster.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcrst_lobster.F90	(revision 2643)
@@ -18,5 +18,4 @@
    USE trcsms_lobster          ! lobster sms trends
    USE sms_lobster          ! lobster sms trends
-   USE in_out_manager  ! I/O manager
    USE iom
 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsed.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsed.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsed.F90	(revision 2643)
@@ -69,5 +69,5 @@
       !!---------------------------------------------------------------------
 
-      IF( (wrk_in_use(3,2)) .OR. (wrk_in_use(2,1)) )THEN
+      IF( ( wrk_in_use(3,2)) .OR. ( wrk_in_use(2,1)) ) THEN
          CALL ctl_stop('trc_sed : requested workspace arrays unavailable.')
          RETURN
@@ -150,7 +150,6 @@
       ENDIF
 
-      IF( (wrk_not_released(3,2)) .OR. (wrk_not_released(2,1)) )THEN
-         CALL ctl_stop('trc_sed : failed to release workspace arrays.')
-      END IF
+      IF( ( wrk_not_released(3, 2) ) .OR. ( wrk_not_released(2, 1) ) )  &
+       &         CALL ctl_stop('trc_sed : failed to release workspace arrays.')
 
    END SUBROUTINE trc_sed
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsms_lobster.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsms_lobster.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/LOBSTER/trcsms_lobster.F90	(revision 2643)
@@ -23,5 +23,4 @@
    USE trdmod_trc
    USE trdmld_trc
-   USE lib_mpp          ! MPP library
 
    IMPLICIT NONE
@@ -53,5 +52,5 @@
       !! --------------------------------------------------------------------
 
-      IF( wrk_in_use(3,1) ) THEN
+      IF( wrk_in_use(3, 1) ) THEN
          CALL ctl_stop('trc_sms_lobster : requested workspace array unavailable')   ;   RETURN
       ENDIF
@@ -71,5 +70,5 @@
       IF( lk_trdmld_trc )  CALL trd_mld_bio( kt )   ! trends: Mixed-layer
 
-      IF( wrk_not_released(3,1) )   CALL ctl_stop('trc_sms_lobster : failed to release workspace array.')
+      IF( wrk_not_released(3, 1) )   CALL ctl_stop('trc_sms_lobster : failed to release workspace array.')
       !
    END SUBROUTINE trc_sms_lobster
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcini_my_trc.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcini_my_trc.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/MY_TRC/trcini_my_trc.F90	(revision 2643)
@@ -38,6 +38,7 @@
       !!----------------------------------------------------------------------
 
-      !  Control consitency
-      CALL trc_ctl_my_trc
+      CALL my_trc_alloc()     ! Allocate MY_TRC arrays
+
+      CALL trc_ctl_my_trc     ! Control consitency
 
       IF(lwp) WRITE(numout,*)
@@ -64,5 +65,5 @@
       DO jl = 1, jp_my_trc
          jn = jp_myt0 + jl - 1
-         WRITE(ctrcnm(jn),'(a,i2.2)') 'CLR',jn
+         WRITE( ctrcnm(jn),'(a,i2.2)' ) 'CLR', jn
          ctrcnl(jn)='Color concentration'
          ctrcun(jn)='N/A'
@@ -71,4 +72,15 @@
 
    END SUBROUTINE trc_ctl_my_trc
+
+   SUBROUTINE my_trc_alloc
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE my_trc_alloc  ***
+      !!
+      !! ** Purpose :   Allocate all the dynamic arrays of MY_TRC
+      !!----------------------------------------------------------------------
+
+      !                                ! Allocate MY_TRC arrays
+      !
+   END SUBROUTINE my_trc_alloc
 
 #else
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zbio.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zbio.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zbio.F90	(revision 2643)
@@ -32,9 +32,4 @@
 
    PUBLIC  p4z_bio    
-
-   !! * Shared module variables
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   &  !:
-      xnegtr            ! Array used to indicate negative tracer values
-
 
    !!* Substitution
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zche.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zche.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zche.F90	(revision 2643)
@@ -25,11 +25,10 @@
 
    PUBLIC   p4z_che  
+   PUBLIC   p4z_che_alloc  
 
    !! * Shared module variables
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   &   !:
-      sio3eq, fekeq           !: chemistry of Fe and Si
-
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,2)   ::   &   !:
-      chemc                   !: Solubilities of O2 and CO2
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sio3eq  ! chemistry of Si
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: fekeq   ! chemistry of Fe
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: chemc   ! Solubilities of O2 and CO2
 
    !! * Module variables
@@ -156,4 +155,5 @@
 CONTAINS
 
+
    SUBROUTINE p4z_che
       !!---------------------------------------------------------------------
@@ -324,4 +324,15 @@
    END SUBROUTINE p4z_che
 
+   INTEGER FUNCTION p4z_che_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_che_alloc  ***
+      !!----------------------------------------------------------------------
+
+      ALLOCATE( sio3eq(jpi,jpj,jpk), fekeq(jpi,jpj,jpk),  &
+        &       chemc(jpi,jpj,2),                     STAT=p4z_che_alloc )
+
+      IF( p4z_che_alloc /= 0 ) CALL ctl_warn('p4z_che_alloc : failed to allocate arrays.')
+
+   END FUNCTION p4z_che_alloc
 #else
    !!======================================================================
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zflx.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zflx.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zflx.F90	(revision 2643)
@@ -27,6 +27,4 @@
    USE sbc_oce , ONLY :  atm_co2
 #endif
-   USE lib_mpp
-   USE lib_fortran
 
    IMPLICIT NONE
@@ -35,7 +33,9 @@
    PUBLIC   p4z_flx  
    PUBLIC   p4z_flx_init  
-
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::  oce_co2            !: ocean carbon flux 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::  satmco2            !: atmospheric pco2
+   PUBLIC   p4z_flx_alloc  
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: oce_co2   !: ocean carbon flux 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: satmco2   !: atmospheric pco2 
+
    REAL(wp)                             ::  t_oce_co2_flx      !: Total ocean carbon flux 
    REAL(wp)                             ::  t_atm_co2_flx      !: global mean of atmospheric pco2
@@ -63,4 +63,9 @@
       !! ** Method  : - ???
       !!---------------------------------------------------------------------
+      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
+      USE wrk_nemo, ONLY: zkgco2 => wrk_2d_1, zkgo2 => wrk_2d_2, zh2co3 => wrk_2d_3 
+      USE wrk_nemo, ONLY: zoflx  => wrk_2d_4, zkg   => wrk_2d_5
+      USE wrk_nemo, ONLY: zdpco2 => wrk_2d_6, zdpo2 => wrk_2d_7
+      !
       INTEGER, INTENT(in) :: kt
       INTEGER  ::   ji, jj, jrorr
@@ -68,11 +73,11 @@
       REAL(wp) ::   zfld, zflu, zfld16, zflu16, zfact
       REAL(wp) ::   zph, zah2, zbot, zdic, zalk, zsch_o2, zalka, zsch_co2
-      REAL(wp), DIMENSION(jpi,jpj) ::   zkgco2, zkgo2, zh2co3
-#if defined key_diatrc && defined key_iomput
-      REAL(wp), DIMENSION(jpi,jpj) ::  zoflx, zkg, zdpco2, zdpo2
-#endif
       CHARACTER (len=25) :: charout
 
       !!---------------------------------------------------------------------
+
+      IF( wrk_in_use(2, 1,2,3,4,5,6,7) ) THEN
+         CALL ctl_stop('p4z_flx: requested workspace arrays unavailable') ; RETURN
+      END IF
 
       ! SURFACE CHEMISTRY (PCO2 AND [H+] IN
@@ -149,6 +154,5 @@
             zfld = satmco2(ji,jj) * tmask(ji,jj,1) * chemc(ji,jj,1) * zkgco2(ji,jj)
             zflu = zh2co3(ji,jj) * tmask(ji,jj,1) * zkgco2(ji,jj)
-            oce_co2(ji,jj) = ( zfld - zflu ) * rfact &
-               &             * e1t(ji,jj) * e2t(ji,jj) * tmask(ji,jj,1) * 1000.
+            oce_co2(ji,jj) = ( zfld - zflu ) * rfact * e1e2t(ji,jj) * tmask(ji,jj,1) * 1000.
             ! compute the trend
             tra(ji,jj,1,jpdic) = tra(ji,jj,1,jpdic) + ( zfld - zflu ) / fse3t(ji,jj,1)
@@ -162,5 +166,5 @@
             ! Save diagnostics
 #  if ! defined key_iomput
-            zfact = 1. / ( e1t(ji,jj) * e2t(ji,jj) ) / rfact
+            zfact = 1. / e1e2t(ji,jj) / rfact
             trc2d(ji,jj,jp_pcs0_2d    ) = oce_co2(ji,jj) * zfact
             trc2d(ji,jj,jp_pcs0_2d + 1) = ( zfld16 - zflu16 ) * 1000. * tmask(ji,jj,1)
@@ -180,5 +184,5 @@
       t_oce_co2_flx = t_oce_co2_flx + glob_sum( oce_co2(:,:) )                     ! Cumulative Total Flux of Carbon
       IF( kt == nitend ) THEN
-         t_atm_co2_flx = glob_sum( satmco2(:,:) * e1t(:,:) * e2t(:,:) )            ! Total atmospheric pCO2
+         t_atm_co2_flx = glob_sum( satmco2(:,:) * e1e2t(:,:) )            ! Total atmospheric pCO2
          !
          t_oce_co2_flx = (-1.) * t_oce_co2_flx  * 12. / 1.e15                      ! Conversion in PgC ; negative for out of the ocean
@@ -203,5 +207,5 @@
 
 # if defined key_diatrc && defined key_iomput
-      CALL iom_put( "Cflx" , oce_co2(:,:) / ( e1t(:,:) * e2t(:,:) ) / rfact  )
+      CALL iom_put( "Cflx" , oce_co2(:,:) /  e1e2t(:,:) / rfact  
       CALL iom_put( "Oflx" , zoflx  )
       CALL iom_put( "Kg"   , zkg    )
@@ -210,4 +214,6 @@
 #endif
 
+      IF( wrk_not_released(2, 1,2,3,4,5,6,7) ) CALL ctl_stop('p4z_flx: failed to release workspace arrays')
+      !
    END SUBROUTINE p4z_flx
 
@@ -238,5 +244,5 @@
 
       ! interior global domain surface
-      area = glob_sum( e1t(:,:) * e2t(:,:) )  
+      area = glob_sum( e1e2t(:,:) )  
 
       ! Initialization of Flux of Carbon
@@ -249,4 +255,15 @@
    END SUBROUTINE p4z_flx_init
 
+   INTEGER FUNCTION p4z_flx_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_flx_alloc  ***
+      !!----------------------------------------------------------------------
+
+      ALLOCATE( oce_co2(jpi,jpj), satmco2(jpi,jpj), STAT=p4z_flx_alloc )
+
+      IF( p4z_flx_alloc /= 0 ) CALL ctl_warn('p4z_flx_alloc : failed to allocate arrays.')
+
+   END FUNCTION p4z_flx_alloc
+
 #else
    !!======================================================================
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zint.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zint.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zint.F90	(revision 2643)
@@ -21,12 +21,11 @@
 
    PUBLIC   p4z_int  
+   PUBLIC   p4z_int_alloc
 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   &   !:
-      tgfunc,            &  !:  Temp. dependancy of various biological rates
-      tgfunc2               !:  Temp. dependancy of mesozooplankton rates 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: tgfunc  !: Temp. dependancy of various biological rates
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: tgfunc2 !: Temp. dependancy of mesozooplankton rates
 
    !! * Module variables
-   REAL(wp) :: &
-      xksilim = 16.5E-6        ! Half-saturation constant for the computation of the Si half-saturation constant
+   REAL(wp) :: xksilim = 16.5E-6   ! Half-saturation constant for the computation of the Si half-saturation constant
 
 
@@ -76,4 +75,15 @@
    END SUBROUTINE p4z_int
 
+   INTEGER FUNCTION p4z_int_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_int_alloc  ***
+      !!----------------------------------------------------------------------
+
+      ALLOCATE( tgfunc(jpi,jpj,jpk), tgfunc2(jpi,jpj,jpk), STAT=p4z_int_alloc )
+
+      IF( p4z_int_alloc /= 0 ) CALL ctl_warn('p4z_int_alloc : failed to allocate arrays.')
+
+   END FUNCTION p4z_int_alloc
+
 #else
    !!======================================================================
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlys.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlys.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zlys.F90	(revision 2643)
@@ -31,14 +31,11 @@
 
    !! * Shared module variables
-   REAL(wp), PUBLIC ::   &
-     kdca = 0.327e3_wp   ,  &  !:
-     nca  = 1.0_wp             !:
+   REAL(wp), PUBLIC :: kdca = 0.327e3_wp  !: diss. rate constant calcite
+   REAL(wp), PUBLIC :: nca  = 1.0_wp      !: order of reaction for calcite dissolution
 
    !! * Module variables
-   REAL(wp) :: &
-      calcon = 1.03E-2        ! mean calcite concentration [Ca2+] in sea water [mole/kg solution]
-
-   INTEGER ::               &
-     rmtss                    !: number of seconds per month
+   REAL(wp) :: calcon = 1.03E-2           !: mean calcite concentration [Ca2+] in sea water [mole/kg solution]
+ 
+   INTEGER  :: rmtss                      !: number of seconds per month 
 
    !!----------------------------------------------------------------------
@@ -60,4 +57,7 @@
       !! ** Method  : - ???
       !!---------------------------------------------------------------------
+      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
+      USE wrk_nemo, ONLY: zco3 => wrk_3d_2, zcaldiss => wrk_3d_3 
+      !
       INTEGER, INTENT(in) ::   kt ! ocean time step
       INTEGER  ::   ji, jj, jk, jn
@@ -65,14 +65,15 @@
       REAL(wp) ::   zdispot, zfact, zalka
       REAL(wp) ::   zomegaca, zexcess, zexcess0
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zco3
 #if defined key_diatrc && defined key_iomput
       REAL(wp) ::   zrfact2
-      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zcaldiss
 #endif
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
 
+      IF(  wrk_in_use(3, 2,3) ) THEN
+         CALL ctl_stop('p4z_lys: requested workspace arrays unavailable')  ;  RETURN
+      END IF
+
       zco3(:,:,:) = 0.
-
 # if defined key_diatrc && defined key_iomput
       zcaldiss(:,:,:) = 0.
@@ -186,4 +187,6 @@
        ENDIF
 
+      IF( wrk_not_released(3, 2,3) ) CALL ctl_stop('p4z_lys: failed to release workspace arrays')
+      !
    END SUBROUTINE p4z_lys
 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zopt.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zopt.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zopt.F90	(revision 2643)
@@ -6,5 +6,5 @@
    !! History :   1.0  !  2004     (O. Aumont) Original code
    !!             2.0  !  2007-12  (C. Ethe, G. Madec)  F90
-   !!             3.2  !  2009-04  (C. Ethe, G. Madec)  optimisaion
+   !!             3.2  !  2009-04  (C. Ethe, G. Madec)  optimisation
    !!----------------------------------------------------------------------
 #if defined  key_pisces
@@ -24,7 +24,8 @@
    PUBLIC   p4z_opt        ! called in p4zbio.F90 module
    PUBLIC   p4z_opt_init   ! called in trcsms_pisces.F90 module
-
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   etot, enano, ediat   !: PAR for phyto, nano and diat 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   emoy                 !: averaged PAR in the mixed layer
+   PUBLIC   p4z_opt_alloc
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: etot, enano, ediat   !: PAR for phyto, nano and diat 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: emoy                 !: averaged PAR in the mixed layer
 
    INTEGER  ::  nksrp   ! levels below which the light cannot penetrate ( depth larger than 391 m)
@@ -43,4 +44,5 @@
 CONTAINS
 
+
    SUBROUTINE p4z_opt( kt, jnt )
       !!---------------------------------------------------------------------
@@ -52,4 +54,10 @@
       !! ** Method  : - ???
       !!---------------------------------------------------------------------
+      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
+      USE wrk_nemo, ONLY: zdepmoy => wrk_2d_1, zetmp => wrk_2d_2
+      USE wrk_nemo, ONLY: zekg    => wrk_3d_2, zekr  => wrk_3d_3, zekb => wrk_3d_4
+      USE wrk_nemo, ONLY: ze0     => wrk_3d_5, ze1   => wrk_3d_6
+      USE wrk_nemo, ONLY: ze2     => wrk_3d_7, ze3   => wrk_3d_8
+      !
       INTEGER, INTENT(in) ::   kt, jnt ! ocean time step
       INTEGER  ::   ji, jj, jk
@@ -57,9 +65,9 @@
       REAL(wp) ::   zchl, zxsi0r
       REAL(wp) ::   zc0 , zc1 , zc2, zc3
-      REAL(wp), DIMENSION(jpi,jpj)     ::   zdepmoy, zetmp
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zekg, zekr, zekb
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ze1 , ze2 , ze3, ze0
       !!---------------------------------------------------------------------
 
+      IF( ( wrk_in_use(2, 1,2) ) .OR. ( wrk_in_use(3, 2,3,4,5,6,7,8) ) ) THEN
+         CALL ctl_stop('p4z_opt: requested workspace arrays unavailable')  ;  RETURN
+      END IF
 
       !     Initialisation of variables used to compute PAR
@@ -223,4 +231,7 @@
 #endif
       !
+      IF( ( wrk_not_released(2, 1,2) ) .OR. ( wrk_not_released(3, 2,3,4,5,6,7,8) ) ) &
+        &         CALL ctl_stop('p4z_opt: failed to release workspace arrays')
+      !
    END SUBROUTINE p4z_opt
 
@@ -245,4 +256,17 @@
       ! 
    END SUBROUTINE p4z_opt_init
+
+   INTEGER FUNCTION p4z_opt_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_opt_alloc  ***
+      !!----------------------------------------------------------------------
+
+      ALLOCATE( etot (jpi,jpj,jpk), enano(jpi,jpj,jpk), &
+        &       ediat(jpi,jpj,jpk), emoy (jpi,jpj,jpk), STAT=p4z_opt_alloc )
+
+      IF( p4z_opt_alloc /= 0 ) CALL ctl_warn('p4z_opt_alloc : failed to allocate arrays.')
+
+   END FUNCTION p4z_opt_alloc
+
 #else
    !!----------------------------------------------------------------------
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zprod.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zprod.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zprod.F90	(revision 2643)
@@ -22,7 +22,4 @@
    USE iom
 
-   USE lib_mpp
-   USE lib_fortran
-
    IMPLICIT NONE
    PRIVATE
@@ -30,4 +27,5 @@
    PUBLIC   p4z_prod         ! called in p4zbio.F90
    PUBLIC   p4z_prod_init    ! called in trcsms_pisces.F90
+   PUBLIC   p4z_prod_alloc
 
    !! * Shared module variables
@@ -43,5 +41,5 @@
      grosip    = 0.151_wp
 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk)  ::  prmax 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: prmax
    
    REAL(wp) ::   &
@@ -61,4 +59,5 @@
 CONTAINS
 
+
    SUBROUTINE p4z_prod( kt , jnt )
       !!---------------------------------------------------------------------
@@ -70,4 +69,13 @@
       !! ** Method  : - ???
       !!---------------------------------------------------------------------
+      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
+      USE wrk_nemo, ONLY: zmixnano    => wrk_2d_1 , zmixdiat     => wrk_2d_2, zstrn  => wrk_2d_3
+      USE wrk_nemo, ONLY: zpislopead  => wrk_3d_2 , zpislopead2  => wrk_3d_2
+      USE wrk_nemo, ONLY: zprdia      => wrk_3d_4 , zprbio       => wrk_3d_5, zysopt => wrk_3d_6
+      USE wrk_nemo, ONLY: zprorca     => wrk_3d_7 , zprorcad     => wrk_3d_8
+      USE wrk_nemo, ONLY: zprofed     => wrk_3d_9 , zprofen      => wrk_3d_10
+      USE wrk_nemo, ONLY: zprochln    => wrk_3d_11, zprochld     => wrk_3d_12
+      USE wrk_nemo, ONLY: zpronew     => wrk_3d_13, zpronewd     => wrk_3d_14
+      !
       INTEGER, INTENT(in) :: kt, jnt
       INTEGER  ::   ji, jj, jk
@@ -81,12 +89,10 @@
       REAL(wp) ::   zrfact2
 #endif
-      REAL(wp), DIMENSION(jpi,jpj)     ::   zmixnano   , zmixdiat, zstrn
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zpislopead , zpislopead2
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zprdia     , zprbio, zysopt
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zprorca    , zprorcad, zprofed
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zprofen   , zprochln, zprochld
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zpronew    , zpronewd
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
+
+      IF( ( wrk_in_use(2, 1,2,3) ) .OR. ( wrk_in_use(3, 2,3,4,5,6,7,8,9,10,11,12,13,14) ) ) THEN
+         CALL ctl_stop('p4z_prod: requested workspace arrays unavailable')  ;  RETURN
+      END IF
 
       zprorca (:,:,:) = 0.0
@@ -187,5 +193,4 @@
                   zsilfac = MIN( 6.4,zsilfac * zsilfac2)
                   zysopt(ji,jj,jk) = grosip * zlim1 * zsilfac
-
               ENDIF
             END DO
@@ -363,4 +368,7 @@
        ENDIF
 
+      IF( ( wrk_not_released(2, 1,2,3) ) .OR. ( wrk_not_released(3, 2,3,4,5,6,7,8,9,10,11,12,13,14) ) ) &
+        &         CALL ctl_stop('p4z_prod: failed to release workspace arrays')
+      !
    END SUBROUTINE p4z_prod
 
@@ -408,4 +416,14 @@
 
 
+   INTEGER FUNCTION p4z_prod_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_prod_alloc  ***
+      !!----------------------------------------------------------------------
+
+      ALLOCATE( prmax(jpi,jpj,jpk), STAT=p4z_prod_alloc )
+
+      IF( p4z_prod_alloc /= 0 ) CALL ctl_warn('p4z_prod_alloc : failed to allocate arrays.')
+
+   END FUNCTION p4z_prod_alloc
 
 #else
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zrem.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zrem.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zrem.F90	(revision 2643)
@@ -29,4 +29,5 @@
    PUBLIC   p4z_rem         ! called in p4zbio.F90
    PUBLIC   p4z_rem_init    ! called in trcsms_pisces.F90
+   PUBLIC   p4z_rem_alloc
 
    !! * Shared module variables
@@ -39,6 +40,5 @@
      oxymin  = 1.e-6_wp         !:
 
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::    & !:
-     &                   denitr                     !: denitrification array
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: denitr  !: denitrification array
 
 
@@ -53,4 +53,5 @@
 CONTAINS
 
+
    SUBROUTINE p4z_rem( kt )
       !!---------------------------------------------------------------------
@@ -61,4 +62,8 @@
       !! ** Method  : - ???
       !!---------------------------------------------------------------------
+      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
+      USE wrk_nemo, ONLY: ztempbac => wrk_2d_1
+      USE wrk_nemo, ONLY: zdepbac  => wrk_3d_2, zfesatur => wrk_3d_2, zolimi => wrk_3d_4
+      !
       INTEGER, INTENT(in) ::   kt ! ocean time step
       INTEGER  ::   ji, jj, jk
@@ -72,10 +77,11 @@
 #endif
       REAL(wp) ::   zlamfac, zonitr, zstep
-      REAL(wp), DIMENSION(jpi,jpj)     ::   ztempbac
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zdepbac, zfesatur, zolimi
       CHARACTER (len=25) :: charout
 
       !!---------------------------------------------------------------------
 
+      IF( ( wrk_in_use(2, 1) ) .OR. ( wrk_in_use(3, 2,3,4) ) ) THEN
+         CALL ctl_stop('p4z_rem: requested workspace arrays unavailable')  ;  RETURN
+      END IF
 
        ! Initialisation of temprary arrys
@@ -393,4 +399,7 @@
        ENDIF
 
+      IF( ( wrk_not_released(2, 1) ) .OR. ( wrk_not_released(3, 2,3,4) ) )  &
+        &         CALL ctl_stop('p4z_rem: failed to release workspace arrays')
+
    END SUBROUTINE p4z_rem
 
@@ -431,4 +440,14 @@
    END SUBROUTINE p4z_rem_init
 
+   INTEGER FUNCTION p4z_rem_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_rem_alloc  ***
+      !!----------------------------------------------------------------------
+
+      ALLOCATE( denitr(jpi,jpj,jpk), STAT=p4z_rem_alloc )
+
+      IF( p4z_rem_alloc /= 0 ) CALL ctl_warn('p4z_rem_alloc : failed to allocate arrays.')
+
+   END FUNCTION p4z_rem_alloc
 #else
    !!======================================================================
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsed.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsed.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsed.F90	(revision 2643)
@@ -18,6 +18,4 @@
    USE oce_trc         !
    USE sms_pisces
-   USE lib_mpp
-   USE lib_fortran
    USE prtctl_trc
    USE p4zbio
@@ -27,5 +25,4 @@
    USE p4zrem
    USE p4zlim
-   USE lbclnk
    USE iom
 
@@ -36,32 +33,34 @@
    PUBLIC   p4z_sed   
    PUBLIC   p4z_sed_init   
+   PUBLIC   p4z_sed_alloc
 
    !! * Shared module variables
-   LOGICAL, PUBLIC ::    &
-     ln_dustfer  = .FALSE.      ,  &  !:
-     ln_river    = .FALSE.      ,  &  !:
-     ln_ndepo    = .FALSE.      ,  &  !:
-     ln_sedinput = .FALSE.            !:
-
-   REAL(wp), PUBLIC ::   &
-     sedfeinput = 1.E-9_wp   ,  &  !:
-     dustsolub  = 0.014_wp         !:
+   LOGICAL, PUBLIC :: ln_dustfer  = .FALSE.    !: boolean for dust input from the atmosphere
+   LOGICAL, PUBLIC :: ln_river    = .FALSE.    !: boolean for river input of nutrients
+   LOGICAL, PUBLIC :: ln_ndepo    = .FALSE.    !: boolean for atmospheric deposition of N
+   LOGICAL, PUBLIC :: ln_sedinput = .FALSE.    !: boolean for Fe input from sediments
+
+   REAL(wp), PUBLIC :: sedfeinput = 1.E-9_wp   !: Coastal release of Iron
+   REAL(wp), PUBLIC :: dustsolub  = 0.014_wp   !: Solubility of the dust
 
    !! * Module variables
-   REAL(wp) :: ryyss               !: number of seconds per year 
-   REAL(wp) :: ryyss1              !: inverse of ryyss
-   REAL(wp) :: rmtss               !: number of seconds per month
-   REAL(wp) :: rday1               !: inverse of rday
-
-   INTEGER , PARAMETER :: &
-        jpmth = 12, jpyr = 1
-   INTEGER ::                   &
-      numdust,                  &  !: logical unit for surface fluxes data
-      nflx1 , nflx2,            &  !: first and second record used
-      nflx11, nflx12      ! ???
-   REAL(wp), DIMENSION(jpi,jpj,jpmth) ::  dustmo    !: set of dust fields
-   REAL(wp), DIMENSION(jpi,jpj)      ::  rivinp, cotdep, nitdep, dust 
-   REAL(wp), DIMENSION(jpi,jpj)      ::  e1e2t
-   REAL(wp), DIMENSION(jpi,jpj,jpk)  ::  ironsed 
+   REAL(wp) :: ryyss                  !: number of seconds per year 
+   REAL(wp) :: ryyss1                 !: inverse of ryyss
+   REAL(wp) :: rmtss                  !: number of seconds per month
+   REAL(wp) :: rday1                  !: inverse of rday
+
+   INTEGER , PARAMETER :: jpmth = 12  !: number of months per year
+   INTEGER , PARAMETER :: jpyr  = 1   !: one year
+
+   INTEGER ::  numdust                !: logical unit for surface fluxes data
+   INTEGER ::  nflx1 , nflx2          !: first and second record used
+   INTEGER ::  nflx11, nflx12
+
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: dustmo    !: set of dust fields
+   REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:) :: dust      !: dust fields
+   REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:) :: rivinp, cotdep    !: river input fields
+   REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:) :: nitdep    !: atmospheric N deposition 
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: ironsed   !: Coastal supply of iron
+
    REAL(wp) :: sumdepsi, rivalkinput, rivpo4input, nitdepinput
 
@@ -76,4 +75,5 @@
 CONTAINS
 
+
    SUBROUTINE p4z_sed( kt, jnt )
       !!---------------------------------------------------------------------
@@ -86,4 +86,8 @@
       !! ** Method  : - ???
       !!---------------------------------------------------------------------
+      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
+      USE wrk_nemo, ONLY: zsidep => wrk_2d_1, zwork => wrk_2d_2, zwork1 => wrk_2d_3
+      USE wrk_nemo, ONLY: znitrpot => wrk_3d_2, zirondep => wrk_3d_3
+      !
       INTEGER, INTENT(in) ::   kt, jnt ! ocean time step
       INTEGER  ::   ji, jj, jk, ikt
@@ -94,9 +98,10 @@
       REAL(wp) ::   zdenitot, znitrpottot, zlim, zfact
       REAL(wp) ::   zwsbio3, zwsbio4, zwscal
-      REAL(wp), DIMENSION(jpi,jpj)     ::   zsidep
-      REAL(wp), DIMENSION(jpi,jpj)     ::   zwork, zwork1
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   znitrpot, zirondep
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
+
+      IF( ( wrk_in_use(2, 1,2,3) ) .OR. ( wrk_in_use(3, 2,3) ) ) THEN
+         CALL ctl_stop('p4z_sed: requested workspace arrays unavailable')  ;  RETURN
+      END IF
 
       IF( jnt == 1  .AND.  ln_dustfer  )  CALL p4z_sbc( kt )
@@ -288,4 +293,7 @@
        ENDIF
 
+      IF( ( wrk_not_released(2, 1,2,3) ) .OR. ( wrk_not_released(3, 2,3) ) )   &
+        &         CALL ctl_stop('p4z_sed: failed to release workspace arrays')
+
    END SUBROUTINE p4z_sed
 
@@ -474,5 +482,4 @@
       ryyss1 = 1. / ryyss
       !                                    ! ocean surface cell
-      e1e2t(:,:) = e1t(:,:) * e2t(:,:)
 
       ! total atmospheric supply of Si
@@ -512,4 +519,16 @@
    END SUBROUTINE p4z_sed_init
 
+   INTEGER FUNCTION p4z_sed_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_sed_alloc  ***
+      !!----------------------------------------------------------------------
+
+      ALLOCATE( dustmo(jpi,jpj,jpmth), dust(jpi,jpj)       ,     &
+        &       rivinp(jpi,jpj)      , cotdep(jpi,jpj)     ,     &
+        &       nitdep(jpi,jpj)      , ironsed(jpi,jpj,jpk), STAT=p4z_sed_alloc )  
+
+      IF( p4z_sed_alloc /= 0 ) CALL ctl_warn('p4z_sed_alloc : failed to allocate arrays.')
+
+   END FUNCTION p4z_sed_alloc
 #else
    !!======================================================================
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsink.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsink.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zsink.F90	(revision 2643)
@@ -21,48 +21,41 @@
    PUBLIC   p4z_sink         ! called in p4zbio.F90
    PUBLIC   p4z_sink_init    ! called in trcsms_pisces.F90
+   PUBLIC   p4z_sink_alloc
 
    !! * Shared module variables
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   &   !:
-     wsbio3, wsbio4,      &    !: POC and GOC sinking speeds
-     wscal                     !: Calcite and BSi sinking speeds
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: wsbio3   !: POC sinking speed 
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: wsbio4   !: GOC sinking speed
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: wscal    !: Calcite and BSi sinking speeds
 
    !! * Module variables
-   REAL(wp), PUBLIC, DIMENSION(jpi,jpj,jpk) ::   &   !:
-     sinking, sinking2,   &    !: POC sinking fluxes (different meanings depending on the parameterization
-     sinkcal, sinksil,    &    !: CaCO3 and BSi sinking fluxes
-     sinkfer                   !: Small BFe sinking flux
-
-   INTEGER  :: &
-      iksed  = 10              !
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sinking, sinking2  !: POC sinking fluxes 
+   !                                                                 !  (different meanings depending on the parameterization)
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sinkcal, sinksil   !: CaCO3 and BSi sinking fluxes
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sinkfer            !: Small BFe sinking fluxes
+#if ! defined key_kriest
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) :: sinkfer2           !: Big iron sinking fluxes
+#endif
+
+   INTEGER  :: iksed  = 10
 
 #if  defined key_kriest
-   REAL(wp)          ::       &   
-      xkr_sfact    = 250.  ,  &   !: Sinking factor
-      xkr_stick    = 0.2   ,  &   !: Stickiness
-      xkr_nnano    = 2.337 ,  &   !: Nbr of cell in nano size class
-      xkr_ndiat    = 3.718 ,  &   !: Nbr of cell in diatoms size class
-      xkr_nmeso    = 7.147 ,  &   !: Nbr of cell in mesozoo  size class
-      xkr_naggr    = 9.877        !: Nbr of cell in aggregates  size class
-
-   REAL(wp)          ::       &   
-      xkr_frac
-
-   REAL(wp), PUBLIC ::        &
-      xkr_dnano            ,  &   !: Size of particles in nano pool
-      xkr_ddiat            ,  &   !: Size of particles in diatoms pool
-      xkr_dmeso            ,  &   !: Size of particles in mesozoo pool
-      xkr_daggr            ,  &   !: Size of particles in aggregates pool
-      xkr_wsbio_min        ,  &   !: min vertical particle speed
-      xkr_wsbio_max               !: max vertical particle speed
-
-   REAL(wp), PUBLIC, DIMENSION(jpk) ::   &   !:
-      xnumm                       !:     maximum number of particles in aggregates
-
-#endif
-
-#if ! defined key_kriest
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   &   !:
-     sinkfer2                  !: Big Fe sinking flux
-#endif 
+   REAL(wp) ::  xkr_sfact    = 250.     !: Sinking factor
+   REAL(wp) ::  xkr_stick    = 0.2      !: Stickiness
+   REAL(wp) ::  xkr_nnano    = 2.337    !: Nbr of cell in nano size class
+   REAL(wp) ::  xkr_ndiat    = 3.718    !: Nbr of cell in diatoms size class
+   REAL(wp) ::  xkr_nmeso    = 7.147    !: Nbr of cell in mesozoo  size class
+   REAL(wp) ::  xkr_naggr    = 9.877    !: Nbr of cell in aggregates  size class
+
+   REAL(wp) ::  xkr_frac 
+
+   REAL(wp), PUBLIC ::  xkr_dnano       !: Size of particles in nano pool
+   REAL(wp), PUBLIC ::  xkr_ddiat       !: Size of particles in diatoms pool
+   REAL(wp), PUBLIC ::  xkr_dmeso       !: Size of particles in mesozoo pool
+   REAL(wp), PUBLIC ::  xkr_daggr       !: Size of particles in aggregates pool
+   REAL(wp), PUBLIC ::  xkr_wsbio_min   !: min vertical particle speed
+   REAL(wp), PUBLIC ::  xkr_wsbio_max   !: max vertical particle speed
+
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) :: xnumm  !:  maximum number of particles in aggregates
+#endif
 
    !!* Substitution
@@ -76,4 +69,5 @@
 CONTAINS
 
+
 #if defined key_kriest
 
@@ -87,5 +81,6 @@
       !! ** Method  : - ???
       !!---------------------------------------------------------------------
-
+      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
+      USE wrk_nemo, ONLY: znum3d    => wrk_3d_2
       INTEGER, INTENT(in) :: kt, jnt
       INTEGER  :: ji, jj, jk
@@ -99,9 +94,11 @@
       INTEGER  :: ik1
 #endif
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   znum3d
       CHARACTER (len=25) :: charout
 
       !!---------------------------------------------------------------------
 
+      IF( wrk_in_use(3, 2 ) ) THEN
+         CALL ctl_stop('p4z_sink: requested workspace arrays unavailable')  ;  RETURN
+      END IF
       !     Initialisation of variables used to compute Sinking Speed
       !     ---------------------------------------------------------
@@ -311,4 +308,6 @@
        ENDIF
 
+      IF( wrk_not_released(3, 2 ) ) CALL ctl_stop('p4z_sink: failed to release workspace arrays')
+      !
    END SUBROUTINE p4z_sink
 
@@ -611,4 +610,7 @@
       !!      transport term, i.e.  div(u*tra).
       !!---------------------------------------------------------------------
+      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
+      USE wrk_nemo, ONLY: ztraz => wrk_3d_2, zakz => wrk_3d_3, zwsink2 => wrk_3d_4
+      !
       INTEGER , INTENT(in   )                         ::   jp_tra    ! tracer index index      
       REAL(wp), INTENT(in   ), DIMENSION(jpi,jpj,jpk) ::   pwsink    ! sinking speed
@@ -617,8 +619,10 @@
       INTEGER  ::   ji, jj, jk, jn
       REAL(wp) ::   zigma,zew,zign, zflx, zstep
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::  ztraz, zakz
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::  zwsink2
-      !!---------------------------------------------------------------------
-
+      !!---------------------------------------------------------------------
+
+      IF(  wrk_in_use(3, 2,3,4 ) ) THEN
+         CALL ctl_stop('p4z_sink2: requested workspace arrays unavailable')
+         RETURN
+      END IF
 
       zstep = rfact2 / 2.
@@ -704,7 +708,27 @@
       psinkflx(:,:,:)   = 2. * psinkflx(:,:,:)
 
+      IF( wrk_not_released(3, 2,3,4 ) ) CALL ctl_stop('p4z_sink2: failed to release workspace arrays')
       !
    END SUBROUTINE p4z_sink2
 
+   INTEGER FUNCTION p4z_sink_alloc()
+      !!----------------------------------------------------------------------
+      !!                     ***  ROUTINE p4z_sink_alloc  ***
+      !!----------------------------------------------------------------------
+
+      ALLOCATE( wsbio3(jpi,jpj,jpk), wsbio4(jpi,jpj,jpk), wscal(jpi,jpj,jpk),  &
+        &       sinking(jpi,jpj,jpk), sinking2(jpi,jpj,jpk)                 ,  &                
+        &       sinkcal(jpi,jpj,jpk), sinksil(jpi,jpj,jpk)                  ,  &                
+#if defined key_kriest
+        &       xnumm(jpk)                                                  ,  &                
+#else
+        &       sinkfer2(jpi,jpj,jpk)                                       ,  &                
+#endif
+
+        &       sinkfer(jpi,jpj,jpk), STAT=p4z_sink_alloc )                
+
+      IF( p4z_sink_alloc /= 0 ) CALL ctl_warn('p4z_sink_alloc : failed to allocate arrays.')
+
+   END FUNCTION p4z_sink_alloc
 #else
    !!======================================================================
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/sms_pisces.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/sms_pisces.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/sms_pisces.F90	(revision 2643)
@@ -38,42 +38,44 @@
    !!* Damping 
    LOGICAL  ::   ln_pisdmp         !: relaxation or not of nutrients to a mean value
-                                   !: when initialize from a restart file 
    LOGICAL  ::   ln_pisclo         !: Restoring or not of nutrients to initial value
                                    !: on close seas
 
    !!*  Biological fluxes for light
-   INTEGER , DIMENSION(jpi,jpj)     ::   neln       !: number of T-levels + 1 in the euphotic layer
-   REAL(wp), DIMENSION(jpi,jpj)     ::   heup       !: euphotic layer depth
+   INTEGER , ALLOCATABLE, SAVE,   DIMENSION(:,:)  ::  neln       !: number of T-levels + 1 in the euphotic layer
+   REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:)  ::  heup       !: euphotic layer depth
 
    !!*  Biological fluxes for primary production
-   REAL(wp), DIMENSION(jpi,jpj)     ::   xksi       !: ???
-   REAL(wp), DIMENSION(jpi,jpj)     ::   xksimax    !: ???
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   xnanono3   !: ???
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   xdiatno3   !: ???
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   xnanonh4   !: ???
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   xdiatnh4   !: ???
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   xlimphy    !: ???
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   xlimdia    !: ???
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   concdfe    !: ???
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   concnfe    !: ???
+   REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:)  ::   xksi       !: ???
+   REAL(wp), ALLOCATABLE, SAVE,   DIMENSION(:,:)  ::   xksimax    !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xnanono3   !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xdiatno3   !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xnanonh4   !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xdiatnh4   !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimphy    !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   xlimdia    !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   concdfe    !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:)  ::   concnfe    !: ???
 
    !!*  SMS for the organic matter
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   xfracal    !: ??
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   nitrfac    !: ??
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   xlimbac    !: ??
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   xdiss      !: ??
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xfracal    !: ??
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   nitrfac    !: ??
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xlimbac    !: ??
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xdiss      !: ??
 #if defined key_diatrc
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   prodcal    !: Calcite production
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   grazing    !: Total zooplankton grazing
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   prodcal    !: Calcite production
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   grazing    !: Total zooplankton grazing
 #endif
 
    !!* Variable for chemistry of the CO2 cycle
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   akb3       !: ???
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ak13       !: ???
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ak23       !: ???
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   aksp       !: ???
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   akw3       !: ???
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   borat      !: ???
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   hi         !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   akb3       !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ak13       !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ak23       !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   aksp       !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   akw3       !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   borat      !: ???
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   hi         !: ???
+
+   !!* Array used to indicate negative tracer values
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   xnegtr     !: ???
 
 #if defined key_kriest
@@ -84,4 +86,47 @@
    REAL(wp) ::   xkr_mass_min, xkr_mass_max         !: ???
 #endif
+
+CONTAINS
+
+   INTEGER FUNCTION sms_pisces_alloc()
+      !!----------------------------------------------------------------------
+      !!        *** ROUTINE sms_pisces_alloc ***
+      !!----------------------------------------------------------------------
+      USE lib_mpp , ONLY: ctl_warn
+      INTEGER :: ierr(5)        ! Local variables
+      !!----------------------------------------------------------------------
+
+      ierr(:) = 0
+
+      !*  Biological fluxes for light
+      ALLOCATE( neln(jpi,jpj), heup(jpi,jpj),                           STAT=ierr(1) )
+
+      !*  Biological fluxes for primary production
+      ALLOCATE( xksimax(jpi,jpj)     , xksi(jpi,jpj)        ,               &
+         &      xnanono3(jpi,jpj,jpk), xdiatno3(jpi,jpj,jpk),               &
+         &      xnanonh4(jpi,jpj,jpk), xdiatnh4(jpi,jpj,jpk),               &
+         &      xlimphy (jpi,jpj,jpk), xlimdia (jpi,jpj,jpk),               &
+         &      concdfe (jpi,jpj,jpk), concnfe (jpi,jpj,jpk),           STAT=ierr(2) ) 
+
+      !*  SMS for the organic matter
+      ALLOCATE( xfracal (jpi,jpj,jpk), nitrfac (jpi,jpj,jpk),               &
+#if defined key_diatrc
+         &      prodcal(jpi,jpj,jpk) , grazing(jpi,jpj,jpk) ,               &
+#endif 
+         &      xlimbac (jpi,jpj,jpk), xdiss(jpi,jpj,jpk)   ,           STAT=ierr(3) )  
+
+      !* Variable for chemistry of the CO2 cycle
+      ALLOCATE( akb3(jpi,jpj,jpk), ak13(jpi,jpj,jpk) ,                      &
+         &      ak23(jpi,jpj,jpk), aksp(jpi,jpj,jpk) ,                      &
+         &      akw3(jpi,jpj,jpk), borat(jpi,jpj,jpk), hi(jpi,jpj,jpk), STAT=ierr(4) )
+
+      !* Array used to indicate negative tracer values  
+      ALLOCATE( xnegtr(jpi,jpj,jpk),                                    STAT=ierr(5) )
+
+      sms_pisces_alloc = MAXVAL( ierr )
+
+      IF( sms_pisces_alloc /= 0 ) CALL ctl_warn('sms_pisces_alloc : failed to allocate arrays.') 
+
+   END FUNCTION sms_pisces_alloc
 
 #else
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/trcini_pisces.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/trcini_pisces.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/trcini_pisces.F90	(revision 2643)
@@ -21,5 +21,11 @@
    USE oce_trc         ! ocean variables
    USE p4zche 
-   USE lib_mpp
+   USE p4zche          ! 
+   USE p4zsink         ! 
+   USE p4zopt          ! 
+   USE p4zprod         !
+   USE p4zrem          ! 
+   USE p4zsed          ! 
+   USE p4zflx          ! 
 
    IMPLICIT NONE
@@ -29,12 +35,11 @@
 
    !! * Module variables
-   REAL(wp) :: &
-      sco2   =  2.312e-3         , &
-      alka0  =  2.423e-3         , &
-      oxyg0  =  177.6e-6         , &
-      po4    =  2.174e-6         , &
-      bioma0 =  1.000e-8         , &
-      silic1 =  91.65e-6         , &
-      no3    =  31.04e-6 * 7.6
+   REAL(wp) :: sco2   =  2.312e-3 
+   REAL(wp) :: alka0  =  2.423e-3
+   REAL(wp) :: oxyg0  =  177.6e-6 
+   REAL(wp) :: po4    =  2.174e-6 
+   REAL(wp) :: bioma0 =  1.000e-8  
+   REAL(wp) :: silic1 =  91.65e-6  
+   REAL(wp) :: no3    =  31.04e-6 * 7.6
 
 #  include "top_substitute.h90"
@@ -55,11 +60,10 @@
 
 
-      !  Control consitency
-      CALL trc_ctl_pisces
-
-
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) ' trc_ini_pisces :   PISCES biochemical model initialisation'
       IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
+
+
+      CALL pisces_alloc()                          ! Allocate PISCES arrays
 
       !                                            ! Time-step
@@ -129,25 +133,38 @@
       !
    END SUBROUTINE trc_ini_pisces
- 
-   SUBROUTINE trc_ctl_pisces
+
+   SUBROUTINE pisces_alloc
       !!----------------------------------------------------------------------
-      !!                     ***  ROUTINE trc_ctl_pisces  ***
+      !!                     ***  ROUTINE pisces_alloc  ***
       !!
-      !! ** Purpose :   control the cpp options, namelist and files 
+      !! ** Purpose :   Allocate all the dynamic arrays of PISCES 
       !!----------------------------------------------------------------------
+      USE p4zint , ONLY : p4z_int_alloc      
+      USE p4zsink, ONLY : p4z_sink_alloc      
+      USE p4zopt , ONLY : p4z_opt_alloc           
+      USE p4zprod, ONLY : p4z_prod_alloc         
+      USE p4zrem , ONLY : p4z_rem_alloc           
+      USE p4zsed , ONLY : p4z_sed_alloc          
+      USE p4zflx , ONLY : p4z_flx_alloc
+      !
+      INTEGER :: ierr
+      !!----------------------------------------------------------------------
+      !
+      ierr =         sms_pisces_alloc()          ! Start of PISCES-related alloc routines...
+      ierr = ierr +     p4z_che_alloc()
+      ierr = ierr +     p4z_int_alloc()
+      ierr = ierr +    p4z_sink_alloc()
+      ierr = ierr +     p4z_opt_alloc()
+      ierr = ierr +    p4z_prod_alloc()
+      ierr = ierr +     p4z_rem_alloc()
+      ierr = ierr +     p4z_sed_alloc()
+      ierr = ierr +     p4z_flx_alloc()
+      !
+      IF( lk_mpp    )   CALL mpp_sum( ierr )
+      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'pisces_alloc : unable to allocate PISCES arrays' )
 
-      IF(lwp) WRITE(numout,*)
-      IF(lwp) WRITE(numout,*) ' use PISCES biological model '
+      !
+   END SUBROUTINE pisces_alloc
 
-   ! Check number of tracers
-   ! -----------------------
-#if  defined key_kriest
-      IF( jp_pisces /= 23) CALL ctl_stop( ' PISCES must have 23 passive tracers. Change jp_pisces in par_pisces.F90' )
-#else
-      IF( jp_pisces /= 24) CALL ctl_stop( ' PISCES must have 24 passive tracers. Change jp_pisces in par_pisces.F90' )
-#endif
-
-   END SUBROUTINE trc_ctl_pisces
-  
 #else
    !!----------------------------------------------------------------------
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/trcnam_pisces.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/trcnam_pisces.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/trcnam_pisces.F90	(revision 2643)
@@ -19,5 +19,4 @@
    USE trc             ! TOP variables
    USE sms_pisces      ! sms trends
-   USE in_out_manager  ! I/O manager
 
 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/trcrst_pisces.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/trcrst_pisces.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/trcrst_pisces.F90	(revision 2643)
@@ -18,9 +18,6 @@
    USE trcsms_pisces          ! pisces sms trends
    USE sms_pisces          ! pisces sms variables
-   USE in_out_manager  ! I/O manager
    USE iom
    USE trcdta
-   USE lib_mpp
-   USE lib_fortran
 
    IMPLICIT NONE
@@ -108,12 +105,10 @@
       !! ** purpose  : Relaxation of some tracers
       !!----------------------------------------------------------------------
-      INTEGER  :: ji, jj, jk
-      REAL(wp) ::  &
-         alkmean = 2426. ,  & ! mean value of alkalinity ( Glodap ; for Goyet 2391. )
-         po4mean = 2.165 ,  & ! mean value of phosphates
-         no3mean = 30.90 ,  & ! mean value of nitrate
-         silmean = 91.51      ! mean value of silicate
-
-      REAL(wp) :: zarea, zvol, zalksum, zpo4sum, zno3sum, zsilsum
+      REAL(wp) ::  alkmean = 2426.     ! mean value of alkalinity ( Glodap ; for Goyet 2391. )
+      REAL(wp) ::  po4mean = 2.165     ! mean value of phosphates
+      REAL(wp) ::  no3mean = 30.90     ! mean value of nitrate
+      REAL(wp) ::  silmean = 91.51     ! mean value of silicate
+
+      REAL(wp) :: zarea, zalksum, zpo4sum, zno3sum, zsilsum
 
 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/PISCES/trcsms_pisces.F90	(revision 2643)
@@ -16,6 +16,4 @@
    USE trc
    USE sms_pisces
-   USE lbclnk
-   USE lib_mpp
    
    USE p4zint          ! 
@@ -65,12 +63,18 @@
       !!              - ...
       !!---------------------------------------------------------------------
+      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
+      USE wrk_nemo, ONLY: ztrpis => wrk_3d_1   ! used for pisces sms trends
+      !
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index      
       !!
       INTEGER ::   jnt, jn
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   ztrpis   ! used for pisces sms trends
       CHARACTER (len=25) :: charout
       !!---------------------------------------------------------------------
 
       IF( kt == nit000 )   CALL trc_sms_pisces_init    ! Initialization (first time-step only)
+
+      IF( wrk_in_use(3,1) )  THEN
+        CALL ctl_stop('trc_sms_pisces : requested workspace array unavailable.')  ;  RETURN
+      ENDIF
 
       IF( ndayflxtr /= nday_year ) THEN      ! New days
@@ -111,4 +115,5 @@
             CALL trd_mod_trc( ztrpis, jn, jptra_trd_sms, kt )   ! save trends
           END DO
+          DEALLOCATE( ztrpis )
       END IF
 
@@ -122,4 +127,6 @@
          !
       ENDIF
+
+      IF( wrk_not_released(3,1) ) CALL ctl_stop('trc_sms_pisces : failed to release workspace array.') 
 
    END SUBROUTINE trc_sms_pisces
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/SED/sedini.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/SED/sedini.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/SED/sedini.F90	(revision 2643)
@@ -17,5 +17,4 @@
    USE sedarr
    USE iom
-   USE in_out_manager  ! I/O manager
 
 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90	(revision 2643)
@@ -25,6 +25,4 @@
    USE traadv_eiv      ! eddy induced velocity     (tra_adv_eiv    routine)
    USE ldftra_oce      ! lateral diffusion coefficient on tracers
-   USE in_out_manager  ! I/O manager
-   USE lib_mpp         ! MPP library
    USE prtctl_trc      ! Print control
 
@@ -50,16 +48,12 @@
 CONTAINS
 
-   FUNCTION trc_adv_alloc()
+   INTEGER FUNCTION trc_adv_alloc()
       !!----------------------------------------------------------------------
       !!                  ***  ROUTINE trc_adv_alloc  ***
       !!----------------------------------------------------------------------
-      INTEGER :: trc_adv_alloc
-      !!----------------------------------------------------------------------
-
-      ALLOCATE(r2dt(jpk), Stat=trc_adv_alloc)
-
-      IF(trc_adv_alloc /= 0)THEN
-         CALL ctl_warn('trc_adv_alloc : failed to allocate array.')
-      END IF
+
+      ALLOCATE( r2dt(jpk), STAT=trc_adv_alloc )
+
+      IF( trc_adv_alloc /= 0 ) CALL ctl_warn('trc_adv_alloc : failed to allocate array.')
 
    END FUNCTION trc_adv_alloc
@@ -75,6 +69,6 @@
       !!----------------------------------------------------------------------
       USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY: zun => wrk_3d_1, zvn => wrk_3d_2, &
-                          zwn => wrk_3d_3   ! effective velocity
+      USE wrk_nemo, ONLY: zun => wrk_3d_4, zvn => wrk_3d_5, &
+                          zwn => wrk_3d_6   ! effective velocity
       !!
       INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
@@ -84,5 +78,5 @@
       !!----------------------------------------------------------------------
 
-      IF(wrk_in_use(3, 1,2,3))THEN
+      IF( wrk_in_use(3, 4,5,6) ) THEN
          CALL ctl_stop('trc_adv : requested workspace arrays unavailable.')
          RETURN
@@ -104,7 +98,7 @@
       DO jk = 1, jpkm1
          !                                                ! eulerian transport only
-         zun(:,:,jk) = e2u(:,:) * fse3u(:,:,jk) * un(:,:,jk)
-         zvn(:,:,jk) = e1v(:,:) * fse3v(:,:,jk) * vn(:,:,jk)
-         zwn(:,:,jk) = e1t(:,:) * e2t(:,:)      * wn(:,:,jk)
+         zun(:,:,jk) = e2u  (:,:) * fse3u(:,:,jk) * un(:,:,jk)
+         zvn(:,:,jk) = e1v  (:,:) * fse3v(:,:,jk) * vn(:,:,jk)
+         zwn(:,:,jk) = e1e2t(:,:)                 * wn(:,:,jk)
          !
       END DO
@@ -150,7 +144,5 @@
       END IF
       !
-      IF(wrk_not_released(3, 1,2,3))THEN
-         CALL ctl_stop('trc_adv : failed to release workspace arrays.')
-      END IF
+      IF( wrk_not_released(3, 4,5,6) ) CALL ctl_stop('trc_adv : failed to release workspace arrays.')
       !
    END SUBROUTINE trc_adv
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcldf.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcldf.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcldf.F90	(revision 2643)
@@ -27,7 +27,4 @@
    USE trdtra
    USE prtctl_trc      ! Print control
-   USE in_out_manager  ! I/O manager
-   USE lib_mpp         ! distribued memory computing library
-   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
 
    IMPLICIT NONE
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90	(revision 2643)
@@ -57,8 +57,6 @@
       !!                   ***  ROUTINE trc_nxt_alloc  ***
       !!----------------------------------------------------------------------
-      USE lib_mpp, ONLY: ctl_warn
-      !!----------------------------------------------------------------------
       !
-      ALLOCATE( r2dt(jpk), Stat=trc_nxt_alloc)
+      ALLOCATE( r2dt(jpk), STAT=trc_nxt_alloc)
       !
       IF( trc_nxt_alloc /= 0 )   CALL ctl_warn('trc_nxt_alloc : failed to allocate array')
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcrad.F90	(revision 2643)
@@ -17,5 +17,4 @@
    USE trdmod_oce
    USE trdtra
-   USE lib_mpp
    USE prtctl_trc          ! Print control for debbuging
 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90	(revision 2643)
@@ -21,5 +21,4 @@
    USE trdmod_oce
    USE trdtra
-   USE lib_mpp         ! MPP library
 
    IMPLICIT NONE
@@ -59,5 +58,6 @@
       !!----------------------------------------------------------------------
       USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
-      USE wrk_nemo, zemps => wrk_2d_1
+      USE wrk_nemo, zemps  => wrk_2d_1
+      USE wrk_nemo, ztrtrd => wrk_3d_1
       !
       INTEGER, INTENT( in ) ::   kt          ! ocean time-step index
@@ -65,9 +65,8 @@
       INTEGER  ::   ji, jj, jn           ! dummy loop indices
       REAL(wp) ::   zsrau, zse3t   ! temporary scalars
-      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrtrd
       CHARACTER (len=22) :: charout
       !!----------------------------------------------------------------------
 
-      IF(wrk_in_use(2, 1))THEN
+      IF( wrk_in_use(2, 1) .OR.  wrk_in_use(3, 1) ) THEN
          CALL ctl_stop('trc_sbc: requested workspace array unavailable.')   ;   RETURN
       END IF
@@ -79,6 +78,4 @@
       ENDIF
 
-
-      IF( l_trdtrc ) ALLOCATE( ztrtrd(jpi,jpj,jpk) )
 
       IF( lk_offline ) THEN          ! emps in dynamical files contains emps - rnf
@@ -115,6 +112,4 @@
       END DO                                                     ! tracer loop
       !                                                          ! ===========
-      IF( l_trdtrc ) DEALLOCATE( ztrtrd )
-
       IF( ln_ctl )   THEN
          WRITE(charout, FMT="('sbc ')") ;  CALL prt_ctl_trc_info(charout)
@@ -122,6 +117,7 @@
       ENDIF
 
-      IF( wrk_not_released(2, 1) )   CALL ctl_stop('trc_sbc: failed to release workspace array')
-      !
+      IF( wrk_not_released(2, 1) .OR. wrk_not_released(3, 1) )   &
+      &       CALL ctl_stop('trc_sbc: failed to release workspace array.')
+
    END SUBROUTINE trc_sbc
 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90	(revision 2643)
@@ -23,7 +23,4 @@
    USE trdtra
    USE prtctl_trc      ! Print control
-   USE in_out_manager  ! I/O manager
-   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-   USE lib_mpp         ! MPP library
 
    IMPLICIT NONE
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trdmld_trc.F90	(revision 2643)
@@ -244,7 +244,6 @@
       !!----------------------------------------------------------------------
 
-      IF(wrk_in_use(2, 1))THEN
-         CALL ctl_stop('trd_mld_bio_zint : requested workspace array unavailable.')
-         RETURN
+      IF( wrk_in_use(2, 1) ) THEN
+         CALL ctl_stop('trd_mld_bio_zint : requested workspace array unavailable.') ; RETURN
       END IF
 
@@ -329,7 +328,5 @@
       END DO
 
-      IF(wrk_not_released(2, 1))THEN
-         CALL ctl_stop('trd_mld_bio_zint : failed to release workspace array.')
-      END IF
+      IF( wrk_not_released(2, 1) ) CALL ctl_stop('trd_mld_bio_zint : failed to release workspace array.')
 #endif
 
@@ -912,7 +909,6 @@
       IF( lrst_trc )   CALL trd_mld_trc_rst_write( kt )  ! this must be after the array swap above (III.3)
 
-      IF(wrk_not_released(3, 1,2,3,4,5,6,7,8,9))THEN
-         CALL ctl_stop('trd_mld_trc : failed to release workspace arrays.')
-      END IF
+      IF( wrk_not_released(3, 1,2,3,4,5,6,7,8,9) ) &
+      &   CALL ctl_stop('trd_mld_trc : failed to release workspace arrays.')
       !
    END SUBROUTINE trd_mld_trc
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc_oce.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc_oce.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc_oce.F90	(revision 2643)
@@ -116,5 +116,6 @@
       tmltrd_csum_ub_bio                         !: before (prev. analysis period) cumulated sum over the
                                                  !: upper triangle
-# endif
+#endif
+
    !!----------------------------------------------------------------------
    !! NEMO/TOP 3.3 , NEMO Consortium (2010)
@@ -155,5 +156,6 @@
                tmltrdm_trc(jpi,jpj,jptra),                   &
                Stat=ierr(1))
-# endif
+#endif
+
 # if defined key_lobster
       ALLOCATE(tmltrd_bio(jpi,jpj,jpdiabio),         &
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/oce_trc.F90	(revision 2643)
@@ -33,5 +33,11 @@
    !* IO manager *
    USE in_out_manager    
-                          
+ 
+   !* MPP library                         
+   USE lib_mpp 
+
+   !* Fortran utilities                         
+   USE lib_fortran
+
    !* physical constants *
    USE phycst            
@@ -88,4 +94,5 @@
    USE dom_oce , ONLY :   e1t        =>   e1t        !: horizontal scale factors at t-point (m)  
    USE dom_oce , ONLY :   e2t        =>   e2t        !: horizontal scale factors at t-point (m)   
+   USE dom_oce , ONLY :   e1e2t      =>   e1e2t      !: cell surface at t-point (m2)
    USE dom_oce , ONLY :   e1u        =>   e1u        !: horizontal scale factors at u-point (m)
    USE dom_oce , ONLY :   e2u        =>   e2u        !: horizontal scale factors at u-point (m)
@@ -194,5 +201,4 @@
 
 #endif
-   USE lib_mpp , ONLY :   lk_mpp    =>  lk_mpp        !: Mpp flag
 
    USE dom_oce , ONLY :   nn_cla    =>  nn_cla        !: flag (0/1) for cross land advection 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/prtctl_trc.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/prtctl_trc.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/prtctl_trc.F90	(revision 2643)
@@ -17,6 +17,4 @@
    USE par_trc          ! TOP parameters
    USE oce_trc          ! ocean space and time domain variables
-   USE in_out_manager   ! I/O manager
-   USE lib_mpp          ! distributed memory computing
 
    IMPLICIT NONE
@@ -78,5 +76,5 @@
       !!----------------------------------------------------------------------
 
-      IF(wrk_in_use(3, 1,2))THEN
+      IF( wrk_in_use(3, 1,2) ) THEN
          CALL ctl_stop('prt_ctl_trc : requested workspace arrays unavailable.')
          RETURN
@@ -158,7 +156,5 @@
       END DO
       !
-      IF(wrk_not_released(3, 1,2))THEN
-         CALL ctl_stop('prt_ctl_trc : failed to release workspace arrays.')
-      END IF
+      IF( wrk_not_released(3, 1,2) ) CALL ctl_stop('prt_ctl_trc : failed to release workspace arrays.')
       !
    END SUBROUTINE prt_ctl_trc
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trc.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trc.F90	(revision 2643)
@@ -119,5 +119,4 @@
                trb(jpi,jpj,jpk,jptra),                             &
                gtru(jpi,jpj,jptra), gtrv(jpi,jpj,jptra),           &
-               rdttrc(jpk),                                        &
 # if defined key_diatrc && ! defined key_iomput
                trc2d(jpi,jpj,jpdia2d), trc3d(jpi,jpj,jpk,jpdia3d), &
@@ -125,11 +124,11 @@
 # if defined key_diabio
                trbio(jpi,jpj,jpk,jpdiabio),                        &
-# endif
-               STAT=trc_alloc)
+#endif
+               rdttrc(jpk),  STAT=trc_alloc )      
 
       IF( trc_alloc /= 0 )   CALL ctl_warn('trc_alloc: failed to allocate arrays')
       !
    END FUNCTION trc_alloc
-   
+
 #else
    !!----------------------------------------------------------------------
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcdia.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcdia.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcdia.F90	(revision 2643)
@@ -25,6 +25,4 @@
    USE par_trc
    USE dianam    ! build name of file (routine)
-   USE in_out_manager  ! I/O manager
-   USE lib_mpp
    USE ioipsl
 
@@ -63,19 +61,4 @@
 CONTAINS
 
-   FUNCTION trc_dia_alloc()
-      !!---------------------------------------------------------------------
-      !!                     ***  ROUTINE trc_dia_alloc  ***
-      !!---------------------------------------------------------------------
-      INTEGER :: trc_dia_alloc
-      !!---------------------------------------------------------------------
-
-      ALLOCATE(ndext50(jpij*jpk), ndext51(jpij), Stat=trc_dia_alloc)
-
-      IF(trc_dia_alloc /= 0)THEN
-         CALL ctl_warn('trc_dia_alloc : failed to allocate arrays.')
-      END IF
-
-   END FUNCTION trc_dia_alloc
-
 
    SUBROUTINE trc_dia( kt )  
@@ -200,7 +183,7 @@
          DO jn = 1, jptra
             IF( lutsav(jn) ) THEN
-               cltra  = ctrcnm(jn)   ! short title for tracer
-               cltral = ctrcnl(jn)   ! long title for tracer
-               cltrau = ctrcun(jn)   ! UNIT for tracer
+               cltra  = TRIM( ctrcnm(jn) )   ! short title for tracer
+               cltral = TRIM( ctrcnl(jn) )   ! long title for tracer
+               cltrau = TRIM( ctrcun(jn) )   ! UNIT for tracer
                CALL histdef( nit5, cltra, cltral, cltrau, jpi, jpj, nhorit5,  &
                   &          ipk, 1, ipk,  ndepit5, 32, clop, zsto, zout ) 
@@ -225,5 +208,5 @@
 
       DO jn = 1, jptra
-         cltra = ctrcnm(jn)      ! short title for tracer
+         cltra  = TRIM( ctrcnm(jn) )   ! short title for tracer
          IF( lutsav(jn) ) CALL histwrite( nit5, cltra, it, trn(:,:,:,jn), ndimt50, ndext50 )
       END DO
@@ -325,7 +308,7 @@
          ! more 3D horizontal arrays
          DO jl = 1, jpdia3d
-            cltra  = ctrc3d(jl)   ! short title for 3D diagnostic
-            cltral = ctrc3l(jl)   ! long title for 3D diagnostic
-            cltrau = ctrc3u(jl)   ! UNIT for 3D diagnostic
+            cltra  = TRIM( ctrc3d(jl) )   ! short title for 3D diagnostic
+            cltral = TRIM( ctrc3l(jl) )  ! long title for 3D diagnostic
+            cltrau = TRIM( ctrc3u(jl) )  ! UNIT for 3D diagnostic
             CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd,   &
                &          ipk, 1, ipk,  ndepitd, 32, clop, zsto, zout )
@@ -334,7 +317,7 @@
          ! more 2D horizontal arrays
          DO jl = 1, jpdia2d
-            cltra  = ctrc2d(jl)    ! short title for 2D diagnostic
-            cltral = ctrc2l(jl)   ! long title for 2D diagnostic
-            cltrau = ctrc2u(jl)   ! UNIT for 2D diagnostic
+            cltra  = TRIM( ctrc2d(jl) )   ! short title for 2D diagnostic
+            cltral = TRIM( ctrc2l(jl) )  ! long title for 2D diagnostic
+            cltrau = TRIM( ctrc2u(jl) )  ! UNIT for 2D diagnostic
             CALL histdef( nitd, cltra, cltral, cltrau, jpi, jpj, nhoritd,  &
                &          1, 1, 1,  -99, 32, clop, zsto, zout )
@@ -362,5 +345,5 @@
       ! more 3D horizontal arrays
       DO jl = 1, jpdia3d
-         cltra = ctrc3d(jl)   ! short title for 3D diagnostic
+         cltra  = TRIM( ctrc3d(jl) )   ! short title for 3D diagnostic
          CALL histwrite( nitd, cltra, it, trc3d(:,:,:,jl), ndimt50 ,ndext50)
       END DO
@@ -368,5 +351,5 @@
       ! more 2D horizontal arrays
       DO jl = 1, jpdia2d
-         cltra = ctrc2d(jl)   ! short title for 2D diagnostic
+         cltra  = TRIM( ctrc2d(jl) )   ! short title for 2D diagnostic
          CALL histwrite(nitd, cltra, it, trc2d(:,:,jl), ndimt51  ,ndext51)
       END DO
@@ -468,7 +451,7 @@
          ! biological trends
          DO jl = 1, jpdiabio
-            cltra  = ctrbio(jl)   ! short title for biological diagnostic
-            cltral = ctrbil(jl)   ! long title for biological diagnostic
-            cltrau = ctrbiu(jl)   ! UNIT for biological diagnostic
+            cltra  = TRIM( ctrbio(jl) )   ! short title for biological diagnostic
+            cltral = TRIM( ctrbil(jl) )  ! long title for biological diagnostic
+            cltrau = TRIM( ctrbiu(jl) )  ! UNIT for biological diagnostic
             CALL histdef( nitb, cltra, cltral, cltrau, jpi, jpj, nhoritb,  &
                &         ipk, 1, ipk,  ndepitb, 32, clop, zsto, zout)
@@ -494,5 +477,5 @@
 
       DO jl = 1, jpdiabio
-         cltra = ctrbio(jl)  ! short title for biological diagnostic
+         cltra  = TRIM( ctrbio(jl) )   ! short title for biological diagnostic
          CALL histwrite(nitb, cltra, it, trbio(:,:,:,jl), ndimt50,ndext50)
       END DO
@@ -513,4 +496,14 @@
 # endif 
 
+   INTEGER FUNCTION trc_dia_alloc()
+      !!---------------------------------------------------------------------
+      !!                     ***  ROUTINE trc_dia_alloc  ***
+      !!---------------------------------------------------------------------
+
+      ALLOCATE( ndext50(jpij*jpk), ndext51(jpij), STAT=trc_dia_alloc )
+
+      IF( trc_dia_alloc /= 0 ) CALL ctl_warn('trc_dia_alloc : failed to allocate arrays.')
+
+   END FUNCTION trc_dia_alloc
 #else
    !!----------------------------------------------------------------------
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcdta.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcdta.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcdta.F90	(revision 2643)
@@ -42,24 +42,4 @@
    !!----------------------------------------------------------------------
 CONTAINS
-
-   FUNCTION trc_dta_alloc()
-      !!----------------------------------------------------------------------
-      !!                   ***  ROUTINE trc_dta_alloc  ***
-      !!----------------------------------------------------------------------
-      INTEGER :: trc_dta_alloc
-      !!----------------------------------------------------------------------
-
-      ALLOCATE(trdta(jpi,jpj,jpk,jptra),                   &
-               tracdta(jpi,jpj,jpk,jptra,2),               &
-               nlectr(jptra), ntrc1(jptra), ntrc2,(jptra), & 
-               !
-               Stat = trc_dta_alloc)
-
-      IF(trc_dta_alloc /= 0)THEN
-         CALL ctl_warn('trc_dta_alloc : failed to allocate arrays.')
-      END IF
-
-   END FUNCTION trc_dta_alloc
-
 
    SUBROUTINE trc_dta( kt )
@@ -219,4 +199,19 @@
    END SUBROUTINE trc_dta
 
+   INTEGER FUNCTION trc_dta_alloc()
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE trc_dta_alloc  ***
+      !!----------------------------------------------------------------------
+
+      ALLOCATE(trdta(jpi,jpj,jpk,jptra),                   &
+               tracdta(jpi,jpj,jpk,jptra,2),               &
+               nlectr(jptra), ntrc1(jptra), ntrc2,(jptra), & 
+               !
+               STAT=trc_dta_alloc)
+
+      IF( trc_dta_alloc /= 0 ) CALL ctl_warn('trc_dta_alloc : failed to allocate arrays.')
+
+   END FUNCTION trc_dta_alloc
+
 #else
    !!----------------------------------------------------------------------
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcini.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcini.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcini.F90	(revision 2643)
@@ -28,8 +28,5 @@
    USE daymod
    USE zpshde          ! partial step: hor. derivative   (zps_hde routine)
-   USE in_out_manager  ! I/O manager
    USE prtctl_trc      ! Print control passive tracers (prt_ctl_trc_init routine)
-   USE lib_mpp         ! distributed memory computing library
-   USE lib_fortran     ! 
    
    IMPLICIT NONE
@@ -67,4 +64,5 @@
       IF(lwp) WRITE(numout,*) '~~~~~~~'
 
+
       CALL top_alloc()              ! allocate TOP arrays
 
@@ -201,13 +199,4 @@
       USE trdmld_trc    , ONLY:   trd_mld_trc_alloc
 #endif
-#if defined key_cfc
-     USE trcsms_cfc     , ONLY:   trc_sms_cfc_alloc
-#endif
-#if defined key_c14b
-     USE trcsms_c14b    , ONLY:   trc_sms_c14b_alloc
-#endif
-#if defined key_lobster
-      USE sms_lobster   , ONLY:   sms_lobster_alloc      ! LOBSTER-related alloc routines...
-#endif
       !
       INTEGER :: ierr
@@ -231,14 +220,4 @@
       ierr = ierr + trd_mld_trc_alloc()
 #endif
-#if defined key_cfc
-      ierr = ierr + trc_sms_cfc_alloc()
-#endif
-#if defined key_c14b
-      ierr = ierr + trc_sms_c14b_alloc()
-#endif
-      !
-#if defined key_lobster
-      ierr = ierr + sms_lobster_alloc()      ! Start of LOBSTER-related alloc routines
-#endif
       !
       IF( lk_mpp    )   CALL mpp_sum( ierr )
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcnam.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcnam.F90	(revision 2643)
@@ -26,6 +26,4 @@
    USE trcnam_c14b       ! C14 SMS namelist
    USE trcnam_my_trc     ! MY_TRC SMS namelist
-   USE in_out_manager    ! I/O manager
-   USE lib_mpp           ! MPP library
    USE trdmod_trc_oce
 
@@ -104,9 +102,9 @@
 
       DO jn = 1, jptra
-         ctrcnm(jn) = sn_tracer(jn)%clsname
-         ctrcnl(jn) = sn_tracer(jn)%cllname
-         ctrcun(jn) = sn_tracer(jn)%clunit
-         lutini(jn) = sn_tracer(jn)%llinit
-         lutsav(jn) = sn_tracer(jn)%llsave
+         ctrcnm(jn) = TRIM( sn_tracer(jn)%clsname )
+         ctrcnl(jn) = TRIM( sn_tracer(jn)%cllname )
+         ctrcun(jn) = TRIM( sn_tracer(jn)%clunit  )
+         lutini(jn) =       sn_tracer(jn)%llinit 
+         lutsav(jn) =       sn_tracer(jn)%llsave
       END DO
 
@@ -122,7 +120,7 @@
          DO jn = 1, jptra
             WRITE(numout,*) '   tracer nb             : ', jn 
-            WRITE(numout,*) '   short name            : ', TRIM(ctrcnm(jn))
-            WRITE(numout,*) '   long name             : ', TRIM(ctrcnl(jn))
-            WRITE(numout,*) '   unit                  : ', TRIM(ctrcun(jn))
+            WRITE(numout,*) '   short name            : ', ctrcnm(jn)
+            WRITE(numout,*) '   long name             : ', ctrcnl(jn)
+            WRITE(numout,*) '   unit                  : ', ctrcun(jn)
             WRITE(numout,*) '   initial value in FILE : ', lutini(jn) 
             WRITE(numout,*) ' '
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcrst.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcrst.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcrst.F90	(revision 2643)
@@ -26,6 +26,4 @@
    USE trc
    USE trcnam_trp
-   USE lib_mpp
-   USE lib_fortran
    USE iom
    USE trcrst_cfc      ! CFC      
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcstp.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcstp.F90	(revision 2642)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trcstp.F90	(revision 2643)
@@ -64,5 +64,5 @@
          ELSE                  ;   CALL trc_dia( kt )
          ENDIF
-                                   CALL trc_sms( kt )           ! tracers: sink and source
+      !                             CALL trc_sms( kt )           ! tracers: sink and source
                                    CALL trc_trp( kt )           ! transport of passive tracers
          IF( kt == nit000 )     CALL iom_close( numrtr )     ! close input  passive tracers restart file
