<p><b>mpetersen@lanl.gov</b> 2012-01-26 17:06:27 -0700 (Thu, 26 Jan 2012)</p><p>After Todd's review, I changed a few minor lines.  I decided to leave the isopycnal pressure as a true Montgomery Potential, but merged in Doug's removal of branching to improve performance in mpas_ocn_vel_pressure_grad.F.  Retested using isopycnal, zlevel, and zstar.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/ale_vert_coord_new/src/core_ocean/mpas_ocn_global_diagnostics.F
===================================================================
--- branches/ocean_projects/ale_vert_coord_new/src/core_ocean/mpas_ocn_global_diagnostics.F        2012-01-26 19:44:19 UTC (rev 1427)
+++ branches/ocean_projects/ale_vert_coord_new/src/core_ocean/mpas_ocn_global_diagnostics.F        2012-01-27 00:06:27 UTC (rev 1428)
@@ -430,7 +430,7 @@
             write (fileID,'(100es24.14)') averages(1:nVariables)
          close (fileID)
          open(fileID,file='stats_time.txt',ACCESS='append')
-            write (fileID,'(i5,10x,a,100es24.14)') timeIndex, &amp;
+            write (fileID,'(i10,10x,a,100es24.14)') timeIndex, &amp;
                state % xtime % scalar, dt, &amp;
                CFLNumberGlobal
          close (fileID)

Modified: branches/ocean_projects/ale_vert_coord_new/src/core_ocean/mpas_ocn_mpas_core.F
===================================================================
--- branches/ocean_projects/ale_vert_coord_new/src/core_ocean/mpas_ocn_mpas_core.F        2012-01-26 19:44:19 UTC (rev 1427)
+++ branches/ocean_projects/ale_vert_coord_new/src/core_ocean/mpas_ocn_mpas_core.F        2012-01-27 00:06:27 UTC (rev 1428)
@@ -98,27 +98,21 @@
 
       call ocn_compute_max_level(domain)
 
-      if (config_vert_grid_type.eq.'isopycnal') then
-         print *, ' Using isopycnal vertical coordinates'
-      elseif (config_vert_grid_type.eq.'zlevel') then
-         print *, ' Using z-level vertical coordinates'
-         call ocn_init_z_level(domain)
-      elseif (config_vert_grid_type.eq.'zstar1') then
-         print *, ' Using z-star vertical coordinates,', &amp;
-           ' all convergence in top layer'
-         call ocn_init_z_level(domain)
-      elseif (config_vert_grid_type.eq.'zstar') then
-         print *, ' Using z-star vertical coordinates'
-         call ocn_init_z_level(domain)
-      elseif (config_vert_grid_type.eq.'zstarWeights') then
-         print *, ' Using z-star vertical coordinates with weights'
-         call ocn_init_z_level(domain)
-      else 
-         print *, ' Incorrect choice of config_vert_grid_type:',&amp;
-           config_vert_grid_type
+      print *, ' Vertical grid type is: ',config_vert_grid_type
+
+      if (config_vert_grid_type.ne.'isopycnal'.and. &amp;
+          config_vert_grid_type.ne.'zlevel'.and. &amp;
+          config_vert_grid_type.ne.'zstar1'.and. &amp;
+          config_vert_grid_type.ne.'zstar'.and. &amp;
+          config_vert_grid_type.ne.'zstarWeights') then
+         print *, ' Incorrect choice of config_vert_grid_type.'
          call mpas_dmpar_abort(dminfo)
       endif
 
+      if (config_vert_grid_type.ne.'isopycnal') then
+         call ocn_init_z_level(domain)
+      endif
+
       if (trim(config_new_btr_variables_from) == 'btr_avg' &amp;
            .and.trim(config_time_integration) == 'unsplit_explicit') then
          print *, ' unsplit_explicit option must use',&amp;

Modified: branches/ocean_projects/ale_vert_coord_new/src/core_ocean/mpas_ocn_tendency.F
===================================================================
--- branches/ocean_projects/ale_vert_coord_new/src/core_ocean/mpas_ocn_tendency.F        2012-01-26 19:44:19 UTC (rev 1427)
+++ branches/ocean_projects/ale_vert_coord_new/src/core_ocean/mpas_ocn_tendency.F        2012-01-27 00:06:27 UTC (rev 1428)
@@ -788,8 +788,6 @@
       ! For zlevel, calculate in-situ density
       if (config_vert_grid_type.ne.'isopycnal') then
          call mpas_timer_start(&quot;equation of state&quot;, .false., diagEOSTimer)
-         call mpas_timer_start(&quot;equation of state&quot;, .false., diagEOSTimer)
-         call mpas_timer_start(&quot;equation of state&quot;, .false., diagEOSTimer)
          call ocn_equation_of_state_rho(s, grid, 0, 'relative', err)
       ! mrp 110324 In order to visualize rhoDisplaced, include the following
          call ocn_equation_of_state_rho(s, grid, 1, 'relative', err)

Modified: branches/ocean_projects/ale_vert_coord_new/src/core_ocean/mpas_ocn_vel_pressure_grad.F
===================================================================
--- branches/ocean_projects/ale_vert_coord_new/src/core_ocean/mpas_ocn_vel_pressure_grad.F        2012-01-26 19:44:19 UTC (rev 1427)
+++ branches/ocean_projects/ale_vert_coord_new/src/core_ocean/mpas_ocn_vel_pressure_grad.F        2012-01-27 00:06:27 UTC (rev 1428)
@@ -119,28 +119,20 @@
       dcEdge =&gt; grid % dcEdge % array
       edgeMask =&gt; grid % edgeMask % array
 
-      if (config_vert_grid_type.eq.'isopycnal') then
-        do iEdge=1,nEdgesSolve
-          cell1 = cellsOnEdge(1,iEdge)
-          cell2 = cellsOnEdge(2,iEdge)
-          invdcEdge = 1.0 / dcEdge(iEdge)
+      ! pressure for generalized coordinates
+      ! -1/rho_0 (grad p_k + rho g grad z_k^{mid})
 
-          do k=1,maxLevelEdgeTop(iEdge)
-             tend(k,iEdge) = tend(k,iEdge)     &amp;
-               - edgeMask(k,iEdge) *(pressure(k,cell2) - pressure(k,cell1))* invdcEdge
-           end do
-        enddo
-      else 
+      ! For pure isopycnal coordinates, we are still using 
+      ! grad(M), the gradient of Montgomery Potential, because
+      ! we have set rho0Inv=1 and grho0Inv=0 in the init routine,
+      ! and pressure is passed in as MontPot.
 
-        ! pressure for generalized coordinates
-        ! -1/rho_0 (grad p_k + rho g grad z_k^{mid})
-        grho0Inv = gravity*rho0Inv
-        do iEdge=1,nEdgesSolve
-          cell1 = cellsOnEdge(1,iEdge)
-          cell2 = cellsOnEdge(2,iEdge)
-          invdcEdge = 1.0 / dcEdge(iEdge)
+      do iEdge=1,nEdgesSolve
+         cell1 = cellsOnEdge(1,iEdge)
+         cell2 = cellsOnEdge(2,iEdge)
+         invdcEdge = 1.0 / dcEdge(iEdge)
 
-          do k=1,maxLevelEdgeTop(iEdge)
+         do k=1,maxLevelEdgeTop(iEdge)
             tend(k,iEdge) = tend(k,iEdge)     &amp;
               - edgeMask(k,iEdge) * rho0Inv*(  pressure(k,cell2) &amp;
                          - pressure(k,cell1) )* invdcEdge &amp;
@@ -148,13 +140,10 @@
                         *(  zMid(k,cell2) &amp;
                           - zMid(k,cell1) )* invdcEdge
                       
-          end do
+         end do
 
-! 120112 mrp Doug's performance branch had:
-!         tend(k,iEdge) = tend(k,iEdge) - edgeMask(k,iEdge) * rho0Inv*(  pressure(k,cell2) - pressure(k,cell1) ) * invdcEdge
-       end do
+      end do
 
-      endif
 
 
    !--------------------------------------------------------------------
@@ -197,15 +186,14 @@
 
       err = 0
 
-      rho0Inv = 1.0/config_rho0
-      grho0Inv = gravity/config_rho0
+      if (config_vert_grid_type.eq.'isopycnal') then
+        rho0Inv = 1.0
+        grho0Inv = 0.0
+      else 
+        rho0Inv = 1.0/config_rho0
+        grho0Inv = gravity/config_rho0
+      end if
 
-! 120112 mrp Doug's performance branch had:
-!      if (config_vert_grid_type.eq.'isopycnal') then
-!        rho0Inv = 1.0
-!      elseif (config_vert_grid_type.eq.'zlevel') then
-!        rho0Inv = 1.0/config_rho0
-!      end if
 
 
    !--------------------------------------------------------------------

</font>
</pre>