<p><b>mpetersen@lanl.gov</b> 2011-02-09 15:20:51 -0700 (Wed, 09 Feb 2011)</p><p>BRANCH COMMIT: Changed tracerTop values at top and bottom to be nearest neighbor rather than zero.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/vert_adv_mrp/src/core_ocean/module_time_integration.F
===================================================================
--- branches/ocean_projects/vert_adv_mrp/src/core_ocean/module_time_integration.F        2011-02-09 17:06:39 UTC (rev 734)
+++ branches/ocean_projects/vert_adv_mrp/src/core_ocean/module_time_integration.F        2011-02-09 22:20:51 UTC (rev 735)
@@ -897,19 +897,17 @@
 
       allocate(tracerTop(num_tracers,nVertLevels+1,nCells))
 
-!TDR: shouldn't we put tracer(:,1,:) into tracerTop(:,1,:)?
-!TDR: and put tracer(:,maxLevelCell(iCell),:) into tracerTop(:,maxLevelCell(iCell)+1,:)?
-!TDR: regardless of what we put, these layer interfaces should be no flux because w==0
-!TDR: still, this is a valid approximation at those interfaces and better than
-!TDR: what will be grabbed from uninitialized memory.
+      ! Tracers at the top and bottom boundary are assigned nearest 
+      ! cell-centered value, regardless of tracer interpolation method.
+      ! wTop=0 at top and bottom sets the boundary condition.
+      do iCell=1,nCellsSolve 
+         do iTracer=1,num_tracers
+            tracerTop(iTracer,1,iCell) = tracers(iTracer,1,iCell)
+            tracerTop(iTracer,maxLevelCell(iCell)+1,iCell) = &amp;
+               tracers(iTracer,maxLevelCell(iCell),iCell)
+         end do
+      end do
 
-!mrp: I initialize tracerTop at the top and bottom as:
-!mrp:         tracerTop(:,1,iCell)=0.0
-!mrp:         tracerTop(:,maxLevelCell(iCell)+1,iCell)=0.0
-!mrp: after the following if statement, because there should be no contribution
-!mrp: from those layers.  As you say, w should be aero anyway.
-
-
       if (config_vert_tracer_adv.eq.'stencil'.and. &amp;
           config_vert_tracer_adv_order.eq.2) then
 
@@ -1059,11 +1057,15 @@
       endif ! vertical tracer advection method
 
       do iCell=1,nCellsSolve 
-         tracerTop(:,1,iCell)=0.0
-         tracerTop(:,maxLevelCell(iCell)+1,iCell)=0.0
-         do k=1,maxLevelCell(iCell)  
+         ! For top layer, contribution is from bottom only.
+         k=1
             do iTracer=1,num_tracers
                tend_tr(iTracer,k,iCell) = tend_tr(iTracer,k,iCell) &amp;
+                      + wTop(k+1,iCell)*tracerTop(iTracer,k+1,iCell)
+            end do
+         do k=2,maxLevelCell(iCell)  
+            do iTracer=1,num_tracers
+               tend_tr(iTracer,k,iCell) = tend_tr(iTracer,k,iCell) &amp;
                   - (   wTop(k  ,iCell)*tracerTop(iTracer,k  ,iCell) &amp;
                       - wTop(k+1,iCell)*tracerTop(iTracer,k+1,iCell))
             end do

</font>
</pre>