<p><b>mpetersen@lanl.gov</b> 2012-06-06 11:06:53 -0600 (Wed, 06 Jun 2012)</p><p>BRANCH COMMIT: More clean up.  I had redundant 'filter_btr_mode_u' subroutines in RK4 and split explicit.  I moved them to tendency module where they can be used by any timestepping method.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/vol_cons_RK_imp_mix/src/core_ocean/mpas_ocn_tendency.F
===================================================================
--- branches/ocean_projects/vol_cons_RK_imp_mix/src/core_ocean/mpas_ocn_tendency.F        2012-06-06 16:58:06 UTC (rev 1967)
+++ branches/ocean_projects/vol_cons_RK_imp_mix/src/core_ocean/mpas_ocn_tendency.F        2012-06-06 17:06:53 UTC (rev 1968)
@@ -70,7 +70,9 @@
              ocn_diagnostic_solve, &amp;
              ocn_wtop, &amp;
              ocn_fuperp, &amp;
-             ocn_tendency_init
+             ocn_tendency_init, &amp;
+             ocn_filter_btr_mode_u, &amp;
+             ocn_filter_btr_mode_tend_u
 
    !--------------------------------------------------------------------
    !
@@ -1031,9 +1033,116 @@
 
    end subroutine ocn_fuperp!}}}
 
+!***********************************************************************
+!
+!  routine ocn_filter_btr_mode_u
+!
+!&gt; \brief   filters barotropic mode out of the velocity variable.
+!&gt; \author  Mark Petersen
+!&gt; \date    23 September 2011
+!&gt; \version SVN:$Id$
+!&gt; \details 
+!&gt;  This routine filters barotropic mode out of the velocity variable.
+!
+!-----------------------------------------------------------------------
+   subroutine ocn_filter_btr_mode_u(s, grid)!{{{
+      implicit none
 
+      type (state_type), intent(inout) :: s
+      type (mesh_type), intent(in) :: grid
+
+      integer :: iEdge, k, nEdges
+      real (kind=RKIND) :: vertSum, uhSum, hSum
+      real (kind=RKIND), dimension(:,:), pointer :: h_edge, u
+      integer, dimension(:), pointer :: maxLevelEdgeTop
+
+      call mpas_timer_start(&quot;ocn_filter_btr_mode_u&quot;)
+
+      u           =&gt; s % u % array
+      h_edge      =&gt; s % h_edge % array
+      maxLevelEdgeTop =&gt; grid % maxLevelEdgeTop % array
+      nEdges      = grid % nEdges
+
+      do iEdge=1,nEdges
+
+        ! hSum is initialized outside the loop because on land boundaries 
+        ! maxLevelEdgeTop=0, but I want to initialize hSum with a 
+        ! nonzero value to avoid a NaN.
+        uhSum = h_edge(1,iEdge) * u(1,iEdge)
+        hSum  = h_edge(1,iEdge)
+
+        do k=2,maxLevelEdgeTop(iEdge)
+          uhSum = uhSum + h_edge(k,iEdge) * u(k,iEdge)
+          hSum  =  hSum + h_edge(k,iEdge)
+        enddo
+
+        vertSum = uhSum/hSum
+        do k=1,maxLevelEdgeTop(iEdge)
+          u(k,iEdge) = u(k,iEdge) - vertSum
+        enddo
+      enddo ! iEdge
+
+      call mpas_timer_stop(&quot;ocn_filter_btr_mode_u&quot;)
+
+   end subroutine ocn_filter_btr_mode_u!}}}
+
 !***********************************************************************
 !
+!  routine ocn_filter_btr_mode_tend_u
+!
+!&gt; \brief   ocn_filters barotropic mode out of the u tendency
+!&gt; \author  Mark Petersen
+!&gt; \date    23 September 2011
+!&gt; \version SVN:$Id$
+!&gt; \details 
+!&gt;  This routine filters barotropic mode out of the u tendency.
+!
+!-----------------------------------------------------------------------
+   subroutine ocn_filter_btr_mode_tend_u(tend, s, grid)!{{{
+      implicit none
+
+      type (tend_type), intent(inout) :: tend
+      type (state_type), intent(in) :: s
+      type (mesh_type), intent(in) :: grid
+
+      integer :: iEdge, k, nEdges
+      real (kind=RKIND) :: vertSum, uhSum, hSum
+      real (kind=RKIND), dimension(:,:), pointer :: h_edge, tend_u
+
+      integer, dimension(:), pointer :: maxLevelEdgeTop
+
+      call mpas_timer_start(&quot;ocn_filter_btr_mode_tend_u&quot;)
+
+      tend_u      =&gt; tend % u % array
+      h_edge      =&gt; s % h_edge % array
+      maxLevelEdgeTop =&gt; grid % maxLevelEdgeTop % array
+      nEdges      = grid % nEdges
+
+      do iEdge=1,nEdges
+
+        ! hSum is initialized outside the loop because on land boundaries 
+        ! maxLevelEdgeTop=0, but I want to initialize hSum with a 
+        ! nonzero value to avoid a NaN.
+        uhSum = h_edge(1,iEdge) * tend_u(1,iEdge)
+        hSum  = h_edge(1,iEdge)
+
+        do k=2,maxLevelEdgeTop(iEdge)
+          uhSum = uhSum + h_edge(k,iEdge) * tend_u(k,iEdge)
+          hSum  =  hSum + h_edge(k,iEdge)
+        enddo
+
+        vertSum = uhSum/hSum
+        do k=1,maxLevelEdgeTop(iEdge)
+          tend_u(k,iEdge) = tend_u(k,iEdge) - vertSum
+        enddo
+      enddo ! iEdge
+
+      call mpas_timer_stop(&quot;ocn_filter_btr_mode_tend_u&quot;)
+
+   end subroutine ocn_filter_btr_mode_tend_u!}}}
+
+!***********************************************************************
+!
 !  routine ocn_tendency_init
 !
 !&gt; \brief   Initializes flags used within tendency routines.

Modified: branches/ocean_projects/vol_cons_RK_imp_mix/src/core_ocean/mpas_ocn_time_integration_rk4.F
===================================================================
--- branches/ocean_projects/vol_cons_RK_imp_mix/src/core_ocean/mpas_ocn_time_integration_rk4.F        2012-06-06 16:58:06 UTC (rev 1967)
+++ branches/ocean_projects/vol_cons_RK_imp_mix/src/core_ocean/mpas_ocn_time_integration_rk4.F        2012-06-06 17:06:53 UTC (rev 1968)
@@ -165,7 +165,7 @@
            ! mrp 110718 filter btr mode out of u_tend
            ! still got h perturbations with just this alone.  Try to set uBtr=0 after full u computation
            if (config_rk_filter_btr_mode) then
-               call filter_btr_mode_tend_u(block % tend, provis, block % mesh)
+               call ocn_filter_btr_mode_tend_u(block % tend, provis, block % mesh)
            endif
 
            call ocn_tend_scalar(block % tend, provis, block % diagnostics, block % mesh, dt)
@@ -294,7 +294,7 @@
 
           !  mrp 110718 filter btr mode out of u
            if (config_rk_filter_btr_mode) then
-               call filter_btr_mode_u(block % state % time_levs(2) % state, block % mesh)
+               call ocn_filter_btr_mode_u(block % state % time_levs(2) % state, block % mesh)
                !block % tend % h % array(:,:) = 0.0 ! I should not need this
            endif
 
@@ -369,169 +369,6 @@
 
    end subroutine ocn_time_integrator_rk4!}}}
 
-   subroutine filter_btr_mode_tend_u(tend, s, grid)!{{{
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   ! Filter and remove barotropic mode from the tendencies
-   !
-   ! Input: s - current model state
-   !        grid - grid metadata
-   !
-   ! Output: tend - computed tendencies for prognostic variables
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-      implicit none
-
-      type (tend_type), intent(inout) :: tend
-      type (state_type), intent(in) :: s
-      type (mesh_type), intent(in) :: grid
-
-      integer :: iEdge, k, nEdges
-      real (kind=RKIND) :: vertSum, uhSum, hSum
-      real (kind=RKIND), dimension(:,:), pointer :: h_edge, tend_u
-
-      integer, dimension(:), pointer :: maxLevelEdgeTop
-
-      call mpas_timer_start(&quot;filter_btr_mode_tend_u&quot;)
-
-      h_edge      =&gt; s % h_edge % array
-      maxLevelEdgeTop      =&gt; grid % maxLevelEdgeTop % array
-      tend_u      =&gt; tend % u % array
-      nEdges      = grid % nEdges
-
-      do iEdge=1,nEdges
-
-        ! hSum is initialized outside the loop because on land boundaries 
-        ! maxLevelEdgeTop=0, but I want to initialize hSum with a 
-        ! nonzero value to avoid a NaN.
-        uhSum = h_edge(1,iEdge) * tend_u(1,iEdge)
-        hSum  = h_edge(1,iEdge)
-
-        do k=2,maxLevelEdgeTop(iEdge)
-          uhSum = uhSum + h_edge(k,iEdge) * tend_u(k,iEdge)
-          hSum  =  hSum + h_edge(k,iEdge)
-        enddo
-
-        vertSum = uhSum/hSum
-        do k=1,maxLevelEdgeTop(iEdge)
-          tend_u(k,iEdge) = tend_u(k,iEdge) - vertSum
-        enddo
-      enddo ! iEdge
-
-      call mpas_timer_stop(&quot;filter_btr_mode_tend_u&quot;)
-
-   end subroutine filter_btr_mode_tend_u!}}}
-
-   subroutine filter_btr_mode_u(s, grid)!{{{
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   ! Filter and remove barotropic mode.
-   !
-   ! Input: s - current model state
-   !        grid - grid metadata
-   !
-   ! Output: tend - computed tendencies for prognostic variables
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-      implicit none
-
-      type (state_type), intent(inout) :: s
-      type (mesh_type), intent(in) :: grid
-
-! mrp 110512 I just split compute_tend into compute_tend_u and compute_tend_h.
-!  Some of these variables can be removed, but at a later time.
-      integer :: iEdge, iCell, iVertex, k, cell1, cell2, &amp;
-        vertex1, vertex2, eoe, i, j
-
-      integer :: nCells, nEdges, nVertices, nVertLevels, nEdgesSolve
-      real (kind=RKIND) :: vertSum, uhSum, hSum, sshEdge
-      real (kind=RKIND), dimension(:), pointer :: &amp;
-        h_s, dvEdge, dcEdge, areaCell, areaTriangle, &amp;
-        meshScalingDel2, meshScalingDel4
-      real (kind=RKIND), dimension(:,:), pointer :: &amp;
-        weightsOnEdge, kiteAreasOnVertex, h_edge, h, u, v, pressure, &amp;
-        tend_u, circulation, vorticity, ke, ke_edge, Vor_edge, &amp;
-        MontPot, wTop, divergence, vertViscTopOfEdge
-      type (dm_info) :: dminfo
-
-      integer, dimension(:), pointer :: nEdgesOnCell, nEdgesOnEdge, &amp;
-        maxLevelCell, maxLevelEdgeTop, maxLevelVertexBot
-      integer, dimension(:,:), pointer :: &amp;
-        cellsOnEdge, cellsOnVertex, verticesOnEdge, edgesOnCell, &amp;
-        edgesOnEdge, edgesOnVertex
-      real (kind=RKIND) :: u_diffusion
-      real (kind=RKIND), dimension(:), allocatable:: fluxVertTop,w_dudzTopEdge
-
-      real (kind=RKIND), allocatable, dimension(:,:) :: delsq_divergence
-      real (kind=RKIND), allocatable, dimension(:,:) :: delsq_u
-      real (kind=RKIND), allocatable, dimension(:,:) :: delsq_circulation, delsq_vorticity
-
-
-      real (kind=RKIND), dimension(:,:), pointer :: u_src
-      real (kind=RKIND), parameter :: rho_ref = 1000.0
-
-      call mpas_timer_start(&quot;filter_btr_mode_u&quot;)
-
-      h           =&gt; s % h % array
-      u           =&gt; s % u % array
-      v           =&gt; s % v % array
-      wTop        =&gt; s % wTop % array
-      h_edge      =&gt; s % h_edge % array
-      circulation =&gt; s % circulation % array
-      vorticity   =&gt; s % vorticity % array
-      divergence  =&gt; s % divergence % array
-      ke          =&gt; s % ke % array
-      ke_edge     =&gt; s % ke_edge % array
-      Vor_edge     =&gt; s % Vor_edge % array
-      MontPot     =&gt; s % MontPot % array
-      pressure    =&gt; s % pressure % array
-
-      weightsOnEdge     =&gt; grid % weightsOnEdge % array
-      kiteAreasOnVertex =&gt; grid % kiteAreasOnVertex % array
-      cellsOnEdge       =&gt; grid % cellsOnEdge % array
-      cellsOnVertex     =&gt; grid % cellsOnVertex % array
-      verticesOnEdge    =&gt; grid % verticesOnEdge % array
-      nEdgesOnCell      =&gt; grid % nEdgesOnCell % array
-      edgesOnCell       =&gt; grid % edgesOnCell % array
-      nEdgesOnEdge      =&gt; grid % nEdgesOnEdge % array
-      edgesOnEdge       =&gt; grid % edgesOnEdge % array
-      edgesOnVertex     =&gt; grid % edgesOnVertex % array
-      dcEdge            =&gt; grid % dcEdge % array
-      dvEdge            =&gt; grid % dvEdge % array
-      areaCell          =&gt; grid % areaCell % array
-      areaTriangle      =&gt; grid % areaTriangle % array
-      h_s               =&gt; grid % h_s % array
-      maxLevelCell      =&gt; grid % maxLevelCell % array
-      maxLevelEdgeTop      =&gt; grid % maxLevelEdgeTop % array
-      maxLevelVertexBot    =&gt; grid % maxLevelVertexBot % array
-
-      nCells      = grid % nCells
-      nEdges      = grid % nEdges
-      nEdgesSolve = grid % nEdgesSolve
-      nVertices   = grid % nVertices
-      nVertLevels = grid % nVertLevels
-
-      u_src =&gt; grid % u_src % array
-
-           do iEdge=1,grid % nEdges
-
-              uhSum = (h_edge(1,iEdge)) * u(1,iEdge)
-              hSum  =  h_edge(1,iEdge)
-
-              do k=2,grid % maxLevelEdgeTop % array(iEdge)
-                 uhSum = uhSum + h_edge(k,iEdge) * u(k,iEdge)
-                 hSum  =  hSum + h_edge(k,iEdge)
-              enddo
-
-              vertSum = uhSum/hSum
-              do k=1,grid % maxLevelEdgeTop % array(iEdge)
-                 u(k,iEdge) = u(k,iEdge) - vertSum
-              enddo
-
-           enddo ! iEdge
-
-      call mpas_timer_stop(&quot;filter_btr_mode_u&quot;)
-
-   end subroutine filter_btr_mode_u!}}}
-
 end module ocn_time_integration_rk4
 
 ! vim: foldmethod=marker

Modified: branches/ocean_projects/vol_cons_RK_imp_mix/src/core_ocean/mpas_ocn_time_integration_split.F
===================================================================
--- branches/ocean_projects/vol_cons_RK_imp_mix/src/core_ocean/mpas_ocn_time_integration_split.F        2012-06-06 16:58:06 UTC (rev 1967)
+++ branches/ocean_projects/vol_cons_RK_imp_mix/src/core_ocean/mpas_ocn_time_integration_split.F        2012-06-06 17:06:53 UTC (rev 1968)
@@ -895,111 +895,8 @@
       end do
       call mpas_timer_stop(&quot;se timestep&quot;, timer_main)
 
-
    end subroutine ocn_time_integrator_split!}}}
 
-   subroutine filter_btr_mode_tend_u(tend, s, grid)!{{{
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   ! Filter and remove barotropic mode from the tendencies
-   !
-   ! Input: s - current model state
-   !        grid - grid metadata
-   !
-   ! Output: tend - computed tendencies for prognostic variables
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-      implicit none
-
-      type (tend_type), intent(inout) :: tend
-      type (state_type), intent(in) :: s
-      type (mesh_type), intent(in) :: grid
-
-      integer :: iEdge, k, nEdges
-      real (kind=RKIND) :: vertSum, uhSum, hSum
-      real (kind=RKIND), dimension(:,:), pointer :: h_edge, tend_u
-
-      integer, dimension(:), pointer :: maxLevelEdgeTop
-
-      call mpas_timer_start(&quot;filter_btr_mode_tend_u&quot;)
-
-      tend_u      =&gt; tend % u % array
-      h_edge      =&gt; s % h_edge % array
-      maxLevelEdgeTop =&gt; grid % maxLevelEdgeTop % array
-      nEdges      = grid % nEdges
-
-      do iEdge=1,nEdges
-
-        ! hSum is initialized outside the loop because on land boundaries 
-        ! maxLevelEdgeTop=0, but I want to initialize hSum with a 
-        ! nonzero value to avoid a NaN.
-        uhSum = h_edge(1,iEdge) * tend_u(1,iEdge)
-        hSum  = h_edge(1,iEdge)
-
-        do k=2,maxLevelEdgeTop(iEdge)
-          uhSum = uhSum + h_edge(k,iEdge) * tend_u(k,iEdge)
-          hSum  =  hSum + h_edge(k,iEdge)
-        enddo
-
-        vertSum = uhSum/hSum
-        do k=1,maxLevelEdgeTop(iEdge)
-          tend_u(k,iEdge) = tend_u(k,iEdge) - vertSum
-        enddo
-      enddo ! iEdge
-
-      call mpas_timer_stop(&quot;filter_btr_mode_tend_u&quot;)
-
-   end subroutine filter_btr_mode_tend_u!}}}
-
-   subroutine filter_btr_mode_u(s, grid)!{{{
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-   ! Filter and remove barotropic mode.
-   !
-   ! Input: s - current model state
-   !        grid - grid metadata
-   !
-   ! Output: tend - computed tendencies for prognostic variables
-   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-      implicit none
-
-      type (state_type), intent(inout) :: s
-      type (mesh_type), intent(in) :: grid
-
-      integer :: iEdge, k, nEdges
-      real (kind=RKIND) :: vertSum, uhSum, hSum
-      real (kind=RKIND), dimension(:,:), pointer :: h_edge, u
-      integer, dimension(:), pointer :: maxLevelEdgeTop
-
-      call mpas_timer_start(&quot;filter_btr_mode_u&quot;)
-
-      u           =&gt; s % u % array
-      h_edge      =&gt; s % h_edge % array
-      maxLevelEdgeTop =&gt; grid % maxLevelEdgeTop % array
-      nEdges      = grid % nEdges
-
-      do iEdge=1,nEdges
-
-        ! hSum is initialized outside the loop because on land boundaries 
-        ! maxLevelEdgeTop=0, but I want to initialize hSum with a 
-        ! nonzero value to avoid a NaN.
-        uhSum = h_edge(1,iEdge) * u(1,iEdge)
-        hSum  = h_edge(1,iEdge)
-
-        do k=2,maxLevelEdgeTop(iEdge)
-          uhSum = uhSum + h_edge(k,iEdge) * u(k,iEdge)
-          hSum  =  hSum + h_edge(k,iEdge)
-        enddo
-
-        vertSum = uhSum/hSum
-        do k=1,maxLevelEdgeTop(iEdge)
-          u(k,iEdge) = u(k,iEdge) - vertSum
-        enddo
-      enddo ! iEdge
-
-      call mpas_timer_stop(&quot;filter_btr_mode_u&quot;)
-
-   end subroutine filter_btr_mode_u!}}}
-
 end module ocn_time_integration_split
 
 ! vim: foldmethod=marker

</font>
</pre>