Index: trunk/NEMO/NST_SRC/agrif_user.F90
===================================================================
--- trunk/NEMO/NST_SRC/agrif_user.F90	(revision 2029)
+++ trunk/NEMO/NST_SRC/agrif_user.F90	(revision 2031)
@@ -101,7 +101,4 @@
 #endif
 
-      Call opa_init  ! Initializations of each fine grid
-      Call agrif_opa_init
-
       ! Specific fine grid Initializations
 #if defined key_tradmp || defined key_esopa
@@ -113,4 +110,8 @@
       lk_obc = .FALSE.
 #endif
+
+      Call opa_init  ! Initializations of each fine grid
+      Call agrif_opa_init
+
       ! 1. Declaration of the type of variable which have to be interpolated
       !---------------------------------------------------------------------
Index: trunk/NEMO/OPA_SRC/OBC/obc_par.F90
===================================================================
--- trunk/NEMO/OPA_SRC/OBC/obc_par.F90	(revision 2029)
+++ trunk/NEMO/OPA_SRC/OBC/obc_par.F90	(revision 2031)
@@ -47,10 +47,14 @@
    !! open boundary parameter
    !!---------------------------------------------------------------------
-   INTEGER ::     &  !: time dimension of the BCS fields on input
+   INTEGER, PARAMETER ::     &  !: time dimension of the BCS fields on input
       jptobc  =	      2 
    !! * EAST open boundary
-   LOGICAL ::     &  !:
+   LOGICAL, PARAMETER ::     &  !:
       lp_obc_east = .FALSE.     !: to active or not the East open boundary
-   INTEGER ::     & 
+     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)
@@ -60,7 +64,11 @@
 
    !! * WEST open boundary
-   LOGICAL ::     &  !:
+   LOGICAL, PARAMETER ::     &  !:
       lp_obc_west = .FALSE.     !: to active or not the West open boundary
-   INTEGER ::     &  !:
+     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)
@@ -70,7 +78,11 @@
 
    !! * NORTH open boundary
-   LOGICAL ::     &  !:
+   LOGICAL, PARAMETER ::     &  !:
       lp_obc_north = .FALSE.    !: to active or not the North open boundary
-   INTEGER ::     &  !:
+     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)
@@ -80,7 +92,11 @@
 
    !! * SOUTH open boundary
-   LOGICAL ::     &  !:
+   LOGICAL, PARAMETER ::     &  !:
       lp_obc_south = .FALSE.    !: to active or not the South open boundary
-   INTEGER ::     &  !:
+     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/obcdta.F90
===================================================================
--- trunk/NEMO/OPA_SRC/OBC/obcdta.F90	(revision 2029)
+++ trunk/NEMO/OPA_SRC/OBC/obcdta.F90	(revision 2031)
@@ -30,6 +30,8 @@
 
   !! * Shared module variables
+!$AGRIF_DO_NOT_TREAT
   REAL(wp),  DIMENSION(2)              ::  zjcnes_obc   ! 
   REAL(wp),  DIMENSION(:), ALLOCATABLE :: ztcobc
+!$AGRIF_END_DO_NOT_TREAT
   REAL(wp) :: rdt_obc
   REAL(wp) :: zjcnes
@@ -469,9 +471,5 @@
        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 2029)
+++ trunk/NEMO/OPA_SRC/SOL/solmat.F90	(revision 2031)
@@ -80,5 +80,6 @@
       ENDIF
 
-#if defined key_dynspg_flt && ! defined key_obc
+#if defined key_dynspg_flt 
+#   if ! defined key_obc
 
       DO jj = 2, jpjm1                      ! matrix of free surface elliptic system
@@ -97,52 +98,67 @@
          END DO
       END DO
-      
-#  elif defined key_dynspg_flt && defined key_obc
-      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
+#   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 DO
-         END DO
-      ENDIF
+            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
+    ELSE
+      DO jj = 2, jpjm1                      ! matrix of free surface elliptic system
+         DO ji = 2, jpim1
+            zcoef = z2dt * z2dt * grav * bmask(ji,jj)
+            zcoefs = -zcoef * hv(ji  ,jj-1) * e1v(ji  ,jj-1) / e2v(ji  ,jj-1)    ! south coefficient
+            zcoefw = -zcoef * hu(ji-1,jj  ) * e2u(ji-1,jj  ) / e1u(ji-1,jj  )    ! west coefficient
+            zcoefe = -zcoef * hu(ji  ,jj  ) * e2u(ji  ,jj  ) / e1u(ji  ,jj  )    ! east coefficient
+            zcoefn = -zcoef * hv(ji  ,jj  ) * e1v(ji  ,jj  ) / e2v(ji  ,jj  )    ! north coefficient
+            gcp(ji,jj,1) = zcoefs
+            gcp(ji,jj,2) = zcoefw
+            gcp(ji,jj,3) = zcoefe
+            gcp(ji,jj,4) = zcoefn
+            gcdmat(ji,jj) = e1t(ji,jj) * e2t(ji,jj) * bmask(ji,jj)    &          ! diagonal coefficient
+               &          - zcoefs -zcoefw -zcoefe -zcoefn
+         END DO
+      END DO
+    ENDIF
+#   endif
 #endif
 
-#if defined key_agrif
-      IF( .NOT.AGRIF_ROOT() ) THEN
+      IF( .NOT. Agrif_Root() ) THEN
          !
          IF( nbondi == -1 .OR. nbondi == 2 )   bmask(2     ,:     ) = 0.e0
@@ -193,5 +209,4 @@
          ! 
       ENDIF
-#endif
 
       ! 2. Boundary conditions 
Index: trunk/NEMO/OPA_SRC/TRA/traqsr.F90
===================================================================
--- trunk/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 2029)
+++ trunk/NEMO/OPA_SRC/TRA/traqsr.F90	(revision 2031)
@@ -45,7 +45,9 @@
    
    ! Module variables
+!$AGRIF_DO_NOT_TREAT
    TYPE(FLD), ALLOCATABLE, DIMENSION(:) ::   sf_chl   ! structure of input Chl (file informations, fields read)
    INTEGER ::   nksr   ! levels below which the light cannot penetrate ( depth larger than 391 m)
    REAL(wp), DIMENSION(3,61) ::   rkrgb   !: tabulated attenuation coefficients for RGB absorption
+!$AGRIF_END_DO_NOT_TREAT
 
    !! * Substitutions
