<p><b>dwj07@fsu.edu</b> 2011-09-16 13:27:37 -0600 (Fri, 16 Sep 2011)</p><p><br>
        -- BRANCH COMMIT --<br>
<br>
        Adding modules for horizontal and vertical advection of thickness.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/performance/src/core_ocean/Makefile
===================================================================
--- branches/ocean_projects/performance/src/core_ocean/Makefile        2011-09-16 18:29:23 UTC (rev 1005)
+++ branches/ocean_projects/performance/src/core_ocean/Makefile        2011-09-16 19:27:37 UTC (rev 1006)
@@ -3,6 +3,8 @@
 OBJS = module_mpas_core.o \
        module_test_cases.o \
        module_advection.o \
+           module_OcnThickHadv.o \
+           module_OcnThickVadv.o \
            module_OcnVelCoriolis.o \
            module_OcnVelVadv.o \
            module_OcnVelHmix.o \
@@ -28,6 +30,10 @@
 
 module_global_diagnostics.o: 
 
+module_OcnThickHadv.o:
+
+module_OcnThickVadv.o:
+
 module_OcnVelPressureGrad.o:
 
 module_OcnVelVadv.o:
@@ -47,6 +53,8 @@
 module_OcnVelCoriolis.o:
 
 module_mpas_core.o: module_advection.o \
+                                        module_OcnThickHadv.o \
+                                        module_OcnThickVadv.o \
                                         module_global_diagnostics.o \
                                         module_test_cases.o \
                                         module_OcnVelCoriolis.o \

Added: branches/ocean_projects/performance/src/core_ocean/module_OcnThickHadv.F
===================================================================
--- branches/ocean_projects/performance/src/core_ocean/module_OcnThickHadv.F                                (rev 0)
+++ branches/ocean_projects/performance/src/core_ocean/module_OcnThickHadv.F        2011-09-16 19:27:37 UTC (rev 1006)
@@ -0,0 +1,210 @@
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+!
+!  OcnThickHadv
+!
+!&gt; \brief MPAS ocean horizontal advection for thickness
+!&gt; \author Doug Jacobsen
+!&gt; \date   16 September 2011
+!&gt; \version SVN:$Id:$
+!&gt; \details
+!&gt;  This module contains the routine for computing 
+!&gt;  tendencies for thickness from horizontal advection
+!
+!-----------------------------------------------------------------------
+
+module OcnThickHadv
+
+   use grid_types
+   use configure
+
+   implicit none
+   private
+   save
+
+   !--------------------------------------------------------------------
+   !
+   ! Public parameters
+   !
+   !--------------------------------------------------------------------
+
+   !--------------------------------------------------------------------
+   !
+   ! Public member functions
+   !
+   !--------------------------------------------------------------------
+
+   public :: OcnThickHadvTend, &amp;
+             OcnThickHadvInit
+
+   !--------------------------------------------------------------------
+   !
+   ! Private module variables
+   !
+   !--------------------------------------------------------------------
+
+
+!***********************************************************************
+
+contains
+
+!***********************************************************************
+!
+!  routine OcnThickHadvTend
+!
+!&gt; \brief   Computes tendency term from horizontal advection of thickness
+!&gt; \author  Doug Jacobsen
+!&gt; \date    15 September 2011
+!&gt; \version SVN:$Id$
+!&gt; \details 
+!&gt;  This routine computes the horizontal advection tendency for
+!&gt;  thicknes based on current state and user choices of forcings.
+!
+!-----------------------------------------------------------------------
+
+   subroutine OcnThickHadvTend(grid, u, h_edge, tend, err)
+
+      !-----------------------------------------------------------------
+      !
+      ! input variables
+      !
+      !-----------------------------------------------------------------
+
+      real (kind=RKIND), dimension(:,:), intent(in) :: &amp;
+         u    !&lt; Input: velocity
+
+      real (kind=RKIND), dimension(:,:), intent(in) :: &amp;
+         h_edge     !&lt; Input: thickness at edge
+
+      type (mesh_type), intent(in) :: &amp;
+         grid          !&lt; Input: grid information
+
+      !-----------------------------------------------------------------
+      !
+      ! input/output variables
+      !
+      !-----------------------------------------------------------------
+
+      real (kind=RKIND), dimension(:,:), intent(inout) :: &amp;
+         tend          !&lt; Input/Output: velocity tendency
+
+      !-----------------------------------------------------------------
+      !
+      ! output variables
+      !
+      !-----------------------------------------------------------------
+
+      integer, intent(out) :: err
+
+      !-----------------------------------------------------------------
+      !
+      ! local variables
+      !
+      !-----------------------------------------------------------------
+
+      integer :: iEdge, nEdges, cell1, cell2, nVertLevels, k
+      integer :: iCell, nCells
+
+      integer, dimension(:), pointer :: maxLevelEdgeTop
+      integer, dimension(:,:), pointer :: cellsOnEdge
+
+      real (kind=RKIND) :: flux
+      real (kind=RKIND), dimension(:), pointer :: dvEdge, areaCell
+
+      !-----------------------------------------------------------------
+      !
+      ! call relevant routines for computing tendencies
+      ! note that the user can choose multiple options and the 
+      !   tendencies will be added together
+      !
+      !-----------------------------------------------------------------
+
+      err = 0
+
+      nEdges = grid % nEdges
+      nCells = grid % nCells
+      nVertLevels = grid % nVertLevels
+
+      maxLevelEdgeTop =&gt; grid % maxLevelEdgeTop % array
+      cellsOnEdge =&gt; grid % cellsOnEdge % array
+      dvEdge =&gt; grid % dvEdge % array
+      areaCell =&gt; grid % areaCell % array
+
+      if (config_vert_grid_type.eq.'isopycnal') then

+         do iEdge=1,nEdges
+            cell1 = cellsOnEdge(1,iEdge)
+            cell2 = cellsOnEdge(2,iEdge)
+            do k=1,nVertLevels
+               flux = u(k,iEdge) * dvEdge(iEdge) * h_edge(k,iEdge)
+               tend(k,cell1) = tend(k,cell1) - flux
+               tend(k,cell2) = tend(k,cell2) + flux
+            end do
+         end do
+         do iCell=1,nCells
+            do k=1,nVertLevels
+               tend(k,iCell) = tend(k,iCell) / areaCell(iCell)
+            end do
+         end do
+
+      elseif (config_vert_grid_type.eq.'zlevel') then
+
+         do iEdge=1,nEdges
+            cell1 = cellsOnEdge(1,iEdge)
+            cell2 = cellsOnEdge(2,iEdge)
+            do k=1,min(1,maxLevelEdgeTop(iEdge))
+               flux = u(k,iEdge) * dvEdge(iEdge) * h_edge(k,iEdge)
+               tend(k,cell1) = tend(k,cell1) - flux
+               tend(k,cell2) = tend(k,cell2) + flux
+            end do
+         end do
+         do iCell=1,nCells
+           tend(1,iCell) = tend(1,iCell) / areaCell(iCell)
+         end do
+
+      endif ! config_vert_grid_type
+
+
+   !--------------------------------------------------------------------
+
+   end subroutine OcnThickHadvTend
+
+!***********************************************************************
+!
+!  routine OcnThickHadvInit
+!
+!&gt; \brief   Initializes ocean forcings
+!&gt; \author  Doug Jacobsen
+!&gt; \date    16 September 2011
+!&gt; \version SVN:$Id$
+!&gt; \details 
+!&gt;  This routine initializes quantities related to forcings 
+!&gt;  in the ocean. Since a multiple forcings are available, 
+!&gt;  this routine primarily calls the
+!&gt;  individual init routines for each forcing. 
+!
+!-----------------------------------------------------------------------
+
+
+   subroutine OcnThickHadvInit(err)
+
+   !--------------------------------------------------------------------
+
+      !-----------------------------------------------------------------
+      !
+      ! call individual init routines for each parameterization
+      !
+      !-----------------------------------------------------------------
+
+      integer, intent(out) :: err
+
+      err = 0
+
+   !--------------------------------------------------------------------
+
+   end subroutine OcnThickHadvInit
+
+!***********************************************************************
+
+end module OcnThickHadv
+
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Added: branches/ocean_projects/performance/src/core_ocean/module_OcnThickVadv.F
===================================================================
--- branches/ocean_projects/performance/src/core_ocean/module_OcnThickVadv.F                                (rev 0)
+++ branches/ocean_projects/performance/src/core_ocean/module_OcnThickVadv.F        2011-09-16 19:27:37 UTC (rev 1006)
@@ -0,0 +1,165 @@
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+!
+!  OcnThickVadv
+!
+!&gt; \brief MPAS ocean vertical advection for thickness
+!&gt; \author Doug Jacobsen
+!&gt; \date   16 September 2011
+!&gt; \version SVN:$Id:$
+!&gt; \details
+!&gt;  This module contains the routine for computing 
+!&gt;  tendencies for thickness from vertical advection
+!
+!-----------------------------------------------------------------------
+
+module OcnThickVadv
+
+   use grid_types
+   use configure
+
+   implicit none
+   private
+   save
+
+   !--------------------------------------------------------------------
+   !
+   ! Public parameters
+   !
+   !--------------------------------------------------------------------
+
+   !--------------------------------------------------------------------
+   !
+   ! Public member functions
+   !
+   !--------------------------------------------------------------------
+
+   public :: OcnThickVadvTend, &amp;
+             OcnThickVadvInit
+
+   !--------------------------------------------------------------------
+   !
+   ! Private module variables
+   !
+   !--------------------------------------------------------------------
+
+
+!***********************************************************************
+
+contains
+
+!***********************************************************************
+!
+!  routine OcnThickVadvTend
+!
+!&gt; \brief   Computes tendency term from vertical advection of thickness
+!&gt; \author  Doug Jacobsen
+!&gt; \date    15 September 2011
+!&gt; \version SVN:$Id$
+!&gt; \details 
+!&gt;  This routine computes the vertical advection tendency for
+!&gt;  thicknes based on current state and user choices of forcings.
+!
+!-----------------------------------------------------------------------
+
+   subroutine OcnThickVadvTend(grid, wTop, tend, err)
+
+      !-----------------------------------------------------------------
+      !
+      ! input variables
+      !
+      !-----------------------------------------------------------------
+
+      real (kind=RKIND), dimension(:,:), intent(in) :: &amp;
+         wTop     !&lt; Input: vertical velocity on top layer
+
+      type (mesh_type), intent(in) :: &amp;
+         grid          !&lt; Input: grid information
+
+      !-----------------------------------------------------------------
+      !
+      ! input/output variables
+      !
+      !-----------------------------------------------------------------
+
+      real (kind=RKIND), dimension(:,:), intent(inout) :: &amp;
+         tend          !&lt; Input/Output: velocity tendency
+
+      !-----------------------------------------------------------------
+      !
+      ! output variables
+      !
+      !-----------------------------------------------------------------
+
+      integer, intent(out) :: err
+
+      !-----------------------------------------------------------------
+      !
+      ! local variables
+      !
+      !-----------------------------------------------------------------
+
+      integer :: iCell, nCells
+
+      !-----------------------------------------------------------------
+      !
+      ! call relevant routines for computing tendencies
+      ! note that the user can choose multiple options and the 
+      !   tendencies will be added together
+      !
+      !-----------------------------------------------------------------
+
+      err = 0
+
+      nCells = grid % nCells
+
+      if (config_vert_grid_type.eq.'zlevel') then
+        do iCell=1,nCells
+           tend(1,iCell) =   tend(1,iCell) + wTop(2,iCell)
+        end do
+      endif ! coordinate type
+
+
+   !--------------------------------------------------------------------
+
+   end subroutine OcnThickVadvTend
+
+!***********************************************************************
+!
+!  routine OcnThickVadvInit
+!
+!&gt; \brief   Initializes ocean forcings
+!&gt; \author  Doug Jacobsen
+!&gt; \date    16 September 2011
+!&gt; \version SVN:$Id$
+!&gt; \details 
+!&gt;  This routine initializes quantities related to forcings 
+!&gt;  in the ocean. Since a multiple forcings are available, 
+!&gt;  this routine primarily calls the
+!&gt;  individual init routines for each forcing. 
+!
+!-----------------------------------------------------------------------
+
+
+   subroutine OcnThickVadvInit(err)
+
+   !--------------------------------------------------------------------
+
+      !-----------------------------------------------------------------
+      !
+      ! call individual init routines for each parameterization
+      !
+      !-----------------------------------------------------------------
+
+      integer, intent(out) :: err
+      
+      err = 0
+
+   !--------------------------------------------------------------------
+
+   end subroutine OcnThickVadvInit
+
+!***********************************************************************
+
+end module OcnThickVadv
+
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Modified: branches/ocean_projects/performance/src/core_ocean/module_time_integration.F
===================================================================
--- branches/ocean_projects/performance/src/core_ocean/module_time_integration.F        2011-09-16 18:29:23 UTC (rev 1005)
+++ branches/ocean_projects/performance/src/core_ocean/module_time_integration.F        2011-09-16 19:27:37 UTC (rev 1006)
@@ -8,6 +8,9 @@
    use spline_interpolation
    use timer
 
+   use OcnThickHadv
+   use OcnThickVadv
+
    use OcnVelCoriolis
    use OcnVelPressureGrad
    use OcnVelVadv
@@ -1571,7 +1574,7 @@
       type (mesh_type), intent(in) :: grid
 
       integer :: iEdge, iCell, iVertex, k, cell1, cell2, &amp;
-        vertex1, vertex2, eoe, i, j
+        vertex1, vertex2, eoe, i, j, err
 
 ! mrp 110512 I just split compute_tend into compute_tend_u and compute_tend_h.
 !  Most of these variables can be removed, but at a later time.
@@ -1661,39 +1664,9 @@
       ! for z-level, only compute height tendency for top layer.
 
       call timer_start(&quot;compute_tend_h-horiz adv&quot;)
-      if (config_vert_grid_type.eq.'isopycnal') then

-         do iEdge=1,nEdges
-            cell1 = cellsOnEdge(1,iEdge)
-            cell2 = cellsOnEdge(2,iEdge)
-            do k=1,nVertLevels
-               flux = u(k,iEdge) * dvEdge(iEdge) * h_edge(k,iEdge)
-               tend_h(k,cell1) = tend_h(k,cell1) - flux
-               tend_h(k,cell2) = tend_h(k,cell2) + flux
-            end do
-         end do
-         do iCell=1,nCells
-            do k=1,nVertLevels
-               tend_h(k,iCell) = tend_h(k,iCell) / areaCell(iCell)
-            end do
-         end do
 
-      elseif (config_vert_grid_type.eq.'zlevel') then
+      call OcnThickHadvTend(grid, u, h_edge, tend_h, err)
 
-         do iEdge=1,nEdges
-            cell1 = cellsOnEdge(1,iEdge)
-            cell2 = cellsOnEdge(2,iEdge)
-            do k=1,min(1,maxLevelEdgeTop(iEdge))
-               flux = u(k,iEdge) * dvEdge(iEdge) * h_edge(k,iEdge)
-               tend_h(k,cell1) = tend_h(k,cell1) - flux
-               tend_h(k,cell2) = tend_h(k,cell2) + flux
-            end do
-         end do
-         do iCell=1,nCells
-           tend_h(1,iCell) = tend_h(1,iCell) / areaCell(iCell)
-         end do
-
-      endif ! config_vert_grid_type
       call timer_stop(&quot;compute_tend_h-horiz adv&quot;)
 
       !
@@ -1701,11 +1674,9 @@
       !
       ! Vertical advection computed for top layer of a z grid only.
       call timer_start(&quot;compute_tend_h-vert adv&quot;)
-      if (config_vert_grid_type.eq.'zlevel') then
-        do iCell=1,nCells
-           tend_h(1,iCell) =   tend_h(1,iCell) + wTop(2,iCell)
-        end do
-      endif ! coordinate type
+
+      call OcnThickVadvTend(grid, wTop, tend_h, err)
+
       call timer_stop(&quot;compute_tend_h-vert adv&quot;)
       call timer_stop(&quot;compute_tend_h&quot;)
    

</font>
</pre>