Index: /NEMO/branches/UKMO/dev_r10037_dynvor_EEUV/cfgs/SHARED/namelist_ref
===================================================================
--- /NEMO/branches/UKMO/dev_r10037_dynvor_EEUV/cfgs/SHARED/namelist_ref	(revision 10370)
+++ /NEMO/branches/UKMO/dev_r10037_dynvor_EEUV/cfgs/SHARED/namelist_ref	(revision 10371)
@@ -874,4 +874,5 @@
    ln_dynvor_msk = .false. !  vorticity multiplied by fmask (=T)        ==>>> PLEASE DO NOT ACTIVATE
       !                    !  (f-point vorticity schemes only)
+   ln_dynvor_ocnavg = .false. ! T => only average ocean points for V->U point or U->V point conversion 
 /
 !-----------------------------------------------------------------------
Index: /NEMO/branches/UKMO/dev_r10037_dynvor_EEUV/src/OCE/DYN/dynvor.F90
===================================================================
--- /NEMO/branches/UKMO/dev_r10037_dynvor_EEUV/src/OCE/DYN/dynvor.F90	(revision 10370)
+++ /NEMO/branches/UKMO/dev_r10037_dynvor_EEUV/src/OCE/DYN/dynvor.F90	(revision 10371)
@@ -44,4 +44,5 @@
    USE lib_mpp        ! MPP library
    USE timing         ! Timing
+   USE phycst         ! for rsmall
 
    IMPLICIT NONE
@@ -61,4 +62,5 @@
    LOGICAL, PUBLIC ::   ln_dynvor_mix   !: mixed scheme                         (MIX)
    LOGICAL, PUBLIC ::   ln_dynvor_msk   !: vorticity multiplied by fmask (=T) or not (=F) (all vorticity schemes)
+   LOGICAL, PUBLIC ::   ln_dynvor_ocnavg   !: T => only average ocean points when transforming V->U or U->V.
 
    INTEGER, PUBLIC ::   nvor_scheme     !: choice of the type of advection scheme
@@ -84,5 +86,11 @@
    REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   di_e2v_2e1e2f   ! = di(e2u)/(2*e1e2f)  used in F-point metric term calculation
    REAL(wp), ALLOCATABLE, DIMENSION(:,:) ::   dj_e1u_2e1e2f   ! = dj(e1v)/(2*e1e2f)   -        -      -       - 
+
+   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   v2upt_avg_denom   !  if ln_dynvor_ocnavg = T then use these denominators
+   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   u2vpt_avg_denom   !  in calculation of averages V->U points and U->V points.
    
+   REAL(wp) ::   r2_3  = 2._wp / 3._wp    ! =2/3
+   REAL(wp) ::   r1_2  = 0.5_wp           ! =1/2
+   REAL(wp) ::   r1_3  = 1._wp / 3._wp    ! =1/3
    REAL(wp) ::   r1_4  = 0.250_wp         ! =1/4
    REAL(wp) ::   r1_6  = 1._wp / 6._wp    ! =1/6
@@ -301,11 +309,11 @@
          DO jj = 2, jpjm1
             DO ji = 2, jpim1   ! vector opt.
-               pu_rhs(ji,jj,jk) = pu_rhs(ji,jj,jk) + r1_4 * r1_e1e2u(ji,jj) / e3u_n(ji,jj,jk)                    &
+               pu_rhs(ji,jj,jk) = pu_rhs(ji,jj,jk) + r1_e1e2u(ji,jj) / e3u_n(ji,jj,jk)                    &
                   &                                * (  zwt(ji+1,jj) * ( pv(ji+1,jj,jk) + pv(ji+1,jj-1,jk) )   &
-                  &                                   + zwt(ji  ,jj) * ( pv(ji  ,jj,jk) + pv(ji  ,jj-1,jk) )   )
+                  &                                   + zwt(ji  ,jj) * ( pv(ji  ,jj,jk) + pv(ji  ,jj-1,jk) )   ) / v2upt_avg_denom(ji,jj,jk)
                   !
-               pv_rhs(ji,jj,jk) = pv_rhs(ji,jj,jk) - r1_4 * r1_e1e2v(ji,jj) / e3v_n(ji,jj,jk)                    &
+               pv_rhs(ji,jj,jk) = pv_rhs(ji,jj,jk) - r1_e1e2v(ji,jj) / e3v_n(ji,jj,jk)                    &
                   &                                * (  zwt(ji,jj+1) * ( pu(ji,jj+1,jk) + pu(ji-1,jj+1,jk) )   & 
-                  &                                   + zwt(ji,jj  ) * ( pu(ji,jj  ,jk) + pu(ji-1,jj  ,jk) )   ) 
+                  &                                   + zwt(ji,jj  ) * ( pu(ji,jj  ,jk) + pu(ji-1,jj  ,jk) )   ) / u2vpt_avg_denom(ji,jj,jk)
             END DO  
          END DO  
@@ -414,6 +422,6 @@
                zx1 = zwx(ji-1,jj) + zwx(ji-1,jj+1)
                zx2 = zwx(ji  ,jj) + zwx(ji  ,jj+1)
-               pua(ji,jj,jk) = pua(ji,jj,jk) + r1_4 * r1_e1u(ji,jj) * ( zwz(ji  ,jj-1) * zy1 + zwz(ji,jj) * zy2 )
-               pva(ji,jj,jk) = pva(ji,jj,jk) - r1_4 * r1_e2v(ji,jj) * ( zwz(ji-1,jj  ) * zx1 + zwz(ji,jj) * zx2 ) 
+               pua(ji,jj,jk) = pua(ji,jj,jk) + r1_e1u(ji,jj) * ( zwz(ji  ,jj-1) * zy1 + zwz(ji,jj) * zy2 ) / v2upt_avg_denom(ji,jj,jk)
+               pva(ji,jj,jk) = pva(ji,jj,jk) - r1_e2v(ji,jj) * ( zwz(ji-1,jj  ) * zx1 + zwz(ji,jj) * zx2 ) / u2vpt_avg_denom(ji,jj,jk)
             END DO  
          END DO  
@@ -517,10 +525,10 @@
          DO jj = 2, jpjm1
             DO ji = fs_2, fs_jpim1   ! vector opt.
-               zuav = r1_8 * r1_e1u(ji,jj) * (  zwy(ji  ,jj-1) + zwy(ji+1,jj-1)  &
+               zuav = r1_2 * r1_e1u(ji,jj) * (  zwy(ji  ,jj-1) + zwy(ji+1,jj-1)  &
                   &                           + zwy(ji  ,jj  ) + zwy(ji+1,jj  )  )
-               zvau =-r1_8 * r1_e2v(ji,jj) * (  zwx(ji-1,jj  ) + zwx(ji-1,jj+1)  &
+               zvau =-r1_2 * r1_e2v(ji,jj) * (  zwx(ji-1,jj  ) + zwx(ji-1,jj+1)  &
                   &                           + zwx(ji  ,jj  ) + zwx(ji  ,jj+1)  )
-               pua(ji,jj,jk) = pua(ji,jj,jk) + zuav * ( zwz(ji  ,jj-1) + zwz(ji,jj) )
-               pva(ji,jj,jk) = pva(ji,jj,jk) + zvau * ( zwz(ji-1,jj  ) + zwz(ji,jj) )
+               pua(ji,jj,jk) = pua(ji,jj,jk) + zuav * ( zwz(ji  ,jj-1) + zwz(ji,jj) ) / v2upt_avg_denom(ji,jj,jk)
+               pva(ji,jj,jk) = pva(ji,jj,jk) + zvau * ( zwz(ji-1,jj  ) + zwz(ji,jj) ) / u2vpt_avg_denom(ji,jj,jk)
             END DO  
          END DO  
@@ -669,8 +677,8 @@
          DO jj = 2, jpjm1
             DO ji = fs_2, fs_jpim1   ! vector opt.
-               zua = + r1_12 * r1_e1u(ji,jj) * (  ztne(ji,jj  ) * zwy(ji  ,jj  ) + ztnw(ji+1,jj) * zwy(ji+1,jj  )   &
-                  &                             + ztse(ji,jj  ) * zwy(ji  ,jj-1) + ztsw(ji+1,jj) * zwy(ji+1,jj-1) )
-               zva = - r1_12 * r1_e2v(ji,jj) * (  ztsw(ji,jj+1) * zwx(ji-1,jj+1) + ztse(ji,jj+1) * zwx(ji  ,jj+1)   &
-                  &                             + ztnw(ji,jj  ) * zwx(ji-1,jj  ) + ztne(ji,jj  ) * zwx(ji  ,jj  ) )
+               zua = + r1_3 * r1_e1u(ji,jj) * (  ztne(ji,jj  ) * zwy(ji  ,jj  ) + ztnw(ji+1,jj) * zwy(ji+1,jj  )   &
+                  &                             + ztse(ji,jj  ) * zwy(ji  ,jj-1) + ztsw(ji+1,jj) * zwy(ji+1,jj-1) ) / v2upt_avg_denom(ji,jj,jk)
+               zva = - r1_3 * r1_e2v(ji,jj) * (  ztsw(ji,jj+1) * zwx(ji-1,jj+1) + ztse(ji,jj+1) * zwx(ji  ,jj+1)   &
+                  &                             + ztnw(ji,jj  ) * zwx(ji-1,jj  ) + ztne(ji,jj  ) * zwx(ji  ,jj  ) ) / u2vpt_avg_denom(ji,jj,jk)
                pua(ji,jj,jk) = pua(ji,jj,jk) + zua
                pva(ji,jj,jk) = pva(ji,jj,jk) + zva
@@ -801,8 +809,8 @@
          DO jj = 2, jpjm1
             DO ji = fs_2, fs_jpim1   ! vector opt.
-               zua = + r1_12 * r1_e1u(ji,jj) * (  ztne(ji,jj  ) * zwy(ji  ,jj  ) + ztnw(ji+1,jj) * zwy(ji+1,jj  )   &
-                  &                             + ztse(ji,jj  ) * zwy(ji  ,jj-1) + ztsw(ji+1,jj) * zwy(ji+1,jj-1) )
-               zva = - r1_12 * r1_e2v(ji,jj) * (  ztsw(ji,jj+1) * zwx(ji-1,jj+1) + ztse(ji,jj+1) * zwx(ji  ,jj+1)   &
-                  &                             + ztnw(ji,jj  ) * zwx(ji-1,jj  ) + ztne(ji,jj  ) * zwx(ji  ,jj  ) )
+               zua = + r1_3 * r1_e1u(ji,jj) * (  ztne(ji,jj  ) * zwy(ji  ,jj  ) + ztnw(ji+1,jj) * zwy(ji+1,jj  )   &
+                  &                             + ztse(ji,jj  ) * zwy(ji  ,jj-1) + ztsw(ji+1,jj) * zwy(ji+1,jj-1) ) / v2upt_avg_denom(ji,jj,jk)
+               zva = - r1_3 * r1_e2v(ji,jj) * (  ztsw(ji,jj+1) * zwx(ji-1,jj+1) + ztse(ji,jj+1) * zwx(ji  ,jj+1)   &
+                  &                             + ztnw(ji,jj  ) * zwx(ji-1,jj  ) + ztne(ji,jj  ) * zwx(ji  ,jj  ) ) / u2vpt_avg_denom(ji,jj,jk)
                pua(ji,jj,jk) = pua(ji,jj,jk) + zua
                pva(ji,jj,jk) = pva(ji,jj,jk) + zva
@@ -931,8 +939,8 @@
          DO jj = 2, jpjm1
             DO ji = fs_2, fs_jpim1   ! vector opt.
-               zua = + r1_6 * r1_e1u(ji,jj) * (  ztne(ji,jj  ) * zwy(ji  ,jj  ) + ztnw(ji+1,jj) * zwy(ji+1,jj  )   &
-                  &                             + ztse(ji,jj  ) * zwy(ji  ,jj-1) + ztsw(ji+1,jj) * zwy(ji+1,jj-1) )
-               zva = - r1_6 * r1_e2v(ji,jj) * (  ztsw(ji,jj+1) * zwx(ji-1,jj+1) + ztse(ji,jj+1) * zwx(ji  ,jj+1)   &
-                  &                             + ztnw(ji,jj  ) * zwx(ji-1,jj  ) + ztne(ji,jj  ) * zwx(ji  ,jj  ) )
+               zua = + r2_3 * r1_e1u(ji,jj) * (  ztne(ji,jj  ) * zwy(ji  ,jj  ) + ztnw(ji+1,jj) * zwy(ji+1,jj  )   &
+                  &                             + ztse(ji,jj  ) * zwy(ji  ,jj-1) + ztsw(ji+1,jj) * zwy(ji+1,jj-1) ) / v2upt_avg_denom(ji,jj,jk)
+               zva = - r2_3 * r1_e2v(ji,jj) * (  ztsw(ji,jj+1) * zwx(ji-1,jj+1) + ztse(ji,jj+1) * zwx(ji  ,jj+1)   &
+                  &                             + ztnw(ji,jj  ) * zwx(ji-1,jj  ) + ztne(ji,jj  ) * zwx(ji  ,jj  ) ) / u2vpt_avg_denom(ji,jj,jk)
                pua(ji,jj,jk) = pua(ji,jj,jk) + zua
                pva(ji,jj,jk) = pva(ji,jj,jk) + zva
@@ -956,5 +964,5 @@
       !!
       NAMELIST/namdyn_vor/ ln_dynvor_ens, ln_dynvor_ene, ln_dynvor_enT, ln_dynvor_eeT,   &
-         &                 ln_dynvor_eeUV, ln_dynvor_een, nn_een_e3f   , ln_dynvor_mix, ln_dynvor_msk
+         &                 ln_dynvor_eeUV, ln_dynvor_een, nn_een_e3f   , ln_dynvor_mix, ln_dynvor_msk, ln_dynvor_ocnavg
       !!----------------------------------------------------------------------
       !
@@ -984,4 +992,5 @@
          WRITE(numout,*) '      mixed enstrophy/energy conserving scheme       ln_dynvor_mix = ', ln_dynvor_mix
          WRITE(numout,*) '      masked (=T) or unmasked(=F) vorticity          ln_dynvor_msk = ', ln_dynvor_msk
+         WRITE(numout,*) '      average only ocean points?                     ln_dynvor_ocnavg = ', ln_dynvor_ocnavg
       ENDIF
 
@@ -1007,4 +1016,22 @@
       ENDIF
 !!gm end
+
+      !! Precalculate denominators for V->Upoint or U->Vpoint conversion.
+      ALLOCATE( v2upt_avg_denom(jpi,jpj,jpk), u2vpt_avg_denom(jpi,jpj,jpk) )
+      IF( ln_dynvor_ocnavg ) THEN 
+         v2upt_avg_denom(:,:,:) = rsmall
+         u2vpt_avg_denom(:,:,:) = rsmall
+         DO jk = 1, jpk
+            DO jj = 1, jpjm1
+               DO ji = 1, jpim1
+                  v2upt_avg_denom(ji,jj,jk) = max( rsmall, vmask(ji,jj,jk) + vmask(ji+1,jj,jk) + vmask(ji,jj-1,jk) + vmask(ji+1,jj-1,jk) )
+                  u2vpt_avg_denom(ji,jj,jk) = max( rsmall, umask(ji,jj,jk) + umask(ji-1,jj,jk) + umask(ji,jj+1,jk) + umask(ji-1,jj+1,jk) )
+               ENDDO
+            ENDDO
+         ENDDO
+      ELSE
+         v2upt_avg_denom(:,:,:) = 4._wp
+         u2vpt_avg_denom(:,:,:) = 4._wp
+      ENDIF
 
       ioptio = 0                     ! type of scheme for vorticity (set nvor_scheme)
