<p><b>ringler@lanl.gov</b> 2012-04-17 14:58:17 -0600 (Tue, 17 Apr 2012)</p><p><br>
first implementation of scale-aware APVM<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/closureN/src/core_ocean/Registry
===================================================================
--- branches/ocean_projects/closureN/src/core_ocean/Registry        2012-04-17 20:15:32 UTC (rev 1790)
+++ branches/ocean_projects/closureN/src/core_ocean/Registry        2012-04-17 20:58:17 UTC (rev 1791)
@@ -59,6 +59,8 @@
 namelist real      hmix     config_apvm_scale_factor      0.0
 namelist real      hmix     config_leith_parameter        0.0
 namelist real      hmix     config_leith_dx               0.0
+namelist real      hmix     config_saAPVM_parameter       0.0
+namelist real      hmix     config_saAPVM_dx              0.0
 namelist character vmix     config_vert_visc_type       const
 namelist character vmix     config_vert_diff_type       const
 namelist logical   vmix     config_implicit_vertical_mix  .true.

Modified: branches/ocean_projects/closureN/src/core_ocean/mpas_ocn_mpas_core.F
===================================================================
--- branches/ocean_projects/closureN/src/core_ocean/mpas_ocn_mpas_core.F        2012-04-17 20:15:32 UTC (rev 1790)
+++ branches/ocean_projects/closureN/src/core_ocean/mpas_ocn_mpas_core.F        2012-04-17 20:58:17 UTC (rev 1791)
@@ -908,23 +908,26 @@
       type (mesh_type), intent(inout) :: mesh
 
       integer :: iEdge, cell1, cell2
-      real (kind=RKIND), dimension(:), pointer :: meshDensity, meshScalingDel2, meshScalingDel4
+      real (kind=RKIND), dimension(:), pointer :: meshDensity, meshScalingDel2, meshScalingDel4, meshScaling
 
       meshDensity =&gt; mesh % meshDensity % array
+      meshScaling     =&gt; mesh % meshScaling     % array
       meshScalingDel2 =&gt; mesh % meshScalingDel2 % array
       meshScalingDel4 =&gt; mesh % meshScalingDel4 % array
 
       !
       ! Compute the scaling factors to be used in the del2 and del4 dissipation
       !
+      meshScaling(:)     = 1.0
       meshScalingDel2(:) = 1.0
       meshScalingDel4(:) = 1.0
       if (config_h_ScaleWithMesh) then
          do iEdge=1,mesh%nEdges
             cell1 = mesh % cellsOnEdge % array(1,iEdge)
             cell2 = mesh % cellsOnEdge % array(2,iEdge)
-            meshScalingDel2(iEdge) = 1.0 / ( (meshDensity(cell1) + meshDensity(cell2) )/2.0)**(5.0/12.0)
-            meshScalingDel4(iEdge) = 1.0 / ( (meshDensity(cell1) + meshDensity(cell2) )/2.0)**(5.0/6.0)
+            meshScaling(iEdge)     = 1.0 / ( (meshDensity(cell1) + meshDensity(cell2) )/2.0)**(1.0/4.0)
+            meshScalingDel2(iEdge) = 1.0 / ( (meshDensity(cell1) + meshDensity(cell2) )/2.0)**(3.0/4.0)
+            meshScalingDel4(iEdge) = 1.0 / ( (meshDensity(cell1) + meshDensity(cell2) )/2.0)**(3.0/4.0)
          end do
       end if
 

Modified: branches/ocean_projects/closureN/src/core_ocean/mpas_ocn_tendency.F
===================================================================
--- branches/ocean_projects/closureN/src/core_ocean/mpas_ocn_tendency.F        2012-04-17 20:15:32 UTC (rev 1790)
+++ branches/ocean_projects/closureN/src/core_ocean/mpas_ocn_tendency.F        2012-04-17 20:58:17 UTC (rev 1791)
@@ -410,7 +410,7 @@
 
       real (kind=RKIND), dimension(:), pointer :: &amp;
         h_s, fVertex, dvEdge, dcEdge, areaCell, areaTriangle, &amp;
-        referenceBottomDepth, ssh
+        referenceBottomDepth, ssh, meshScaling
       real (kind=RKIND), dimension(:,:), pointer :: &amp;
         weightsOnEdge, kiteAreasOnVertex, h_edge, h, u, v, pressure,&amp;
         circulation, vorticity, ke, ke_edge, MontPot, wTop, zMid, &amp;
@@ -418,6 +418,9 @@
         rho, temperature, salinity, kev, kevc, uBolusGM, uTransport
       real (kind=RKIND), dimension(:,:,:), pointer :: tracers, deriv_two
       real (kind=RKIND), dimension(:,:), allocatable:: div_u
+
+      real (kind=RKIND) :: gamma, uDotGradVor, ref_KE
+
       character :: c1*6
 
       h           =&gt; s % h % array
@@ -445,6 +448,7 @@
       ssh         =&gt; s % ssh % array
       tracers     =&gt; s % tracers % array
 
+      meshScaling       =&gt; grid % meshScaling % array
       weightsOnEdge     =&gt; grid % weightsOnEdge % array
       kiteAreasOnVertex =&gt; grid % kiteAreasOnVertex % array
       cellsOnEdge       =&gt; grid % cellsOnEdge % array
@@ -727,7 +731,7 @@
             gradVor_n(k,iEdge) = (Vor_cell(k,cell2) - Vor_cell(k,cell1)) * invLength
          enddo
 
-         invLength = 1.0 / dvEdge(iEdge)
+         invLength = 1.0 / (dcEdge(iEdge) / sqrt(3.0))
          ! Compute gradient of PV in the tangent direction
          !   ( this computes gradVor_t at all edges bounding real cells and distance-1 ghost cells )
          do k = 1,maxLevelEdgeBot(iEdge)
@@ -739,11 +743,12 @@
       !
       ! Modify PV edge with upstream bias.
       !
+      ref_KE = 1.0
       do iEdge = 1,nEdges
          do k = 1,maxLevelEdgeBot(iEdge)
-           Vor_edge(k,iEdge) = Vor_edge(k,iEdge) &amp;
-             - config_apvm_scale_factor * dt* (  u(k,iEdge) * gradVor_n(k,iEdge) &amp;
-                          + v(k,iEdge) * gradVor_t(k,iEdge) )
+           uDotGradVor = u(k,iEdge) * gradVor_n(k,iEdge) + v(k,iEdge) * gradVor_t(k,iEdge)
+           gamma = config_saAPVM_parameter * abs(uDotGradVor) * h_edge(k,iEdge) * (ref_KE)**(-3/2) * (config_saAPVM_dx * meshScaling(iEdge))**3 
+           Vor_edge(k,iEdge) = Vor_edge(k,iEdge) - gamma * uDotGradVor
          enddo
       enddo
 

Deleted: branches/ocean_projects/closureN/src/core_ocean/mpas_ocn_vel_hmix_saAPVM.F
===================================================================
--- branches/ocean_projects/closureN/src/core_ocean/mpas_ocn_vel_hmix_saAPVM.F        2012-04-17 20:15:32 UTC (rev 1790)
+++ branches/ocean_projects/closureN/src/core_ocean/mpas_ocn_vel_hmix_saAPVM.F        2012-04-17 20:58:17 UTC (rev 1791)
@@ -1,206 +0,0 @@
-!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-!
-!  ocn_vel_hmix_saAPVM
-!
-!&gt; \brief Ocean horizontal mixing - Laplacian parameterization 
-!&gt; \author Phil Jones, Doug Jacobsen
-!&gt; \date   15 September 2011
-!&gt; \version SVN:$Id:$
-!&gt; \details
-!&gt;  This module contains routines for computing horizontal mixing 
-!&gt;  tendencies using a Laplacian formulation.
-!
-!-----------------------------------------------------------------------
-
-module ocn_vel_hmix_saAPVM
-
-   use mpas_grid_types
-   use mpas_configure
-
-   implicit none
-   private
-   save
-
-   !--------------------------------------------------------------------
-   !
-   ! Public parameters
-   !
-   !--------------------------------------------------------------------
-
-   !--------------------------------------------------------------------
-   !
-   ! Public member functions
-   !
-   !--------------------------------------------------------------------
-
-   public :: ocn_vel_hmix_saAPVM_tend, &amp;
-             ocn_vel_hmix_saAPVM_init
-
-   !-------------------------------------------------------------------
-   !
-   ! Private module variables
-   !
-   !--------------------------------------------------------------------
-
-   logical ::  hmixsaAPVMOn  !&lt; integer flag to determine whether scale-aware APVM is chosen
-
-   real (kind=RKIND) :: &amp;
-      saAPVM_parameter,         &amp;!&lt; nondimensional APVM parameter
-      saAPVM_dx                  !&lt; length scale of finest mesh resolution
-
-!***********************************************************************
-
-contains
-
-!***********************************************************************
-!
-!  routine ocn_vel_hmix_saAPVM_tend
-!
-!&gt; \brief   Computes velocity tendency term based on scale-aware APVM enstrophy closure
-!&gt; \author  Todd Ringler
-!&gt; \date    2 March 2012
-!&gt; \version SVN:$Id$
-!&gt; \details 
-!&gt;  This routine computes a velocity tendency consistent with the scale-aware APVM enstrophy
-!&gt;  closure for an enstrophy cascade.
-!
-!-----------------------------------------------------------------------
-
-   subroutine ocn_vel_hmix_saAPVM_tend(grid, vorticity, tend, err)!{{{
-
-      !-----------------------------------------------------------------
-      !
-      ! input variables
-      !
-      !-----------------------------------------------------------------
-
-      real (kind=RKIND), dimension(:,:), intent(in) :: &amp;
-         vorticity       !&lt; Input: vorticity
-
-      type (mesh_type), intent(in) :: &amp;
-         grid            !&lt; Input: grid information
-
-      !-----------------------------------------------------------------
-      !
-      ! input/output variables
-      !
-      !-----------------------------------------------------------------
-
-      real (kind=RKIND), dimension(:,:), intent(inout) :: &amp;
-         tend             !&lt; Input/Output: velocity tendency
-
-
-      !-----------------------------------------------------------------
-      !
-      ! output variables
-      !
-      !-----------------------------------------------------------------
-
-      integer, intent(out) :: err !&lt; Output: error flag
-
-      !-----------------------------------------------------------------
-      !
-      ! local variables
-      !
-      !-----------------------------------------------------------------
-
-      integer :: k, iEdge, nEdgesSolve, vertex1, vertex2
-      integer, dimension(:), pointer :: maxLevelEdgeTop
-      integer, dimension(:,:), pointer :: verticesOnEdge, edgeMask
-
-      real (kind=RKIND) :: u_diffusion, invLength2, pii
-      real (kind=RKIND), dimension(:), pointer :: meshScaling, dvEdge
-
-      !-----------------------------------------------------------------
-      !
-      ! exit if this mixing is not selected
-      !
-      !-----------------------------------------------------------------
-
-      err = 0
-
-      if(.not.hmixsaAPVMOn) return
-
-      nEdgesSolve = grid % nEdgesSolve
-      maxLevelEdgeTop =&gt; grid % maxLevelEdgeTop % array
-      verticesOnEdge =&gt; grid % verticesOnEdge % array
-      meshScaling =&gt; grid % meshScaling % array
-      edgeMask =&gt; grid % edgeMask % array
-      dvEdge =&gt; grid % dvEdge % array
-      pii = 2.*asin(1.0)
-
-      !write(0,*) ' min/max before saAPVM : ', minval(tend), maxval(tend)
-
-      do iEdge=1,nEdgesSolve
-         vertex1 = verticesOnEdge(1,iEdge)
-         vertex2 = verticesOnEdge(2,iEdge)
-
-         invLength2 = 1.0 / dvEdge(iEdge)
-
-         do k=1,maxLevelEdgeTop(iEdge)
-
-!here
-            leithVisc = ( leith_parameter * leith_dx * meshScaling(iEdge) / pii)**3 &amp;
-                        * abs( vorticity(k,vertex2) - vorticity(k,vertex1) ) * invLength2
-
-            u_diffusion = -leithVisc * ( vorticity(k,vertex2) - vorticity(k,vertex1) ) * invLength2
-                         
-            tend(k,iEdge) = tend(k,iEdge) + edgeMask(k, iEdge) * u_diffusion
-!here
-
-         end do
-      end do
-
-      write(0,*) ' min/max after scale-aware APVM: ', minval(tend), maxval(tend)
-      write(0,*) saAPVM_parameter, saAPVM_dx
-      write(0,*) minval(meshScaling), maxval(meshScaling)
-
-   !--------------------------------------------------------------------
-
-   end subroutine ocn_vel_hmix_saAPVM_tend!}}}
-
-!***********************************************************************
-!
-!  routine ocn_vel_hmix_saAPVM_init
-!
-!&gt; \brief   Initializes parameters related to the scale-aware APVM turblence closure 
-!&gt; \author  Todd Ringler
-!&gt; \date    2 March 2012
-!&gt; \version SVN:$Id$
-!&gt; \details
-!&gt;  This routine initializes parameters related to the scale-aware APVM turblence closure. 
-!-----------------------------------------------------------------------
-
-   subroutine ocn_vel_hmix_saAPVM_init(err)!{{{
-
-
-   integer, intent(out) :: err !&lt; Output: error flag
-
-   !--------------------------------------------------------------------
-   !
-   ! set some local module variables based on input config choices
-   !
-   !--------------------------------------------------------------------
-
-   err = 0
-
-   hmixsaAPVMOn = .false.
-
-   if ( config_saAPVM_parameter &gt; 0.0 ) then
-      hmixsaAPVMOn = .true.
-      saAPVM_parameter = config_saAPVM_parameter
-      saAPVM_dx = config_saAPVM_dx
-      write(0,*) ' Scale-Aware APVM ', hmixsaAPVMOn, saAPVM_parameter, saAPVM_dx
-   endif
-
-
-   !--------------------------------------------------------------------
-
-   end subroutine ocn_vel_hmix_saAPVM_init!}}}
-
-!***********************************************************************
-
-end module ocn_vel_hmix_saAPVM
-
-!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-! vim: foldmethod=marker

</font>
</pre>