Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 5850)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 5851)
@@ -2002,4 +2002,11 @@
 void Penta::CreateKMatrixCouplingMacAyealPattyn( Mat Kgg){
 
+	this->CreateKMatrixCouplingMacAyealPattynViscous(Kgg);
+	this->CreateKMatrixCouplingMacAyealPattynFriction(Kgg);
+}
+/*}}}*/
+/*FUNCTION Penta::CreateKMatrixCouplingMacAyealPattynViscous{{{1*/
+void Penta::CreateKMatrixCouplingMacAyealPattynViscous( Mat Kgg){
+
 	/* local declarations */
 	int             i,j;
@@ -2120,20 +2127,20 @@
 	MatSetValues(Kgg,numdofm,doflistm,numdofp,doflistp,(const double*)Ke_gg_transp,ADD_VALUES);
 
-	//Deal with 2d friction at the bedrock interface
-	if(IsOnBed() && !IsOnShelf()){
-
-		/*Build a tria element using the 3 grids of the base of the penta. Then use 
-		 * the tria functionality to build a friction stiffness matrix on these 3
-		 * grids: */
-
-		tria->CreateKMatrixCouplingMacAyealPattynFriction(Kgg);
-	}
-
-	delete tria->matice; delete tria;
-
 	xfree((void**)&doflistm);
 	xfree((void**)&doflistp);
+	delete tria->matice; delete tria;
 	delete gauss;
 	delete gauss_tria;
+}
+/*}}}*/
+/*FUNCTION Penta::CreateKMatrixCouplingMacAyealPattynFriction{{{1*/
+void Penta::CreateKMatrixCouplingMacAyealPattynFriction( Mat Kgg){
+
+	/*Initialize Element matrix and return if necessary*/
+	if(IsOnWater() || IsOnShelf() || !IsOnBed()) return;
+
+	Tria* tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria.
+	tria->CreateKMatrixCouplingMacAyealPattynFriction(Kgg);
+	delete tria->matice; delete tria;
 }
 /*}}}*/
Index: /issm/trunk/src/c/objects/Elements/Penta.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.h	(revision 5850)
+++ /issm/trunk/src/c/objects/Elements/Penta.h	(revision 5851)
@@ -124,4 +124,6 @@
 		void	  CreateKMatrixBalancedvelocities(Mat Kggg);
 		void	  CreateKMatrixCouplingMacAyealPattyn( Mat Kgg);
+		void	  CreateKMatrixCouplingMacAyealPattynViscous( Mat Kgg);
+		void	  CreateKMatrixCouplingMacAyealPattynFriction( Mat Kgg);
 		void	  CreateKMatrixCouplingPattynStokes( Mat Kgg);
 		void	  CreateKMatrixDiagnosticHoriz( Mat Kgg);
