Index: ../trunk-jpl/test/NightlyRun/test438.m
===================================================================
--- ../trunk-jpl/test/NightlyRun/test438.m	(revision 0)
+++ ../trunk-jpl/test/NightlyRun/test438.m	(revision 18772)
@@ -0,0 +1,37 @@
+md=triangle(model(),'../Exp/Square.exp',150000.);
+md=setmask(md,'../Exp/SquareShelf.exp','');
+md=parameterize(md,'../Par/SquareSheetShelf.par');
+md=setflowequation(md,'SSA','all');
+md.friction=frictionwaterlayer(md.friction);
+md.friction.water_layer=zeros(md.mesh.numberofvertices,2);
+md.friction.water_layer(:,2)=1;
+md.friction.water_layer(md.mesh.numberofvertices+1,:)=[1 2];
+md.cluster=generic('name',oshostname(),'np',3);
+md=solve(md,TransientSolutionEnum());
+
+%Fields and tolerances to track changes
+field_names     ={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
+field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+field_values={...
+	(md.results.TransientSolution(1).Vx),...
+	(md.results.TransientSolution(1).Vy),...
+	(md.results.TransientSolution(1).Vel),...
+	(md.results.TransientSolution(1).Pressure),...
+	(md.results.TransientSolution(1).Base),...
+	(md.results.TransientSolution(1).Surface),...
+	(md.results.TransientSolution(1).Thickness),...
+	(md.results.TransientSolution(2).Vx),...
+	(md.results.TransientSolution(2).Vy),...
+	(md.results.TransientSolution(2).Vel),...
+	(md.results.TransientSolution(2).Pressure),...
+	(md.results.TransientSolution(2).Base),...
+	(md.results.TransientSolution(2).Surface),...
+	(md.results.TransientSolution(2).Thickness),...
+	(md.results.TransientSolution(3).Vx),...
+	(md.results.TransientSolution(3).Vy),...
+	(md.results.TransientSolution(3).Vel),...
+	(md.results.TransientSolution(3).Pressure),...
+	(md.results.TransientSolution(3).Base),...
+	(md.results.TransientSolution(3).Surface),...
+	(md.results.TransientSolution(3).Thickness),...
+	};
Index: ../trunk-jpl/test/NightlyRun/test439.m
===================================================================
--- ../trunk-jpl/test/NightlyRun/test439.m	(revision 0)
+++ ../trunk-jpl/test/NightlyRun/test439.m	(revision 18772)
@@ -0,0 +1,38 @@
+md=triangle(model(),'../Exp/Square.exp',150000.);
+md=setmask(md,'../Exp/SquareShelf.exp','');
+md=parameterize(md,'../Par/SquareSheetShelf.par');
+md=extrude(md,4,1);
+md=setflowequation(md,'HO','all');
+md.friction=frictionwaterlayer(md.friction);
+md.friction.water_layer=zeros(md.mesh.numberofvertices,2);
+md.friction.water_layer(:,2)=1;
+md.friction.water_layer(md.mesh.numberofvertices+1,:)=[1 2];
+md.cluster=generic('name',oshostname(),'np',3);
+md=solve(md,TransientSolutionEnum());
+
+%Fields and tolerances to track changes
+field_names     ={'Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3'};
+field_tolerances={1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09,1e-09};
+field_values={...
+	(md.results.TransientSolution(1).Vx),...
+	(md.results.TransientSolution(1).Vy),...
+	(md.results.TransientSolution(1).Vel),...
+	(md.results.TransientSolution(1).Pressure),...
+	(md.results.TransientSolution(1).Base),...
+	(md.results.TransientSolution(1).Surface),...
+	(md.results.TransientSolution(1).Thickness),...
+	(md.results.TransientSolution(2).Vx),...
+	(md.results.TransientSolution(2).Vy),...
+	(md.results.TransientSolution(2).Vel),...
+	(md.results.TransientSolution(2).Pressure),...
+	(md.results.TransientSolution(2).Base),...
+	(md.results.TransientSolution(2).Surface),...
+	(md.results.TransientSolution(2).Thickness),...
+	(md.results.TransientSolution(3).Vx),...
+	(md.results.TransientSolution(3).Vy),...
+	(md.results.TransientSolution(3).Vel),...
+	(md.results.TransientSolution(3).Pressure),...
+	(md.results.TransientSolution(3).Base),...
+	(md.results.TransientSolution(3).Surface),...
+	(md.results.TransientSolution(3).Thickness),...
+	};
Index: ../trunk-jpl/test/Archives/Archive439.nc
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: ../trunk-jpl/test/Archives/Archive439.nc
===================================================================
--- ../trunk-jpl/test/Archives/Archive439.nc	(revision 18771)
+++ ../trunk-jpl/test/Archives/Archive439.nc	(revision 18772)

Property changes on: ../trunk-jpl/test/Archives/Archive439.nc
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: ../trunk-jpl/test/Archives/Archive438.nc
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: ../trunk-jpl/test/Archives/Archive438.nc
===================================================================
--- ../trunk-jpl/test/Archives/Archive438.nc	(revision 18771)
+++ ../trunk-jpl/test/Archives/Archive438.nc	(revision 18772)

Property changes on: ../trunk-jpl/test/Archives/Archive438.nc
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
===================================================================
--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 18771)
+++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 18772)
@@ -273,6 +273,12 @@
 			iomodel->FetchDataToInput(elements,PressureEnum);
 			iomodel->FetchDataToInput(elements,TemperatureEnum);
 			break;
+		case 5:
+			iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+			iomodel->FetchDataToInput(elements,FrictionPEnum);
+			iomodel->FetchDataToInput(elements,FrictionQEnum);
+			iomodel->FetchDataToInput(elements,FrictionWaterLayerEnum);
+			break;
 		default:
 			_error_("not supported");
 	}
Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
===================================================================
--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 18771)
+++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 18772)
@@ -88,6 +88,12 @@
 			iomodel->FetchDataToInput(elements,FrictionCEnum);
 			iomodel->FetchDataToInput(elements,FrictionMEnum);
 			break;
+		case 5:
+			iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+			iomodel->FetchDataToInput(elements,FrictionPEnum);
+			iomodel->FetchDataToInput(elements,FrictionQEnum);
+			iomodel->FetchDataToInput(elements,FrictionWaterLayerEnum);
+			break;
 		default:
 			_error_("not supported");
 	}
Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
===================================================================
--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 18771)
+++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 18772)
@@ -107,6 +107,12 @@
 			iomodel->FetchDataToInput(elements,PressureEnum);
 			iomodel->FetchDataToInput(elements,TemperatureEnum);
 			break;
+		case 5:
+			iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+			iomodel->FetchDataToInput(elements,FrictionPEnum);
+			iomodel->FetchDataToInput(elements,FrictionQEnum);
+			iomodel->FetchDataToInput(elements,FrictionWaterLayerEnum);
+			break;
 		default:
 			_error_("not supported");
 	}
Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 18771)
+++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 18772)
@@ -95,6 +95,7 @@
 	FrictionCEnum,
 	FrictionLawEnum,
 	FrictionGammaEnum,
+	FrictionWaterLayerEnum,
 	GeometryHydrostaticRatioEnum,
 	HydrologyModelEnum,
 	HydrologyshreveEnum,
Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 18771)
+++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 18772)
@@ -103,6 +103,7 @@
 		case FrictionCEnum : return "FrictionC";
 		case FrictionLawEnum : return "FrictionLaw";
 		case FrictionGammaEnum : return "FrictionGamma";
+		case FrictionWaterLayerEnum : return "FrictionWaterLayer";
 		case GeometryHydrostaticRatioEnum : return "GeometryHydrostaticRatio";
 		case HydrologyModelEnum : return "HydrologyModel";
 		case HydrologyshreveEnum : return "Hydrologyshreve";
Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 18771)
+++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 18772)
@@ -103,6 +103,7 @@
 	      else if (strcmp(name,"FrictionC")==0) return FrictionCEnum;
 	      else if (strcmp(name,"FrictionLaw")==0) return FrictionLawEnum;
 	      else if (strcmp(name,"FrictionGamma")==0) return FrictionGammaEnum;
+	      else if (strcmp(name,"FrictionWaterLayer")==0) return FrictionWaterLayerEnum;
 	      else if (strcmp(name,"GeometryHydrostaticRatio")==0) return GeometryHydrostaticRatioEnum;
 	      else if (strcmp(name,"HydrologyModel")==0) return HydrologyModelEnum;
 	      else if (strcmp(name,"Hydrologyshreve")==0) return HydrologyshreveEnum;
@@ -135,11 +136,11 @@
 	      else if (strcmp(name,"HydrologydcEplColapseThickness")==0) return HydrologydcEplColapseThicknessEnum;
 	      else if (strcmp(name,"HydrologydcEplMaxThickness")==0) return HydrologydcEplMaxThicknessEnum;
 	      else if (strcmp(name,"HydrologydcEplThickness")==0) return HydrologydcEplThicknessEnum;
-	      else if (strcmp(name,"HydrologydcEplThicknessOld")==0) return HydrologydcEplThicknessOldEnum;
          else stage=2;
    }
    if(stage==2){
-	      if (strcmp(name,"HydrologydcEplConductivity")==0) return HydrologydcEplConductivityEnum;
+	      if (strcmp(name,"HydrologydcEplThicknessOld")==0) return HydrologydcEplThicknessOldEnum;
+	      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;
@@ -258,11 +259,11 @@
 	      else if (strcmp(name,"MeshX")==0) return MeshXEnum;
 	      else if (strcmp(name,"MeshY")==0) return MeshYEnum;
 	      else if (strcmp(name,"MeshZ")==0) return MeshZEnum;
-	      else if (strcmp(name,"MeshElementtype")==0) return MeshElementtypeEnum;
          else stage=3;
    }
    if(stage==3){
-	      if (strcmp(name,"DomainType")==0) return DomainTypeEnum;
+	      if (strcmp(name,"MeshElementtype")==0) return MeshElementtypeEnum;
+	      else if (strcmp(name,"DomainType")==0) return DomainTypeEnum;
 	      else if (strcmp(name,"DomainDimension")==0) return DomainDimensionEnum;
 	      else if (strcmp(name,"Domain2Dhorizontal")==0) return Domain2DhorizontalEnum;
 	      else if (strcmp(name,"Domain2Dvertical")==0) return Domain2DverticalEnum;
@@ -381,11 +382,11 @@
 	      else if (strcmp(name,"ConfigurationType")==0) return ConfigurationTypeEnum;
 	      else if (strcmp(name,"AdjointBalancethicknessAnalysis")==0) return AdjointBalancethicknessAnalysisEnum;
 	      else if (strcmp(name,"AdjointBalancethickness2Analysis")==0) return AdjointBalancethickness2AnalysisEnum;
-	      else if (strcmp(name,"AdjointHorizAnalysis")==0) return AdjointHorizAnalysisEnum;
          else stage=4;
    }
    if(stage==4){
-	      if (strcmp(name,"AnalysisCounter")==0) return AnalysisCounterEnum;
+	      if (strcmp(name,"AdjointHorizAnalysis")==0) return AdjointHorizAnalysisEnum;
+	      else if (strcmp(name,"AnalysisCounter")==0) return AnalysisCounterEnum;
 	      else if (strcmp(name,"DefaultAnalysis")==0) return DefaultAnalysisEnum;
 	      else if (strcmp(name,"BalancethicknessAnalysis")==0) return BalancethicknessAnalysisEnum;
 	      else if (strcmp(name,"BalancethicknessSolution")==0) return BalancethicknessSolutionEnum;
@@ -504,11 +505,11 @@
 	      else if (strcmp(name,"SpcStatic")==0) return SpcStaticEnum;
 	      else if (strcmp(name,"SpcTransient")==0) return SpcTransientEnum;
 	      else if (strcmp(name,"StringArrayParam")==0) return StringArrayParamEnum;
-	      else if (strcmp(name,"StringParam")==0) return StringParamEnum;
          else stage=5;
    }
    if(stage==5){
-	      if (strcmp(name,"Seg")==0) return SegEnum;
+	      if (strcmp(name,"StringParam")==0) return StringParamEnum;
+	      else if (strcmp(name,"Seg")==0) return SegEnum;
 	      else if (strcmp(name,"SegInput")==0) return SegInputEnum;
 	      else if (strcmp(name,"Tria")==0) return TriaEnum;
 	      else if (strcmp(name,"TriaInput")==0) return TriaInputEnum;
@@ -627,11 +628,11 @@
 	      else if (strcmp(name,"P1bubblecondensed")==0) return P1bubblecondensedEnum;
 	      else if (strcmp(name,"P2")==0) return P2Enum;
 	      else if (strcmp(name,"P2bubble")==0) return P2bubbleEnum;
-	      else if (strcmp(name,"P2bubblecondensed")==0) return P2bubblecondensedEnum;
          else stage=6;
    }
    if(stage==6){
-	      if (strcmp(name,"P2xP1")==0) return P2xP1Enum;
+	      if (strcmp(name,"P2bubblecondensed")==0) return P2bubblecondensedEnum;
+	      else if (strcmp(name,"P2xP1")==0) return P2xP1Enum;
 	      else if (strcmp(name,"P1xP2")==0) return P1xP2Enum;
 	      else if (strcmp(name,"P1xP3")==0) return P1xP3Enum;
 	      else if (strcmp(name,"P2xP4")==0) return P2xP4Enum;
@@ -750,11 +751,11 @@
 	      else if (strcmp(name,"Paterson")==0) return PatersonEnum;
 	      else if (strcmp(name,"Arrhenius")==0) return ArrheniusEnum;
 	      else if (strcmp(name,"LliboutryDuval")==0) return LliboutryDuvalEnum;
-	      else if (strcmp(name,"TransientIslevelset")==0) return TransientIslevelsetEnum;
          else stage=7;
    }
    if(stage==7){
-	      if (strcmp(name,"ExtrapolationVariable")==0) return ExtrapolationVariableEnum;
+	      if (strcmp(name,"TransientIslevelset")==0) return TransientIslevelsetEnum;
+	      else if (strcmp(name,"ExtrapolationVariable")==0) return ExtrapolationVariableEnum;
 	      else if (strcmp(name,"IceMaskNodeActivation")==0) return IceMaskNodeActivationEnum;
 	      else if (strcmp(name,"LevelsetfunctionSlopeX")==0) return LevelsetfunctionSlopeXEnum;
 	      else if (strcmp(name,"LevelsetfunctionSlopeY")==0) return LevelsetfunctionSlopeYEnum;
Index: ../trunk-jpl/src/c/classes/Loads/Friction.cpp
===================================================================
--- ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 18771)
+++ ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 18772)
@@ -263,7 +263,7 @@
 	IssmDouble  Neff;
 	IssmDouble  thickness,bed;
 	IssmDouble  vx,vy,vz,vmag;
-	IssmDouble  drag_coefficient;
+	IssmDouble  drag_coefficient,water_layer;
 	IssmDouble  alpha2;
 
 	/*Recover parameters: */
@@ -272,6 +272,7 @@
 	element->GetInputValue(&thickness, gauss,ThicknessEnum);
 	element->GetInputValue(&bed, gauss,BaseEnum);
 	element->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
+	element->GetInputValue(&water_layer, gauss,FrictionWaterLayerEnum);
 	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
@@ -281,7 +282,7 @@
 	s=1./drag_p;
 
 	//From bed and thickness, compute effective pressure when drag is viscous:
-	Neff=gravity*(rho_ice*thickness+rho_water*bed);
+	Neff=gravity*(rho_ice*thickness+rho_water*(bed+water_layer));
 	if(Neff<0)Neff=0;
 
 	switch(dim){
Index: ../trunk-jpl/src/m/classes/frictionwaterlayer.m
===================================================================
--- ../trunk-jpl/src/m/classes/frictionwaterlayer.m	(revision 18771)
+++ ../trunk-jpl/src/m/classes/frictionwaterlayer.m	(revision 18772)
@@ -3,7 +3,7 @@
 %   Usage:
 %      frictionwaterlayer=frictionwaterlayer();
 
-classdef frictiontemp
+classdef frictionwaterlayer
 	properties (SetAccess=public) 
 		coefficient = NaN;
 		p           = NaN;
@@ -16,7 +16,7 @@
 				case 0
 					obj=setdefaultparameters(obj);
 				case 1
-					obj=structtoobj(frictiontemp(),varargin{1});
+					obj=structtoobj(frictionwaterlayer(),varargin{1});
 				otherwise
 					error('constructor not supported');
 			end
