Index: /issm/trunk/src/m/classes/public/BasinConstrain.m
===================================================================
--- /issm/trunk/src/m/classes/public/BasinConstrain.m	(revision 1307)
+++ /issm/trunk/src/m/classes/public/BasinConstrain.m	(revision 1308)
@@ -57,6 +57,17 @@
 numpos=unique(md.elements(pos,:));
 grids=setdiff(1:1:md.numberofgrids,numpos);
-
 md.gridondirichlet_diag(grids)=1;
 md.dirichletvalues_diag(grids,1)=md.vx_obs(grids);
 md.dirichletvalues_diag(grids,2)=md.vy_obs(grids);
+
+
+%make sure any grid with NaN velocity is spc'd:
+pos=find(isnan(md.vel_obs_raw));
+md.gridondirichlet_diag(pos)=1;
+%we spc to the smoothed value, so that control methods don't go berserk trying to figure out what reaction force to apply for the spc to stand.
+md.dirichletvalues_diag(pos,1)=md.vx_obs(pos); 
+md.dirichletvalues_diag(pos,2)=md.vy_obs(pos); 
+
+%make sure icefronts that are completely spc'd are taken out:
+free_segments=find(sum(md.gridondirichlet_diag(md.segmentonneumann_diag(:,1:2)),2)~=2);
+md.segmentonneumann_diag=md.segmentonneumann_diag(free_segments,:);
