Index: trunk/NEMOGCM/NEMO/NST_SRC/agrif_opa_interp.F90
===================================================================
--- trunk/NEMOGCM/NEMO/NST_SRC/agrif_opa_interp.F90	(revision 2528)
+++ trunk/NEMOGCM/NEMO/NST_SRC/agrif_opa_interp.F90	(revision 2715)
@@ -25,4 +25,6 @@
    USE phycst
    USE in_out_manager
+   USE agrif_opa_sponge
+   USE lib_mpp
 
    IMPLICIT NONE
@@ -45,11 +47,20 @@
       !!                  ***  ROUTINE Agrif_Tra  ***
       !!----------------------------------------------------------------------
+      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
+      USE wrk_nemo, ONLY: wrk_3d_1, wrk_3d_2
+      !!
       INTEGER  ::   ji, jj, jk   ! dummy loop indices
       REAL(wp) ::   zrhox , alpha1, alpha2, alpha3
       REAL(wp) ::   alpha4, alpha5, alpha6, alpha7
-      REAL(wp), DIMENSION(jpi,jpj,jpk) ::   zta, zsa   ! 3D workspace
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zta, zsa
       !!----------------------------------------------------------------------
       !
       IF( Agrif_Root() )   RETURN
+
+      zta => wrk_3d_1 ; zsa => wrk_3d_2
+      IF( wrk_in_use(3, 1,2) )THEN
+         CALL ctl_stop('agrif_tra: requested workspace arrays unavailable.')
+         RETURN
+      END IF
 
       Agrif_SpecialValue    = 0.e0
@@ -58,6 +69,6 @@
       zsa(:,:,:) = 0.e0
 
-      CALL Agrif_Bc_variable( zta, tn )
-      CALL Agrif_Bc_variable( zsa, sn )
+      CALL Agrif_Bc_variable( zta, tn_id, procname = interptn )
+      CALL Agrif_Bc_variable( zsa, sn_id, procname = interpsn )
       Agrif_UseSpecialValue = .FALSE.
 
@@ -162,4 +173,8 @@
       ENDIF
       !
+      IF( wrk_not_released(3, 1,2) ) THEN
+         CALL ctl_stop('agrif_tra: failed to release workspace arrays.')
+      ENDIF
+      !
    END SUBROUTINE Agrif_tra
 
@@ -169,4 +184,9 @@
       !!                  ***  ROUTINE Agrif_DYN  ***
       !!----------------------------------------------------------------------  
+      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
+      USE wrk_nemo, ONLY: wrk_2d_4, wrk_2d_5
+      USE wrk_nemo, ONLY: wrk_2d_6, wrk_2d_7
+      USE wrk_nemo, ONLY: wrk_3d_1, wrk_3d_2
+      !! 
       INTEGER, INTENT(in) ::   kt
       !!
@@ -175,10 +195,17 @@
       REAL(wp) :: z2dt, znugdt
       REAL(wp) :: zrhox, rhoy
-      REAL(wp), DIMENSION(jpi,jpj) :: zua2d, zva2d
-      REAL(wp), DIMENSION(jpi,jpj) :: spgu1,spgv1
-      REAL(wp), DIMENSION(jpi,jpj,jpk) :: zua, zva
+      REAL(wp), POINTER, DIMENSION(:,:,:) :: zua, zva
+      REAL(wp), POINTER, DIMENSION(:,:) :: spgv1, spgu1, zua2d, zva2d
       !!----------------------------------------------------------------------  
 
       IF( Agrif_Root() )   RETURN
+
+      spgu1  => wrk_2d_4 ; spgv1 => wrk_2d_5
+      zua2d  => wrk_2d_6 ; zva2d => wrk_2d_7
+      zua  => wrk_3d_1 ; zva => wrk_3d_2
+      IF( wrk_in_use(2, 4,5,6,7) .OR. wrk_in_use(3, 1,2) )THEN
+         CALL ctl_stop('agrif_dyn: requested workspace arrays unavailable.')
+         RETURN
+      END IF
 
       zrhox = Agrif_Rhox()
@@ -199,6 +226,6 @@
       zua = 0.
       zva = 0.
-      CALL Agrif_Bc_variable(zua,un,procname=interpu)
-      CALL Agrif_Bc_variable(zva,vn,procname=interpv)
+      CALL Agrif_Bc_variable(zua,un_id,procname=interpu)
+      CALL Agrif_Bc_variable(zva,vn_id,procname=interpv)
       zua2d = 0.
       zva2d = 0.
@@ -206,6 +233,6 @@
       Agrif_SpecialValue=0.
       Agrif_UseSpecialValue = ln_spc_dyn
-      CALL Agrif_Bc_variable(zua2d,e1u,calledweight=1.,procname=interpu2d)
-      CALL Agrif_Bc_variable(zva2d,e2v,calledweight=1.,procname=interpv2d)
+      CALL Agrif_Bc_variable(zua2d,e1u_id,calledweight=1.,procname=interpu2d)
+      CALL Agrif_Bc_variable(zva2d,e2v_id,calledweight=1.,procname=interpv2d)
       Agrif_UseSpecialValue = .FALSE.
 
@@ -492,5 +519,9 @@
 
       ENDIF
-
+      !
+      IF( wrk_not_released(3, 1,2) .OR. wrk_not_released(2, 4,5,6,7)) THEN
+         CALL ctl_stop('agrif_dyn: failed to release workspace arrays.')
+      ENDIF
+      !
    END SUBROUTINE Agrif_dyn
 
