Index: branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_bilapg.F90
===================================================================
--- branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_bilapg.F90	(revision 3116)
+++ branches/2011/dev_NEMO_MERGE_2011/NEMOGCM/NEMO/OPA_SRC/TRA/traldf_bilapg.F90	(revision 3159)
@@ -25,4 +25,6 @@
    USE trc_oce         ! share passive tracers/Ocean variables
    USE lib_mpp         ! MPP library
+   USE wrk_nemo_2      ! Memory Allocation
+   USE timing          ! Timing
 
    IMPLICIT NONE
@@ -66,6 +68,4 @@
       !!               biharmonic mixing trend.
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released
-      USE wrk_nemo, ONLY:   wk1 => wrk_4d_1 , wk2 => wrk_4d_2     ! 4D workspace
       !
       INTEGER         , INTENT(in   )                      ::   kt       ! ocean time-step index
@@ -77,10 +77,11 @@
       !
       INTEGER ::   ji, jj, jk, jn   ! dummy loop indices
-      !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(4, 1,2) ) THEN
-         CALL ctl_stop('tra_ldf_bilapg: requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
-
+      REAL(wp), POINTER, DIMENSION(:,:,:,:) :: zwk1, zwk2 
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('tra_ldf_bilapg')
+      !
+      CALL wrk_alloc( jpi, jpj, jpk, kjpt, zwk1, zwk2 ) 
+      !
       IF( kt == kit000 )  THEN
          IF(lwp) WRITE(numout,*)
@@ -91,14 +92,14 @@
       ! 1. Laplacian of ptb * aht
       ! ----------------------------- 
-      CALL ldfght( kt, cdtype, ptb, wk1, kjpt, 1 )      ! rotated harmonic operator applied to ptb and multiply by aht 
+      CALL ldfght( kt, cdtype, ptb, zwk1, kjpt, 1 )      ! rotated harmonic operator applied to ptb and multiply by aht 
       !                                                 ! output in wk1 
       !
       DO jn = 1, kjpt
-         CALL lbc_lnk( wk1(:,:,:,jn) , 'T', 1. )        ! Lateral boundary conditions on wk1   (unchanged sign)
+         CALL lbc_lnk( zwk1(:,:,:,jn) , 'T', 1. )        ! Lateral boundary conditions on wk1   (unchanged sign)
       END DO
 
       ! 2. Bilaplacian of ptb
       ! -------------------------
-      CALL ldfght( kt, cdtype, wk1, wk2, kjpt, 2 )      ! rotated harmonic operator applied to wk1 ; output in wk2
+      CALL ldfght( kt, cdtype, zwk1, zwk2, kjpt, 2 )      ! rotated harmonic operator applied to wk1 ; output in wk2
 
 
@@ -110,5 +111,5 @@
                DO ji = 2, jpim1
                   ! add it to the general tracer trends
-                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + wk2(ji,jj,jk,jn)
+                  pta(ji,jj,jk,jn) = pta(ji,jj,jk,jn) + zwk2(ji,jj,jk,jn)
                END DO
             END DO
@@ -116,5 +117,7 @@
       END DO
       !
-      IF( wrk_not_released(4, 1,2) )   CALL ctl_stop('tra_ldf_bilapg : failed to release workspace arrays.')
+      CALL wrk_dealloc( jpi, jpj, jpk, kjpt, zwk1, zwk2 ) 
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('tra_ldf_bilapg')
       !
    END SUBROUTINE tra_ldf_bilapg
@@ -159,9 +162,5 @@
       !!
       !!----------------------------------------------------------------------
-      USE wrk_nemo, ONLY:   wrk_in_use, wrk_not_released, wrk_in_use_xz, wrk_not_released_xz
       USE oce     , ONLY:   zftv => ua       ! ua used as workspace
-      USE wrk_nemo, ONLY:   zftu => wrk_2d_1 , zdkt  => wrk_2d_2 , zdk1t => wrk_2d_3
-      USE wrk_nemo, ONLY:   zftw => wrk_xz_1 , zdit  => wrk_xz_2 
-      USE wrk_nemo, ONLY:   zdjt => wrk_xz_3 , zdj1t => wrk_xz_4
       !
       INTEGER         , INTENT(in )                              ::  kt      ! ocean time-step index
@@ -180,9 +179,12 @@
       REAL(wp) ::  zbtr, ztah, ztav
       REAL(wp) ::  zcof0, zcof1, zcof2, zcof3, zcof4
-      !!----------------------------------------------------------------------
-
-      IF( wrk_in_use(2, 1,2,3) .OR. wrk_in_use_xz(1,2,3,4) )THEN
-         CALL ctl_stop('ldfght : requested workspace arrays unavailable')   ;   RETURN
-      ENDIF
+      REAL(wp), POINTER, DIMENSION(:,:) ::  zftu, zdkt, zdk1t
+      REAL(wp), POINTER, DIMENSION(:,:) ::  zftw, zdit, zdjt, zdj1t
+      !!----------------------------------------------------------------------
+      !
+      IF( nn_timing == 1 )  CALL timing_start('ldfght')
+      !
+      CALL wrk_alloc( jpi, jpj, zftu, zdkt, zdk1t ) 
+      CALL wrk_alloc( jpi, jpk, zftw, zdit, zdjt, zdj1t ) 
       !
       DO jn = 1, kjpt
@@ -336,6 +338,8 @@
       END DO
       !
-      IF( wrk_not_released(2, 1,2,3)   .OR.   &
-          wrk_not_released_xz(1,2,3,4) )   CALL ctl_stop('ldfght : failed to release workspace arrays.')
+      CALL wrk_dealloc( jpi, jpj, zftu, zdkt, zdk1t ) 
+      CALL wrk_dealloc( jpi, jpk, zftw, zdit, zdjt, zdj1t ) 
+      !
+      IF( nn_timing == 1 )  CALL timing_stop('ldfght')
       !
    END SUBROUTINE ldfght
