Index: /trunk/NEMO/NST_SRC/agrif_user.F90
===================================================================
--- /trunk/NEMO/NST_SRC/agrif_user.F90	(revision 1875)
+++ /trunk/NEMO/NST_SRC/agrif_user.F90	(revision 1876)
@@ -73,4 +73,7 @@
       USE tradmp
 #endif
+#if defined key_obc   ||   defined key_esopa
+      USE obc_par
+#endif
       USE sol_oce
       USE in_out_manager
@@ -105,4 +108,8 @@
       ! no tracer damping on fine grids
       lk_tradmp = .FALSE.
+#endif
+#if defined key_obc || defined key_esopa
+      ! no open boundary on fine grids
+      lk_obc = .FALSE.
 #endif
       ! 1. Declaration of the type of variable which have to be interpolated
Index: /trunk/NEMO/OPA_SRC/DOM/dom_oce.F90
===================================================================
--- /trunk/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 1875)
+++ /trunk/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 1876)
@@ -219,13 +219,4 @@
 #else
    LOGICAL, PUBLIC, PARAMETER ::   lk_agrif = .FALSE.   !: agrif flag
-
-CONTAINS
-   LOGICAL FUNCTION Agrif_Root()
-      Agrif_Root = .TRUE.
-   END FUNCTION Agrif_Root
-
-   CHARACTER(len=3) FUNCTION Agrif_CFixed()
-     Agrif_CFixed = '0' 
-   END FUNCTION Agrif_CFixed
 #endif
 
Index: /trunk/NEMO/OPA_SRC/DYN/dynnxt.F90
===================================================================
--- /trunk/NEMO/OPA_SRC/DYN/dynnxt.F90	(revision 1875)
+++ /trunk/NEMO/OPA_SRC/DYN/dynnxt.F90	(revision 1876)
@@ -146,5 +146,5 @@
 # if defined key_obc
       !                                !* OBC open boundaries
-      CALL obc_dyn( kt )
+      IF( lk_obc )   CALL obc_dyn( kt )
       !
       IF ( lk_dynspg_exp .OR. lk_dynspg_ts ) THEN
Index: /trunk/NEMO/OPA_SRC/DYN/dynspg_flt.F90
===================================================================
--- /trunk/NEMO/OPA_SRC/DYN/dynspg_flt.F90	(revision 1875)
+++ /trunk/NEMO/OPA_SRC/DYN/dynspg_flt.F90	(revision 1876)
@@ -186,6 +186,6 @@
 
 #if defined key_obc
-      CALL obc_dyn( kt )      ! Update velocities on each open boundary with the radiation algorithm
-      CALL obc_vol( kt )      ! Correction of the barotropic componant velocity to control the volume of the system
+      IF( lk_obc )   CALL obc_dyn( kt )   ! Update velocities on each open boundary with the radiation algorithm
+      IF( lk_obc )   CALL obc_vol( kt )   ! Correction of the barotropic componant velocity to control the volume of the system
 #endif
 #if defined key_bdy
@@ -315,6 +315,11 @@
 #if defined key_obc
             ! caution : grad D = 0 along open boundaries
-            spgu(ji,jj) = z2dt * ztdgu * obcumask(ji,jj)
-            spgv(ji,jj) = z2dt * ztdgv * obcvmask(ji,jj)
+            IF( Agrif_Root() ) THEN
+               spgu(ji,jj) = z2dt * ztdgu * obcumask(ji,jj)
+               spgv(ji,jj) = z2dt * ztdgv * obcvmask(ji,jj)
+            ELSE
+               spgu(ji,jj) = z2dt * ztdgu
+               spgv(ji,jj) = z2dt * ztdgv
+            ENDIF
 #elif defined key_bdy
             ! caution : grad D = 0 along open boundaries
@@ -330,5 +335,5 @@
       END DO
 
-#if defined key_agrif
+#if defined key_agrif      
       IF( .NOT. Agrif_Root() ) THEN
          ! caution : grad D (fine) = grad D (coarse) at coarse/fine interface
@@ -338,6 +343,5 @@
          IF( nbondj ==  1 .OR. nbondj == 2 ) spgv(:,nlcj-2) = z2dtg * z2dt * laplacv(:,nlcj-2) * vmask(:,nlcj-2,1)
       ENDIF
-#endif
-
+#endif      
       ! Add the trends multiplied by z2dt to the after velocity
       ! -------------------------------------------------------
Index: /trunk/NEMO/OPA_SRC/OBC/obc_par.F90
===================================================================
--- /trunk/NEMO/OPA_SRC/OBC/obc_par.F90	(revision 1875)
+++ /trunk/NEMO/OPA_SRC/OBC/obc_par.F90	(revision 1876)
@@ -25,5 +25,9 @@
    !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt 
    !!----------------------------------------------------------------------
-   LOGICAL, PUBLIC, PARAMETER ::   lk_obc = .TRUE.   !: Ocean Boundary Condition flag
+#if ! defined key_agrif
+   LOGICAL, PUBLIC, PARAMETER ::   lk_obc = .TRUE.     !: Ocean Boundary Condition flag
+#else
+   LOGICAL, PUBLIC            ::   lk_obc = .TRUE.     !: Ocean Boundary Condition flag
+#endif
 
 # if defined key_eel_r5
@@ -43,10 +47,10 @@
    !! open boundary parameter
    !!---------------------------------------------------------------------
-   INTEGER, PARAMETER ::     &  !: time dimension of the BCS fields on input
+   INTEGER ::     &  !: time dimension of the BCS fields on input
       jptobc  =	      2 
    !! * EAST open boundary
-   LOGICAL, PARAMETER ::     &  !:
+   LOGICAL ::     &  !:
       lp_obc_east = .FALSE.     !: to active or not the East open boundary
-   INTEGER, PARAMETER ::     &  !:
+   INTEGER ::     & 
       jpieob  = jpiglo-2,    &  !: i-localization of the East open boundary (must be ocean U-point)
       jpjed   =        2,    &  !: j-starting indice of the East open boundary (must be land T-point)
@@ -56,7 +60,7 @@
 
    !! * WEST open boundary
-   LOGICAL, PARAMETER ::     &  !:
+   LOGICAL ::     &  !:
       lp_obc_west = .FALSE.     !: to active or not the West open boundary
-   INTEGER, PARAMETER ::     &  !:
+   INTEGER ::     &  !:
       jpiwob  =	       2,    &  !: i-localization of the West open boundary (must be ocean U-point)
       jpjwd   =	       2,    &  !: j-starting indice of the West open boundary (must be land T-point)
@@ -66,7 +70,7 @@
 
    !! * NORTH open boundary
-   LOGICAL, PARAMETER ::     &  !:
+   LOGICAL ::     &  !:
       lp_obc_north = .FALSE.    !: to active or not the North open boundary
-   INTEGER, PARAMETER ::     &  !:
+   INTEGER ::     &  !:
       jpjnob  = jpjglo-2,    &  !: j-localization of the North open boundary (must be ocean V-point)
       jpind   =        2,    &  !: i-starting indice of the North open boundary (must be land T-point)
@@ -76,7 +80,7 @@
 
    !! * SOUTH open boundary
-   LOGICAL, PARAMETER ::     &  !:
+   LOGICAL ::     &  !:
       lp_obc_south = .FALSE.    !: to active or not the South open boundary
-   INTEGER, PARAMETER ::     &  !:
+   INTEGER ::     &  !:
       jpjsob  =        2,    &  !: j-localization of the South open boundary (must be ocean V-point)
       jpisd   =        2,    &  !: i-starting indice of the South open boundary (must be land T-point)
Index: /trunk/NEMO/OPA_SRC/OBC/obc_par_EEL_R5.h90
===================================================================
--- /trunk/NEMO/OPA_SRC/OBC/obc_par_EEL_R5.h90	(revision 1875)
+++ /trunk/NEMO/OPA_SRC/OBC/obc_par_EEL_R5.h90	(revision 1876)
@@ -15,5 +15,10 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_east = .TRUE.      !: to active or not the East open boundary
-   INTEGER, PARAMETER ::     &  !:
+
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   &
+#endif
+    ::     &
       jpieob  = jpiglo-2,    &  !: i-localization of the East open boundary (must be ocean U-point)
       jpjed   =        2,    &  !: j-starting indice of the East open boundary (must be land T-point)
@@ -25,5 +30,10 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_west = .TRUE.      !: to active or not the West open boundary
-   INTEGER, PARAMETER ::     &
+
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   &
+#endif
+    ::     &
       jpiwob  =	       2,    &  !: i-localization of the West open boundary (must be ocean U-point)
       jpjwd   =	       2,    &  !: j-starting indice of the West open boundary (must be land T-point)
@@ -35,5 +45,10 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_north = .FALSE.    !: to active or not the North open boundary
-   INTEGER, PARAMETER ::     &  !:
+
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   &
+#endif
+    ::     &
       jpjnob  = jpjglo-2,    &  !: j-localization of the North open boundary (must be ocean V-point)
       jpind   =        2,    &  !: i-starting indice of the North open boundary (must be land T-point)
@@ -45,5 +60,10 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_south = .FALSE.    !: to active or not the South open boundary
-   INTEGER, PARAMETER ::     &  !:
+
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   &
+#endif
+    ::     &
       jpjsob  =        2,    &  !: j-localization of the South open boundary (must be ocean V-point)
       jpisd   =        2,    &  !: i-starting indice of the South open boundary (must be land T-point)
Index: /trunk/NEMO/OPA_SRC/OBC/obc_par_POMME_R025.h90
===================================================================
--- /trunk/NEMO/OPA_SRC/OBC/obc_par_POMME_R025.h90	(revision 1875)
+++ /trunk/NEMO/OPA_SRC/OBC/obc_par_POMME_R025.h90	(revision 1876)
@@ -4,21 +4,23 @@
    !! open boundary parameter : POMME configuration
    !!---------------------------------------------------------------------
-     INTEGER, PARAMETER ::     &  !: time dimension of the BCS fields on input
-      jptobc  =	      14
+   INTEGER, PARAMETER ::  jptobc  =	      14   
+   !: time dimension of the BCS fields on input
 
    !! * EAST open boundary
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_east = .TRUE.      !:
-   INTEGER, PARAMETER ::     &  !:
 
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   & 
+#endif
+    ::     & 
       ! * default values *
       !jpieob = jpiglo-2,    &  !: i-localization of the East open boundary (must be ocean U-point)
       !jpjed  =        2,    &  !: j-starting indice of the East open boundary (must be land T-point)
       !jpjef  = jpjglo-1,    &  !: j-ending   indice of the East open boundary (must be land T-point)
-
       jpieob = jpiglo-2,    &  !: i-localization of the East open boundary (must be ocean U-point)
       jpjed  =        1,    &  !: j-starting indice of the East open boundary (must be land T-point)
       jpjef  =   jpjglo,    &  !: j-ending   indice of the East open boundary (must be land T-point)
-
       jpjedp1 =  jpjed+1,    &  !: first ocean point         "                 "
       jpjefm1 =  jpjef-1        !: last  ocean point         "                 "
@@ -27,15 +29,17 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_west = .TRUE.     !: to active or not the West open boundary
-   INTEGER, PARAMETER ::     &  !:
 
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   & 
+#endif
+    ::     & 
       ! * default values *
       !jpiwob  =        2,   &  !: i-localization of the West open boundary (must be ocean U-point)
       !jpjwd   =        2,   &  !: j-starting indice of the West open boundary (must be land T-point)
       !jpjwf   = jpjglo-1,   &  !: j-ending   indice of the West open boundary (must be land T-point)
-
       jpiwob  =        2,   &  !: i-localization of the West open boundary (must be ocean U-point)
       jpjwd   =        1,   &  !: j-starting indice of the West open boundary (must be land T-point)
       jpjwf   =   jpjglo,   &  !: j-ending   indice of the West open boundary (must be land T-point)
-
       jpjwdp1 =  jpjwd+1,    &  !: first ocean point         "                 "
       jpjwfm1 =  jpjwf-1        !: last  ocean point         "                 "
@@ -44,15 +48,17 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_north = .TRUE.     !:
-   INTEGER, PARAMETER ::     &  !:
 
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   & 
+#endif
+    ::     & 
       ! * default values *
       !jpjnob = jpjglo-2,    &  !: j-localization of the North open boundary (must be ocean V-point)
       !jpind  =        2,    &  !: i-starting indice of the North open boundary (must be land T-point)
       !jpinf  = jpiglo-1,    &  !: i-ending   indice of the North open boundary (must be land T-point)
-
       jpjnob = jpjglo-2,    &  !: j-localization of the North open boundary (must be ocean V-point)
       jpind  =        1,    &  !: i-starting indice of the North open boundary (must be land T-point)
       jpinf  =   jpiglo,    &  !: i-ending   indice of the North open boundary (must be land T-point)
-
       jpindp1 =  jpind+1,    &  !: first ocean point         "                 "
       jpinfm1 =  jpinf-1        !: last  ocean point         "                 "
@@ -61,15 +67,17 @@
    LOGICAL, PARAMETER ::     &  !:
       lp_obc_south = .TRUE.     !: INDICE to active or not the South open boundary
-   INTEGER, PARAMETER ::     &  !:
 
+     INTEGER   &
+#if !defined key_agrif
+     , PARAMETER   & 
+#endif
+    ::     & 
       ! * default values *
       !jpjsob =        2,    &  !: j-localization of the South open boundary (must be ocean V-point)
       !jpisd  =        2,    &  !: i-starting indice of the South open boundary (must be land T-point)
       !jpisf  = jpiglo-1,    &  !: i-ending   indice of the South open boundary (must be land T-point)
-
       jpjsob =        2,    &  !: j-localization of the South open boundary (must be ocean V-point)
       jpisd  =        1,    &  !: i-starting indice of the South open boundary (must be land T-point)
       jpisf  =   jpiglo,    &  !: i-ending   indice of the South open boundary (must be land T-point)
-
       jpisdp1 =  jpisd+1,    &  !: first ocean point         "                 "
       jpisfm1 =  jpisf-1        !: last  ocean point         "                 "
Index: /trunk/NEMO/OPA_SRC/OBC/obcdta.F90
===================================================================
--- /trunk/NEMO/OPA_SRC/OBC/obcdta.F90	(revision 1875)
+++ /trunk/NEMO/OPA_SRC/OBC/obcdta.F90	(revision 1876)
@@ -469,5 +469,9 @@
        ENDIF
     ELSE
+#if defined key_agrif
+       IF ( ASSOCIATED(ztcobc) ) DEALLOCATE ( ztcobc )
+#else
        IF ( ALLOCATED(ztcobc) ) DEALLOCATE ( ztcobc )
+#endif
        ALLOCATE (ztcobc(itobc))
        DO ji=1,1   ! use a dummy loop to read ztcobc only once
Index: /trunk/NEMO/OPA_SRC/SOL/solmat.F90
===================================================================
--- /trunk/NEMO/OPA_SRC/SOL/solmat.F90	(revision 1875)
+++ /trunk/NEMO/OPA_SRC/SOL/solmat.F90	(revision 1876)
@@ -99,48 +99,50 @@
       
 #  elif defined key_dynspg_flt && defined key_obc
-
-      DO jj = 2, jpjm1                      ! matrix of free surface elliptic system with open boundaries
-         DO ji = 2, jpim1
-            zcoef = z2dt * z2dt * grav * bmask(ji,jj)
-            !                                    ! south coefficient
-            IF( lp_obc_south .AND. ( jj == njs0p1 ) ) THEN
-               zcoefs = -zcoef * hv(ji,jj-1) * e1v(ji,jj-1)/e2v(ji,jj-1)*(1.-vsmsk(ji,1))
-            ELSE
-               zcoefs = -zcoef * hv(ji,jj-1) * e1v(ji,jj-1)/e2v(ji,jj-1)
-            END IF
-            gcp(ji,jj,1) = zcoefs
-            !
-            !                                    ! west coefficient
-            IF( lp_obc_west  .AND. ( ji == niw0p1 ) ) THEN
-               zcoefw = -zcoef * hu(ji-1,jj) * e2u(ji-1,jj)/e1u(ji-1,jj)*(1.-uwmsk(jj,1))
-            ELSE
-               zcoefw = -zcoef * hu(ji-1,jj) * e2u(ji-1,jj)/e1u(ji-1,jj)
-            END IF
-            gcp(ji,jj,2) = zcoefw
-            !
-            !                                    ! east coefficient
-            IF( lp_obc_east  .AND. ( ji == nie0 ) ) THEN
-               zcoefe = -zcoef * hu(ji,jj) * e2u(ji,jj)/e1u(ji,jj)*(1.-uemsk(jj,1))
-            ELSE
-               zcoefe = -zcoef * hu(ji,jj) * e2u(ji,jj)/e1u(ji,jj)
-            END IF
-            gcp(ji,jj,3) = zcoefe
-            !
-            !                                    ! north coefficient
-            IF( lp_obc_north .AND. ( jj == njn0 ) ) THEN
-               zcoefn = -zcoef * hv(ji,jj) * e1v(ji,jj)/e2v(ji,jj)*(1.-vnmsk(ji,1))
-            ELSE
+      IF( Agrif_Root() ) THEN
+         DO jj = 2, jpjm1                      ! matrix of free surface elliptic system with open boundaries
+            DO ji = 2, jpim1
+               zcoef = z2dt * z2dt * grav * bmask(ji,jj)
+               !                                    ! south coefficient
+               IF( lp_obc_south .AND. ( jj == njs0p1 ) ) THEN
+                  zcoefs = -zcoef * hv(ji,jj-1) * e1v(ji,jj-1)/e2v(ji,jj-1)*(1.-vsmsk(ji,1))
+               ELSE
+                  zcoefs = -zcoef * hv(ji,jj-1) * e1v(ji,jj-1)/e2v(ji,jj-1)
+               END IF
+               gcp(ji,jj,1) = zcoefs
+               !
+               !                                    ! west coefficient
+               IF( lp_obc_west  .AND. ( ji == niw0p1 ) ) THEN
+                  zcoefw = -zcoef * hu(ji-1,jj) * e2u(ji-1,jj)/e1u(ji-1,jj)*(1.-uwmsk(jj,1))
+               ELSE
+                  zcoefw = -zcoef * hu(ji-1,jj) * e2u(ji-1,jj)/e1u(ji-1,jj)
+               END IF
+               gcp(ji,jj,2) = zcoefw
+               !
+               !                                    ! east coefficient
+               IF( lp_obc_east  .AND. ( ji == nie0 ) ) THEN
+                  zcoefe = -zcoef * hu(ji,jj) * e2u(ji,jj)/e1u(ji,jj)*(1.-uemsk(jj,1))
+               ELSE
+                  zcoefe = -zcoef * hu(ji,jj) * e2u(ji,jj)/e1u(ji,jj)
+               END IF
+               gcp(ji,jj,3) = zcoefe
+               !
+               !                                    ! north coefficient
+               IF( lp_obc_north .AND. ( jj == njn0 ) ) THEN
+                  zcoefn = -zcoef * hv(ji,jj) * e1v(ji,jj)/e2v(ji,jj)*(1.-vnmsk(ji,1))
+               ELSE
                zcoefn = -zcoef * hv(ji,jj) * e1v(ji,jj)/e2v(ji,jj)
-            END IF
-            gcp(ji,jj,4) = zcoefn
-            !
-            !                                    ! diagonal coefficient
-            gcdmat(ji,jj) = e1t(ji,jj)*e2t(ji,jj)*bmask(ji,jj)   &
-               &            - zcoefs -zcoefw -zcoefe -zcoefn
+               END IF
+               gcp(ji,jj,4) = zcoefn
+               !
+               !                                    ! diagonal coefficient
+               gcdmat(ji,jj) = e1t(ji,jj)*e2t(ji,jj)*bmask(ji,jj)   &
+                  &            - zcoefs -zcoefw -zcoefe -zcoefn
+            END DO
          END DO
-      END DO
+      ENDIF
 #endif
 
-      IF( .NOT. Agrif_Root() ) THEN   ! Fine grid boundaries
+#if defined key_agrif
+      IF( .NOT.AGRIF_ROOT() ) THEN
          !
          IF( nbondi == -1 .OR. nbondi == 2 )   bmask(2     ,:     ) = 0.e0
@@ -191,4 +193,5 @@
          ! 
       ENDIF
+#endif
 
       ! 2. Boundary conditions 
Index: /trunk/NEMO/OPA_SRC/TRA/tranxt.F90
===================================================================
--- /trunk/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 1875)
+++ /trunk/NEMO/OPA_SRC/TRA/tranxt.F90	(revision 1876)
@@ -38,4 +38,5 @@
    USE agrif_opa_update
    USE agrif_opa_interp
+   USE obc_oce 
 
    IMPLICIT NONE
@@ -101,5 +102,5 @@
       !
 #if defined key_obc
-      CALL obc_tra( kt )               ! OBC open boundaries
+      IF( lk_obc )   CALL obc_tra( kt )  ! OBC open boundaries
 #endif
 #if defined key_bdy
Index: /trunk/NEMO/OPA_SRC/par_POMME_R025.h90
===================================================================
--- /trunk/NEMO/OPA_SRC/par_POMME_R025.h90	(revision 1875)
+++ /trunk/NEMO/OPA_SRC/par_POMME_R025.h90	(revision 1876)
@@ -22,9 +22,7 @@
       jp_cfg = 025  ,        &  !: resolution of the configuration (degrees)
       ! Original data size
-
       ! ORCA025 global grid size
       jpiglo_ORCA025 = 1442, &
       jpjglo_ORCA025 = 1021, &  ! not used currently
-
       ! POMME "global" domain localisation in the ORCA025 global grid
       jpi_iw    = 1059,      & 
@@ -32,9 +30,7 @@
       jpj_js    = 661,       &
       jpj_jn    = 700,       &
-
       jpidta  = ( jpi_ie - jpi_iw + 1 ), &   !: =30 first horizontal dimension > or = to jpi
       jpjdta  = ( jpj_jn - jpj_js + 1 ), &   !: =40 second                     > or = to jpj
       jpkdta  = 46 ,         &  !: number of levels           > or = to jpk
-
       ! total domain matrix size
       jpiglo  = jpidta,      &  !: first  dimension of global domain --> i
