<p><b>mhoffman@lanl.gov</b> 2012-06-14 16:45:19 -0600 (Thu, 14 Jun 2012)</p><p>BRANCH COMMIT -- land ice<br>
<br>
Added more verbose output for CFL violations.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_tendency.F
===================================================================
--- branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_tendency.F        2012-06-14 21:36:50 UTC (rev 1981)
+++ branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_tendency.F        2012-06-14 22:45:19 UTC (rev 1982)
@@ -67,7 +67,7 @@
 !
 !-----------------------------------------------------------------------
 
-   subroutine land_ice_tendency_h(mesh, state, layerThickness_tend, dt, dminfo, err)
+   subroutine land_ice_tendency_h(mesh, state, layerThickness_tend, dt, dminfo, allowableDt, err)
 
       !-----------------------------------------------------------------
       !
@@ -103,6 +103,7 @@
       !-----------------------------------------------------------------
 
       integer, intent(out) :: err !&lt; Output: error flag
+      real (kind=RKIND), intent(out) :: allowableDt
 
       !-----------------------------------------------------------------
       !
@@ -122,7 +123,7 @@
         !   state % layerThickness % array, state % thickness % array, thickness_tend, dt, err)
 
         call land_ice_tend_h_layers_fo_upwind(mesh, state % normalVelocity % array, &amp;
-             state % layerThickness % array, layerThickness_tend, dt, err)       
+             state % layerThickness % array, layerThickness_tend, dt, allowableDt, err)       
 
      !case ('FCT')  !===================================================
         ! MJH TEMP TRYING IT WITH THICKNESS
@@ -558,7 +559,7 @@
 !&gt;  results.  
 !
 !-----------------------------------------------------------------------
-   subroutine land_ice_tend_h_layers_fo_upwind(grid, normalVelocity, layerThickness, tend, dt, err)!{{{
+   subroutine land_ice_tend_h_layers_fo_upwind(grid, normalVelocity, layerThickness, tend, dt, MinOfMaxAllowableDt, err)!{{{
 
       !-----------------------------------------------------------------
       !
@@ -593,6 +594,7 @@
       !-----------------------------------------------------------------
 
       integer, intent(out) :: err !&lt; Output: error flag
+      real (kind=RKIND) :: MinOfMaxAllowableDt
 
       !-----------------------------------------------------------------
       !
@@ -604,7 +606,7 @@
 
       integer, dimension(:,:), pointer :: cellsOnEdge
 
-      real (kind=RKIND) :: flux, VelSign, maxAllowableDt, MinOfMaxAllowableDt
+      real (kind=RKIND) :: flux, VelSign, maxAllowableDt
       real (kind=RKIND), dimension(:), pointer :: dvEdge, areaCell, dcEdge
 
       err = 0
@@ -646,11 +648,11 @@
       end do
 
       if (err .gt. 0) then
-         write(0,*) 'CFL violation on ', err, ' level-edges!  Maximum time step (yrs) should be ', MinOfMaxAllowableDt
+         write(0,*) 'CFL violation on this processor on ', err, ' level-edges!  Maximum allowable time step (yrs) for this processor is ', MinOfMaxAllowableDt
          err = 1
       endif
 
-      print *, '  Maximum allowable time step (yrs) is ~', MinOfMaxAllowableDt
+      print *, '  Maximum allowable time step (yrs) on this processor is ~', MinOfMaxAllowableDt
 
    !--------------------------------------------------------------------
 

Modified: branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_time_integration_forwardeuler.F
===================================================================
--- branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_time_integration_forwardeuler.F        2012-06-14 21:36:50 UTC (rev 1981)
+++ branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_time_integration_forwardeuler.F        2012-06-14 22:45:19 UTC (rev 1982)
@@ -55,7 +55,9 @@
 
       integer :: nVertLevels, k, iEdge, iTracer
 
-      integer :: err
+      integer :: err, allowableDtProcNumber
+
+      real (kind=RKIND) :: allowableDt, allowableDtMin
       
 
 
@@ -66,6 +68,7 @@
       dminfo =&gt; domain % dminfo
       procVertexMaskChanged = 0
 
+
       block =&gt; domain % blocklist
       do while (associated(block))
 ! === Initialize pointers ========================
@@ -96,9 +99,6 @@
          tracer_tendency =&gt; block % tend % tracers % array
 
 
-         allocate(mask(mesh%nCells + 1))
-
-
 ! === Implicit column physics (vertical temperature diffusion) ===========
          !call ()
 
@@ -106,7 +106,7 @@
 ! === Calculate Tendencies ========================
          call mpas_timer_start(&quot;calculate tendencies&quot;)
          ! Calculate thickness tendency using state at time n =========
-         call land_ice_tendency_h(mesh, stateOld, layerThickness_tend, dt, dminfo, err)
+         call land_ice_tendency_h(mesh, stateOld, layerThickness_tend, dt, dminfo, allowableDt, err)
 
          ! update halos on thickness tend (perhaps move to land_ice_tendency_h after we've updated the halo update calls)
          call mpas_dmpar_exch_halo_field2d_real(dminfo, layerthickness_tend, &amp;
@@ -115,7 +115,27 @@
 
          !print *,'  Max abs thickness tend:', maxval(abs(thickness_tend(1:mesh % nCellsSolve)))
 
+         block =&gt; block % next
+      end do
 
+      ! Determine CFL limit on all procs
+      call mpas_dmpar_min_real(dminfo, allowableDt, allowableDtMin)
+      ! Determine which processor has the limiting CFL
+      if (allowableDt .eq. allowableDtMin) then
+        allowableDtProcNumber = dminfo % my_proc_id
+      else 
+        allowableDtProcNumber = -1
+      endif
+      call mpas_dmpar_max_int(dminfo, allowableDtProcNumber, allowableDtProcNumber)
+      write(6,*) '  Maximum allowable time step for all processors is:', allowableDtMin,  '  Time step is limited by processor number ', allowableDtProcNumber
+
+      if (err .gt. 0) then
+           write(0,*) 'Abort: Error in calculating thickness tendency (possibly CFL violation)'
+           call mpas_dmpar_abort(dminfo)
+      endif
+
+      block =&gt; domain % blocklist
+      do while (associated(block))
          ! Calculate tracer tendencies ==========
          ! There could be a negative layer thickness with SMB turned on!
          call land_ice_tendency_tracers(mesh, stateOld, layerThickness_tend, tracer_tendency, dt, dminfo, err)
@@ -134,10 +154,13 @@
                                             block % parinfo % cellsToSend, block % parinfo % cellsToRecv)
          end select
 
-        
-         call mpas_timer_stop(&quot;calculate tendencies&quot;)
+         block =&gt; block % next
+      end do 
+      call mpas_timer_stop(&quot;calculate tendencies&quot;)
    
 
+      block =&gt; domain % blocklist
+      do while (associated(block))
 ! === Compute new state for prognostic variables ==================================
 ! (once implicit column physics are added (i.e. temp diffusion), these calculations will need to be adjusted to apply to the new values as needed)
          call mpas_timer_start(&quot;calc. new prognostic vars&quot;)
@@ -155,6 +178,7 @@
          !print *, 'thickness_tend maxval:', maxval(thickness_tend(1:mesh % nCellsSolve))       
          !print *, 'thicknessOld maxval:', maxval(thicknessOld(1:mesh % nCellsSolve))
          print *, '  thicknessNew maxval:', maxval(thicknessNew(1:mesh % nCellsSolve))
+         allocate(mask(mesh%nCells + 1))
          mask = 0
 
          ! reset negative thickness to 0.  This should not happen unless negative MB is larger than entire ice column.
@@ -171,6 +195,7 @@
             mask = 1
          end where
          print *,'  Cells with nonzero thickness:', sum(mask)
+         deallocate(mask)
 
 
          ! Calculate new tracer values =================
@@ -217,8 +242,6 @@
          call mpas_timer_stop(&quot;calc. diagnostic vars except vel&quot;)
 
 
-         deallocate(mask)
-
          block =&gt; block % next
       end do
        

</font>
</pre>