<p><b>qchen3@fsu.edu</b> 2013-04-16 14:57:31 -0600 (Tue, 16 Apr 2013)</p><p><br>
BRANCH COMMIT<br>
<br>
Removed singular values from slopeRelative and k33 by interpolation to nearby interfaces.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/gm_implement/src/core_ocean/Registry
===================================================================
--- branches/ocean_projects/gm_implement/src/core_ocean/Registry        2013-04-16 20:20:22 UTC (rev 2757)
+++ branches/ocean_projects/gm_implement/src/core_ocean/Registry        2013-04-16 20:57:31 UTC (rev 2758)
@@ -300,7 +300,7 @@
 var persistent real    zMid ( nVertLevels nCells Time ) 2 - zMid state - -
 var persistent real    v ( nVertLevels nEdges Time ) 2 - v state - -
 var persistent real    uTransport ( nVertLevels nEdges Time ) 2 - uTransport state - -
-var persistent real    uBolusGM ( nVertLevels nEdges Time ) 2 - uBolusGM state - -
+var persistent real    uBolusGM ( nVertLevels nEdges Time ) 2 o uBolusGM state - -
 var persistent real    uBolusGMX ( nVertLevels nEdges Time ) 2 - uBolusGMX state - -
 var persistent real    uBolusGMY ( nVertLevels nEdges Time ) 2 - uBolusGMY state - -
 var persistent real    uBolusGMZ ( nVertLevels nEdges Time ) 2 - uBolusGMZ state - -

Modified: branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_gm.F
===================================================================
--- branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_gm.F        2013-04-16 20:20:22 UTC (rev 2757)
+++ branches/ocean_projects/gm_implement/src/core_ocean/mpas_ocn_gm.F        2013-04-16 20:57:31 UTC (rev 2758)
@@ -108,6 +108,7 @@
 
       slopeRelative(:,:) = huge(0D0)
       k33(:,:) = huge(0D0)
+      uBolusGM(:,:) = huge(0D0)
 
       ! Compute density gradient (grad_rho) and gradient of zMid (grad_zMid) 
       ! along the constant coordinate surface.
@@ -187,9 +188,23 @@
 
       ! Compute slopeRelative at cell edge and layer interface
       ! QC Note: We may need to overwrite the invalid or unrealistically large values in the variable.
-      slopeRelative(:,:) = -(1.0 - config_diapycnal_diff) * grad_rho_interface(:,:) / rhoz_edge(:,:)
-      slopeRelative(:,:) = slopeRelative(:,:) - config_diapycnal_diff * grad_zMid_interface(:,:)
+      do iEdge = 1, nEdges
+         do k = 2, maxLevelEdgeTop(iEdge)
+            slopeRelative(k,iEdge) = -(1.0 - config_diapycnal_diff) * grad_rho_interface(k,iEdge) / rhoz_edge(k,iEdge) - config_diapycnal_diff * grad_zMid_interface(k,iEdge)
+         end do
 
+         ! Since rhoz_edge is guarantteed to be zero on the top surface, slopeRelative on the top surface is identified with its value on the second interface.
+         slopeRelative(1,iEdge) = slopeRelative(2,iEdge)
+
+         ! rhoz_edge may or may not equal zero on the bottom surface, depending on whether maxLevelEdgeTop(iEdge) = maxLevelEdgeBottom(iEdge). But here we
+         ! take a simplistic approach and idendify slopeRelative on the bottom sufrace with its value on the interface just above.
+         slopeRelative( maxLevelEdgeTop(iEdge)+1, iEdge ) = slopeRelative( maxLevelEdgeTop(iEdge), iEdge )
+      end do
+         
+            
+      !slopeRelative(:,:) = -(1.0 - config_diapycnal_diff) * grad_rho_interface(:,:) / rhoz_edge(:,:)
+      !slopeRelative(:,:) = slopeRelative(:,:) - config_diapycnal_diff * grad_zMid_interface(:,:)
+
       ! Compute k33 at cell center and layer interface
       k33(:,:) = 0.0
       do iEdge = 1, nEdges
@@ -204,9 +219,14 @@
 
       ! QC Note: We may need to overwrite invalid or unrealistically large values of k33.
       do iCell = 1,nCells
-         do k = 1, maxLevelCell(iCell)+1
+         do k = 2, maxLevelCell(iCell)
             k33(k,iCell) = k33(k,iCell) / areaCell(iCell) / rhoz(k,iCell)**2 + config_diapycnal_diff
+
          end do
+
+         k33(1,iCell) = k33(2,iCell)
+         k33( maxLevelCell(iCell)+1,iCell ) = k33( maxLevelCell(iCell), iCell )
+
       end do
             
 !WRITE(*,*) 'DEBUG MARK #4'

</font>
</pre>