Index: /issm/trunk/src/m/classes/@icefront/CreatePVector.m
===================================================================
--- /issm/trunk/src/m/classes/@icefront/CreatePVector.m	(revision 1396)
+++ /issm/trunk/src/m/classes/@icefront/CreatePVector.m	(revision 1397)
@@ -332,5 +332,4 @@
 	global element_debug  element_debugid
 
-
 	if strcmpi(load.type,'segment'),
 		%check that the element is onbed (collapsed formulation) otherwise:pe=0
Index: /issm/trunk/src/m/classes/@pentaelem/GetB_melange.m
===================================================================
--- /issm/trunk/src/m/classes/@pentaelem/GetB_melange.m	(revision 1397)
+++ /issm/trunk/src/m/classes/@pentaelem/GetB_melange.m	(revision 1397)
@@ -0,0 +1,29 @@
+function B=GetB_melange(pentaelem,xyz_list,gauss_coord)
+%GETB_MELANGE - compute the B matrix for the horizontal velocity of Pattyn's model
+%
+%   Compute B  matrix. B=[B1 B2 B3 B4 B5 B6] where Bi is of size numgrids*NDOF
+%   For grid i, Bi can be expressed in the basic coordinate system by:
+%   Bi_basic=[ dh/dx          0     ]
+%            [   0          dh/dy   ]
+%            [ 1/2*dh/dy  1/2*dh/dx ]
+%   where h is the interpolation function for grid i.
+%
+%   Usage:
+%      B=GetB_horiz(pentaelem,xyz_list,gauss_coord)
+% 
+%   See also GETBPRIME_HORIZ, CREATEKMATRIX
+
+	num_grids=6;	
+	NDOF2=2;
+
+	dh1dh6_basic=GetNodalFunctionsDerivativesBasic(pentaelem,xyz_list,gauss_coord);
+	%Build B:
+	B=zeros(3,NDOF2*num_grids);
+	for i=1:num_grids,
+		B(1,NDOF2*(i-1)+1)=dh1dh6_basic(1,i);
+		B(1,NDOF2*(i-1)+2)=0;
+		B(2,NDOF2*(i-1)+1)=0;
+		B(2,NDOF2*(i-1)+2)=dh1dh6_basic(2,i);
+		B(3,NDOF2*(i-1)+1)=dh1dh6_basic(2,i)/2;
+		B(3,NDOF2*(i-1)+2)=dh1dh6_basic(1,i)/2;	
+	end
Index: /issm/trunk/src/m/classes/@pentaelem/GetBprime_melange.m
===================================================================
--- /issm/trunk/src/m/classes/@pentaelem/GetBprime_melange.m	(revision 1397)
+++ /issm/trunk/src/m/classes/@pentaelem/GetBprime_melange.m	(revision 1397)
@@ -0,0 +1,30 @@
+function Bprime=GetBprime_melange(pentaelem,xyz_list,gauss_coord)
+%GETBPRIME_MELANGE - compute the Bprime matrix for horizontal velocities in Pattyn's model
+%
+%   Compute B'  matrix. B'=[B1' B2' B3' B4' B5' B6'] where Bi' is of size 3*NDOF2. 
+%   For grid i, Bi' can be expressed in the basic coordinate system by:
+%   Bi_basic'=[ 2*dh/dx    dh/dy ]
+%             [   dh/dx   2*dh/dy]
+%             [   dh/dy   dh/dx  ]
+%   where h is the interpolation function for grid i.
+%
+%   Usage:
+%      Bprime=GetBprime_horiz(pentaelem,xyz_list,gauss_coord)
+%
+%   See also GETB_HORIZ, CREATEKMATRIX
+
+	num_grids=6;	
+	NDOF2=2;
+
+	dh1dh6_basic=GetNodalFunctionsDerivativesBasic(pentaelem,xyz_list,gauss_coord);
+
+	%Build Bprime:
+	Bprime=zeros(3,NDOF2*num_grids);
+	for i=1:num_grids,
+		Bprime(1,NDOF2*(i-1)+1)=2*dh1dh6_basic(1,i);
+		Bprime(1,NDOF2*(i-1)+2)=  dh1dh6_basic(2,i);
+		Bprime(2,NDOF2*(i-1)+1)=  dh1dh6_basic(1,i);
+		Bprime(2,NDOF2*(i-1)+2)=2*dh1dh6_basic(2,i);
+		Bprime(3,NDOF2*(i-1)+1)=dh1dh6_basic(2,i);
+		Bprime(3,NDOF2*(i-1)+2)=dh1dh6_basic(1,i);		
+	end
Index: /issm/trunk/src/m/classes/@pentaelem/pentaelem.m
===================================================================
--- /issm/trunk/src/m/classes/@pentaelem/pentaelem.m	(revision 1396)
+++ /issm/trunk/src/m/classes/@pentaelem/pentaelem.m	(revision 1397)
@@ -17,4 +17,5 @@
 	pentaelem.friction_type=2;
 	pentaelem.viscosity_overshoot=0;
+	pentaelem.ontiling=0;
 	pentaelem.k=zeros(6,1);
 	pentaelem.p=1;
Index: /issm/trunk/src/m/classes/@triaelem/CreateKMatrix.m
===================================================================
--- /issm/trunk/src/m/classes/@triaelem/CreateKMatrix.m	(revision 1396)
+++ /issm/trunk/src/m/classes/@triaelem/CreateKMatrix.m	(revision 1397)
@@ -472,4 +472,8 @@
 end %for ig=1:num_gauss,
 
+%if triaelem.id==1,
+%	disp('tria')
+%	Ke.terms
+%end
 if (element_debug & triaelem.id==element_debugid),
 	disp(sprintf('Ke_gg->terms:\n'));
Index: /issm/trunk/src/m/classes/@triaelem/triaelem.m
===================================================================
--- /issm/trunk/src/m/classes/@triaelem/triaelem.m	(revision 1396)
+++ /issm/trunk/src/m/classes/@triaelem/triaelem.m	(revision 1397)
@@ -17,4 +17,5 @@
 	triaelem.friction_type=2;
 	triaelem.viscosity_overshoot=0;
+	triaelem.ontiling=0;
 	triaelem.k=zeros(3,1);
 	triaelem.p=1;
