<p><b>mhoffman@lanl.gov</b> 2012-04-30 11:32:38 -0600 (Mon, 30 Apr 2012)</p><p>BRANCH COMMIT<br>
<br>
Modifed the vertexMaskChanged flag that is needed for calling LifeV to determine if the vertex mask has changed on ANY processor (as opposed to just local processor).  It was written to work per block, even though LifeV does not support blocks.<br>
Also, fixed a few bugs in subroutine land_ice_setup_vertical_coords.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/land_ice_projects/implement_core/src/core_land_ice/Registry
===================================================================
--- branches/land_ice_projects/implement_core/src/core_land_ice/Registry        2012-04-30 17:15:40 UTC (rev 1840)
+++ branches/land_ice_projects/implement_core/src/core_land_ice/Registry        2012-04-30 17:32:38 UTC (rev 1841)
@@ -164,7 +164,7 @@
 var persistent integer vertexMask ( nVertices Time ) 2 o vertexMask state - -
 % Needed for LifeV solver to know if the region to solve on the block's domain has changed (treated as a logical):
 % THIS SHOULD BE CHANGED TO INTEGER TYPE ONCE THE TRUNK IS MERGED TO THIS BRANCH AND field0dinteger IS DEFINED IN framework/mpas_grid_types.F
-var persistent real vertexMaskChanged ( ) 2 - vertexMaskChanged state - -
+var persistent real anyVertexMaskChanged ( ) 2 - anyVertexMaskChanged state - -
 
 
 

Modified: branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_lifev.F
===================================================================
--- branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_lifev.F        2012-04-30 17:15:40 UTC (rev 1840)
+++ branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_lifev.F        2012-04-30 17:32:38 UTC (rev 1841)
@@ -322,8 +322,7 @@
       integer, dimension(:), pointer :: vertexMask
 
       integer :: index_temperature
-      real (kind=RKIND) :: vertexMaskChanged  ! THIS TYPE NEEDS TO BE CHANGE TO INTEGER ONCE REGISTRY IS UPDATED
-      
+      real (kind=RKIND) :: anyVertexMaskChanged  ! THIS TYPE NEEDS TO BE CHANGE TO INTEGER ONCE REGISTRY IS UPDATED
 
       err = 0
       
@@ -339,12 +338,12 @@
       tracers =&gt; state % tracers % array
       index_temperature = state % index_temperature
       vertexMask =&gt; state % vertexMask % array
-      vertexMaskChanged = state % vertexMaskChanged % scalar
+      anyVertexMaskChanged = state % anyVertexMaskChanged % scalar
 
 
 #ifdef USE_LIFEV
       ! LifeV calls to be made only when vertex mask changes
-      if (vertexMaskChanged .eq. 1) then
+      if (anyVertexMaskChanged .eq. 1) then
           call velocity_solver_compute_2d_grid(vertexMask)
 
           select case (config_dycore)

Modified: branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_mpas_core.F
===================================================================
--- branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_mpas_core.F        2012-04-30 17:15:40 UTC (rev 1840)
+++ branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_mpas_core.F        2012-04-30 17:32:38 UTC (rev 1841)
@@ -173,7 +173,7 @@
       ! Initialize state ==== 
       call lice_diagnostic_solve(mesh, state, err)
       ! Set the initial flag to 1 so LifeV will calculate its mesh information the first time
-      state % vertexMaskChanged % scalar = 1
+      state % anyVertexMaskChanged % scalar = 1
 
       ! Calculate an initial (diagnostic) velocity field consistent with the initial thickness field 
       ! \todo: skip this step if a velocity field was supplied in the I.C. input file
@@ -475,12 +475,13 @@
       integer :: nVertLevels, k
       real (kind=RKIND), dimension(:), pointer :: layerThicknessFractions, layerCenterSigma, layerInterfaceSigma
 
+      nVertLevels = mesh % nVertLevels
       ! layerThicknessFractions is provided by input
-      layerThicknessFractions = mesh % layerThicknessFractions % array
+      layerThicknessFractions =&gt; mesh % layerThicknessFractions % array
       ! layerCenterSigma is the fractional vertical position (0-1) of each layer center, with 0.0 at the ice surface and 1.0 at the ice bed
-      layerCenterSigma = mesh % layerCenterSigma % array
+      layerCenterSigma =&gt; mesh % layerCenterSigma % array
       ! layerInterfaceSigma is the fractional vertical position (0-1) of each layer interface, with 0.0 at the ice surface and 1.0 at the ice bed.  Interface 1 is the surface, interface 2 is between layers 1 and 2, etc., and interface nVertLevels+1 is the bed.
-      layerInterfaceSigma = mesh % layerInterfaceSigma % array
+      layerInterfaceSigma =&gt; mesh % layerInterfaceSigma % array
 
       layerCenterSigma(1) = 0.5 * layerThicknessFractions(1)
       layerInterfaceSigma(1) = 0.0

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-04-30 17:15:40 UTC (rev 1840)
+++ branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_time_integration_forwardeuler.F        2012-04-30 17:32:38 UTC (rev 1841)
@@ -39,6 +39,7 @@
       type (domain_type), intent(inout) :: domain
       real (kind=RKIND), intent(in) :: dt
 
+      type (dm_info), pointer :: dminfo
       type (block_type), pointer :: block
       type (state_type), pointer :: stateOld, stateNew
       type (mesh_type), pointer :: mesh
@@ -50,6 +51,8 @@
 
       integer, dimension(:), allocatable :: mask
 
+      integer :: blockVertexMaskChanged, procVertexMaskChanged, anyVertexMaskChanged
+
       integer :: nVertLevels, k
 
       integer :: err
@@ -58,6 +61,9 @@
       !   time step, and time level 2 stores the state advanced dt in time by timestep(...)
       ! (time level 1 should not be modified.)
 
+      dminfo =&gt; domain % dminfo
+      procVertexMaskChanged = 0
+
       block =&gt; domain % blocklist
       do while (associated(block))
 ! === Initialize pointers ========================
@@ -138,15 +144,31 @@
 ! === Calculate diagnostic variables for new state =====================
 
          call lice_diagnostic_solve(mesh, stateNew, err)  ! perhaps velocity solve should move in here.
-         ! Determine if the vertex mask changed during this time step (needed for LifeV)
+
+         ! Determine if the vertex mask changed during this time step for this block (needed for LifeV)
          if ( sum(stateNew % vertexMask % array - stateOld % vertexMask % array) .ne. 0 ) then
-             stateNew % vertexMaskChanged % scalar = 1
+             blockVertexMaskChanged = 1
          else
-             stateNew % vertexMaskChanged % scalar = 0
+             blockVertexMaskChanged = 0
          endif
-         !print *, 'old flag ', stateOld % vertexMaskChanged % scalar
-         !print *, 'new flag ', stateNew % vertexMaskChanged % scalar
+         print *, 'blockVertexMaskChanged ', blockVertexMaskChanged
 
+         ! Determine if any blocks on this processor had a change to the vertex mask
+         procVertexMaskChanged = max(procVertexMaskChanged, blockVertexMaskChanged)
+
+         block =&gt; block % next
+      end do
+       
+      ! Determine if the vertex mask has changed on any processor (need to exit the block loop to do so)
+      call mpas_dmpar_max_int(dminfo, procVertexMaskChanged, anyVertexMaskChanged)
+
+      block =&gt; domain % blocklist
+      do while (associated(block))
+
+         ! Assign the vertex-changed flag to each block
+         stateNew % anyVertexMaskChanged % scalar = anyVertexMaskChanged
+         print *, 'anyVertexMaskChanged: ', anyVertexMaskChanged
+
          ! Compute the diagnostic velocity for this time step using the updated (new) state
          ! Pass in the old velocity to be used as an initial guess for velocity solvers that need one.
          normalVelocityNew = normalVelocityOld 
@@ -154,6 +176,8 @@
          ! update halos on velocity
          ! call ()
 
+         block =&gt; block % next
+      end do
 
 
 ! === Cleanup &amp; Misc. =============================
@@ -161,8 +185,6 @@
 
 ! ================================
 
-         block =&gt; block % next
-      end do
 
       deallocate(mask)
 

</font>
</pre>