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 2605)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcadv.F90	(revision 2606)
@@ -32,8 +32,9 @@
    PRIVATE
 
-   PUBLIC   trc_adv    ! routine called by step module
+   PUBLIC   trc_adv          ! routine called by step module
+   PUBLIC   trc_adv_alloc    ! routine called by nemogcm module
 
    INTEGER ::   nadv   ! choice of the type of advection scheme
-   REAL(wp), DIMENSION(jpk) ::   r2dt  ! vertical profile time-step, = 2 rdttra
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) ::   r2dt  ! vertical profile time-step, = 2 rdttra
       !                                ! except at nit000 (=rdttra) if neuler=0
 
@@ -48,4 +49,20 @@
 
 CONTAINS
+
+   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
+
+   END FUNCTION trc_adv_alloc
+
 
    SUBROUTINE trc_adv( kt )
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcdmp.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcdmp.F90	(revision 2605)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcdmp.F90	(revision 2606)
@@ -29,5 +29,6 @@
    PRIVATE
 
-   PUBLIC trc_dmp      ! routine called by step.F90
+   PUBLIC trc_dmp            ! routine called by step.F90
+   PUBLIC trc_dmp_alloc      ! routine called by nemogcm.F90
 
    LOGICAL , PUBLIC, PARAMETER ::   lk_trcdmp = .TRUE.   !: internal damping flag
@@ -40,5 +41,5 @@
    INTEGER  ::   nn_file_tr =    2   ! = 1 create a damping.coeff NetCDF file 
 
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::   restotr   ! restoring coeff. on tracers (s-1)
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   restotr   ! restoring coeff. on tracers (s-1)
 
    !! * Substitutions
@@ -51,4 +52,20 @@
 
 CONTAINS
+
+   FUNCTION trc_dmp_alloc()
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE trc_dmp_alloc  ***
+      !!----------------------------------------------------------------------
+      INTEGER :: trc_dmp_alloc
+      !!----------------------------------------------------------------------
+
+      ALLOCATE(restotr(jpi,jpj,jpk), Stat=trc_dmp_alloc)
+
+      IF(trc_dmp_alloc /= 0)THEN
+         CALL ctl_warn('trc_dmp_alloc : failed to allocate array.')
+      END IF
+
+   END FUNCTION trc_dmp_alloc
+
 
    SUBROUTINE trc_dmp( kt )
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 2605)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcnxt.F90	(revision 2606)
@@ -45,6 +45,7 @@
    !! * Routine accessibility
    PUBLIC trc_nxt          ! routine called by step.F90
+   PUBLIC trc_nxt_alloc    ! routine called by nemogcm.F90
 
-  REAL(wp), DIMENSION(jpk) ::   r2dt
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) ::   r2dt
    !!----------------------------------------------------------------------
    !! NEMO/TOP 3.3 , NEMO Consortium (2010)
@@ -54,4 +55,20 @@
 
 CONTAINS
+
+   FUNCTION trc_nxt_alloc
+      !!----------------------------------------------------------------------
+      !!                   ***  ROUTINE trc_nxt_alloc  ***
+      !!----------------------------------------------------------------------
+      INTEGER :: trc_nxt_alloc
+      !!----------------------------------------------------------------------
+
+      ALLOCATE( r2dt(jpk), Stat=trc_nxt_alloc)
+
+      IF(trc_nxt_alloc /= 0)THEN
+         CALL ctl_warn('trc_nxt_alloc : failed to allocate array.')
+      ENDIF
+
+   END FUNCTION trc_nxt_alloc
+
 
    SUBROUTINE trc_nxt( kt )
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 2605)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trczdf.F90	(revision 2606)
@@ -29,9 +29,10 @@
    PRIVATE
 
-   PUBLIC   trc_zdf    ! called by step.F90 
+   PUBLIC   trc_zdf          ! called by step.F90 
+   PUBLIC   trc_zdf_alloc    ! called by nemogcm.F90 
 
    INTEGER ::   nzdf = 0               ! type vertical diffusion algorithm used
       !                                ! defined from ln_zdf...  namlist logicals)
-   REAL(wp), DIMENSION(jpk) ::  r2dt   ! vertical profile time-step, = 2 rdttra
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) ::  r2dt   ! vertical profile time-step, = 2 rdttra
       !                                ! except at nit000 (=rdttra) if neuler=0
 
@@ -48,4 +49,20 @@
 CONTAINS
    
+   FUNCTION trc_zdf_alloc()
+      !!----------------------------------------------------------------------
+      !!                  ***  ROUTINE trc_zdf_alloc  ***
+      !!----------------------------------------------------------------------
+      INTEGER :: trc_zdf_alloc
+      !!----------------------------------------------------------------------
+
+      ALLOCATE(r2dt(jpk), Stat=trc_zdf_alloc)
+
+      IF(trc_zdf_alloc /= 0)THEN
+         CALL ctl_warn('trc_zdf_alloc : failed to allocate array.')
+      END IF
+
+   END FUNCTION trc_zdf_alloc
+
+
    SUBROUTINE trc_zdf( kt )
       !!----------------------------------------------------------------------
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 2605)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trdmod_trc_oce.F90	(revision 2606)
@@ -60,7 +60,7 @@
    !! Trends diagnostics parameters
    !!---------------------------------------------------------------------
-   INTEGER, PARAMETER ::            &
-      jpltrd_trc = 12,                  & !: number of mixed-layer trends arrays
-      jpktrd_trc = jpk                    !: max level for mixed-layer trends diag.
+   INTEGER, PARAMETER :: jpltrd_trc = 12    !: number of mixed-layer trends arrays
+      
+   INTEGER            :: jpktrd_trc         !: max level for mixed-layer trends diag.
 
    !! Arrays used for diagnosing mixed-layer trends 
@@ -68,15 +68,15 @@
    CHARACTER(LEN=80) :: clname_trc, ctrd_trc(jpltrd_trc+1,2)
 
-   INTEGER, DIMENSION(jpi,jpj) ::   &
+   INTEGER, ALLOCATABLE, SAVE, DIMENSION(:,:) ::   &
       nmld_trc       , &                            !: mixed layer depth indexes 
       nbol_trc                                   !: mixed-layer depth indexes when read from file
 
-   REAL(wp), DIMENSION(jpi,jpj,jpk) ::  wkx_trc  !:
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  wkx_trc  !:
 
-   REAL(wp), DIMENSION(jpi,jpj) ::  rmld_trc     !: ML depth (m) corresponding to nmld_trc
-   REAL(wp), DIMENSION(jpi,jpj) ::  rmld_sum_trc !: needed to compute the leap-frog time mean of ML depth
-   REAL(wp), DIMENSION(jpi,jpj) ::  rmldbn_trc   !: idem
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::  rmld_trc     !: ML depth (m) corresponding to nmld_trc
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::  rmld_sum_trc !: needed to compute the leap-frog time mean of ML depth
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::  rmldbn_trc   !: idem
 
-   REAL(wp), DIMENSION(jpi,jpj,jptra) ::  &
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  &
       tml_trc    ,                        &      !: \ "now" mixed layer temperature/salinity
       tmlb_trc   ,                        &      !: /  and associated "before" fields
@@ -89,5 +89,5 @@
                                                  !:     previous analysis period
                                                  
-   REAL(wp), DIMENSION(jpi,jpj,jptra) ::  &      
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  &      
       tmlatfb_trc, tmlatfn_trc ,          &      !: "before" Asselin contrib. at beginning of the averaging
                                                  !:     period (i.e. last contrib. from previous such period)
@@ -98,5 +98,5 @@
       tmlradm_trc                                !: accumulator for the previous trcrad trend
 
-   REAL(wp), DIMENSION(jpi,jpj,jpltrd_trc,jptra) ::  &
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::  &
       tmltrd_trc,                         &      !: \ physical contributions to the total trend (for T/S),
                                                  !: / cumulated over the current analysis window
@@ -105,5 +105,5 @@
       tmltrd_csum_ub_trc                         !: before (prev. analysis period) cumulated sum over the
                                                  !: upper triangle
-   REAL(wp), DIMENSION(jpi,jpj,jptra) ::  &
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  &
       tmltrdm_trc                                !: total cumulative trends over the analysis window
 
@@ -114,5 +114,5 @@
 #if defined key_lobster
    CHARACTER(LEN=80) :: clname_bio, ctrd_bio(jpdiabio,2)
-   REAL(wp), DIMENSION(jpi,jpj,jpdiabio) ::  &
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  &
       tmltrd_bio,                         &      !: \ biological contributions to the total trend ,
                                                  !: / cumulated over the current analysis window
@@ -129,4 +129,64 @@
 #endif
 
+#if defined key_top
+CONTAINS
+
+   FUNCTION trd_mod_trc_oce_alloc
+      !!----------------------------------------------------------------------
+      !!         *** ROUTINE trd_mod_trc_oce_alloc ***
+      !!----------------------------------------------------------------------
+      USE in_out_manager, ONLY: ctl_warn
+      !
+      INTEGER :: trd_mod_trc_oce_alloc
+      ! Locals
+      INTEGER :: ierr(2)
+      !!----------------------------------------------------------------------
+
+      ierr(:) = 0
+
+#if defined key_trdmld_trc
+      ALLOCATE(nmld_trc(jpi,jpj),          nbol_trc(jpi,jpj),           &
+               wkx_trc(jpi,jpj,jpk),       rmld_trc(jpi,jpj),           &
+               rmld_sum_trc(jpi,jpj),      rmldbn_trc(jpi,jpj),         &
+               tml_trc(jpi,jpj,jptra),     tmlb_trc(jpi,jpj,jptra),     &
+               tmlbb_trc(jpi,jpj,jptra),   tmlbn_trc(jpi,jpj,jptra),    &
+               tml_sum_trc(jpi,jpj,jptra), tml_sumb_trc(jpi,jpj,jptra), &
+               tmltrd_atf_sumb_trc(jpi,jpj,jptra),                      &
+               tmltrd_rad_sumb_trc(jpi,jpj,jptra),                      &
+               !
+               tmlatfb_trc(jpi,jpj,jptra), tmlatfn_trc(jpi,jpj,jptra),  &
+               tmlatfm_trc(jpi,jpj,jptra), tmlradb_trc(jpi,jpj,jptra),  &
+               tmlradn_trc(jpi,jpj,jptra), tmlradm_trc(jpi,jpj,jptra),  &
+               !
+               tmltrd_trc(jpi,jpj,jpltrd_trc,jptra)        , &
+               tmltrd_sum_trc(jpi,jpj,jpltrd_trc,jptra)    , &
+               tmltrd_csum_ln_trc(jpi,jpj,jpltrd_trc,jptra), &
+               tmltrd_csum_ub_trc(jpi,jpj,jpltrd_trc,jptra), &
+               !
+               tmltrdm_trc(jpi,jpj,jptra),                   &
+               Stat=ierr(1))
+#endif
+#if defined key_lobster
+      ALLOCATE(tmltrd_bio(jpi,jpj,jpdiabio),         &
+               tmltrd_sum_bio(jpi,jpj,jpdiabio),     &
+               tmltrd_csum_ln_bio(jpi,jpj,jpdiabio), &
+               tmltrd_csum_ub_bio(jpi,jpj,jpdiabio), &
+               Stat=ierr(2))
+#endif
+
+      trd_mod_trc_oce_alloc = MAXVAL(ierr)
+
+      IF(trd_mod_trc_oce_alloc /= 0)THEN
+         CALL ctl_warn('trd_mod_trc_oce_alloc : failed to allocate arrays.')
+      END IF
+
+#if defined key_trdmld_trc
+      ! Initialise what used to be a parameter - max level for mixed-layer 
+      ! trends diag.
+      jpktrd_trc = jpk
+#endif
+
+   END FUNCTION trd_mod_trc_oce_alloc
+#endif
 
 END MODULE trdmod_trc_oce
