<p><b>ringler@lanl.gov</b> 2013-02-04 14:59:39 -0700 (Mon, 04 Feb 2013)</p><p><br>
added structures to allow hooks into CVMix<br>
<br>
1) created mpas_ocn_vmix_cvmix.F: this routine will link to and call into CVMix<br>
2) mpas_ocn_vmix.F: this routine calls into init/build of mpas_ocn_vmix_cvmix.F<br>
3) Makefile: compiles mpas_ocn_vmix_cvmix.F<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/cvmix_implementation/src/core_ocean/Makefile
===================================================================
--- branches/ocean_projects/cvmix_implementation/src/core_ocean/Makefile        2013-02-04 20:36:28 UTC (rev 2424)
+++ branches/ocean_projects/cvmix_implementation/src/core_ocean/Makefile        2013-02-04 21:59:39 UTC (rev 2425)
@@ -5,7 +5,7 @@
        mpas_ocn_advection.o \
            mpas_ocn_thick_hadv.o \
            mpas_ocn_thick_vadv.o \
-       mpas_ocn_gm.o \
+           mpas_ocn_gm.o \
            mpas_ocn_vel_coriolis.o \
            mpas_ocn_vel_vadv.o \
            mpas_ocn_vel_hmix.o \
@@ -36,6 +36,7 @@
            mpas_ocn_vmix_coefs_const.o \
            mpas_ocn_vmix_coefs_rich.o \
            mpas_ocn_vmix_coefs_tanh.o \
+           mpas_ocn_vmix_cvmix.o \
            mpas_ocn_restoring.o \
            mpas_ocn_tendency.o \
            mpas_ocn_tracer_advection.o \
@@ -47,13 +48,13 @@
            mpas_ocn_tracer_advection_std_vadv4.o \
            mpas_ocn_tracer_advection_mono.o \
            mpas_ocn_tracer_advection_helpers.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 \
            mpas_ocn_monthly_forcing.o
 
@@ -159,7 +160,7 @@
 
 mpas_ocn_restoring.o:
 
-mpas_ocn_vmix.o: mpas_ocn_vmix_coefs_const.o mpas_ocn_vmix_coefs_rich.o mpas_ocn_vmix_coefs_tanh.o
+mpas_ocn_vmix.o: mpas_ocn_vmix_coefs_const.o mpas_ocn_vmix_coefs_rich.o mpas_ocn_vmix_coefs_tanh.o mpas_ocn_vmix_cvmix.o
 
 mpas_ocn_vmix_coefs_const.o:
 
@@ -167,6 +168,8 @@
 
 mpas_ocn_vmix_coefs_tanh.o:
 
+mpas_ocn_vmix_cvmix.o:
+
 mpas_ocn_equation_of_state.o: mpas_ocn_equation_of_state_jm.o mpas_ocn_equation_of_state_linear.o
 
 mpas_ocn_equation_of_state_jm.o:
@@ -178,7 +181,7 @@
 mpas_ocn_mpas_core.o: mpas_ocn_test_cases.o \
                                           mpas_ocn_advection.o \
                                           mpas_ocn_thick_hadv.o \
-                      mpas_ocn_gm.o \
+                                          mpas_ocn_gm.o \
                                           mpas_ocn_thick_vadv.o \
                                           mpas_ocn_vel_coriolis.o \
                                           mpas_ocn_vel_vadv.o \
@@ -209,6 +212,7 @@
                                           mpas_ocn_vmix_coefs_const.o \
                                           mpas_ocn_vmix_coefs_rich.o \
                                           mpas_ocn_vmix_coefs_tanh.o \
+                                          mpas_ocn_vmix_cvmix.o \
                                           mpas_ocn_restoring.o \
                                           mpas_ocn_tracer_advection.o \
                                           mpas_ocn_tracer_advection_std.o \

Modified: branches/ocean_projects/cvmix_implementation/src/core_ocean/mpas_ocn_vmix.F
===================================================================
--- branches/ocean_projects/cvmix_implementation/src/core_ocean/mpas_ocn_vmix.F        2013-02-04 20:36:28 UTC (rev 2424)
+++ branches/ocean_projects/cvmix_implementation/src/core_ocean/mpas_ocn_vmix.F        2013-02-04 21:59:39 UTC (rev 2425)
@@ -23,6 +23,7 @@
    use ocn_vmix_coefs_const
    use ocn_vmix_coefs_tanh
    use ocn_vmix_coefs_rich
+   use ocn_vmix_cvmix
 
    implicit none
    private
@@ -667,7 +668,7 @@
 
       integer, intent(out) :: err !&lt; Output: error flag
 
-      integer :: err1, err2, err3
+      integer :: err1, err2, err3, err4
 
       err = 0
 
@@ -688,8 +689,11 @@
       call ocn_vmix_coefs_const_init(err1)
       call ocn_vmix_coefs_tanh_init(err2)
       call ocn_vmix_coefs_rich_init(err3)
+      call ocn_vmix_cvmix_init(err4)
 
-      err = ior(err1, ior(err2, err3))
+      err = ior(err1, err2)
+      err = ior(err,  err3)
+      err = ior(err,  err4)
 
    !--------------------------------------------------------------------
 

Added: branches/ocean_projects/cvmix_implementation/src/core_ocean/mpas_ocn_vmix_cvmix.F
===================================================================
--- branches/ocean_projects/cvmix_implementation/src/core_ocean/mpas_ocn_vmix_cvmix.F                                (rev 0)
+++ branches/ocean_projects/cvmix_implementation/src/core_ocean/mpas_ocn_vmix_cvmix.F        2013-02-04 21:59:39 UTC (rev 2425)
@@ -0,0 +1,309 @@
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+!
+!  ocn_vmix_cvmix
+!
+!&gt; \brief MPAS ocean vertical mixing interface to CVMix
+!&gt; \author Todd Ringler
+!&gt; \date   04 February 2013
+!&gt; \version SVN:$Id:$
+!&gt; \details
+!&gt;  This module contains the routines for call CVMix
+!&gt;
+!
+!-----------------------------------------------------------------------
+
+module ocn_vmix_cvmix
+
+   use mpas_grid_types
+   use mpas_configure
+   use mpas_timer
+
+!  use cmvix
+
+   implicit none
+   private
+   save
+
+   !--------------------------------------------------------------------
+   !
+   ! Public parameters
+   !
+   !--------------------------------------------------------------------
+
+   !--------------------------------------------------------------------
+   !
+   ! Public member functions
+   !
+   !--------------------------------------------------------------------
+
+!TDR
+!  private :: ocn_vel_vmix_coefs_const, &amp;
+!             ocn_tracer_vmix_coefs_const
+
+   public :: ocn_vmix_cvmix_build, &amp;
+             ocn_vmix_cvmix_init
+
+   !--------------------------------------------------------------------
+   !
+   ! Private module variables
+   !
+   !--------------------------------------------------------------------
+
+   logical :: constViscOn, constDiffOn
+
+   real (kind=RKIND) :: constVisc, constDiff
+
+
+!***********************************************************************
+
+contains
+
+!***********************************************************************
+!
+!  routine ocn_vmix_cmvix_build
+!
+!&gt; \brief   Computes mixing coefficients using CVMix
+!&gt; \author  Todd Ringler
+!&gt; \date    04 February 2013
+!&gt; \version SVN:$Id$
+!&gt; \details 
+!&gt;  This routine computes the vertical mixing coefficients for momentum
+!&gt;  and tracers by calling CVMix routines.
+!
+!-----------------------------------------------------------------------
+
+   subroutine ocn_vmix_cvmix_build(grid, s, d, err)!{{{
+
+      !-----------------------------------------------------------------
+      !
+      ! input variables
+      !
+      !-----------------------------------------------------------------
+
+      type (mesh_type), intent(in) :: &amp;
+         grid          !&lt; Input: grid information
+
+      !-----------------------------------------------------------------
+      !
+      ! input/output variables
+      !
+      !-----------------------------------------------------------------
+
+      type (state_type), intent(inout) :: &amp;
+         s             !&lt; Input/Output: state information
+
+      type (diagnostics_type), intent(inout) :: &amp;
+         d             !&lt; Input/Output: diagnostic information
+
+      !-----------------------------------------------------------------
+      !
+      ! output variables
+      !
+      !-----------------------------------------------------------------
+
+      integer, intent(out) :: err !&lt; Output: error flag
+
+      !-----------------------------------------------------------------
+      !
+      ! local variables
+      !
+      !-----------------------------------------------------------------
+
+      integer :: err1, err2
+
+      real (kind=RKIND), dimension(:,:), pointer :: &amp;
+        vertViscTopOfEdge, vertDiffTopOfCell
+
+      !-----------------------------------------------------------------
+      !
+      ! call relevant routines for computing tendencies
+      ! note that the user can choose multiple options and the 
+      !   tendencies will be added together
+      !
+      !-----------------------------------------------------------------
+
+      err = 0
+
+      vertViscTopOfEdge =&gt; d % vertViscTopOfEdge % array
+      vertDiffTopOfCell =&gt; d % vertDiffTopOfCell % array
+
+!TDR
+!     call ocn_vel_vmix_coefs_const(grid, vertViscTopOfEdge, err1)
+!     call ocn_tracer_vmix_coefs_const(grid, vertDiffTopOfCell, err2)
+
+      err = ior(err1, err2)
+
+   !--------------------------------------------------------------------
+
+   end subroutine ocn_vmix_cvmix_build!}}}
+
+!***********************************************************************
+!
+!  routine ocn_vel_vmix_coefs_const
+!
+!&gt; \brief   Computes coefficients for vertical momentum mixing
+!&gt; \author  Doug Jacobsen
+!&gt; \date    19 September 2011
+!&gt; \version SVN:$Id$
+!&gt; \details 
+!&gt;  This routine computes the constant vertical mixing coefficients for momentum
+!
+!-----------------------------------------------------------------------
+
+!  subroutine ocn_vel_vmix_coefs_const(grid, vertViscTopOfEdge, err)!{{{
+
+      !-----------------------------------------------------------------
+      !
+      ! input variables
+      !
+      !-----------------------------------------------------------------
+
+!     type (mesh_type), intent(in) :: &amp;
+!        grid          !&lt; Input: grid information
+
+      !-----------------------------------------------------------------
+      !
+      ! input/output variables
+      !
+      !-----------------------------------------------------------------
+
+      !-----------------------------------------------------------------
+      !
+      ! output variables
+      !
+      !-----------------------------------------------------------------
+
+!     real (kind=RKIND), dimension(:,:), intent(out) :: vertViscTopOfEdge !&lt; Output: vertical viscosity
+
+!     integer, intent(out) :: err !&lt; Output: error flag
+
+      !-----------------------------------------------------------------
+      !
+      ! local variables
+      !
+      !-----------------------------------------------------------------
+
+!     err = 0
+
+!     if(.not.constViscOn) return
+
+!     vertViscTopOfEdge = vertViscTopOfEdge + constVisc
+
+   !--------------------------------------------------------------------
+
+!  end subroutine ocn_vel_vmix_coefs_const!}}}
+
+!***********************************************************************
+!
+!  routine ocn_tracer_vmix_coefs_const
+!
+!&gt; \brief   Computes coefficients for vertical tracer mixing
+!&gt; \author  Doug Jacobsen
+!&gt; \date    19 September 2011
+!&gt; \version SVN:$Id$
+!&gt; \details 
+!&gt;  This routine computes the constant vertical mixing coefficients for tracers
+!
+!-----------------------------------------------------------------------
+
+!  subroutine ocn_tracer_vmix_coefs_const(grid, vertDiffTopOfCell, err)!{{{
+
+      !-----------------------------------------------------------------
+      !
+      ! input variables
+      !
+      !-----------------------------------------------------------------
+
+!     type (mesh_type), intent(in) :: &amp;
+!        grid          !&lt; Input: grid information
+
+      !-----------------------------------------------------------------
+      !
+      ! input/output variables
+      !
+      !-----------------------------------------------------------------
+
+      !-----------------------------------------------------------------
+      !
+      ! output variables
+      !
+      !-----------------------------------------------------------------
+
+!     real (kind=RKIND), dimension(:,:), intent(out) :: vertDiffTopOfCell !&lt; Output: Vertical diffusion
+
+!     integer, intent(out) :: err !&lt; Output: error flag
+
+      !-----------------------------------------------------------------
+      !
+      ! local variables
+      !
+      !-----------------------------------------------------------------
+
+!     err = 0
+
+!     if(.not.constDiffOn) return
+
+!     vertDiffTopOfCell = vertDiffTopOfCell + constDiff
+
+   !--------------------------------------------------------------------
+
+!  end subroutine ocn_tracer_vmix_coefs_const!}}}
+
+
+!***********************************************************************
+!
+!  routine ocn_vmix_cvmix_init
+!
+!&gt; \brief   Initializes ocean vertical mixing quantities by using
+!&gt; \ get and puts into CVMix
+!&gt; \author  Todd Ringler
+!&gt; \date    04 February 2013
+!&gt; \version SVN:$Id$
+!&gt; \details 
+!&gt;  This routine initializes a variety of quantities related to 
+!&gt;  vertical mixing in the ocean. Parameters are set by calling into CVMix
+!
+!-----------------------------------------------------------------------
+
+
+   subroutine ocn_vmix_cvmix_init(err)!{{{
+
+   !--------------------------------------------------------------------
+
+      !-----------------------------------------------------------------
+      !
+      ! call individual init routines for each parameterization
+      !
+      !-----------------------------------------------------------------
+
+      integer, intent(out) :: err !&lt; Output: error flag
+
+      err = 0
+
+      constViscOn = config_use_const_visc
+      constDiffOn = config_use_const_diff
+      constVisc = config_vert_visc
+      constDiff = config_vert_diff
+
+!     if (config_vert_visc_type.eq.'const') then
+!         constViscOn = .true.
+!         constVisc = config_vert_visc
+!     endif
+
+!     if (config_vert_diff_type.eq.'const') then
+!         constDiffOn = .true.
+!         constDiff = config_vert_diff
+!     endif
+
+
+   !--------------------------------------------------------------------
+
+   end subroutine ocn_vmix_cvmix_init!}}}
+
+!***********************************************************************
+
+end module ocn_vmix_cvmix
+
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+
+! vim: foldmethod=marker

</font>
</pre>