Index: /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 15534)
+++ /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 15535)
@@ -1555,10 +1555,10 @@
 
 	/*Step1: Get and Extrude original input: */
-	if (object_type==ElementEnum){
+	if(object_type==ElementEnum){
 		num_inputs=1;
 		base_inputs=xNew<Input*>(num_inputs);
 		base_inputs[0]=(Input*)this->inputs->GetInput(enum_type);
 	}
-	else if (object_type==MaterialsEnum){
+	else if(object_type==MaterialsEnum){
 		num_inputs=1;
 		base_inputs=xNew<Input*>(num_inputs);
@@ -9645,11 +9645,12 @@
 void  Penta::MigrateGroundingLine(IssmDouble* old_floating_ice,IssmDouble* sheet_ungrounding){
 
-	int     i,migration_style;
-	bool    floatingelement = false;
-	bool    groundedelement = false;
-	IssmDouble  bed_hydro,yts,gl_melting_rate;
-	IssmDouble  rho_water,rho_ice,density;
-	IssmDouble  melting[NUMVERTICES],phi[NUMVERTICES];
-	IssmDouble  h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];
+	int        i,migration_style;
+	bool       floatingelement = false;
+	bool       groundedelement = false;
+	IssmDouble bed_hydro,yts,gl_melting_rate;
+	IssmDouble rho_water,rho_ice,density;
+	IssmDouble h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],r[NUMVERTICES];
+	IssmDouble melting[NUMVERTICES],phi[NUMVERTICES];
+	bool       grounded[NUMVERTICES],floating[NUMVERTICES];
 
 	if(!IsOnBed()) return;
@@ -9662,9 +9663,9 @@
 	GetInputListOnVertices(&s[0],SurfaceEnum);
 	GetInputListOnVertices(&b[0],BedEnum);
-	GetInputListOnVertices(&ba[0],BathymetryEnum);
+	GetInputListOnVertices(&r[0],BathymetryEnum);
 	if(migration_style==SubelementMigrationEnum) GetInputListOnVertices(&phi[0],GLlevelsetEnum);
-	rho_water=matpar->GetRhoWater();
-	rho_ice=matpar->GetRhoIce();
-	density=rho_ice/rho_water;
+	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: */
@@ -9672,7 +9673,9 @@
 		/*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */
 		if(reCast<bool,IssmDouble>(old_floating_ice[nodes[i]->Sid()])){
-			if(b[i]<=ba[i]){ 
-				b[i]=ba[i];
-				s[i]=b[i]+h[i];
+			if(b[i]<=r[i]){ 
+				b[i]        = r[i];
+				s[i]        = b[i]+h[i];
+				floating[i] = false;
+				grounded[i] = true;
 				nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,false));
 				nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,true));
@@ -9683,15 +9686,19 @@
 		else{
 			bed_hydro=-density*h[i];
-			if (bed_hydro>ba[i]){
+			if(bed_hydro>r[i]){
 				/*Unground only if the element is connected to the ice shelf*/
 				if(migration_style==AgressiveMigrationEnum || migration_style==SubelementMigrationEnum){
-					s[i]=(1-density)*h[i];
-					b[i]=-density*h[i];
+					s[i]        = (1-density)*h[i];
+					b[i]        = -density*h[i];
+					floating[i] = true;
+					grounded[i] = false;
 					nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true));
 					nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false));
 				}
 				else if(migration_style==SoftMigrationEnum && reCast<int,IssmDouble>(sheet_ungrounding[nodes[i]->Sid()])){
-					s[i]=(1-density)*h[i];
-					b[i]=-density*h[i];
+					s[i]        = (1-density)*h[i];
+					b[i]        = -density*h[i];
+					floating[i] = true;
+					grounded[i] = false;
 					nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true));
 					nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false));
@@ -9736,5 +9743,5 @@
 	/*Recalculate phi*/
 	if(migration_style==SubelementMigrationEnum){
-		for(i=0;i<NUMVERTICES;i++) phi[i]=h[i]+ba[i]/density;
+		for(i=0;i<NUMVERTICES;i++) phi[i]=h[i]+r[i]/density;
 		this->inputs->AddInput(new PentaInput(GLlevelsetEnum,&phi[0],P1Enum));
 		this->InputExtrude(GLlevelsetEnum,ElementEnum);
@@ -9752,6 +9759,5 @@
 void  Penta::PotentialUngrounding(Vector<IssmDouble>* potential_ungrounding){
 
-	int     i;
-	IssmDouble  h[NUMVERTICES],ba[NUMVERTICES];
+	IssmDouble  h[NUMVERTICES],r[NUMVERTICES];
 	IssmDouble  bed_hydro;
 	IssmDouble  rho_water,rho_ice,density;
@@ -9762,12 +9768,12 @@
 	density=rho_ice/rho_water;
 	GetInputListOnVertices(&h[0],ThicknessEnum);
-	GetInputListOnVertices(&ba[0],BathymetryEnum);
+	GetInputListOnVertices(&r[0],BathymetryEnum);
 
 	/*go through vertices, and figure out which ones are on the ice sheet, and want to unground: */
-	for(i=0;i<NUMVERTICES;i++){
+	for(int i=0;i<NUMVERTICES;i++){
 		/*Find if grounded vertices want to start floating*/
 		if (!nodes[i]->IsFloating()){
 			bed_hydro=-density*h[i];
-			if (bed_hydro>ba[i]){
+			if(bed_hydro>r[i]){
 				/*Vertex that could potentially unground, flag it*/
 				potential_ungrounding->SetValue(nodes[i]->Sid(),1,INS_VAL);
Index: /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 15534)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 15535)
@@ -7166,11 +7166,12 @@
 void  Tria::MigrateGroundingLine(IssmDouble* old_floating_ice,IssmDouble* sheet_ungrounding){
 
-	int     i,migration_style;
-	bool    floatingelement = false;
-	bool    groundedelement = false;
-	IssmDouble  bed_hydro,yts,gl_melting_rate;
-	IssmDouble  rho_water,rho_ice,density;
-	IssmDouble  melting[NUMVERTICES],phi[NUMVERTICES];;
-	IssmDouble  h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];
+	int        i,migration_style;
+	bool       floatingelement = false;
+	bool       groundedelement = false;
+	IssmDouble bed_hydro,yts,gl_melting_rate;
+	IssmDouble rho_water,rho_ice,density;
+	IssmDouble melting[NUMVERTICES],phi[NUMVERTICES];;
+	IssmDouble h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],r[NUMVERTICES];
+	bool       grounded[NUMVERTICES],floating[NUMVERTICES];
 
 	/*Recover info at the vertices: */
@@ -7181,9 +7182,9 @@
 	GetInputListOnVertices(&s[0],SurfaceEnum);
 	GetInputListOnVertices(&b[0],BedEnum);
-	GetInputListOnVertices(&ba[0],BathymetryEnum);
+	GetInputListOnVertices(&r[0],BathymetryEnum);
 	if(migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum) GetInputListOnVertices(&phi[0],GLlevelsetEnum);
-	rho_water=matpar->GetRhoWater();
-	rho_ice=matpar->GetRhoIce();
-	density=rho_ice/rho_water;
+	rho_water = matpar->GetRhoWater();
+	rho_ice   = matpar->GetRhoIce();
+	density   = rho_ice/rho_water;
 
 	/*go through vertices, and update inputs, considering them to be TriaVertex type: */
@@ -7191,7 +7192,9 @@
 		/*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */
 		if(reCast<bool>(old_floating_ice[nodes[i]->Sid()])){
-			if(b[i]<=ba[i]){ 
-				b[i]=ba[i];
-				s[i]=b[i]+h[i];
+			if(b[i]<=r[i]){ 
+				b[i]        = r[i];
+				s[i]        = b[i]+h[i];
+				floating[i] = false;
+				grounded[i] = true;
 				nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,false));
 				nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,true));
@@ -7202,15 +7205,19 @@
 		else{
 			bed_hydro=-density*h[i];
-			if (bed_hydro>ba[i]){
+			if (bed_hydro>r[i]){
 				/*Unground only if the element is connected to the ice shelf*/
 				if(migration_style==AgressiveMigrationEnum || migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum){
-					s[i]=(1-density)*h[i];
-					b[i]=-density*h[i];
+					s[i]        = (1-density)*h[i];
+					b[i]        = -density*h[i];
+					floating[i] = true;
+					grounded[i] = false;
 					nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true));
 					nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false));
 				}
 				else if(migration_style==SoftMigrationEnum && reCast<bool>(sheet_ungrounding[nodes[i]->Sid()])){
-					s[i]=(1-density)*h[i];
-					b[i]=-density*h[i];
+					s[i]        = (1-density)*h[i];
+					b[i]        = -density*h[i];
+					floating[i] = true;
+					grounded[i] = false;
 					nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true));
 					nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false));
@@ -7256,5 +7263,5 @@
 	/*Recalculate phi*/
 	if(migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum){
-		for(i=0;i<NUMVERTICES;i++) phi[i]=h[i]+ba[i]/density;
+		for(i=0;i<NUMVERTICES;i++) phi[i]=h[i]+r[i]/density;
 		this->inputs->AddInput(new TriaInput(GLlevelsetEnum,&phi[0],P1Enum));
 	}
@@ -7264,6 +7271,5 @@
 void  Tria::PotentialUngrounding(Vector<IssmDouble>* potential_ungrounding){
 
-	int     i;
-	IssmDouble  h[NUMVERTICES],ba[NUMVERTICES];
+	IssmDouble  h[NUMVERTICES],r[NUMVERTICES];
 	IssmDouble  bed_hydro;
 	IssmDouble  rho_water,rho_ice,density;
@@ -7274,12 +7280,12 @@
 	density=rho_ice/rho_water;
 	GetInputListOnVertices(&h[0],ThicknessEnum);
-	GetInputListOnVertices(&ba[0],BathymetryEnum);
+	GetInputListOnVertices(&r[0],BathymetryEnum);
 
 	/*go through vertices, and figure out which ones are grounded and want to unground: */
-	for(i=0;i<NUMVERTICES;i++){
+	for(int i=0;i<NUMVERTICES;i++){
 		/*Find if grounded vertices want to start floating*/
 		if (!nodes[i]->IsFloating()){
 			bed_hydro=-density*h[i];
-			if (bed_hydro>ba[i]){
+			if(bed_hydro>r[i]){
 				/*Vertex that could potentially unground, flag it*/
 				potential_ungrounding->SetValue(nodes[i]->Sid(),1,INS_VAL);
Index: /issm/trunk-jpl/src/c/classes/Node.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Node.h	(revision 15534)
+++ /issm/trunk-jpl/src/c/classes/Node.h	(revision 15535)
@@ -65,31 +65,31 @@
 		/*}}}*/
 		/*Node numerical routines {{{*/
-		void   CreateNodalConstraints(Vector<IssmDouble>* ys);
-		void   SetCurrentConfiguration(DataSet* nodes,Vertices* vertices);
-		int    Sid(void); 
+		void  CreateNodalConstraints(Vector<IssmDouble>* ys);
+		void  SetCurrentConfiguration(DataSet* nodes,Vertices* vertices);
+		int   Sid(void); 
 #ifdef _HAVE_DIAGNOSTIC_
-		void   GetCoordinateSystem(IssmDouble* coord_system_out);
+		void  GetCoordinateSystem(IssmDouble* coord_system_out);
 #endif
-		bool   InAnalysis(int analysis_type);
-		int    GetApproximation();
-		int    GetNumberOfDofs(int approximation_enum,int setenum);
-		int    IsClone();
-		void   ApplyConstraint(int dof,IssmDouble value);
-		void   RelaxConstraint(int dof);
-		void   DofInSSet(int dof);
-		void   DofInFSet(int dof);
-		int    GetDof(int dofindex,int setenum);
-		void   CreateVecSets(Vector<IssmDouble>* pv_g,Vector<IssmDouble>* pv_f,Vector<IssmDouble>* pv_s);
-		void   GetDofList(int* poutdoflist,int approximation_enum,int setenum);
-		void   GetLocalDofList(int* poutdoflist,int approximation_enum,int setenum);
-		void   FreezeDof(int dof);
-		bool   IsActive(void);
-		void   Activate(void);
-		void   Deactivate(void);
-		int    IsFloating();
-		int    IsGrounded();
-		void   UpdateSpcs(IssmDouble* ys);
-		void   VecMerge(Vector<IssmDouble>* ug, IssmDouble* vector_serial,int setenum);
-		void   VecReduce(Vector<IssmDouble>* vector, IssmDouble* ug_serial,int setnum);
+		bool  InAnalysis(int analysis_type);
+		int   GetApproximation();
+		int   GetNumberOfDofs(int approximation_enum,int setenum);
+		int   IsClone();
+		void  ApplyConstraint(int dof,IssmDouble value);
+		void  RelaxConstraint(int dof);
+		void  DofInSSet(int dof);
+		void  DofInFSet(int dof);
+		int   GetDof(int dofindex,int setenum);
+		void  CreateVecSets(Vector<IssmDouble>* pv_g,Vector<IssmDouble>* pv_f,Vector<IssmDouble>* pv_s);
+		void  GetDofList(int* poutdoflist,int approximation_enum,int setenum);
+		void  GetLocalDofList(int* poutdoflist,int approximation_enum,int setenum);
+		void  FreezeDof(int dof);
+		bool  IsActive(void);
+		void  Activate(void);
+		void  Deactivate(void);
+		void  UpdateSpcs(IssmDouble* ys);
+		int   IsFloating();
+		int   IsGrounded();
+		void  VecMerge(Vector<IssmDouble>* ug, IssmDouble* vector_serial,int setenum);
+		void  VecReduce(Vector<IssmDouble>* vector, IssmDouble* ug_serial,int setnum);
 		void  DistributeDofs(int* pdofcount,int setenum);
 		void  OffsetDofs(int dofcount,int setenum);
