Index: /issm/trunk-jpl/src/c/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/c/Makefile.am	(revision 25838)
+++ /issm/trunk-jpl/src/c/Makefile.am	(revision 25839)
@@ -498,4 +498,5 @@
 issm_sources += ./analyses/LevelsetAnalysis.cpp
 issm_sources += ./modules/Calvingx/Calvingx.cpp
+issm_sources += ./modules/MovingFrontalVelx/MovingFrontalVelx.cpp
 issm_sources += ./modules/KillIcebergsx/KillIcebergsx.cpp
 endif
Index: /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 25838)
+++ /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 25839)
@@ -186,17 +186,15 @@
 
 	/*Intermediaries */
-	int  stabilization,dim, domaintype, calvinglaw;
+	int  stabilization,dim,domaintype;
 	int i,j,k,row, col;
 	IssmDouble kappa;
 	IssmDouble Jdet, dt, D_scalar;
 	IssmDouble h,hx,hy,hz;
-	IssmDouble vel,v[3],w[3],c[3],m[3],dlsf[3];
-	IssmDouble norm_dlsf, norm_calving, calvingrate, meltingrate, groundedice;
-	IssmDouble migrationmax, calvinghaf, heaviside, haf_eps;
+	IssmDouble vel,w[3];
+	IssmDouble migrationmax;
 	IssmDouble* xyz_list = NULL;
 
 	/*Get problem dimension and whether there is moving front or not*/
 	basalelement->FindParam(&domaintype,DomainTypeEnum);
-	basalelement->FindParam(&calvinglaw,CalvingLawEnum);
 	basalelement->FindParam(&stabilization,LevelsetStabilizationEnum);
 	switch(domaintype){
@@ -206,7 +204,4 @@
 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
 	}
-
-	/*Calving threshold*/
-
 	/*Fetch number of nodes and dof for this finite element*/
 	int numnodes    = basalelement->GetNumberOfNodes();
@@ -225,82 +220,22 @@
 	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
 	basalelement->FindParam(&migrationmax,MigrationMaxEnum);
-	Input* vx_input           = NULL;
-	Input* vy_input           = NULL;
-	Input* calvingratex_input = NULL;
-	Input* calvingratey_input = NULL;
-	Input* lsf_slopex_input   = NULL;
-	Input* lsf_slopey_input   = NULL;
-	Input* calvingrate_input  = NULL;
-	Input* meltingrate_input  = NULL;
-	Input* gr_input           = NULL;
+
+	Input* mf_vx_input        = NULL;
+	Input* mf_vy_input        = NULL;
 
 	/*Load velocities*/
 	switch(domaintype){
 		case Domain2DverticalEnum:
-			vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
+			mf_vx_input=basalelement->GetInput(MovingFrontalVxEnum); _assert_(mf_vx_input);
 			break;
 		case Domain2DhorizontalEnum:
-			vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
-			vy_input=basalelement->GetInput(VyEnum); _assert_(vy_input);
-			gr_input=basalelement->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);
+			mf_vx_input=basalelement->GetInput(MovingFrontalVxEnum); _assert_(mf_vx_input);
+			mf_vy_input=basalelement->GetInput(MovingFrontalVyEnum); _assert_(mf_vy_input);
 			break;
 		case Domain3DEnum:
-			vx_input=basalelement->GetInput(VxAverageEnum); _assert_(vx_input);
-			vy_input=basalelement->GetInput(VyAverageEnum); _assert_(vy_input);
-			gr_input=basalelement->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);
+			mf_vx_input=basalelement->GetInput(MovingFrontalVxEnum); _assert_(mf_vx_input);
+			mf_vy_input=basalelement->GetInput(MovingFrontalVyEnum); _assert_(mf_vy_input);
 			break;
 		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
-	}
-
-	/*Load calving inputs*/
-	switch(calvinglaw){
-		case DefaultCalvingEnum:
-		case CalvingVonmisesEnum:
-			lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
-			if(dim==2) lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
-			calvingrate_input = basalelement->GetInput(CalvingCalvingrateEnum);     _assert_(calvingrate_input);
-			meltingrate_input = basalelement->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
-			break;
-		case CalvingLevermannEnum:
-			switch(domaintype){
-				case Domain2DverticalEnum:
-					calvingratex_input=basalelement->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
-					break;
-				case Domain2DhorizontalEnum:
-					calvingratex_input=basalelement->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
-					calvingratey_input=basalelement->GetInput(CalvingrateyEnum); _assert_(calvingratey_input);
-					break;
-				case Domain3DEnum:
-					calvingratex_input=basalelement->GetInput(CalvingratexAverageEnum); _assert_(calvingratex_input);
-					calvingratey_input=basalelement->GetInput(CalvingrateyAverageEnum); _assert_(calvingratey_input);
-					break;
-				default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
-			}
-			meltingrate_input = basalelement->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
-			break;
-		case CalvingMinthicknessEnum:
-			lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
-			if(dim==2) lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
-			meltingrate_input = basalelement->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
-			break;
-		case CalvingHabEnum:
-			lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
-			if(dim==2) lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
-			meltingrate_input = basalelement->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
-			break;
-		case CalvingCrevasseDepthEnum:
-			lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
-			if(dim==2) lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
-			meltingrate_input = basalelement->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
-			break;
-		case CalvingDev2Enum:
-			basalelement->FindParam(&calvinghaf,CalvingHeightAboveFloatationEnum);
-			lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
-			if(dim==2) lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
-			calvingrate_input = basalelement->GetInput(CalvingCalvingrateEnum);     _assert_(calvingrate_input);
-			meltingrate_input = basalelement->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
-			break;
-		default:
-			_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
 	}
 
@@ -324,163 +259,16 @@
 		}
 
-		/* Advection */
-		vx_input->GetInputValue(&v[0],gauss);
-		vy_input->GetInputValue(&v[1],gauss);
-		gr_input->GetInputValue(&groundedice,gauss);
-
-		/*Get calving speed*/
-		switch(calvinglaw){
-			case DefaultCalvingEnum:
-			case CalvingVonmisesEnum:
-				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
-				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
-				calvingrate_input->GetInputValue(&calvingrate,gauss);
-				meltingrate_input->GetInputValue(&meltingrate,gauss);
-
-				/*Limit calving rate to c <= v + 3 km/yr */
-				vel=sqrt(v[0]*v[0] + v[1]*v[1]);
-				if(calvingrate>migrationmax+vel) calvingrate = vel+migrationmax;
-				if(groundedice<0) meltingrate = 0.;
-
-				norm_dlsf=0.;
-				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
-				norm_dlsf=sqrt(norm_dlsf);
-
-				if(norm_dlsf>1.e-10)
-				 for(i=0;i<dim;i++){
-					 c[i]=calvingrate*dlsf[i]/norm_dlsf; m[i]=meltingrate*dlsf[i]/norm_dlsf;
-				 }
-				else
-				 for(i=0;i<dim;i++){
-					 c[i]=0.; m[i]=0.;
-				 }
-				break;
-
-			case CalvingLevermannEnum:
-				calvingratex_input->GetInputValue(&c[0],gauss);
-				if(dim==2) calvingratey_input->GetInputValue(&c[1],gauss);
-				meltingrate_input->GetInputValue(&meltingrate,gauss);
-				norm_calving=0.;
-				for(i=0;i<dim;i++) norm_calving+=pow(c[i],2);
-				norm_calving=sqrt(norm_calving)+1.e-14;
-				for(i=0;i<dim;i++) m[i]=meltingrate*c[i]/norm_calving;
-				break;
-
-			case CalvingMinthicknessEnum:
-				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
-				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
-				meltingrate_input->GetInputValue(&meltingrate,gauss);
-
-				norm_dlsf=0.;
-				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
-				norm_dlsf=sqrt(norm_dlsf);
-
-				if(norm_dlsf>1.e-10)
-				 for(i=0;i<dim;i++){
-					 c[i]=0.;
-					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
-				 }
-				else
-				 for(i=0;i<dim;i++){
-					 c[i]=0.;
-					 m[i]=0.;
-				 }
-				break;
-
-			case CalvingHabEnum:
-				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
-				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
-				meltingrate_input->GetInputValue(&meltingrate,gauss);
-
-				norm_dlsf=0.;
-				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
-				norm_dlsf=sqrt(norm_dlsf);
-
-				if(norm_dlsf>1.e-10)
-				 for(i=0;i<dim;i++){
-					 c[i]=0.;
-					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
-				 }
-				else
-				 for(i=0;i<dim;i++){
-					 c[i]=0.;
-					 m[i]=0.;
-				 }
-				break;
-
-			case CalvingCrevasseDepthEnum:
-				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
-				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
-				meltingrate_input->GetInputValue(&meltingrate,gauss);
-
-				if(groundedice<0) meltingrate = 0.;
-
-				norm_dlsf=0.;
-				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
-				norm_dlsf=sqrt(norm_dlsf);
-
-				if(norm_dlsf>1.e-10)
-				 for(i=0;i<dim;i++){
-					 c[i]=0.;
-					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
-				 }
-				else
-				 for(i=0;i<dim;i++){
-					 c[i]=0.;
-					 m[i]=0.;
-				 }
-				break;
-
-			case CalvingDev2Enum:
-				  {
-					lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
-					if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
-					calvingrate_input->GetInputValue(&calvingrate,gauss);
-					meltingrate_input->GetInputValue(&meltingrate,gauss);
-					gr_input->GetInputValue(&groundedice,gauss);
-
-					//idea: no retreat on ice above critical calving height "calvinghaf" . Limit using regularized Heaviside function.
-					vel=sqrt(v[0]*v[0] + v[1]*v[1]);
-					haf_eps=10.;
-					if(groundedice-calvinghaf<=-haf_eps){
-						// ice floats freely below calvinghaf: calve freely
-						// undercutting has no effect:
-						meltingrate=0.;
-					}
-					else if(groundedice-calvinghaf>=haf_eps){
-						// ice is well above calvinghaf -> no calving back, i.e. limit calving rate to ice velocity
-						calvingrate=min(calvingrate,vel);
-						// ice is almost grounded: frontal undercutting has maximum effect (do nothing).
-					}
-					else{ // ice is close to calvinghaf: smooth transition between limitation and free calving.
-						//heaviside: 0 for floating, 1 for grounded
-						heaviside=(groundedice-calvinghaf+haf_eps)/(2.*haf_eps) + sin(PI*(groundedice-calvinghaf)/haf_eps)/(2.*PI);
-						calvingrate=heaviside*(min(calvingrate,vel)-calvingrate)+calvingrate;
-						meltingrate=heaviside*meltingrate+0.;
-					}
-
-					norm_dlsf=0.;
-					for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
-					norm_dlsf=sqrt(norm_dlsf);
-
-					if(norm_dlsf>1.e-10)
-					 for(i=0;i<dim;i++){
-						 c[i]=calvingrate*dlsf[i]/norm_dlsf;
-						 m[i]=meltingrate*dlsf[i]/norm_dlsf;
-					 }
-					else
-					 for(i=0;i<dim;i++){
-						 c[i]=0.;
-						 m[i]=0.;
-					 }
-					break;
-				  }
-
-			default:
-				_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
-		}
-
-		/*Levelset speed is ice velocity - calving rate*/
-		for(i=0;i<dim;i++) w[i]=v[i]-c[i]-m[i];
+		/* Levelset speed */
+		mf_vx_input->GetInputValue(&w[0], gauss);
+		mf_vy_input->GetInputValue(&w[1], gauss);
+
+		/* Apply limiter to the migration rate */		
+		vel = 0.;
+		for(i=0;i<dim;i++) vel += w[i]*w[i];
+		vel = sqrt(vel)+1e-14;
+		/* !!NOTE: This is different from the previous version 25838 (and before). The current threshold restrict both advance and retreat velocity. */
+		if (vel > migrationmax) {
+			for(i=0;i<dim;i++) w[i] = w[i]/vel*migrationmax;
+		}
 
 		/*Compute D*/
Index: /issm/trunk-jpl/src/c/classes/Elements/Element.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Element.h	(revision 25838)
+++ /issm/trunk-jpl/src/c/classes/Elements/Element.h	(revision 25839)
@@ -297,4 +297,5 @@
 		virtual IssmDouble Misfit(int modelenum,int observationenum,int weightsenum)=0;
 		virtual IssmDouble MisfitArea(int weightsenum)=0;
+		virtual void	   MovingFrontalVelocity(void){_error_("not implemented yet");};
 		virtual Gauss*     NewGauss(void)=0;
 		virtual Gauss*     NewGauss(int order)=0;
Index: /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 25838)
+++ /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 25839)
@@ -2745,4 +2745,282 @@
 
 	return minlength;
+}
+/*}}}*/
+void	   Penta::MovingFrontalVelocity(void){/*{{{*/
+	if(!this->IsOnBase()) return;
+	int  dim, domaintype, calvinglaw, i;
+	IssmDouble v[3],w[3],c[3],m[3],dlsf[3];
+	IssmDouble norm_dlsf, norm_calving, calvingrate, meltingrate, groundedice;
+	IssmDouble migrationmax, calvinghaf, heaviside, haf_eps;
+	IssmDouble  xyz_list[NUMVERTICES][3];
+	IssmDouble  movingfrontvx[NUMVERTICES];
+	IssmDouble  movingfrontvy[NUMVERTICES];
+	IssmDouble  vel;
+	
+	/* Get node coordinates and dof list: */
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+
+	Input* vx_input           = NULL;
+	Input* vy_input           = NULL;
+	Input* calvingratex_input = NULL;
+	Input* calvingratey_input = NULL;
+	Input* lsf_slopex_input   = NULL;
+	Input* lsf_slopey_input   = NULL;
+	Input* calvingrate_input  = NULL;
+	Input* meltingrate_input  = NULL;
+	Input* gr_input           = NULL;
+
+	/*Get problem dimension and whether there is moving front or not*/
+	this->FindParam(&domaintype,DomainTypeEnum);
+	this->FindParam(&calvinglaw,CalvingLawEnum);
+
+	switch(domaintype){
+		case Domain2DverticalEnum:   dim = 1; break;
+		case Domain2DhorizontalEnum: dim = 2; break;
+		case Domain3DEnum:           dim = 2; break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+	/*Load velocities*/
+	switch(domaintype){
+		case Domain2DverticalEnum:
+			vx_input=this->GetInput(VxEnum); _assert_(vx_input);
+			break;
+		case Domain2DhorizontalEnum:
+			vx_input=this->GetInput(VxEnum); _assert_(vx_input);
+			vy_input=this->GetInput(VyEnum); _assert_(vy_input);
+			gr_input=this->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);
+			break;
+		case Domain3DEnum:
+			vx_input=this->GetInput(VxAverageEnum); _assert_(vx_input);
+			vy_input=this->GetInput(VyAverageEnum); _assert_(vy_input);
+			gr_input=this->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);
+			break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+
+	switch(calvinglaw){
+		case DefaultCalvingEnum:
+		case CalvingVonmisesEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			calvingrate_input = this->GetInput(CalvingCalvingrateEnum);     _assert_(calvingrate_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingLevermannEnum:
+			switch(domaintype){
+				case Domain2DverticalEnum:
+					calvingratex_input=this->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
+					break;
+				case Domain2DhorizontalEnum:
+					calvingratex_input=this->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
+					calvingratey_input=this->GetInput(CalvingrateyEnum); _assert_(calvingratey_input);
+					break;
+				case Domain3DEnum:
+					calvingratex_input=this->GetInput(CalvingratexAverageEnum); _assert_(calvingratex_input);
+					calvingratey_input=this->GetInput(CalvingrateyAverageEnum); _assert_(calvingratey_input);
+					break;
+				default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+			}
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingMinthicknessEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingHabEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingCrevasseDepthEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingDev2Enum:
+			this->FindParam(&calvinghaf,CalvingHeightAboveFloatationEnum);
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			calvingrate_input = this->GetInput(CalvingCalvingrateEnum);     _assert_(calvingrate_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		default:
+			_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
+	}
+
+	/* Start looping on the number of vertices: */
+	GaussPenta* gauss=new GaussPenta();
+	for(int iv=0;iv<NUMVERTICES;iv++){
+		gauss->GaussVertex(iv);
+
+		/* Advection */
+		vx_input->GetInputValue(&v[0],gauss);
+		vy_input->GetInputValue(&v[1],gauss);
+		gr_input->GetInputValue(&groundedice,gauss);
+
+		/*Get calving speed*/
+		switch(calvinglaw){
+			case DefaultCalvingEnum:
+			case CalvingVonmisesEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+				calvingrate_input->GetInputValue(&calvingrate,gauss);
+				meltingrate_input->GetInputValue(&meltingrate,gauss);
+
+				if(groundedice<0) meltingrate = 0.;
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=calvingrate*dlsf[i]/norm_dlsf; m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.; m[i]=0.;
+				 }
+				break;
+
+			case CalvingLevermannEnum:
+				calvingratex_input->GetInputValue(&c[0],gauss);
+				if(dim==2) calvingratey_input->GetInputValue(&c[1],gauss);
+				meltingrate_input->GetInputValue(&meltingrate,gauss);
+				norm_calving=0.;
+				for(i=0;i<dim;i++) norm_calving+=pow(c[i],2);
+				norm_calving=sqrt(norm_calving)+1.e-14;
+				for(i=0;i<dim;i++) m[i]=meltingrate*c[i]/norm_calving;
+				break;
+
+			case CalvingMinthicknessEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+				meltingrate_input->GetInputValue(&meltingrate,gauss);
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=0.;
+				 }
+				break;
+
+			case CalvingHabEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+				meltingrate_input->GetInputValue(&meltingrate,gauss);
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=0.;
+				 }
+				break;
+
+			case CalvingCrevasseDepthEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+				meltingrate_input->GetInputValue(&meltingrate,gauss);
+
+				if(groundedice<0) meltingrate = 0.;
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=0.;
+				 }
+				break;
+
+			case CalvingDev2Enum:
+				  {
+					lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
+					if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+					calvingrate_input->GetInputValue(&calvingrate,gauss);
+					meltingrate_input->GetInputValue(&meltingrate,gauss);
+					gr_input->GetInputValue(&groundedice,gauss);
+
+					//idea: no retreat on ice above critical calving height "calvinghaf" . Limit using regularized Heaviside function.
+					vel=sqrt(v[0]*v[0] + v[1]*v[1]);
+					haf_eps=10.;
+					if(groundedice-calvinghaf<=-haf_eps){
+						// ice floats freely below calvinghaf: calve freely
+						// undercutting has no effect:
+						meltingrate=0.;
+					}
+					else if(groundedice-calvinghaf>=haf_eps){
+						// ice is well above calvinghaf -> no calving back, i.e. limit calving rate to ice velocity
+						calvingrate=min(calvingrate,vel);
+						// ice is almost grounded: frontal undercutting has maximum effect (do nothing).
+					}
+					else{ // ice is close to calvinghaf: smooth transition between limitation and free calving.
+						//heaviside: 0 for floating, 1 for grounded
+						heaviside=(groundedice-calvinghaf+haf_eps)/(2.*haf_eps) + sin(PI*(groundedice-calvinghaf)/haf_eps)/(2.*PI);
+						calvingrate=heaviside*(min(calvingrate,vel)-calvingrate)+calvingrate;
+						meltingrate=heaviside*meltingrate+0.;
+					}
+
+					norm_dlsf=0.;
+					for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+					norm_dlsf=sqrt(norm_dlsf);
+
+					if(norm_dlsf>1.e-10)
+					 for(i=0;i<dim;i++){
+						 c[i]=calvingrate*dlsf[i]/norm_dlsf;
+						 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+					 }
+					else
+					 for(i=0;i<dim;i++){
+						 c[i]=0.;
+						 m[i]=0.;
+					 }
+					break;
+				  }
+
+			default:
+				_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
+		}
+
+		for(i=0;i<dim;i++) w[i]=v[i]-c[i]-m[i];
+
+		movingfrontvx[iv] = w[0];
+		movingfrontvy[iv] = w[1];		
+	}
+
+	/*Add input*/
+	this->AddInput(MovingFrontalVxEnum,&movingfrontvx[0],P1DGEnum);
+	this->AddInput(MovingFrontalVyEnum,&movingfrontvy[0],P1DGEnum);
+
+	this->InputExtrude(MovingFrontalVxEnum,-1);
+	this->InputExtrude(MovingFrontalVyEnum,-1);
+	/*Clean up and return*/
+	delete gauss;
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Elements/Penta.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Penta.h	(revision 25838)
+++ /issm/trunk-jpl/src/c/classes/Elements/Penta.h	(revision 25839)
@@ -129,4 +129,5 @@
 		IssmDouble     Misfit(int modelenum,int observationenum,int weightsenum){_error_("not implemented yet");};
 		IssmDouble     MisfitArea(int weightsenum){_error_("not implemented yet");};
+		void           MovingFrontalVelocity(void);
 		Gauss*         NewGauss(void);
 		Gauss*         NewGauss(int order);
Index: /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 25838)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 25839)
@@ -3442,4 +3442,278 @@
 	delete gauss;
 	return Jelem;
+}
+/*}}}*/
+void	   Tria::MovingFrontalVelocity(void){/*{{{*/
+
+	int  dim, domaintype, calvinglaw, i;
+	IssmDouble v[3],w[3],c[3],m[3],dlsf[3];
+	IssmDouble norm_dlsf, norm_calving, calvingrate, meltingrate, groundedice;
+	IssmDouble migrationmax, calvinghaf, heaviside, haf_eps;
+	IssmDouble  xyz_list[NUMVERTICES][3];
+	IssmDouble  movingfrontvx[NUMVERTICES];
+	IssmDouble  movingfrontvy[NUMVERTICES];
+	IssmDouble  vel;
+	
+	/* Get node coordinates and dof list: */
+	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+
+	Input* vx_input           = NULL;
+	Input* vy_input           = NULL;
+	Input* calvingratex_input = NULL;
+	Input* calvingratey_input = NULL;
+	Input* lsf_slopex_input   = NULL;
+	Input* lsf_slopey_input   = NULL;
+	Input* calvingrate_input  = NULL;
+	Input* meltingrate_input  = NULL;
+	Input* gr_input           = NULL;
+
+	/*Get problem dimension and whether there is moving front or not*/
+	this->FindParam(&domaintype,DomainTypeEnum);
+	this->FindParam(&calvinglaw,CalvingLawEnum);
+
+	switch(domaintype){
+		case Domain2DverticalEnum:   dim = 1; break;
+		case Domain2DhorizontalEnum: dim = 2; break;
+		case Domain3DEnum:           dim = 2; break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+	/*Load velocities*/
+	switch(domaintype){
+		case Domain2DverticalEnum:
+			vx_input=this->GetInput(VxEnum); _assert_(vx_input);
+			break;
+		case Domain2DhorizontalEnum:
+			vx_input=this->GetInput(VxEnum); _assert_(vx_input);
+			vy_input=this->GetInput(VyEnum); _assert_(vy_input);
+			gr_input=this->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);
+			break;
+		case Domain3DEnum:
+			vx_input=this->GetInput(VxAverageEnum); _assert_(vx_input);
+			vy_input=this->GetInput(VyAverageEnum); _assert_(vy_input);
+			gr_input=this->GetInput(MaskOceanLevelsetEnum); _assert_(gr_input);
+			break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+
+	switch(calvinglaw){
+		case DefaultCalvingEnum:
+		case CalvingVonmisesEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			calvingrate_input = this->GetInput(CalvingCalvingrateEnum);     _assert_(calvingrate_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingLevermannEnum:
+			switch(domaintype){
+				case Domain2DverticalEnum:
+					calvingratex_input=this->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
+					break;
+				case Domain2DhorizontalEnum:
+					calvingratex_input=this->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
+					calvingratey_input=this->GetInput(CalvingrateyEnum); _assert_(calvingratey_input);
+					break;
+				case Domain3DEnum:
+					calvingratex_input=this->GetInput(CalvingratexAverageEnum); _assert_(calvingratex_input);
+					calvingratey_input=this->GetInput(CalvingrateyAverageEnum); _assert_(calvingratey_input);
+					break;
+				default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+			}
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingMinthicknessEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingHabEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingCrevasseDepthEnum:
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		case CalvingDev2Enum:
+			this->FindParam(&calvinghaf,CalvingHeightAboveFloatationEnum);
+			lsf_slopex_input  = this->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+			if(dim==2) lsf_slopey_input  = this->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+			calvingrate_input = this->GetInput(CalvingCalvingrateEnum);     _assert_(calvingrate_input);
+			meltingrate_input = this->GetInput(CalvingMeltingrateEnum);     _assert_(meltingrate_input);
+			break;
+		default:
+			_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
+	}
+
+	/* Start looping on the number of vertices: */
+	GaussTria* gauss=new GaussTria();
+	for(int iv=0;iv<NUMVERTICES;iv++){
+		gauss->GaussVertex(iv);
+
+		/* Advection */
+		vx_input->GetInputValue(&v[0],gauss);
+		vy_input->GetInputValue(&v[1],gauss);
+		gr_input->GetInputValue(&groundedice,gauss);
+
+		/*Get calving speed*/
+		switch(calvinglaw){
+			case DefaultCalvingEnum:
+			case CalvingVonmisesEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+				calvingrate_input->GetInputValue(&calvingrate,gauss);
+				meltingrate_input->GetInputValue(&meltingrate,gauss);
+				if(groundedice<0) meltingrate = 0.;
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=calvingrate*dlsf[i]/norm_dlsf; m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.; m[i]=0.;
+				 }
+				break;
+
+			case CalvingLevermannEnum:
+				calvingratex_input->GetInputValue(&c[0],gauss);
+				if(dim==2) calvingratey_input->GetInputValue(&c[1],gauss);
+				meltingrate_input->GetInputValue(&meltingrate,gauss);
+				norm_calving=0.;
+				for(i=0;i<dim;i++) norm_calving+=pow(c[i],2);
+				norm_calving=sqrt(norm_calving)+1.e-14;
+				for(i=0;i<dim;i++) m[i]=meltingrate*c[i]/norm_calving;
+				break;
+
+			case CalvingMinthicknessEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+				meltingrate_input->GetInputValue(&meltingrate,gauss);
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=0.;
+				 }
+				break;
+
+			case CalvingHabEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+				meltingrate_input->GetInputValue(&meltingrate,gauss);
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=0.;
+				 }
+				break;
+
+			case CalvingCrevasseDepthEnum:
+				lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
+				if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+				meltingrate_input->GetInputValue(&meltingrate,gauss);
+
+				if(groundedice<0) meltingrate = 0.;
+
+				norm_dlsf=0.;
+				for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+				norm_dlsf=sqrt(norm_dlsf);
+
+				if(norm_dlsf>1.e-10)
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+				 }
+				else
+				 for(i=0;i<dim;i++){
+					 c[i]=0.;
+					 m[i]=0.;
+				 }
+				break;
+
+			case CalvingDev2Enum:
+				  {
+					lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
+					if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+					calvingrate_input->GetInputValue(&calvingrate,gauss);
+					meltingrate_input->GetInputValue(&meltingrate,gauss);
+					gr_input->GetInputValue(&groundedice,gauss);
+
+					//idea: no retreat on ice above critical calving height "calvinghaf" . Limit using regularized Heaviside function.
+					vel=sqrt(v[0]*v[0] + v[1]*v[1]);
+					haf_eps=10.;
+					if(groundedice-calvinghaf<=-haf_eps){
+						// ice floats freely below calvinghaf: calve freely
+						// undercutting has no effect:
+						meltingrate=0.;
+					}
+					else if(groundedice-calvinghaf>=haf_eps){
+						// ice is well above calvinghaf -> no calving back, i.e. limit calving rate to ice velocity
+						calvingrate=min(calvingrate,vel);
+						// ice is almost grounded: frontal undercutting has maximum effect (do nothing).
+					}
+					else{ // ice is close to calvinghaf: smooth transition between limitation and free calving.
+						//heaviside: 0 for floating, 1 for grounded
+						heaviside=(groundedice-calvinghaf+haf_eps)/(2.*haf_eps) + sin(PI*(groundedice-calvinghaf)/haf_eps)/(2.*PI);
+						calvingrate=heaviside*(min(calvingrate,vel)-calvingrate)+calvingrate;
+						meltingrate=heaviside*meltingrate+0.;
+					}
+
+					norm_dlsf=0.;
+					for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+					norm_dlsf=sqrt(norm_dlsf);
+
+					if(norm_dlsf>1.e-10)
+					 for(i=0;i<dim;i++){
+						 c[i]=calvingrate*dlsf[i]/norm_dlsf;
+						 m[i]=meltingrate*dlsf[i]/norm_dlsf;
+					 }
+					else
+					 for(i=0;i<dim;i++){
+						 c[i]=0.;
+						 m[i]=0.;
+					 }
+					break;
+				  }
+
+			default:
+				_error_("Calving law "<<EnumToStringx(calvinglaw)<<" not supported yet");
+		}
+		for(i=0;i<dim;i++) w[i]=v[i]-c[i]-m[i];
+				
+		movingfrontvx[iv] = w[0];
+		movingfrontvy[iv] = w[1];		
+	}
+
+	/*Add input*/
+	this->AddInput(MovingFrontalVxEnum,&movingfrontvx[0],P1DGEnum);
+	this->AddInput(MovingFrontalVyEnum,&movingfrontvy[0],P1DGEnum);
+
+	/*Clean up and return*/
+	delete gauss;
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Elements/Tria.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tria.h	(revision 25838)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tria.h	(revision 25839)
@@ -202,4 +202,5 @@
 		void           JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss);
 		IssmDouble     MinEdgeLength(IssmDouble* xyz_list){_error_("not implemented yet");};
+		void	       MovingFrontalVelocity(void);
 		Gauss*         NewGauss(void);
 		Gauss*         NewGauss(int order);
Index: /issm/trunk-jpl/src/c/cores/movingfront_core.cpp
===================================================================
--- /issm/trunk-jpl/src/c/cores/movingfront_core.cpp	(revision 25838)
+++ /issm/trunk-jpl/src/c/cores/movingfront_core.cpp	(revision 25839)
@@ -111,4 +111,6 @@
 	}
 
+	/* Calculate the frontal velocity for levelset function */
+	MovingFrontalVelx(femmodel);
 
 	/* solve level set equation */
Index: /issm/trunk-jpl/src/c/modules/modules.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/modules.h	(revision 25838)
+++ /issm/trunk-jpl/src/c/modules/modules.h	(revision 25839)
@@ -72,4 +72,5 @@
 #include "./SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.h"
 #include "./ModelProcessorx/ModelProcessorx.h"
+#include "./MovingFrontalVelx/MovingFrontalVelx.h"
 #include "./ParseToolkitsOptionsx/ParseToolkitsOptionsx.h"
 #include "./NodalValuex/NodalValuex.h"
Index: /issm/trunk-jpl/src/c/shared/Enum/Enum.vim
===================================================================
--- /issm/trunk-jpl/src/c/shared/Enum/Enum.vim	(revision 25838)
+++ /issm/trunk-jpl/src/c/shared/Enum/Enum.vim	(revision 25839)
@@ -689,4 +689,6 @@
 syn keyword cConstant MeshVertexonsurfaceEnum
 syn keyword cConstant MisfitEnum
+syn keyword cConstant MovingFrontalVxEnum
+syn keyword cConstant MovingFrontalVyEnum
 syn keyword cConstant NeumannfluxEnum
 syn keyword cConstant NewDamageEnum
Index: /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 25838)
+++ /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 25839)
@@ -685,4 +685,6 @@
 	MeshVertexonsurfaceEnum,
 	MisfitEnum,
+	MovingFrontalVxEnum,
+	MovingFrontalVyEnum,
 	NeumannfluxEnum,
 	NewDamageEnum,
Index: /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 25838)
+++ /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 25839)
@@ -691,4 +691,6 @@
 		case MeshVertexonsurfaceEnum : return "MeshVertexonsurface";
 		case MisfitEnum : return "Misfit";
+		case MovingFrontalVxEnum : return "MovingFrontalVx";
+		case MovingFrontalVyEnum : return "MovingFrontalVy";
 		case NeumannfluxEnum : return "Neumannflux";
 		case NewDamageEnum : return "NewDamage";
Index: /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 25838)
+++ /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 25839)
@@ -706,4 +706,6 @@
 	      else if (strcmp(name,"MeshVertexonsurface")==0) return MeshVertexonsurfaceEnum;
 	      else if (strcmp(name,"Misfit")==0) return MisfitEnum;
+	      else if (strcmp(name,"MovingFrontalVx")==0) return MovingFrontalVxEnum;
+	      else if (strcmp(name,"MovingFrontalVy")==0) return MovingFrontalVyEnum;
 	      else if (strcmp(name,"Neumannflux")==0) return NeumannfluxEnum;
 	      else if (strcmp(name,"NewDamage")==0) return NewDamageEnum;
@@ -750,10 +752,10 @@
 	      else if (strcmp(name,"SealevelriseG")==0) return SealevelriseGEnum;
 	      else if (strcmp(name,"SealevelriseGU")==0) return SealevelriseGUEnum;
-	      else if (strcmp(name,"SealevelriseGE")==0) return SealevelriseGEEnum;
-	      else if (strcmp(name,"SealevelriseGN")==0) return SealevelriseGNEnum;
          else stage=7;
    }
    if(stage==7){
-	      if (strcmp(name,"SedimentHead")==0) return SedimentHeadEnum;
+	      if (strcmp(name,"SealevelriseGE")==0) return SealevelriseGEEnum;
+	      else if (strcmp(name,"SealevelriseGN")==0) return SealevelriseGNEnum;
+	      else if (strcmp(name,"SedimentHead")==0) return SedimentHeadEnum;
 	      else if (strcmp(name,"SedimentHeadOld")==0) return SedimentHeadOldEnum;
 	      else if (strcmp(name,"SedimentHeadSubstep")==0) return SedimentHeadSubstepEnum;
@@ -873,10 +875,10 @@
 	      else if (strcmp(name,"StressMaxPrincipal")==0) return StressMaxPrincipalEnum;
 	      else if (strcmp(name,"StressTensorxx")==0) return StressTensorxxEnum;
-	      else if (strcmp(name,"StressTensorxy")==0) return StressTensorxyEnum;
-	      else if (strcmp(name,"StressTensorxz")==0) return StressTensorxzEnum;
          else stage=8;
    }
    if(stage==8){
-	      if (strcmp(name,"StressTensoryy")==0) return StressTensoryyEnum;
+	      if (strcmp(name,"StressTensorxy")==0) return StressTensorxyEnum;
+	      else if (strcmp(name,"StressTensorxz")==0) return StressTensorxzEnum;
+	      else if (strcmp(name,"StressTensoryy")==0) return StressTensoryyEnum;
 	      else if (strcmp(name,"StressTensoryz")==0) return StressTensoryzEnum;
 	      else if (strcmp(name,"StressTensorzz")==0) return StressTensorzzEnum;
@@ -996,10 +998,10 @@
 	      else if (strcmp(name,"Outputdefinition69")==0) return Outputdefinition69Enum;
 	      else if (strcmp(name,"Outputdefinition6")==0) return Outputdefinition6Enum;
-	      else if (strcmp(name,"Outputdefinition70")==0) return Outputdefinition70Enum;
-	      else if (strcmp(name,"Outputdefinition71")==0) return Outputdefinition71Enum;
          else stage=9;
    }
    if(stage==9){
-	      if (strcmp(name,"Outputdefinition72")==0) return Outputdefinition72Enum;
+	      if (strcmp(name,"Outputdefinition70")==0) return Outputdefinition70Enum;
+	      else if (strcmp(name,"Outputdefinition71")==0) return Outputdefinition71Enum;
+	      else if (strcmp(name,"Outputdefinition72")==0) return Outputdefinition72Enum;
 	      else if (strcmp(name,"Outputdefinition73")==0) return Outputdefinition73Enum;
 	      else if (strcmp(name,"Outputdefinition74")==0) return Outputdefinition74Enum;
@@ -1119,10 +1121,10 @@
 	      else if (strcmp(name,"EsaTransitions")==0) return EsaTransitionsEnum;
 	      else if (strcmp(name,"ExternalResult")==0) return ExternalResultEnum;
-	      else if (strcmp(name,"ExtrapolationAnalysis")==0) return ExtrapolationAnalysisEnum;
-	      else if (strcmp(name,"ExtrudeFromBaseAnalysis")==0) return ExtrudeFromBaseAnalysisEnum;
          else stage=10;
    }
    if(stage==10){
-	      if (strcmp(name,"ExtrudeFromTopAnalysis")==0) return ExtrudeFromTopAnalysisEnum;
+	      if (strcmp(name,"ExtrapolationAnalysis")==0) return ExtrapolationAnalysisEnum;
+	      else if (strcmp(name,"ExtrudeFromBaseAnalysis")==0) return ExtrudeFromBaseAnalysisEnum;
+	      else if (strcmp(name,"ExtrudeFromTopAnalysis")==0) return ExtrudeFromTopAnalysisEnum;
 	      else if (strcmp(name,"FSApproximation")==0) return FSApproximationEnum;
 	      else if (strcmp(name,"FSSolver")==0) return FSSolverEnum;
@@ -1242,10 +1244,10 @@
 	      else if (strcmp(name,"MaxDivergence")==0) return MaxDivergenceEnum;
 	      else if (strcmp(name,"MaxVel")==0) return MaxVelEnum;
-	      else if (strcmp(name,"MaxVx")==0) return MaxVxEnum;
-	      else if (strcmp(name,"MaxVy")==0) return MaxVyEnum;
          else stage=11;
    }
    if(stage==11){
-	      if (strcmp(name,"MaxVz")==0) return MaxVzEnum;
+	      if (strcmp(name,"MaxVx")==0) return MaxVxEnum;
+	      else if (strcmp(name,"MaxVy")==0) return MaxVyEnum;
+	      else if (strcmp(name,"MaxVz")==0) return MaxVzEnum;
 	      else if (strcmp(name,"Melange")==0) return MelangeEnum;
 	      else if (strcmp(name,"MeltingAnalysis")==0) return MeltingAnalysisEnum;
@@ -1365,10 +1367,10 @@
 	      else if (strcmp(name,"SubelementMelt1")==0) return SubelementMelt1Enum;
 	      else if (strcmp(name,"SubelementMelt2")==0) return SubelementMelt2Enum;
-	      else if (strcmp(name,"SubelementMigration")==0) return SubelementMigrationEnum;
-	      else if (strcmp(name,"SurfaceSlopeSolution")==0) return SurfaceSlopeSolutionEnum;
          else stage=12;
    }
    if(stage==12){
-	      if (strcmp(name,"TaylorHood")==0) return TaylorHoodEnum;
+	      if (strcmp(name,"SubelementMigration")==0) return SubelementMigrationEnum;
+	      else if (strcmp(name,"SurfaceSlopeSolution")==0) return SurfaceSlopeSolutionEnum;
+	      else if (strcmp(name,"TaylorHood")==0) return TaylorHoodEnum;
 	      else if (strcmp(name,"Tetra")==0) return TetraEnum;
 	      else if (strcmp(name,"TetraInput")==0) return TetraInputEnum;
Index: /issm/trunk-jpl/test/NightlyRun/test540.m
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test540.m	(revision 25838)
+++ /issm/trunk-jpl/test/NightlyRun/test540.m	(revision 25839)
@@ -16,4 +16,5 @@
 pos = find(md.mesh.vertexonboundary);
 md.levelset.spclevelset(pos) = md.mask.ice_levelset(pos);
+md.levelset.migration_max = 1e10;
 
 %Force MUMPS sequential analysis
Index: /issm/trunk-jpl/test/NightlyRun/test541.m
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test541.m	(revision 25838)
+++ /issm/trunk-jpl/test/NightlyRun/test541.m	(revision 25839)
@@ -16,4 +16,5 @@
 pos = find(md.mesh.vertexonboundary);
 md.levelset.spclevelset(pos) = md.mask.ice_levelset(pos);
+md.levelset.migration_max = 1e10;
 
 %Force MUMPS sequential analysis
Index: /issm/trunk-jpl/test/NightlyRun/test804.m
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test804.m	(revision 25838)
+++ /issm/trunk-jpl/test/NightlyRun/test804.m	(revision 25839)
@@ -17,4 +17,5 @@
 md.calving.calvingrate=1000.*ones(md.mesh.numberofvertices,1);
 md.frontalforcings.meltingrate=zeros(md.mesh.numberofvertices,1);
+md.levelset.migration_max = 1e10;
 
 md=solve(md,'Transient');
Index: /issm/trunk-jpl/test/NightlyRun/test805.m
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test805.m	(revision 25838)
+++ /issm/trunk-jpl/test/NightlyRun/test805.m	(revision 25839)
@@ -26,4 +26,5 @@
 md.groundingline.melt_interpolation='SubelementMelt1';
 md.levelset.stabilization=2;
+md.levelset.migration_max = 1e10;
 
 md=solve(md,'Transient');
Index: /issm/trunk-jpl/test/NightlyRun/test806.m
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test806.m	(revision 25838)
+++ /issm/trunk-jpl/test/NightlyRun/test806.m	(revision 25839)
@@ -32,4 +32,5 @@
 md.frontalforcings.meltingrate=zeros(md.mesh.numberofvertices,1);
 md.levelset.spclevelset=NaN(md.mesh.numberofvertices,1);
+md.levelset.migration_max = 1e8;
 
 md.transient.requested_outputs={'default','StrainRateparallel','StrainRateperpendicular','Calvingratex','Calvingratey','CalvingCalvingrate'};
Index: /issm/trunk-jpl/test/NightlyRun/test808.m
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test808.m	(revision 25838)
+++ /issm/trunk-jpl/test/NightlyRun/test808.m	(revision 25839)
@@ -33,4 +33,5 @@
 md.levelset.spclevelset=NaN(md.mesh.numberofvertices,1);
 md.levelset.reinit_frequency=1;
+md.levelset.migration_max = 1e10;
 
 md=solve(md,'Transient');
Index: /issm/trunk-jpl/test/NightlyRun/test809.m
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test809.m	(revision 25838)
+++ /issm/trunk-jpl/test/NightlyRun/test809.m	(revision 25839)
@@ -23,4 +23,5 @@
 md.levelset.spclevelset=NaN(md.mesh.numberofvertices,1);
 md.levelset.reinit_frequency=1;
+md.levelset.migration_max = 1e10;
 
 md=solve(md,'Transient');
