Index: /issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.m
===================================================================
--- /issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.m	(revision 15794)
+++ /issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.m	(revision 15795)
@@ -31,9 +31,23 @@
 md.stressbalance.spcvy=NaN*ones(md.mesh.numberofvertices,1);
 md.stressbalance.spcvz=NaN*ones(md.mesh.numberofvertices,1);
-md.stressbalance.spcvx(pos)=0;
-md.stressbalance.spcvy(pos)=0;
-md.stressbalance.spcvz(pos)=0;
 md.stressbalance.referential=NaN*ones(md.mesh.numberofvertices,6);
 md.stressbalance.loadingforce=0*ones(md.mesh.numberofvertices,3);
+
+%Ice front position: 
+md.mask.icelevelset(find(nodeonicefront))=0;
+
+%First find segments that are not completely on the front
+if(md.mesh.dimension==2),
+	numbernodesfront=2;
+else 
+	numbernodesfront=4;
+end
+segmentsfront=md.mask.icelevelset(md.mesh.segments(:,1:numbernodesfront))==0;
+segments=find(sum(segmentsfront,2)~=numbernodesfront);
+%Find all nodes for these segments and spc them
+pos=[md.mesh.segments(segments,1:numbernodesfront)];
+md.stressbalance.spcvx(pos(:))=0;
+md.stressbalance.spcvy(pos(:))=0;
+md.stressbalance.spcvz(pos(:))=0;
 
 %Dirichlet Values
@@ -45,7 +59,4 @@
 	disp('      boundary conditions for stressbalance model: spc set as zero');
 end
-
-%Ice front position
-md.mask.icelevelset(find(nodeonicefront))=0;
 
 %Create zeros basalforcings and surfaceforcings
Index: /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m
===================================================================
--- /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m	(revision 15794)
+++ /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.m	(revision 15795)
@@ -38,9 +38,24 @@
 md.stressbalance.spcvy=NaN*ones(md.mesh.numberofvertices,1);
 md.stressbalance.spcvz=NaN*ones(md.mesh.numberofvertices,1);
-md.stressbalance.spcvx(pos)=0;
-md.stressbalance.spcvy(pos)=0;
-md.stressbalance.spcvz(pos)=0;
 md.stressbalance.referential=NaN*ones(md.mesh.numberofvertices,6);
 md.stressbalance.loadingforce=0*ones(md.mesh.numberofvertices,3);
+
+
+%Position of ice front
+md.mask.icelevelset(find(vertexonicefront))=0;
+
+%First find segments that are not completely on the front
+if(md.mesh.dimension==2),
+	numbernodesfront=2;
+else 
+	numbernodesfront=4;
+end
+segmentsfront=md.mask.icelevelset(md.mesh.segments(:,1:numbernodesfront))==0;
+segments=find(sum(segmentsfront,2)~=numbernodesfront);
+%Find all nodes for these segments and spc them
+pos=[md.mesh.segments(segments,1:numbernodesfront)];
+md.stressbalance.spcvx(pos(:))=0;
+md.stressbalance.spcvy(pos(:))=0;
+md.stressbalance.spcvz(pos(:))=0;
 
 %Dirichlet Values
@@ -56,7 +71,4 @@
 pos=find(md.mesh.vertexonboundary);
 md.hydrology.spcwatercolumn(pos,1)=1;
-
-%Position of ice front
-md.mask.icelevelset(find(vertexonicefront))=0;
 
 %Create zeros basalforcings and surfaceforcings
