Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/divcur.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/divcur.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/divcur.F90	(revision 3161)
@@ -31,4 +31,6 @@
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE lib_mpp         ! MPP library
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -83,20 +85,19 @@
       INTEGER, INTENT(in) ::   kt   ! ocean time-step index
       !
-      REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   zwu   ! specific 2D workspace
-      REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:) ::   zwv   ! specific 2D workspace
-      !
       INTEGER ::   ji, jj, jk, jl           ! dummy loop indices
       INTEGER ::   ii, ij, ijt, iju, ierr   ! local integer
       REAL(wp) ::  zraur, zdep              ! local scalar
-      !!----------------------------------------------------------------------
-
+      REAL(wp), POINTER,  DIMENSION(:,:) ::   zwu, zwv   ! specific 2D workspace
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('div_cur')
+      !
+      CALL wrk_alloc( jpi  , jpj+2, zwu, kistart = 1  )
+      CALL wrk_alloc( jpi+2, jpj  , zwv, kjstart = -1 )
+      !
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
          IF(lwp) WRITE(numout,*) 'div_cur : horizontal velocity divergence and relative vorticity'
          IF(lwp) WRITE(numout,*) '~~~~~~~   NOT optimal for auto-tasking case'
-         !
-         ALLOCATE( zwu( jpi, 1:jpj+2) , zwv(-1:jpi+2, jpj) , STAT=ierr )
-         IF( lk_mpp    )   CALL mpp_sum( ierr )
-         IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'div_cur : unable to allocate arrays' )
       ENDIF
 
@@ -230,4 +231,9 @@
       CALL lbc_lnk( hdivn, 'T', 1. )   ;   CALL lbc_lnk( rotn , 'F', 1. )    ! lateral boundary cond. (no sign change)
       !
+      CALL wrk_dealloc( jpi  , jpj+2, zwu, kistart = 1  )
+      CALL wrk_dealloc( jpi+2, jpj  , zwv, kjstart = -1 )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('div_cur')
+      !
    END SUBROUTINE div_cur
    
@@ -267,5 +273,7 @@
       REAL(wp) ::   zraur, zdep   ! local scalars
       !!----------------------------------------------------------------------
-
+      !
+      IF( nn_timing == 1 )  CALL timing_start('div_cur')
+      !
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -319,4 +327,6 @@
       CALL lbc_lnk( hdivn, 'T', 1. )   ;   CALL lbc_lnk( rotn , 'F', 1. )     ! lateral boundary cond. (no sign change)
       !
+      IF( nn_timing == 1 )  CALL timing_stop('div_cur')
+      !
    END SUBROUTINE div_cur
    
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv.F90	(revision 3161)
@@ -19,4 +19,5 @@
    USE in_out_manager  ! I/O manager
    USE lib_mpp         ! MPP library
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -57,4 +58,6 @@
       !!----------------------------------------------------------------------
       !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_adv')
+      !
       SELECT CASE ( nadv )                  ! compute advection trend and add it to general trend
       CASE ( 0 )     
@@ -72,4 +75,6 @@
                       CALL dyn_adv_ubs ( kt )
       END SELECT
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_adv')
       !
    END SUBROUTINE dyn_adv
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv_cen2.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv_cen2.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv_cen2.F90	(revision 3161)
@@ -20,4 +20,6 @@
    USE lib_mpp        ! MPP library
    USE prtctl         ! Print control
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -47,9 +49,5 @@
       !! ** Action  :   (ua,va) updated with the now vorticity term trend
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
       USE oce     , ONLY:   tsa             ! tsa used as 2 3D workspace
-      USE wrk_nemo, ONLY:   zfu_t => wrk_3d_1 , zfv_t => wrk_3d_4 , zfu_uw =>wrk_3d_6   ! 3D workspaces
-      USE wrk_nemo, ONLY:   zfu_f => wrk_3d_2 , zfv_f => wrk_3d_5 , zfv_vw =>wrk_3d_7
-      USE wrk_nemo, ONLY:   zfw   => wrk_3d_3
       !
       INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
@@ -57,7 +55,14 @@
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
       REAL(wp) ::   zbu, zbv     ! local scalars
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  zfu_t, zfv_t, zfu_f, zfv_f, zfu_uw, zfv_vw, zfw
       REAL(wp), POINTER, DIMENSION(:,:,:) ::  zfu, zfv
       !!----------------------------------------------------------------------
-
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_adv_cen2')
+      !
+      CALL wrk_alloc( jpi, jpj, jpk, zfu_t, zfv_t, zfu_f, zfv_f, zfu_uw, zfv_vw, zfw )
+      zfu => tsa(:,:,:,1) 
+      zfv => tsa(:,:,:,2) 
+      !
       IF( kt == nit000 .AND. lwp ) THEN
          WRITE(numout,*)
@@ -65,12 +70,4 @@
          WRITE(numout,*) '~~~~~~~~~~~~'
       ENDIF
-
-      ! Check that global workspace arrays aren't already in use
-      IF( wrk_in_use(3, 1,2,3,4,5,6,7) ) THEN
-         CALL ctl_stop('dyn_adv_cen2 : requested workspace array unavailable')   ;   RETURN
-      ENDIF
-      !
-      zfu => tsa(:,:,:,1) 
-      zfv => tsa(:,:,:,2) 
       !
       IF( l_trddyn ) THEN           ! Save ua and va trends
@@ -166,5 +163,7 @@
          &                       tab3d_2=va, clinfo2=           ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
-      IF( wrk_not_released(3, 1,2,3,4,5,6,7) )   CALL ctl_stop('dyn_adv_cen2: failed to release workspace array')
+      CALL wrk_dealloc( jpi, jpj, jpk, zfu_t, zfv_t, zfu_f, zfv_f, zfu_uw, zfv_vw, zfw )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_adv_cen2')
       !
    END SUBROUTINE dyn_adv_cen2
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv_ubs.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv_ubs.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynadv_ubs.F90	(revision 3161)
@@ -22,4 +22,6 @@
    USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
    USE lib_mpp        ! MPP library
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -68,11 +70,5 @@
       !! Reference : Shchepetkin & McWilliams, 2005, Ocean Modelling. 
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
       USE oce     , ONLY:   tsa             ! tsa used as 2 3D workspace
-      USE wrk_nemo, ONLY:   zfu_t  => wrk_3d_1 , zfv_t  =>wrk_3d_4 , zfu_uw =>wrk_3d_6   ! 3D workspace
-      USE wrk_nemo, ONLY:   zfu_f  => wrk_3d_2 , zfv_f  =>wrk_3d_5 , zfv_vw =>wrk_3d_7
-      USE wrk_nemo, ONLY:   zfw    => wrk_3d_3
-      USE wrk_nemo, ONLY:   zlu_uu => wrk_4d_1 , zlv_vv=>wrk_4d_3   ! 4D workspace
-      USE wrk_nemo, ONLY:   zlu_uv => wrk_4d_2 , zlv_vu=>wrk_4d_4
       !
       INTEGER, INTENT(in) ::   kt     ! ocean time-step index
@@ -81,7 +77,16 @@
       REAL(wp) ::   zbu, zbv    ! temporary scalars
       REAL(wp) ::   zui, zvj, zfuj, zfvi, zl_u, zl_v   ! temporary scalars
-      REAL(wp), POINTER, DIMENSION(:,:,:) ::  zfu, zfv
+      REAL(wp), POINTER, DIMENSION(:,:,:  ) ::  zfu, zfv
+      REAL(wp), POINTER, DIMENSION(:,:,:  ) ::  zfu_t, zfv_t, zfu_f, zfv_f, zfu_uw, zfv_vw, zfw
+      REAL(wp), POINTER, DIMENSION(:,:,:,:) ::  zlu_uu, zlv_vv, zlu_uv, zlv_vu
       !!----------------------------------------------------------------------
-
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_adv_ubs')
+      !
+      CALL wrk_alloc( jpi, jpj, jpk,       zfu_t , zfv_t , zfu_f , zfv_f, zfu_uw, zfv_vw, zfw )
+      CALL wrk_alloc( jpi, jpj, jpk, jpts, zlu_uu, zlv_vv, zlu_uv, zlv_vu                     )
+      zfu => tsa(:,:,:,1) 
+      zfv => tsa(:,:,:,2) 
+      !
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -89,12 +94,4 @@
          IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
       ENDIF
-
-      ! Check that required workspace arrays are not already in use
-      IF( wrk_in_use(3, 1,2,3,4,5,6,7) .OR. wrk_in_use(4, 1,2,3,4) ) THEN
-         CALL ctl_stop('dyn_adv_ubs: requested workspace array unavailable')   ;   RETURN
-      ENDIF
-      !
-      zfu => tsa(:,:,:,1) 
-      zfv => tsa(:,:,:,2) 
       !
       zfu_t(:,:,:) = 0._wp
@@ -258,6 +255,8 @@
          &                       tab3d_2=va, clinfo2=           ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
-      IF( wrk_not_released(3, 1,2,3,4,5,6,7) .OR.   &
-          wrk_not_released(4, 1,2,3,4)       )   CALL ctl_stop('dyn_adv_ubs: failed to release workspace array')
+      CALL wrk_dealloc( jpi, jpj, jpk,       zfu_t , zfv_t , zfu_f , zfv_f, zfu_uw, zfv_vw, zfw )
+      CALL wrk_dealloc( jpi, jpj, jpk, jpts, zlu_uu, zlv_vv, zlu_uv, zlv_vu                     )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_adv_ubs')
       !
    END SUBROUTINE dyn_adv_ubs
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynbfr.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynbfr.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynbfr.F90	(revision 3161)
@@ -18,4 +18,5 @@
    USE in_out_manager  ! I/O manager
    USE prtctl          ! Print control
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -52,5 +53,7 @@
       !!---------------------------------------------------------------------
       !
-      IF( .not. ln_bfrimp) THEN     ! only for explicit bottom friction form
+      IF( nn_timing == 1 )  CALL timing_start('dyn_bfr')
+      !
+      IF( .NOT.ln_bfrimp) THEN     ! only for explicit bottom friction form
                                     ! implicit bfr is implemented in dynzdf_imp
                                     ! H. Liu,  Sept. 2011
@@ -91,4 +94,7 @@
         !
       ENDIF     ! end explicit bottom friction
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_bfr')
+      !
    END SUBROUTINE dyn_bfr
 
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynhpg.F90	(revision 3161)
@@ -37,4 +37,6 @@
    USE lbclnk          ! lateral boundary condition 
    USE lib_mpp         ! MPP library
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -80,4 +82,6 @@
       !!----------------------------------------------------------------------
       !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_hpg')
+      !
       IF( l_trddyn ) THEN                    ! Temporary saving of ua and va trends (l_trddyn)
          ztrdu => tsa(:,:,:,1) 
@@ -104,4 +108,6 @@
       IF(ln_ctl)   CALL prt_ctl( tab3d_1=ua, clinfo1=' hpg  - Ua: ', mask1=umask,   &
          &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_hpg')
       !
    END SUBROUTINE dyn_hpg
@@ -436,13 +442,5 @@
       !! Reference: Shchepetkin and McWilliams, J. Geophys. Res., 108(C3), 3090, 2003
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
       USE oce     , ONLY:   tsa                         ! (tsa) used as 2 3D workspace
-      USE wrk_nemo, ONLY:   drhox => wrk_3d_1  , dzx  => wrk_3d_2
-      USE wrk_nemo, ONLY:   drhou => wrk_3d_3  , dzu  => wrk_3d_4 , rho_i => wrk_3d_5
-      USE wrk_nemo, ONLY:   drhoy => wrk_3d_6  , dzy  => wrk_3d_7
-      USE wrk_nemo, ONLY:   drhov => wrk_3d_8  , dzv  => wrk_3d_9 , rho_j => wrk_3d_10
-      USE wrk_nemo, ONLY:   drhoz => wrk_3d_11 , dzz  => wrk_3d_12 
-      USE wrk_nemo, ONLY:   drhow => wrk_3d_13 , dzw  => wrk_3d_14
-      USE wrk_nemo, ONLY:   rho_k => wrk_3d_15
       !!
       INTEGER, INTENT(in) ::   kt    ! ocean time-step index
@@ -453,12 +451,15 @@
       REAL(wp) ::   z1_12, cffv, cffy   !    "         "
       REAL(wp), POINTER, DIMENSION(:,:,:) ::  zhpi, zhpj 
-      !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(3, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) ) THEN
-         CALL ctl_stop('dyn:hpg_djc: requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
-      !
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  dzx, dzy, dzz, dzu, dzv, dzw
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  drhox, drhoy, drhoz, drhou, drhov, drhow
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  rho_i, rho_j, rho_k
+      !!----------------------------------------------------------------------
+      !
+      CALL wrk_alloc( jpi, jpj, jpk, dzx  , dzy  , dzz  , dzu  , dzv  , dzw   ) 
+      CALL wrk_alloc( jpi, jpj, jpk, drhox, drhoy, drhoz, drhou, drhov, drhow ) 
+      CALL wrk_alloc( jpi, jpj, jpk, rho_i, rho_j, rho_k                      ) 
       zhpi => tsa(:,:,:,1) 
       zhpj => tsa(:,:,:,2) 
+      !
 
       IF( kt == nit000 ) THEN
@@ -657,6 +658,7 @@
       END DO
       !
-      IF( wrk_not_released(3, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) )   &
-         CALL ctl_stop('dyn:hpg_djc: failed to release workspace arrays')
+      CALL wrk_dealloc( jpi, jpj, jpk, dzx  , dzy  , dzz  , dzu  , dzv  , dzw   ) 
+      CALL wrk_dealloc( jpi, jpj, jpk, drhox, drhoy, drhoz, drhou, drhov, drhow ) 
+      CALL wrk_dealloc( jpi, jpj, jpk, rho_i, rho_j, rho_k                      ) 
       !
    END SUBROUTINE hpg_djc
@@ -676,17 +678,5 @@
       !!
       !!----------------------------------------------------------------------
-
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
       USE oce     , ONLY:   tsa                          ! (tsa) used as 2 3D workspace
-      USE wrk_nemo, ONLY:   zhpi => wrk_3d_3 
-      USE wrk_nemo, ONLY:   zu   => wrk_3d_4 
-      USE wrk_nemo, ONLY:   zv   => wrk_3d_5
-      USE wrk_nemo, ONLY:   fsp  => wrk_3d_6
-      USE wrk_nemo, ONLY:   xsp  => wrk_3d_7
-      USE wrk_nemo, ONLY:   asp  => wrk_3d_8
-      USE wrk_nemo, ONLY:   bsp  => wrk_3d_9
-      USE wrk_nemo, ONLY:   csp  => wrk_3d_10
-      USE wrk_nemo, ONLY:   dsp  => wrk_3d_11
-      !!
       !!----------------------------------------------------------------------
       !!
@@ -704,13 +694,11 @@
       INTEGER  :: zbhitwe, zbhitns
       REAL(wp), POINTER, DIMENSION(:,:,:) ::   zdeptht, zrhh 
-      !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(3, 3,4,5,6,7,8,9,10,11) ) THEN
-         CALL ctl_stop('dyn:hpg_prj: requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
-      !
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::   zhpi, zu, zv, fsp, xsp, asp, bsp, csp, dsp
+      !!----------------------------------------------------------------------
+      !
+      CALL wrk_alloc( jpi, jpj, jpk, zhpi, zu, zv, fsp, xsp, asp, bsp, csp, dsp ) 
       zdeptht => tsa(:,:,:,1) 
       zrhh    => tsa(:,:,:,2) 
-
+      !
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -964,8 +952,6 @@
         END DO
       END DO
-
-      !
-      IF( wrk_not_released(3, 3,4,5,6,7,8,9,10,11) )   &
-         CALL ctl_stop('dyn:hpg_prj: failed to release workspace arrays')
+      !
+      CALL wrk_dealloc( jpi, jpj, jpk, zhpi, zu, zv, fsp, xsp, asp, bsp, csp, dsp ) 
       !
    END SUBROUTINE hpg_prj
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynkeg.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynkeg.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynkeg.F90	(revision 3161)
@@ -19,4 +19,6 @@
    USE lib_mpp         ! MPP library
    USE prtctl          ! Print control
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -52,7 +54,5 @@
       !!             - save this trends (l_trddyn=T) for post-processing
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
       USE oce     , ONLY:   tsa             ! tsa used as 2 3D workspace
-      USE wrk_nemo, ONLY:   zhke  => wrk_3d_1                 ! 3D workspace
       !!
       INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
@@ -60,11 +60,12 @@
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
       REAL(wp) ::   zu, zv       ! temporary scalars
-      REAL(wp), POINTER, DIMENSION(:,:,:) ::   ztrdu, ztrdv 
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zhke
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrdu, ztrdv 
       !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(3,1) ) THEN
-         CALL ctl_stop('dyn_keg: requested workspace array is unavailable')   ;   RETURN
-      ENDIF
-
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_keg')
+      !
+      CALL wrk_alloc( jpi, jpj, jpk, zhke )
+      !
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -140,5 +141,7 @@
          &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
-      IF( wrk_not_released(3, 1) )   CALL ctl_stop('dyn_keg: failed to release workspace array')
+      CALL wrk_dealloc( jpi, jpj, jpk, zhke )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_keg')
       !
    END SUBROUTINE dyn_keg
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf.F90	(revision 3161)
@@ -26,4 +26,7 @@
    USE lib_mpp        ! distribued memory computing library
    USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
+
 
    IMPLICIT NONE
@@ -51,15 +54,14 @@
       !! ** Purpose :   compute the lateral ocean dynamics physics.
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   ztrdu => wrk_3d_1 , ztrdv => wrk_3d_2
       !
       INTEGER, INTENT(in) ::   kt   ! ocean time-step index
-      !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(3, 1,2) ) THEN
-         CALL ctl_stop('dyn_ldf: requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
+      !
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrdu, ztrdv
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_ldf')
       !
       IF( l_trddyn )   THEN                      ! temporary save of ta and sa trends
+         CALL wrk_alloc( jpi, jpj, jpk, ztrdu, ztrdv )
          ztrdu(:,:,:) = ua(:,:,:) 
          ztrdv(:,:,:) = va(:,:,:) 
@@ -105,4 +107,5 @@
          ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
          CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_ldf, 'DYN', kt )
+         CALL wrk_dealloc( jpi, jpj, jpk, ztrdu, ztrdv )
       ENDIF
       !                                          ! print sum trends (used for debugging)
@@ -110,5 +113,5 @@
          &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
-      IF( wrk_not_released(3, 1,2) )   CALL ctl_stop('dyn_ldf: failed to release workspace arrays')
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_ldf')
       !
    END SUBROUTINE dyn_ldf
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilap.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilap.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilap.F90	(revision 3161)
@@ -23,4 +23,6 @@
    USE trdmod_oce      ! ocean variables trends
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -74,8 +76,4 @@
       !!               mixing trend.
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   zcu => wrk_2d_1 , zcv => wrk_2d_2   ! 3D workspace
-      USE wrk_nemo, ONLY:   zuf => wrk_3d_3 , zut => wrk_3d_4   ! 3D workspace
-      USE wrk_nemo, ONLY:   zlu => wrk_3d_5 , zlv => wrk_3d_6
       !
       INTEGER, INTENT(in) ::   kt   ! ocean time-step index
@@ -83,10 +81,13 @@
       INTEGER  ::   ji, jj, jk                  ! dummy loop indices
       REAL(wp) ::   zua, zva, zbt, ze2u, ze2v   ! temporary scalar
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: zcu, zcv
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zuf, zut, zlu, zlv
       !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(2, 1,2) .OR. wrk_in_use(3, 3,4,5,6) ) THEN
-         CALL ctl_stop('dyn_ldf_bilap : requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
-
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_ldf_bilap')
+      !
+      CALL wrk_alloc( jpi, jpj,      zcu, zcv           )
+      CALL wrk_alloc( jpi, jpj, jpk, zuf, zut, zlu, zlv ) 
+      !
       IF( kt == nit000 .AND. lwp ) THEN
          WRITE(numout,*)
@@ -207,6 +208,8 @@
       END DO                                           !   End of slab
       !                                                ! ===============
-      IF( wrk_not_released(2, 1,2)     .OR.   &
-          wrk_not_released(3, 3,4,5,6) )   CALL ctl_stop('dyn_ldf_bilap: failed to release workspace arrays')
+      CALL wrk_dealloc( jpi, jpj,      zcu, zcv           )
+      CALL wrk_dealloc( jpi, jpj, jpk, zuf, zut, zlu, zlv ) 
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_ldf_bilap')
       !
    END SUBROUTINE dyn_ldf_bilap
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilapg.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilapg.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_bilapg.F90	(revision 3161)
@@ -27,4 +27,7 @@
    USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
    USE prtctl          ! Print control
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
+
 
    IMPLICIT NONE
@@ -84,6 +87,4 @@
       !!              - save the trend in (zwk3,zwk4) ('key_trddyn')
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   zwk1 => wrk_3d_3 , zwk2 => wrk_3d_4   ! 3D workspace
       USE oce     , ONLY:   tsa             ! tsa used as 2 3D workspace
       !
@@ -91,11 +92,11 @@
       !
       INTEGER ::   ji, jj, jk                 ! dummy loop indices
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  zwk1, zwk2
       REAL(wp), POINTER, DIMENSION(:,:,:) ::  zwk3, zwk4
       !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(3, 3,4) ) THEN
-         CALL ctl_stop('dyn_ldf_bilapg: requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
-      !
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_ldf_bilapg')
+      !
+      CALL wrk_alloc( jpi, jpj, jpk, zwk1, zwk2 ) 
       zwk3 => tsa(:,:,:,1) 
       zwk4 => tsa(:,:,:,2) 
@@ -105,9 +106,10 @@
          IF(lwp) WRITE(numout,*) 'dyn_ldf_bilapg : horizontal biharmonic operator in s-coordinate'
          IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~~~'
-         zwk1(:,:,:) = 0.e0   ;   zwk3(:,:,:) = 0.e0
-         zwk2(:,:,:) = 0.e0   ;   zwk4(:,:,:) = 0.e0
          !                                      ! allocate dyn_ldf_bilapg arrays
          IF( dyn_ldf_bilapg_alloc() /= 0 )   CALL ctl_stop('STOP', 'dyn_ldf_bilapg: failed to allocate arrays')
       ENDIF
+      !
+      zwk1(:,:,:) = 0.e0   ;   zwk3(:,:,:) = 0.e0
+      zwk2(:,:,:) = 0.e0   ;   zwk4(:,:,:) = 0.e0
 
       ! Laplacian of (ub,vb) multiplied by ahm
@@ -133,5 +135,7 @@
       END DO
       !
-      IF( wrk_not_released(3, 3,4) )   CALL ctl_stop('dyn_ldf_bilapg: failed to release workspace arrays')
+      CALL wrk_dealloc( jpi, jpj, jpk, zwk1, zwk2 ) 
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_ldf_bilapg')
       !
    END SUBROUTINE dyn_ldf_bilapg
@@ -179,8 +183,4 @@
       !!      'key_trddyn' defined: the trend is saved for diagnostics.
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   ziut => wrk_2d_1 , zjuf  => wrk_2d_2 , zjvt  => wrk_2d_3
-      USE wrk_nemo, ONLY:   zivf => wrk_2d_4 , zdku  => wrk_2d_5 , zdk1u => wrk_2d_6
-      USE wrk_nemo, ONLY:   zdkv => wrk_2d_7 , zdk1v => wrk_2d_8
       !!
       REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in   ) ::   pu , pv    ! 1st call: before horizontal velocity 
@@ -196,9 +196,12 @@
       REAL(wp) ::   zbur, zbvr, zmkt, zmkf, zuav, zvav   !   -      -
       REAL(wp) ::   zuwslpi, zuwslpj, zvwslpi, zvwslpj   !   -      -
-      !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(2, 1,2,3,4,5,6,7,8) ) THEN
-         CALL ctl_stop('dyn:ldfguv: requested workspace arrays unavailable')   ;   RETURN
-      END IF
+      !
+      REAL(wp), POINTER, DIMENSION(:,:) :: ziut, zjuf, zjvt, zivf, zdku, zdk1u, zdkv, zdk1v
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('ldfguv')
+      !
+      CALL wrk_alloc( jpi, jpj, ziut, zjuf, zjvt, zivf, zdku, zdk1u, zdkv, zdk1v ) 
+      !
       !                               ! ********** !   ! ===============
       DO jk = 1, jpkm1                ! First step !   ! Horizontal slab
@@ -456,5 +459,7 @@
       !                                                ! ===============
 
-      IF( wrk_not_released(2, 1,2,3,4,5,6,7,8) )   CALL ctl_stop('dyn:ldfguv: failed to release workspace arrays')
+      CALL wrk_dealloc( jpi, jpj, ziut, zjuf, zjvt, zivf, zdku, zdk1u, zdkv, zdk1v ) 
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('ldfguv')
       !
    END SUBROUTINE ldfguv
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_iso.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_iso.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_iso.F90	(revision 3161)
@@ -29,4 +29,6 @@
    USE lib_mpp         ! MPP library
    USE prtctl          ! Print control
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -105,8 +107,4 @@
       !!      of the rotated operator in dynzdf module
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   ziut  => wrk_2d_1 , zjuf  => wrk_2d_2 , zjvt => wrk_2d_3    ! 2D workspace
-      USE wrk_nemo, ONLY:   zivf  => wrk_2d_4 , zdku  => wrk_2d_5 , zdkv => wrk_2d_6    ! 2D workspace
-      USE wrk_nemo, ONLY:   zdk1u => wrk_2d_7 , zdk1v => wrk_2d_8
       !
       INTEGER, INTENT( in ) ::   kt   ! ocean time-step index
@@ -117,10 +115,12 @@
       REAL(wp) ::   zcoef0, zcoef3, zcoef4, zmkt, zmkf               !   -      -
       REAL(wp) ::   zuav, zvav, zuwslpi, zuwslpj, zvwslpi, zvwslpj   !   -      -
+      !
+      REAL(wp), POINTER, DIMENSION(:,:) :: ziut, zjuf, zjvt, zivf, zdku, zdk1u, zdkv, zdk1v
       !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(2, 1,2,3,4,5,6,7,8) ) THEN
-         CALL ctl_stop('dyn_ldf_iso: requested workspace arrays unavailable')   ;   RETURN
-      END IF
-
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_ldf_iso')
+      !
+      CALL wrk_alloc( jpi, jpj, ziut, zjuf, zjvt, zivf, zdku, zdk1u, zdkv, zdk1v ) 
+      !
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -427,6 +427,7 @@
       END DO                                           !   End of slab
       !                                                ! ===============
-
-      IF( wrk_not_released(2, 1,2,3,4,5,6,7,8) )   CALL ctl_stop('dyn_ldf_iso: failed to release workspace arrays')
+      CALL wrk_dealloc( jpi, jpj, ziut, zjuf, zjvt, zivf, zdku, zdk1u, zdkv, zdk1v ) 
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_ldf_iso')
       !
    END SUBROUTINE dyn_ldf_iso
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_lap.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_lap.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynldf_lap.F90	(revision 3161)
@@ -23,4 +23,5 @@
    USE trdmod_oce      ! ocean variables trends
    USE ldfslp          ! iso-neutral slopes 
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -68,4 +69,6 @@
       !!----------------------------------------------------------------------
       !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_ldf_lap')
+      !
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -95,4 +98,6 @@
       END DO                                           !   End of slab
       !                                                ! ===============
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_ldf_lap')
+      !
    END SUBROUTINE dyn_ldf_lap
 
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynnept.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynnept.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynnept.F90	(revision 3161)
@@ -30,5 +30,5 @@
    USE phycst
    USE lbclnk
-
+   USE wrk_nemo_2      ! Memory Allocation
 
    IMPLICIT NONE
@@ -102,15 +102,5 @@
       USE iom
       !!
-!!    Local dynamic allocation
       INTEGER  ::   ji, jj, jk    ! dummy loop indices
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   ht       ! temporary 2D workspace
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   htn      ! temporary 2D workspace
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   tscale   ! temporary 2D workspace
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   tsp      ! temporary 2D workspace
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   hur_n    ! temporary 2D workspace
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   hvr_n    ! temporary 2D workspace
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   hu_n     ! temporary 2D workspace
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:)   ::   hv_n     ! temporary 2D workspace
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   znmask   ! temporary 3D array for nmask
       REAL(wp) :: unemin,unemax,vnemin,vnemax   ! extrema of (u*, v*) fields
       REAL(wp) :: zhdivmin,zhdivmax             ! extrema of horizontal divergence of (u*, v*) fields
@@ -118,14 +108,15 @@
       REAL(wp) :: ustar,vstar                   ! (u*, v*) before tapering in shallow water
       REAL(wp) :: hramp                         ! depth over which Neptune vel. is ramped down
-      !!
-      NAMELIST/namdyn_nept/ ln_neptsimp,      &
-                            ln_smooth_neptvel,&
-			    rn_tslse,	      &
-			    rn_tslsp,	      &
-                            ln_neptramp,      &
-                            rn_htrmin,        &
-			    rn_htrmax
-      !!----------------------------------------------------------------------
-
+      !
+      REAL(wp), POINTER, DIMENSION(:,:  ) :: ht, htn, tscale, tsp, hur_n, hvr_n, hu_n, hv_n      
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: znmask
+      !!
+      NAMELIST/namdyn_nept/ ln_neptsimp, ln_smooth_neptvel, rn_tslse, rn_tslsp,      &
+                            ln_neptramp, rn_htrmin, rn_htrmax
+      !!----------------------------------------------------------------------
+      !                                                           ! Dynamically allocate local work arrays
+      CALL wrk_alloc( jpi, jpj     , ht, htn, tscale, tsp, hur_n, hvr_n, hu_n, hv_n  ) 
+      CALL wrk_alloc( jpi, jpj, jpk, znmask                                          ) 
+      !
       ! Define the (simplified) Neptune parameters
       ! ==========================================
@@ -179,9 +170,4 @@
 !!    Perform dynamic allocation of shared module variables
       IF( dynnept_alloc() /= 0 )   CALL ctl_warn('dynnept_alloc: array allocate failed.')
-
-!!    Dynamically allocate local work arrays
-      ALLOCATE( ht(jpi,jpj), htn(jpi,jpj), tscale(jpi,jpj), tsp(jpi,jpj),      &
-         &      hur_n(jpi,jpj), hvr_n(jpi,jpj), hu_n(jpi,jpj), hv_n(jpi,jpj),  &
-         &      znmask(jpi,jpj,jpk) )
 
       IF( .not. ln_rstart ) THEN      ! If restarting, these arrays are read from the restart file
@@ -350,6 +336,7 @@
 !!    Deallocate temporary workspace arrays, which are all local to
 !!    this routine, except where passed as arguments to other routines
-      DEALLOCATE( ht, htn, tscale, tsp, hur_n, hvr_n, hu_n, hv_n, znmask )
-
+      CALL wrk_dealloc( jpi, jpj     , ht, htn, tscale, tsp, hur_n, hvr_n, hu_n, hv_n  ) 
+      CALL wrk_dealloc( jpi, jpj, jpk, znmask                                          ) 
+      !
    END SUBROUTINE dyn_nept_init
 
@@ -393,6 +380,5 @@
       INTEGER  ::   ji, jj, jk          ! dummy loop indices
       !!----------------------------------------------------------------------
-
-
+      !    
       IF(lwp) WRITE(numout,*)
       IF(lwp) WRITE(numout,*) 'dyn_nept_div_cur_init :'
@@ -501,6 +487,6 @@
          ENDIF
          !
-	 lastkt = kt	     ! Store kt
-	 !
+         lastkt = kt     ! Store kt
+         !
       ENDIF
       !
@@ -530,5 +516,5 @@
 
 
-   SUBROUTINE dyn_nept_smooth_vel( htold, htnew, option )
+   SUBROUTINE dyn_nept_smooth_vel( htold, htnew, ld_option )
 
       !!----------------------------------------------------------------------
@@ -539,18 +525,18 @@
       !! ** Action : - Updates the array htnew (output) with a smoothed
       !!               version of the (input) array htold. Form of smoothing
-      !!               algorithm is controlled by the (logical) argument option.
-      !!----------------------------------------------------------------------
-
-      INTEGER                                   ::   ji, jj  ! dummy loop indices
-      REAL(wp), DIMENSION(jpi,jpj), INTENT(IN)  ::   htold   ! temporary 2D workspace
-      LOGICAL, INTENT(IN)                       ::   option  ! temporary 2D workspace
-      REAL(wp), DIMENSION(jpi,jpj)              ::   htnew   ! temporary 2D workspace
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:)     ::   work    ! temporary 2D workspace
-      INTEGER,  ALLOCATABLE, DIMENSION(:,:)     ::   nb      ! temporary 2D workspace
-      INTEGER,  ALLOCATABLE, DIMENSION(:,:)     ::   iwork   ! temporary 2D workspace
-
-!!    Dynamically allocate local work arrays
-      ALLOCATE( work(jpi,jpj), nb(jpi,jpj), iwork(jpi,jpj) )
-
+      !!               algorithm is controlled by the (logical) argument ld_option.
+      !!----------------------------------------------------------------------
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(in   )  ::  htold      ! temporary 2D workspace
+      LOGICAL                     , INTENT(in   )  ::  ld_option  ! temporary 2D workspace
+      REAL(wp), DIMENSION(jpi,jpj), INTENT(inout)  ::  htnew      ! temporary 2D workspace
+      !
+      INTEGER                           ::  ji, jj  ! dummy loop indices
+      INTEGER , POINTER, DIMENSION(:,:) ::  nb, iwork
+      REAL(wp), POINTER, DIMENSION(:,:) ::  work    ! temporary 2D workspace
+      !!----------------------------------------------------------------------
+      !
+      CALL wrk_alloc( jpi, jpj, nb, iwork ) 
+      CALL wrk_alloc( jpi, jpj, work      ) 
+      !
       iwork(:,:) = 0
 
@@ -565,7 +551,7 @@
       !! htnew contains valid ocean depths from htold, or zero
 
-      !! set work to a smoothed/averaged version of htnew; choice controlled by option
+      !! set work to a smoothed/averaged version of htnew; choice controlled by ld_option
       !! nb is set to the sum of the weights of the valid values used in work
-      IF( option ) THEN
+      IF( ld_option ) THEN
 
          !! Apply scale-selective smoothing in determining work from htnew
@@ -615,7 +601,8 @@
       END WHERE
 
-!!    Deallocate temporary workspace arrays, all local to this routine
-      DEALLOCATE( work, nb, iwork )
-
+      !!    Deallocate temporary workspace arrays, all local to this routine
+      CALL wrk_dealloc( jpi, jpj, nb, iwork ) 
+      CALL wrk_dealloc( jpi, jpj, work      ) 
+      !
    END SUBROUTINE dyn_nept_smooth_vel
 
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynnxt.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynnxt.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynnxt.F90	(revision 3161)
@@ -44,4 +44,5 @@
    USE agrif_opa_interp
 #endif
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -105,5 +106,6 @@
       REAL(wp), POINTER, DIMENSION(:,:,:) ::  ze3u_f, ze3v_f 
       !!----------------------------------------------------------------------
-
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_nxt')
       !
       ze3u_f => tsa(:,:,:,1) 
@@ -279,4 +281,6 @@
          &                       tab3d_2=vn, clinfo2=' Vn: '       , mask2=vmask )
       ! 
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_nxt')
+      !
    END SUBROUTINE dyn_nxt
 
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg.F90	(revision 3161)
@@ -28,4 +28,7 @@
    USE lib_mpp        ! MPP library
    USE solver          ! solver initialization
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
+
 
    IMPLICIT NONE
@@ -73,6 +76,4 @@
       !!        of the physical meaning of the results. 
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   ztrdu => wrk_3d_4 , ztrdv => wrk_3d_5    ! 3D workspace
       !
       INTEGER, INTENT(in   ) ::   kt       ! ocean time-step index
@@ -81,9 +82,9 @@
       INTEGER  ::   ji, jj, jk                             ! dummy loop indices
       REAL(wp) ::   z2dt, zg_2                             ! temporary scalar
-      !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(3, 4,5) ) THEN
-         CALL ctl_stop('dyn_spg: requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrdu, ztrdv
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_spg')
+      !
 
 !!gm NOTA BENE : the dynspg_exp and dynspg_ts should be modified so that 
@@ -93,4 +94,5 @@
 
       IF( l_trddyn )   THEN                      ! temporary save of ta and sa trends
+         CALL wrk_alloc( jpi, jpj, jpk, ztrdu, ztrdv ) 
          ztrdu(:,:,:) = ua(:,:,:)
          ztrdv(:,:,:) = va(:,:,:)
@@ -148,4 +150,6 @@
          END SELECT
          CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_spg, 'DYN', kt )
+         !
+         CALL wrk_dealloc( jpi, jpj, jpk, ztrdu, ztrdv ) 
       ENDIF
       !                                          ! print mean trends (used for debugging)
@@ -153,5 +157,5 @@
          &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
-      IF( wrk_not_released(3, 4,5) )   CALL ctl_stop('dyn_spg: failed to release workspace arrays')
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_spg')
       !
    END SUBROUTINE dyn_spg
@@ -167,5 +171,7 @@
       INTEGER ::   ioptio
       !!----------------------------------------------------------------------
-
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_spg_init')
+      !
       IF(lwp) THEN             ! Control print
          WRITE(numout,*)
@@ -220,5 +226,6 @@
          IF( .NOT.ln_dynadv_vec )   CALL ctl_stop( 'Flux form not implemented for this free surface formulation' )
       ENDIF
-
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_spg_init')
       !
    END SUBROUTINE dyn_spg_init
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_exp.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_exp.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_exp.F90	(revision 3161)
@@ -28,4 +28,6 @@
    USE iom             ! I/O library
    USE restart         ! only for lrst_oce
+   USE timing          ! Timing
+
 
    IMPLICIT NONE
@@ -65,5 +67,7 @@
       INTEGER ::   ji, jj, jk   ! dummy loop indices
       !!----------------------------------------------------------------------
-
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_spg_exp')
+      !
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -100,4 +104,6 @@
       ENDIF
       !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_spg_exp')
+      !
    END SUBROUTINE dyn_spg_exp
 
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_flt.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_flt.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_flt.F90	(revision 3161)
@@ -49,4 +49,5 @@
    USE agrif_opa_interp
 #endif
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -113,4 +114,6 @@
       !!----------------------------------------------------------------------
       !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_spg_flt')
+      !
       zub => tsa(:,:,:,1) 
       zvb => tsa(:,:,:,2) 
@@ -350,4 +353,6 @@
       IF( lrst_oce ) CALL flt_rst( kt, 'WRITE' )
       !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_spg_flt')
+      !
    END SUBROUTINE dyn_spg_flt
 
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynspg_ts.F90	(revision 3161)
@@ -42,5 +42,8 @@
    USE iom             ! IOM library
    USE restart         ! only for lrst_oce
-   USE zdf_oce
+   USE zdf_oce         ! Vertical diffusion
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
+
 
    IMPLICIT NONE
@@ -108,11 +111,4 @@
       !! References : Griffies et al., (2003): A technical guide to MOM4. NOAA/GFDL
       !!---------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   zsshun_e => wrk_2d_1 , zsshb_e  => wrk_2d_2  , zhdiv => wrk_2d_3
-      USE wrk_nemo, ONLY:   zsshvn_e => wrk_2d_4 , zssh_sum => wrk_2d_5
-      USE wrk_nemo, ONLY:   zcu => wrk_2d_6  , zwx   => wrk_2d_7  , zua   => wrk_2d_8  , zbfru  => wrk_2d_9
-      USE wrk_nemo, ONLY:   zcv => wrk_2d_10 , zwy   => wrk_2d_11 , zva   => wrk_2d_12 , zbfrv  => wrk_2d_13
-      USE wrk_nemo, ONLY:   zun => wrk_2d_14 , zun_e => wrk_2d_15 , zub_e => wrk_2d_16 , zu_sum => wrk_2d_17
-      USE wrk_nemo, ONLY:   zvn => wrk_2d_18 , zvn_e => wrk_2d_19 , zvb_e => wrk_2d_20 , zv_sum => wrk_2d_21
       !
       INTEGER, INTENT(in)  ::   kt   ! ocean time-step index
@@ -127,11 +123,16 @@
       REAL(wp) ::   zv_spg, zv_cor, zv_sld, zv_asp            !   -      -
       REAL(wp) ::   ua_btm, va_btm                            !   -      -
+      !
+      REAL(wp), POINTER, DIMENSION(:,:) :: zsshun_e, zsshvn_e, zsshb_e, zssh_sum, zhdiv 
+      REAL(wp), POINTER, DIMENSION(:,:) :: zua, zva, zun, zvn, zun_e, zvn_e, zub_e, zvb_e 
+      REAL(wp), POINTER, DIMENSION(:,:) :: zcu, zcv, zwx, zwy, zbfru, zbfrv, zu_sum, zv_sum
       !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(2,  1, 2, 3, 4, 5, 6, 7, 8, 9,10,     &
-         &              11,12,13,14,15,16,17,18,19,20,21 ) ) THEN
-         CALL ctl_stop( 'dyn_spg_ts: requested workspace arrays unavailable' )   ;   RETURN
-      ENDIF
-
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_spg_ts')
+      !
+      CALL wrk_alloc( jpi, jpj, zsshun_e, zsshvn_e, zsshb_e, zssh_sum, zhdiv     )
+      CALL wrk_alloc( jpi, jpj, zua, zva, zun, zvn, zun_e, zvn_e, zub_e, zvb_e   )
+      CALL wrk_alloc( jpi, jpj, zcu, zcv, zwx, zwy, zbfru, zbfrv, zu_sum, zv_sum )
+      !
       IF( kt == nit000 ) THEN             !* initialisation
          !
@@ -680,8 +681,9 @@
       IF( lrst_oce )   CALL ts_rst( kt, 'WRITE' )
       !
-      !
-      IF( wrk_not_released(2,  1, 2, 3, 4, 5, 6, 7, 8, 9,10,         &
-         &                    11,12,13,14,15,16,17,18,19,20,21) )    &
-         CALL ctl_stop('dyn_spg_ts: failed to release workspace arrays')
+      CALL wrk_dealloc( jpi, jpj, zsshun_e, zsshvn_e, zsshb_e, zssh_sum, zhdiv     )
+      CALL wrk_dealloc( jpi, jpj, zua, zva, zun, zvn, zun_e, zvn_e, zub_e, zvb_e   )
+      CALL wrk_dealloc( jpi, jpj, zcu, zcv, zwx, zwy, zbfru, zbfrv, zu_sum, zv_sum )
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_spg_ts')
       !
    END SUBROUTINE dyn_spg_ts
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynvor.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynvor.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynvor.F90	(revision 3161)
@@ -34,5 +34,8 @@
    USE prtctl         ! Print control
    USE in_out_manager ! I/O manager
-   USE lib_mpp
+   USE lib_mpp        ! MPP library
+   USE wrk_nemo_2     ! Memory Allocation
+   USE timing         ! Timing
+
 
    IMPLICIT NONE
@@ -78,4 +81,6 @@
       REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrdu, ztrdv
       !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_vor')
       !
       IF( l_trddyn )   THEN
@@ -183,4 +188,6 @@
          &                     tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_vor')
+      !
    END SUBROUTINE dyn_vor
 
@@ -212,6 +219,4 @@
       !! References : Sadourny, r., 1975, j. atmos. sciences, 32, 680-689.
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   zwx => wrk_2d_1 , zwy => wrk_2d_2 , zwz => wrk_2d_3     ! 2D workspace
       !
       INTEGER , INTENT(in   )                         ::   kt     ! ocean time-step index
@@ -223,10 +228,11 @@
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
       REAL(wp) ::   zx1, zy1, zfact2, zx2, zy2   ! local scalars
-      !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(2, 1,2,3) ) THEN
-         CALL ctl_stop('dyn:vor_ene: requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
-
+      REAL(wp), POINTER, DIMENSION(:,:) :: zwx, zwy, zwz
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('vor_ene')
+      !
+      CALL wrk_alloc( jpi, jpj, zwx, zwy, zwz ) 
+      !
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -292,5 +298,7 @@
       END DO                                           !   End of slab
       !                                                ! ===============
-      IF( wrk_not_released(2, 1,2,3) )   CALL ctl_stop('dyn:vor_ene: failed to release workspace arrays')
+      CALL wrk_dealloc( jpi, jpj, zwx, zwy, zwz ) 
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('vor_ene')
       !
    END SUBROUTINE vor_ene
@@ -328,6 +336,4 @@
       !! References : Sadourny, r., 1975, j. atmos. sciences, 32, 680-689.
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   zwx => wrk_2d_4 , zwy => wrk_2d_5 , zwz => wrk_2d_6 , zww => wrk_2d_7   ! 2D workspace
       !
       INTEGER, INTENT(in) ::   kt   ! ocean timestep index
@@ -336,10 +342,11 @@
       REAL(wp) ::   zfact1, zua, zcua, zx1, zy1   ! local scalars
       REAL(wp) ::   zfact2, zva, zcva, zx2, zy2   !   -      -
-      !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(2, 4,5,6,7) ) THEN
-         CALL ctl_stop('dyn:vor_mix: requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
-
+      REAL(wp), POINTER, DIMENSION(:,:) :: zwx, zwy, zwz, zww
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('vor_mix')
+      !
+      CALL wrk_alloc( jpi, jpj, zwx, zwy, zwz, zww ) 
+      !
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -412,5 +419,7 @@
       END DO                                           !   End of slab
       !                                                ! ===============
-      IF( wrk_not_released(2, 4,5,6,7) )   CALL ctl_stop('dyn:vor_mix: failed to release workspace arrays')
+      CALL wrk_dealloc( jpi, jpj, zwx, zwy, zwz, zww ) 
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('vor_mix')
       !
    END SUBROUTINE vor_mix
@@ -443,6 +452,4 @@
       !! References : Sadourny, r., 1975, j. atmos. sciences, 32, 680-689.
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   zwx => wrk_2d_4, zwy => wrk_2d_5, zwz => wrk_2d_6    ! 2D workspace
       !
       INTEGER , INTENT(in   )                         ::   kt     ! ocean time-step index
@@ -454,10 +461,11 @@
       INTEGER  ::   ji, jj, jk           ! dummy loop indices
       REAL(wp) ::   zfact1, zuav, zvau   ! temporary scalars
-      !!----------------------------------------------------------------------
-      
-      IF( wrk_in_use(2, 4,5,6) ) THEN
-         CALL ctl_stop('dyn:vor_ens: requested workspace arrays unavailable')   ;   RETURN
-      END IF
-
+      REAL(wp), POINTER, DIMENSION(:,:) :: zwx, zwy, zwz, zww
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('vor_ens')
+      !
+      CALL wrk_alloc( jpi, jpj, zwx, zwy, zwz ) 
+      !
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -531,5 +539,7 @@
       END DO                                           !   End of slab
       !                                                ! ===============
-      IF( wrk_not_released(2, 4,5,6) )   CALL ctl_stop('dyn:vor_ens: failed to release workspace arrays')
+      CALL wrk_dealloc( jpi, jpj, zwx, zwy, zwz ) 
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('vor_ens')
       !
    END SUBROUTINE vor_ens
@@ -555,11 +565,4 @@
       !! References : Arakawa and Lamb 1980, Mon. Wea. Rev., 109, 18-36
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   zwx  => wrk_2d_1 , zwy  => wrk_2d_2 ,  zwz => wrk_2d_3     ! 2D workspace
-      USE wrk_nemo, ONLY:   ztnw => wrk_2d_4 , ztne => wrk_2d_5 
-      USE wrk_nemo, ONLY:   ztsw => wrk_2d_6 , ztse => wrk_2d_7
-#if defined key_vvl
-      USE wrk_nemo, ONLY:   ze3f => wrk_3d_1                                           ! 3D workspace (lk_vvl=T)
-#endif
       !
       INTEGER , INTENT(in   )                         ::   kt     ! ocean time-step index
@@ -569,16 +572,26 @@
       REAL(wp), INTENT(inout), DIMENSION(jpi,jpj,jpk) ::   pva    ! total v-trend
       !!
-      INTEGER  ::   ji, jj, jk         ! dummy loop indices
-      INTEGER  ::   ierr               ! local integer
-      REAL(wp) ::   zfac12, zua, zva   ! local scalars
+      INTEGER  ::   ji, jj, jk                                    ! dummy loop indices
+      INTEGER  ::   ierr                                          ! local integer
+      REAL(wp) ::   zfac12, zua, zva                              ! local scalars
+      !                                                           !  3D workspace 
+      REAL(wp), POINTER    , DIMENSION(:,:  )         :: zwx, zwy, zwz
+      REAL(wp), POINTER    , DIMENSION(:,:  )         :: ztnw, ztne, ztsw, ztse
+#if defined key_vvl
+      REAL(wp), POINTER    , DIMENSION(:,:,:)         :: ze3f     !  3D workspace (lk_vvl=T)
+#endif
 #if ! defined key_vvl
-      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), SAVE ::   ze3f     ! lk_vvl=F, ze3f=1/e3f saved one for all
+      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), SAVE   :: ze3f     ! lk_vvl=F, ze3f=1/e3f saved one for all
 #endif
       !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(2, 1,2,3,4,5,6,7) .OR. wrk_in_use(3, 1) ) THEN
-         CALL ctl_stop('dyn:vor_een: requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
-
+      !
+      IF( nn_timing == 1 )  CALL timing_start('vor_een')
+      !
+      CALL wrk_alloc( jpi, jpj,      zwx , zwy , zwz        ) 
+      CALL wrk_alloc( jpi, jpj,      ztnw, ztne, ztsw, ztse ) 
+#if defined key_vvl
+      CALL wrk_alloc( jpi, jpj, jpk, ze3f                   )
+#endif
+      !
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -678,6 +691,11 @@
       END DO                                           !   End of slab
       !                                                ! ===============
-      IF( wrk_not_released(2, 1,2,3,4,5,6,7) .OR.   &
-          wrk_not_released(3, 1)             )   CALL ctl_stop('dyn:vor_een: failed to release workspace arrays')
+      CALL wrk_dealloc( jpi, jpj,      zwx , zwy , zwz        ) 
+      CALL wrk_dealloc( jpi, jpj,      ztnw, ztne, ztsw, ztse ) 
+#if defined key_vvl
+      CALL wrk_dealloc( jpi, jpj, jpk, ze3f                   )
+#endif
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('vor_een')
       !
    END SUBROUTINE vor_een
@@ -713,5 +731,5 @@
       ! If energy, enstrophy or mixed advection of momentum in vector form change the value for masks
       ! at angles with three ocean points and one land point
-      IF( ln_vorlat .AND. (ln_dynvor_ene .OR. ln_dynvor_ens .OR. ln_dynvor_mix) ) THEN
+      IF( ln_vorlat .AND. ( ln_dynvor_ene .OR. ln_dynvor_ens .OR. ln_dynvor_mix ) ) THEN
          DO jk = 1, jpk
             DO jj = 2, jpjm1
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynzad.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynzad.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynzad.F90	(revision 3161)
@@ -21,4 +21,6 @@
    USE lib_mpp         ! MPP library
    USE prtctl         ! Print control
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -53,8 +55,5 @@
       !!              - Save the trends in (ztrdu,ztrdv) ('key_trddyn')
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   zww   => wrk_2d_1                        ! 2D workspace
       USE oce     , ONLY:   tsa             ! tsa used as 2 3D workspace
-      USE wrk_nemo, ONLY:   ztrdu => wrk_3d_1 , ztrdv => wrk_3d_2    ! 3D workspace
       !!
       INTEGER, INTENT(in) ::   kt   ! ocean time-step inedx
@@ -63,9 +62,11 @@
       REAL(wp) ::   zua, zva        ! temporary scalars
       REAL(wp), POINTER, DIMENSION(:,:,:) ::  zwuw , zwvw
+      REAL(wp), POINTER, DIMENSION(:,:  ) ::  zww
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrdu, ztrdv
       !!----------------------------------------------------------------------
-      
-      IF( wrk_in_use(2, 1) .OR. wrk_in_use(3, 1,2) ) THEN 
-         CALL ctl_stop('dyn_zad: requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_zad')
+      !
+      CALL wrk_alloc( jpi, jpj, zww ) 
       !
       zwuw  => tsa(:,:,:,1) 
@@ -78,4 +79,5 @@
 
       IF( l_trddyn )   THEN         ! Save ua and va trends
+         CALL wrk_alloc( jpi, jpj, jpk, ztrdu, ztrdv ) 
          ztrdu(:,:,:) = ua(:,:,:) 
          ztrdv(:,:,:) = va(:,:,:) 
@@ -121,4 +123,5 @@
          ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
          CALL trd_mod(ztrdu, ztrdv, jpdyn_trd_zad, 'DYN', kt)
+         CALL wrk_dealloc( jpi, jpj, jpk, ztrdu, ztrdv ) 
       ENDIF
       !                             ! Control print
@@ -126,6 +129,7 @@
          &                       tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
-      IF( wrk_not_released(2, 1)   .OR.   &
-          wrk_not_released(3, 1,2) )   CALL ctl_stop('dyn_zad: failed to release workspace arrays')
+      CALL wrk_dealloc( jpi, jpj, zww ) 
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_zad')
       !
    END SUBROUTINE dyn_zad
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf.F90	(revision 3161)
@@ -25,4 +25,6 @@
    USE lib_mpp         ! MPP library
    USE prtctl          ! Print control
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -53,13 +55,12 @@
       !! ** Purpose :   compute the vertical ocean dynamics physics.
       !!---------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   ztrdu => wrk_3d_1 , ztrdv => wrk_3d_2    ! 3D workspace
       !!
       INTEGER, INTENT( in ) ::   kt      ! ocean time-step index
+      !
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrdu, ztrdv
       !!---------------------------------------------------------------------
-
-      IF( wrk_in_use(3, 1,2) ) THEN
-         CALL ctl_stop('dyn_zdf: requested workspace arrays unavailable')   ;   RETURN
-      END IF
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_zdf')
+      !
       !                                          ! set time step
       IF( neuler == 0 .AND. kt == nit000     ) THEN   ;   r2dt =      rdt   ! = rdtra (restart with Euler time stepping)
@@ -68,4 +69,5 @@
 
       IF( l_trddyn )   THEN                      ! temporary save of ta and sa trends
+         CALL wrk_alloc( jpi, jpj, jpk, ztrdu, ztrdv ) 
          ztrdu(:,:,:) = ua(:,:,:)
          ztrdv(:,:,:) = va(:,:,:)
@@ -90,4 +92,6 @@
          ztrdv(:,:,:) = va(:,:,:) - ztrdv(:,:,:)
          CALL trd_mod( ztrdu, ztrdv, jpdyn_trd_zdf, 'DYN', kt )
+         !
+         CALL wrk_dealloc( jpi, jpj, jpk, ztrdu, ztrdv ) 
       ENDIF
       !                                          ! print mean trends (used for debugging)
@@ -95,5 +99,5 @@
             &                    tab3d_2=va, clinfo2=       ' Va: ', mask2=vmask, clinfo3='dyn' )
       !
-      IF( wrk_not_released(3, 1,2) )   CALL ctl_stop('dyn_zdf: failed to release workspace arrays')
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_zdf')
       !
    END SUBROUTINE dyn_zdf
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_exp.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_exp.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_exp.F90	(revision 3161)
@@ -22,4 +22,7 @@
    USE in_out_manager  ! I/O manager
    USE lib_mpp         ! MPP library
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
+
 
    IMPLICIT NONE
@@ -54,7 +57,5 @@
       !! ** Action : - Update (ua,va) with the vertical diffusive trend
       !!---------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
       USE oce     , ONLY:   tsa             ! tsa used as 2 3D workspace
-      USE wrk_nemo, ONLY:   zwz => wrk_3d_3 , zww => wrk_3d_4   ! 3D workspace
       !
       INTEGER , INTENT(in) ::   kt     ! ocean time-step index
@@ -64,9 +65,10 @@
       REAL(wp) ::   zrau0r, zlavmr, zua, zva   ! local scalars
       REAL(wp), POINTER, DIMENSION(:,:,:) ::  zwx, zwy
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  zwz, zww
       !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(3, 3,4) ) THEN
-         CALL ctl_stop('dyn_zdf_exp: requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_zdf_exp')
+      !
+      CALL wrk_alloc( jpi, jpj, jpk, zwz, zww ) 
       !
       zwx => tsa(:,:,:,1) 
@@ -124,5 +126,7 @@
       END DO                           ! End of time splitting
       !
-      IF( wrk_not_released(3, 3,4) )   CALL ctl_stop('dyn_zdf_exp: failed to release workspace arrays')
+      CALL wrk_dealloc( jpi, jpj, jpk, zwz, zww ) 
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_zdf_exp')
       !
    END SUBROUTINE dyn_zdf_exp
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_imp.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_imp.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/dynzdf_imp.F90	(revision 3161)
@@ -21,4 +21,6 @@
    USE lib_mpp         ! MPP library
    USE zdfbfr          ! bottom friction setup
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -55,9 +57,7 @@
       !! ** Action : - Update (ua,va) arrays with the after vertical diffusive mixing trend.
       !!---------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE oce     , ONLY:   tsa             ! tsa used as 2 3D workspace
-      USE wrk_nemo, ONLY:   zwi => wrk_3d_3                 ! 3D workspace
-      !!
-      INTEGER , INTENT(in) ::   kt    ! ocean time-step index
+      USE oce     , ONLY:   tsa       ! tsa used as 2 3D workspace
+      !!
+      INTEGER , INTENT(in) ::  kt     ! ocean time-step index
       REAL(wp), INTENT(in) ::  p2dt   ! vertical profile of tracer time-step
       !!
@@ -69,11 +69,11 @@
       REAL(wp) ::   zbfru, zbfrv 
       REAL(wp) ::   zbfr_imp = 0._wp                        ! toggle (SAVE'd by assignment) 
+      REAL(wp), POINTER, DIMENSION(:,:,:) ::  zwi
       REAL(wp), POINTER, DIMENSION(:,:,:) ::  zwd, zws
       !!----------------------------------------------------------------------
-      !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(3, 3) ) THEN
-         CALL ctl_stop('dyn_zdf_imp: requested workspace array unavailable')   ;   RETURN
-      END IF
+      !
+      IF( nn_timing == 1 )  CALL timing_start('dyn_zdf_imp')
+      !
+      CALL wrk_alloc( jpi, jpj, jpk, zwi ) 
       !
       zwd => tsa(:,:,:,1) 
@@ -251,7 +251,8 @@
       END DO
       !
-      IF( wrk_not_released(3, 3) )   CALL ctl_stop('dyn_zdf_imp: failed to release workspace array')
-      !
-
+      CALL wrk_dealloc( jpi, jpj, jpk, zwi ) 
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('dyn_zdf_imp')
+      !
    END SUBROUTINE dyn_zdf_imp
 
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/sshwzv.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/sshwzv.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/DYN/sshwzv.F90	(revision 3161)
@@ -39,4 +39,6 @@
    USE asminc          ! Assimilation increment
 #endif
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -75,7 +77,5 @@
       !! Reference  : Leclair, M., and G. Madec, 2009, Ocean Modelling.
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
       USE oce     , ONLY: tsa             ! tsa used as 2 3D workspace
-      USE wrk_nemo, ONLY: zhdiv => wrk_2d_1, z2d => wrk_2d_2
       !!
       INTEGER, INTENT(in) ::   kt   ! time step
@@ -83,11 +83,12 @@
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
       REAL(wp) ::   zcoefu, zcoefv, zcoeff, z2dt, z1_2dt, z1_rau0   ! local scalars
+      REAL(wp), POINTER, DIMENSION(:,:  ) ::  z2d, zhdiv
       REAL(wp), POINTER, DIMENSION(:,:,:) ::  z3d
       !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(2, 1,2) ) THEN
-         CALL ctl_stop('ssh_wzv: requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
-
+      !
+      IF( nn_timing == 1 )  CALL timing_start('ssh_wzv')
+      !
+      CALL wrk_alloc( jpi, jpj, z2d, zhdiv ) 
+      !
       IF( kt == nit000 ) THEN
          !
@@ -242,5 +243,7 @@
       IF(ln_ctl)   CALL prt_ctl( tab2d_1=ssha, clinfo1=' ssha  - : ', mask1=tmask, ovlap=1 )
       !
-      IF( wrk_not_released(2, 1,2) )   CALL ctl_stop('ssh_wzv: failed to release workspace arrays')
+      CALL wrk_dealloc( jpi, jpj, z2d, zhdiv ) 
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('ssh_wzv')
       !
    END SUBROUTINE ssh_wzv
@@ -271,5 +274,7 @@
       REAL(wp) ::   zec      ! temporary scalar
       !!----------------------------------------------------------------------
-
+      !
+      IF( nn_timing == 1 )  CALL timing_start('ssh_nxt')
+      !
       IF( kt == nit000 ) THEN
          IF(lwp) WRITE(numout,*)
@@ -356,4 +361,6 @@
       IF(ln_ctl)   CALL prt_ctl( tab2d_1=sshb, clinfo1=' sshb  - : ', mask1=tmask, ovlap=1 )
       !
+      IF( nn_timing == 1 )  CALL timing_stop('ssh_nxt')
+      !
    END SUBROUTINE ssh_nxt
 
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/nemogcm.F90	(revision 3161)
@@ -56,7 +56,5 @@
    USE phycst          ! physical constant                  (par_cst routine)
    USE trdmod          ! momentum/tracers trends       (trd_mod_init routine)
-   USE asminc          ! assimilation increments       (asm_inc_init routine)
    USE asmtrj          ! writing out state trajectory
-   USE sshwzv          ! vertical velocity used in asm
    USE diaptr          ! poleward transports           (dia_ptr_init routine)
    USE diadct          ! sections transports           (dia_dct_init routine)
@@ -70,5 +68,4 @@
    USE c1d             ! 1D configuration
    USE step_c1d        ! Time stepping loop for the 1D configuration
-   USE dynnept         ! simplified form of Neptune effect
 #if defined key_top
    USE trcini          ! passive tracer initialisation
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/step.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/step.F90	(revision 3161)
@@ -36,6 +36,4 @@
    USE agrif_opa_sponge ! Momemtum and tracers sponges
 #endif
-   USE asminc           ! assimilation increments    (tra_asm_inc, dyn_asm_inc routines)
-   USE dynnept          ! simplified form of Neptune effect
 
    IMPLICIT NONE
Index: /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/step_oce.F90
===================================================================
--- /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/step_oce.F90	(revision 3160)
+++ /branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/step_oce.F90	(revision 3161)
@@ -45,4 +45,6 @@
    USE dynspg_oce       ! surface pressure gradient        (dyn_spg routine)
    USE dynspg           ! surface pressure gradient        (dyn_spg routine)
+   USE dynnept          ! simp. form of Neptune effect(dyn_nept_cor routine)
+
    USE dynnxt           ! time-stepping                    (dyn_nxt routine)
 
@@ -89,4 +91,7 @@
    USE floats           ! floats computation               (flo_stp routine)
 
+   USE asminc           ! assimilation increments      (tra_asm_inc routine)
+   !                                                   (dyn_asm_inc routine)
+
    USE stpctl           ! time stepping control            (stp_ctl routine)
    USE restart          ! ocean restart                    (rst_wri routine)
