Index: /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
===================================================================
--- /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 10399)
+++ /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 10400)
@@ -34,5 +34,5 @@
 
 		/*propagate ice shelf into connex areas of the ice sheet that potentially want to unground: */
-		vertices_ungrounding=PropagateFloatingiceToGrounded(elements,nodes,vertices,parameters,vertices_potentially_ungrounding);
+		vertices_ungrounding=PropagateFloatingiceToGroundedNeighbors(elements,nodes,vertices,parameters,vertices_potentially_ungrounding);
 	}
 
@@ -110,6 +110,6 @@
 }
 /*}}}*/
-/*FUNCTION PropagateFloatingiceToGrounded {{{1*/
-double*    PropagateFloatingiceToGrounded(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,double* vertices_potentially_ungrounding){ 
+/*FUNCTION PropagateFloatingiceToGroundedNeighbors {{{1*/
+double*    PropagateFloatingiceToGroundedNeighbors(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,double* vertices_potentially_ungrounding){ 
 
 	int      i,analysis_type;
@@ -117,6 +117,6 @@
 	int      nflipped,local_nflipped;
 	double*  nodes_on_floatingice                  = NULL;
-	double*  elements_neighbouring_floatingce      = NULL;
-	Vec      vec_elements_neighbouring_floatingice = NULL;
+	double*  elements_neighboring_floatingce      = NULL;
+	Vec      vec_elements_neighboring_floatingice = NULL;
 	Vec      vec_nodes_on_floatingice              = NULL;
 	Node*    node                                  = NULL;
@@ -136,22 +136,22 @@
 		
 		/*Vector of size number of elements*/
-		vec_elements_neighbouring_floatingice=NewVec(elements->NumberOfElements(),true);
+		vec_elements_neighboring_floatingice=NewVec(elements->NumberOfElements(),true);
 
 		/*Figure out if any of the nodes of the element will be floating -> elements neighbouting the floating ice*/
 		for(i=0;i<elements->Size();i++){
 			element=(Element*)elements->GetObjectByOffset(i);
-			VecSetValue(vec_elements_neighbouring_floatingice,element->Sid(),element->IsNodeOnShelfFromFlags(nodes_on_floatingice)?1.0:0.0,INSERT_VALUES);
+			VecSetValue(vec_elements_neighboring_floatingice,element->Sid(),element->IsNodeOnShelfFromFlags(nodes_on_floatingice)?1.0:0.0,INSERT_VALUES);
 		}
 
 		/*Assemble vector and serialize: */
-		VecAssemblyBegin(vec_elements_neighbouring_floatingice);
-		VecAssemblyEnd(vec_elements_neighbouring_floatingice);
-		VecToMPISerial(&elements_neighbouring_floatingce,vec_elements_neighbouring_floatingice);
+		VecAssemblyBegin(vec_elements_neighboring_floatingice);
+		VecAssemblyEnd(vec_elements_neighboring_floatingice);
+		VecToMPISerial(&elements_neighboring_floatingce,vec_elements_neighboring_floatingice);
 
-		/*Go through elements_neighbouring_floatingce, and update vector of the nodes that will start floating*/
+		/*Go through elements_neighboring_floatingce, and update vector of the nodes that will start floating*/
 		local_nflipped=0;
 		for(i=0;i<elements->Size();i++){
 			element=(Element*)elements->GetObjectByOffset(i);
-			if(elements_neighbouring_floatingce[element->Sid()]){
+			if(elements_neighboring_floatingce[element->Sid()]){
 				local_nflipped+=element->UpdatePotentialSheetUngrounding(vertices_potentially_ungrounding,vec_nodes_on_floatingice,nodes_on_floatingice);
 			}
@@ -164,9 +164,9 @@
 
 		/*Avoid leaks: */
-		xfree((void**)&elements_neighbouring_floatingce);
+		xfree((void**)&elements_neighboring_floatingce);
 		xfree((void**)&nodes_on_floatingice);
 
 		/*Assemble and serialize:*/
-		VecFree(&vec_elements_neighbouring_floatingice);
+		VecFree(&vec_elements_neighboring_floatingice);
 		VecToMPISerial(&nodes_on_floatingice,vec_nodes_on_floatingice); 
 	}
@@ -174,5 +174,5 @@
 	/*Free ressources:*/
 	VecFree(&vec_nodes_on_floatingice);
-	xfree((void**)&elements_neighbouring_floatingce);
+	xfree((void**)&elements_neighboring_floatingce);
 
 	return nodes_on_floatingice;
Index: /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.h
===================================================================
--- /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.h	(revision 10399)
+++ /issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.h	(revision 10400)
@@ -16,4 +16,4 @@
 Vec        CreateNodesOnFloatingIce(Nodes* nodes,int configuration_type);
 double*    PotentialSheetUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters);
-double*    PropagateFloatingiceToGrounded(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,double* vertices_potentially_ungrounding);
+double*    PropagateFloatingiceToGroundedNeighbors(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,double* vertices_potentially_ungrounding);
 #endif  /* _GROUNDINGLINEMIGRATIONX_H */
Index: /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp
===================================================================
--- /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 10399)
+++ /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 10400)
@@ -26,8 +26,8 @@
 	char       *outputfilename          = NULL;
 	char        cpu_outputfilename[100];        //easier to convert an integer with sprintf
-	bool        io_gather,results_on_vertices;
+	bool        io_gather;
 	int         solutiontype;
 	Results    *results                 = NULL;
-	bool        dakota_analysis            = false;
+	bool        dakota_analysis         = false;
 	
 	#ifdef _SERIAL_
Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 10399)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 10400)
@@ -2038,5 +2038,76 @@
 /*FUNCTION Penta::MigrateGroundingLine{{{1*/
 void  Penta::MigrateGroundingLine(double* old_floating_ice,double* sheet_ungrounding){
-	_error_("not supported yet!");
+
+	int     i,migration_style,unground;
+	bool    elementonshelf = false;
+	double  bed_hydro,yts,gl_melting_rate;
+	double  rho_water,rho_ice,density;
+	double  melting[NUMVERTICES];
+	double  h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];
+
+	/*Recover info at the vertices: */
+	parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
+	parameters->FindParam(&yts,ConstantsYtsEnum);
+	GetInputListOnVertices(&h[0],ThicknessEnum);
+	GetInputListOnVertices(&s[0],SurfaceEnum);
+	GetInputListOnVertices(&b[0],BedEnum);
+	GetInputListOnVertices(&ba[0],BathymetryEnum);
+	rho_water=matpar->GetRhoWater();
+	rho_ice=matpar->GetRhoIce();
+	density=rho_ice/rho_water;
+	
+	/*go through vertices, and update inputs, considering them to be PentaVertex type: */
+	for(i=0;i<NUMVERTICES;i++){
+		/*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */
+		if(old_floating_ice[nodes[i]->Sid()]){
+			if(b[i]<=ba[i]){ 
+				b[i]=ba[i];
+				s[i]=b[i]+h[i];
+				nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,false));
+				nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,true));
+			}
+		}
+		/*Ice sheet: if hydrostatic bed above bathymetry, ice sheet starts to unground, elso do nothing */
+		/*Change only if AgressiveMigration or if the ice sheet is in contact with the ocean*/
+		else{
+			bed_hydro=-density*h[i];
+			if (bed_hydro>ba[i]){
+				/*Unground only if the element is connected to the ice shelf*/
+				if(migration_style==AgressiveMigrationEnum){
+					s[i]=(1-density)*h[i];
+					b[i]=-density*h[i];
+					nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true));
+					nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false));
+				}
+				else if(migration_style==SoftMigrationEnum && sheet_ungrounding[nodes[i]->Sid()]){
+					s[i]=(1-density)*h[i];
+					b[i]=-density*h[i];
+					nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true));
+					nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false));
+				}
+			}
+		}
+	}
+
+	/*If at least one vertex is now floating, the element is now floating*/
+	for(i=0;i<NUMVERTICES;i++){
+		if(nodes[i]->IsFloating()){
+			elementonshelf=true;
+			break;
+		}
+	}
+	
+   /*Add basal melting rate if element just ungrounded*/
+	if(!this->IsFloating() && elementonshelf==true){
+		for(i=0;i<NUMVERTICES;i++)melting[i]=gl_melting_rate/yts;
+		this->inputs->AddInput(new PentaVertexInput(BasalforcingsMeltingRateEnum,&melting[0]));
+	} 
+
+	/*Update inputs*/
+   this->inputs->AddInput(new BoolInput(MaskElementonfloatingiceEnum,elementonshelf));
+
+	/*Update inputs*/    
+	this->inputs->AddInput(new PentaVertexInput(SurfaceEnum,&s[0]));
+	this->inputs->AddInput(new PentaVertexInput(BedEnum,&b[0]));
 }
 /*}}}*/
@@ -2100,7 +2171,7 @@
 
 	int     i;
-	int     numrows  = 0;
-	int     numnodes = 0;
-	int     temp_numnodes=0;
+	int     numrows       = 0;
+	int     numnodes      = 0;
+	int     temp_numnodes = 0;
 
 	/*Go through all the results objects, and update the counters: */
Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 10399)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 10400)
@@ -2035,7 +2035,7 @@
 
 	int     i;
-	int     numrows     = 0;
-	int     numnodes    = 0;
-	int     temp_numnodes    = 0;
+	int     numrows       = 0;
+	int     numnodes      = 0;
+	int     temp_numnodes = 0;
 
 	/*Go through all the results objects, and update the counters: */
Index: /issm/trunk/src/c/objects/Patch.h
===================================================================
--- /issm/trunk/src/c/objects/Patch.h	(revision 10399)
+++ /issm/trunk/src/c/objects/Patch.h	(revision 10400)
@@ -25,7 +25,4 @@
 
 /*Headers:*/
-/*{{{1*/
-/*}}}*/
-
 class Patch{
 
@@ -47,4 +44,3 @@
 
 };
-
 #endif //ifndef _PATCH_H_
Index: /issm/trunk/src/c/solutions/transient_core.cpp
===================================================================
--- /issm/trunk/src/c/solutions/transient_core.cpp	(revision 10399)
+++ /issm/trunk/src/c/solutions/transient_core.cpp	(revision 10400)
@@ -97,5 +97,5 @@
 
 		if(isgroundingline){
-			if(dim==3) _error_("Grounding line migration not implemented in 3d");
+		//	if(dim==3) _error_("Grounding line migration not implemented in 3d");
 			_printf_(VerboseSolution(),"   computing new grounding line position\n");
 			#ifdef _HAVE_GROUNDINGLINE_
