Index: ../trunk-jpl/src/c/analyses/AdjointBalancethickness2Analysis.cpp
===================================================================
--- ../trunk-jpl/src/c/analyses/AdjointBalancethickness2Analysis.cpp	(revision 18714)
+++ ../trunk-jpl/src/c/analyses/AdjointBalancethickness2Analysis.cpp	(revision 18715)
@@ -148,7 +148,7 @@
 void AdjointBalancethickness2Analysis::GradientJOmega(Element* element,Vector<IssmDouble>* gradient,int control_index){/*{{{*/
 
 	/*Intermediaries*/
-	IssmDouble dlambda[2],ds[2],D0,Jdet; 
+	IssmDouble dlambda[2],ds[2],D0,omega,Jdet; 
 	IssmDouble *xyz_list= NULL;
 
 	/*Fetch number of vertices for this finite element*/
@@ -165,6 +165,7 @@
 	Input* adjoint_input = element->GetInput(AdjointEnum);            _assert_(adjoint_input);
 	Input* s_input       = element->GetInput(SurfaceEnum);            _assert_(s_input);
 	Input* D0_input      = element->GetInput(BalancethicknessD0Enum); _assert_(D0_input);
+	Input* omega_input   = element->GetInput(BalancethicknessOmegaEnum); _assert_(omega_input);
 
 	Gauss* gauss=element->NewGauss(2);
 	for(int ig=gauss->begin();ig<gauss->end();ig++){
@@ -174,12 +175,13 @@
 		element->NodalFunctionsP1(basis,gauss);
 
 		D0_input->GetInputValue(&D0,gauss);
+		omega_input->GetInputValue(&omega,gauss);
 		adjoint_input->GetInputDerivativeValue(&dlambda[0],xyz_list,gauss);
 		s_input->GetInputDerivativeValue(&ds[0],xyz_list,gauss);
 
 		/*Build gradient vector (actually -dJ/da): */
 		for(int i=0;i<numvertices;i++){
-			ge[i]+= -Jdet*gauss->weight*basis[i]*D0*(ds[0]*dlambda[0] + ds[1]*dlambda[1]);
+			ge[i]+= -Jdet*gauss->weight*basis[i]*exp(omega)*D0*(ds[0]*dlambda[0] + ds[1]*dlambda[1]);
 			_assert_(!xIsNan<IssmDouble>(ge[i]));
 		}
 	}
Index: ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp
===================================================================
--- ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp	(revision 18714)
+++ ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp	(revision 18715)
@@ -97,7 +97,7 @@
 
 		for(int i=0;i<numnodes;i++){
 			for(int j=0;j<numnodes;j++){
-				Ke->values[i*numnodes+j] += D0*omega*gauss->weight*Jdet*(dbasis[0*numnodes+i]*dbasis[0*numnodes+j] + dbasis[1*numnodes+i]*dbasis[1*numnodes+j]);
+				Ke->values[i*numnodes+j] += D0*exp(omega)*gauss->weight*Jdet*(dbasis[0*numnodes+i]*dbasis[0*numnodes+j] + dbasis[1*numnodes+i]*dbasis[1*numnodes+j]);
 			}
 		}
 	}
Index: ../trunk-jpl/src/c/cores/balancethickness2_core.cpp
===================================================================
--- ../trunk-jpl/src/c/cores/balancethickness2_core.cpp	(revision 18714)
+++ ../trunk-jpl/src/c/cores/balancethickness2_core.cpp	(revision 18715)
@@ -13,18 +13,19 @@
 
 	/*parameters: */
 	bool        save_results;
-	IssmDouble  l = 8.;
+	IssmDouble  l = 3.;
 
 	/*recover parameters: */
 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 
 	if(VerboseSolution()) _printf0_("computing smooth surface slopes:\n");
-	femmodel->parameters->SetParam(l,SmoothThicknessMultiplierEnum);
-	femmodel->SetCurrentConfiguration(SmoothAnalysisEnum);
-	femmodel->parameters->SetParam(SurfaceSlopeXEnum,InputToSmoothEnum);
-	solutionsequence_linear(femmodel);
-	femmodel->parameters->SetParam(SurfaceSlopeYEnum,InputToSmoothEnum);
-	solutionsequence_linear(femmodel);
+	//femmodel->parameters->SetParam(l,SmoothThicknessMultiplierEnum);
+	//femmodel->SetCurrentConfiguration(SmoothAnalysisEnum);
+	//femmodel->parameters->SetParam(SurfaceSlopeXEnum,InputToSmoothEnum);
+	//solutionsequence_linear(femmodel);
+	//femmodel->parameters->SetParam(SurfaceSlopeYEnum,InputToSmoothEnum);
+	//solutionsequence_linear(femmodel);
+	surfaceslope_core(femmodel);
 
 	if(VerboseSolution()) _printf0_("call computational core:\n");
 	femmodel->SetCurrentConfiguration(Balancethickness2AnalysisEnum);
Index: ../trunk-jpl/src/c/classes/FemModel.cpp
===================================================================
--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 18714)
+++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 18715)
@@ -482,6 +482,7 @@
 			break;
 
 		case Balancethickness2SolutionEnum:
+			analyses_temp[numanalyses++]=L2ProjectionBaseAnalysisEnum;
 			analyses_temp[numanalyses++]=SmoothAnalysisEnum;
 			analyses_temp[numanalyses++]=Balancethickness2AnalysisEnum;
 			break;
