Index: branches/DEV_r1837_MLF/NEMO/OPA_SRC/DYN/dynnxt.F90
===================================================================
--- branches/DEV_r1837_MLF/NEMO/OPA_SRC/DYN/dynnxt.F90	(revision 2005)
+++ branches/DEV_r1837_MLF/NEMO/OPA_SRC/DYN/dynnxt.F90	(revision 2068)
@@ -22,4 +22,6 @@
    USE oce             ! ocean dynamics and tracers
    USE dom_oce         ! ocean space and time domain
+   USE sbc_oce         ! Surface boundary condition: ocean fields
+   USE phycst          ! physical constants
    USE dynspg_oce      ! type of surface pressure gradient
    USE dynadv          ! dynamics: vector invariant versus flux form
@@ -218,5 +220,7 @@
          END DO
       ELSE                                             !* Leap-Frog : Asselin filter and swap
-         IF( ln_dynadv_vec .OR. .NOT. lk_vvl ) THEN          ! applied on velocity
+         !                                ! =============!
+         IF( .NOT. lk_vvl ) THEN          ! Fixed volume !
+            !                             ! =============!
             DO jk = 1, jpkm1                              
                DO jj = 1, jpj
@@ -232,62 +236,108 @@
                END DO
             END DO
-         ELSE                                                ! applied on thickness weighted velocity
-            ! Before scale factors at (t/u/v)-points (actually "now filtered" and futur "before")
-            ! ======================================
-            ! Scale factor at t-points
-            ! ------------------------
-            fse3t_b(:,:,:) = fse3t_n(:,:,:) + atfp * fse3t_m(:,:,:)
+            !                             ! ================!
+         ELSE                             ! Variable volume !
+            !                             ! ================!
+            ! Before scale factor at t-points
+            ! -------------------------------
+            DO jk = 1, jpkm1
+               fse3t_b(:,:,jk) = fse3t_n(:,:,jk) + atfp * fse3t_d(:,:,jk)
+            ENDDO
             ! Add volume filter correction only at the first level of t-point scale factors
             zec = atfp * rdt / rau0
             fse3t_b(:,:,1) = fse3t_b(:,:,1) - zec * ( emp_b(:,:) - emp(:,:) ) * tmask(:,:,1)
-            ! Scale factor at (u/v)-points
-            ! ------------------------
             ! surface at t-points and inverse surface at (u/v)-points used in surface averaging computations
             zs_t  (:,:) =       e1t(:,:) * e2t(:,:)
             zs_u_1(:,:) = 0.5 / e1u(:,:) * e2u(:,:)
             zs_v_1(:,:) = 0.5 / e1v(:,:) * e2v(:,:)
-            ! Scale factor anomaly at (u/v)-points: surface averaging of scale factor at t-points
-            DO jk = 1, jpkm1
-               DO jj = 1, jpjm1
-                  DO ji = 1, jpim1
-                     zv_t_ij          = zs_t(ji  ,jj  ) * fse3t_b(ji  ,jj  ,jk)
-                     zv_t_ip1j        = zs_t(ji+1,jj  ) * fse3t_b(ji+1,jj  ,jk)
-                     zv_t_ijp1        = zs_t(ji  ,jj+1) * fse3t_b(ji  ,jj+1,jk)
-                     ze3u_f(ji,jj,jk) = umask(ji,jj,jk) * ( zs_u_1(ji,jj) * ( zv_t_ij + zv_t_ip1j ) - fse3u_0(ji,jj,jk) )
-                     ze3v_f(ji,jj,jk) = vmask(ji,jj,jk) * ( zs_v_1(ji,jj) * ( zv_t_ij + zv_t_ijp1 ) - fse3v_0(ji,jj,jk) )
-                  END DO
-               END DO
-            END DO
-            CALL lbc_lnk( ze3u_f, 'U', 1. )               ! lateral boundary conditions
-            CALL lbc_lnk( ze3v_f, 'U', 1. )
-            ! Add initial scale factor to scale factor anomaly
-            ze3u_f(:,:,:) = ze3u_f(:,:,:) + fse3u_0(:,:,:)
-            ze3v_f(:,:,:) = ze3v_f(:,:,:) + fse3v_0(:,:,:)
-            
-            DO jk = 1, jpkm1
-               DO jj = 1, jpj
-                  DO ji = 1, jpim
-                     zue3a = ua(ji,jj,jk) * fse3u_a(ji,jj,jk)
-                     zve3a = va(ji,jj,jk) * fse3v_a(ji,jj,jk)
-                     zue3n = un(ji,jj,jk) * fse3u_n(ji,jj,jk)
-                     zve3n = vn(ji,jj,jk) * fse3v_n(ji,jj,jk)
-                     zue3b = ub(ji,jj,jk) * fse3u_b(ji,jj,jk)
-                     zve3b = vb(ji,jj,jk) * fse3v_b(ji,jj,jk)
-                     !
-                     zuf  = ( zue3n + atfp * ( zue3b  - 2.e0 * zue3n  + zue3a  ) ) / ze3u_f(ji,jj,jk)
-                     zvf  = ( zve3n + atfp * ( zve3b  - 2.e0 * zve3n  + zve3a  ) ) / ze3v_f(ji,jj,jk)
-                     !
-                     ub(ji,jj,jk) = zuf                      ! ub <-- filtered velocity
-                     vb(ji,jj,jk) = zvf
-                     fse3u_b(ji,jj,jk) = ze3u_f(ji,jj,jk)    ! e3u_b <-- filtered scale factor
-                     fse3v_b(ji,jj,jk) = ze3v_f(ji,jj,jk)
-                     un(ji,jj,jk) = ua(ji,jj,jk)             ! un <-- ua
-                     vn(ji,jj,jk) = va(ji,jj,jk)
-                  END DO
-               END DO
-            END DO
-            CALL lbc_lnk( ub, 'U', -1. )         ! local domain boundaries
-            CALL lbc_lnk( vb, 'V', -1. ) 
+            !
+            IF( ln_dynadv_vec ) THEN
+               ! Before scale factor at (u/v)-points
+               ! -----------------------------------
+               ! Scale factor anomaly at (u/v)-points: surface averaging of scale factor at t-points
+               DO jk = 1, jpkm1
+                  DO jj = 1, jpjm1
+                     DO ji = 1, jpim1
+                        zv_t_ij           = zs_t(ji  ,jj  ) * fse3t_b(ji  ,jj  ,jk)
+                        zv_t_ip1j         = zs_t(ji+1,jj  ) * fse3t_b(ji+1,jj  ,jk)
+                        zv_t_ijp1         = zs_t(ji  ,jj+1) * fse3t_b(ji  ,jj+1,jk)
+                        fse3u_b(ji,jj,jk) = umask(ji,jj,jk) * ( zs_u_1(ji,jj) * ( zv_t_ij + zv_t_ip1j ) - fse3u_0(ji,jj,jk) )
+                        fse3v_b(ji,jj,jk) = vmask(ji,jj,jk) * ( zs_v_1(ji,jj) * ( zv_t_ij + zv_t_ijp1 ) - fse3v_0(ji,jj,jk) )
+                     END DO
+                  END DO
+               END DO
+               ! lateral boundary conditions
+               CALL lbc_lnk( fse3u_b(:,:,:), 'U', 1. )
+               CALL lbc_lnk( fse3v_b(:,:,:), 'V', 1. )
+               ! Add initial scale factor to scale factor anomaly
+               fse3u_b(:,:,:) = fse3u_b(:,:,:) + fse3u_0(:,:,:)
+               fse3v_b(:,:,:) = fse3v_b(:,:,:) + fse3v_0(:,:,:)
+               ! Leap-Frog - Asselin filter and swap: applied on velocity
+               ! -----------------------------------
+               DO jk = 1, jpkm1
+                  DO jj = 1, jpj
+                     DO ji = 1, jpi
+                        zuf = un(ji,jj,jk) + atfp * ( ub(ji,jj,jk) - 2.e0 * un(ji,jj,jk) + ua(ji,jj,jk) )
+                        zvf = vn(ji,jj,jk) + atfp * ( vb(ji,jj,jk) - 2.e0 * vn(ji,jj,jk) + va(ji,jj,jk) )
+                        !
+                        ub(ji,jj,jk) = zuf                      ! ub <-- filtered velocity
+                        vb(ji,jj,jk) = zvf
+                        un(ji,jj,jk) = ua(ji,jj,jk)             ! un <-- ua
+                        vn(ji,jj,jk) = va(ji,jj,jk)
+                     END DO
+                  END DO
+               END DO
+               !
+            ELSE
+               ! Temporary filered scale factor at (u/v)-points (will become before scale factor)
+               !-----------------------------------------------
+               ! Scale factor anomaly at (u/v)-points: surface averaging of scale factor at t-points
+               DO jk = 1, jpkm1
+                  DO jj = 1, jpjm1
+                     DO ji = 1, jpim1
+                        zv_t_ij          = zs_t(ji  ,jj  ) * fse3t_b(ji  ,jj  ,jk)
+                        zv_t_ip1j        = zs_t(ji+1,jj  ) * fse3t_b(ji+1,jj  ,jk)
+                        zv_t_ijp1        = zs_t(ji  ,jj+1) * fse3t_b(ji  ,jj+1,jk)
+                        ze3u_f(ji,jj,jk) = umask(ji,jj,jk) * ( zs_u_1(ji,jj) * ( zv_t_ij + zv_t_ip1j ) - fse3u_0(ji,jj,jk) )
+                        ze3v_f(ji,jj,jk) = vmask(ji,jj,jk) * ( zs_v_1(ji,jj) * ( zv_t_ij + zv_t_ijp1 ) - fse3v_0(ji,jj,jk) )
+                     END DO
+                  END DO
+               END DO
+               ! lateral boundary conditions
+               CALL lbc_lnk( ze3u_f, 'U', 1. )
+               CALL lbc_lnk( ze3v_f, 'V', 1. )
+               ! Add initial scale factor to scale factor anomaly
+               ze3u_f(:,:,:) = ze3u_f(:,:,:) + fse3u_0(:,:,:)
+               ze3v_f(:,:,:) = ze3v_f(:,:,:) + fse3v_0(:,:,:)
+               ! Leap-Frog - Asselin filter and swap: applied on thickness weighted velocity
+               ! -----------------------------------             ===========================
+               DO jk = 1, jpkm1
+                  DO jj = 1, jpj
+                     DO ji = 1, jpim1
+                        zue3a = ua(ji,jj,jk) * fse3u_a(ji,jj,jk)
+                        zve3a = va(ji,jj,jk) * fse3v_a(ji,jj,jk)
+                        zue3n = un(ji,jj,jk) * fse3u_n(ji,jj,jk)
+                        zve3n = vn(ji,jj,jk) * fse3v_n(ji,jj,jk)
+                        zue3b = ub(ji,jj,jk) * fse3u_b(ji,jj,jk)
+                        zve3b = vb(ji,jj,jk) * fse3v_b(ji,jj,jk)
+                        !
+                        zuf  = ( zue3n + atfp * ( zue3b - 2.e0 * zue3n  + zue3a ) ) / ze3u_f(ji,jj,jk)
+                        zvf  = ( zve3n + atfp * ( zve3b - 2.e0 * zve3n  + zve3a ) ) / ze3v_f(ji,jj,jk)
+                        !
+                        ub(ji,jj,jk) = zuf                      ! ub <-- filtered velocity
+                        vb(ji,jj,jk) = zvf
+                        un(ji,jj,jk) = ua(ji,jj,jk)             ! un <-- ua
+                        vn(ji,jj,jk) = va(ji,jj,jk)
+                     END DO
+                  END DO
+               END DO
+               fse3u_b(:,:,:) = ze3u_f(:,:,:)                   ! e3u_b <-- filtered scale factor
+               fse3v_b(:,:,:) = ze3v_f(:,:,:)
+               CALL lbc_lnk( ub, 'U', -1. )                     ! lateral boundary conditions
+               CALL lbc_lnk( vb, 'V', -1. )
+            ENDIF
+            !
          ENDIF
+         !
       ENDIF
 
