Index: trunk/NEMO/LIM_SRC_3/limrhg.F90
===================================================================
--- trunk/NEMO/LIM_SRC_3/limrhg.F90	(revision 834)
+++ trunk/NEMO/LIM_SRC_3/limrhg.F90	(revision 866)
@@ -176,6 +176,4 @@
          zresr                         !: Local error on velocity
 
-      INTEGER :: &
-         stress_mean_swi = 1
 !
 !------------------------------------------------------------------------------!
@@ -203,7 +201,6 @@
             zc1(ji,jj)    = tms(ji,jj) * ( rhosn * vt_s(ji,jj) + rhoic * vt_i(ji,jj) )
             zpresh(ji,jj) = tms(ji,jj) *  strength(ji,jj) / 2.
-            ! tmi = 1 where ther is ice or on land
-            ! Claude sees a bug, next line : tmi(ji,jj)
-            tmi           = 1.0 - ( 1.0 - MAX( 0.0 , SIGN ( 1.0 , vt_i(ji,jj) - &
+            ! tmi = 1 where there is ice or on land
+            tmi(ji,jj)    = 1.0 - ( 1.0 - MAX( 0.0 , SIGN ( 1.0 , vt_i(ji,jj) - &
                                     epsd ) ) ) * tms(ji,jj)
          END DO
@@ -213,6 +210,5 @@
       CALL lbc_lnk( zpresh(:,:), 'T',  1. )
 
-! Claude sees a bug
-!     CALL lbc_lnk( tmi(:,:), 'T',  1. )
+      CALL lbc_lnk( tmi(:,:), 'T',  1. )
 
       ! Ice strength on grid cell corners (zpreshc)
@@ -280,10 +276,18 @@
 
             ! Ocean has no slip boundary condition
-            v_oce1(ji,jj)  = 0.5*( (v_io(ji,jj)+v_io(ji,jj-1))*e1t(ji+1,jj)    &
-                &                 +(v_io(ji+1,jj)+v_io(ji+1,jj-1))*e1t(ji,jj)) &
+! GG bug
+!           v_oce1(ji,jj)  = 0.5*( (v_io(ji,jj)+v_io(ji,jj-1))*e1t(ji+1,jj)    &
+!               &                 +(v_io(ji+1,jj)+v_io(ji+1,jj-1))*e1t(ji,jj)) &
+!               &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)  
+            v_oce1(ji,jj)  = 0.5*( (v_io(ji,jj)+v_io(ji,jj-1))*e1t(ji,jj)    &
+                &                 +(v_io(ji+1,jj)+v_io(ji+1,jj-1))*e1t(ji+1,jj)) &
                 &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)  
 
-            u_oce2(ji,jj)  = 0.5*((u_io(ji,jj)+u_io(ji-1,jj))*e2t(ji,jj+1)     &
-                &                 +(u_io(ji,jj+1)+u_io(ji-1,jj+1))*e2t(ji,jj)) &
+! GG bug
+!           u_oce2(ji,jj)  = 0.5*((u_io(ji,jj)+u_io(ji-1,jj))*e2t(ji,jj+1)     &
+!               &                 +(u_io(ji,jj+1)+u_io(ji-1,jj+1))*e2t(ji,jj)) &
+!               &                / (e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)
+            u_oce2(ji,jj)  = 0.5*((u_io(ji,jj)+u_io(ji-1,jj))*e2t(ji,jj)     &
+                &                 +(u_io(ji,jj+1)+u_io(ji-1,jj+1))*e2t(ji,jj+1)) &
                 &                / (e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)
 
@@ -322,13 +326,7 @@
 
       !-Initialise stress tensor 
-      IF ( stress_mean_swi .NE. 1 ) THEN
-         zs1(:,:)  = 0.0
-         zs2(:,:)  = 0.0
-         zs12(:,:) = 0.0
-      ELSE
-         zs1(:,:)  = stress1_i(:,:)
-         zs2(:,:)  = stress2_i(:,:)
-         zs12(:,:) = stress12_i(:,:)
-      ENDIF
+      zs1(:,:)  = stress1_i(:,:)
+      zs2(:,:)  = stress2_i(:,:)
+      zs12(:,:) = stress12_i(:,:)
 
       v_ice1(:,:) = 0.0
@@ -512,6 +510,10 @@
 
                     ! SB modif because ocean has no slip boundary condition
-                    zv_ice1       = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji+1,jj)     &
-                      &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji,jj))   &
+! GG bug
+!                   zv_ice1       = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji+1,jj)     &
+!                     &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji,jj))   &
+!                     &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)
+                    zv_ice1       = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji,jj)         &
+                      &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji+1,jj))   &
                       &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)
                     za           = rhoco*SQRT((u_ice(ji,jj)-u_oce1(ji,jj))**2 + &
@@ -535,6 +537,10 @@
                     z0           = zmass2(ji,jj)/dtevp
                     ! SB modif because ocean has no slip boundary condition
-                    zu_ice2       = 0.5*( (u_ice(ji,jj)+u_ice(ji-1,jj))*e2t(ji,jj+1)     &
-                &                 + (u_ice(ji,jj+1)+u_ice(ji-1,jj+1))*e2t(ji,jj))   &
+! GG bug
+!                   zu_ice2       = 0.5*( (u_ice(ji,jj)+u_ice(ji-1,jj))*e2t(ji,jj+1)     &
+!               &                 + (u_ice(ji,jj+1)+u_ice(ji-1,jj+1))*e2t(ji,jj))   &
+!               &               /(e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)
+                    zu_ice2       = 0.5*( (u_ice(ji,jj)+u_ice(ji-1,jj))*e2t(ji,jj)     &
+                &                 + (u_ice(ji,jj+1)+u_ice(ji-1,jj+1))*e2t(ji,jj+1))   &
                 &               /(e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)
                     za           = rhoco*SQRT((zu_ice2-u_oce2(ji,jj))**2 + & 
@@ -558,6 +564,10 @@
                     z0           = zmass2(ji,jj)/dtevp
                     ! SB modif because ocean has no slip boundary condition
-                    zu_ice2       = 0.5*( (u_ice(ji,jj)+u_ice(ji-1,jj))*e2t(ji,jj+1)      &
-                       &                 +(u_ice(ji,jj+1)+u_ice(ji-1,jj+1))*e2t(ji,jj))   &
+! GG Bug
+!                   zu_ice2       = 0.5*( (u_ice(ji,jj)+u_ice(ji-1,jj))*e2t(ji,jj+1)      &
+!                      &                 +(u_ice(ji,jj+1)+u_ice(ji-1,jj+1))*e2t(ji,jj))   &
+!                      &               /(e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)   
+                    zu_ice2       = 0.5*( (u_ice(ji,jj)+u_ice(ji-1,jj))*e2t(ji,jj)      &
+                       &                 +(u_ice(ji,jj+1)+u_ice(ji-1,jj+1))*e2t(ji,jj+1))   &
                        &               /(e2t(ji,jj+1)+e2t(ji,jj)) * tmv(ji,jj)   
 
@@ -581,6 +591,10 @@
                     z0           = zmass1(ji,jj)/dtevp
                     ! SB modif because ocean has no slip boundary condition
-                    zv_ice1       = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji+1,jj)      &
-                       &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji,jj))   &
+! GG Bug
+!                   zv_ice1       = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji+1,jj)      &
+!                      &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji,jj))   &
+!                      &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)
+                    zv_ice1       = 0.5*( (v_ice(ji,jj)+v_ice(ji,jj-1))*e1t(ji,jj)      &
+                       &                 +(v_ice(ji+1,jj)+v_ice(ji+1,jj-1))*e1t(ji+1,jj))   &
                        &               /(e1t(ji+1,jj)+e1t(ji,jj)) * tmu(ji,jj)
     
@@ -628,10 +642,6 @@
          END DO
       END DO
-!
-!------------------------------------------------------------------------------!
-! 5) Compute stress rain invariants and store strain tensor
-!------------------------------------------------------------------------------!
-!
-      ! Compute delta, shear and div, inputs for mechanical redistribution 
+
+      ! Recompute delta, shear and div, inputs for mechanical redistribution 
       DO jj = k_j1+1, k_jpj-1
          DO ji = 2, jpim1
@@ -690,48 +700,35 @@
      &                          ) + creepl
 
-             divu_i(ji,jj)  = zdd(ji,jj) 
-             delta_i(ji,jj) = deltat(ji,jj) 
-             shear_i(ji,jj) = zds(ji,jj)
-
              ENDIF ! zdummy
 
          END DO !jj
       END DO !ji
-
-! MV This should be removed as it is the same as previous lines
-!     ! dynamical invariants
-!     IF ( stress_mean_swi .EQ. 0 ) THEN
-! the following should not be necessary
-         DO jj = k_j1+1, k_jpj-1
-            DO ji = 2, jpim1
-               divu_i(ji,jj)  = zdd(ji,jj)
-               delta_i(ji,jj) = deltat (ji,jj)
-               shear_i(ji,jj) = zds (ji,jj)
-            END DO
+!
+!------------------------------------------------------------------------------!
+! 5) Store stress tensor and its invariants
+!------------------------------------------------------------------------------!
+!
+      ! * Invariants of the stress tensor are required for limitd_me
+      ! * Store the stress tensor for the next time step
+      ! accelerates convergence and improves stability
+      DO jj = k_j1+1, k_jpj-1
+         DO ji = 2, jpim1
+            divu_i(ji,jj)  = zdd(ji,jj)
+            delta_i(ji,jj) = deltat (ji,jj)
+            shear_i(ji,jj) = zds (ji,jj)
+            stress1_i(ji,jj)  = zs1(ji,jj)
+            stress2_i(ji,jj)  = zs2(ji,jj)
+            stress12_i(ji,jj) = zs12(ji,jj)
          END DO
-!     ENDIF
-
+      END DO
+
+      ! Lateral boundary condition
       CALL lbc_lnk( divu_i(:,:) , 'T', 1. )
       CALL lbc_lnk( delta_i(:,:), 'T', 1. )
       CALL lbc_lnk( shear_i(:,:), 'F', 1. )
-
-
-      ! Store the stress tensor for next time step
-      ! this accelerates convergence and improves stability
-      IF ( stress_mean_swi .EQ. 1 ) THEN
-         DO jj = k_j1+1, k_jpj-1
-            DO ji = 2, jpim1
-               stress1_i(ji,jj)  = zs1(ji,jj)
-               stress2_i(ji,jj)  = zs2(ji,jj)
-               stress12_i(ji,jj) = zs12(ji,jj)
-            END DO
-         END DO
-      ENDIF
-
-      ! Lateral boundary condition
       CALL lbc_lnk( stress1_i(:,:), 'T', 1. )
       CALL lbc_lnk( stress2_i(:,:), 'T', 1. )
       CALL lbc_lnk( stress12_i(:,:), 'F', 1. )
- 
+
 !
 !------------------------------------------------------------------------------!
