Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
===================================================================
--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 18741)
+++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 18742)
@@ -99,7 +99,7 @@
 	Element* basalelement = element->SpawnBasalElement();
 
 	/*Intermediaries */
-	int  dim, domaintype;
+	int  dim, domaintype, iscalvingrate;
 	int i, row, col;
 	IssmDouble kappa;
 	IssmDouble Jdet, dt, D_scalar;
@@ -108,7 +108,8 @@
 //	IssmDouble norm_dlsf;
 	IssmDouble* xyz_list = NULL;
 
-	/*Get problem dimension*/
+	/*Get problem dimension and whether there is calving or not*/
+	basalelement->FindParam(&iscalvingrate,MasstransportIscalvingrateEnum);
 	basalelement->FindParam(&domaintype,DomainTypeEnum);
 	switch(domaintype){
 		case Domain2DverticalEnum:   dim = 1; break;
@@ -141,19 +142,25 @@
 	if(domaintype==Domain2DhorizontalEnum){
 		vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
 		vy_input=basalelement->GetInput(VyEnum); _assert_(vy_input);
-		calvingratex_input=basalelement->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
-		calvingratey_input=basalelement->GetInput(CalvingrateyEnum); _assert_(calvingratey_input);
+		if(iscalvingrate){
+			calvingratex_input=basalelement->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
+			calvingratey_input=basalelement->GetInput(CalvingrateyEnum); _assert_(calvingratey_input);
+		}
 	}
 	else{
 		if(dim==1){
 			vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
-			calvingratex_input=basalelement->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
+			if(iscalvingrate){
+				calvingratex_input=basalelement->GetInput(CalvingratexEnum); _assert_(calvingratex_input);
+			}
 		}
 		if(dim==2){
 			vx_input=basalelement->GetInput(VxAverageEnum); _assert_(vx_input);
 			vy_input=basalelement->GetInput(VyAverageEnum); _assert_(vy_input);
-			calvingratex_input=basalelement->GetInput(CalvingratexAverageEnum); _assert_(calvingratex_input);
-			calvingratey_input=basalelement->GetInput(CalvingrateyAverageEnum); _assert_(calvingratey_input);
+			if(iscalvingrate){
+				calvingratex_input=basalelement->GetInput(CalvingratexAverageEnum); _assert_(calvingratex_input);
+				calvingratey_input=basalelement->GetInput(CalvingrateyAverageEnum); _assert_(calvingratey_input);
+			}
 		}
 	}
 
@@ -184,8 +191,14 @@
 		GetBprime(Bprime,basalelement,xyz_list,gauss); 
 		vx_input->GetInputValue(&v[0],gauss); // in 3D case, add mesh velocity 
 		vy_input->GetInputValue(&v[1],gauss); 
-		calvingratex_input->GetInputValue(&c[0],gauss); // in 3D case, add mesh velocity 
-		calvingratey_input->GetInputValue(&c[1],gauss); 
+		if(iscalvingrate){
+			calvingratex_input->GetInputValue(&c[0],gauss); // in 3D case, add mesh velocity 
+			calvingratey_input->GetInputValue(&c[1],gauss); 
+			for(i=0;i<dim;i++) w[i]=v[i]-c[i];
+		}
+		else{
+			for(i=0;i<dim;i++) w[i]=v[i];
+		}
 		//lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
 		//lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
 		//calvingrate_input->GetInputValue(&calvingrate,gauss);
@@ -199,7 +212,6 @@
 		//else
 		//for(i=0;i<dim;i++) c[i]=0.;
 		
-		for(i=0;i<dim;i++) w[i]=v[i]-c[i];
 
 		for(row=0;row<dim;row++)
 			for(col=0;col<dim;col++)
