<p><b>mhoffman@lanl.gov</b> 2013-02-06 13:22:23 -0700 (Wed, 06 Feb 2013)</p><p>BRANCH COMMIT - land ice<br>
<br>
Adding a global diagnostic for ice energy.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_global_diagnostics.F
===================================================================
--- branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_global_diagnostics.F        2013-02-06 18:43:40 UTC (rev 2447)
+++ branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_global_diagnostics.F        2013-02-06 20:22:23 UTC (rev 2448)
@@ -55,7 +55,7 @@
       real (kind=RKIND), dimension(:), pointer ::  areaCell, dcEdge, dvEdge, areaTriangle
 !!!      real (kind=RKIND), dimension(:), pointer ::  h_s, fCell, fEdge
 !!!      real (kind=RKIND), dimension(:,:), pointer :: h, u, v, layerThicknessEdge, &amp;
-      real (kind=RKIND), dimension(:,:), pointer :: layerThickness, normalVelocity, &amp;
+      real (kind=RKIND), dimension(:,:), pointer :: layerThickness, normalVelocity, temperature, &amp;
 !!!                                                    pv_edge, pv_vertex, pv_cell,  &amp;
                                                     layerThicknessVertex, weightsOnEdge
       integer, dimension(:), pointer :: cellMask
@@ -66,13 +66,13 @@
 !!!      real (kind=RKIND), dimension(:), allocatable :: h_s_edge
 
       real (kind=RKIND), dimension(:), allocatable :: iceArea
-      real (kind=RKIND), dimension(:,:), allocatable :: cellVolume, cellArea, volumeWeightedPotentialVorticity
+      real (kind=RKIND), dimension(:,:), allocatable :: cellVolume, cellEnergy, cellArea, volumeWeightedPotentialVorticity
       real (kind=RKIND), dimension(:,:), allocatable :: volumeWeightedPotentialEnstrophy, vertexVolume, volumeWeightedKineticEnergy 
       real (kind=RKIND), dimension(:,:), allocatable :: volumeWeightedPotentialEnergy, volumeWeightedPotentialEnergyTopography 
       real (kind=RKIND), dimension(:,:), allocatable :: keTend_CoriolisForce, keTend_PressureGradient 
       real (kind=RKIND), dimension(:,:), allocatable ::peTend_DivThickness, refAreaWeightedSurfaceHeight, refAreaWeightedSurfaceHeight_edge
 
-      real (kind=RKIND) :: sumCellVolume, sumIceAreaLocal, sumIceArea, sumCellArea, sumVertexVolume, sumrefAreaWeightedSurfaceHeight
+      real (kind=RKIND) :: sumCellVolume, sumCellEnergy, sumIceAreaLocal, sumIceArea, sumCellArea, sumVertexVolume, sumrefAreaWeightedSurfaceHeight
 
       real (kind=RKIND) :: globalIceThickness, globalIceMass
       !real (kind=RKIND) :: globalFluidThickness, globalPotentialVorticity, globalPotentialEnstrophy, globalEnergy 
@@ -115,6 +115,9 @@
       cellMask =&gt; state % cellMask % array
       layerThickness =&gt; state % layerThickness % array
       normalVelocity =&gt; state % normalVelocity % array
+      temperature =&gt; state % tracers % array(state % index_temperature, :, :)
+
+
 !!!      v =&gt; state % v % array
       tracers =&gt; state % tracers % array
 !      layerThicknessEdge =&gt; state % layerThicknessEdge % array
@@ -126,6 +129,7 @@
       ! Step 2
       ! 2. Allocate the array with the correct dimensions.
       allocate(cellVolume(nVertLevels,nCellsSolve))
+      allocate(cellEnergy(nVertLevels,nCellsSolve))
       allocate(iceArea(nCells+1))
       allocate(cellArea(nVertLevels,nCellsSolve))
       !allocate(refAreaWeightedSurfaceHeight(nVertLevels,nCellsSolve))
@@ -175,9 +179,16 @@
         iceArea = 0.0_RKIND
       end where
 
+
+
       do iLevel = 1,nVertLevels
         ! eg. GlobalFluidThickness top (Sum( h dA)) = Sum(cellVolume)
         cellVolume(iLevel,:) = layerThickness(iLevel,1:nCellsSolve)*areaCell(1:nCellsSolve)
+
+        ! This is cell energy relative to 0 deg C
+        cellEnergy(iLevel,:) = temperature(iLevel,1:nCellsSolve) * layerThickness(iLevel,1:nCellsSolve) * areaCell(1:nCellsSolve)
+       
+
         ! eg. GlobalFluidThickness bot (Sum(dA)) = Sum(cellArea)
         !cellArea(iLevel,:) = areaCell(1:nCellsSolve)
 !!!        volumeWeightedPotentialVorticity(iLevel,:) = pv_vertex(iLevel,1:nVerticesSolve) &amp;
@@ -232,6 +243,9 @@
 
       ! Computing top and bottom of global mass integral
       call land_ice_compute_global_sum(dminfo, nVertLevels, nCellsSolve, cellVolume, sumCellVolume)
+
+      call land_ice_compute_global_sum(dminfo, nVertLevels, nCellsSolve, cellEnergy, sumCellEnergy)
+
       sumIceAreaLocal = sum(iceArea(1:nCellsSolve))
       call mpas_dmpar_sum_real(dminfo, sumIceAreaLocal, sumIceArea)  ! Compute global sum
 
@@ -306,7 +320,7 @@
 
          ! Get the precision being used so we don't write more digits than are meaningful
          write(realPrecisionStr,*) PRECISION(sumCellVolume)-1
-         write(fileID,'(1i0, 100es24.'// ADJUSTL(realPrecisionStr) // ')') timeIndex, timeIndex*dt, sumIceArea, sumCellVolume
+         write(fileID,'(1i0, 100es24.'// ADJUSTL(realPrecisionStr) // ')') timeIndex, timeIndex*dt, sumIceArea, sumCellVolume, sumCellEnergy
          close(fileID)
       end if
 

</font>
</pre>