<p><b>mpetersen@lanl.gov</b> 2011-12-07 14:35:44 -0700 (Wed, 07 Dec 2011)</p><p>Added zstar with arbitrary weights, and a bug fix.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/ale_vert_coord/src/core_ocean/mpas_ocn_mpas_core.F
===================================================================
--- branches/ocean_projects/ale_vert_coord/src/core_ocean/mpas_ocn_mpas_core.F        2011-12-07 19:42:16 UTC (rev 1243)
+++ branches/ocean_projects/ale_vert_coord/src/core_ocean/mpas_ocn_mpas_core.F        2011-12-07 21:35:44 UTC (rev 1244)
@@ -99,6 +99,9 @@
       elseif (config_vert_grid_type.eq.'zstar') then
          print *, ' Using z-star vertical coordinates'
          call init_ZLevel(domain)
+      elseif (config_vert_grid_type.eq.'zstarWeights') then
+         print *, ' Using z-star vertical coordinates with weights'
+         call init_ZLevel(domain)
       else 
          print *, ' Incorrect choice of config_vert_grid_type:',&amp;
            config_vert_grid_type

Modified: branches/ocean_projects/ale_vert_coord/src/core_ocean/mpas_ocn_tendency.F
===================================================================
--- branches/ocean_projects/ale_vert_coord/src/core_ocean/mpas_ocn_tendency.F        2011-12-07 19:42:16 UTC (rev 1243)
+++ branches/ocean_projects/ale_vert_coord/src/core_ocean/mpas_ocn_tendency.F        2011-12-07 21:35:44 UTC (rev 1244)
@@ -1155,7 +1155,7 @@
         h_s, fVertex, fEdge, dvEdge, dcEdge, areaCell, areaTriangle
       real (kind=RKIND), dimension(:,:), pointer :: u,h,wTop, h_edge
       real (kind=RKIND), dimension(:,:), allocatable:: div_hu
-      real (kind=RKIND), dimension(:), allocatable:: div_hu_btr, h_tend_col
+      real (kind=RKIND), dimension(:), allocatable:: div_hu_btr, h_tend_col, h_weights
 
       integer, dimension(:,:), pointer :: cellsOnEdge, cellsOnVertex, &amp;
         verticesOnEdge, edgesOnCell, edgesOnEdge, edgesOnVertex, &amp;
@@ -1182,7 +1182,7 @@
       nVertLevels = grid % nVertLevels
 
       allocate(div_hu(nVertLevels,nCells+1), div_hu_btr(nCells+1), &amp;
-          h_tend_col(nVertLevels))
+          h_tend_col(nVertLevels), h_weights(nVertLevels))
 
       !
       ! Compute div(h^{edge} u) for each cell
@@ -1192,7 +1192,7 @@
       do iEdge=1,nEdges
          cell1 = cellsOnEdge(1,iEdge)
          cell2 = cellsOnEdge(2,iEdge)
-         do k=2,maxLevelEdgeBot(iEdge)
+         do k=1,maxLevelEdgeBot(iEdge)
             flux = u(k,iEdge) * dvEdge(iEdge) * h_edge(k,iEdge) 
             div_hu(k,cell1) = div_hu(k,cell1) + flux
             div_hu(k,cell2) = div_hu(k,cell2) - flux
@@ -1270,9 +1270,37 @@
            end do
         end do
 
+      elseif (config_vert_grid_type.eq.'zstarWeights') then
+
+        ! This is a test with other weights, not meant to be permanent.
+
+        h_weights = 0.0
+        h_weights(1:5) = 1.0
+        do k=1,10
+           h_weights(5+k) = 1.0-k*0.1
+        end do
+
+        do iCell=1,nCells
+
+           hSum = 0.0
+           do k=1,maxLevelCell(iCell)
+              h_tend_col(k) = - h_weights(k)*h(k,iCell)*div_hu_btr(iCell)
+              hSum = hSum + h_weights(k)*h(k,iCell)
+           end do
+           h_tend_col = h_tend_col / hSum
+
+           ! Vertical velocity through layer interface at top and 
+           ! bottom is zero.
+           wTop(1,iCell) = 0.0
+           wTop(maxLevelCell(iCell)+1,iCell) = 0.0
+           do k=maxLevelCell(iCell),2,-1
+              wTop(k,iCell) = wTop(k+1,iCell) - div_hu(k,iCell) - h_tend_col(k)
+           end do
+        end do
+
       endif
 
-      deallocate(div_hu, div_hu_btr, h_tend_col)
+      deallocate(div_hu, div_hu_btr, h_tend_col, h_weights)
 
       call mpas_timer_stop(&quot;wTop&quot;)
 

</font>
</pre>