Index: /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 27469)
+++ /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 27470)
@@ -102,6 +102,5 @@
 
 	bool dakota_analysis,ismovingfront,isenthalpy;
-	int frictionlaw,basalforcing_model,materialstype;
-	int FrictionCoupling;
+	int  basalforcing_model,materialstype;
 
 	/*Now, is the model 3d? otherwise, do nothing: */
@@ -131,5 +130,4 @@
 	iomodel->FindConstant(&dakota_analysis,"md.qmu.isdakota");
 	iomodel->FindConstant(&ismovingfront,"md.transient.ismovingfront");
-	iomodel->FindConstant(&frictionlaw,"md.friction.law");
 	iomodel->FindConstant(&materialstype,"md.materials.type");
 
@@ -191,73 +189,6 @@
 	}
 
-	/*Friction law variables*/
-	switch(frictionlaw){
-		case 1:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			if (FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-			}
-			break;
-		case 2:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			break;
-		case 3:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.As",FrictionAsEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			if (FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-			}
-			break;
-		case 4:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.pressure",PressureEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.temperature",TemperatureEnum);
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			break;
-		case 5:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.water_layer",FrictionWaterLayerEnum);
-			break;
-		case 6:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.pressure",PressureEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.temperature",TemperatureEnum);
-			break;
-		case 7:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficientcoulomb",FrictionCoefficientcoulombEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			if (FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-			}
-			break;
-		case 9:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.pressure_adjusted_temperature",FrictionPressureAdjustedTemperatureEnum);
-			InputUpdateFromConstantx(inputs,elements,1.,FrictionPEnum);
-			InputUpdateFromConstantx(inputs,elements,1.,FrictionQEnum);
-			break;
-		default:
-			_error_("friction law not supported");
-	}
+	/*Friction*/
+	FrictionUpdateInputs(elements, inputs, iomodel);
 
 	/*Free data: */
@@ -277,5 +208,4 @@
 	parameters->AddObject(iomodel->CopyConstantObject("md.thermal.isdrainicecolumn",ThermalIsdrainicecolumnEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.thermal.watercolumn_upperlimit",ThermalWatercolumnUpperlimitEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.friction.law",FrictionLawEnum));
 
 	iomodel->FindConstant(&requestedoutputs,&numoutputs,"md.thermal.requested_outputs");
@@ -284,24 +214,6 @@
 	iomodel->DeleteData(&requestedoutputs,numoutputs,"md.thermal.requested_outputs");
 
-	/*Deal with friction parameters*/
-	int frictionlaw;
-	iomodel->FindConstant(&frictionlaw,"md.friction.law");
-	if(frictionlaw==6){
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-	}
-	if(frictionlaw==4){
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-	}
-	if(frictionlaw==1 || frictionlaw==3 || frictionlaw==7){
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-	}
-	if(frictionlaw==9){
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-		parameters->AddObject(new IntParam(FrictionCouplingEnum,0));
-	}
+	/*Friction*/
+	FrictionUpdateParameters(parameters, iomodel);
 }/*}}}*/
 
Index: /issm/trunk-jpl/src/c/analyses/HydrologyGlaDSAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/analyses/HydrologyGlaDSAnalysis.cpp	(revision 27469)
+++ /issm/trunk-jpl/src/c/analyses/HydrologyGlaDSAnalysis.cpp	(revision 27470)
@@ -111,5 +111,5 @@
 
 	/*Fetch data needed: */
-	int    hydrology_model,frictionlaw;
+	int    hydrology_model;
 	iomodel->FindConstant(&hydrology_model,"md.hydrology.model");
 
@@ -151,116 +151,13 @@
 		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxBaseEnum);
 		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyBaseEnum);
-		iomodel->FindConstant(&frictionlaw,"md.friction.law");
 	}
 	else{
 		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vx",VxEnum);
 		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyEnum);
-		iomodel->FindConstant(&frictionlaw,"md.friction.law");
-	}
-
-	/*Friction law variables*/
-	int FrictionCoupling;
-	switch(frictionlaw){
-		case 1:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			if(FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-			}
-			break;
-		case 2:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			break;
-		case 3:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.As",FrictionAsEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			if(FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-			}
-			break;
-		case 4:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.pressure",PressureEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.temperature",TemperatureEnum);
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			break;
-		case 5:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.water_layer",FrictionWaterLayerEnum);
-			break;
-		case 6:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.pressure",PressureEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.temperature",TemperatureEnum);
-			break;
-		case 7:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficientcoulomb",FrictionCoefficientcoulombEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			if(FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-
-			}
-			break;
-		case 9:
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.temperature",TemperatureEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.pressure_adjusted_temperature",FrictionPressureAdjustedTemperatureEnum);
-			InputUpdateFromConstantx(inputs,elements,1.,FrictionPEnum);
-			InputUpdateFromConstantx(inputs,elements,1.,FrictionQEnum);
-			break;
-		case 10:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.till_friction_angle",FrictionTillFrictionAngleEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.sediment_compressibility_coefficient",FrictionSedimentCompressibilityCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.hydrology.watercolumn_max",HydrologyWatercolumnMaxEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.watercolumn",WatercolumnEnum,0.);
-			break;
-		case 11:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.Cmax",FrictionCmaxEnum);
-			if(FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-			}
-			break;
-		case 12:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.f",FrictionfEnum);
-			break;
-		case 13:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			if(FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-			}
-			break;
-		default:
-			_error_("friction law "<< frictionlaw <<" not supported");
-	}
+	}
+
+	/*Friction*/
+	FrictionUpdateInputs(elements, inputs, iomodel);
+
 }/*}}}*/
 void HydrologyGlaDSAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
@@ -276,5 +173,4 @@
 
 	parameters->AddObject(new IntParam(HydrologyModelEnum,hydrology_model));
-	parameters->AddObject(iomodel->CopyConstantObject("md.friction.law",FrictionLawEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.hydrology.pressure_melt_coefficient",HydrologyPressureMeltCoefficientEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.hydrology.cavity_spacing",HydrologyCavitySpacingEnum));
@@ -284,62 +180,6 @@
 	parameters->AddObject(iomodel->CopyConstantObject("md.hydrology.englacial_void_ratio",HydrologyEnglacialVoidRatioEnum));
 
-	/*Deal with friction parameters*/
-	int frictionlaw;
-	iomodel->FindConstant(&frictionlaw,"md.friction.law");
-	switch(frictionlaw){
-		case 1:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			break;
-		case 2:
-			break;
-		case 3:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			break;
-		case 4:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			break;
-		case 5:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.f",FrictionFEnum));
-			break;
-		case 6:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-			break;
-		case 7:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			break;
-		case 8:
-			break;
-		case 9:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			parameters->AddObject(new IntParam(FrictionCouplingEnum,0));
-			break;
-		case 10:
-			parameters->AddObject(new IntParam(FrictionCouplingEnum,2)); /*comment this line to use effective pressure from Beuler and Pelt (2015)*/
-			parameters->AddObject(new DoubleParam(FrictionEffectivePressureLimitEnum,0.));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.pseudoplasticity_exponent",FrictionPseudoplasticityExponentEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.threshold_speed",FrictionThresholdSpeedEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.delta",FrictionDeltaEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.void_ratio",FrictionVoidRatioEnum));
-			break;
-		case 11:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			break;
-		case 12:
-			parameters->AddObject(new IntParam(FrictionCouplingEnum,2));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			break;
-		case 13:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			break;
-		default: _error_("Friction law "<<frictionlaw<<" not implemented yet");
-	}
+	/*Friction*/
+	FrictionUpdateParameters(parameters, iomodel);
 
 	/*Requested outputs*/
Index: /issm/trunk-jpl/src/c/analyses/HydrologyShaktiAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/analyses/HydrologyShaktiAnalysis.cpp	(revision 27469)
+++ /issm/trunk-jpl/src/c/analyses/HydrologyShaktiAnalysis.cpp	(revision 27470)
@@ -124,19 +124,7 @@
 		iomodel->FetchDataToInput(inputs,elements,"md.initialization.vy",VyBaseEnum);
 	}
-	iomodel->FindConstant(&frictionlaw,"md.friction.law");
-
-	/*Friction law variables*/
-	switch(frictionlaw){
-		case 1:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			break;
-		case 8:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			break;
-		default:
-			_error_("Friction law "<< frictionlaw <<" not supported");
-	}
+
+	/*Friction*/
+	FrictionUpdateInputs(elements, inputs, iomodel);
 }/*}}}*/
 void HydrologyShaktiAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
@@ -152,28 +140,6 @@
 
 	parameters->AddObject(new IntParam(HydrologyModelEnum,hydrology_model));
-	parameters->AddObject(iomodel->CopyConstantObject("md.friction.law",FrictionLawEnum));
    parameters->AddObject(iomodel->CopyConstantObject("md.hydrology.relaxation",HydrologyRelaxationEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.hydrology.storage",HydrologyStorageEnum));
-
-	/*Deal with friction parameters*/
-	int frictionlaw;
-	iomodel->FindConstant(&frictionlaw,"md.friction.law");
-	if(frictionlaw==6){
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-	}
-	if(frictionlaw==4){
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-	}
-	if(frictionlaw==1 || frictionlaw==3 || frictionlaw==7){
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-	}
-	if(frictionlaw==9){
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-		parameters->AddObject(new IntParam(FrictionCouplingEnum,0));
-	}
 
   /*Requested outputs*/
@@ -182,4 +148,7 @@
   if(numoutputs)parameters->AddObject(new StringArrayParam(HydrologyRequestedOutputsEnum,requestedoutputs,numoutputs));
   iomodel->DeleteData(&requestedoutputs,numoutputs,"md.hydrology.requested_outputs");
+
+	/*Friction*/
+	FrictionUpdateParameters(parameters, iomodel);
 }/*}}}*/
 
Index: /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 27469)
+++ /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 27470)
@@ -692,6 +692,5 @@
 	/*Intermediaries*/
 	int    materials_type,finiteelement,fe_FS;
-	int    approximation,frictionlaw;
-	int    FrictionCoupling;
+	int    approximation;
 	int*   finiteelement_list=NULL;
 	bool   isSSA,isL1L2,isMOLHO,isHO,isFS,iscoupling;
@@ -710,5 +709,4 @@
 	iomodel->FindConstant(&materials_type,"md.materials.type");
 	iomodel->FindConstant(&ismovingfront,"md.transient.ismovingfront");
-	iomodel->FindConstant(&frictionlaw,"md.friction.law");
 
 	/*return if no processing required*/
@@ -876,111 +874,6 @@
 	}
 
-	/*Friction law variables*/
-	switch(frictionlaw){
-		case 1:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			if(FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-			}
-			break;
-		case 2:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			break;
-		case 3:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.As",FrictionAsEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			if(FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-			}
-			break;
-		case 4:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.pressure",PressureEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.temperature",TemperatureEnum);
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			break;
-		case 5:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.water_layer",FrictionWaterLayerEnum);
-			break;
-		case 6:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.pressure",PressureEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.temperature",TemperatureEnum);
-			break;
-		case 7:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficientcoulomb",FrictionCoefficientcoulombEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			if(FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-
-			}
-			break;
-		case 9:
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.temperature",TemperatureEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.pressure_adjusted_temperature",FrictionPressureAdjustedTemperatureEnum);
-			InputUpdateFromConstantx(inputs,elements,1.,FrictionPEnum);
-			InputUpdateFromConstantx(inputs,elements,1.,FrictionQEnum);
-			break;
-		case 10:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.till_friction_angle",FrictionTillFrictionAngleEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.sediment_compressibility_coefficient",FrictionSedimentCompressibilityCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.hydrology.watercolumn_max",HydrologyWatercolumnMaxEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.watercolumn",WatercolumnEnum,0.);
-			break;
-		case 11:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.Cmax",FrictionCmaxEnum);
-			if(FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-			}
-			break;
-		case 12:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.f",FrictionfEnum);
-			break;
-		case 13:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			if(FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-			}
-			break;
-		default:
-			_error_("friction law "<< frictionlaw <<" not supported");
-	}
-
-#ifdef _HAVE_ANDROID_
-	inputs->DuplicateInput(FrictionCoefficientEnum,AndroidFrictionCoefficientEnum);
-#endif
+	/*Friction*/
+	FrictionUpdateInputs(elements, inputs, iomodel);
 
 	/*Free data: */
@@ -1014,5 +907,4 @@
 	parameters->AddObject(iomodel->CopyConstantObject("md.stressbalance.FSreconditioning",StressbalanceFSreconditioningEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.stressbalance.shelf_dampening",StressbalanceShelfDampeningEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.friction.law",FrictionLawEnum));
 
 	/*XTH LATH parameters*/
@@ -1037,62 +929,6 @@
 	iomodel->DeleteData(&requestedoutputs,numoutputs,"md.stressbalance.requested_outputs");
 
-	/*Deal with friction parameters*/
-	int frictionlaw;
-	iomodel->FindConstant(&frictionlaw,"md.friction.law");
-	switch(frictionlaw){
-		case 1:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			break;
-		case 2:
-			break;
-		case 3:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			break;
-		case 4:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			break;
-		case 5:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.f",FrictionFEnum));
-			break;
-		case 6:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-			break;
-		case 7:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			break;
-		case 8:
-			break;
-		case 9:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			parameters->AddObject(new IntParam(FrictionCouplingEnum,0));
-			break;
-		case 10:
-			parameters->AddObject(new IntParam(FrictionCouplingEnum,2)); /*comment this line to use effective pressure from Beuler and Pelt (2015)*/
-			parameters->AddObject(new DoubleParam(FrictionEffectivePressureLimitEnum,0.));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.pseudoplasticity_exponent",FrictionPseudoplasticityExponentEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.threshold_speed",FrictionThresholdSpeedEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.delta",FrictionDeltaEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.void_ratio",FrictionVoidRatioEnum));
-			break;
-		case 11:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			break;
-		case 12:
-			parameters->AddObject(new IntParam(FrictionCouplingEnum,2));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			break;
-		case 13:
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-			break;
-		default: _error_("Friction law "<<frictionlaw<<" not implemented yet");
-	}
+	/*Friction*/
+	FrictionUpdateParameters(parameters, iomodel);
 
 }/*}}}*/
Index: /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 27469)
+++ /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 27470)
@@ -113,8 +113,6 @@
 	bool   isSIA;
 	bool   ismovingfront;
-	int    frictionlaw;
 	iomodel->FindConstant(&isSIA,"md.flowequation.isSIA");
 	iomodel->FindConstant(&ismovingfront,"md.transient.ismovingfront");
-	iomodel->FindConstant(&frictionlaw,"md.friction.law");
 
 	/*Now, is the flag SIA on? otherwise, do nothing: */
@@ -140,25 +138,4 @@
 	iomodel->DeleteData(1,"md.flowequation.element_equation");
 
-	/*Friction law variables*/
-	switch(frictionlaw){
-		case 1:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			break;
-		case 2:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			break;
-		case 6:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.pressure",PressureEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.temperature",TemperatureEnum);
-			break;
-		default:
-			_error_("not supported");
-	}
-
 	iomodel->FetchDataToInput(inputs,elements,"md.geometry.thickness",ThicknessEnum);
 	iomodel->FetchDataToInput(inputs,elements,"md.mask.ocean_levelset",MaskOceanLevelsetEnum);
@@ -168,8 +145,12 @@
 	}
 
+	/*Friction*/
+	FrictionUpdateInputs(elements, inputs, iomodel);
+
 }/*}}}*/
 void StressbalanceSIAAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
 
-	/*No specific parameters*/
+	/*Friction*/
+	FrictionUpdateParameters(parameters, iomodel);
 
 }/*}}}*/
Index: /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 27469)
+++ /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 27470)
@@ -106,6 +106,6 @@
 void ThermalAnalysis::UpdateElements(Elements* elements,Inputs* inputs,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
 
-	int frictionlaw,basalforcing_model,materialstype;
-	int FrictionCoupling;
+	int basalforcing_model,materialstype;
+
 	/*Now, is the model 3d? otherwise, do nothing: */
 	if(iomodel->domaintype==Domain2DhorizontalEnum)return;
@@ -127,5 +127,4 @@
 	iomodel->FindConstant(&dakota_analysis,"md.qmu.isdakota");
 	iomodel->FindConstant(&ismovingfront,"md.transient.ismovingfront");
-	iomodel->FindConstant(&frictionlaw,"md.friction.law");
 	iomodel->FindConstant(&materialstype,"md.materials.type");
 
@@ -183,73 +182,7 @@
 			break;
 	}
-	/*Friction law variables*/
-	switch(frictionlaw){
-		case 1:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			if (FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-			}
-			break;
-		case 2:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			break;
-		case 3:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.As",FrictionAsEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			if (FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-			}
-			break;
-		case 4:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.pressure",PressureEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.temperature",TemperatureEnum);
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			break;
-		case 5:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.water_layer",FrictionWaterLayerEnum);
-			break;
-		case 6:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.pressure",PressureEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.initialization.temperature",TemperatureEnum);
-			break;
-		case 7:
-			iomodel->FindConstant(&FrictionCoupling,"md.friction.coupling");
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficientcoulomb",FrictionCoefficientcoulombEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
-			if (FrictionCoupling==3){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
-			else if(FrictionCoupling==4){
-				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
-			}
-			break;
-		case 9:
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
-			iomodel->FetchDataToInput(inputs,elements,"md.friction.pressure_adjusted_temperature",FrictionPressureAdjustedTemperatureEnum);
-			InputUpdateFromConstantx(inputs,elements,1.,FrictionPEnum);
-			InputUpdateFromConstantx(inputs,elements,1.,FrictionQEnum);
-			break;
-		default:
-			_error_("friction law not supported");
-	}
+
+	/*Friction*/
+	FrictionUpdateInputs(elements, inputs, iomodel);
 }/*}}}*/
 void ThermalAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
@@ -265,5 +198,4 @@
 	parameters->AddObject(iomodel->CopyConstantObject("md.thermal.isenthalpy",ThermalIsenthalpyEnum));
 	parameters->AddObject(iomodel->CopyConstantObject("md.thermal.isdynamicbasalspc",ThermalIsdynamicbasalspcEnum));
-	parameters->AddObject(iomodel->CopyConstantObject("md.friction.law",FrictionLawEnum));
 
 	iomodel->FindConstant(&requestedoutputs,&numoutputs,"md.thermal.requested_outputs");
@@ -272,25 +204,6 @@
 	iomodel->DeleteData(&requestedoutputs,numoutputs,"md.thermal.requested_outputs");
 
-	/*Deal with friction parameters*/
-	int frictionlaw;
-	iomodel->FindConstant(&frictionlaw,"md.friction.law");
-	if(frictionlaw==6){
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-	}
-	if(frictionlaw==4){
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-	}
-	if(frictionlaw==1 || frictionlaw==3 || frictionlaw==7){
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-	}
-	if(frictionlaw==9){
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
-		parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
-		parameters->AddObject(new IntParam(FrictionCouplingEnum,0));
-	}
-
+	/*Friction*/
+	FrictionUpdateParameters(parameters, iomodel);
 }/*}}}*/
 
Index: /issm/trunk-jpl/src/c/classes/Loads/Friction.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 27469)
+++ /issm/trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 27470)
@@ -13,4 +13,5 @@
 #include "../classes.h"
 #include "shared/shared.h"
+#include "../../modules/InputUpdateFromConstantx/InputUpdateFromConstantx.h"
 /*}}}*/
 
@@ -19,4 +20,5 @@
 	this->element=NULL;
 	this->law=0;
+	this->linearize=false;
 	this->apply_dim = 1.;
 	this->domaintype=-1;
@@ -24,4 +26,6 @@
 	this->vy_input=NULL;
 	this->vz_input=NULL;
+	this->alpha2_list=NULL;
+	this->alpha2_complement_list=NULL;
 }
 /*}}}*/
@@ -39,21 +43,40 @@
 		case Domain2DhorizontalEnum: 
 			this->apply_dim = 2.;
-			this->vx_input = element_in->GetInput(VxBaseEnum);			_assert_(this->vx_input); 
-			this->vy_input = element_in->GetInput(VyBaseEnum);			_assert_(this->vy_input);
+			this->vx_input = element_in->GetInput(VxBaseEnum);	_assert_(this->vx_input); 
+			this->vy_input = element_in->GetInput(VyBaseEnum);	_assert_(this->vy_input);
 			this->vz_input = NULL;
 			break;
       case Domain2DverticalEnum:
 			this->apply_dim = 2.;
-			this->vx_input = element_in->GetInput(VxEnum);				_assert_(this->vx_input);
-			this->vy_input = element_in->GetInput(VyEnum);				_assert_(this->vy_input);
+			this->vx_input = element_in->GetInput(VxEnum);	_assert_(this->vx_input);
+			this->vy_input = element_in->GetInput(VyEnum);	_assert_(this->vy_input);
 			this->vz_input = NULL;
 			break;
       case Domain3DEnum:           
 			this->apply_dim = 3.;
-			this->vx_input = element_in->GetInput(VxEnum);				_assert_(this->vx_input);
-			this->vy_input = element_in->GetInput(VyEnum);				_assert_(this->vy_input);
-			this->vz_input = element_in->GetInput(VzEnum);				_assert_(this->vz_input);
+			this->vx_input = element_in->GetInput(VxEnum);	_assert_(this->vx_input);
+			this->vy_input = element_in->GetInput(VyEnum);	_assert_(this->vy_input);
+			this->vz_input = element_in->GetInput(VzEnum);	_assert_(this->vz_input);
 			break;
       default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+	}
+
+	if(this->law==1){
+		element_in->FindParam(&this->linearize,FrictionLinearizeEnum);
+		if(this->linearize){
+			this->linearize = false; /*Change to make sure we do the calculation once*/
+			int numvertices = this->element->GetNumberOfVertices();
+			this->alpha2_list            = xNew<IssmDouble>(numvertices);
+			this->alpha2_complement_list = xNew<IssmDouble>(numvertices);
+			Gauss* gauss=this->element->NewGauss();
+			for(int iv=0;iv<numvertices;iv++){
+				gauss->GaussVertex(iv);
+				this->GetAlpha2(&this->alpha2_list[iv], gauss);
+				IssmDouble temp = 0.;
+				this->GetAlpha2(&temp, gauss);
+				this->GetAlphaComplement(&this->alpha2_complement_list[iv], gauss);
+			}
+			this->linearize = true ; /*Change back, we are now all set!*/
+		}
 	}
 }
@@ -68,7 +91,10 @@
 /*}}}*/
 Friction::~Friction(){/*{{{*/
+	if(this->linearize){
+		xDelete<IssmDouble>(this->alpha2_list);
+		xDelete<IssmDouble>(this->alpha2_complement_list);
+	}
 }
 /*}}}*/
-
 
 /*methods: */
@@ -270,5 +296,10 @@
 	switch(this->law){
 		case 1:
-			GetAlpha2Viscous(palpha2,gauss);
+			if(this->linearize){
+				this->element->ValueP1OnGauss(palpha2, this->alpha2_list, gauss);
+			}
+			else{
+				GetAlpha2Viscous(palpha2,gauss);
+			}
 			break;
 		case 2:
@@ -1046,2 +1077,187 @@
 	_assert_(!xIsInf<IssmDouble>(*pvz));
 }/*}}}*/
+
+/*IO*/
+void FrictionUpdateInputs(Elements* elements,Inputs* inputs,IoModel* iomodel){/*{{{*/
+
+	/*Intermediaries*/
+	int    frictionlaw;
+	int    frictioncoupling;
+
+	/*Friction law variables*/
+	iomodel->FindConstant(&frictionlaw,"md.friction.law");
+	switch(frictionlaw){
+		case 1:
+			iomodel->FindConstant(&frictioncoupling,"md.friction.coupling");
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
+			if(frictioncoupling==3){
+				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
+			else if(frictioncoupling==4){
+				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
+			}
+			break;
+		case 2:
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
+			break;
+		case 3:
+			iomodel->FindConstant(&frictioncoupling,"md.friction.coupling");
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.As",FrictionAsEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
+			if(frictioncoupling==3){
+				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
+			else if(frictioncoupling==4){
+				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
+			}
+			break;
+		case 4:
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.initialization.pressure",PressureEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.initialization.temperature",TemperatureEnum);
+			iomodel->FindConstant(&frictioncoupling,"md.friction.coupling");
+			break;
+		case 5:
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.water_layer",FrictionWaterLayerEnum);
+			break;
+		case 6:
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.initialization.pressure",PressureEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.initialization.temperature",TemperatureEnum);
+			break;
+		case 7:
+			iomodel->FindConstant(&frictioncoupling,"md.friction.coupling");
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficientcoulomb",FrictionCoefficientcoulombEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.p",FrictionPEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.q",FrictionQEnum);
+			if(frictioncoupling==3){
+				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
+			else if(frictioncoupling==4){
+				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
+
+			}
+			break;
+		case 9:
+			iomodel->FetchDataToInput(inputs,elements,"md.initialization.temperature",TemperatureEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.coefficient",FrictionCoefficientEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.pressure_adjusted_temperature",FrictionPressureAdjustedTemperatureEnum);
+			InputUpdateFromConstantx(inputs,elements,1.,FrictionPEnum);
+			InputUpdateFromConstantx(inputs,elements,1.,FrictionQEnum);
+			break;
+		case 10:
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.till_friction_angle",FrictionTillFrictionAngleEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.sediment_compressibility_coefficient",FrictionSedimentCompressibilityCoefficientEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.hydrology.watercolumn_max",HydrologyWatercolumnMaxEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.initialization.watercolumn",WatercolumnEnum,0.);
+			break;
+		case 11:
+			iomodel->FindConstant(&frictioncoupling,"md.friction.coupling");
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.Cmax",FrictionCmaxEnum);
+			if(frictioncoupling==3){
+				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
+			else if(frictioncoupling==4){
+				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
+			}
+			break;
+		case 12:
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.f",FrictionfEnum);
+			break;
+		case 13:
+			iomodel->FindConstant(&frictioncoupling,"md.friction.coupling");
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.C",FrictionCEnum);
+			iomodel->FetchDataToInput(inputs,elements,"md.friction.m",FrictionMEnum);
+			if(frictioncoupling==3){
+				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",FrictionEffectivePressureEnum);}
+			else if(frictioncoupling==4){
+				iomodel->FetchDataToInput(inputs,elements,"md.friction.effective_pressure",EffectivePressureEnum);
+			}
+			break;
+		default:
+			_error_("friction law "<< frictionlaw <<" not supported");
+	}
+
+#ifdef _HAVE_ANDROID_
+	inputs->DuplicateInput(FrictionCoefficientEnum,AndroidFrictionCoefficientEnum);
+#endif
+
+}/*}}}*/
+void FrictionUpdateParameters(Parameters* parameters,IoModel* iomodel){/*{{{*/
+
+	parameters->AddObject(iomodel->CopyConstantObject("md.friction.law",FrictionLawEnum));
+
+	/*Set default linearize parameter to 0 for now*/
+	parameters->AddObject(new IntParam(FrictionLinearizeEnum,0));
+
+	int frictionlaw;
+	iomodel->FindConstant(&frictionlaw,"md.friction.law");
+	switch(frictionlaw){
+		case 1:
+			//parameters->AddObject(iomodel->CopyConstantObject("md.friction.linearize",FrictionLinearizeEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
+			break;
+		case 2:
+			break;
+		case 3:
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
+			break;
+		case 4:
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
+			break;
+		case 5:
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.f",FrictionFEnum));
+			break;
+		case 6:
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
+			break;
+		case 7:
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
+			break;
+		case 8:
+			break;
+		case 9:
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.gamma",FrictionGammaEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
+			parameters->AddObject(new IntParam(FrictionCouplingEnum,0));
+			break;
+		case 10:
+			parameters->AddObject(new IntParam(FrictionCouplingEnum,2)); /*comment this line to use effective pressure from Beuler and Pelt (2015)*/
+			parameters->AddObject(new DoubleParam(FrictionEffectivePressureLimitEnum,0.));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.pseudoplasticity_exponent",FrictionPseudoplasticityExponentEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.threshold_speed",FrictionThresholdSpeedEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.delta",FrictionDeltaEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.void_ratio",FrictionVoidRatioEnum));
+			break;
+		case 11:
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
+			break;
+		case 12:
+			parameters->AddObject(new IntParam(FrictionCouplingEnum,2));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
+			break;
+		case 13:
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.coupling",FrictionCouplingEnum));
+			parameters->AddObject(iomodel->CopyConstantObject("md.friction.effective_pressure_limit",FrictionEffectivePressureLimitEnum));
+			break;
+		default: _error_("Friction law "<<frictionlaw<<" not implemented yet");
+	}
+
+}/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Friction.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Friction.h	(revision 27469)
+++ /issm/trunk-jpl/src/c/classes/Loads/Friction.h	(revision 27470)
@@ -8,4 +8,7 @@
 /*Headers:*/
 class Inputs;
+class Elements;
+class Parameters;
+class IoModel;
 class GaussPenta;
 class GaussTria;
@@ -21,4 +24,7 @@
 		Input      *vy_input;
 		Input      *vz_input;
+		bool        linearize;
+		IssmDouble *alpha2_list;
+		IssmDouble *alpha2_complement_list;
 
 		/*methods: */
@@ -60,3 +66,7 @@
 };
 
+/*Friction related IO*/
+void FrictionUpdateParameters(Parameters* parameters,IoModel* iomodel);
+void FrictionUpdateInputs(Elements* elements,Inputs* inputs,IoModel* iomodel);
+
 #endif  /* _FRICTION_H_ */
