Index: ../trunk-jpl/test/NightlyRun/test530.py
===================================================================
--- ../trunk-jpl/test/NightlyRun/test530.py	(revision 18592)
+++ ../trunk-jpl/test/NightlyRun/test530.py	(revision 18593)
@@ -15,10 +15,10 @@
 md=solve(md,BalancevelocitySolutionEnum())
 
 # Fields and tolerances to track changes
-field_names     =['SurfaceSlopeX','SurfaceSlopeY','Vel']
+field_names     =['DrivingStressX','DrivingStressY','Vel']
 field_tolerances=[1e-13,1e-13,1e-13]
 field_values=[\
-		md.results.BalancevelocitySolution.SurfaceSlopeX,\
-		md.results.BalancevelocitySolution.SurfaceSlopeY,\
+		md.results.BalancevelocitySolution.DrivingStressX,\
+		md.results.BalancevelocitySolution.DrivingStressY,\
 		md.results.BalancevelocitySolution.Vel,\
 		]
Index: ../trunk-jpl/test/NightlyRun/test531.py
===================================================================
--- ../trunk-jpl/test/NightlyRun/test531.py	(revision 18592)
+++ ../trunk-jpl/test/NightlyRun/test531.py	(revision 18593)
@@ -17,10 +17,10 @@
 md=solve(md,BalancevelocitySolutionEnum())
 
 # Fields and tolerances to track changes
-field_names     =['SurfaceSlopeX','SurfaceSlopeY','Vel']
+field_names     =['DrivingStressX','DrivingStressY','Vel']
 field_tolerances=[1e-13,1e-13,1e-13]
 field_values=[\
-		md.results.BalancevelocitySolution.SurfaceSlopeX,\
-		md.results.BalancevelocitySolution.SurfaceSlopeY,\
+		md.results.BalancevelocitySolution.DrivingStressX,\
+		md.results.BalancevelocitySolution.DrivingStressY,\
 		md.results.BalancevelocitySolution.Vel,\
 		]
Index: ../trunk-jpl/test/NightlyRun/test530.m
===================================================================
--- ../trunk-jpl/test/NightlyRun/test530.m	(revision 18592)
+++ ../trunk-jpl/test/NightlyRun/test530.m	(revision 18593)
@@ -6,10 +6,10 @@
 md=solve(md,BalancevelocitySolutionEnum());
 
 %Fields and tolerances to track changes
-field_names     ={'SurfaceSlopeX','SurfaceSlopeX','Vel'};
+field_names     ={'DrivingStressX','DrivingStressX','Vel'};
 field_tolerances={1e-13,1e-13,1e-13};
 field_values={...
-	(md.results.BalancevelocitySolution.SurfaceSlopeX),...
-	(md.results.BalancevelocitySolution.SurfaceSlopeY),...
+	(md.results.BalancevelocitySolution.DrivingStressX),...
+	(md.results.BalancevelocitySolution.DrivingStressY),...
 	(md.results.BalancevelocitySolution.Vel),...
 	};
Index: ../trunk-jpl/test/NightlyRun/test531.m
===================================================================
--- ../trunk-jpl/test/NightlyRun/test531.m	(revision 18592)
+++ ../trunk-jpl/test/NightlyRun/test531.m	(revision 18593)
@@ -8,10 +8,10 @@
 md=solve(md,BalancevelocitySolutionEnum());
 
 %Fields and tolerances to track changes
-field_names     ={'SurfaceSlopeX','SurfaceSlopeX','Vel'};
+field_names     ={'DrivingStressX','DrivingStressX','Vel'};
 field_tolerances={1e-13,1e-13,1e-13};
 field_values={...
-	(md.results.BalancevelocitySolution.SurfaceSlopeX),...
-	(md.results.BalancevelocitySolution.SurfaceSlopeY),...
+	(md.results.BalancevelocitySolution.DrivingStressX),...
+	(md.results.BalancevelocitySolution.DrivingStressY),...
 	(md.results.BalancevelocitySolution.Vel),...
 	};
Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h
===================================================================
--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 18592)
+++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.h	(revision 18593)
@@ -1,33 +0,0 @@
-/*! \file SmoothedSurfaceSlopeYAnalysis.h 
- *  \brief: header file for generic external result object
- */
-
-#ifndef _SmoothedSurfaceSlopeYAnalysis_
-#define _SmoothedSurfaceSlopeYAnalysis_
-
-/*Headers*/
-#include "./Analysis.h"
-
-class SmoothedSurfaceSlopeYAnalysis: public Analysis{
-
-	public:
-		/*Model processing*/
-		int  DofsPerNode(int** doflist,int domaintype,int approximation);
-		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
-		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
-		void CreateNodes(Nodes* nodes,IoModel* iomodel);
-		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
-		void CreateLoads(Loads* loads, IoModel* iomodel);
-
-		/*Finite element Analysis*/
-		void           Core(FemModel* femmodel);
-		ElementVector* CreateDVector(Element* element);
-		ElementMatrix* CreateJacobianMatrix(Element* element);
-		ElementMatrix* CreateKMatrix(Element* element);
-		ElementVector* CreatePVector(Element* element);
-		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
-		void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
-		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
-		void UpdateConstraints(FemModel* femmodel);
-};
-#endif
Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
===================================================================
--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 18592)
+++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 18593)
@@ -1,183 +0,0 @@
-#include "./SmoothedSurfaceSlopeXAnalysis.h"
-#include "../toolkits/toolkits.h"
-#include "../classes/classes.h"
-#include "../shared/shared.h"
-#include "../modules/modules.h"
-
-/*Model processing*/
-int  SmoothedSurfaceSlopeXAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
-	return 1;
-}/*}}}*/
-void SmoothedSurfaceSlopeXAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
-}/*}}}*/
-void SmoothedSurfaceSlopeXAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
-
-	/*Update elements: */
-	int counter=0;
-	for(int i=0;i<iomodel->numberofelements;i++){
-		if(iomodel->my_elements[i]){
-			Element* element=(Element*)elements->GetObjectByOffset(counter);
-			element->Update(i,iomodel,analysis_counter,analysis_type,P1Enum);
-			counter++;
-		}
-	}
-
-	iomodel->FetchDataToInput(elements,SurfaceEnum);
-	iomodel->FetchDataToInput(elements,BaseEnum);
-	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
-	if(iomodel->domaintype!=Domain2DhorizontalEnum){
-		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
-		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
-	}
-}/*}}}*/
-void SmoothedSurfaceSlopeXAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
-	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
-	::CreateNodes(nodes,iomodel,SmoothedSurfaceSlopeXAnalysisEnum,P1Enum);
-	if(iomodel->domaintype==Domain3DEnum) iomodel->DeleteData(1,MeshVertexonbaseEnum);
-}/*}}}*/
-void SmoothedSurfaceSlopeXAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
-}/*}}}*/
-void SmoothedSurfaceSlopeXAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
-}/*}}}*/
-
-/*Finite Element Analysis*/
-void           SmoothedSurfaceSlopeXAnalysis::Core(FemModel* femmodel){/*{{{*/
-	_error_("not implemented");
-}/*}}}*/
-ElementVector* SmoothedSurfaceSlopeXAnalysis::CreateDVector(Element* element){/*{{{*/
-	/*Default, return NULL*/
-	return NULL;
-}/*}}}*/
-ElementMatrix* SmoothedSurfaceSlopeXAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
-_error_("Not implemented");
-}/*}}}*/
-ElementMatrix* SmoothedSurfaceSlopeXAnalysis::CreateKMatrix(Element* element){/*{{{*/
-
-	/* Intermediaries */
-	IssmDouble  Jdet,thickness,l=8.;
-	IssmDouble *xyz_list = NULL;
-
-	/*Fetch number of nodes and dof for this finite element*/
-	int numnodes = element->GetNumberOfNodes();
-
-	/*Initialize Element matrix and vectors*/
-	ElementMatrix* Ke     = element->NewElementMatrix();
-	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
-
-	/*Retrieve all inputs and parameters*/
-	element->GetVerticesCoordinates(&xyz_list);
-	Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input);
-
-	/* Start looping on the number of gaussian points: */
-	Gauss* gauss=element->NewGauss(2);
-	for(int ig=gauss->begin();ig<gauss->end();ig++){
-		gauss->GaussPoint(ig);
-
-		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
-		thickness_input->GetInputValue(&thickness,gauss);
-		if(thickness<50.) thickness=50.;
-
-		element->NodalFunctions(basis,gauss);
-		element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
-
-		for(int i=0;i<numnodes;i++){
-			for(int j=0;j<numnodes;j++){
-				Ke->values[i*numnodes+j] += gauss->weight*Jdet*(
-							basis[i]*basis[j]
-							+(l*thickness)*(l*thickness)*(dbasis[0*numnodes+i]*dbasis[0*numnodes+j] + dbasis[1*numnodes+i]*dbasis[1*numnodes+j])
-							);
-			}
-		}
-	}
-
-	/*Clean up and return*/
-	delete gauss;
-	xDelete<IssmDouble>(dbasis);
-	xDelete<IssmDouble>(basis);
-	xDelete<IssmDouble>(xyz_list);
-	return Ke;
-}/*}}}*/
-ElementVector* SmoothedSurfaceSlopeXAnalysis::CreatePVector(Element* element){/*{{{*/
-
-	/*Intermediaries*/
-	int      domaintype;
-	Element* basalelement;
-
-	/*Get basal element*/
-	element->FindParam(&domaintype,DomainTypeEnum);
-	switch(domaintype){
-		case Domain2DhorizontalEnum:
-			basalelement = element;
-			break;
-		case Domain3DEnum:
-			if(!element->IsOnBase()) return NULL;
-			basalelement = element->SpawnBasalElement();
-			break;
-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
-	}
-
-	/*Intermediaries */
-	int         input_enum;
-	IssmDouble  Jdet,thickness,slope[2];
-	IssmDouble  taud_x,norms,normv,vx,vy;
-	IssmDouble *xyz_list  = NULL;
-
-	/*Fetch number of nodes and dof for this finite element*/
-	int numnodes = basalelement->GetNumberOfNodes();
-
-	/*Initialize Element vector*/
-	ElementVector* pe    = basalelement->NewElementVector();
-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
-
-	/*Retrieve all inputs and parameters*/
-	basalelement->GetVerticesCoordinates(&xyz_list);
-	IssmDouble rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
-	IssmDouble gravity   = element->GetMaterialParameter(ConstantsGEnum);
-	Input* H_input       = basalelement->GetInput(ThicknessEnum); _assert_(H_input);
-	Input* surface_input = basalelement->GetInput(SurfaceEnum);   _assert_(surface_input);
-	Input* vx_input      = basalelement->GetInput(VxEnum);
-	Input* vy_input      = basalelement->GetInput(VyEnum);
-
-	/* Start  looping on the number of gaussian points: */
-	Gauss* gauss=basalelement->NewGauss(2);
-	for(int ig=gauss->begin();ig<gauss->end();ig++){
-		gauss->GaussPoint(ig);
-
-		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
-		basalelement->NodalFunctions(basis,gauss);
-
-		H_input->GetInputValue(&thickness,gauss);
-		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
-		if(vx_input && vy_input){
-			vx_input->GetInputValue(&vx,gauss);
-			vy_input->GetInputValue(&vy,gauss);
-			norms = sqrt(slope[0]*slope[0]+slope[1]*slope[1]+1.e-10);
-			normv = sqrt(vx*vx + vy*vy);
-			if(normv>15./(365.*24.*3600.)) slope[0] = -vx/normv*norms;
-		}
-		taud_x = rho_ice*gravity*thickness*slope[0];
-
-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*taud_x*basis[i];
-	}
-
-	/*Clean up and return*/
-	xDelete<IssmDouble>(xyz_list);
-	xDelete<IssmDouble>(basis);
-	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
-	return pe;
-}/*}}}*/
-void SmoothedSurfaceSlopeXAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
-	   _error_("not implemented yet");
-}/*}}}*/
-void SmoothedSurfaceSlopeXAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
-	_error_("Not implemented yet");
-}/*}}}*/
-void SmoothedSurfaceSlopeXAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
-	element->InputUpdateFromSolutionOneDof(solution,SurfaceSlopeXEnum);
-}/*}}}*/
-void SmoothedSurfaceSlopeXAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
-	/*Default, do nothing*/
-	return;
-}/*}}}*/
Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
===================================================================
--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 18592)
+++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 18593)
@@ -1,182 +0,0 @@
-#include "./SmoothedSurfaceSlopeYAnalysis.h"
-#include "../toolkits/toolkits.h"
-#include "../classes/classes.h"
-#include "../shared/shared.h"
-#include "../modules/modules.h"
-
-/*Model processing*/
-int  SmoothedSurfaceSlopeYAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
-	return 1;
-}/*}}}*/
-void SmoothedSurfaceSlopeYAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
-}/*}}}*/
-void SmoothedSurfaceSlopeYAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
-
-	/*Update elements: */
-	int counter=0;
-	for(int i=0;i<iomodel->numberofelements;i++){
-		if(iomodel->my_elements[i]){
-			Element* element=(Element*)elements->GetObjectByOffset(counter);
-			element->Update(i,iomodel,analysis_counter,analysis_type,P1Enum);
-			counter++;
-		}
-	}
-
-	iomodel->FetchDataToInput(elements,SurfaceEnum);
-	iomodel->FetchDataToInput(elements,BaseEnum);
-	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
-	if(iomodel->domaintype!=Domain2DhorizontalEnum){
-		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
-		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
-	}
-}/*}}}*/
-void SmoothedSurfaceSlopeYAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
-	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(1,MeshVertexonbaseEnum);
-	::CreateNodes(nodes,iomodel,SmoothedSurfaceSlopeYAnalysisEnum,P1Enum);
-	if(iomodel->domaintype==Domain3DEnum) iomodel->DeleteData(1,MeshVertexonbaseEnum);
-}/*}}}*/
-void SmoothedSurfaceSlopeYAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
-}/*}}}*/
-void SmoothedSurfaceSlopeYAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
-}/*}}}*/
-
-/*Finite Element Analysis*/
-void           SmoothedSurfaceSlopeYAnalysis::Core(FemModel* femmodel){/*{{{*/
-	_error_("not implemented");
-}/*}}}*/
-ElementVector* SmoothedSurfaceSlopeYAnalysis::CreateDVector(Element* element){/*{{{*/
-	/*Default, return NULL*/
-	return NULL;
-}/*}}}*/
-ElementMatrix* SmoothedSurfaceSlopeYAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
-_error_("Not implemented");
-}/*}}}*/
-ElementMatrix* SmoothedSurfaceSlopeYAnalysis::CreateKMatrix(Element* element){/*{{{*/
-
-	/* Intermediaries */
-	IssmDouble  Jdet,thickness,l=8.;
-	IssmDouble *xyz_list = NULL;
-
-	/*Fetch number of nodes and dof for this finite element*/
-	int numnodes = element->GetNumberOfNodes();
-
-	/*Initialize Element matrix and vectors*/
-	ElementMatrix* Ke     = element->NewElementMatrix();
-	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
-	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
-
-	/*Retrieve all inputs and parameters*/
-	element->GetVerticesCoordinates(&xyz_list);
-	Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input);
-
-	/* Start looping on the number of gaussian points: */
-	Gauss* gauss=element->NewGauss(2);
-	for(int ig=gauss->begin();ig<gauss->end();ig++){
-		gauss->GaussPoint(ig);
-
-		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
-		thickness_input->GetInputValue(&thickness,gauss);
-		if(thickness<50.) thickness=50.;
-
-		element->NodalFunctions(basis,gauss);
-		element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
-
-		for(int i=0;i<numnodes;i++){
-			for(int j=0;j<numnodes;j++){
-				Ke->values[i*numnodes+j] += gauss->weight*Jdet*(
-							basis[i]*basis[j]
-							+(l*thickness)*(l*thickness)*(dbasis[0*numnodes+i]*dbasis[0*numnodes+j] + dbasis[1*numnodes+i]*dbasis[1*numnodes+j])
-							);
-			}
-		}
-	}
-
-	/*Clean up and return*/
-	delete gauss;
-	xDelete<IssmDouble>(dbasis);
-	xDelete<IssmDouble>(basis);
-	xDelete<IssmDouble>(xyz_list);
-	return Ke;
-}/*}}}*/
-ElementVector* SmoothedSurfaceSlopeYAnalysis::CreatePVector(Element* element){/*{{{*/
-
-	/*Intermediaries*/
-	int      domaintype;
-	Element* basalelement;
-
-	/*Get basal element*/
-	element->FindParam(&domaintype,DomainTypeEnum);
-	switch(domaintype){
-		case Domain2DhorizontalEnum:
-			basalelement = element;
-			break;
-		case Domain3DEnum:
-			if(!element->IsOnBase()) return NULL;
-			basalelement = element->SpawnBasalElement();
-			break;
-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
-	}
-
-	/*Intermediaries */
-	IssmDouble  Jdet,thickness,slope[2];
-	IssmDouble  taud_y,norms,normv,vx,vy;
-	IssmDouble *xyz_list  = NULL;
-
-	/*Fetch number of nodes and dof for this finite element*/
-	int numnodes = basalelement->GetNumberOfNodes();
-
-	/*Initialize Element vector*/
-	ElementVector* pe    = basalelement->NewElementVector();
-	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
-
-	/*Retrieve all inputs and parameters*/
-	basalelement->GetVerticesCoordinates(&xyz_list);
-	IssmDouble rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
-	IssmDouble gravity   = element->GetMaterialParameter(ConstantsGEnum);
-	Input* H_input       = basalelement->GetInput(ThicknessEnum); _assert_(H_input);
-	Input* surface_input = basalelement->GetInput(SurfaceEnum);   _assert_(surface_input);
-	Input* vx_input      = basalelement->GetInput(VxEnum);
-	Input* vy_input      = basalelement->GetInput(VyEnum);
-
-	/* Start  looping on the number of gaussian points: */
-	Gauss* gauss=basalelement->NewGauss(2);
-	for(int ig=gauss->begin();ig<gauss->end();ig++){
-		gauss->GaussPoint(ig);
-
-		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
-		basalelement->NodalFunctions(basis,gauss);
-
-		H_input->GetInputValue(&thickness,gauss);
-		surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
-		if(vx_input && vy_input){
-			vx_input->GetInputValue(&vx,gauss);
-			vy_input->GetInputValue(&vy,gauss);
-			norms = sqrt(slope[0]*slope[0]+slope[1]*slope[1]+1.e-10);
-			normv = sqrt(vx*vx + vy*vy);
-			if(normv>15./(365.*24.*3600.)) slope[1] = -vy/normv*norms;
-		}
-		taud_y = rho_ice*gravity*thickness*slope[1];
-
-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*taud_y*basis[i];
-	}
-
-	/*Clean up and return*/
-	xDelete<IssmDouble>(xyz_list);
-	xDelete<IssmDouble>(basis);
-	delete gauss;
-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
-	return pe;
-}/*}}}*/
-void SmoothedSurfaceSlopeYAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
-	   _error_("not implemented yet");
-}/*}}}*/
-void SmoothedSurfaceSlopeYAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
-	_error_("Not implemented yet");
-}/*}}}*/
-void SmoothedSurfaceSlopeYAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
-	element->InputUpdateFromSolutionOneDof(solution,SurfaceSlopeYEnum);
-}/*}}}*/
-void SmoothedSurfaceSlopeYAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
-	/*Default, do nothing*/
-	return;
-}/*}}}*/
Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h
===================================================================
--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 18592)
+++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.h	(revision 18593)
@@ -1,33 +0,0 @@
-/*! \file SmoothedSurfaceSlopeXAnalysis.h 
- *  \brief: header file for generic external result object
- */
-
-#ifndef _SmoothedSurfaceSlopeXAnalysis_
-#define _SmoothedSurfaceSlopeXAnalysis_
-
-/*Headers*/
-#include "./Analysis.h"
-
-class SmoothedSurfaceSlopeXAnalysis: public Analysis{
-
-	public:
-		/*Model processing*/
-		int  DofsPerNode(int** doflist,int domaintype,int approximation);
-		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
-		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
-		void CreateNodes(Nodes* nodes,IoModel* iomodel);
-		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
-		void CreateLoads(Loads* loads, IoModel* iomodel);
-
-		/*Finite element Analysis*/
-		void           Core(FemModel* femmodel);
-		ElementVector* CreateDVector(Element* element);
-		ElementMatrix* CreateJacobianMatrix(Element* element);
-		ElementMatrix* CreateKMatrix(Element* element);
-		ElementVector* CreatePVector(Element* element);
-		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
-		void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
-		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
-		void UpdateConstraints(FemModel* femmodel);
-};
-#endif
Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp
===================================================================
--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 18592)
+++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 18593)
@@ -85,12 +85,9 @@
 		#ifdef _HAVE_DEPTHAVERAGE_
 		case DepthAverageAnalysisEnum : return new DepthAverageAnalysis();
 		#endif
-		#ifdef _HAVE_SMOOTHEDSURFACESLOPEX_
-		case SmoothedSurfaceSlopeXAnalysisEnum : return new SmoothedSurfaceSlopeXAnalysis();
+		#ifdef _HAVE_SMOOTH_
+		case SmoothAnalysisEnum : return new SmoothAnalysis();
 		#endif
-		#ifdef _HAVE_SMOOTHEDSURFACESLOPEY_
-		case SmoothedSurfaceSlopeYAnalysisEnum : return new SmoothedSurfaceSlopeYAnalysis();
-		#endif
 		#ifdef _HAVE_THERMAL_
 		case ThermalAnalysisEnum : return new ThermalAnalysis();
 		#endif
Index: ../trunk-jpl/src/c/analyses/SmoothAnalysis.h
===================================================================
--- ../trunk-jpl/src/c/analyses/SmoothAnalysis.h	(revision 0)
+++ ../trunk-jpl/src/c/analyses/SmoothAnalysis.h	(revision 18593)
@@ -0,0 +1,33 @@
+/*! \file SmoothAnalysis.h 
+ *  \brief: header file for generic external result object
+ */
+
+#ifndef _SmoothAnalysis_
+#define _SmoothAnalysis_
+
+/*Headers*/
+#include "./Analysis.h"
+
+class SmoothAnalysis: public Analysis{
+
+	public:
+		/*Model processing*/
+		int  DofsPerNode(int** doflist,int domaintype,int approximation);
+		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
+		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
+		void CreateNodes(Nodes* nodes,IoModel* iomodel);
+		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
+		void CreateLoads(Loads* loads, IoModel* iomodel);
+
+		/*Finite element Analysis*/
+		void           Core(FemModel* femmodel);
+		ElementVector* CreateDVector(Element* element);
+		ElementMatrix* CreateJacobianMatrix(Element* element);
+		ElementMatrix* CreateKMatrix(Element* element);
+		ElementVector* CreatePVector(Element* element);
+		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+		void GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index);
+		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+		void UpdateConstraints(FemModel* femmodel);
+};
+#endif
Index: ../trunk-jpl/src/c/analyses/SmoothAnalysis.cpp
===================================================================
--- ../trunk-jpl/src/c/analyses/SmoothAnalysis.cpp	(revision 0)
+++ ../trunk-jpl/src/c/analyses/SmoothAnalysis.cpp	(revision 18593)
@@ -0,0 +1,227 @@
+#include "./SmoothAnalysis.h"
+#include "../toolkits/toolkits.h"
+#include "../classes/classes.h"
+#include "../shared/shared.h"
+#include "../modules/modules.h"
+
+/*Model processing*/
+int  SmoothAnalysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
+	return 1;
+}/*}}}*/
+void SmoothAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+}/*}}}*/
+void SmoothAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+
+	/*Update elements: */
+	int counter=0;
+	for(int i=0;i<iomodel->numberofelements;i++){
+		if(iomodel->my_elements[i]){
+			Element* element=(Element*)elements->GetObjectByOffset(counter);
+			element->Update(i,iomodel,analysis_counter,analysis_type,P1Enum);
+			counter++;
+		}
+	}
+}/*}}}*/
+void SmoothAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+
+	::CreateNodes(nodes,iomodel,SmoothAnalysisEnum,P1Enum);
+
+}/*}}}*/
+void SmoothAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+}/*}}}*/
+void SmoothAnalysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+}/*}}}*/
+
+/*Finite Element Analysis*/
+void           SmoothAnalysis::Core(FemModel* femmodel){/*{{{*/
+	_error_("not implemented");
+}/*}}}*/
+ElementVector* SmoothAnalysis::CreateDVector(Element* element){/*{{{*/
+	/*Default, return NULL*/
+	return NULL;
+}/*}}}*/
+ElementMatrix* SmoothAnalysis::CreateJacobianMatrix(Element* element){/*{{{*/
+_error_("Not implemented");
+}/*}}}*/
+ElementMatrix* SmoothAnalysis::CreateKMatrix(Element* element){/*{{{*/
+
+	/* Intermediaries */
+	int         domaintype;
+	IssmDouble  Jdet,thickness,l=8.;
+	IssmDouble *xyz_list = NULL;
+
+	/*Check dimension*/
+	element->FindParam(&domaintype,DomainTypeEnum);
+	switch(domaintype){
+		case Domain2DhorizontalEnum:
+			break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+
+	/*Fetch number of nodes and dof for this finite element*/
+	int numnodes = element->GetNumberOfNodes();
+
+	/*Initialize Element matrix and vectors*/
+	ElementMatrix* Ke     = element->NewElementMatrix();
+	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
+	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
+
+	/*Retrieve all inputs and parameters*/
+	element->GetVerticesCoordinates(&xyz_list);
+	Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input);
+
+	/* Start looping on the number of gaussian points: */
+	Gauss* gauss=element->NewGauss(2);
+	for(int ig=gauss->begin();ig<gauss->end();ig++){
+		gauss->GaussPoint(ig);
+
+		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+		thickness_input->GetInputValue(&thickness,gauss);
+		if(thickness<50.) thickness=50.;
+
+		element->NodalFunctions(basis,gauss);
+		element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+
+		for(int i=0;i<numnodes;i++){
+			for(int j=0;j<numnodes;j++){
+				Ke->values[i*numnodes+j] += gauss->weight*Jdet*(
+							basis[i]*basis[j]
+							+(l*thickness)*(l*thickness)*(dbasis[0*numnodes+i]*dbasis[0*numnodes+j] + dbasis[1*numnodes+i]*dbasis[1*numnodes+j])
+							);
+			}
+		}
+	}
+
+	/*Clean up and return*/
+	delete gauss;
+	xDelete<IssmDouble>(dbasis);
+	xDelete<IssmDouble>(basis);
+	xDelete<IssmDouble>(xyz_list);
+	return Ke;
+}/*}}}*/
+ElementVector* SmoothAnalysis::CreatePVector(Element* element){/*{{{*/
+
+	/*Get basal element*/
+	int domaintype;
+	element->FindParam(&domaintype,DomainTypeEnum);
+	switch(domaintype){
+		case Domain2DhorizontalEnum:
+			break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+
+	/*Intermediaries */
+	int         input_enum;
+	IssmDouble  Jdet,value;
+	IssmDouble *xyz_list  = NULL;
+	Input      *input = NULL;
+
+	/*SPECIFICS: Driving stress for balance velocities*/
+	Input*      H_input = NULL, *surface_input = NULL, *vx_input = NULL, *vy_input = NULL;
+	IssmDouble  taud_x,norms,normv,vx,vy;
+	IssmDouble  rho_ice,gravity,slope[2],thickness;
+
+	/*Fetch number of nodes and dof for this finite element*/
+	int numnodes = element->GetNumberOfNodes();
+
+	/*Initialize Element vector*/
+	ElementVector* pe    = element->NewElementVector();
+	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+
+	/*Retrieve all inputs and parameters*/
+	element->GetVerticesCoordinates(&xyz_list);
+	element->FindParam(&input_enum,InputToSmoothEnum);
+
+	switch(input_enum){
+		case DrivingStressXEnum:
+		case DrivingStressYEnum:{
+			rho_ice       = element->GetMaterialParameter(MaterialsRhoIceEnum);
+			gravity       = element->GetMaterialParameter(ConstantsGEnum);
+			H_input       = element->GetInput(ThicknessEnum); _assert_(H_input);
+			surface_input = element->GetInput(SurfaceEnum);   _assert_(surface_input);
+			vx_input      = element->GetInput(VxEnum);
+			vy_input      = element->GetInput(VyEnum);
+			}
+			break;
+		case SurfaceSlopeXEnum:
+		case SurfaceSlopeYEnum:{
+			surface_input = element->GetInput(SurfaceEnum);   _assert_(surface_input);
+			}
+			break;
+		default: input = element->GetInput(input_enum);
+	}
+
+
+	/* Start  looping on the number of gaussian points: */
+	Gauss* gauss=element->NewGauss(2);
+	for(int ig=gauss->begin();ig<gauss->end();ig++){
+		gauss->GaussPoint(ig);
+
+		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+		element->NodalFunctions(basis,gauss);
+
+
+		switch(input_enum){
+			case DrivingStressXEnum: 
+			case DrivingStressYEnum:{
+				H_input->GetInputValue(&thickness,gauss);
+				surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+				if(vx_input && vy_input){
+					vx_input->GetInputValue(&vx,gauss);
+					vy_input->GetInputValue(&vy,gauss);
+					norms = sqrt(slope[0]*slope[0]+slope[1]*slope[1]+1.e-10);
+					normv = sqrt(vx*vx + vy*vy);
+					if(normv>15./(365.*24.*3600.)){
+						slope[0] = -vx/normv*norms;
+						slope[1] = -vy/normv*norms;
+					}
+				}
+				if(input_enum==DrivingStressXEnum)
+				 value = rho_ice*gravity*thickness*slope[0];
+				else
+				 value = rho_ice*gravity*thickness*slope[1];
+			}
+			break;
+			case SurfaceSlopeXEnum: 
+				surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+				value = slope[0];
+				break;
+			case SurfaceSlopeYEnum:
+				surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+				value = slope[1];
+				break;
+			default:
+				input->GetInputValue(&value,gauss);
+		}
+
+		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*value*basis[i];
+	}
+
+	/*Clean up and return*/
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(basis);
+	delete gauss;
+	return pe;
+}/*}}}*/
+void SmoothAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+	   _error_("not implemented yet");
+}/*}}}*/
+void SmoothAnalysis::GradientJ(Vector<IssmDouble>* gradient,Element* element,int control_type,int control_index){/*{{{*/
+	_error_("Not implemented yet");
+}/*}}}*/
+void SmoothAnalysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+	int inputenum,domaintype,elementtype;
+
+	element->FindParam(&inputenum,InputToSmoothEnum);
+	element->FindParam(&domaintype,DomainTypeEnum);
+	switch(domaintype){
+		case Domain2DhorizontalEnum:
+			element->InputUpdateFromSolutionOneDof(solution,inputenum);
+			break;
+		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+}/*}}}*/
+void SmoothAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+	/*Default, do nothing*/
+	return;
+}/*}}}*/
Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
===================================================================
--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 18592)
+++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 18593)
@@ -94,8 +94,8 @@
 	h = element->CharacteristicLength();
 
 	/*Get vector N for all nodes and build HNx and HNy*/
-	element->GetInputListOnNodes(Nx,SurfaceSlopeXEnum);
-	element->GetInputListOnNodes(Ny,SurfaceSlopeYEnum);
+	element->GetInputListOnNodes(Nx,DrivingStressXEnum);
+	element->GetInputListOnNodes(Ny,DrivingStressYEnum);
 	element->GetInputListOnNodes(H,ThicknessEnum);
 	for(int i=0;i<numnodes;i++){
 		IssmDouble norm=sqrt(Nx[i]*Nx[i]+Ny[i]*Ny[i]+1.e-10);
@@ -189,8 +189,8 @@
 	IssmDouble h = basalelement->CharacteristicLength();
 
 	/*Get vector N for all nodes*/
-	basalelement->GetInputListOnNodes(Nx,SurfaceSlopeXEnum);
-	basalelement->GetInputListOnNodes(Ny,SurfaceSlopeYEnum);
+	basalelement->GetInputListOnNodes(Nx,DrivingStressXEnum);
+	basalelement->GetInputListOnNodes(Ny,DrivingStressYEnum);
 	basalelement->GetInputListOnNodes(H,ThicknessEnum);
 	for(int i=0;i<numnodes;i++){
 		IssmDouble norm=sqrt(Nx[i]*Nx[i]+Ny[i]*Ny[i]+1.e-10);
Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
===================================================================
--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 18592)
+++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 18593)
@@ -92,7 +92,7 @@
 	int numnodes = basalelement->GetNumberOfNodes();
 
 	/*Initialize Element vector*/
-	ElementMatrix* Ke    = basalelement->NewElementMatrix(NoneApproximationEnum);
+	ElementMatrix* Ke    = basalelement->NewElementMatrix();
 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
 
 	/*Retrieve all inputs and parameters*/
Index: ../trunk-jpl/src/c/analyses/analyses.h
===================================================================
--- ../trunk-jpl/src/c/analyses/analyses.h	(revision 18592)
+++ ../trunk-jpl/src/c/analyses/analyses.h	(revision 18593)
@@ -31,8 +31,7 @@
 #include "./MasstransportAnalysis.h"
 #include "./MeltingAnalysis.h"
 #include "./MeshdeformationAnalysis.h"
-#include "./SmoothedSurfaceSlopeXAnalysis.h"
-#include "./SmoothedSurfaceSlopeYAnalysis.h"
+#include "./SmoothAnalysis.h"
 #include "./SeaiceAnalysis.h"
 #include "./StressbalanceAnalysis.h"
 #include "./StressbalanceSIAAnalysis.h"
Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 18592)
+++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 18593)
@@ -387,8 +387,7 @@
 	DepthAverageAnalysisEnum,
 	SteadystateSolutionEnum,
 	SurfaceSlopeSolutionEnum,
-	SmoothedSurfaceSlopeXAnalysisEnum,
-	SmoothedSurfaceSlopeYAnalysisEnum,
+	SmoothAnalysisEnum,
 	ThermalAnalysisEnum,
 	ThermalSolutionEnum,
 	TransientSolutionEnum,
@@ -449,6 +448,7 @@
 	InputToExtrudeEnum,
 	InputToL2ProjectEnum,
 	InputToDepthaverageEnum,
+	InputToSmoothEnum,
 	IntParamEnum,
 	IntVecParamEnum,
 	TransientParamEnum,
@@ -562,6 +562,8 @@
 	ViscousHeatingEnum,
 	HydrologyWaterVxEnum,
 	HydrologyWaterVyEnum,
+	DrivingStressXEnum,
+	DrivingStressYEnum,
 	SigmaNNEnum,
 	StressTensorEnum,
 	StressTensorxxEnum,
Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 18592)
+++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 18593)
@@ -390,8 +390,7 @@
 		case DepthAverageAnalysisEnum : return "DepthAverageAnalysis";
 		case SteadystateSolutionEnum : return "SteadystateSolution";
 		case SurfaceSlopeSolutionEnum : return "SurfaceSlopeSolution";
-		case SmoothedSurfaceSlopeXAnalysisEnum : return "SmoothedSurfaceSlopeXAnalysis";
-		case SmoothedSurfaceSlopeYAnalysisEnum : return "SmoothedSurfaceSlopeYAnalysis";
+		case SmoothAnalysisEnum : return "SmoothAnalysis";
 		case ThermalAnalysisEnum : return "ThermalAnalysis";
 		case ThermalSolutionEnum : return "ThermalSolution";
 		case TransientSolutionEnum : return "TransientSolution";
@@ -446,6 +445,7 @@
 		case InputToExtrudeEnum : return "InputToExtrude";
 		case InputToL2ProjectEnum : return "InputToL2Project";
 		case InputToDepthaverageEnum : return "InputToDepthaverage";
+		case InputToSmoothEnum : return "InputToSmooth";
 		case IntParamEnum : return "IntParam";
 		case IntVecParamEnum : return "IntVecParam";
 		case TransientParamEnum : return "TransientParam";
@@ -553,6 +553,8 @@
 		case ViscousHeatingEnum : return "ViscousHeating";
 		case HydrologyWaterVxEnum : return "HydrologyWaterVx";
 		case HydrologyWaterVyEnum : return "HydrologyWaterVy";
+		case DrivingStressXEnum : return "DrivingStressX";
+		case DrivingStressYEnum : return "DrivingStressY";
 		case SigmaNNEnum : return "SigmaNN";
 		case StressTensorEnum : return "StressTensor";
 		case StressTensorxxEnum : return "StressTensorxx";
Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 18592)
+++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 18593)
@@ -399,8 +399,7 @@
 	      else if (strcmp(name,"DepthAverageAnalysis")==0) return DepthAverageAnalysisEnum;
 	      else if (strcmp(name,"SteadystateSolution")==0) return SteadystateSolutionEnum;
 	      else if (strcmp(name,"SurfaceSlopeSolution")==0) return SurfaceSlopeSolutionEnum;
-	      else if (strcmp(name,"SmoothedSurfaceSlopeXAnalysis")==0) return SmoothedSurfaceSlopeXAnalysisEnum;
-	      else if (strcmp(name,"SmoothedSurfaceSlopeYAnalysis")==0) return SmoothedSurfaceSlopeYAnalysisEnum;
+	      else if (strcmp(name,"SmoothAnalysis")==0) return SmoothAnalysisEnum;
 	      else if (strcmp(name,"ThermalAnalysis")==0) return ThermalAnalysisEnum;
 	      else if (strcmp(name,"ThermalSolution")==0) return ThermalSolutionEnum;
 	      else if (strcmp(name,"TransientSolution")==0) return TransientSolutionEnum;
@@ -455,6 +454,7 @@
 	      else if (strcmp(name,"InputToExtrude")==0) return InputToExtrudeEnum;
 	      else if (strcmp(name,"InputToL2Project")==0) return InputToL2ProjectEnum;
 	      else if (strcmp(name,"InputToDepthaverage")==0) return InputToDepthaverageEnum;
+	      else if (strcmp(name,"InputToSmooth")==0) return InputToSmoothEnum;
 	      else if (strcmp(name,"IntParam")==0) return IntParamEnum;
 	      else if (strcmp(name,"IntVecParam")==0) return IntVecParamEnum;
 	      else if (strcmp(name,"TransientParam")==0) return TransientParamEnum;
@@ -565,6 +565,8 @@
 	      else if (strcmp(name,"ViscousHeating")==0) return ViscousHeatingEnum;
 	      else if (strcmp(name,"HydrologyWaterVx")==0) return HydrologyWaterVxEnum;
 	      else if (strcmp(name,"HydrologyWaterVy")==0) return HydrologyWaterVyEnum;
+	      else if (strcmp(name,"DrivingStressX")==0) return DrivingStressXEnum;
+	      else if (strcmp(name,"DrivingStressY")==0) return DrivingStressYEnum;
 	      else if (strcmp(name,"SigmaNN")==0) return SigmaNNEnum;
 	      else if (strcmp(name,"StressTensor")==0) return StressTensorEnum;
 	      else if (strcmp(name,"StressTensorxx")==0) return StressTensorxxEnum;
@@ -626,12 +628,12 @@
 	      else if (strcmp(name,"Time")==0) return TimeEnum;
 	      else if (strcmp(name,"WaterColumnOld")==0) return WaterColumnOldEnum;
 	      else if (strcmp(name,"Outputdefinition")==0) return OutputdefinitionEnum;
-	      else if (strcmp(name,"OutputdefinitionList")==0) return OutputdefinitionListEnum;
-	      else if (strcmp(name,"Massfluxatgate")==0) return MassfluxatgateEnum;
          else stage=6;
    }
    if(stage==6){
-	      if (strcmp(name,"MassfluxatgateName")==0) return MassfluxatgateNameEnum;
+	      if (strcmp(name,"OutputdefinitionList")==0) return OutputdefinitionListEnum;
+	      else if (strcmp(name,"Massfluxatgate")==0) return MassfluxatgateEnum;
+	      else if (strcmp(name,"MassfluxatgateName")==0) return MassfluxatgateNameEnum;
 	      else if (strcmp(name,"MassfluxatgateSegments")==0) return MassfluxatgateSegmentsEnum;
 	      else if (strcmp(name,"MisfitName")==0) return MisfitNameEnum;
 	      else if (strcmp(name,"MisfitModelEnum")==0) return MisfitModelEnumEnum;
@@ -749,12 +751,12 @@
 	      else if (strcmp(name,"BasalforcingsOceanVy")==0) return BasalforcingsOceanVyEnum;
 	      else if (strcmp(name,"SurfaceforcingsRhoAir")==0) return SurfaceforcingsRhoAirEnum;
 	      else if (strcmp(name,"SurfaceforcingsAirCoef")==0) return SurfaceforcingsAirCoefEnum;
-	      else if (strcmp(name,"SurfaceforcingsAirLinDragCoef")==0) return SurfaceforcingsAirLinDragCoefEnum;
-	      else if (strcmp(name,"SurfaceforcingsAirQuadDragCoef")==0) return SurfaceforcingsAirQuadDragCoefEnum;
          else stage=7;
    }
    if(stage==7){
-	      if (strcmp(name,"SurfaceforcingsWindVx")==0) return SurfaceforcingsWindVxEnum;
+	      if (strcmp(name,"SurfaceforcingsAirLinDragCoef")==0) return SurfaceforcingsAirLinDragCoefEnum;
+	      else if (strcmp(name,"SurfaceforcingsAirQuadDragCoef")==0) return SurfaceforcingsAirQuadDragCoefEnum;
+	      else if (strcmp(name,"SurfaceforcingsWindVx")==0) return SurfaceforcingsWindVxEnum;
 	      else if (strcmp(name,"SurfaceforcingsWindVy")==0) return SurfaceforcingsWindVyEnum;
 	      else if (strcmp(name,"Matseaice")==0) return MatseaiceEnum;
 	      else if (strcmp(name,"MaterialsPoisson")==0) return MaterialsPoissonEnum;
Index: ../trunk-jpl/src/c/Makefile.am
===================================================================
--- ../trunk-jpl/src/c/Makefile.am	(revision 18592)
+++ ../trunk-jpl/src/c/Makefile.am	(revision 18593)
@@ -656,12 +656,9 @@
 if THERMAL
 issm_sources += ./analyses/ThermalAnalysis.cpp
 endif
-if SMOOTHEDSURFACESLOPEX
-issm_sources += ./analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+if SMOOTH
+issm_sources += ./analyses/SmoothAnalysis.cpp
 endif
-if SMOOTHEDSURFACESLOPEY
-issm_sources += ./analyses/SmoothedSurfaceSlopeYAnalysis.cpp
-endif
 if MESHDEFORMATION
 issm_sources += ./analyses/MeshdeformationAnalysis.cpp
 endif
Index: ../trunk-jpl/src/c/cores/balancevelocity_core.cpp
===================================================================
--- ../trunk-jpl/src/c/cores/balancevelocity_core.cpp	(revision 18592)
+++ ../trunk-jpl/src/c/cores/balancevelocity_core.cpp	(revision 18593)
@@ -18,11 +18,11 @@
 	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 
 	if(VerboseSolution()) _printf0_("computing smoothed slopes:\n");
-	femmodel->SetCurrentConfiguration(SmoothedSurfaceSlopeXAnalysisEnum);
+	femmodel->SetCurrentConfiguration(SmoothAnalysisEnum);
+	femmodel->parameters->SetParam(DrivingStressXEnum,InputToSmoothEnum);
 	solutionsequence_linear(femmodel);
-	femmodel->SetCurrentConfiguration(SmoothedSurfaceSlopeYAnalysisEnum);
+	femmodel->parameters->SetParam(DrivingStressYEnum,InputToSmoothEnum);
 	solutionsequence_linear(femmodel);
-	//surfaceslope_core(femmodel);
 
 	if(VerboseSolution()) _printf0_("call computational core:\n");
 	femmodel->SetCurrentConfiguration(BalancevelocityAnalysisEnum);
@@ -30,7 +30,7 @@
 
 	if(save_results){
 		if(VerboseSolution()) _printf0_("   saving results\n");
-		int outputs[3] = {SurfaceSlopeXEnum,SurfaceSlopeYEnum,VelEnum};
+		int outputs[3] = {DrivingStressXEnum,DrivingStressYEnum,VelEnum};
 		femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3);
 	}
 
Index: ../trunk-jpl/src/c/classes/FemModel.cpp
===================================================================
--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 18592)
+++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 18593)
@@ -474,8 +474,7 @@
 
 		case BalancevelocitySolutionEnum:
 			analyses_temp[numanalyses++]=BalancevelocityAnalysisEnum;
-			analyses_temp[numanalyses++]=SmoothedSurfaceSlopeXAnalysisEnum;
-			analyses_temp[numanalyses++]=SmoothedSurfaceSlopeYAnalysisEnum;
+			analyses_temp[numanalyses++]=SmoothAnalysisEnum;
 			break;
 
 		case SurfaceSlopeSolutionEnum:
Index: ../trunk-jpl/src/m/classes/inversionvalidation.m
===================================================================
--- ../trunk-jpl/src/m/classes/inversionvalidation.m	(revision 18592)
+++ ../trunk-jpl/src/m/classes/inversionvalidation.m	(revision 18593)
@@ -17,6 +17,7 @@
 		vz_obs                      = NaN
 		vel_obs                     = NaN
 		thickness_obs               = NaN
+		surface_obs               = NaN
 	end
 	methods
 		function obj = inversionvalidation(varargin) % {{{
@@ -53,7 +54,7 @@
 			md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0 1]);
 			md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',...
 				{'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'DamageDbar' 'Vx' 'Vy' 'Thickness',...
-				'BalancethicknessNu' 'BalancethicknessApparentMassbalance'});
+				'BalancethicknessOmega' 'BalancethicknessApparentMassbalance'});
 			md = checkfield(md,'fieldname','inversion.cost_functions','size',[1 num_costfunc],'values',[101:105 201 501:506 601:604]);
 			md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);
 			md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]);
@@ -83,6 +84,7 @@
 			fielddisplay(obj,'vy_obs','observed velocity y component [m/yr]');
 			fielddisplay(obj,'vel_obs','observed velocity magnitude [m/yr]');
 			fielddisplay(obj,'thickness_obs','observed thickness [m]');
+			fielddisplay(obj,'surface_obs','observed surface elevation [m]');
 			disp('Available cost functions:');
 			disp('   101: SurfaceAbsVelMisfit');
 			disp('   102: SurfaceRelVelMisfit');
@@ -114,6 +116,7 @@
 				mattype=1;
 			end
 			WriteData(fid,'object',obj,'class','inversion','fieldname','thickness_obs','format','DoubleMat','mattype',mattype);
+			WriteData(fid,'object',obj,'class','inversion','fieldname','surface_obs','format','DoubleMat','mattype',mattype);
 
 			%process control parameters
 			num_control_parameters=numel(obj.control_parameters);
@@ -139,6 +142,7 @@
 			pos=find(obj.cost_functions==504); data(pos)=ThicknessAlongGradientEnum();
 			pos=find(obj.cost_functions==505); data(pos)=ThicknessAcrossGradientEnum();
 			pos=find(obj.cost_functions==506); data(pos)=BalancethicknessMisfitEnum();
+			pos=find(obj.cost_functions==601); data(pos)=SurfaceAbsMisfitEnum();
 			WriteData(fid,'data',data,'enum',InversionCostFunctionsEnum(),'format','DoubleMat','mattype',3);
 			WriteData(fid,'data',num_cost_functions,'enum',InversionNumCostFunctionsEnum(),'format','Integer');
 		end % }}}
Index: ../trunk-jpl/src/m/enum/DrivingStressXEnum.m
===================================================================
--- ../trunk-jpl/src/m/enum/DrivingStressXEnum.m	(revision 0)
+++ ../trunk-jpl/src/m/enum/DrivingStressXEnum.m	(revision 18593)
@@ -0,0 +1,11 @@
+function macro=DrivingStressXEnum()
+%DRIVINGSTRESSXENUM - Enum of DrivingStressX
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+%            Please read src/c/shared/Enum/README for more information
+%
+%   Usage:
+%      macro=DrivingStressXEnum()
+
+macro=StringToEnum('DrivingStressX');
Index: ../trunk-jpl/src/m/enum/SmoothAnalysisEnum.m
===================================================================
--- ../trunk-jpl/src/m/enum/SmoothAnalysisEnum.m	(revision 0)
+++ ../trunk-jpl/src/m/enum/SmoothAnalysisEnum.m	(revision 18593)
@@ -0,0 +1,11 @@
+function macro=SmoothAnalysisEnum()
+%SMOOTHANALYSISENUM - Enum of SmoothAnalysis
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+%            Please read src/c/shared/Enum/README for more information
+%
+%   Usage:
+%      macro=SmoothAnalysisEnum()
+
+macro=StringToEnum('SmoothAnalysis');
Index: ../trunk-jpl/src/m/enum/DrivingStressYEnum.m
===================================================================
--- ../trunk-jpl/src/m/enum/DrivingStressYEnum.m	(revision 0)
+++ ../trunk-jpl/src/m/enum/DrivingStressYEnum.m	(revision 18593)
@@ -0,0 +1,11 @@
+function macro=DrivingStressYEnum()
+%DRIVINGSTRESSYENUM - Enum of DrivingStressY
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+%            Please read src/c/shared/Enum/README for more information
+%
+%   Usage:
+%      macro=DrivingStressYEnum()
+
+macro=StringToEnum('DrivingStressY');
Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
===================================================================
--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 18592)
+++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 18593)
@@ -382,8 +382,7 @@
 def DepthAverageAnalysisEnum(): return StringToEnum("DepthAverageAnalysis")[0]
 def SteadystateSolutionEnum(): return StringToEnum("SteadystateSolution")[0]
 def SurfaceSlopeSolutionEnum(): return StringToEnum("SurfaceSlopeSolution")[0]
-def SmoothedSurfaceSlopeXAnalysisEnum(): return StringToEnum("SmoothedSurfaceSlopeXAnalysis")[0]
-def SmoothedSurfaceSlopeYAnalysisEnum(): return StringToEnum("SmoothedSurfaceSlopeYAnalysis")[0]
+def SmoothAnalysisEnum(): return StringToEnum("SmoothAnalysis")[0]
 def ThermalAnalysisEnum(): return StringToEnum("ThermalAnalysis")[0]
 def ThermalSolutionEnum(): return StringToEnum("ThermalSolution")[0]
 def TransientSolutionEnum(): return StringToEnum("TransientSolution")[0]
@@ -438,6 +437,7 @@
 def InputToExtrudeEnum(): return StringToEnum("InputToExtrude")[0]
 def InputToL2ProjectEnum(): return StringToEnum("InputToL2Project")[0]
 def InputToDepthaverageEnum(): return StringToEnum("InputToDepthaverage")[0]
+def InputToSmoothEnum(): return StringToEnum("InputToSmooth")[0]
 def IntParamEnum(): return StringToEnum("IntParam")[0]
 def IntVecParamEnum(): return StringToEnum("IntVecParam")[0]
 def TransientParamEnum(): return StringToEnum("TransientParam")[0]
@@ -545,6 +545,8 @@
 def ViscousHeatingEnum(): return StringToEnum("ViscousHeating")[0]
 def HydrologyWaterVxEnum(): return StringToEnum("HydrologyWaterVx")[0]
 def HydrologyWaterVyEnum(): return StringToEnum("HydrologyWaterVy")[0]
+def DrivingStressXEnum(): return StringToEnum("DrivingStressX")[0]
+def DrivingStressYEnum(): return StringToEnum("DrivingStressY")[0]
 def SigmaNNEnum(): return StringToEnum("SigmaNN")[0]
 def StressTensorEnum(): return StringToEnum("StressTensor")[0]
 def StressTensorxxEnum(): return StringToEnum("StressTensorxx")[0]
Index: ../trunk-jpl/src/m/enum/InputToSmoothEnum.m
===================================================================
--- ../trunk-jpl/src/m/enum/InputToSmoothEnum.m	(revision 0)
+++ ../trunk-jpl/src/m/enum/InputToSmoothEnum.m	(revision 18593)
@@ -0,0 +1,11 @@
+function macro=InputToSmoothEnum()
+%INPUTTOSMOOTHENUM - Enum of InputToSmooth
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+%            Please read src/c/shared/Enum/README for more information
+%
+%   Usage:
+%      macro=InputToSmoothEnum()
+
+macro=StringToEnum('InputToSmooth');
