<p><b>qchen3@fsu.edu</b> 2012-01-20 15:15:12 -0700 (Fri, 20 Jan 2012)</p><p>BRANCH COMMIT<br>
<br>
GM for thickness is now re-implemented as a stand-alone module.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/gmvar/Makefile
===================================================================
--- branches/ocean_projects/gmvar/Makefile        2012-01-20 22:12:31 UTC (rev 1403)
+++ branches/ocean_projects/gmvar/Makefile        2012-01-20 22:15:12 UTC (rev 1404)
@@ -111,9 +111,9 @@
         &quot;CC = gcc&quot; \
         &quot;SFC = ifort&quot; \
         &quot;SCC = gcc&quot; \
-        &quot;FFLAGS = -real-size 64 -g -convert big_endian -FR&quot; \
-        &quot;CFLAGS = -g -m64&quot; \
-        &quot;LDFLAGS = -g&quot; \
+        &quot;FFLAGS = -real-size 64 -O3 -convert big_endian -FR&quot; \
+        &quot;CFLAGS = -O3 -m64&quot; \
+        &quot;LDFLAGS = -O3&quot; \
         &quot;CORE = $(CORE)&quot; \
         &quot;CPPFLAGS = -DRKIND=8 $(MODEL_FORMULATION) -DUNDERSCORE -m64 $(FILE_OFFSET) $(ZOLTAN_DEFINE)&quot; )
 

Modified: branches/ocean_projects/gmvar/namelist.input.ocean
===================================================================
--- branches/ocean_projects/gmvar/namelist.input.ocean        2012-01-20 22:12:31 UTC (rev 1403)
+++ branches/ocean_projects/gmvar/namelist.input.ocean        2012-01-20 22:15:12 UTC (rev 1404)
@@ -4,7 +4,7 @@
    config_rk_filter_btr_mode = .false.
    config_dt = 180.0
    config_start_time = '0000-01-01_00:00:00'
-   config_run_duration = '5_00:00:00'
+   config_run_duration = '1_00:00:00'
    config_stats_interval = 480
 /
 &amp;io

Modified: branches/ocean_projects/gmvar/src/core_ocean/Makefile
===================================================================
--- branches/ocean_projects/gmvar/src/core_ocean/Makefile        2012-01-20 22:12:31 UTC (rev 1403)
+++ branches/ocean_projects/gmvar/src/core_ocean/Makefile        2012-01-20 22:15:12 UTC (rev 1404)
@@ -5,6 +5,7 @@
        mpas_ocn_advection.o \
            mpas_ocn_thick_hadv.o \
            mpas_ocn_thick_vadv.o \
+           mpas_ocn_gm.o \
            mpas_ocn_vel_coriolis.o \
            mpas_ocn_vel_vadv.o \
            mpas_ocn_vel_hmix.o \
@@ -59,7 +60,7 @@
 
 mpas_ocn_time_integration_split.o:
 
-mpas_ocn_tendency.o:
+mpas_ocn_tendency.o: mpas_ocn_gm.o
 
 mpas_ocn_global_diagnostics.o: 
 
@@ -67,6 +68,8 @@
 
 mpas_ocn_thick_vadv.o:
 
+mpas_ocn_gm.o: 
+
 mpas_ocn_vel_pressure_grad.o:
 
 mpas_ocn_vel_vadv.o:
@@ -135,6 +138,7 @@
                                   mpas_ocn_test_cases.o \
                                           mpas_ocn_advection.o \
                                           mpas_ocn_thick_hadv.o \
+                                          mpas_ocn_gm.o \
                                           mpas_ocn_thick_vadv.o \
                                           mpas_ocn_vel_coriolis.o \
                                           mpas_ocn_vel_vadv.o \

Modified: branches/ocean_projects/gmvar/src/core_ocean/Registry
===================================================================
--- branches/ocean_projects/gmvar/src/core_ocean/Registry        2012-01-20 22:12:31 UTC (rev 1403)
+++ branches/ocean_projects/gmvar/src/core_ocean/Registry        2012-01-20 22:15:12 UTC (rev 1404)
@@ -226,6 +226,7 @@
 var persistent real    uBolusZonal ( nVertLevels nEdges Time ) 2 o uBolusZonal state - -
 var persistent real    uBolusMeridional ( nVertLevels nEdges Time ) 2 o uBolusMeridional state - -
 var persistent real    uTransport ( nVertLevels nEdges Time ) 2 o uTransport state - -
+var persistent real    hEddyFlux ( nVertLevels nEdges Time ) 2 o hEddyFlux state - -
 var persistent real    h_kappa ( nVertLevels nEdges Time ) 2 o h_kappa state - -
 var persistent real    h_kappa_q ( nVertLevels nEdges Time ) 2 o h_kappa_q state - -
 var persistent real    hu ( nVertLevels nEdges Time ) 2 0 hu state - -

Added: branches/ocean_projects/gmvar/src/core_ocean/mpas_ocn_gm.F
===================================================================
--- branches/ocean_projects/gmvar/src/core_ocean/mpas_ocn_gm.F                                (rev 0)
+++ branches/ocean_projects/gmvar/src/core_ocean/mpas_ocn_gm.F        2012-01-20 22:15:12 UTC (rev 1404)
@@ -0,0 +1,158 @@
+module ocn_gm
+
+   use ieee_arithmetic
+
+   use mpas_grid_types
+   use mpas_configure
+   use mpas_timer
+   
+   implicit none
+   private 
+   save
+
+   !--------------------------------------------------------------------
+   !
+   ! Public parameters
+   !
+   !--------------------------------------------------------------------
+
+   !--------------------------------------------------------------------
+   !
+   ! Public member functions
+   !
+   !--------------------------------------------------------------------
+
+   public :: ocn_gm_compute_uTransport
+
+   !--------------------------------------------------------------------
+   !
+   ! Private module variables
+   !
+   !--------------------------------------------------------------------
+
+contains
+
+   subroutine ocn_gm_compute_uTransport(s, grid)
+      implicit none
+      type(state_type), intent(inout)        :: s
+      type(mesh_type), intent(in)            :: grid
+
+      real(kind=RKIND), dimension(:,:), pointer :: u, uBolus, uTransport
+
+      u           =&gt; s % u % array
+      uBolus      =&gt; s % uBolus % array
+      uTransport  =&gt; s % uTransport % array
+
+      call ocn_gm_compute_uBolus(s, grid)
+      uTransport(:,:) = u(:,:) + uBolus(:,:)
+
+   end subroutine ocn_gm_compute_uTransport
+      
+
+   subroutine ocn_gm_compute_uBolus(s, grid)
+      implicit none
+      type(state_type), intent(inout)        :: s
+      type(mesh_type), intent(in)            :: grid
+
+      real(kind=RKIND), dimension(:,:), pointer :: uBolus, hEddyFlux, h_edge
+
+      integer, dimension(:), pointer   :: maxLevelEdgeTop
+      integer                          :: k, iEdge, nEdges
+
+      uBolus         =&gt; s % uBolus % array
+      h_edge         =&gt; s % h_edge % array
+      hEddyFlux      =&gt; s % hEddyFlux % array
+
+      maxLevelEdgeTop =&gt; grid % maxLevelEdgeTop % array
+
+      nEdges = grid % nEdges
+
+      call ocn_gm_compute_hEddyFlux(s, grid)
+
+      if (config_vert_grid_type .EQ. 'z-level') then
+         ! Nothing for now
+         uBolus(:,:) = 0.0
+
+      else if (config_vert_grid_type .EQ. 'isopycnal') then
+         do iEdge = 1, nEdges
+            do k = 1, maxLevelEdgeTop(iEdge)
+               uBolus(k,iEdge) = hEddyFlux(k,iEdge)/h_edge(k,iEdge)
+            end do
+         end do
+      end if
+
+   end subroutine ocn_gm_compute_uBolus
+
+
+   subroutine ocn_gm_compute_hEddyFlux(s, grid)
+      implicit none
+      type(state_type), intent(inout)     :: s
+      type(mesh_type), intent(in)         :: grid
+
+      real(kind=RKIND), dimension(:,:), pointer  :: hEddyFlux, h
+      real(kind=RKIND), dimension(:), pointer    :: dcEdge
+      integer, dimension(:,:), pointer           :: cellsOnEdge
+      integer, dimension(:), pointer             :: maxLevelEdgeTop
+      integer                                    :: k, cell1, cell2, iEdge, nEdges
+
+      hEddyFlux      =&gt; s % hEddyFlux % array
+      h              =&gt; s % h % array
+
+      dcEdge         =&gt; grid % dcEdge % array
+      cellsOnEdge    =&gt; grid % cellsOnEdge % array
+      maxLevelEdgeTop =&gt; grid % maxLevelEdgeTop % array
+
+      nEdges = grid % nEdges
+
+      hEddyFlux(:,:) = 0.0
+
+      if (config_vert_grid_type .EQ. 'z-level') then
+
+         !Nothing for now
+
+      else if (config_vert_grid_type .EQ. 'isopycnal') then
+            do iEdge = 1,nEdges
+               cell1 = cellsOnEdge(1,iEdge)
+               cell2 = cellsOnEdge(2,iEdge)
+               do k=1,maxLevelEdgeTop(iEdge)
+                  hEddyFlux(k,iEdge) = -config_h_kappa * (h(k,cell2) - h(k,cell1)) / dcEdge(iEdge)
+               end do
+            end do
+       end if
+                  
+   end subroutine ocn_gm_compute_hEddyFlux
+
+
+
+   subroutine ocn_get_h_kappa(s, grid)
+
+      type (state_type), intent(inout) :: s
+      type (mesh_type), intent(in) :: grid
+
+      real(kind=RKIND), dimension(:,:), pointer    :: h_kappa
+
+
+      h_kappa  =&gt; s % h_kappa % array
+
+      h_kappa(:,:) = config_h_kappa
+
+
+   end subroutine ocn_get_h_kappa
+
+
+   subroutine ocn_get_h_kappa_q(s, grid)
+
+      type (state_type), intent(inout) :: s
+      type (mesh_type), intent(in) :: grid
+
+      real(kind=RKIND), dimension(:,:), pointer    :: h_kappa_q
+
+
+      h_kappa_q  =&gt; s % h_kappa_q % array
+
+      h_kappa_q(:,:) = config_h_kappa_q
+
+
+   end subroutine ocn_get_h_kappa_q
+
+end module ocn_gm

Modified: branches/ocean_projects/gmvar/src/core_ocean/mpas_ocn_tendency.F
===================================================================
--- branches/ocean_projects/gmvar/src/core_ocean/mpas_ocn_tendency.F        2012-01-20 22:12:31 UTC (rev 1403)
+++ branches/ocean_projects/gmvar/src/core_ocean/mpas_ocn_tendency.F        2012-01-20 22:15:12 UTC (rev 1404)
@@ -23,6 +23,7 @@
 
    use ocn_thick_hadv
    use ocn_thick_vadv
+   use ocn_gm
 
    use ocn_vel_coriolis
    use ocn_vel_pressure_grad
@@ -98,7 +99,7 @@
       implicit none
 
       type (tend_type), intent(inout) :: tend
-      type (state_type), intent(in) :: s
+      type (state_type), intent(inout) :: s
       type (diagnostics_type), intent(in) :: d
       type (mesh_type), intent(in) :: grid
 
@@ -195,7 +196,12 @@
 
       call mpas_timer_start(&quot;ocn_tend_h-horiz adv&quot;)
 
-      call ocn_thick_hadv_tend(grid, uTransport, h_edge, tend_h, err)
+      if (config_h_kappa .GE. epsilon(1d0)) then
+         call ocn_gm_compute_uTransport(s, grid)
+         call ocn_thick_hadv_tend(grid, uTransport, h_edge, tend_h, err)
+      else
+         call ocn_thick_hadv_tend(grid, u, h_edge, tend_h, err)
+      end if
 
       call mpas_timer_stop(&quot;ocn_tend_h-horiz adv&quot;)
 
@@ -621,8 +627,7 @@
         weightsOnEdge, kiteAreasOnVertex, h_edge, h, u, v, w, pressure,&amp;
         circulation, vorticity, ke, ke_edge, MontPot, wTop, &amp;
         pv_edge, pv_vertex, pv_cell, gradPVn, gradPVt, divergence, &amp;
-        rho, temperature, salinity, kev, kevc, uBolus, uTransport, &amp;
-        h_kappa, h_kappa_q
+        rho, temperature, salinity, kev, kevc, uBolus, uTransport
       real (kind=RKIND), dimension(:,:,:), pointer :: tracers
       real (kind=RKIND), dimension(:), allocatable:: pTop
       real (kind=RKIND), dimension(:,:), allocatable:: div_u
@@ -643,9 +648,9 @@
 
       h           =&gt; s % h % array
       u           =&gt; s % u % array
-      v           =&gt; s % v % array
       uBolus      =&gt; s % uBolus % array
       uTransport  =&gt; s % uTransport % array
+      v           =&gt; s % v % array
       wTop        =&gt; s % wTop % array
       h_edge      =&gt; s % h_edge % array
       circulation =&gt; s % circulation % array
@@ -664,8 +669,6 @@
       tracers     =&gt; s % tracers % array
       MontPot     =&gt; s % MontPot % array
       pressure    =&gt; s % pressure % array
-      h_kappa     =&gt; s % h_kappa % array
-      h_kappa_q   =&gt; s % h_kappa_q % array
 
       weightsOnEdge     =&gt; grid % weightsOnEdge % array
       kiteAreasOnVertex =&gt; grid % kiteAreasOnVertex % array
@@ -913,31 +916,6 @@
       enddo
 
       !
-      ! Compute Bolus velocity as bolus == - /kappa (/grad h) / h
-      !
-      uBolus(:,:) = 0.0
-      if (config_vert_grid_type .EQ. 'z-level') then
-         ! Nothing for now
-
-      else if (config_vert_grid_type .EQ. 'isopycnal') then
-         call ocn_get_h_kappa(s, grid)
-         if (maxval(h_kappa(:,:)) &gt; epsilon(1d0)) then
-            do iEdge = 1,nEdges
-               cell1 = cellsOnEdge(1,iEdge)
-               cell2 = cellsOnEdge(2,iEdge)
-               do k=1,maxLevelEdgeTop(iEdge)
-                  uBolus(k,iEdge) = -h_kappa(k,iEdge) * (h(k,cell2) - h(k,cell1))/dcEdge(iEdge)/h_edge(k,iEdge)
-               end do
-            end do
-         end if
-      end if
-
-      !
-      ! Compute the transport velocity (this velocity transports thickness and PV)
-      !
-      uTransport(:,:) = u(:,:) + uBolus(:,:)
-
-      !
       ! Compute kinetic energy in each cell by blending ke and kevc
       !
       if(config_include_KE_vertex) then
@@ -1379,37 +1357,6 @@
    end subroutine ocn_fuperp!}}}
 
 
-   subroutine ocn_get_h_kappa(s, grid)
-
-      type (state_type), intent(inout) :: s
-      type (mesh_type), intent(in) :: grid
-
-      real(kind=RKIND), dimension(:,:), pointer    :: h_kappa
-
-
-      h_kappa  =&gt; s % h_kappa % array
-
-      h_kappa(:,:) = config_h_kappa
-
-
-   end subroutine ocn_get_h_kappa
-
-
-   subroutine ocn_get_h_kappa_q(s, grid)
-
-      type (state_type), intent(inout) :: s
-      type (mesh_type), intent(in) :: grid
-
-      real(kind=RKIND), dimension(:,:), pointer    :: h_kappa_q
-
-
-      h_kappa_q  =&gt; s % h_kappa_q % array
-
-      h_kappa_q(:,:) = config_h_kappa_q
-
-
-   end subroutine ocn_get_h_kappa_q
-
 !***********************************************************************
 
 end module ocn_tendency

</font>
</pre>