<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 => mesh % meshDensity % array
+ meshScaling => mesh % meshScaling % array
meshScalingDel2 => mesh % meshScalingDel2 % array
meshScalingDel4 => 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 :: &
h_s, fVertex, dvEdge, dcEdge, areaCell, areaTriangle, &
- referenceBottomDepth, ssh
+ referenceBottomDepth, ssh, meshScaling
real (kind=RKIND), dimension(:,:), pointer :: &
weightsOnEdge, kiteAreasOnVertex, h_edge, h, u, v, pressure,&
circulation, vorticity, ke, ke_edge, MontPot, wTop, zMid, &
@@ -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 => s % h % array
@@ -445,6 +448,7 @@
ssh => s % ssh % array
tracers => s % tracers % array
+ meshScaling => grid % meshScaling % array
weightsOnEdge => grid % weightsOnEdge % array
kiteAreasOnVertex => grid % kiteAreasOnVertex % array
cellsOnEdge => 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) &
- - config_apvm_scale_factor * dt* ( u(k,iEdge) * gradVor_n(k,iEdge) &
- + 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
-!
-!> \brief Ocean horizontal mixing - Laplacian parameterization
-!> \author Phil Jones, Doug Jacobsen
-!> \date 15 September 2011
-!> \version SVN:$Id:$
-!> \details
-!> This module contains routines for computing horizontal mixing
-!> 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, &
- ocn_vel_hmix_saAPVM_init
-
- !-------------------------------------------------------------------
- !
- ! Private module variables
- !
- !--------------------------------------------------------------------
-
- logical :: hmixsaAPVMOn !< integer flag to determine whether scale-aware APVM is chosen
-
- real (kind=RKIND) :: &
- saAPVM_parameter, &!< nondimensional APVM parameter
- saAPVM_dx !< length scale of finest mesh resolution
-
-!***********************************************************************
-
-contains
-
-!***********************************************************************
-!
-! routine ocn_vel_hmix_saAPVM_tend
-!
-!> \brief Computes velocity tendency term based on scale-aware APVM enstrophy closure
-!> \author Todd Ringler
-!> \date 2 March 2012
-!> \version SVN:$Id$
-!> \details
-!> This routine computes a velocity tendency consistent with the scale-aware APVM enstrophy
-!> closure for an enstrophy cascade.
-!
-!-----------------------------------------------------------------------
-
- subroutine ocn_vel_hmix_saAPVM_tend(grid, vorticity, tend, err)!{{{
-
- !-----------------------------------------------------------------
- !
- ! input variables
- !
- !-----------------------------------------------------------------
-
- real (kind=RKIND), dimension(:,:), intent(in) :: &
- vorticity !< Input: vorticity
-
- type (mesh_type), intent(in) :: &
- grid !< Input: grid information
-
- !-----------------------------------------------------------------
- !
- ! input/output variables
- !
- !-----------------------------------------------------------------
-
- real (kind=RKIND), dimension(:,:), intent(inout) :: &
- tend !< Input/Output: velocity tendency
-
-
- !-----------------------------------------------------------------
- !
- ! output variables
- !
- !-----------------------------------------------------------------
-
- integer, intent(out) :: err !< 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 => grid % maxLevelEdgeTop % array
- verticesOnEdge => grid % verticesOnEdge % array
- meshScaling => grid % meshScaling % array
- edgeMask => grid % edgeMask % array
- dvEdge => 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 &
- * 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
-!
-!> \brief Initializes parameters related to the scale-aware APVM turblence closure
-!> \author Todd Ringler
-!> \date 2 March 2012
-!> \version SVN:$Id$
-!> \details
-!> This routine initializes parameters related to the scale-aware APVM turblence closure.
-!-----------------------------------------------------------------------
-
- subroutine ocn_vel_hmix_saAPVM_init(err)!{{{
-
-
- integer, intent(out) :: err !< Output: error flag
-
- !--------------------------------------------------------------------
- !
- ! set some local module variables based on input config choices
- !
- !--------------------------------------------------------------------
-
- err = 0
-
- hmixsaAPVMOn = .false.
-
- if ( config_saAPVM_parameter > 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>