Index: /trunk/NEMO/TOP_SRC/TRP/trczdf_exp.F90
===================================================================
--- /trunk/NEMO/TOP_SRC/TRP/trczdf_exp.F90	(revision 489)
+++ /trunk/NEMO/TOP_SRC/TRP/trczdf_exp.F90	(revision 490)
@@ -97,5 +97,5 @@
          IF( neuler == 0 .AND. kt == nittrc000 ) THEN
             rdttrc(:) =  rdttra(:) * FLOAT(ndttrc)             ! restarting with Euler time stepping
-         ELSEIF( kt <= nittrc000 + 1 ) THEN
+         ELSEIF( kt <= nittrc000 + ndttrc ) THEN
             rdttrc(:) = 2. * rdttra(:) * FLOAT(ndttrc)         ! leapfrog
          ENDIF
Index: /trunk/NEMO/TOP_SRC/TRP/trczdf_imp.F90
===================================================================
--- /trunk/NEMO/TOP_SRC/TRP/trczdf_imp.F90	(revision 489)
+++ /trunk/NEMO/TOP_SRC/TRP/trczdf_imp.F90	(revision 490)
@@ -97,5 +97,5 @@
          IF( neuler == 0 .AND. kt == nittrc000 ) THEN
             rdttrc(:) =  rdttra(:) * FLOAT(ndttrc)             ! restarting with Euler time stepping
-         ELSEIF( kt <= nittrc000 + 1 ) THEN
+         ELSEIF( kt <= nittrc000 + ndttrc ) THEN
             rdttrc(:) = 2. * rdttra(:) * FLOAT(ndttrc)         ! leapfrog
          ENDIF
@@ -145,10 +145,65 @@
          END DO
          
- 
-	! Matrix inversion from the first level
-	ikst = 1
-
-#   include "zdf.matrixsolver.vopt.h90"        
- 
+         
+         ! Matrix inversion from the first level
+         !----------------------------------------------------------------------
+         !   solve m.x = y  where m is a tri diagonal matrix ( jpk*jpk )
+         !
+         !        ( zwd1 zws1   0    0    0  )( zwx1 ) ( zwy1 )
+         !        ( zwi2 zwd2 zws2   0    0  )( zwx2 ) ( zwy2 )
+         !        (  0   zwi3 zwd3 zws3   0  )( zwx3 )=( zwy3 )
+         !        (        ...               )( ...  ) ( ...  )
+         !        (  0    0    0   zwik zwdk )( zwxk ) ( zwyk )
+         !
+         !   m is decomposed in the product of an upper and lower triangular matrix
+         !   The 3 diagonal terms are in 2d arrays: zwd, zws, zwi
+         !   The second member is in 2d array zwy
+         !   The solution is in 2d array zwx
+         !   The 3d arry zwt is a work space array
+         !   zwy is used and then used as a work space array : its value is modified!
+         !
+         !   N.B. the starting vertical index (ikst) is equal to 1 except for
+         !   the resolution of tke matrix where surface tke value is prescribed
+         !   so that ikstrt=2.
+        ikst = 1
+        ikstp1 = ikst + 1
+        ikenm2 = jpk - 2
+        
+        DO jj = 2, jpjm1
+           DO ji = fs_2, fs_jpim1
+              zwt(ji,jj,ikst) = zwd(ji,jj,ikst)
+           END DO
+        END DO
+        
+        DO jk = ikstp1, jpkm1
+           DO jj = 2, jpjm1
+              DO ji = fs_2, fs_jpim1
+                 zwt(ji,jj,jk) = zwd(ji,jj,jk) - zwi(ji,jj,jk) * zws(ji,jj,jk-1) / zwt(ji,jj,jk-1)
+              END DO
+           END DO
+        END DO
+        
+        DO jk = ikstp1, jpkm1
+           DO jj = 2, jpjm1
+              DO ji = fs_2, fs_jpim1
+                 zwy(ji,jj,jk) = zwy(ji,jj,jk) - zwi(ji,jj,jk) / zwt(ji,jj,jk-1) * zwy(ji,jj,jk-1)
+              END DO
+           END DO
+        END DO
+        
+        DO jj = 2, jpjm1
+           DO ji = fs_2, fs_jpim1
+              zwx(ji,jj,jpkm1) = zwy(ji,jj,jpkm1) / zwt(ji,jj,jpkm1)
+           END DO
+        END DO
+        
+        DO jk = ikenm2, ikst, -1
+           DO jj = 2, jpjm1
+              DO ji = fs_2, fs_jpim1
+                 zwx(ji,jj,jk) = ( zwy(ji,jj,jk) - zws(ji,jj,jk) * zwx(ji,jj,jk+1) ) / zwt(ji,jj,jk)
+              END DO
+           END DO
+        END DO
+
          
 #if defined key_trc_diatrd
Index: /trunk/NEMO/TOP_SRC/TRP/trczdf_iso.F90
===================================================================
--- /trunk/NEMO/TOP_SRC/TRP/trczdf_iso.F90	(revision 489)
+++ /trunk/NEMO/TOP_SRC/TRP/trczdf_iso.F90	(revision 490)
@@ -125,7 +125,6 @@
       INTEGER ::   ji, jj, jk, jn                 ! dummy loop indices
       INTEGER ::   ikst, ikenm2, ikstp1       ! temporary integers
-#if defined key_partial_steps
       INTEGER ::   iku, ikv, ikv1             ! temporary integers
-#endif
+
       REAL(wp) ::   ztra
       REAL(wp) ::   &
@@ -167,5 +166,5 @@
          IF( neuler == 0 .AND. kt == nittrc000 ) THEN
             rdttrc(:) =  rdttra(:) * FLOAT(ndttrc)             ! restarting with Euler time stepping
-         ELSEIF( kt <= nittrc000 + 1 ) THEN
+         ELSEIF( kt <= nittrc000 + ndttrc ) THEN
             rdttrc(:) = 2. * rdttra(:) * FLOAT(ndttrc)         ! leapfrog
          ENDIF
@@ -208,20 +207,20 @@
                END DO
             END DO
-#  if defined key_partial_steps
-            ! partial steps correction at the bottom ocean level 
-            DO ji = 1, jpim1
-               ! last ocean level
-               iku  = MIN( mbathy(ji,jj), mbathy(ji+1,jj  ) ) - 1
-               ikv  = MIN( mbathy(ji,jj), mbathy(ji  ,jj+1) ) - 1
-               ikv1 = MIN( mbathy(ji,jj), mbathy(ji  ,jj-1) ) - 1
-               ! i-gradient of of passive tracer at jj
-               zdit (ji,iku) = gtru(ji,jj,jn)
-               ! j-gradient of of passive tracer at jj
-               zdjt (ji,ikv) = gtrv(ji,jj,jn) 
-               ! j-gradient of of passive tracer at jj+1
-               zdj1t(ji,ikv1)= gtrv(ji,jj-1,jn)
-            END DO
-#endif
-
+
+            IF( ln_zps ) THEN
+               ! partial steps correction at the bottom ocean level 
+               DO ji = 1, jpim1
+                  ! last ocean level
+                  iku  = MIN( mbathy(ji,jj), mbathy(ji+1,jj  ) ) - 1
+                  ikv  = MIN( mbathy(ji,jj), mbathy(ji  ,jj+1) ) - 1
+                  ikv1 = MIN( mbathy(ji,jj), mbathy(ji  ,jj-1) ) - 1
+                  ! i-gradient of of passive tracer at jj
+                  zdit (ji,iku) = gtru(ji,jj,jn)
+                  ! j-gradient of of passive tracer at jj
+                  zdjt (ji,ikv) = gtrv(ji,jj,jn) 
+                  ! j-gradient of of passive tracer at jj+1
+                  zdj1t(ji,ikv1)= gtrv(ji,jj-1,jn)
+               END DO
+            ENDIF
 
             ! I.2 Vertical fluxes
@@ -279,5 +278,5 @@
             !                              ! Eddy induced vertical advective fluxes !
             !                              ! ---------------------------------------!
-#if defined key_traldf_c2d || defined key_traldf_c3d
+#if defined key_traldf_c2d || defined key_traldf_c3d || defined key_off_degrad
             DO jk = 2, jpkm1
                DO ji = 2, jpim1
Index: /trunk/NEMO/TOP_SRC/TRP/trczdf_iso_vopt.F90
===================================================================
--- /trunk/NEMO/TOP_SRC/TRP/trczdf_iso_vopt.F90	(revision 489)
+++ /trunk/NEMO/TOP_SRC/TRP/trczdf_iso_vopt.F90	(revision 490)
@@ -177,5 +177,5 @@
          IF( neuler == 0 .AND. kt == nittrc000 ) THEN
             rdttrc(:) =  rdttra(:) * FLOAT(ndttrc)             ! restarting with Euler time stepping
-         ELSEIF( kt <= nittrc000 + 1 ) THEN
+         ELSEIF( kt <= nittrc000 + ndttrc ) THEN
             rdttrc(:) = 2. * rdttra(:) * FLOAT(ndttrc)         ! leapfrog
          ENDIF
@@ -398,7 +398,5 @@
       !! * Local declarations
       INTEGER ::   ji, jj, jk,jn       ! dummy loop indices
-#if defined key_partial_steps
       INTEGER ::   iku, ikv
-#endif
       REAL(wp) ::   &
          ztavg,                  &  ! temporary scalars
@@ -446,18 +444,18 @@
             END DO
          END DO
-#  if defined key_partial_steps
-         ! partial steps correction at the bottom ocean level 
-         DO jj = 1, jpjm1
-            DO ji = 1, fs_jpim1   ! vector opt.
-               ! last ocean level
-               iku  = MIN( mbathy(ji,jj), mbathy(ji+1,jj  ) ) - 1
-               ikv  = MIN( mbathy(ji,jj), mbathy(ji  ,jj+1) ) - 1
-               ! i-gradient of passive tracer
-               zwx (ji,jj,iku) = gtru(ji,jj,jn)
-               ! j-gradient of passive tracer
-               zwy (ji,jj,ikv) = gtrv(ji,jj,jn)  
-            END DO
-         END DO
-#endif
+         IF( ln_zps ) THEN
+            ! partial steps correction at the bottom ocean level 
+            DO jj = 1, jpjm1
+               DO ji = 1, fs_jpim1   ! vector opt.
+                  ! last ocean level
+                  iku  = MIN( mbathy(ji,jj), mbathy(ji+1,jj  ) ) - 1
+                  ikv  = MIN( mbathy(ji,jj), mbathy(ji  ,jj+1) ) - 1
+                  ! i-gradient of passive tracer
+                  zwx (ji,jj,iku) = gtru(ji,jj,jn)
+                  ! j-gradient of passive tracer
+                  zwy (ji,jj,ikv) = gtrv(ji,jj,jn)  
+               END DO
+            END DO
+         ENDIF
 
 
@@ -502,5 +500,5 @@
             DO jj = 2, jpjm1
                DO ji = fs_2, fs_jpim1   ! vector opt.
-#   if defined key_traldf_c2d || defined key_traldf_c3d
+#   if defined key_traldf_c2d || defined key_traldf_c3d  || defined key_off_degrad
                   zuwki = ( wslpi(ji,jj,jk) + wslpi(ji-1,jj,jk) )   &
                      &  * fsaeitru(ji-1,jj,jk) * e2u(ji-1,jj) * umask(ji-1,jj,jk)
