Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 2622)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 2623)
@@ -58,4 +58,5 @@
    REAL(wp), PUBLIC                 ::   atfp1         !: asselin time filter coeff. (atfp1= 1-2*atfp)
    REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   rdttra  !: vertical profile of tracer time step
+   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   r2dtra  !: = 2*rdttra except at nit000 (=rdttra) if neuler=0
 
    !                                         !!* Namelist namcla : cross land advection
@@ -261,5 +262,5 @@
       ierr(:) = 0
 
-      ALLOCATE( rdttra(jpk), mig(jpi), mjg(jpj), STAT=ierr(1) )
+      ALLOCATE( rdttra(jpk), r2dtra(jpk), mig(jpi), mjg(jpj), STAT=ierr(1) )
 
       ALLOCATE( nimppt(jpnij) , ibonit(jpnij) , nlcit(jpnij) , nlcjt(jpnij) ,     &
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traadv.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traadv.F90	(revision 2622)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traadv.F90	(revision 2623)
@@ -32,5 +32,4 @@
    PUBLIC   tra_adv        ! routine called by step module
    PUBLIC   tra_adv_init   ! routine called by opa module
-   PUBLIC   tra_adv_alloc  ! routine called by nemogcm module
 
    !                                        !!* Namelist namtra_adv *
@@ -44,6 +43,4 @@
    INTEGER ::   nadv   ! choice of the type of advection scheme
 
-   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:) ::   r2dt   ! vertical profile time-step, = 2 rdttra except at nit000 (=rdttra) if neuler=0
-
    !! * Substitutions
 #  include "domzgr_substitute.h90"
@@ -55,20 +52,4 @@
    !!----------------------------------------------------------------------
 CONTAINS
-
-   FUNCTION tra_adv_alloc()
-      !!----------------------------------------------------------------------
-      !!                ***  ROUTINE tra_adv_alloc  ***
-      !!----------------------------------------------------------------------
-      IMPLICIT none
-      INTEGER tra_adv_alloc
-      !!----------------------------------------------------------------------
-
-      ALLOCATE( r2dt(jpk), Stat=tra_adv_alloc)
-
-      IF(tra_adv_alloc /= 0)THEN
-         CALL ctl_warn('tra_adv_alloc: failed to allocate array.')
-      END IF
-
-   END FUNCTION tra_adv_alloc
 
    SUBROUTINE tra_adv( kt )
@@ -80,6 +61,7 @@
       !! ** Method  : - Update (ua,va) with the advection term following nadv
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY: wrk_use, wrk_release
-      USE wrk_nemo, ONLY: zun => wrk_3d_1, zvn => wrk_3d_2, zwn => wrk_3d_3
+      USE wrk_nemo, ONLY:   wrk_use, wrk_release
+      USE wrk_nemo, ONLY:   zun => wrk_3d_1, zvn => wrk_3d_2, zwn => wrk_3d_3   ! 3D workspace
+      !
       INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
       !
@@ -87,13 +69,12 @@
       !!----------------------------------------------------------------------
       !
-      IF(.not. wrk_use(3,1,2,3))THEN
-         CALL ctl_stop('tra_adv: ERROR: requested workspace arrays unavailable')
-         RETURN
+      IF(.not. wrk_use(3, 1,2,3) ) THEN
+         CALL ctl_stop('tra_adv: requested workspace arrays unavailable')   ;   RETURN
       END IF
       !                                          ! set time step
       IF( neuler == 0 .AND. kt == nit000 ) THEN     ! at nit000
-         r2dt(:) =  rdttra(:)                          ! = rdtra (restarting with Euler time stepping)
+         r2dtra(:) =  rdttra(:)                          ! = rdtra (restarting with Euler time stepping)
       ELSEIF( kt <= nit000 + 1) THEN                ! at nit000 or nit000+1
-         r2dt(:) = 2. * rdttra(:)                      ! = 2 rdttra (leapfrog)
+         r2dtra(:) = 2._wp * rdttra(:)                   ! = 2 rdttra (leapfrog)
       ENDIF
       !
@@ -118,28 +99,28 @@
 
       SELECT CASE ( nadv )                            !==  compute advection trend and add it to general trend  ==!
-      CASE ( 1 )   ;    CALL tra_adv_cen2  ( kt, 'TRA',       zun, zvn, zwn, tsb, tsn, tsa, jpts )   !  2nd order centered
-      CASE ( 2 )   ;    CALL tra_adv_tvd   ( kt, 'TRA', r2dt, zun, zvn, zwn, tsb, tsn, tsa, jpts )   !  TVD 
-      CASE ( 3 )   ;    CALL tra_adv_muscl ( kt, 'TRA', r2dt, zun, zvn, zwn, tsb,      tsa, jpts )   !  MUSCL 
-      CASE ( 4 )   ;    CALL tra_adv_muscl2( kt, 'TRA', r2dt, zun, zvn, zwn, tsb, tsn, tsa, jpts )   !  MUSCL2 
-      CASE ( 5 )   ;    CALL tra_adv_ubs   ( kt, 'TRA', r2dt, zun, zvn, zwn, tsb, tsn, tsa, jpts )   !  UBS 
-      CASE ( 6 )   ;    CALL tra_adv_qck   ( kt, 'TRA', r2dt, zun, zvn, zwn, tsb, tsn, tsa, jpts )   !  QUICKEST 
+      CASE ( 1 )   ;    CALL tra_adv_cen2  ( kt, 'TRA',         zun, zvn, zwn, tsb, tsn, tsa, jpts )   !  2nd order centered
+      CASE ( 2 )   ;    CALL tra_adv_tvd   ( kt, 'TRA', r2dtra, zun, zvn, zwn, tsb, tsn, tsa, jpts )   !  TVD 
+      CASE ( 3 )   ;    CALL tra_adv_muscl ( kt, 'TRA', r2dtra, zun, zvn, zwn, tsb,      tsa, jpts )   !  MUSCL 
+      CASE ( 4 )   ;    CALL tra_adv_muscl2( kt, 'TRA', r2dtra, zun, zvn, zwn, tsb, tsn, tsa, jpts )   !  MUSCL2 
+      CASE ( 5 )   ;    CALL tra_adv_ubs   ( kt, 'TRA', r2dtra, zun, zvn, zwn, tsb, tsn, tsa, jpts )   !  UBS 
+      CASE ( 6 )   ;    CALL tra_adv_qck   ( kt, 'TRA', r2dtra, zun, zvn, zwn, tsb, tsn, tsa, jpts )   !  QUICKEST 
       !
       CASE (-1 )                                      !==  esopa: test all possibility with control print  ==!
-         CALL tra_adv_cen2  ( kt, 'TRA',       zun, zvn, zwn, tsb, tsn, tsa, jpts )          
+         CALL tra_adv_cen2  ( kt, 'TRA',         zun, zvn, zwn, tsb, tsn, tsa, jpts )          
          CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' adv0 - Ta: ', mask1=tmask,               &
             &          tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
-         CALL tra_adv_tvd   ( kt, 'TRA', r2dt, zun, zvn, zwn, tsb, tsn, tsa, jpts )          
+         CALL tra_adv_tvd   ( kt, 'TRA', r2dtra, zun, zvn, zwn, tsb, tsn, tsa, jpts )          
          CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' adv1 - Ta: ', mask1=tmask,               &
             &          tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
-         CALL tra_adv_muscl ( kt, 'TRA', r2dt, zun, zvn, zwn, tsb,      tsa, jpts )          
+         CALL tra_adv_muscl ( kt, 'TRA', r2dtra, zun, zvn, zwn, tsb,      tsa, jpts )          
          CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' adv3 - Ta: ', mask1=tmask,               &
             &          tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
-         CALL tra_adv_muscl2( kt, 'TRA', r2dt, zun, zvn, zwn, tsb, tsn, tsa, jpts )          
+         CALL tra_adv_muscl2( kt, 'TRA', r2dtra, zun, zvn, zwn, tsb, tsn, tsa, jpts )          
          CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' adv4 - Ta: ', mask1=tmask,               &
             &          tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
-         CALL tra_adv_ubs   ( kt, 'TRA', r2dt, zun, zvn, zwn, tsb, tsn, tsa, jpts )          
+         CALL tra_adv_ubs   ( kt, 'TRA', r2dtra, zun, zvn, zwn, tsb, tsn, tsa, jpts )          
          CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' adv5 - Ta: ', mask1=tmask,               &
             &          tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
-         CALL tra_adv_qck   ( kt, 'TRA', r2dt, zun, zvn, zwn, tsb, tsn, tsa, jpts )          
+         CALL tra_adv_qck   ( kt, 'TRA', r2dtra, zun, zvn, zwn, tsb, tsn, tsa, jpts )          
          CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' adv6 - Ta: ', mask1=tmask,               &
             &          tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
@@ -150,8 +131,5 @@
          &                       tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
       !
-      IF(.not. wrk_release(3,1,2,3))THEN
-         CALL ctl_stop('tra_adv: ERROR: failed to release workspace arrays')
-         RETURN
-      END IF
+      IF(.not. wrk_release(3,1,2,3) )   CALL ctl_stop('tra_adv: failed to release workspace arrays')
       !
    END SUBROUTINE tra_adv
@@ -172,6 +150,6 @@
       !!----------------------------------------------------------------------
 
-      REWIND ( numnam )               ! Read Namelist namtra_adv : tracer advection scheme
-      READ   ( numnam, namtra_adv )
+      REWIND( numnam )                ! Read Namelist namtra_adv : tracer advection scheme
+      READ  ( numnam, namtra_adv )
 
       IF(lwp) THEN                    ! Namelist print
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_cen2.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_cen2.F90	(revision 2622)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_cen2.F90	(revision 2623)
@@ -37,5 +37,4 @@
    PUBLIC   tra_adv_cen2       ! routine called by step.F90
    PUBLIC   ups_orca_set       ! routine used by traadv_cen2_jki.F90
-   PUBLIC   tra_adv_cen2_alloc ! routine called by nemogcm.F90
 
    LOGICAL  :: l_trd       ! flag to compute trends
@@ -52,20 +51,4 @@
    !!----------------------------------------------------------------------
 CONTAINS
-
-   FUNCTION tra_adv_cen2_alloc()
-      !!----------------------------------------------------------------------
-      !!               ***  ROUTINE tra_adv_cen2_alloc  ***
-      !!----------------------------------------------------------------------
-      IMPLICIT none
-      INTEGER :: tra_adv_cen2_alloc
-      !!----------------------------------------------------------------------
-
-      ALLOCATE(upsmsk(jpi,jpj), Stat=tra_adv_cen2_alloc)
-
-      IF(tra_adv_cen2_alloc > 0)THEN
-         CALL ctl_warn('tra_adv_cen2_alloc: failed to allocate array.')
-      END IF
-
-   END FUNCTION tra_adv_cen2_alloc
 
    SUBROUTINE tra_adv_cen2( kt, cdtype, pun, pvn, pwn,        &
@@ -140,17 +123,17 @@
       !!
       INTEGER  ::   ji, jj, jk, jn                   ! dummy loop indices
-      REAL(wp) ::   zbtr, ztra                       ! temporary scalars
-      REAL(wp) ::   zfp_ui, zfp_vj, zfp_w            !    -         -
-      REAL(wp) ::   zfm_ui, zfm_vj, zfm_w            !    -         -
-      REAL(wp) ::   zcofi , zcofj , zcofk            !    -         -
-      REAL(wp) ::   zupsut, zcenut                   !    -         -
-      REAL(wp) ::   zupsvt, zcenvt                   !    -         -
-      REAL(wp) ::   zupst , zcent                    !    -         -
-      REAL(wp) ::   zice                             !    -         -
-      !!----------------------------------------------------------------------
-
-      IF( (.not. wrk_use(2, 1)) .OR. (.not. wrk_use(3, 1,2)))THEN
-         CALL ctl_stop('tra_adv_cen2: ERROR: requested workspace arrays unavailable')
-         RETURN
+      INTEGER  ::   ierr                             ! local integer
+      REAL(wp) ::   zbtr, ztra                       ! local scalars
+      REAL(wp) ::   zfp_ui, zfp_vj, zfp_w            !   -      -
+      REAL(wp) ::   zfm_ui, zfm_vj, zfm_w            !   -      -
+      REAL(wp) ::   zcofi , zcofj , zcofk            !   -      -
+      REAL(wp) ::   zupsut, zcenut                   !   -      -
+      REAL(wp) ::   zupsvt, zcenvt                   !   -      -
+      REAL(wp) ::   zupst , zcent                    !   -      -
+      REAL(wp) ::   zice                             !   -      -
+      !!----------------------------------------------------------------------
+
+      IF( .not. wrk_use(2, 1) .OR. .not. wrk_use(3, 1,2) ) THEN
+         CALL ctl_stop('tra_adv_cen2: ERROR: requested workspace arrays unavailable')   ;   RETURN
       END IF
 
@@ -161,5 +144,8 @@
          IF(lwp) WRITE(numout,*)
          !
-         upsmsk(:,:) = 0.e0                              ! not upstream by default
+         ALLOCATE( upsmsk(jpi,jpj), STAT=ierr )
+         IF( ierr /= 0 )   CALL ctl_stop('STOP', 'tra_adv_cen2: unable to allocate array')
+         !
+         upsmsk(:,:) = 0._wp                             ! not upstream by default
          ! 
          IF( cp_cfg == "orca" )   CALL ups_orca_set      ! set mixed Upstream/centered scheme near some straits
@@ -173,5 +159,5 @@
          !
          l_trd = .FALSE.
-         IF( ( cdtype == 'TRA' .AND. l_trdtra ) .OR. ( cdtype == 'TRC' .AND. l_trdtrc ) ) l_trd = .TRUE.
+         IF( ( cdtype == 'TRA' .AND. l_trdtra ) .OR. ( cdtype == 'TRC' .AND. l_trdtrc ) )   l_trd = .TRUE.
       ENDIF
       !
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/trabbl.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/trabbl.F90	(revision 2622)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/trabbl.F90	(revision 2623)
@@ -17,4 +17,5 @@
    !!   'key_trabbl'   or                             bottom boundary layer
    !!----------------------------------------------------------------------
+   !!   tra_bbl_alloc : allocate trabbl arrays
    !!   tra_bbl       : update the tracer trends due to the bottom boundary layer (advective and/or diffusive)
    !!   tra_bbl_dif   : generic routine to compute bbl diffusive trend
@@ -42,5 +43,4 @@
    PUBLIC   tra_bbl_adv   !  -          -          -              -
    PUBLIC   bbl           !  routine called by trcbbl.F90 and dtadyn.F90
-   PUBLIC   tra_bbl_alloc !  routine called by nemogcm.F90
 
    LOGICAL, PUBLIC, PARAMETER ::   lk_trabbl = .TRUE.    !: bottom boundary layer flag
@@ -54,6 +54,8 @@
    REAL(wp), PUBLIC ::   rn_gambbl  = 10.0_wp   !: lateral coeff. for bottom boundary layer scheme [s]
 
+   LOGICAL , PUBLIC ::   l_bbl                  !: flag to compute bbl diffu. flux coef and transport
+   
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), PUBLIC ::   utr_bbl  , vtr_bbl   ! u- (v-) transport in the bottom boundary layer
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), PUBLIC ::   ahu_bbl  , ahv_bbl   ! masked diffusive bbl coefficients at u and v-points
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), PUBLIC ::   ahu_bbl  , ahv_bbl   ! masked diffusive bbl coeff. at u & v-pts
 
    INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:) ::   mbku_d   , mbkv_d      ! vertical index of the "lower" bottom ocean U/V-level
@@ -61,6 +63,5 @@
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   ahu_bbl_0, ahv_bbl_0   ! diffusive bbl flux coefficients at u and v-points
    REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   e3u_bbl_0, e3v_bbl_0   ! thichness of the bbl (e3) at u and v-points
-   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   e1e2t_r   ! thichness of the bbl (e3) at u and v-points
-   LOGICAL, PUBLIC              ::   l_bbl                    !: flag to compute bbl diffu. flux coef and transport
+   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   r1_e1e2t               ! inverse of the cell surface at t-point      [1/m2]
 
    !! * Substitutions
@@ -74,22 +75,17 @@
 CONTAINS
 
-   FUNCTION tra_bbl_alloc()
-      IMPLICIT none
-      INTEGER :: tra_bbl_alloc
-
-      ALLOCATE(utr_bbl(jpi,jpj),   vtr_bbl(jpi,jpj),   &
-               ahu_bbl(jpi,jpj),   ahv_bbl(jpi,jpj),   &
-               mbku_d(jpi,jpj),    mbkv_d(jpi,jpj),    &
-               mgrhu(jpi,jpj),     mgrhv(jpi,jpj),     &
-               ahu_bbl_0(jpi,jpj), ahv_bbl_0(jpi,jpj), &
-               e3u_bbl_0(jpi,jpj), e3v_bbl_0(jpi,jpj), &
-               e1e2t_r(jpi,jpj),                       &
-               Stat=tra_bbl_alloc)
-
-      IF(tra_bbl_alloc > 0)THEN
-         CALL ctl_warn('tra_bbl_alloc: allocation of arrays failed.')
-      END IF
-
+   INTEGER FUNCTION tra_bbl_alloc()
+      !!----------------------------------------------------------------------
+      !!                ***  FUNCTION tra_bbl_alloc  ***
+      !!----------------------------------------------------------------------
+      ALLOCATE( utr_bbl  (jpi,jpj) , ahu_bbl  (jpi,jpj) , mbku_d  (jpi,jpj) , mgrhu(jpi,jpj) ,     &
+         &      vtr_bbl  (jpi,jpj) , ahv_bbl  (jpi,jpj) , mbkv_d  (jpi,jpj) , mgrhv(jpi,jpj) ,     &
+         &      ahu_bbl_0(jpi,jpj) , ahv_bbl_0(jpi,jpj) ,                                          &
+         &      e3u_bbl_0(jpi,jpj) , e3v_bbl_0(jpi,jpj) , r1_e1e2t(jpi,jpj)                  , STAT=tra_bbl_alloc)
+         !
+      IF( lk_mpp            )   CALL mpp_sum ( tra_bbl_alloc )
+      IF( tra_bbl_alloc > 0 )   CALL ctl_warn('tra_bbl_alloc: allocation of arrays failed.')
    END FUNCTION tra_bbl_alloc
+
 
    SUBROUTINE tra_bbl( kt )
@@ -173,11 +169,11 @@
       !!              Campin, J.-M., and H. Goosse, 1999, Tellus, 412-430.
       !!----------------------------------------------------------------------  
-      USE wrk_nemo, ONLY: wrk_use, wrk_release
-      USE wrk_nemo, ONLY: zptb => wrk_2d_1
-      !!
+      USE wrk_nemo, ONLY:   wrk_use, wrk_release
+      USE wrk_nemo, ONLY:   zptb => wrk_2d_1
+      !
       INTEGER                              , INTENT(in   ) ::   kjpt    ! number of tracers
       REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(in   ) ::   ptb   ! before and now tracer fields
       REAL(wp), DIMENSION(jpi,jpj,jpk,kjpt), INTENT(inout) ::   pta   ! tracer trend 
-      !!
+      !
       INTEGER  ::   ji, jj, jn   ! dummy loop indices
       INTEGER  ::   ik           ! local integers
@@ -185,8 +181,7 @@
       !!----------------------------------------------------------------------
       !
-      IF(.not. wrk_use(2,1))THEN
-         CALL ctl_stop('tra_bbl_dif: ERROR: requested workspace array unavailable')
-         RETURN
-      END IF
+      IF(.not. wrk_use(2,1) ) THEN
+         CALL ctl_stop('tra_bbl_dif: ERROR: requested workspace array unavailable')   ;   RETURN
+      ENDIF
       !
       DO jn = 1, kjpt                                     ! tracer loop
@@ -212,5 +207,5 @@
 #  endif
                ik = mbkt(ji,jj)                            ! bottom T-level index
-               zbtr = e1e2t_r(ji,jj)  / fse3t(ji,jj,ik)
+               zbtr = r1_e1e2t(ji,jj)  / fse3t(ji,jj,ik)
                pta(ji,jj,ik,jn) = pta(ji,jj,ik,jn)                                                         &
                   &               + (   ahu_bbl(ji  ,jj  ) * ( zptb(ji+1,jj  ) - zptb(ji  ,jj  ) )   &
@@ -223,7 +218,5 @@
       END DO                                                ! end tracer
       !                                                     ! ===========
-      IF(.not. wrk_release(2,1))THEN
-         CALL ctl_stop('tra_bbl_dif: ERROR: failed to release workspace array')
-      END IF
+      IF(.not. wrk_release(2,1) )   CALL ctl_stop('tra_bbl_dif: failed to release workspace array')
       !
    END SUBROUTINE tra_bbl_dif
@@ -273,15 +266,15 @@
                   !
                   !                                               ! up  -slope T-point (shelf bottom point)
-                  zbtr = e1e2t_r(iis,jj) / fse3t(iis,jj,ikus)
+                  zbtr = r1_e1e2t(iis,jj) / fse3t(iis,jj,ikus)
                   ztra = zu_bbl * ( ptb(iid,jj,ikus,jn) - ptb(iis,jj,ikus,jn) ) * zbtr
                   pta(iis,jj,ikus,jn) = pta(iis,jj,ikus,jn) + ztra
                   !                   
                   DO jk = ikus, ikud-1                            ! down-slope upper to down T-point (deep column)
-                     zbtr = e1e2t_r(iid,jj) / fse3t(iid,jj,jk)
+                     zbtr = r1_e1e2t(iid,jj) / fse3t(iid,jj,jk)
                      ztra = zu_bbl * ( ptb(iid,jj,jk+1,jn) - ptb(iid,jj,jk,jn) ) * zbtr
                      pta(iid,jj,jk,jn) = pta(iid,jj,jk,jn) + ztra
                   END DO
                   ! 
-                  zbtr = e1e2t_r(iid,jj) / fse3t(iid,jj,ikud)
+                  zbtr = r1_e1e2t(iid,jj) / fse3t(iid,jj,ikud)
                   ztra = zu_bbl * ( ptb(iis,jj,ikus,jn) - ptb(iid,jj,ikud,jn) ) * zbtr
                   pta(iid,jj,ikud,jn) = pta(iid,jj,ikud,jn) + ztra
@@ -295,15 +288,15 @@
                   ! 
                   ! up  -slope T-point (shelf bottom point)
-                  zbtr = e1e2t_r(ji,ijs) / fse3t(ji,ijs,ikvs)
+                  zbtr = r1_e1e2t(ji,ijs) / fse3t(ji,ijs,ikvs)
                   ztra = zv_bbl * ( ptb(ji,ijd,ikvs,jn) - ptb(ji,ijs,ikvs,jn) ) * zbtr
                   pta(ji,ijs,ikvs,jn) = pta(ji,ijs,ikvs,jn) + ztra
                   !                   
                   DO jk = ikvs, ikvd-1                            ! down-slope upper to down T-point (deep column)
-                     zbtr = e1e2t_r(ji,ijd) / fse3t(ji,ijd,jk)
+                     zbtr = r1_e1e2t(ji,ijd) / fse3t(ji,ijd,jk)
                      ztra = zv_bbl * ( ptb(ji,ijd,jk+1,jn) - ptb(ji,ijd,jk,jn) ) * zbtr
                      pta(ji,ijd,jk,jn) = pta(ji,ijd,jk,jn)  + ztra
                   END DO
                   !                                               ! down-slope T-point (deep bottom point)
-                  zbtr = e1e2t_r(ji,ijd) / fse3t(ji,ijd,ikvd)
+                  zbtr = r1_e1e2t(ji,ijd) / fse3t(ji,ijd,ikvd)
                   ztra = zv_bbl * ( ptb(ji,ijs,ikvs,jn) - ptb(ji,ijd,ikvd,jn) ) * zbtr
                   pta(ji,ijd,ikvd,jn) = pta(ji,ijd,ikvd,jn) + ztra
@@ -345,7 +338,8 @@
       !!              Campin, J.-M., and H. Goosse, 1999, Tellus, 412-430.
       !!----------------------------------------------------------------------  
-      USE wrk_nemo, ONLY: wrk_use, wrk_release
-      USE wrk_nemo, ONLY: zub => wrk_2d_1, zvb => wrk_2d_2, ztb => wrk_2d_3, &
-                          zsb => wrk_2d_4, zdep => wrk_2d_5
+      USE wrk_nemo, ONLY:   wrk_use, wrk_release
+      USE wrk_nemo, ONLY:   zub => wrk_2d_1 , ztb => wrk_2d_2                      ! 2D workspace
+      USE wrk_nemo, ONLY:   zvb => wrk_2d_3 , zsb => wrk_2d_4 , zdep => wrk_2d_5
+      !
       INTEGER         , INTENT(in   ) ::   kt       ! ocean time-step index
       CHARACTER(len=3), INTENT(in   ) ::   cdtype   ! =TRA or TRC (tracer indicator)
@@ -391,8 +385,7 @@
       !!----------------------------------------------------------------------
 
-      IF(.not. wrk_use(2, 1,2,3,4,5))THEN
-         CALL ctl_stop('bbl: ERROR: requested workspace arrays unavailable')
-         RETURN
-      END IF
+      IF(.not. wrk_use(2, 1,2,3,4,5) ) THEN
+         CALL ctl_stop('bbl: requested workspace arrays unavailable')   ;   RETURN
+      ENDIF
      
       IF( kt == nit000 )  THEN
@@ -532,7 +525,5 @@
       ENDIF
       !
-      IF(.not. wrk_release(2, 1,2,3,4,5))THEN
-         CALL ctl_stop('bbl: ERROR: failed to release workspace arrays')
-      END IF
+      IF(.not. wrk_release(2, 1,2,3,4,5) )   CALL ctl_stop('bbl: failed to release workspace arrays')
       !
    END SUBROUTINE bbl
@@ -546,8 +537,8 @@
       !!
       !! ** Method  :   Read the nambbl namelist and check the parameters
-      !!              called by tra_bbl at the first timestep (nit000)
-      !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY: wrk_use, wrk_release
-      USE wrk_nemo, ONLY: zmbk => wrk_2d_1
+      !!              called by nemo_init at the first timestep (nit000)
+      !!----------------------------------------------------------------------
+      USE wrk_nemo, ONLY:   wrk_use, wrk_release
+      USE wrk_nemo, ONLY:   zmbk => wrk_2d_1       ! 2D workspace
       INTEGER ::   ji, jj               ! dummy loop indices
       INTEGER ::   ii0, ii1, ij0, ij1   ! temporary integer
@@ -556,8 +547,7 @@
       !!----------------------------------------------------------------------
 
-      IF(.not. wrk_use(2,1))THEN
-         CALL ctl_stop('tra_bbl_init: ERROR: requested workspace array unavailable')
-         RETURN
-      END IF
+      IF(.not. wrk_use(2,1) ) THEN
+         CALL ctl_stop('tra_bbl_init: requested workspace array unavailable')   ;   RETURN
+      ENDIF
 
       REWIND ( numnam )              !* Read Namelist nambbl : bottom boundary layer scheme
@@ -576,5 +566,8 @@
          WRITE(numout,*) '          advective bbl coefficient           rn_gambbl  = ', rn_gambbl, ' s'
       ENDIF
-      
+
+      !                              ! allocate trabbl arrays
+      IF( tra_bbl_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'tra_bbl_init : unable to allocate arrays' )
+     
       IF( nn_bbl_adv == 1 )    WRITE(numout,*) '       * Advective BBL using upper velocity'
       IF( nn_bbl_adv == 2 )    WRITE(numout,*) '       * Advective BBL using velocity = F( delta rho)'
@@ -584,5 +577,5 @@
 
       !                             !* inverse of surface of T-cells
-      e1e2t_r(:,:) = 1.0 / ( e1t(:,:) * e2t(:,:) )
+      r1_e1e2t(:,:) = 1._wp / ( e1t(:,:) * e2t(:,:) )
       
       !                             !* vertical index of  "deep" bottom u- and v-points
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/tradmp.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/tradmp.F90	(revision 2622)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/tradmp.F90	(revision 2623)
@@ -19,4 +19,5 @@
    !!   'key_tradmp'                                       internal damping
    !!----------------------------------------------------------------------
+   !!   tra_dmp_alloc : allocate tradmp arrays
    !!   tra_dmp       : update the tracer trend with the internal damping
    !!   tra_dmp_init  : initialization, namlist read, parameters control
@@ -45,5 +46,4 @@
    PUBLIC   dtacof       ! routine called by in both tradmp.F90 and trcdmp.F90
    PUBLIC   dtacof_zoom  ! routine called by in both tradmp.F90 and trcdmp.F90
-   PUBLIC   tra_dmp_alloc ! routine called by nemogcm.F90
 
 #if ! defined key_agrif
@@ -74,16 +74,14 @@
 CONTAINS
 
-   FUNCTION tra_dmp_alloc()
-      IMPLICIT none
-      INTEGER :: tra_dmp_alloc
-
-      ALLOCATE(strdmp(jpi,jpj,jpk), ttrdmp(jpi,jpj,jpk), &
-               resto(jpi,jpj,jpk), Stat=tra_dmp_alloc)
-
-      IF(tra_dmp_alloc /= 0)THEN
-         CALL ctl_warn('tra_dmp_alloc: allocation of arrays failed.')
-      END IF
-
+   INTEGER FUNCTION tra_dmp_alloc()
+      !!----------------------------------------------------------------------
+      !!                ***  FUNCTION tra_bbl_alloc  ***
+      !!----------------------------------------------------------------------
+      ALLOCATE( strdmp(jpi,jpj,jpk) , ttrdmp(jpi,jpj,jpk) , resto(jpi,jpj,jpk), STAT=tra_dmp_alloc )
+      !
+      IF( lk_mpp            )   CALL mpp_sum ( tra_dmp_alloc )
+      IF( tra_dmp_alloc > 0 )   CALL ctl_warn('tra_dmp_alloc: allocation of arrays failed.')
    END FUNCTION tra_dmp_alloc
+
 
    SUBROUTINE tra_dmp( kt )
@@ -207,4 +205,7 @@
       ENDIF
 
+      !                              ! allocate tradmp arrays
+      IF( tra_dmp_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'tra_dmp_init : unable to allocate arrays' )
+
       SELECT CASE ( nn_hdmp )
       CASE (  -1  )   ;   IF(lwp) WRITE(numout,*) '   tracer damping in the Med & Red seas only'
@@ -326,7 +327,6 @@
       USE iom
       USE ioipsl
-      USE wrk_nemo, ONLY: wrk_use, wrk_release
-      USE wrk_nemo, ONLY: zhfac => wrk_1d_1, zmrs => wrk_2d_1
-      USE wrk_nemo, ONLY: zdct => wrk_3d_1
+      USE wrk_nemo, ONLY:   wrk_use, wrk_release
+      USE wrk_nemo, ONLY:   zhfac => wrk_1d_1, zmrs => wrk_2d_1 , zdct  => wrk_3d_1   ! 1D, 2D, 3D workspace
       !!
       INTEGER                         , INTENT(in   )  ::  kn_hdmp    ! damping option
@@ -347,9 +347,8 @@
       !!----------------------------------------------------------------------
 
-      IF( (.not. wrk_use(1,1)) .OR. (.not. wrk_use(2,1)) .OR. &
-          (.not. wrk_use(3,1)))THEN
-         CALL ctl_stop('dtacof: ERROR: requested workspace arrays unavailable')
-         RETURN
-      END IF
+      IF( .not. wrk_use(1, 1) .OR. .not. wrk_use(2, 1)  .OR.   &
+          .not. wrk_use(3, 1)   )THEN
+         CALL ctl_stop('dtacof: requested workspace arrays unavailable')   ;   RETURN
+      ENDIF
       !                                   ! ====================
       !                                   !  ORCA configuration : global domain
@@ -544,8 +543,6 @@
       ENDIF
       !
-      IF( (.not. wrk_release(1,1)) .OR. (.not. wrk_release(2,1)) .OR. &
-          (.not. wrk_release(3,1)) )THEN
-         CALL ctl_stop('dtacof: ERROR: failed to release workspace arrays')
-      END IF
+      IF( .not. wrk_release(1, 1) .OR. .not. wrk_release(2, 1) .OR. &
+          .not. wrk_release(3, 1) )   CALL ctl_stop('dtacof: failed to release workspace arrays')
       !
    END SUBROUTINE dtacof
@@ -573,11 +570,8 @@
       !!----------------------------------------------------------------------
       USE ioipsl      ! IOipsl librairy
-      USE wrk_nemo, ONLY: wrk_use, wrk_release, llwrk_use, llwrk_release
-      USE wrk_nemo, ONLY: zxc => wrk_1d_1, zyc => wrk_1d_2, &
-                          zzc => wrk_1d_3, zdis => wrk_1d_4
-      USE wrk_nemo, ONLY: llcotu => llwrk_2d_1, llcotv => llwrk_2d_2, &
-                          llcotf => llwrk_2d_3
-      USE wrk_nemo, ONLY: zxt => wrk_2d_1, zyt => wrk_2d_2, &
-                          zzt => wrk_2d_3, zmask => wrk_2d_4
+      USE wrk_nemo, ONLY:   wrk_use, wrk_release, llwrk_use, llwrk_release
+      USE wrk_nemo, ONLY:   zxc => wrk_1d_1, zyc  => wrk_1d_2, zzc => wrk_1d_3, zdis => wrk_1d_4
+      USE wrk_nemo, ONLY:   llcotu => llwrk_2d_1, llcotv => llwrk_2d_2 , llcotf => llwrk_2d_3
+      USE wrk_nemo, ONLY:   zxt => wrk_2d_1 , zyt => wrk_2d_2 , zzt => wrk_2d_3, zmask => wrk_2d_4
       !!
       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT( out ) ::   pdct   ! distance to the coastline
@@ -592,8 +586,7 @@
       !!----------------------------------------------------------------------
 
-      IF( (.not. llwrk_use(2,1,2,3)) .OR. (.not. wrk_use(2, 1,2,3,4)) .OR. &
-          (.not. wrk_use(1, 1,2,3,4)) )THEN
-         CALL ctl_stop('cofdis: ERROR: requested workspace arrays unavailable')
-         RETURN
+      IF( .not. llwrk_use(2, 1,2,3)  .OR. .not. wrk_use(2, 1,2,3,4)  .OR.   &
+          .not.   wrk_use(1, 1,2,3,4)  )THEN
+         CALL ctl_stop('cofdis: ERROR: requested workspace arrays unavailable')   ;   RETURN
       END IF
 
@@ -748,9 +741,7 @@
       CALL restclo( icot )
       !
-      IF( (.not. llwrk_release(2, 1,2,3)) .OR. &
-          (.not. wrk_release(2, 1,2,3,4)) .OR. & 
-          (.not. wrk_release(1, 1,2,3,4)) )THEN
-         CALL ctl_stop('cofdis: ERROR: failed to release workspace arrays')
-      END IF
+      IF( .not. llwrk_release(2, 1,2,3)   .OR. &
+          .not.   wrk_release(2, 1,2,3,4) .OR. & 
+          .not.   wrk_release(1, 1,2,3,4)  )   CALL ctl_stop('cofdis: failed to release workspace arrays')
       !
    END SUBROUTINE cofdis
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90	(revision 2622)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traldf.F90	(revision 2623)
@@ -35,10 +35,9 @@
    PUBLIC   tra_ldf         ! called by step.F90 
    PUBLIC   tra_ldf_init    ! called by opa.F90 
-   PUBLIC   tra_ldf_alloc   ! called by nemogcm.F90
    !
    INTEGER ::   nldf = 0   ! type of lateral diffusion used defined from ln_traldf_... namlist logicals)
-#if defined key_traldf_ano
-   REAL, SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::   t0_ldf, s0_ldf   ! lateral diffusion trends of T & S for a constant profile
-#endif
+
+   REAL, SAVE, ALLOCATABLE, DIMENSION(:,:,:) ::   t0_ldf, s0_ldf   !: lateral diffusion trends of T & S for a cst profile
+   !                                                               !  (key_traldf_ano only)
 
    !! * Substitutions
@@ -51,20 +50,4 @@
    !!----------------------------------------------------------------------
 CONTAINS
-
-   FUNCTION tra_ldf_alloc()
-      IMPLICIT none
-      INTEGER :: tra_ldf_alloc
-
-      tra_ldf_alloc = 0
-
-#if defined key_traldf_ano
-      ALLOCATE(t0_ldf(jpi,jpj,jpk), s0_ldf(jpi,jpj,jpk), Stat=tra_ldf_alloc)
-#endif
-
-      IF(tra_ldf_alloc /= 0)THEN
-         CALL ctl_warn('tra_ldf_alloc: failed to allocate arrays t0_ldf and s0_ldf.')
-      END IF
-
-   END FUNCTION tra_ldf_alloc
 
    SUBROUTINE tra_ldf( kt )
@@ -147,5 +130,4 @@
       !!----------------------------------------------------------------------
       INTEGER ::   ioptio, ierr         ! temporary integers 
-!      
       !!----------------------------------------------------------------------
 
@@ -256,6 +238,6 @@
       !!----------------------------------------------------------------------
       USE wrk_nemo, ONLY: wrk_use, wrk_release
-      USE wrk_nemo, ONLY: zt_ref => wrk_3d_1, ztb => wrk_3d_2, zavt => wrk_3d_3 
-      USE wrk_nemo, ONLY: zs_ref => wrk_3d_4, zsb => wrk_3d_5 ! 3D workspaces
+      USE wrk_nemo, ONLY: zt_ref => wrk_3d_1, ztb => wrk_3d_2, zavt => wrk_3d_3   ! 3D workspaces
+      USE wrk_nemo, ONLY: zs_ref => wrk_3d_4, zsb => wrk_3d_5                     ! 3D workspaces
       !! 
       USE zdf_oce         ! vertical mixing
@@ -264,12 +246,12 @@
       !!
       INTEGER  ::   jk              ! Dummy loop indice
+      INTEGER  ::   ierr            ! local integer
       LOGICAL  ::   llsave          !
-      REAL(wp) ::   zt0, zs0, z12   ! temporary scalar
-      !!----------------------------------------------------------------------
-
-      IF(.NOT. wrk_use(3, 1,2,3,4,5))THEN
-         CALL ctl_stop('ldf_ano : requested workspace arrays unavailable.')
-         RETURN
-      END IF
+      REAL(wp) ::   zt0, zs0, z12   ! local scalar
+      !!----------------------------------------------------------------------
+
+      IF(.NOT. wrk_use(3, 1,2,3,4,5) ) THEN
+         CALL ctl_stop('ldf_ano : requested workspace arrays unavailable')   ;   RETURN
+      ENDIF
 
       IF(lwp) THEN
@@ -278,4 +260,9 @@
          WRITE(numout,*) '~~~~~~~~~~~'
       ENDIF
+
+      !                              ! allocate trabbl arrays
+      ALLOCATE( t0_ldf(jpi,jpj,jpk) , s0_ldf(jpi,jpj,jpk) , STAT=ierr )
+      IF( lk_mpp    )   CALL ctl_warn( ierr )
+      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'ldf_ano : unable to allocate arrays' )
 
       ! defined the T & S reference profiles
@@ -333,7 +320,5 @@
       avt(:,:,:)        = zavt(:,:,:)
       !
-      IF(.NOT. wrk_release(3, 1,2,3,4,5))THEN
-         CALL ctl_stop('ldf_ano : failed to release workspace arrays.')
-      END IF
+      IF(.NOT. wrk_release(3, 1,2,3,4,5) )   CALL ctl_stop('ldf_ano : failed to release workspace arrays')
       !
    END SUBROUTINE ldf_ano
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_iso_grif.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_iso_grif.F90	(revision 2622)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_iso_grif.F90	(revision 2623)
@@ -16,4 +16,5 @@
    USE oce             ! ocean dynamics and active tracers
    USE dom_oce         ! ocean space and time domain
+   USE phycst          ! physical constants
    USE trc_oce         ! share passive tracers/Ocean variables
    USE zdf_oce         ! ocean vertical physics
@@ -23,19 +24,14 @@
    USE in_out_manager  ! I/O manager
    USE iom             ! I/O library
-#if defined key_diaar5
-   USE phycst          ! physical constants
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
-#endif
 
    IMPLICIT NONE
    PRIVATE
 
-   PUBLIC tra_ldf_iso_grif       ! routine called by traldf.F90
-   PUBLIC tra_ldf_iso_grif_alloc ! routine called by nemogcm.F90
-
-   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE       ::   psix_eiv
-   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE       ::   psiy_eiv
-   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE       ::   ah_wslp2
-   REAL(wp),         DIMENSION(:,:,:), ALLOCATABLE, SAVE ::   zdkt  ! 2D+1 workspace
+   PUBLIC   tra_ldf_iso_grif   ! routine called by traldf.F90
+
+   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE, SAVE ::   psix_eiv, psiy_eiv   !: eiv stream function (diag only)
+   REAL(wp), PUBLIC, DIMENSION(:,:,:), ALLOCATABLE, SAVE ::   ah_wslp2             !: aeiv*w-slope^2
+   REAL(wp),         DIMENSION(:,:,:), ALLOCATABLE, SAVE ::   zdkt                 !  atypic workspace
 
    !! * Substitutions
@@ -50,18 +46,4 @@
    !!----------------------------------------------------------------------
 CONTAINS
-
-  FUNCTION tra_ldf_iso_grif_alloc()
-      !!----------------------------------------------------------------------
-      !!                ***  ROUTINE tra_ldf_iso_grif_alloc  ***
-      !!----------------------------------------------------------------------
-      INTEGER :: tra_ldf_iso_grif_alloc
-      !!----------------------------------------------------------------------
-      !
-      ALLOCATE(zdkt(jpi,jpj,0:1), Stat=tra_ldf_iso_grif_alloc)
-      !
-      IF( tra_ldf_iso_grif_alloc /= 0 )   CALL ctl_warn('tra_ldf_iso_grif_alloc : allocation of arrays failed.')
-      !
-  END FUNCTION tra_ldf_iso_grif_alloc
-
 
   SUBROUTINE tra_ldf_iso_grif( kt, cdtype, pgu, pgv,              &
@@ -106,10 +88,8 @@
       !! ** Action :   Update pta arrays with the before rotated diffusion
       !!----------------------------------------------------------------------
-      USE oce,   zftu => ua   ! use ua as workspace
-      USE oce,   zftv => va   ! use va as workspace
-      USE wrk_nemo, ONLY: wrk_use, wrk_release
-      USE wrk_nemo, ONLY: zdit => wrk_3d_1, zdjt => wrk_3d_2, ztfw => wrk_3d_3
-      !USE wrk_nemo, ONLY: wrk_3d_4 ! For 2D+1 workspace
-      USE wrk_nemo, ONLY: z2d => wrk_2d_1 ! Only used if key_diaar5 defined
+      USE wrk_nemo, ONLY:   wrk_use, wrk_release
+      USE oce     , ONLY:   zftu => ua       , zftv => va            ! (ua,va) used as 3D workspace
+      USE wrk_nemo, ONLY:   zdit => wrk_3d_1 , zdjt => wrk_3d_2 , ztfw => wrk_3d_3   ! 3D workspace
+      USE wrk_nemo, ONLY:   z2d  => wrk_2d_1                                          ! 2D workspace
       !!
       INTEGER                              , INTENT(in   ) ::   kt         ! ocean time-step index
@@ -137,9 +117,7 @@
       !!----------------------------------------------------------------------
 
-      ! Check that workspace arrays are free for use
-      IF( (.NOT. wrk_use(3, 1,2,3)) .OR. (.NOT. wrk_use(2, 1)))THEN
-         CALL ctl_stop('tra_ldf_iso_grif : requested workspace arrays unavailable.')
-         RETURN
-      END IF
+      IF( .NOT. wrk_use(3, 1,2,3) .OR. .NOT. wrk_use(2, 1) ) THEN
+         CALL ctl_stop('tra_ldf_iso_grif : requested workspace arrays unavailable.')   ;   RETURN
+      ENDIF
       ! ARP - line below uses 'bounds re-mapping' which is only defined in
       ! Fortran 2003 and up. We would be OK if code was written to use
@@ -153,13 +131,11 @@
          IF(lwp) WRITE(numout,*) '                   WARNING: STILL UNDER TEST, NOT RECOMMENDED. USE AT YOUR OWN PERIL'
          IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
-         ALLOCATE( ah_wslp2(jpi,jpj,jpk) , STAT=ierr )
-         IF( ierr > 0 ) THEN
-            CALL ctl_stop( 'tra_ldf_iso_grif : unable to allocate Griffies operator ah_wslp2 ' )   ;   RETURN
-         ENDIF
+         ALLOCATE( ah_wslp2(jpi,jpj,jpk) , zdkt(jpi,jpj,0:1), STAT=ierr )
+         IF( lk_mpp   )   CALL mpp_sum ( ierr )
+         IF( ierr > 0 )   CALL ctl_stop('STOP', 'tra_ldf_iso_grif: unable to allocate arrays')
          IF( ln_traldf_gdia ) THEN
             ALLOCATE( psix_eiv(jpi,jpj,jpk) , psiy_eiv(jpi,jpj,jpk) , STAT=ierr )
-            IF( ierr > 0 ) THEN
-               CALL ctl_stop( 'tra_ldf_iso_grif : unable to allocate Griffies operator diagnostics ' )   ;   RETURN
-            ENDIF
+            IF( lk_mpp   )   CALL mpp_sum ( ierr )
+            IF( ierr > 0 )   CALL ctl_stop('STOP', 'tra_ldf_iso_grif: unable to allocate diagnostics')
          ENDIF
       ENDIF
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_lap.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_lap.F90	(revision 2622)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_lap.F90	(revision 2623)
@@ -28,6 +28,5 @@
    PRIVATE
 
-   PUBLIC   tra_ldf_lap       ! routine called by step.F90
-   PUBLIC   tra_ldf_lap_alloc ! routine called by nemogcm.F90
+   PUBLIC   tra_ldf_lap   ! routine called by step.F90
 
    REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:,:) ::   e1ur, e2vr   ! scale factor coefficients
@@ -43,20 +42,4 @@
    !!----------------------------------------------------------------------
 CONTAINS
-
-   FUNCTION tra_ldf_lap_alloc()
-      !!----------------------------------------------------------------------
-      !!                ***  ROUTINE tra_ldf_lap_alloc  ***
-      !!----------------------------------------------------------------------
-      IMPLICIT none
-      INTEGER :: tra_ldf_lap_alloc
-      !!----------------------------------------------------------------------
-
-      ALLOCATE(e1ur(jpi,jpj), e2vr(jpi,jpj), Stat=tra_ldf_lap_alloc)
-
-      IF( tra_ldf_lap_alloc /= 0)THEN
-         CALL ctl_warn('tra_ldf_lap_alloc: failed to allocate e1ur and e2vr arrays.')
-      END IF
-
-   END FUNCTION tra_ldf_lap_alloc
 
    SUBROUTINE tra_ldf_lap( kt, cdtype, pgu, pgv,      &
@@ -79,6 +62,6 @@
       !!                harmonic mixing trend.
       !!----------------------------------------------------------------------
-      USE oce         , ztu => ua   ! use ua as workspace
-      USE oce         , ztv => va   ! use va as workspace
+      USE oce ,   ztu => ua   ! use ua as workspace
+      USE oce ,   ztv => va   ! use va as workspace
       !!
       INTEGER                              , INTENT(in   ) ::   kt         ! ocean time-step index
@@ -90,5 +73,5 @@
       !!
       INTEGER  ::   ji, jj, jk, jn       ! dummy loop indices
-      INTEGER  ::   iku, ikv             ! local integers
+      INTEGER  ::   iku, ikv, ierr       ! local integers
       REAL(wp) ::   zabe1, zabe2, zbtr   ! local scalars
       !!----------------------------------------------------------------------
@@ -98,4 +81,9 @@
          IF(lwp) WRITE(numout,*) 'tra_ldf_lap : iso-level laplacian diffusion on ', cdtype
          IF(lwp) WRITE(numout,*) '~~~~~~~~~~~ '
+         !
+         ALLOCATE( e1ur(jpi,jpj), e2vr(jpi,jpj), STAT=ierr )
+         IF( lk_mpp    )   CALL mpp_sum( ierr )
+         IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'tra_ldf_lap : unable to allocate arrays' )
+         !
          e1ur(:,:) = e2u(:,:) / e1u(:,:)
          e2vr(:,:) = e1v(:,:) / e2v(:,:)
@@ -140,5 +128,5 @@
             DO jj = 2, jpjm1
                DO ji = fs_2, fs_jpim1   ! vector opt.
-                  zbtr = 1.0 / ( e1t(ji,jj) * e2t(ji,jj) * fse3t(ji,jj,jk) )
+                  zbtr = 1._wp / ( e1t(ji,jj) *e2t(ji,jj) * fse3t(ji,jj,jk) )
                   ! horizontal diffusive trends added to the general tracer trends
                   pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + zbtr * (  ztu(ji,jj,jk) - ztu(ji-1,jj,jk)   &
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 2622)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 2623)
@@ -55,8 +55,6 @@
    PUBLIC   tra_nxt_fix   ! to be used in trcnxt
    PUBLIC   tra_nxt_vvl   ! to be used in trcnxt
-   PUBLIC   tra_nxt_alloc ! used in nemogcm.F90
-
-   REAL(wp)                 ::   rbcp            ! Brown & Campana parameters for semi-implicit hpg
-   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:) :: r2dt ! vertical profile time step, =2*rdttra (leapfrog) or =rdttra (Euler)
+
+   REAL(wp) ::   rbcp   ! Brown & Campana parameters for semi-implicit hpg
 
    !! * Substitutions
@@ -64,24 +62,8 @@
    !!----------------------------------------------------------------------
    !! NEMO/OPA 3.3 , NEMO-Consortium (2010) 
-   !! $Id $
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !! $Id$
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
 CONTAINS
-
-   FUNCTION tra_nxt_alloc()
-      !!----------------------------------------------------------------------
-      !!                ***  ROUTINE tran_xt_alloc  ***
-      !!----------------------------------------------------------------------
-      IMPLICIT none
-      INTEGER tra_nxt_alloc
-      !!----------------------------------------------------------------------
-
-      ALLOCATE(r2dt(jpk), Stat=tra_nxt_alloc)
-
-      IF(tra_nxt_alloc /= 0)THEN
-         CALL ctl_warn('tra_nxt_alloc: failed to allocate array r2dt.')
-      END IF
-
-   END FUNCTION tra_nxt_alloc
 
    SUBROUTINE tra_nxt( kt )
@@ -121,5 +103,5 @@
          IF(lwp) WRITE(numout,*) '~~~~~~~'
          !
-         rbcp    = 0.25 * (1. + atfp) * (1. + atfp) * ( 1. - atfp)       ! Brown & Campana parameter for semi-implicit hpg
+         rbcp = 0.25 * (1. + atfp) * (1. + atfp) * ( 1. - atfp)      ! Brown & Campana parameter for semi-implicit hpg
       ENDIF
 
@@ -148,6 +130,6 @@
  
       ! set time step size (Euler/Leapfrog)
-      IF( neuler == 0 .AND. kt == nit000 ) THEN   ;   r2dt(:) =     rdttra(:)      ! at nit000             (Euler)
-      ELSEIF( kt <= nit000 + 1 )           THEN   ;   r2dt(:) = 2.* rdttra(:)      ! at nit000 or nit000+1 (Leapfrog)
+      IF( neuler == 0 .AND. kt == nit000 ) THEN   ;   r2dtra(:) =     rdttra(:)      ! at nit000             (Euler)
+      ELSEIF( kt <= nit000 + 1 )           THEN   ;   r2dtra(:) = 2.* rdttra(:)      ! at nit000 or nit000+1 (Leapfrog)
       ENDIF
 
@@ -181,5 +163,5 @@
       IF( l_trdtra ) THEN      ! trend of the Asselin filter (tb filtered - tb)/dt     
          DO jk = 1, jpkm1
-            zfact = 1.e0 / r2dt(jk)             
+            zfact = 1.e0 / r2dtra(jk)             
             ztrdt(:,:,jk) = ( tsb(:,:,jk,jp_tem) - ztrdt(:,:,jk) ) * zfact
             ztrds(:,:,jk) = ( tsb(:,:,jk,jp_sal) - ztrds(:,:,jk) ) * zfact
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf.F90	(revision 2622)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/TRA/trazdf.F90	(revision 2623)
@@ -34,12 +34,8 @@
    PRIVATE
 
-   PUBLIC tra_zdf      !  routine called by step.F90
-   PUBLIC tra_zdf_init !  routine called by opa.F90
-   PUBLIC tra_zdf_alloc!  routine called by nemogcm.F90
+   PUBLIC   tra_zdf        ! routine called by step.F90
+   PUBLIC   tra_zdf_init   ! routine called by nemogcm.F90
 
-   INTEGER ::   nzdf = 0               ! type vertical diffusion algorithm used
-      !                                ! defined from ln_zdf...  namlist logicals)
-   REAL(wp), SAVE, ALLOCATABLE, DIMENSION(:) :: r2dt ! vertical profile time-step, = 2 rdttra
-      !                                              ! except at nit000 (=rdttra) if neuler=0
+   INTEGER ::   nzdf = 0   ! type vertical diffusion algorithm used (defined from ln_zdf...  namlist logicals)
 
    !! * Substitutions
@@ -50,24 +46,7 @@
    !! NEMO/OPA 3.3 , NEMO Consortium (2010)
    !! $Id$
-   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
+   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
-
 CONTAINS
-
-   FUNCTION tra_zdf_alloc()
-      !!---------------------------------------------------------------------- 
-      !!                ***  ROUTINE tra_zdf_alloc  ***
-      !!---------------------------------------------------------------------- 
-      IMPLICIT none
-      INTEGER :: tra_zdf_alloc
-      !!----------------------------------------------------------------------
-
-      ALLOCATE(r2dt(jpk), Stat=tra_zdf_alloc)
-
-      IF(tra_zdf_alloc /= 0)THEN
-         CALL ctl_warn('tra_zdf_alloc: failed to allocate r2dt array')
-      END IF
-
-   END FUNCTION tra_zdf_alloc
 
    SUBROUTINE tra_zdf( kt )
@@ -85,7 +64,7 @@
       !                                          ! set time step
       IF( neuler == 0 .AND. kt == nit000 ) THEN     ! at nit000
-         r2dt(:) =  rdttra(:)                          ! = rdtra (restarting with Euler time stepping)
+         r2dtra(:) =  rdttra(:)                          ! = rdtra (restarting with Euler time stepping)
       ELSEIF( kt <= nit000 + 1) THEN                ! at nit000 or nit000+1
-         r2dt(:) = 2. * rdttra(:)                      ! = 2 rdttra (leapfrog)
+         r2dtra(:) = 2. * rdttra(:)                      ! = 2 rdttra (leapfrog)
       ENDIF
 
@@ -96,11 +75,11 @@
 
       SELECT CASE ( nzdf )                       ! compute lateral mixing trend and add it to the general trend
-      CASE ( 0 )    ;    CALL tra_zdf_exp( kt, 'TRA', r2dt, nn_zdfexp, tsb, tsa, jpts )  !   explicit scheme 
-      CASE ( 1 )    ;    CALL tra_zdf_imp( kt, 'TRA', r2dt,            tsb, tsa, jpts )  !   implicit scheme 
+      CASE ( 0 )    ;    CALL tra_zdf_exp( kt, 'TRA', r2dtra, nn_zdfexp, tsb, tsa, jpts )  !   explicit scheme 
+      CASE ( 1 )    ;    CALL tra_zdf_imp( kt, 'TRA', r2dtra,            tsb, tsa, jpts )  !   implicit scheme 
       CASE ( -1 )                                       ! esopa: test all possibility with control print
-         CALL tra_zdf_exp( kt, 'TRA', r2dt, nn_zdfexp, tsb, tsa, jpts )
+         CALL tra_zdf_exp( kt, 'TRA', r2dtra, nn_zdfexp, tsb, tsa, jpts )
          CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' zdf0 - Ta: ', mask1=tmask,               &
          &             tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
-         CALL tra_zdf_imp( kt, 'TRA', r2dt,            tsb, tsa, jpts ) 
+         CALL tra_zdf_imp( kt, 'TRA', r2dtra,            tsb, tsa, jpts ) 
          CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' zdf1 - Ta: ', mask1=tmask,               &
          &             tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
@@ -109,6 +88,6 @@
       IF( l_trdtra )   THEN                      ! save the vertical diffusive trends for further diagnostics
          DO jk = 1, jpkm1
-            ztrdt(:,:,jk) = ( ( tsa(:,:,jk,jp_tem) - tsb(:,:,jk,jp_tem) ) / r2dt(jk) ) - ztrdt(:,:,jk)
-            ztrds(:,:,jk) = ( ( tsa(:,:,jk,jp_sal) - tsb(:,:,jk,jp_sal) ) / r2dt(jk) ) - ztrds(:,:,jk)
+            ztrdt(:,:,jk) = ( ( tsa(:,:,jk,jp_tem) - tsb(:,:,jk,jp_tem) ) / r2dtra(jk) ) - ztrdt(:,:,jk)
+            ztrds(:,:,jk) = ( ( tsa(:,:,jk,jp_sal) - tsb(:,:,jk,jp_sal) ) / r2dtra(jk) ) - ztrds(:,:,jk)
          END DO
          CALL trd_tra( kt, 'TRA', jp_tem, jptra_trd_zdf, ztrdt )
@@ -120,5 +99,5 @@
       IF(ln_ctl)   CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' zdf  - Ta: ', mask1=tmask,               &
          &                       tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
-
+      !
    END SUBROUTINE tra_zdf
 
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfric.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfric.F90	(revision 2622)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/ZDF/zdfric.F90	(revision 2623)
@@ -97,7 +97,6 @@
       !!----------------------------------------------------------------------
 
-      IF(.NOT. wrk_use(2, 1))THEN
-         CALL ctl_stop('zdf_ric : requested workspace array unavailable.')
-         RETURN
+      IF(.NOT. wrk_use(2, 1) ) THEN
+         CALL ctl_stop('zdf_ric : requested workspace array unavailable')   ;   RETURN
       END IF
       !                                                ! ===============
@@ -151,7 +150,5 @@
       CALL lbc_lnk( avmu, 'U', 1. )   ;   CALL lbc_lnk( avmv, 'V', 1. )
       !
-      IF(.NOT. wrk_release(2, 1))THEN
-         CALL ctl_stop('zdf_ric : failed to release workspace array.')
-      END IF
+      IF(.NOT. wrk_release(2, 1) )   CALL ctl_stop('zdf_ric : failed to release workspace array')
       !
    END SUBROUTINE zdf_ric
Index: /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 2622)
+++ /branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 2623)
@@ -479,20 +479,4 @@
 #endif
 
-     USE traadv,       ONLY: tra_adv_alloc
-     USE traadv_cen2,  ONLY: tra_adv_cen2_alloc
-#if   defined key_trabbl   ||   defined key_esopa
-     USE trabbl,       ONLY: tra_bbl_alloc
-#endif
-#if   defined key_tradmp   ||   defined key_esopa
-     USE tradmp,       ONLY: tra_dmp_alloc
-#endif
-     USE traldf,       ONLY: tra_ldf_alloc
-#if   defined key_ldfslp   ||   defined key_esopa
-     USE traldf_iso_grif,ONLY: tra_ldf_iso_grif_alloc
-#endif
-     USE traldf_lap,   ONLY: tra_ldf_lap_alloc
-     USE tranxt,       ONLY: tra_nxt_alloc
-     USE trazdf,       ONLY: tra_zdf_alloc
-
      ! TOP-related alloc routines...
 #if defined key_top
@@ -559,20 +543,4 @@
       ierr = ierr + obc_oce_alloc()
 #endif
-
-      ierr = ierr + tra_adv_alloc()
-      ierr = ierr + tra_adv_cen2_alloc()
-#if defined key_trabbl   ||   defined key_esopa
-      ierr = ierr + tra_bbl_alloc()
-#endif
-#if defined key_tradmp   ||   defined key_esopa
-      ierr = ierr + tra_dmp_alloc()
-#endif
-      ierr = ierr + tra_ldf_alloc()
-#if defined key_ldfslp   ||   defined key_esopa
-      ierr = ierr + tra_ldf_iso_grif_alloc()
-#endif
-      ierr = ierr + tra_ldf_lap_alloc()
-      ierr = ierr + tra_nxt_alloc()
-      ierr = ierr + tra_zdf_alloc()
 
       ! Start of TOP-related alloc routines...
