<p><b>qchen3@fsu.edu</b> 2013-04-03 10:37:04 -0600 (Wed, 03 Apr 2013)</p><p>BRANCH COMMIT<br>
<br>
The vertical component of Redi diffusion is now added into the vmix_implicit subroutine. Code compiles, but not tested.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/gm_implement/src/core_ocean/Makefile
===================================================================
--- branches/ocean_projects/gm_implement/src/core_ocean/Makefile        2013-04-03 16:25:11 UTC (rev 2714)
+++ branches/ocean_projects/gm_implement/src/core_ocean/Makefile        2013-04-03 16:37:04 UTC (rev 2715)
@@ -34,6 +34,7 @@
        mpas_ocn_vmix_coefs_const.o \
        mpas_ocn_vmix_coefs_rich.o \
        mpas_ocn_vmix_coefs_tanh.o \
+       mpas_ocn_vmix_coefs_redi.o \
        mpas_ocn_restoring.o \
        mpas_ocn_tendency.o \
        mpas_ocn_diagnostics.o \
@@ -154,7 +155,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_coefs_redi.o
 
 mpas_ocn_vmix_coefs_const.o:
 
@@ -162,6 +163,8 @@
 
 mpas_ocn_vmix_coefs_tanh.o:
 
+mpas_ocn_vmix_coefs_redi.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:
@@ -202,6 +205,7 @@
                       mpas_ocn_vmix_coefs_const.o \
                       mpas_ocn_vmix_coefs_rich.o \
                       mpas_ocn_vmix_coefs_tanh.o \
+                      mpas_ocn_vmix_coefs_redi.o \
                       mpas_ocn_restoring.o \
                       mpas_ocn_tracer_advection.o \
                       mpas_ocn_tracer_advection_std.o \

Modified: branches/ocean_projects/gm_implement/src/core_ocean/Registry
===================================================================
--- branches/ocean_projects/gm_implement/src/core_ocean/Registry        2013-04-03 16:25:11 UTC (rev 2714)
+++ branches/ocean_projects/gm_implement/src/core_ocean/Registry        2013-04-03 16:37:04 UTC (rev 2715)
@@ -54,6 +54,8 @@
 namelist real      hmix_Leith    config_Leith_dx             15000.0
 namelist real      hmix_Leith    config_Leith_visc2_max      2.5e3
 
+namelist logical   standard_GM     config_use_GM              .false.
+namelist logical   standard_GM     config_use_Redi_diff       .false.
 namelist real      standard_GM     config_h_kappa              0.0
 namelist real      standard_GM     config_h_kappa_q            0.0
 namelist real      standard_GM     config_diapycnal_diff       0.0000001

Modified: branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_time_integration_rk4.F
===================================================================
--- branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_time_integration_rk4.F        2013-04-03 16:25:11 UTC (rev 2714)
+++ branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_time_integration_rk4.F        2013-04-03 16:37:04 UTC (rev 2715)
@@ -214,9 +214,11 @@
                   block % provis % uBolusGM % array(:,:) = 0.0
               end if
  
-              block % provis % uTransport % array(:,:) &amp;
+              if (config_use_GM) then
+                 block % provis % uTransport % array(:,:) &amp;
                     = block % provis % u          % array(:,:) &amp;
                     + block % provis % uBolusGM   % array(:,:)
+              end if
 
               block =&gt; block % next
            end do
@@ -281,6 +283,19 @@
         ! implicit vmix routine that follows. 
         call ocn_diagnostic_solve(dt, block % state % time_levs(2) % state, block % mesh)
 
+        ! Compute uBolusGM and the tracer transport velocity
+        if (config_h_kappa .GE. epsilon(0D0)) then
+            call ocn_gm_compute_uBolus(block % state % time_levs(2) % state, block % mesh, block % scratch)
+        else
+            block % state % time_levs(2) % state % uBolusGM % array(:,:) = 0.0
+        end if
+
+        if (config_use_GM) then
+           block % state % time_levs(2) % state % uTransport % array(:,:) &amp;
+                     = block % state % time_levs(2) % state % u % array(:,:) &amp;
+                     + block % state % time_levs(2) % state % uBolusGM % array(:,:)
+        end if
+
         call ocn_vmix_implicit(dt, block % mesh, block % diagnostics, block % state % time_levs(2) % state, err)
         block =&gt; block % next
       end do
@@ -315,9 +330,11 @@
              block % state % time_levs(2) % state % uBolusGM % array(:,:) = 0.0
          end if
 
+         if (config_use_GM) then
             block % state % time_levs(2) % state % uTransport % array(:,:) &amp;
-          = block % state % time_levs(2) % state % u % array(:,:) &amp;
-          + block % state % time_levs(2) % state % uBolusGM % array(:,:)
+                = block % state % time_levs(2) % state % u % array(:,:) &amp;
+                + block % state % time_levs(2) % state % uBolusGM % array(:,:)
+         end if
 
          call mpas_reconstruct(block % mesh, block % state % time_levs(2) % state % u % array,          &amp;
                           block % state % time_levs(2) % state % uReconstructX % array,            &amp;

Modified: branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_time_integration_split.F
===================================================================
--- branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_time_integration_split.F        2013-04-03 16:25:11 UTC (rev 2714)
+++ branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_time_integration_split.F        2013-04-03 16:37:04 UTC (rev 2715)
@@ -945,6 +945,20 @@
         ! implicit vmix routine that follows.
         call ocn_diagnostic_solve(dt, block % state % time_levs(2) % state, block % mesh)
 
+        ! Compute uBolusGM 
+        if (config_h_kappa .GE. epsilon(0D0)) then
+            call ocn_gm_compute_uBolus(block % state % time_levs(2) % state, block % mesh, block % scratch)
+        else
+            block % state % time_levs(2) % state % uBolusGM % array(:,:) = 0.0
+        end if
+
+        if(config_use_GM) then
+           ! Compute velocity transport, used in advection terms of h and tracer tendency
+           block % state % time_levs(2) % state % uTransport % array(:,:) &amp;
+              = block % state % time_levs(2) % state % u % array(:,:) &amp;
+              + block % state % time_levs(2) % state % uBolusGM % array(:,:)
+         end if
+
         call ocn_vmix_implicit(dt, block % mesh, block % diagnostics, block % state % time_levs(2) % state, err)
 
         block =&gt; block % next
@@ -981,10 +995,12 @@
              block % state % time_levs(2) % state % uBolusGM % array(:,:) = 0.0
          end if
 
-         ! Compute velocity transport, used in advection terms of h and tracer tendency
-            block % state % time_levs(2) % state % uTransport % array(:,:) &amp;
-          = block % state % time_levs(2) % state % u % array(:,:) &amp;
-          + block % state % time_levs(2) % state % uBolusGM % array(:,:)
+         if(config_use_GM) then
+             ! Compute velocity transport, used in advection terms of h and tracer tendency
+             block % state % time_levs(2) % state % uTransport % array(:,:) &amp;
+                = block % state % time_levs(2) % state % u % array(:,:) &amp;
+                + block % state % time_levs(2) % state % uBolusGM % array(:,:)
+         end if
 
          call mpas_reconstruct(block % mesh, block % state % time_levs(2) % state % u % array,          &amp;
                           block % state % time_levs(2) % state % uReconstructX % array,            &amp;

Modified: branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_vmix.F
===================================================================
--- branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_vmix.F        2013-04-03 16:25:11 UTC (rev 2714)
+++ branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_vmix.F        2013-04-03 16:37:04 UTC (rev 2715)
@@ -23,6 +23,7 @@
    use ocn_vmix_coefs_const
    use ocn_vmix_coefs_tanh
    use ocn_vmix_coefs_rich
+   use ocn_vmix_coefs_redi
 
    implicit none
    private
@@ -112,7 +113,7 @@
       !
       !-----------------------------------------------------------------
 
-      integer :: err1, err2, err3
+      integer :: err1, err2, err3, err4
 
       !-----------------------------------------------------------------
       !
@@ -128,8 +129,9 @@
       call ocn_vmix_coefs_const_build(grid, s, d, err1)
       call ocn_vmix_coefs_tanh_build(grid, s, d, err2)
       call ocn_vmix_coefs_rich_build(grid, s, d, err3)
+      call ocn_vmix_coefs_redi_build(grid, s, d, err4)
 
-      err = ior(err1, ior(err2, err3))
+      err = ior(ior(err1, ior(err2, err3)), err4)
 
    !--------------------------------------------------------------------
 

Copied: branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_vmix_coefs_redi.F (from rev 2711, branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_vmix_coefs_const.F)
===================================================================
--- branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_vmix_coefs_redi.F                                (rev 0)
+++ branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_vmix_coefs_redi.F        2013-04-03 16:37:04 UTC (rev 2715)
@@ -0,0 +1,236 @@
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+!
+!  ocn_vmix_coefs_const
+!
+!&gt; \brief MPAS ocean vertical mixing coefficients
+!&gt; \author Doug Jacobsen
+!&gt; \date   19 September 2011
+!&gt; \version SVN:$Id:$
+!&gt; \details
+!&gt;  This module contains the routines for compounding
+!&gt;  the Redi vertical mixing coefficients.  
+!&gt;
+!
+!-----------------------------------------------------------------------
+
+module ocn_vmix_coefs_redi
+
+   use mpas_grid_types
+   use mpas_configure
+   use mpas_timer
+
+   implicit none
+   private
+   save
+
+   !--------------------------------------------------------------------
+   !
+   ! Public parameters
+   !
+   !--------------------------------------------------------------------
+
+   !--------------------------------------------------------------------
+   !
+   ! Public member functions
+   !
+   !--------------------------------------------------------------------
+
+   private :: ocn_tracer_vmix_coefs_redi
+
+   public :: ocn_vmix_coefs_redi_build, &amp;
+             ocn_vmix_coefs_redi_init
+
+   !--------------------------------------------------------------------
+   !
+   ! Private module variables
+   !
+   !--------------------------------------------------------------------
+
+   logical :: rediDiffOn
+
+
+
+!***********************************************************************
+
+contains
+
+!***********************************************************************
+!
+!  routine ocn_vmix_coefs_redi_build
+!
+!&gt; \brief   Computes coefficients for vertical mixing
+!&gt; \author  Doug Jacobsen
+!&gt; \date    19 September 2011
+!&gt; \version SVN:$Id$
+!&gt; \details 
+!&gt;  This routine computes the vertical mixing coefficients for momentum
+!&gt;  and tracers based user choices of mixing parameterization.
+!
+!-----------------------------------------------------------------------
+
+   subroutine ocn_vmix_coefs_redi_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
+      !
+      !-----------------------------------------------------------------
+
+      real (kind=RKIND), dimension(:,:), pointer :: &amp;
+        vertDiffTopOfCell, vertRediDiff
+
+      !-----------------------------------------------------------------
+      !
+      ! call relevant routines for computing tendencies
+      ! note that the user can choose multiple options and the 
+      !   tendencies will be added together
+      !
+      !-----------------------------------------------------------------
+
+      err = 0
+
+      vertDiffTopOfCell =&gt; d % vertDiffTopOfCell % array
+      vertRediDiff      =&gt; s % k33 % array
+
+      call ocn_tracer_vmix_coefs_redi(grid, vertDiffTopOfCell, vertRediDiff, err)
+
+   !--------------------------------------------------------------------
+
+   end subroutine ocn_vmix_coefs_redi_build!}}}
+
+!***********************************************************************
+!
+!  routine ocn_tracer_vmix_coefs_redi
+!
+!&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 rediant vertical mixing coefficients for tracers
+!
+!-----------------------------------------------------------------------
+
+   subroutine ocn_tracer_vmix_coefs_redi(grid, vertDiffTopOfCell, vertRediDiff, err)!{{{
+
+      !-----------------------------------------------------------------
+      !
+      ! input variables
+      !
+      !-----------------------------------------------------------------
+
+      type (mesh_type), intent(in) :: &amp;
+         grid          !&lt; Input: grid information
+
+      !-----------------------------------------------------------------
+      !
+      ! input/output variables
+      !
+      !-----------------------------------------------------------------
+
+      !-----------------------------------------------------------------
+      !
+      ! output variables
+      !
+      !-----------------------------------------------------------------
+
+      real (kind=RKIND), dimension(:,:), intent(inout) :: vertDiffTopOfCell !&lt; Output: Vertical diffusion
+
+      real (kind=RKIND), dimension(:,:), intent(in)    :: vertRediDiff !&lt; Output: Vertical diffusion
+
+      integer, intent(out) :: err !&lt; Output: error flag
+
+      !-----------------------------------------------------------------
+      !
+      ! local variables
+      !
+      !-----------------------------------------------------------------
+
+      err = 0
+
+      if(.not.rediDiffOn) return
+
+      vertDiffTopOfCell = vertDiffTopOfCell + vertRediDiff
+
+   !--------------------------------------------------------------------
+
+   end subroutine ocn_tracer_vmix_coefs_redi!}}}
+
+
+!***********************************************************************
+!
+!  routine ocn_vmix_coefs_redi_init
+!
+!&gt; \brief   Initializes ocean momentum vertical mixing quantities
+!&gt; \author  Doug Jacobsen
+!&gt; \date    19 September 2011
+!&gt; \version SVN:$Id$
+!&gt; \details 
+!&gt;  This routine initializes a variety of quantities related to 
+!&gt;  vertical velocity mixing in the ocean. Since a variety of 
+!&gt;  parameterizations are available, this routine primarily calls the
+!&gt;  individual init routines for each parameterization. 
+!
+!-----------------------------------------------------------------------
+
+
+   subroutine ocn_vmix_coefs_redi_init(err)!{{{
+
+   !--------------------------------------------------------------------
+
+      !-----------------------------------------------------------------
+      !
+      ! call individual init routines for each parameterization
+      !
+      !-----------------------------------------------------------------
+
+      integer, intent(out) :: err !&lt; Output: error flag
+
+      err = 0
+
+      if (config_Redi_kappa &gt; 0.) then
+         rediDiffOn = .True.
+      else
+         rediDiffOn = .False.
+      end if
+
+   !--------------------------------------------------------------------
+
+   end subroutine ocn_vmix_coefs_redi_init!}}}
+
+!***********************************************************************
+
+end module ocn_vmix_coefs_redi
+
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+
+! vim: foldmethod=marker

</font>
</pre>