Index: branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_tvd_crs.F90
===================================================================
--- branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_tvd_crs.F90	(revision 6101)
+++ branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/TRA/traadv_tvd_crs.F90	(revision 6772)
@@ -91,4 +91,5 @@
       !!----------------------------------------------------------------------
       !
+
       IF( nn_timing == 1 )  CALL timing_start('tra_adv_tvd')
       !
@@ -126,6 +127,6 @@
          ! upstream tracer flux in the i and j direction
          DO jk = 1, jpkm1
-            DO jj = 1, jpjm1
-               DO ji = 1, fs_jpim1   ! vector opt.
+            DO jj = 2, jpj_crs-1
+               DO ji = 2, jpi_crs-1
                   ! upstream scheme
                   zfp_ui = pun(ji,jj,jk) + ABS( pun(ji,jj,jk) )
@@ -138,13 +139,15 @@
             END DO
          END DO
+         CALL crs_lbc_lnk( zwx, 'U', -1._wp )  
+         CALL crs_lbc_lnk( zwy, 'V', -1._wp )  
          ! upstream tracer flux in the k direction
          ! Surface value
          IF( lk_vvl ) THEN   ;   zwz(:,:, 1 ) = 0.e0                         ! volume variable
-         ELSE                ;   zwz(:,:, 1 ) = pwn(:,:,1) * ptb(:,:,1,jn)   ! linear free surface 
+         ELSE                ;   zwz(:,:, 1 ) = pwn(:,:,1) !cbr * ptb(:,:,1,jn)   ! linear free surface 
          ENDIF
          ! Interior value
          DO jk = 2, jpkm1
-            DO jj = 1, jpj
-               DO ji = 1, jpi
+            DO jj = 2,  jpj_crs-1
+               DO ji = nldi_crs, nlei_crs
                   zfp_wk = pwn(ji,jj,jk) + ABS( pwn(ji,jj,jk) )
                   zfm_wk = pwn(ji,jj,jk) - ABS( pwn(ji,jj,jk) )
@@ -153,9 +156,11 @@
             END DO
          END DO
+         CALL crs_lbc_lnk( zwz, 'T', 1. )  
+
          ! total advective trend
          DO jk = 1, jpkm1
             z2dtt = p2dt(jk)
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.
+            DO jj = 2, jpj_crs-1
+               DO ji = 2, jpi_crs-1
                   zbtr = r1_bt_crs(ji,jj,jk) 
                   ! total intermediate advective trends
@@ -163,5 +168,5 @@
                      &             + zwy(ji,jj,jk) - zwy(ji  ,jj-1,jk  )   &
                      &             + zwz(ji,jj,jk) - zwz(ji  ,jj  ,jk+1) )
-                  ! update and guess with monotonic sheme
+
                   pta(ji,jj,jk,jn) =   pta(ji,jj,jk,jn)         + ztra
                   zwi(ji,jj,jk)    = ( ptb(ji,jj,jk,jn) + z2dtt * ztra ) * tmask_crs(ji,jj,jk)
@@ -169,4 +174,5 @@
             END DO
          END DO
+ 
          !                             ! Lateral boundary conditions on zwi  (unchanged sign)
          CALL crs_lbc_lnk( zwi, 'T', 1. )  
@@ -187,6 +193,6 @@
          ! antidiffusive flux on i and j
          DO jk = 1, jpkm1
-            DO jj = 1, jpjm1
-               DO ji = 1, fs_jpim1   ! vector opt.
+            DO jj = 2, jpj_crs-1
+               DO ji = 2, jpi_crs-1
                   zwx(ji,jj,jk) = 0.5 * pun(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji+1,jj,jk,jn) ) - zwx(ji,jj,jk)
                   zwy(ji,jj,jk) = 0.5 * pvn(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji,jj+1,jk,jn) ) - zwy(ji,jj,jk)
@@ -198,10 +204,10 @@
          !
          DO jk = 2, jpkm1          ! Interior value
-            DO jj = 1, jpj
-               DO ji = 1, jpi
+            DO jj = 2, jpj_crs-1
+               DO ji = 2, jpi_crs-1
                   zwz(ji,jj,jk) = 0.5 * pwn(ji,jj,jk) * ( ptn(ji,jj,jk,jn) + ptn(ji,jj,jk-1,jn) ) - zwz(ji,jj,jk)
                END DO
             END DO
-         END DO
+        END DO
          CALL crs_lbc_lnk( zwx, 'U', -1. )   ;   CALL crs_lbc_lnk( zwy, 'V', -1. )         ! Lateral bondary conditions
          CALL crs_lbc_lnk( zwz, 'W',  1. )
@@ -214,6 +220,6 @@
          ! ------------------------------------
          DO jk = 1, jpkm1
-            DO jj = 2, jpjm1
-               DO ji = fs_2, fs_jpim1   ! vector opt.  
+            DO jj = 2, jpj_crs-1
+               DO ji = 2, jpi_crs-1
                   zbtr = r1_bt_crs(ji,jj,jk)
                   ! total advective trends
@@ -247,4 +253,5 @@
       END DO
       !
+
                    CALL wrk_dealloc( jpi, jpj, jpk, zwi, zwz , zwx, zwy )
       IF( l_trd )  CALL wrk_dealloc( jpi, jpj, jpk, ztrdx, ztrdy, ztrdz )
@@ -302,6 +309,6 @@
          ikm1 = MAX(jk-1,1)
          z2dtt = p2dt(jk)
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1   ! vector opt.
+         DO jj = 2, jpj_crs-1
+            DO ji = 2, jpi_crs-1
 
                ! search maximum in neighbourhood
@@ -339,6 +346,6 @@
       ! ----------------------------------------
       DO jk = 1, jpkm1
-         DO jj = 2, jpjm1
-            DO ji = fs_2, fs_jpim1   ! vector opt.
+         DO jj = 2, jpj_crs-1
+            DO ji = 2, jpi_crs-1
                zau = MIN( 1.e0, zbetdo(ji,jj,jk), zbetup(ji+1,jj,jk) )
                zbu = MIN( 1.e0, zbetup(ji,jj,jk), zbetdo(ji+1,jj,jk) )
