<p><b>mpetersen@lanl.gov</b> 2012-10-15 15:54:54 -0600 (Mon, 15 Oct 2012)</p><p>branch commit, partial_bottom_cells: Change initial condition interpolation to be for all tracers, not just T&amp;S.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/partial_bottom_cells/src/core_ocean/mpas_ocn_mpas_core.F
===================================================================
--- branches/ocean_projects/partial_bottom_cells/src/core_ocean/mpas_ocn_mpas_core.F        2012-10-15 21:26:39 UTC (rev 2212)
+++ branches/ocean_projects/partial_bottom_cells/src/core_ocean/mpas_ocn_mpas_core.F        2012-10-15 21:54:54 UTC (rev 2213)
@@ -541,10 +541,10 @@
 
       type (domain_type), intent(inout) :: domain
 
-      integer :: i, iCell, iEdge, iVertex, k, nCells
+      integer :: i, iCell, iEdge, iVertex, k, nCells, num_tracers
       type (block_type), pointer :: block
 
-      integer :: iTracer, cell, cell1, cell2, indexT, indexS
+      integer :: iTracer, cell, cell1, cell2
       real (kind=RKIND) :: uhSum, hSum, hEdge1, zMidPBC
 
       integer, dimension(:), pointer :: maxLevelCell
@@ -571,6 +571,7 @@
 
          nCells      = block % mesh % nCells
          nVertLevels = block % mesh % nVertLevels
+         num_tracers = size(tracers, dim=1)
 
          ! mrp 120208 right now hZLevel is in the grid.nc file.
          ! We would like to transition to using refBottomDepth
@@ -623,13 +624,10 @@
 
          if (config_alter_ICs_for_pbc.and..not.config_do_restart) then
             write (0,'(a)') ' Altering bottomDepth to avoid very thin cells.'
-            write (0,'(a)') ' Altering h, temperature, and salinity initial conditions to conform with partial bottom cells.'
+            write (0,'(a)') ' Altering h and tracer initial conditions to conform with partial bottom cells.'
 
             allocate(minBottomDepth(nVertLevels),minBottomDepthMid(nVertLevels),zMidZLevel(nVertLevels))
 
-            indexT = block % state % time_levs(1) % state % index_temperature
-            indexS = block % state % time_levs(1) % state % index_salinity
-
             ! min_pbc_fraction restricts pbcs from being too small.
             ! A typical value is 10%, so pbcs must occupy at least 10% of the cell thickness.
             ! If min_pbc_fraction = 0.0, bottomDepth gives the actual depth for that cell.
@@ -664,15 +662,14 @@
 
                ! Linearly interpolate the initial T&amp;S for new location of bottom cell for PBCs
                zMidPBC = -0.5*(bottomDepth(iCell) + refBottomDepthTopOfCell(k))
-               tracers(indexT,k,iCell) = tracers(indexT,k,iCell) &amp;
-                  + (tracers(indexT,k-1,iCell) - tracers(indexT,k,iCell)) &amp;
-                   /(zMidZLevel(k-1)-zMidZLevel(k)) &amp;
-                   *(zMidPBC - zMidZLevel(k))
-               tracers(indexS,k,iCell) = tracers(indexS,k,iCell) &amp;
-                  + (tracers(indexS,k-1,iCell) - tracers(indexS,k,iCell)) &amp;
-                   /(zMidZLevel(k-1)-zMidZLevel(k)) &amp;
-                   *(zMidPBC - zMidZLevel(k))
 
+               do iTracer=1,num_tracers
+                  tracers(iTracer,k,iCell) = tracers(iTracer,k,iCell) &amp;
+                     + (tracers(iTracer,k-1,iCell) - tracers(iTracer,k,iCell)) &amp;
+                      /(zMidZLevel(k-1)-zMidZLevel(k)) &amp;
+                      *(zMidPBC - zMidZLevel(k))
+               enddo
+
             enddo  
 
             deallocate(minBottomDepth,zMidZLevel)

</font>
</pre>