Index: trunk/NEMO/LIM_SRC_2/limadv_2.F90
===================================================================
--- trunk/NEMO/LIM_SRC_2/limadv_2.F90	(revision 1528)
+++ trunk/NEMO/LIM_SRC_2/limadv_2.F90	(revision 1529)
@@ -25,4 +25,7 @@
    PUBLIC lim_adv_x_2    ! called by lim_trp
    PUBLIC lim_adv_y_2    ! called by lim_trp
+
+   !! * Substitutions
+#  include "vectopt_loop_substitute.h90"
 
    !! * Module variables
@@ -110,7 +113,5 @@
 
       !  Calculate fluxes and moments between boxes i<-->i+1              
-      DO jj = 2, jpjm1                    !  Flux from i to i+1 WHEN u GT 0 
-!i bug   DO ji = 1, jpim1 
-!i    DO jj = 1, jpj                      !  Flux from i to i+1 WHEN u GT 0 
+      DO jj = 1, jpj                      !  Flux from i to i+1 WHEN u GT 0 
          DO ji = 1, jpi
             zbet(ji,jj)  =  MAX( rzero, SIGN( rone, put(ji,jj) ) )
@@ -138,7 +139,6 @@
       END DO
 
-      DO jj = 2, jpjm1                      !  Flux from i+1 to i when u LT 0.
-!i    DO jj = 1, jpjm1                      !  Flux from i+1 to i when u LT 0.
-         DO ji = 1, jpim1
+      DO jj = 1, jpjm1                      !  Flux from i+1 to i when u LT 0.
+         DO ji = 1, fs_jpim1
             zalf          = MAX( rzero, -put(ji,jj) ) * zrdt * e2u(ji,jj) / psm(ji+1,jj) 
             zalg  (ji,jj) = zalf
@@ -159,5 +159,5 @@
 
       DO jj = 2, jpjm1                     !  Readjust moments remaining in the box. 
-         DO ji = 2, jpim1
+         DO ji = fs_2, fs_jpim1
             zbt  =       zbet(ji-1,jj)
             zbt1 = 1.0 - zbet(ji-1,jj)
@@ -174,5 +174,5 @@
       !   Put the temporary moments into appropriate neighboring boxes.    
       DO jj = 2, jpjm1                     !   Flux from i to i+1 IF u GT 0.
-         DO ji = 2, jpim1
+         DO ji = fs_2, fs_jpim1
             zbt  =       zbet(ji-1,jj)
             zbt1 = 1.0 - zbet(ji-1,jj)
@@ -195,5 +195,5 @@
 
       DO jj = 2, jpjm1                     !  Flux from i+1 to i IF u LT 0.
-         DO ji = 2, jpim1
+         DO ji = fs_2, fs_jpim1
             zbt  =       zbet(ji,jj)
             zbt1 = 1.0 - zbet(ji,jj)
@@ -225,5 +225,5 @@
       CALL lbc_lnk( psxy, 'T',  1. )
 
-      IF(ln_ctl)   THEN
+      IF(ln_ctl) THEN
          CALL prt_ctl(tab2d_1=psm  , clinfo1=' lim_adv_x: psm  :', tab2d_2=ps0 , clinfo2=' ps0  : ')
          CALL prt_ctl(tab2d_1=psx  , clinfo1=' lim_adv_x: psx  :', tab2d_2=psxx, clinfo2=' psxx : ')
@@ -303,8 +303,6 @@
 
        !  Calculate fluxes and moments between boxes j<-->j+1              
-!!bug  DO jj = 2, jpjm1
        DO jj = 1, jpj
-          DO ji = 2, jpim1
-!!bug     DO ji = 1, jpim1
+          DO ji = 1, jpi
              !  Flux from j to j+1 WHEN v GT 0   
              zbet(ji,jj)  =  MAX( rzero, SIGN( rone, pvt(ji,jj) ) )
@@ -333,7 +331,5 @@
 
        DO jj = 1, jpjm1                   !  Flux from j+1 to j when v LT 0.
-          DO ji = 2, jpim1
-!i     DO jj = 1, jpjm1                   !  Flux from j+1 to j when v LT 0.
-!i        DO ji = 2, jpim1
+          DO ji = 1, jpi
              zalf          = ( MAX(rzero, -pvt(ji,jj) ) * zrdt * e1v(ji,jj) ) / psm(ji,jj+1) 
              zalg  (ji,jj) = zalf
@@ -354,6 +350,6 @@
  
        !  Readjust moments remaining in the box. 
-       DO jj = 2, jpjm1
-          DO ji = 2, jpim1
+       DO jj = 2, jpj
+          DO ji = 1, jpi
              zbt  =         zbet(ji,jj-1)
              zbt1 = ( 1.0 - zbet(ji,jj-1) )
@@ -370,5 +366,5 @@
        !   Put the temporary moments into appropriate neighboring boxes.    
        DO jj = 2, jpjm1                    !   Flux from j to j+1 IF v GT 0.
-          DO ji = 2, jpim1
+          DO ji = 1, jpi
              zbt  =         zbet(ji,jj-1)
              zbt1 = ( 1.0 - zbet(ji,jj-1) )
@@ -395,5 +391,5 @@
 
        DO jj = 2, jpjm1                   !  Flux from j+1 to j IF v LT 0.
-          DO ji = 2, jpim1
+          DO ji = 1, jpi
              zbt  =         zbet(ji,jj)
              zbt1 = ( 1.0 - zbet(ji,jj) )
Index: trunk/NEMO/LIM_SRC_3/limadv.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limadv.F90	(revision 1528)
+++ trunk/NEMO/LIM_SRC_3/limadv.F90	(revision 1529)
@@ -114,6 +114,4 @@
       !  Calculate fluxes and moments between boxes i<-->i+1              
       DO jj = 1, jpj                      !  Flux from i to i+1 WHEN u GT 0 
-         !i bug   DO ji = 1, jpim1 
-         !i    DO jj = 1, jpj                      !  Flux from i to i+1 WHEN u GT 0 
          DO ji = 1, jpi
             zbet(ji,jj)  =  MAX( rzero, SIGN( rone, put(ji,jj) ) )
@@ -142,5 +140,4 @@
 
       DO jj = 1, jpjm1                      !  Flux from i+1 to i when u LT 0.
-         !i    DO jj = 1, fs_jpjm1                   !  Flux from i+1 to i when u LT 0.
          DO ji = 1, fs_jpim1
             zalf          = MAX( rzero, -put(ji,jj) ) * zrdt * e2u(ji,jj) / psm(ji+1,jj) 
@@ -162,5 +159,5 @@
 
       DO jj = 2, jpjm1                     !  Readjust moments remaining in the box. 
-         DO ji = fs_2, jpi
+         DO ji = fs_2, fs_jpim1
             zbt  =       zbet(ji-1,jj)
             zbt1 = 1.0 - zbet(ji-1,jj)
@@ -306,8 +303,6 @@
 
       !  Calculate fluxes and moments between boxes j<-->j+1              
-      !!bug  DO jj = 2, jpjm1
       DO jj = 1, jpj
          DO ji = 1, jpi
-            !!bug     DO ji = 1, jpim1
             !  Flux from j to j+1 WHEN v GT 0   
             zbet(ji,jj)  =  MAX( rzero, SIGN( rone, pvt(ji,jj) ) )
@@ -337,6 +332,4 @@
       DO jj = 1, jpjm1                   !  Flux from j+1 to j when v LT 0.
          DO ji = 1, jpi
-            !i     DO jj = 1, jpjm1                   !  Flux from j+1 to j when v LT 0.
-            !i        DO ji = 2, jpim1
             zalf          = ( MAX(rzero, -pvt(ji,jj) ) * zrdt * e1v(ji,jj) ) / psm(ji,jj+1) 
             zalg  (ji,jj) = zalf
