Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 18510)
+++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 18511)
@@ -87,6 +87,7 @@
 	FlowequationFeHOEnum,
 	FlowequationFeFSEnum,
 	FlowequationVertexEquationEnum,
+	FrictionAsEnum,
 	FrictionCoefficientEnum,
 	FrictionPEnum,
 	FrictionQEnum,
Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 18510)
+++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 18511)
@@ -95,6 +95,7 @@
 		case FlowequationFeHOEnum : return "FlowequationFeHO";
 		case FlowequationFeFSEnum : return "FlowequationFeFS";
 		case FlowequationVertexEquationEnum : return "FlowequationVertexEquation";
+		case FrictionAsEnum : return "FrictionAs";
 		case FrictionCoefficientEnum : return "FrictionCoefficient";
 		case FrictionPEnum : return "FrictionP";
 		case FrictionQEnum : return "FrictionQ";
Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 18510)
+++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 18511)
@@ -95,6 +95,7 @@
 	      else if (strcmp(name,"FlowequationFeHO")==0) return FlowequationFeHOEnum;
 	      else if (strcmp(name,"FlowequationFeFS")==0) return FlowequationFeFSEnum;
 	      else if (strcmp(name,"FlowequationVertexEquation")==0) return FlowequationVertexEquationEnum;
+	      else if (strcmp(name,"FrictionAs")==0) return FrictionAsEnum;
 	      else if (strcmp(name,"FrictionCoefficient")==0) return FrictionCoefficientEnum;
 	      else if (strcmp(name,"FrictionP")==0) return FrictionPEnum;
 	      else if (strcmp(name,"FrictionQ")==0) return FrictionQEnum;
@@ -135,11 +136,11 @@
 	      else if (strcmp(name,"HydrologydcEplConductivity")==0) return HydrologydcEplConductivityEnum;
 	      else if (strcmp(name,"HydrologydcIsefficientlayer")==0) return HydrologydcIsefficientlayerEnum;
 	      else if (strcmp(name,"HydrologydcSedimentlimitFlag")==0) return HydrologydcSedimentlimitFlagEnum;
-	      else if (strcmp(name,"HydrologydcSedimentlimit")==0) return HydrologydcSedimentlimitEnum;
          else stage=2;
    }
    if(stage==2){
-	      if (strcmp(name,"HydrologydcTransferFlag")==0) return HydrologydcTransferFlagEnum;
+	      if (strcmp(name,"HydrologydcSedimentlimit")==0) return HydrologydcSedimentlimitEnum;
+	      else if (strcmp(name,"HydrologydcTransferFlag")==0) return HydrologydcTransferFlagEnum;
 	      else if (strcmp(name,"HydrologydcLeakageFactor")==0) return HydrologydcLeakageFactorEnum;
 	      else if (strcmp(name,"HydrologydcPenaltyFactor")==0) return HydrologydcPenaltyFactorEnum;
 	      else if (strcmp(name,"HydrologydcPenaltyLock")==0) return HydrologydcPenaltyLockEnum;
@@ -258,11 +259,11 @@
 	      else if (strcmp(name,"QmuIsdakota")==0) return QmuIsdakotaEnum;
 	      else if (strcmp(name,"MassFluxSegments")==0) return MassFluxSegmentsEnum;
 	      else if (strcmp(name,"MassFluxSegmentsPresent")==0) return MassFluxSegmentsPresentEnum;
-	      else if (strcmp(name,"QmuMassFluxSegmentsPresent")==0) return QmuMassFluxSegmentsPresentEnum;
          else stage=3;
    }
    if(stage==3){
-	      if (strcmp(name,"QmuNumberofpartitions")==0) return QmuNumberofpartitionsEnum;
+	      if (strcmp(name,"QmuMassFluxSegmentsPresent")==0) return QmuMassFluxSegmentsPresentEnum;
+	      else if (strcmp(name,"QmuNumberofpartitions")==0) return QmuNumberofpartitionsEnum;
 	      else if (strcmp(name,"QmuNumberofresponses")==0) return QmuNumberofresponsesEnum;
 	      else if (strcmp(name,"QmuPartition")==0) return QmuPartitionEnum;
 	      else if (strcmp(name,"QmuResponsedescriptors")==0) return QmuResponsedescriptorsEnum;
@@ -381,11 +382,11 @@
 	      else if (strcmp(name,"MeltingAnalysis")==0) return MeltingAnalysisEnum;
 	      else if (strcmp(name,"MasstransportAnalysis")==0) return MasstransportAnalysisEnum;
 	      else if (strcmp(name,"MasstransportSolution")==0) return MasstransportSolutionEnum;
-	      else if (strcmp(name,"FreeSurfaceBaseAnalysis")==0) return FreeSurfaceBaseAnalysisEnum;
          else stage=4;
    }
    if(stage==4){
-	      if (strcmp(name,"FreeSurfaceTopAnalysis")==0) return FreeSurfaceTopAnalysisEnum;
+	      if (strcmp(name,"FreeSurfaceBaseAnalysis")==0) return FreeSurfaceBaseAnalysisEnum;
+	      else if (strcmp(name,"FreeSurfaceTopAnalysis")==0) return FreeSurfaceTopAnalysisEnum;
 	      else if (strcmp(name,"SurfaceNormalVelocity")==0) return SurfaceNormalVelocityEnum;
 	      else if (strcmp(name,"ExtrudeFromBaseAnalysis")==0) return ExtrudeFromBaseAnalysisEnum;
 	      else if (strcmp(name,"ExtrudeFromTopAnalysis")==0) return ExtrudeFromTopAnalysisEnum;
@@ -504,11 +505,11 @@
 	      else if (strcmp(name,"FractionIncrement")==0) return FractionIncrementEnum;
 	      else if (strcmp(name,"Friction")==0) return FrictionEnum;
 	      else if (strcmp(name,"Internal")==0) return InternalEnum;
-	      else if (strcmp(name,"MassFlux")==0) return MassFluxEnum;
          else stage=5;
    }
    if(stage==5){
-	      if (strcmp(name,"MeltingOffset")==0) return MeltingOffsetEnum;
+	      if (strcmp(name,"MassFlux")==0) return MassFluxEnum;
+	      else if (strcmp(name,"MeltingOffset")==0) return MeltingOffsetEnum;
 	      else if (strcmp(name,"Misfit")==0) return MisfitEnum;
 	      else if (strcmp(name,"Pressure")==0) return PressureEnum;
 	      else if (strcmp(name,"PressurePicard")==0) return PressurePicardEnum;
@@ -627,11 +628,11 @@
 	      else if (strcmp(name,"MisfitObservationEnum")==0) return MisfitObservationEnumEnum;
 	      else if (strcmp(name,"MisfitTimeinterpolation")==0) return MisfitTimeinterpolationEnum;
 	      else if (strcmp(name,"MisfitWeights")==0) return MisfitWeightsEnum;
-	      else if (strcmp(name,"MisfitWeightsEnum")==0) return MisfitWeightsEnumEnum;
          else stage=6;
    }
    if(stage==6){
-	      if (strcmp(name,"SurfaceObservation")==0) return SurfaceObservationEnum;
+	      if (strcmp(name,"MisfitWeightsEnum")==0) return MisfitWeightsEnumEnum;
+	      else if (strcmp(name,"SurfaceObservation")==0) return SurfaceObservationEnum;
 	      else if (strcmp(name,"WeightsSurfaceObservation")==0) return WeightsSurfaceObservationEnum;
 	      else if (strcmp(name,"MinVel")==0) return MinVelEnum;
 	      else if (strcmp(name,"MaxVel")==0) return MaxVelEnum;
@@ -750,11 +751,11 @@
 	      else if (strcmp(name,"MaterialsTimeRelaxationStress")==0) return MaterialsTimeRelaxationStressEnum;
 	      else if (strcmp(name,"MaterialsTimeRelaxationDamage")==0) return MaterialsTimeRelaxationDamageEnum;
 	      else if (strcmp(name,"MaterialsRidgingExponent")==0) return MaterialsRidgingExponentEnum;
-	      else if (strcmp(name,"MaterialsCohesion")==0) return MaterialsCohesionEnum;
          else stage=7;
    }
    if(stage==7){
-	      if (strcmp(name,"MaterialsInternalFrictionCoef")==0) return MaterialsInternalFrictionCoefEnum;
+	      if (strcmp(name,"MaterialsCohesion")==0) return MaterialsCohesionEnum;
+	      else if (strcmp(name,"MaterialsInternalFrictionCoef")==0) return MaterialsInternalFrictionCoefEnum;
 	      else if (strcmp(name,"MaterialsCompressionCoef")==0) return MaterialsCompressionCoefEnum;
 	      else if (strcmp(name,"MaterialsTractionCoef")==0) return MaterialsTractionCoefEnum;
 	      else if (strcmp(name,"VxStar")==0) return VxStarEnum;
Index: ../trunk-jpl/src/c/classes/Loads/Friction.h
===================================================================
--- ../trunk-jpl/src/c/classes/Loads/Friction.h	(revision 18510)
+++ ../trunk-jpl/src/c/classes/Loads/Friction.h	(revision 18511)
@@ -31,6 +31,7 @@
 		void  GetAlpha2(IssmDouble* palpha2,Gauss* gauss);
 		void  GetAlpha2Viscous(IssmDouble* palpha2,Gauss* gauss);
 		void  GetAlpha2Weertman(IssmDouble* palpha2,Gauss* gauss);
+		void  GetAlpha2Hydro(IssmDouble* palpha2,Gauss* gauss);
 		void  GetAlphaComplement(IssmDouble* alpha_complement,Gauss* gauss);
 };
 
Index: ../trunk-jpl/src/c/classes/Loads/Friction.cpp
===================================================================
--- ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 18510)
+++ ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 18511)
@@ -47,8 +47,10 @@
 			break;
 		case 2:
 			GetAlpha2Weertman(palpha2,gauss);
+	  case 3:
+			GetAlpha2Hydro(palpha2,gauss);
 			break;
-		default:
+	  default:
 			_error_("not supported");
 	}
 
@@ -154,6 +156,68 @@
 	/*Assign output pointers:*/
 	*palpha2=alpha2;
 }/*}}}*/
+void Friction::GetAlpha2Hydro(IssmDouble* palpha2, Gauss* gauss){/*{{{*/
+
+	/*This routine calculates the basal friction coefficient 
+		Based on Gagliardini 2007, needs a good effective pressure computation
+	  alpha2= C*Neff*[|vel|/{(C^n*Neff^n*As)*(1+alpha*Chi^q)}]^(1/n)  with
+		-Chi=|vel|/(C^n*Neff^n*As)
+		-alpha=(q-1)^(q-1)/q^q  **/
+
+	/*diverse: */
+	IssmDouble  q_exp;
+	IssmDouble  C_param;
+	IssmDouble  As;
+
+	IssmDouble  Neff;
+	IssmDouble  n;
+
+	IssmDouble  alpha;
+	IssmDouble  Chi;
+
+	IssmDouble  vx,vy,vz,vmag;
+	IssmDouble  alpha2;
+
+	/*Recover parameters: */
+	element->GetInputValue(&q_exp,FrictionQEnum);
+	element->GetInputValue(&C_param,FrictionCEnum);
+	element->GetInputValue(&As,FrictionAsEnum);
+
+	element->GetInputValue(&Neff,gauss,EffectivePressureEnum);
+	element->GetInputValue(&n,gauss,MaterialsRheologyNEnum);
+	
+	if(Neff<0)Neff=0;
+
+	switch(dim){
+		case 1:
+			element->GetInputValue(&vx,gauss,VxEnum);
+			vmag=sqrt(vx*vx);
+			break;
+		case 2:
+			element->GetInputValue(&vx,gauss,VxEnum);
+			element->GetInputValue(&vy,gauss,VyEnum);
+			vmag=sqrt(vx*vx+vy*vy);
+			break;
+		case 3:
+			element->GetInputValue(&vx,gauss,VxEnum);
+			element->GetInputValue(&vy,gauss,VyEnum);
+			element->GetInputValue(&vz,gauss,VzEnum);
+			vmag=sqrt(vx*vx+vy*vy+vz*vz);
+			break;
+		default:
+			_error_("not supported");
+	}
+
+	//compute alpha and Chi coefficients: */
+	alpha=(pow(q_exp-1,q_exp-1))/pow(q_exp,q_exp);
+	Chi=vmag/(pow(C_param,n)*pow(Neff,n)*As);
+
+	alpha2=C_param*Neff*pow((Chi/(1+alpha*pow(Chi,q_exp))),1./n);
+	_assert_(!xIsNan<IssmDouble>(alpha2));
+	
+	/*Assign output pointers:*/
+	*palpha2=alpha2;
+}/*}}}*/
 void Friction::GetAlphaComplement(IssmDouble* palpha_complement, Gauss* gauss){/*{{{*/
 
 	/* FrictionGetAlpha2 computes alpha2= drag^2 * Neff ^r * vel ^s, with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p. 
