<p><b>ringler@lanl.gov</b> 2012-03-02 20:51:23 -0700 (Fri, 02 Mar 2012)</p><p><br>
first cut at the Leith turbulence closure.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/leith/src/core_ocean/Makefile
===================================================================
--- branches/ocean_projects/leith/src/core_ocean/Makefile        2012-03-03 03:08:30 UTC (rev 1584)
+++ branches/ocean_projects/leith/src/core_ocean/Makefile        2012-03-03 03:51:23 UTC (rev 1585)
@@ -1,8 +1,8 @@
.SUFFIXES: .F .o
-OBJS = mpas_ocn_mpas_core.o \
- mpas_ocn_test_cases.o \
- mpas_ocn_advection.o \
+OBJS = mpas_ocn_mpas_core.o \
+ mpas_ocn_test_cases.o \
+ mpas_ocn_advection.o \
         mpas_ocn_thick_hadv.o \
         mpas_ocn_thick_vadv.o \
         mpas_ocn_vel_coriolis.o \
@@ -10,6 +10,7 @@
         mpas_ocn_vel_hmix.o \
         mpas_ocn_vel_hmix_del2.o \
         mpas_ocn_vel_hmix_del4.o \
+ mpas_ocn_vel_hmix_leith.o \
         mpas_ocn_vel_forcing.o \
         mpas_ocn_vel_forcing_windstress.o \
         mpas_ocn_vel_forcing_bottomdrag.o \
@@ -36,13 +37,13 @@
         mpas_ocn_vmix_coefs_tanh.o \
         mpas_ocn_restoring.o \
         mpas_ocn_tendency.o \
- mpas_ocn_time_integration.o \
- mpas_ocn_time_integration_rk4.o \
- mpas_ocn_time_integration_split.o \
+ mpas_ocn_time_integration.o \
+ mpas_ocn_time_integration_rk4.o \
+ mpas_ocn_time_integration_split.o \
         mpas_ocn_equation_of_state.o \
         mpas_ocn_equation_of_state_jm.o \
         mpas_ocn_equation_of_state_linear.o \
- mpas_ocn_global_diagnostics.o \
+ mpas_ocn_global_diagnostics.o \
         mpas_ocn_time_average.o
all: core_hyd
@@ -74,12 +75,14 @@
mpas_ocn_vel_vadv.o:
-mpas_ocn_vel_hmix.o: mpas_ocn_vel_hmix_del2.o mpas_ocn_vel_hmix_del4.o
+mpas_ocn_vel_hmix.o: mpas_ocn_vel_hmix_del2.o mpas_ocn_vel_hmix_del4.o mpas_ocn_vel_hmix_leith.o
mpas_ocn_vel_hmix_del2.o:
mpas_ocn_vel_hmix_del4.o:
+mpas_ocn_vel_hmix_leith.o:
+
mpas_ocn_vel_forcing.o: mpas_ocn_vel_forcing_windstress.o mpas_ocn_vel_forcing_bottomdrag.o mpas_ocn_vel_forcing_rayleigh.o
mpas_ocn_vel_forcing_windstress.o:
@@ -146,6 +149,7 @@
                                         mpas_ocn_vel_hmix.o \
                                         mpas_ocn_vel_hmix_del2.o \
                                         mpas_ocn_vel_hmix_del4.o \
+                                         mpas_ocn_vel_hmix_leith.o \
                                         mpas_ocn_vel_forcing.o \
                                         mpas_ocn_vel_forcing_windstress.o \
                                         mpas_ocn_vel_forcing_bottomdrag.o \
Modified: branches/ocean_projects/leith/src/core_ocean/Registry
===================================================================
--- branches/ocean_projects/leith/src/core_ocean/Registry        2012-03-03 03:08:30 UTC (rev 1584)
+++ branches/ocean_projects/leith/src/core_ocean/Registry        2012-03-03 03:51:23 UTC (rev 1585)
@@ -47,6 +47,8 @@
namelist logical hmix config_rayleigh_friction false
namelist real hmix config_rayleigh_damping_coeff 0.0
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 character vmix config_vert_visc_type const
namelist character vmix config_vert_diff_type const
namelist logical vmix config_implicit_vertical_mix .true.
@@ -122,6 +124,7 @@
var persistent real meshDensity ( nCells ) 0 iro meshDensity mesh - -
var persistent real meshScalingDel2 ( nEdges ) 0 ro meshScalingDel2 mesh - -
var persistent real meshScalingDel4 ( nEdges ) 0 ro meshScalingDel4 mesh - -
+var persistent real meshScalingLeith ( nEdges ) 0 ro meshScalingLeith mesh - -
var persistent integer cellsOnEdge ( TWO nEdges ) 0 iro cellsOnEdge mesh - -
var persistent integer nEdgesOnCell ( nCells ) 0 iro nEdgesOnCell mesh - -
Modified: branches/ocean_projects/leith/src/core_ocean/mpas_ocn_mpas_core.F
===================================================================
--- branches/ocean_projects/leith/src/core_ocean/mpas_ocn_mpas_core.F        2012-03-03 03:08:30 UTC (rev 1584)
+++ branches/ocean_projects/leith/src/core_ocean/mpas_ocn_mpas_core.F        2012-03-03 03:51:23 UTC (rev 1585)
@@ -781,14 +781,15 @@
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, meshScalingLeith
meshDensity => mesh % meshDensity % array
meshScalingDel2 => mesh % meshScalingDel2 % array
meshScalingDel4 => mesh % meshScalingDel4 % array
+ meshScalingLeith => mesh % meshScalingLeith % array
!
- ! Compute the scaling factors to be used in the del2 and del4 dissipation
+ ! Compute the scaling factors to be used in the del2 and del4 dissipation (and Leith)
!
meshScalingDel2(:) = 1.0
meshScalingDel4(:) = 1.0
@@ -798,6 +799,7 @@
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)
+ meshScalingLeith(iEdge) =1.0 / ( (meshDensity(cell1) + meshDensity(cell2) )/2.0)**(1.0/4.0)
end do
end if
Modified: branches/ocean_projects/leith/src/core_ocean/mpas_ocn_vel_hmix.F
===================================================================
--- branches/ocean_projects/leith/src/core_ocean/mpas_ocn_vel_hmix.F        2012-03-03 03:08:30 UTC (rev 1584)
+++ branches/ocean_projects/leith/src/core_ocean/mpas_ocn_vel_hmix.F        2012-03-03 03:51:23 UTC (rev 1585)
@@ -21,6 +21,7 @@
use mpas_timer
use ocn_vel_hmix_del2
use ocn_vel_hmix_del4
+ use ocn_vel_hmix_leith
implicit none
private
@@ -47,7 +48,7 @@
!
!--------------------------------------------------------------------
- type (timer_node), pointer :: del2Timer, del4Timer
+ type (timer_node), pointer :: del2Timer, del4Timer, leithTimer
!***********************************************************************
@@ -112,7 +113,7 @@
!
!-----------------------------------------------------------------
- integer :: err1, err2
+ integer :: err1, err2, err3
!-----------------------------------------------------------------
!
@@ -128,6 +129,9 @@
call mpas_timer_start("del4", .false., del4Timer)
call ocn_vel_hmix_del4_tend(grid, divergence, vorticity, tend, err2)
call mpas_timer_stop("del4", del4Timer)
+ call mpas_timer_start("leith", .false., leithTimer)
+ call ocn_vel_hmix_leith_tend(grid, vorticity, tend, err3)
+ call mpas_timer_stop("leith", leithTimer)
err = ior(err1, err2)
Added: branches/ocean_projects/leith/src/core_ocean/mpas_ocn_vel_hmix_leith.F
===================================================================
--- branches/ocean_projects/leith/src/core_ocean/mpas_ocn_vel_hmix_leith.F         (rev 0)
+++ branches/ocean_projects/leith/src/core_ocean/mpas_ocn_vel_hmix_leith.F        2012-03-03 03:51:23 UTC (rev 1585)
@@ -0,0 +1,202 @@
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+!
+! ocn_vel_hmix_leith
+!
+!> \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_leith
+
+ use mpas_grid_types
+ use mpas_configure
+
+ implicit none
+ private
+ save
+
+ !--------------------------------------------------------------------
+ !
+ ! Public parameters
+ !
+ !--------------------------------------------------------------------
+
+ !--------------------------------------------------------------------
+ !
+ ! Public member functions
+ !
+ !--------------------------------------------------------------------
+
+ public :: ocn_vel_hmix_leith_tend, &
+ ocn_vel_hmix_leith_init
+
+ !-------------------------------------------------------------------
+ !
+ ! Private module variables
+ !
+ !--------------------------------------------------------------------
+
+ logical :: hmixLeithOn !< integer flag to determine whether Leith chosen
+
+ real (kind=RKIND) :: &
+ leith_parameter, &!< nondimensional Leith parameter
+ leith_dx !< length scale of finest mesh resolution
+
+!***********************************************************************
+
+contains
+
+!***********************************************************************
+!
+! routine ocn_vel_hmix_leith_tend
+!
+!> \brief Computes velocity tendency term based on Leith turblence closure
+!> \author Todd Ringler
+!> \date 2 March 2012
+!> \version SVN:$Id$
+!> \details
+!> This routine computes a velocity tendency consistent with the Leith turbulence
+!> closure for an enstrophy cascade.
+!
+!-----------------------------------------------------------------------
+
+ subroutine ocn_vel_hmix_leith_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 :: iEdge, nEdgesSolve, vertex1, vertex2, cell1, cell2
+ integer :: k
+ integer, dimension(:), pointer :: maxLevelEdgeTop
+ integer, dimension(:,:), pointer :: cellsOnEdge, verticesOnEdge, edgeMask
+
+ real (kind=RKIND) :: u_diffusion, invLength1, invLength2
+ real (kind=RKIND), dimension(:), pointer :: meshScalingLeith, &
+ dcEdge, dvEdge
+
+ !-----------------------------------------------------------------
+ !
+ ! exit if this mixing is not selected
+ !
+ !-----------------------------------------------------------------
+
+ err = 0
+
+ if(.not.hmixLeithOn) return
+
+ nEdgesSolve = grid % nEdgesSolve
+ maxLevelEdgeTop => grid % maxLevelEdgeTop % array
+ cellsOnEdge => grid % cellsOnEdge % array
+ verticesOnEdge => grid % verticesOnEdge % array
+ meshScalingLeith => grid % meshScalingLeith % array
+ edgeMask => grid % edgeMask % array
+ dcEdge => grid % dcEdge % array
+ dvEdge => grid % dvEdge % array
+
+ do iEdge=1,nEdgesSolve
+ cell1 = cellsOnEdge(1,iEdge)
+ cell2 = cellsOnEdge(2,iEdge)
+ vertex1 = verticesOnEdge(1,iEdge)
+ vertex2 = verticesOnEdge(2,iEdge)
+
+ invLength1 = 1.0 / dcEdge(iEdge)
+ invLength2 = 1.0 / dvEdge(iEdge)
+
+ do k=1,maxLevelEdgeTop(iEdge)
+
+ u_diffusion = -leith_parameter**3 * leith_dx * meshScalingLeith(iEdge) * &
+ abs( vorticity(k,vertex2) - vorticity(k,vertex1) ) * &
+ ( vorticity(k,vertex2) - vorticity(k,vertex1) )
+
+ tend(k,iEdge) = tend(k,iEdge) + edgeMask(k, iEdge) * u_diffusion
+
+ end do
+ end do
+
+ !--------------------------------------------------------------------
+
+ end subroutine ocn_vel_hmix_leith_tend!}}}
+
+!***********************************************************************
+!
+! routine ocn_vel_hmix_leith_init
+!
+!> \brief Initializes parameters related to the Leith turblence closure
+!> \author Todd Ringler
+!> \date 2 March 2012
+!> \version SVN:$Id$
+!> \details
+!> This routine initializes parameters related to the Leith turblence closure.
+!-----------------------------------------------------------------------
+
+ subroutine ocn_vel_hmix_leith_init(err)!{{{
+
+
+ integer, intent(out) :: err !< Output: error flag
+
+ !--------------------------------------------------------------------
+ !
+ ! set some local module variables based on input config choices
+ !
+ !--------------------------------------------------------------------
+
+ err = 0
+
+ hmixLeithOn = .false.
+
+ if ( config_leith_parameter > 0.0 ) then
+ hmixLeithOn = .true.
+ leith_parameter = config_leith_parameter
+ leith_dx = config_leith_dx
+ endif
+
+
+ !--------------------------------------------------------------------
+
+ end subroutine ocn_vel_hmix_leith_init!}}}
+
+!***********************************************************************
+
+end module ocn_vel_hmix_leith
+
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+! vim: foldmethod=marker
</font>
</pre>