<p><b>mhoffman@lanl.gov</b> 2012-06-25 17:43:39 -0600 (Mon, 25 Jun 2012)</p><p>BRANCH COMMIT -- land ice<br>
Created namelist option that prevents advance beyond the initial ice extent.  Ice can retreat and re-advance but any ice that advances beyond the initial extent is removed from the domain (similar to being ablated away).<br>
</p><hr noshade><pre><font color="gray">Modified: branches/land_ice_projects/implement_core/src/core_land_ice/Makefile
===================================================================
--- branches/land_ice_projects/implement_core/src/core_land_ice/Makefile        2012-06-22 16:02:33 UTC (rev 2001)
+++ branches/land_ice_projects/implement_core/src/core_land_ice/Makefile        2012-06-25 23:43:39 UTC (rev 2002)
@@ -55,7 +55,7 @@
 
 mpas_land_ice_global_diagnostics.o:
 
-mpas_land_ice_mpas_core.o: mpas_land_ice_global_diagnostics.o mpas_land_ice_time_integration.o mpas_ocn_advection.o mpas_land_ice_annual_forcing.o
+mpas_land_ice_mpas_core.o: mpas_land_ice_global_diagnostics.o mpas_land_ice_time_integration.o mpas_ocn_advection.o mpas_land_ice_annual_forcing.o mpas_land_ice_mask.o
 
 
 # modules needed for FCT tracer advection from ocean core (eventually to be in operators?)

Modified: branches/land_ice_projects/implement_core/src/core_land_ice/Registry
===================================================================
--- branches/land_ice_projects/implement_core/src/core_land_ice/Registry        2012-06-22 16:02:33 UTC (rev 2001)
+++ branches/land_ice_projects/implement_core/src/core_land_ice/Registry        2012-06-25 23:43:39 UTC (rev 2002)
@@ -29,6 +29,7 @@
 % Define the ice thickness below which dynamics are not calculated.
 namelist character   land_ice_model  config_forcing_frequency     Static
 % Valid options are Static, Annual
+namelist logical     land_ice_model  config_allow_additional_advance       true
 
 % The following options are used by the ocean core and may be useful in the future
 %namelist logical     land_ice_model  config_h_ScaleWithMesh       false

Modified: branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_mask.F
===================================================================
--- branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_mask.F        2012-06-22 16:02:33 UTC (rev 2001)
+++ branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_mask.F        2012-06-25 23:43:39 UTC (rev 2002)
@@ -35,7 +35,7 @@
    ! Public member functions
    !
    !--------------------------------------------------------------------
-   public :: land_ice_calculate_mask
+   public :: land_ice_calculate_mask, land_ice_calculate_mask_init
 
    !--------------------------------------------------------------------
    !
@@ -49,8 +49,81 @@
 
 contains
 
+
+
 !***********************************************************************
 !
+!  routine land_ice_calculate_mask_init
+!
+!&gt; \brief   Calculates masks for land ice for info needed from initial condition only
+!&gt; \author  Matt Hoffman
+!&gt; \date    25 June 2012
+!&gt; \version SVN:$Id$
+!&gt; \details
+!&gt;  This routine Calculates masks for land ice for info needed from initial condition only.
+!
+!-----------------------------------------------------------------------
+
+   subroutine land_ice_calculate_mask_init(mesh, state, err)
+
+      !-----------------------------------------------------------------
+      !
+      ! input variables
+      !
+      !-----------------------------------------------------------------
+
+      type (mesh_type), intent(in) :: &amp;
+         mesh          !&lt; Input: mesh information
+
+      !-----------------------------------------------------------------
+      !
+      ! input/output variables
+      !
+      !-----------------------------------------------------------------
+
+      type (state_type), intent(inout) :: &amp;
+         state          !&lt; Input: state information 
+
+      !-----------------------------------------------------------------
+      !
+      ! output variables
+      !
+      !-----------------------------------------------------------------
+
+      integer, intent(out) :: err !&lt; Output: error flag
+
+      !-----------------------------------------------------------------
+      !
+      ! local variables
+      !
+      !-----------------------------------------------------------------
+      integer, dimension(:), pointer :: cellMask
+      real(KIND=RKIND), dimension(:), pointer :: thickness
+
+      ! Assign pointers and variables
+      cellMask =&gt; state % cellMask % array
+      thickness =&gt; state % thickness % array
+
+      cellMask = 0
+
+      if (config_allow_additional_advance .eqv. .false.) then
+
+              ! Bit 8: Identify points without ice initially
+              where (thickness == 0.0)
+                  cellMask = MASK_VALUE_INITIALLY_NOT_ICE
+              end where
+
+      endif
+
+
+   !--------------------------------------------------------------------
+
+   end subroutine land_ice_calculate_mask_init
+
+
+
+!***********************************************************************
+!
 !  routine land_ice_calculate_mask
 !
 !&gt; \brief   Calculates masks for land ice
@@ -134,7 +207,11 @@
 
 
       ! Calculate cellMask values===========================
-      cellMask = 0
+      !cellMask = 0
+      ! Set mask to 0 everywhere, but preserve bits that shouldn't change
+      do i=1, nCells
+        cellMask(i) = MACRO_LOG_TO_INT(MASK_WAS_INITIALLY_NOT_ICE(cellMask(i))) * MASK_VALUE_INITIALLY_NOT_ICE
+      enddo
       
       ! Bit 0: Identify points with ice
       where (thickness &gt; 0)

Modified: branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_mask.inc
===================================================================
--- branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_mask.inc        2012-06-22 16:02:33 UTC (rev 2001)
+++ branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_mask.inc        2012-06-25 23:43:39 UTC (rev 2002)
@@ -37,6 +37,8 @@
  #define GLIDE_MASK_COMP_DOMAIN_BND 128 
 */
 
+/* Bit 8: Identifies a mask that indicates the initial extent of the ice */
+#define MASK_VALUE_INITIALLY_NOT_ICE             256
 
 
 
@@ -76,6 +78,8 @@
 /*Checks whether this is an ice margin (first cell on glacier side from non-ice cell)*/
 #define MASK_IS_MARGIN(mask)         (iand(mask, MASK_VALUE_MARGIN) == MASK_VALUE_MARGIN)
 
+/*Checks whether this location was initially icefree */
+#define MASK_WAS_INITIALLY_NOT_ICE(mask)         (iand(mask, MASK_VALUE_INITIALLY_NOT_ICE) == MASK_VALUE_INITIALLY_NOT_ICE)
 
 
 

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-06-22 16:02:33 UTC (rev 2001)
+++ branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_mpas_core.F        2012-06-25 23:43:39 UTC (rev 2002)
@@ -155,6 +155,7 @@
       use mpas_vector_reconstruction
       use land_ice_vel
       use land_ice_tendency, only: land_ice_diagnostic_solve
+      use land_ice_mask
       use mpas_ocn_tracer_advection
       use ocn_advection
       use land_ice_annual_forcing
@@ -202,6 +203,7 @@
 
       ! Initialize state ==== 
       call mpas_timer_start(&quot;initial state calculation&quot;)
+      call land_ice_calculate_mask_init(mesh, state, err)
       call land_ice_diagnostic_solve(mesh, state, err)
       ! Set the initial flag to 1 so LifeV will calculate its mesh information the first time
       state % anyVertexMaskChanged % scalar = 1

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-22 16:02:33 UTC (rev 2001)
+++ branches/land_ice_projects/implement_core/src/core_land_ice/mpas_land_ice_time_integration_forwardeuler.F        2012-06-25 23:43:39 UTC (rev 2002)
@@ -11,6 +11,7 @@
 !
 !-----------------------------------------------------------------------
 
+#include &quot;mpas_land_ice_mask.inc&quot;
 
 module land_ice_time_integration_forwardeuler
 
@@ -48,6 +49,7 @@
       real (kind=RKIND), dimension(:), pointer :: thicknessOld, thicknessNew, layerThicknessFractions
       real (kind=RKIND), dimension(:,:), pointer :: normalVelocityOld, normalVelocityNew, layerThicknessOld, layerThicknessNew, layerThickness_tend
       real (kind=RKIND), dimension(:,:,:), pointer :: tracer_tendency, tracersNew, tracersOld
+      integer, dimension(:), pointer :: cellMaskOld
 
       integer, dimension(:), allocatable :: mask
 
@@ -86,6 +88,7 @@
          layerThicknessOld =&gt; stateOld % layerThickness % array
          normalVelocityOld =&gt; stateOld % normalVelocity % array
          tracersOld =&gt; stateOld % tracers % array
+         cellMaskOld =&gt; stateOld % cellMask % array
 
          ! State at time n+1 (advanced by dt by Forward Euler)
          stateNew =&gt; block % state % time_levs(2) % state
@@ -181,6 +184,13 @@
          allocate(mask(mesh%nCells + 1))
          mask = 0
 
+         ! if holding advance within initial extent of ice, set thickness to 0 anywhere it has expanded beyond initial extent
+         if (config_allow_additional_advance .eqv. .false.) then 
+             where ( MASK_WAS_INITIALLY_NOT_ICE(cellMaskOld) )
+                 thicknessNew = 0.0
+             end where
+         endif
+
          ! reset negative thickness to 0.  This should not happen unless negative MB is larger than entire ice column.
          where (thicknessNew .lt. 0.0)
             mask = 1

</font>
</pre>