Index: /issm/trunk-jpl/src/m/mech/basalstress.m
===================================================================
--- /issm/trunk-jpl/src/m/mech/basalstress.m	(revision 27594)
+++ /issm/trunk-jpl/src/m/mech/basalstress.m	(revision 27595)
@@ -13,5 +13,15 @@
 r=averaging(md,md.friction.q./md.friction.p,0);
 
-%compute horizontal velocity
+%Compute effective pressure
+switch(md.friction.coupling)
+	case 0
+		N = max(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.base),0);
+	case 3
+		N = max(md.friction.effective_pressure, 0);
+	otherwise
+		error('not supported yet');
+end
+
+%compute sliding velocity
 ub=sqrt(md.initialization.vx.^2+md.initialization.vy.^2)/md.constants.yts;
 ubx=md.initialization.vx/md.constants.yts;
@@ -19,10 +29,11 @@
 
 %compute basal drag (S.I.)
-alpha2=(max(md.constants.g*(md.materials.rho_ice*md.geometry.thickness+md.materials.rho_water*md.geometry.base),0).^r).*(md.friction.coefficient.^2).*(ub.^(s-1));
+alpha2 = (N.^r).*(md.friction.coefficient.^2).*(ub.^(s-1));
 b  =  alpha2.*ub;
 bx = -alpha2.*ubx;
 by = -alpha2.*uby;
 
-clear alpha2
-
+%reeeturn magnitude of only one output is requested
+if nargout==1
+	bx = b;
 end
