Index: /issm/trunk/src/m/model/geography.m
===================================================================
--- /issm/trunk/src/m/model/geography.m	(revision 7082)
+++ /issm/trunk/src/m/model/geography.m	(revision 7083)
@@ -41,6 +41,7 @@
 elementoniceshelf=double((elementoniceshelf & ~elementonicesheet));
 elementonicesheet=double(~elementoniceshelf);
+%the order here is important. we choose gridoniceshelf as default on the grounding line.
+gridonicesheet(md.elements(find(elementonicesheet),:))=1;
 gridoniceshelf(md.elements(find(elementoniceshelf),:))=1;
-gridonicesheet(md.elements(find(elementonicesheet),:))=1;
 
 %Return: 
Index: /issm/trunk/src/m/model/ismodelselfconsistent.m
===================================================================
--- /issm/trunk/src/m/model/ismodelselfconsistent.m	(revision 7082)
+++ /issm/trunk/src/m/model/ismodelselfconsistent.m	(revision 7083)
@@ -152,4 +152,8 @@
 	error(['model not consistent: model ' md.name ' violates the equality thickness=surface-bed!']);
 end
+if md.gl_migration & isnan(md.bathymetry),
+	error(['model not consistent: model ' md.name ' requesting grounding line migration, buth bathymetry is absent!']);
+end
+
 %}}}
 %RIFTS{{{1
Index: /issm/trunk/src/m/model/marshall.m
===================================================================
--- /issm/trunk/src/m/model/marshall.m	(revision 7082)
+++ /issm/trunk/src/m/model/marshall.m	(revision 7083)
@@ -31,4 +31,5 @@
 WriteData(fid,md.z,'Mat','z');
 WriteData(fid,md.elements,'Mat','elements');
+WriteData(fid,md.elementconnectivity,'Mat','elementconnectivity');
 WriteData(fid,md.elements_type,'Mat','elements_type');
 WriteData(fid,md.vertices_type,'Mat','vertices_type');
@@ -161,4 +162,10 @@
 WriteData(fid,md.isstokes,'Integer','isstokes');
 
+%grounding line migration: 
+WriteData(fid,md.gl_migration,'Integer','grounding_line_migration');
+if(md.gl_migration),
+	WriteData(fid,md.bathymetry,'Mat','bathymetry');
+end
+
 %Rifts
 WriteData(fid,md.riftinfo,'Mat','riftinfo');
Index: /issm/trunk/src/m/model/tres.m
===================================================================
--- /issm/trunk/src/m/model/tres.m	(revision 7082)
+++ /issm/trunk/src/m/model/tres.m	(revision 7083)
@@ -61,4 +61,7 @@
 			results2(count).time=md.results.Transient2DSolution(i).time;
 			results2(count).step=md.results.Transient2DSolution(i).step;
+			if md.gl_migration,
+				results2(count).ElementOnIceShelf=PatchToVec(md.results.Transient2DSolution(i).ElementOnIceShelf);
+			end
 			count=count+1;
 		end
