Index: NEMO/trunk/src/NST/agrif_oce_interp.F90
===================================================================
--- NEMO/trunk/src/NST/agrif_oce_interp.F90	(revision 9805)
+++ NEMO/trunk/src/NST/agrif_oce_interp.F90	(revision 9806)
@@ -94,6 +94,6 @@
       !
       ! prevent smoothing in ghost cells
-      i1 =  1   ;   i2 = jpi
-      j1 =  1   ;   j2 = jpj
+      i1 =  1   ;   i2 = nlci
+      j1 =  1   ;   j2 = nlcj
       IF( nbondj == -1 .OR. nbondj == 2 )   j1 = 2 + nbghostcells
       IF( nbondj == +1 .OR. nbondj == 2 )   j2 = nlcj - nbghostcells - 1
@@ -645,5 +645,5 @@
       INTEGER  ::   ji, jj, jk, jn, iref, jref, ibdy, jbdy   ! dummy loop indices
       INTEGER  ::   imin, imax, jmin, jmax, N_in, N_out
-      REAL(wp) ::   zrhox, z1, z2, z3, z4, z5, z6, z7
+      REAL(wp) ::   zrho, z1, z2, z3, z4, z5, z6, z7
       LOGICAL :: western_side, eastern_side,northern_side,southern_side
       ! vertical interpolation:
@@ -718,14 +718,4 @@
          IF ( .NOT.lk_agrif_clp ) THEN 
             !
-            zrhox = Agrif_Rhox()
-            z1 = ( zrhox - 1. ) * 0.5
-            z3 = ( zrhox - 1. ) / ( zrhox + 1. )
-            z6 = 2. * ( zrhox - 1. ) / ( zrhox + 1. )
-            z7 =    - ( zrhox - 1. ) / ( zrhox + 3. )
-            !
-            z2 = 1. - z1
-            z4 = 1. - z3
-            z5 = 1. - z6 - z7
-            !
             imin = i1 ; imax = i2
             jmin = j1 ; jmax = j2
@@ -734,11 +724,18 @@
             IF((nbondj == -1).OR.(nbondj == 2)) jmin = 2 + nbghostcells
             IF((nbondj == +1).OR.(nbondj == 2)) jmax = nlcj - nbghostcells - 1
-            IF((nbondi == -1).OR.(nbondi == 2)) imin = 1 + nbghostcells
+            IF((nbondi == -1).OR.(nbondi == 2)) imin = 2 + nbghostcells
             IF((nbondi == +1).OR.(nbondi == 2)) imax = nlci - nbghostcells - 1      
             !
             IF( eastern_side ) THEN
+               zrho = Agrif_Rhox()
+               z1 = ( zrho - 1._wp ) * 0.5_wp                    
+               z3 = ( zrho - 1._wp ) / ( zrho + 1._wp )         
+               z6 = 2._wp * ( zrho - 1._wp ) / ( zrho + 1._wp )
+               z7 =       - ( zrho - 1._wp ) / ( zrho + 3._wp )
+               z2 = 1._wp - z1 ; z4 = 1._wp - z3 ; z5 = 1._wp - z6 - z7
+               !
                ibdy = nlci-nbghostcells
                DO jn = 1, jpts
-                  tsa(ibdy+1,jmin:jmax,k1:k2,jn) = z1 * ptab_child(ibdy+1,jmin:jmax,k1:k2,jn) + z2 * ptab_child(ibdy,jmin:jmax,k1:k2,jn)
+                  tsa(ibdy+1,jmin:jmax,1:jpkm1,jn) = z1 * ptab_child(ibdy+1,jmin:jmax,1:jpkm1,jn) + z2 * ptab_child(ibdy,jmin:jmax,1:jpkm1,jn)
                   DO jk = 1, jpkm1
                      DO jj = jmin,jmax
@@ -755,12 +752,19 @@
                   END DO
                   ! Restore ghost points:
-                  tsa(ibdy+1,jmin:jmax,k1:k2,jn) = ptab_child(ibdy+1,jmin:jmax,k1:k2,jn) * tmask(ibdy+1,jmin:jmax,k1:k2)
+                  tsa(ibdy+1,jmin:jmax,1:jpkm1,jn) = ptab_child(ibdy+1,jmin:jmax,1:jpkm1,jn) * tmask(ibdy+1,jmin:jmax,1:jpkm1)
                END DO
             ENDIF
             ! 
             IF( northern_side ) THEN
+               zrho = Agrif_Rhoy()
+               z1 = ( zrho - 1._wp ) * 0.5_wp                    
+               z3 = ( zrho - 1._wp ) / ( zrho + 1._wp )         
+               z6 = 2._wp * ( zrho - 1._wp ) / ( zrho + 1._wp )
+               z7 =       - ( zrho - 1._wp ) / ( zrho + 3._wp )
+               z2 = 1._wp - z1 ; z4 = 1._wp - z3 ; z5 = 1._wp - z6 - z7
+               !
                jbdy = nlcj-nbghostcells         
                DO jn = 1, jpts
-                  tsa(imin:imax,jbdy+1,k1:k2,jn) = z1 * ptab_child(imin:imax,jbdy+1,k1:k2,jn) + z2 * ptab_child(imin:imax,jbdy,k1:k2,jn)
+                  tsa(imin:imax,jbdy+1,1:jpkm1,jn) = z1 * ptab_child(imin:imax,jbdy+1,1:jpkm1,jn) + z2 * ptab_child(imin:imax,jbdy,1:jpkm1,jn)
                   DO jk = 1, jpkm1
                      DO ji = imin,imax
@@ -777,12 +781,19 @@
                   END DO
                   ! Restore ghost points:
-                  tsa(imin:imax,jbdy+1,k1:k2,jn) = ptab_child(imin:imax,jbdy+1,k1:k2,jn) * tmask(imin:imax,jbdy+1,k1:k2)
+                  tsa(imin:imax,jbdy+1,1:jpkm1,jn) = ptab_child(imin:imax,jbdy+1,1:jpkm1,jn) * tmask(imin:imax,jbdy+1,1:jpkm1)
                END DO
             ENDIF
             !
-            IF( western_side ) THEN    
+            IF( western_side ) THEN
+               zrho = Agrif_Rhox()
+               z1 = ( zrho - 1._wp ) * 0.5_wp                    
+               z3 = ( zrho - 1._wp ) / ( zrho + 1._wp )         
+               z6 = 2._wp * ( zrho - 1._wp ) / ( zrho + 1._wp )
+               z7 =       - ( zrho - 1._wp ) / ( zrho + 3._wp )
+               z2 = 1._wp - z1 ; z4 = 1._wp - z3 ; z5 = 1._wp - z6 - z7
+               !    
                ibdy = 1+nbghostcells       
                DO jn = 1, jpts
-                  tsa(ibdy-1,jmin:jmax,k1:k2,jn) = z1 * ptab_child(ibdy-1,jmin:jmax,k1:k2,jn) + z2 * ptab_child(ibdy,jmin:jmax,k1:k2,jn)
+                  tsa(ibdy-1,jmin:jmax,1:jpkm1,jn) = z1 * ptab_child(ibdy-1,jmin:jmax,1:jpkm1,jn) + z2 * ptab_child(ibdy,jmin:jmax,1:jpkm1,jn)
                   DO jk = 1, jpkm1
                      DO jj = jmin,jmax
@@ -792,5 +803,6 @@
                            tsa(ibdy,jj,jk,jn)=(z4*tsa(ibdy-1,jj,jk,jn)+z3*tsa(ibdy+1,jj,jk,jn))*tmask(ibdy,jj,jk)        
                            IF( un(ibdy,jj,jk) < 0._wp ) THEN
-                              tsa(ibdy,jj,jk,jn)=(z6*tsa(ibdy+1,jj,jk,jn)+z5*tsa(ibdy-1,jj,jk,jn)+z7*tsa(ibdy+2,jj,jk,jn))*tmask(ibdy,jj,jk)
+                              tsa(ibdy,jj,jk,jn)=( z6*tsa(ibdy+1,jj,jk,jn)+z5*tsa(ibdy-1,jj,jk,jn) &
+                                                 + z7*tsa(ibdy+2,jj,jk,jn) ) * tmask(ibdy,jj,jk)
                            ENDIF
                         ENDIF
@@ -798,14 +810,21 @@
                   END DO
                   ! Restore ghost points:
-                  tsa(ibdy-1,jmin:jmax,k1:k2,jn) = ptab_child(ibdy-1,jmin:jmax,k1:k2,jn) * tmask(ibdy-1,jmin:jmax,k1:k2)
+                  tsa(ibdy-1,jmin:jmax,1:jpkm1,jn) = ptab_child(ibdy-1,jmin:jmax,1:jpkm1,jn) * tmask(ibdy-1,jmin:jmax,1:jpkm1)
                END DO
             ENDIF
             !
-            IF( southern_side ) THEN  
+            IF( southern_side ) THEN
+               zrho = Agrif_Rhoy()
+               z1 = ( zrho - 1._wp ) * 0.5_wp                    
+               z3 = ( zrho - 1._wp ) / ( zrho + 1._wp )         
+               z6 = 2._wp * ( zrho - 1._wp ) / ( zrho + 1._wp )
+               z7 =       - ( zrho - 1._wp ) / ( zrho + 3._wp )
+               z2 = 1._wp - z1 ; z4 = 1._wp - z3 ; z5 = 1._wp - z6 - z7
+               !  
                jbdy=1+nbghostcells        
                DO jn = 1, jpts
-                  tsa(imin:imax,jbdy-1,k1:k2,jn) = z1 * ptab_child(imin:imax,jbdy-1,k1:k2,jn) + z2 * ptab_child(imin:imax,jbdy,k1:k2,jn)
-                  DO jk = 1, jpk      
-                     DO ji=imin,imax
+                  tsa(imin:imax,jbdy-1,1:jpkm1,jn) = z1 * ptab_child(imin:imax,jbdy-1,1:jpkm1,jn) + z2 * ptab_child(imin:imax,jbdy,1:jpkm1,jn)
+                  DO jk = 1, jpkm1      
+                     DO ji = imin,imax
                         IF( vmask(ji,jbdy,jk) == 0._wp ) THEN
                            tsa(ji,jbdy,jk,jn)=tsa(ji,jbdy-1,jk,jn) * tmask(ji,jbdy,jk)
@@ -813,5 +832,6 @@
                            tsa(ji,jbdy,jk,jn)=(z4*tsa(ji,jbdy-1,jk,jn)+z3*tsa(ji,jbdy+1,jk,jn))*tmask(ji,jbdy,jk)
                            IF( vn(ji,jbdy,jk) < 0._wp ) THEN
-                              tsa(ji,jbdy,jk,jn)=(z6*tsa(ji,jbdy+1,jk,jn)+z5*tsa(ji,jbdy-1,jk,jn)+z7*tsa(ji,jbdy+2,jk,jn))*tmask(ji,jbdy,jk)
+                              tsa(ji,jbdy,jk,jn)=( z6*tsa(ji,jbdy+1,jk,jn)+z5*tsa(ji,jbdy-1,jk,jn) & 
+                                                 + z7*tsa(ji,jbdy+2,jk,jn) ) * tmask(ji,jbdy,jk)
                            ENDIF
                         ENDIF
@@ -819,5 +839,5 @@
                   END DO
                   ! Restore ghost points:
-                  tsa(imin:imax,jbdy-1,k1:k2,jn) = tsa(imin:imax,jbdy-1,k1:k2,jn) * tmask(imin:imax,jbdy-1,k1:k2)
+                  tsa(imin:imax,jbdy-1,1:jpkm1,jn) = ptab_child(imin:imax,jbdy-1,1:jpkm1,jn) * tmask(imin:imax,jbdy-1,1:jpkm1)
                END DO
             ENDIF
Index: NEMO/trunk/src/NST/agrif_oce_sponge.F90
===================================================================
--- NEMO/trunk/src/NST/agrif_oce_sponge.F90	(revision 9805)
+++ NEMO/trunk/src/NST/agrif_oce_sponge.F90	(revision 9806)
@@ -103,6 +103,6 @@
          ! Store it in ztabramp
 
-         ispongearea  = 2 + nn_sponge_len * Agrif_irhox()
-         z1_spongearea = 1._wp / REAL( ispongearea - 1 )
+         ispongearea  = 1 + nn_sponge_len * Agrif_irhox()
+         z1_spongearea = 1._wp / REAL( ispongearea )
          
          ztabramp(:,:) = 0._wp
@@ -111,7 +111,7 @@
          IF( (nbondi == -1) .OR. (nbondi == 2) ) THEN
             ind1 = 1+nbghostcells
-            ind2 = 1+nbghostcells + (ispongearea-1)
+            ind2 = 1+nbghostcells + ispongearea 
             DO jj = 1, jpj
-               DO ji = ind1, ind2                  
+               DO ji = ind1, ind2                
                   ztabramp(ji,jj) = REAL( ind2 - ji ) * z1_spongearea * umask(ind1,jj,1)
                END DO
@@ -121,6 +121,6 @@
          ! --- East --- !
          IF( (nbondi == 1) .OR. (nbondi == 2) ) THEN
-            ind1 = nlci - (1+nbghostcells) - (ispongearea-1)
-            ind2 = nlci - (1+nbghostcells)
+            ind1 = nlci - nbghostcells - ispongearea
+            ind2 = nlci - nbghostcells
             DO jj = 1, jpj
                DO ji = ind1, ind2
@@ -133,6 +133,6 @@
          IF( (nbondj == -1) .OR. (nbondj == 2) ) THEN
             ind1 = 1+nbghostcells
-            ind2 = 1+nbghostcells + (ispongearea-1)
-            DO jj = ind1, ind2
+            ind2 = 1+nbghostcells + ispongearea
+            DO jj = ind1, ind2 
                DO ji = 1, jpi
                   ztabramp(ji,jj) = MAX( ztabramp(ji,jj), REAL( ind2 - jj ) * z1_spongearea * vmask(ji,ind1,1) )
@@ -143,6 +143,6 @@
          ! --- North --- !
          IF( (nbondj == 1) .OR. (nbondj == 2) ) THEN
-            ind1 = nlcj - (1+nbghostcells) - (ispongearea-1)
-            ind2 = nlcj - (1+nbghostcells)
+            ind1 = nlcj - nbghostcells - ispongearea
+            ind2 = nlcj - nbghostcells
             DO jj = ind1, ind2
                DO ji = 1, jpi
@@ -177,6 +177,6 @@
             DO ji = 2, jpim1   ! vector opt.
                fsahm_spt(ji,jj) = visc_dyn * ztabramp(ji,jj)
-               fsahm_spf(ji,jj) = 0.25_wp * visc_dyn * ( ztabramp(ji,jj) + ztabramp(ji  ,jj+1) &
-                                                     &  +ztabramp(ji,jj) + ztabramp(ji+1,jj  ) )
+               fsahm_spf(ji,jj) = 0.25_wp * visc_dyn * ( ztabramp(ji  ,jj  ) + ztabramp(ji  ,jj+1) &
+                                                     &  +ztabramp(ji+1,jj+1) + ztabramp(ji+1,jj  ) )
             END DO
          END DO
@@ -278,9 +278,15 @@
          DO jn = 1, jpts            
             DO jk = 1, jpkm1
-               DO jj = j1,j2-1
+               ztu(i1:i2,j1:j2,jk) = 0._wp
+               DO jj = j1,j2
                   DO ji = i1,i2-1
                      zabe1 = fsaht_spu(ji,jj) * umask(ji,jj,jk) * e2_e1u(ji,jj) * e3u_n(ji,jj,jk)
+                     ztu(ji,jj,jk) = zabe1 * ( tsbdiff(ji+1,jj  ,jk,jn) - tsbdiff(ji,jj,jk,jn) ) 
+                  END DO
+               END DO
+               ztv(i1:i2,j1:j2,jk) = 0._wp
+               DO ji = i1,i2
+                  DO jj = j1,j2-1
                      zabe2 = fsaht_spv(ji,jj) * vmask(ji,jj,jk) * e1_e2v(ji,jj) * e3v_n(ji,jj,jk)
-                     ztu(ji,jj,jk) = zabe1 * ( tsbdiff(ji+1,jj  ,jk,jn) - tsbdiff(ji,jj,jk,jn) ) 
                      ztv(ji,jj,jk) = zabe2 * ( tsbdiff(ji  ,jj+1,jk,jn) - tsbdiff(ji,jj,jk,jn) )
                   END DO
@@ -288,6 +294,6 @@
                !
                IF( ln_zps ) THEN      ! set gradient at partial step level
-                  DO jj = j1,j2-1
-                     DO ji = i1,i2-1
+                  DO jj = j1,j2
+                     DO ji = i1,i2
                         ! last level
                         iku = mbku(ji,jj)
Index: NEMO/trunk/src/NST/agrif_top_interp.F90
===================================================================
--- NEMO/trunk/src/NST/agrif_top_interp.F90	(revision 9805)
+++ NEMO/trunk/src/NST/agrif_top_interp.F90	(revision 9806)
@@ -59,5 +59,5 @@
       INTEGER  ::   ji, jj, jk, jn, iref, jref, ibdy, jbdy   ! dummy loop indices
       INTEGER  ::   imin, imax, jmin, jmax, N_in, N_out
-      REAL(wp) ::   zrhox, z1, z2, z3, z4, z5, z6, z7
+      REAL(wp) ::   zrho, z1, z2, z3, z4, z5, z6, z7
       LOGICAL :: western_side, eastern_side,northern_side,southern_side
       ! vertical interpolation:
@@ -132,14 +132,4 @@
          IF ( .NOT.lk_agrif_clp ) THEN 
             !
-            zrhox = Agrif_Rhox()
-            z1 = ( zrhox - 1. ) * 0.5
-            z3 = ( zrhox - 1. ) / ( zrhox + 1. )
-            z6 = 2. * ( zrhox - 1. ) / ( zrhox + 1. )
-            z7 =    - ( zrhox - 1. ) / ( zrhox + 3. )
-            !
-            z2 = 1. - z1
-            z4 = 1. - z3
-            z5 = 1. - z6 - z7
-            !
             imin = i1 ; imax = i2
             jmin = j1 ; jmax = j2
@@ -148,11 +138,18 @@
             IF((nbondj == -1).OR.(nbondj == 2)) jmin = 2 + nbghostcells
             IF((nbondj == +1).OR.(nbondj == 2)) jmax = nlcj - nbghostcells - 1
-            IF((nbondi == -1).OR.(nbondi == 2)) imin = 1 + nbghostcells
+            IF((nbondi == -1).OR.(nbondi == 2)) imin = 2 + nbghostcells
             IF((nbondi == +1).OR.(nbondi == 2)) imax = nlci - nbghostcells - 1      
             !
             IF( eastern_side ) THEN
+               zrho = Agrif_Rhox()
+               z1 = ( zrho - 1._wp ) * 0.5_wp                    
+               z3 = ( zrho - 1._wp ) / ( zrho + 1._wp )         
+               z6 = 2._wp * ( zrho - 1._wp ) / ( zrho + 1._wp )
+               z7 =       - ( zrho - 1._wp ) / ( zrho + 3._wp )
+               z2 = 1._wp - z1 ; z4 = 1._wp - z3 ; z5 = 1._wp - z6 - z7
+               !
                ibdy = nlci-nbghostcells
                DO jn = 1, jptra
-                  tra(ibdy+1,jmin:jmax,k1:k2,jn) = z1 * ptab_child(ibdy+1,jmin:jmax,k1:k2,jn) + z2 * ptab_child(ibdy,jmin:jmax,k1:k2,jn)
+                  tra(ibdy+1,jmin:jmax,1:jpkm1,jn) = z1 * ptab_child(ibdy+1,jmin:jmax,1:jpkm1,jn) + z2 * ptab_child(ibdy,jmin:jmax,1:jpkm1,jn)
                   DO jk = 1, jpkm1
                      DO jj = jmin,jmax
@@ -169,12 +166,19 @@
                   END DO
                   ! Restore ghost points:
-                  tra(ibdy+1,jmin:jmax,k1:k2,jn) = ptab_child(ibdy+1,jmin:jmax,k1:k2,jn) * tmask(ibdy+1,jmin:jmax,k1:k2)
+                  tra(ibdy+1,jmin:jmax,1:jpkm1,jn) = ptab_child(ibdy+1,jmin:jmax,1:jpkm1,jn) * tmask(ibdy+1,jmin:jmax,1:jpkm1)
                END DO
             ENDIF
             ! 
             IF( northern_side ) THEN
+               zrho = Agrif_Rhoy()
+               z1 = ( zrho - 1._wp ) * 0.5_wp                    
+               z3 = ( zrho - 1._wp ) / ( zrho + 1._wp )         
+               z6 = 2._wp * ( zrho - 1._wp ) / ( zrho + 1._wp )
+               z7 =       - ( zrho - 1._wp ) / ( zrho + 3._wp )
+               z2 = 1._wp - z1 ; z4 = 1._wp - z3 ; z5 = 1._wp - z6 - z7
+               !
                jbdy = nlcj-nbghostcells         
                DO jn = 1, jptra
-                  tra(imin:imax,jbdy+1,k1:k2,jn) = z1 * ptab_child(imin:imax,jbdy+1,k1:k2,jn) + z2 * ptab_child(imin:imax,jbdy,k1:k2,jn)
+                  tra(imin:imax,jbdy+1,1:jpkm1,jn) = z1 * ptab_child(imin:imax,jbdy+1,1:jpkm1,jn) + z2 * ptab_child(imin:imax,jbdy,1:jpkm1,jn)
                   DO jk = 1, jpkm1
                      DO ji = imin,imax
@@ -191,12 +195,19 @@
                   END DO
                   ! Restore ghost points:
-                  tra(imin:imax,jbdy+1,k1:k2,jn) = ptab_child(imin:imax,jbdy+1,k1:k2,jn) * tmask(imin:imax,jbdy+1,k1:k2)
-               END DO
-            ENDIF
-            !
-            IF( western_side ) THEN    
+                  tra(imin:imax,jbdy+1,1:jpkm1,jn) = ptab_child(imin:imax,jbdy+1,1:jpkm1,jn) * tmask(imin:imax,jbdy+1,1:jpkm1)
+               END DO
+            ENDIF
+            !
+            IF( western_side ) THEN
+               zrho = Agrif_Rhox()
+               z1 = ( zrho - 1._wp ) * 0.5_wp                    
+               z3 = ( zrho - 1._wp ) / ( zrho + 1._wp )         
+               z6 = 2._wp * ( zrho - 1._wp ) / ( zrho + 1._wp )
+               z7 =       - ( zrho - 1._wp ) / ( zrho + 3._wp )
+               z2 = 1._wp - z1 ; z4 = 1._wp - z3 ; z5 = 1._wp - z6 - z7
+               !    
                ibdy = 1+nbghostcells       
                DO jn = 1, jptra
-                  tra(ibdy-1,jmin:jmax,k1:k2,jn) = z1 * ptab_child(ibdy-1,jmin:jmax,k1:k2,jn) + z2 * ptab_child(ibdy,jmin:jmax,k1:k2,jn)
+                  tra(ibdy-1,jmin:jmax,1:jpkm1,jn) = z1 * ptab_child(ibdy-1,jmin:jmax,1:jpkm1,jn) + z2 * ptab_child(ibdy,jmin:jmax,1:jpkm1,jn)
                   DO jk = 1, jpkm1
                      DO jj = jmin,jmax
@@ -206,20 +217,28 @@
                            tra(ibdy,jj,jk,jn)=(z4*tra(ibdy-1,jj,jk,jn)+z3*tra(ibdy+1,jj,jk,jn))*tmask(ibdy,jj,jk)        
                            IF( un(ibdy,jj,jk) < 0._wp ) THEN
-                              tra(ibdy,jj,jk,jn)=(z6*tra(ibdy+1,jj,jk,jn)+z5*tra(ibdy-1,jj,jk,jn)+z7*tra(ibdy+2,jj,jk,jn))*tmask(ibdy,jj,jk)
-                           ENDIF
-                        ENDIF
-                     END DO
-                  END DO
-                  ! Restore ghost points:
-                  tra(ibdy-1,jmin:jmax,k1:k2,jn) = ptab_child(ibdy-1,jmin:jmax,k1:k2,jn) * tmask(ibdy-1,jmin:jmax,k1:k2)
-               END DO
-            ENDIF
-            !
-            IF( southern_side ) THEN  
+                              tra(ibdy,jj,jk,jn)=( z6*tra(ibdy+1,jj,jk,jn)+z5*tra(ibdy-1,jj,jk,jn) &
+                                                 + z7*tra(ibdy+2,jj,jk,jn) ) * tmask(ibdy,jj,jk)
+                           ENDIF
+                        ENDIF
+                     END DO
+                  END DO
+                  ! Restore ghost points:
+                  tra(ibdy-1,jmin:jmax,1:jpkm1,jn) = ptab_child(ibdy-1,jmin:jmax,1:jpkm1,jn) * tmask(ibdy-1,jmin:jmax,1:jpkm1)
+               END DO
+            ENDIF
+            !
+            IF( southern_side ) THEN
+               zrho = Agrif_Rhoy()
+               z1 = ( zrho - 1._wp ) * 0.5_wp                    
+               z3 = ( zrho - 1._wp ) / ( zrho + 1._wp )         
+               z6 = 2._wp * ( zrho - 1._wp ) / ( zrho + 1._wp )
+               z7 =       - ( zrho - 1._wp ) / ( zrho + 3._wp )
+               z2 = 1._wp - z1 ; z4 = 1._wp - z3 ; z5 = 1._wp - z6 - z7
+               !  
                jbdy=1+nbghostcells        
                DO jn = 1, jptra
-                  tra(imin:imax,jbdy-1,k1:k2,jn) = z1 * ptab_child(imin:imax,jbdy-1,k1:k2,jn) + z2 * ptab_child(imin:imax,jbdy,k1:k2,jn)
-                  DO jk = 1, jpk      
-                     DO ji=imin,imax
+                  tra(imin:imax,jbdy-1,1:jpkm1,jn) = z1 * ptab_child(imin:imax,jbdy-1,1:jpkm1,jn) + z2 * ptab_child(imin:imax,jbdy,1:jpkm1,jn)
+                  DO jk = 1, jpkm1      
+                     DO ji = imin,imax
                         IF( vmask(ji,jbdy,jk) == 0._wp ) THEN
                            tra(ji,jbdy,jk,jn)=tra(ji,jbdy-1,jk,jn) * tmask(ji,jbdy,jk)
@@ -227,15 +246,17 @@
                            tra(ji,jbdy,jk,jn)=(z4*tra(ji,jbdy-1,jk,jn)+z3*tra(ji,jbdy+1,jk,jn))*tmask(ji,jbdy,jk)
                            IF( vn(ji,jbdy,jk) < 0._wp ) THEN
-                              tra(ji,jbdy,jk,jn)=(z6*tra(ji,jbdy+1,jk,jn)+z5*tra(ji,jbdy-1,jk,jn)+z7*tra(ji,jbdy+2,jk,jn))*tmask(ji,jbdy,jk)
-                           ENDIF
-                        ENDIF
-                     END DO
-                  END DO
-                  ! Restore ghost points:
-                  tra(imin:imax,jbdy-1,k1:k2,jn) = tra(imin:imax,jbdy-1,k1:k2,jn) * tmask(imin:imax,jbdy-1,k1:k2)
+                              tra(ji,jbdy,jk,jn)=( z6*tra(ji,jbdy+1,jk,jn)+z5*tra(ji,jbdy-1,jk,jn) & 
+                                                 + z7*tra(ji,jbdy+2,jk,jn) ) * tmask(ji,jbdy,jk)
+                           ENDIF
+                        ENDIF
+                     END DO
+                  END DO
+                  ! Restore ghost points:
+                  tra(imin:imax,jbdy-1,1:jpkm1,jn) = ptab_child(imin:imax,jbdy-1,1:jpkm1,jn) * tmask(imin:imax,jbdy-1,1:jpkm1)
                END DO
             ENDIF
             !
          ENDIF
+
       ENDIF
       !
