Index: /NEMO/trunk/src/OCE/DYN/dynnxt.F90
===================================================================
--- /NEMO/trunk/src/OCE/DYN/dynnxt.F90	(revision 12278)
+++ /NEMO/trunk/src/OCE/DYN/dynnxt.F90	(revision 12279)
@@ -225,38 +225,22 @@
             zcoef = atfp * rdt * r1_rau0
 
-            e3t_b(:,:,1) = e3t_b(:,:,1) - zcoef * ( emp_b(:,:) - emp(:,:) ) * tmask(:,:,1)
+            DO jk = 1, jpkm1
+               e3t_b(:,:,jk) = e3t_b(:,:,jk) - zcoef * ( emp_b(:,:) - emp(:,:) ) * tmask(:,:,jk) & 
+                             &                       * e3t_n(:,:,jk) /  ( ht_n(:,:) + 1._wp - ssmask(:,:) )
+            END DO
 
             IF ( ln_rnf ) THEN
-               IF( ln_rnf_depth ) THEN
-                  DO jk = 1, jpkm1 ! Deal with Rivers separetely, as can be through depth too
-                     DO jj = 1, jpj
-                        DO ji = 1, jpi
-                           IF( jk <=  nk_rnf(ji,jj)  ) THEN
-                               e3t_b(ji,jj,jk) =   e3t_b(ji,jj,jk) - zcoef *  ( - rnf_b(ji,jj) + rnf(ji,jj) ) &
-                                      &          * ( e3t_n(ji,jj,jk) / h_rnf(ji,jj) ) * tmask(ji,jj,jk)
-                           ENDIF
-                        ENDDO
-                     ENDDO
-                  ENDDO
-               ELSE
-                  e3t_b(:,:,1) = e3t_b(:,:,1) - zcoef *  ( -rnf_b(:,:) + rnf(:,:))*tmask(:,:,1)
-               ENDIF
-            END IF
-
-            IF ( ln_isf ) THEN   ! if ice shelf melting
-               DO jk = 1, jpkm1 ! Deal with isf separetely, as can be through depth too
-                  DO jj = 1, jpj
-                     DO ji = 1, jpi
-                        IF( misfkt(ji,jj) <=jk .and. jk < misfkb(ji,jj)  ) THEN
-                           e3t_b(ji,jj,jk) = e3t_b(ji,jj,jk) - zcoef * ( fwfisf_b(ji,jj) - fwfisf(ji,jj) ) &
-                                &          * ( e3t_n(ji,jj,jk) * r1_hisf_tbl(ji,jj) ) * tmask(ji,jj,jk)
-                        ELSEIF ( jk==misfkb(ji,jj) ) THEN
-                           e3t_b(ji,jj,jk) = e3t_b(ji,jj,jk) - zcoef * ( fwfisf_b(ji,jj) - fwfisf(ji,jj) ) &
-                                &          * ( e3t_n(ji,jj,jk) * r1_hisf_tbl(ji,jj) ) * ralpha(ji,jj) * tmask(ji,jj,jk)
-                        ENDIF
-                     END DO
-                  END DO
-               END DO
-            END IF
+               DO jk = 1, jpkm1
+                  e3t_b(:,:,jk) = e3t_b(:,:,jk) - zcoef * ( rnf_b(:,:) - rnf(:,:) ) * tmask(:,:,jk) & 
+                                &                       * e3t_n(:,:,jk) /  ( ht_n(:,:) + 1._wp - ssmask(:,:) )
+               END DO
+            ENDIF
+
+            IF ( ln_isf ) THEN
+               DO jk = 1, jpkm1
+                  e3t_b(:,:,jk) = e3t_b(:,:,jk) - zcoef * ( fwfisf_b(:,:) - fwfisf(:,:) ) * tmask(:,:,jk) & 
+                                &                       * e3t_n(:,:,jk) /  ( ht_n(:,:) + 1._wp - ssmask(:,:) )
+               END DO
+            ENDIF
             !
             IF( ln_dynadv_vec ) THEN      ! Asselin filter applied on velocity
Index: /NEMO/trunk/src/OCE/TRA/tranxt.F90
===================================================================
--- /NEMO/trunk/src/OCE/TRA/tranxt.F90	(revision 12278)
+++ /NEMO/trunk/src/OCE/TRA/tranxt.F90	(revision 12279)
@@ -267,5 +267,5 @@
       INTEGER  ::   ji, jj, jk, jn              ! dummy loop indices
       REAL(wp) ::   zfact, zfact1, ztc_a , ztc_n , ztc_b , ztc_f , ztc_d    ! local scalar
-      REAL(wp) ::   zfact2, ze3t_b, ze3t_n, ze3t_a, ze3t_f, ze3t_d   !   -      -
+      REAL(wp) ::   zfact2, ze3t_b, ze3t_n, ze3t_a, ze3t_f, ze3t_d, zscale  !   -      -
       REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) ::   ztrd_atf
       !!----------------------------------------------------------------------
@@ -312,21 +312,12 @@
                   ztc_f  = ztc_n  + atfp * ztc_d
                   !
+                  zscale = zfact2 * e3t_n(ji,jj,jk) / ( ht_n(ji,jj) + 1._wp - ssmask(ji,jj) )
+                  ze3t_f = ze3t_f - zscale * ( emp_b(ji,jj) - emp(ji,jj) )
+                  IF ( ll_rnf ) ze3t_f = ze3t_f - zscale * (    rnf_b(ji,jj) -    rnf(ji,jj) )
+                  IF ( ll_isf ) ze3t_f = ze3t_f - zscale * ( fwfisf_b(ji,jj) - fwfisf(ji,jj) )
+
                   IF( jk == mikt(ji,jj) ) THEN           ! first level 
-                     ze3t_f = ze3t_f - zfact2 * ( (emp_b(ji,jj)    - emp(ji,jj)   )  &
-                            &                   + (fwfisf_b(ji,jj) - fwfisf(ji,jj))  )
                      ztc_f  = ztc_f  - zfact1 * ( psbc_tc(ji,jj,jn) - psbc_tc_b(ji,jj,jn) )
                   ENDIF
-                  IF( ln_rnf_depth ) THEN
-                     ! Rivers are not just at the surface must go down to nk_rnf(ji,jj)
-                     IF( mikt(ji,jj) <=jk .and. jk <= nk_rnf(ji,jj)  ) THEN
-                        ze3t_f = ze3t_f - zfact2 * ( - (rnf_b(ji,jj) - rnf(ji,jj)   )  ) &
-                    &                            * ( e3t_n(ji,jj,jk) / h_rnf(ji,jj) ) 
-                     ENDIF
-                  ELSE
-                     IF( jk == mikt(ji,jj) ) THEN           ! first level 
-                        ze3t_f = ze3t_f - zfact2 * ( - (rnf_b(ji,jj)    - rnf(ji,jj)   ) ) 
-                     ENDIF
-                  ENDIF
-
                   !
                   ! solar penetration (temperature only)
