Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 10523)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 10524)
@@ -5141,7 +5141,8 @@
 
 	/*Constants*/
-	const int    numdofm=NDOF2*NUMVERTICES2D;
-	const int    numdofp=NDOF2*NUMVERTICES;
-	const int    numdoftotal=2*NDOF2*NUMVERTICES;
+	const int numnodes    = 2 *NUMVERTICES;
+	const int numdofm     = NDOF2 *NUMVERTICES2D;
+	const int numdofp     = NDOF2 *NUMVERTICES;
+	const int numdoftotal = 2 *NDOF2*NUMVERTICES;
 
 	/*Intermediaries */
@@ -5159,8 +5160,18 @@
 	GaussPenta *gauss=NULL;
 	GaussTria  *gauss_tria=NULL;
+	Node       *node_list[numnodes];
+	int         cs_list[numnodes];
 
 	/*Find penta on bed as pattyn must be coupled to the dofs on the bed: */
 	Penta* pentabase=GetBasalElement();
-	Tria* tria=pentabase->SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria.
+	Tria*  tria=pentabase->SpawnTria(0,1,2); //nodes 0, 1 and 2 make the new tria.
+
+	/*Prepare node list*/
+	for(i=0;i<NUMVERTICES;i++){
+		node_list[i+0*NUMVERTICES] = pentabase->nodes[i];
+		node_list[i+1*NUMVERTICES] = this->nodes[i];
+		cs_list[i+0*NUMVERTICES] = XYEnum;
+		cs_list[i+1*NUMVERTICES] = XYEnum;
+	}
 
 	/*Initialize Element matrix*/
@@ -5209,4 +5220,7 @@
 	for(i=0;i<numdofm;i++) for(j=0;j<numdofp;j++) Ke->values[i*numdoftotal+(j+2*numdofm)]+=Ke_gg[j][i];
 
+	/*Transform Coordinate System*/
+	TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
+
 	/*Clean-up and return*/
 	delete tria->matice; delete tria;
@@ -5220,6 +5234,7 @@
 
 	/*Constants*/
-	const int numdof        = NDOF2 *NUMVERTICES;
-	const int numdoftotal   = NDOF4 *NUMVERTICES;
+	const int numnodes    = 2 *NUMVERTICES;
+	const int numdof      = NDOF2 *NUMVERTICES;
+	const int numdoftotal = NDOF4 *NUMVERTICES;
 	
 	/*Intermediaries */
@@ -5238,4 +5253,6 @@
 	Friction  *friction = NULL;
 	GaussPenta *gauss=NULL;
+	Node       *node_list[numnodes];
+	int         cs_list[numnodes];
 
 	/*Initialize Element matrix and return if necessary*/
@@ -5245,4 +5262,12 @@
 	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
 	delete Ke1; delete Ke2;
+
+	/*Prepare node list*/
+	for(i=0;i<NUMVERTICES;i++){
+		node_list[i+0*NUMVERTICES] = this->nodes[i];
+		node_list[i+1*NUMVERTICES] = this->nodes[i];
+		cs_list[i+0*NUMVERTICES] = XYEnum;
+		cs_list[i+1*NUMVERTICES] = XYEnum;
+	}
 
 	/*retrieve inputs :*/
@@ -5293,4 +5318,7 @@
 	for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[i*numdoftotal+(numdof+j)]+=Ke_gg[i][j];
 	for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke->values[(i+numdof)*numdoftotal+j]+=Ke_gg[i][j];
+
+	/*Transform Coordinate System*/
+	TransformStiffnessMatrixCoord(Ke,node_list,numnodes,cs_list);
 
 	/*Clean up and return*/
@@ -7354,4 +7382,8 @@
 	}
 
+	/*Transform solution in Cartesian Space*/
+	TransformSolutionCoord(&macayeal_values[0],penta->nodes,NUMVERTICES,XYEnum);
+	TransformSolutionCoord(&pattyn_values[0],   this->nodes,NUMVERTICES,XYEnum);
+
 	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
 	for(i=0;i<NUMVERTICES;i++){
Index: /issm/trunk/src/c/shared/Elements/CoordinateSystemTransform.cpp
===================================================================
--- /issm/trunk/src/c/shared/Elements/CoordinateSystemTransform.cpp	(revision 10523)
+++ /issm/trunk/src/c/shared/Elements/CoordinateSystemTransform.cpp	(revision 10524)
@@ -45,6 +45,6 @@
 			case XYEnum:
 				/*We remove the z component, we need to renormalize x and y*/
-				x_norm = sqrt( coord_system[0][0]*coord_system[0][0] + coord_system[1][0]*coord_system[1][0]);
-				y_norm = sqrt( coord_system[0][1]*coord_system[0][1] + coord_system[1][1]*coord_system[1][1]);
+				x_norm = sqrt( coord_system[0][0]*coord_system[0][0] + coord_system[1][0]*coord_system[1][0]); _assert_(x_norm>1.e-5);
+				y_norm = sqrt( coord_system[0][1]*coord_system[0][1] + coord_system[1][1]*coord_system[1][1]); _assert_(y_norm>1.e-5);
 				transform[(numdofs)*(counter+0) + counter+0] = coord_system[0][0]/x_norm;
 				transform[(numdofs)*(counter+0) + counter+1] = coord_system[0][1]/y_norm;
