<p><b>dwj07@fsu.edu</b> 2012-03-07 15:50:57 -0700 (Wed, 07 Mar 2012)</p><p><br>
        -- BRANCH COMMIT --<br>
<br>
        Adding flag to turn on and off check for monotonicity.<br>
<br>
        Also, fixing an issue with split_explicit with maxLevelCell = 0.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/monotonic_advection/src/core_ocean/Registry
===================================================================
--- branches/ocean_projects/monotonic_advection/src/core_ocean/Registry        2012-03-07 22:24:20 UTC (rev 1602)
+++ branches/ocean_projects/monotonic_advection/src/core_ocean/Registry        2012-03-07 22:50:57 UTC (rev 1603)
@@ -73,6 +73,7 @@
 namelist real      advection config_coef_3rd_order      1.0
 namelist logical   advection config_positive_definite   false
 namelist logical   advection config_monotonic           false
+namelist logical   advection config_check_monotonicity  false
 namelist logical   restore   config_restoreTS           false
 namelist real      restore   config_restoreT_timescale  90.0
 namelist real      restore   config_restoreS_timescale  90.0

Modified: branches/ocean_projects/monotonic_advection/src/core_ocean/mpas_ocn_time_integration_split.F
===================================================================
--- branches/ocean_projects/monotonic_advection/src/core_ocean/mpas_ocn_time_integration_split.F        2012-03-07 22:24:20 UTC (rev 1602)
+++ branches/ocean_projects/monotonic_advection/src/core_ocean/mpas_ocn_time_integration_split.F        2012-03-07 22:50:57 UTC (rev 1603)
@@ -432,7 +432,7 @@
       
                    sshEdge = 0.5 * (block % state % time_levs(oldBtrSubcycleTime) % state % sshSubcycle % array(cell1) &amp;
                              + block % state % time_levs(oldBtrSubcycleTime) % state % sshSubcycle % array(cell2) )
-                   hSum = sshEdge + block % mesh % referenceBottomDepth % array (block % mesh % maxLevelEdgeTop % array(iEdge))
+                   hSum = sshEdge + block % mesh % referenceBottomDepth % array (max(block % mesh % maxLevelEdgeTop % array(iEdge),1))
       
                    flux = ((1.0-config_btr_gam1_uWt1) * block % state % time_levs(oldBtrSubcycleTime) % state % uBtrSubcycle % array(iEdge) &amp;
                           + config_btr_gam1_uWt1 * block % state % time_levs(newBtrSubcycleTime) % state % uBtrSubcycle % array(iEdge)) &amp;

Modified: branches/ocean_projects/monotonic_advection/src/operators/mpas_tracer_advection_mono.F
===================================================================
--- branches/ocean_projects/monotonic_advection/src/operators/mpas_tracer_advection_mono.F        2012-03-07 22:24:20 UTC (rev 1602)
+++ branches/ocean_projects/monotonic_advection/src/operators/mpas_tracer_advection_mono.F        2012-03-07 22:50:57 UTC (rev 1603)
@@ -73,8 +73,9 @@
       num_tracers = size(tracers,dim=1)
 
       ! allocate nCells arrays
-      allocate(tracer_cur(nVertLevels, nCells))
+
       allocate(tracer_new(nVertLevels, nCells))
+      allocate(tracer_cur(nVertLevels, nCells))
       allocate(upwind_tendency(nVertLevels, nCells))
       allocate(inv_h_new(nVertLevels, nCells))
       allocate(tracer_max(nVertLevels, nCells))
@@ -104,10 +105,9 @@
             upwind_tendency(k, iCell) = 0.0
 
             !dwj 02/21/12 tracer_new is supposed to be the &quot;new&quot; tracer state. This allows bounds checks.
-            tracer_new(k,iCell) = 0.0
-
-!           tracer_min(k, iCell) = tracer_cur(k, iCell)
-!           tracer_max(k, iCell) = tracer_cur(k, iCell)
+            if (config_check_monotonicity) then
+              tracer_new(k,iCell) = 0.0
+            end if
           end do ! k loop
         end do ! iCell loop
 
@@ -279,38 +279,36 @@
           do k = 1,maxLevelCell(iCell)
             tend(iTracer, k, iCell) = tend(iTracer, k, iCell) + (high_order_vert_flux(k+1, iCell) - high_order_vert_flux(k, iCell)) + upwind_tendency(k,iCell)
 
-            !dwj 02/21/12 tracer_new holds a tendency for now.
-            tracer_new(k, iCell) = tracer_new(k, iCell) + (high_order_vert_flux(k+1, iCell) - high_order_vert_flux(k, iCell)) + upwind_tendency(k,iCell)
+            if (config_check_monotonicity) then
+              !dwj 02/21/12 tracer_new holds a tendency for now.
+              tracer_new(k, iCell) = tracer_new(k, iCell) + (high_order_vert_flux(k+1, iCell) - high_order_vert_flux(k, iCell)) + upwind_tendency(k,iCell)
 
-            !dwj 02/21/12 now, updated tracer_new to be the new state of the tracer.
-            tracer_new(k, iCell) = (tracer_cur(k, iCell)*h(k, iCell) + dt * tracer_new(k, iCell)) * inv_h_new(k, iCell)
+              !dwj 02/21/12 now, updated tracer_new to be the new state of the tracer.
+              tracer_new(k, iCell) = (tracer_cur(k, iCell)*h(k, iCell) + dt * tracer_new(k, iCell)) * inv_h_new(k, iCell)
+            end if
           end do ! k loop
         end do ! iCell loop
 
-        !dwj 02/21/12 build min and max of cur and new tracer states to check bounds
-        cur_min = minval(tracer_cur(:,1:nCellsSolve))
-        cur_max = maxval(tracer_cur(:,1:nCellsSolve))
-        new_min = minval(tracer_new(:,1:nCellsSolve))
-        new_max = maxval(tracer_new(:,1:nCellsSolve))
+        if (config_check_monotonicity) then
+          !dwj 02/21/12 build min and max of cur and new tracer states to check bounds
+          cur_min = minval(tracer_cur(:,1:nCellsSolve))
+          cur_max = maxval(tracer_cur(:,1:nCellsSolve))
+          new_min = minval(tracer_new(:,1:nCellsSolve))
+          new_max = maxval(tracer_new(:,1:nCellsSolve))
 
-        !dwj 02/21/12 do bounds check
-!       if(new_min &lt; cur_min-eps) then
-!           write(*,*) 'Minimum out of bounds on tracer ', iTracer, cur_min, new_min
-!       end if
+          !dwj 02/21/12 do bounds check
+          if(new_min &lt; cur_min-eps) then
+              write(*,*) 'Minimum out of bounds on tracer ', iTracer, cur_min, new_min
+          end if
 
-!       if(new_max &gt; cur_max+eps) then
-!           write(*,*) 'Maximum out of bounds on tracer ', iTracer, cur_max, new_max
-!       end if
-
-!       do iCell = 1, grid%nCells
-!         do k=1, grid%maxLevelCell(iCell)
-!           tracer_next_in(iTracer,k,iCell) = max(0.,tracer_next(k,iCell))
-!         end do ! k loop
-!       end do ! iCell loop
+          if(new_max &gt; cur_max+eps) then
+              write(*,*) 'Maximum out of bounds on tracer ', iTracer, cur_max, new_max
+          end if
+        end if
       end do ! iTracer loop
 
-      deallocate(tracer_cur)
       deallocate(tracer_new)
+      deallocate(tracer_cur)
       deallocate(upwind_tendency)
       deallocate(inv_h_new)
       deallocate(tracer_max)

</font>
</pre>