Index: /issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
===================================================================
--- /issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 9074)
+++ /issm/trunk/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 9075)
@@ -42,9 +42,6 @@
 
 	/*Transient or static?:*/
-	if(M==iomodel->numberofvertices){ //{{{1
+	if(M==iomodel->numberofvertices){
 		/*static: just create Spc objects*/
-
-	
-		/*Initialize counter*/
 		count=0;
 	
@@ -60,13 +57,10 @@
 					count++;
 				}
-
-			} //if((my_nodes[i]==1))
+			}
 		}
-	} //}}}
-	else{ //{{{1
+	}
+	else{
 		/*transient: create transient Spct objects. Same logic, except we need to retrieve 
 		 * various times and values to initialize an Spct object: */
-
-		/*Initialize counter*/
 		count=0;
 
@@ -78,6 +72,4 @@
 		/*unit conversion: */
 		UnitConversion(times,N,ExtToIuEnum,TimeEnum);
-
-
 
 		/*Create spcs from x,y,z, as well as the spc values on those spcs: */
@@ -100,7 +92,7 @@
 				}
 				xfree((void**)&values);
-			} //if((my_nodes[i]==1))
+			}
 		}
-	} //}}}
+	}
 
 	/*Free ressources:*/
Index: /issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp
===================================================================
--- /issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp	(revision 9074)
+++ /issm/trunk/src/c/modules/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp	(revision 9075)
@@ -1,7 +1,4 @@
-/*
- * CreateConstraintsPrognostic.c:
- */
-
 #include "../../../Container/Container.h"
+#include "../../../modules/modules.h"
 #include "../../../toolkits/toolkits.h"
 #include "../../../EnumDefinitions/EnumDefinitions.h"
@@ -27,28 +24,7 @@
 	if(!constraints) constraints = new Constraints(ConstraintsEnum);
 
-	/*Do not add constraints in DG*/
+	/*Do not add constraints in DG, they are weakly imposed*/
 	if(!iomodel->prognostic_DG){
-
-		/*Fetch data: */
-		IoModelFetchData(&iomodel->spcthickness,NULL,NULL,iomodel_handle,SpcthicknessEnum);
-
-		/*Initialize counter*/
-		count=0;
-
-		/*Create spcs from x,y,z, as well as the spc values on those spcs: */
-		for (i=0;i<iomodel->numberofvertices;i++){
-			/*keep only this partition's nodes:*/
-			if((iomodel->my_vertices[i])){
-
-				if ((int)iomodel->spcthickness[2*i]){
-
-					constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,*(iomodel->spcthickness+2*i+1),PrognosticAnalysisEnum));
-					count++;
-				}
-			} //if((my_vertices[i]))
-		}
-
-		/*Free data: */
-		xfree((void**)&iomodel->spcthickness);
+		IoModelToConstraintsx(constraints,iomodel,iomodel_handle,SpcthicknessEnum,PrognosticAnalysisEnum);
 	}
 
Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 9074)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 9075)
@@ -775,4 +775,5 @@
 	/*Constants*/
 	const int  numdof=NDOF2*NUMVERTICES;
+	_error_("STOP");
 
 	/*Intermediaries*/
Index: /issm/trunk/src/m/classes/model.m
===================================================================
--- /issm/trunk/src/m/classes/model.m	(revision 9074)
+++ /issm/trunk/src/m/classes/model.m	(revision 9075)
@@ -15,5 +15,5 @@
 		 name            = {'',true,'String'};
 		 runtimename     = {'',false}; %name used when running a parallel job
-		 counter         = {0,false}; %1 mesh, 2 geography, 3 parameterize
+		 counter         = {0,false};
 		 domainoutline   = {NaN,false};
 		 riftoutline     = {NaN,false};
@@ -346,5 +346,5 @@
 	 end
 	 methods (Static)
-		 function md = loadobj(md) % {{{
+		 function md = lllloadobj(md) % {{{
 			 % This function is directly called by matlab when a model object is
 			 % loaded. If the input is a struct it is an old version of model and
Index: /issm/trunk/src/m/model/display/displaybc.m
===================================================================
--- /issm/trunk/src/m/model/display/displaybc.m	(revision 9074)
+++ /issm/trunk/src/m/model/display/displaybc.m	(revision 9075)
@@ -25,7 +25,7 @@
 
 disp(sprintf('\n      prognostic:'));
-fielddisplay(md,'spcthickness','constraints flag list (first column) and values (second column)');
+fielddisplay(md,'spcthickness','thickness constraints (NaN means no constraint)');
 
 disp(sprintf('\n      thermal:'));
-fielddisplay(md,'spctemperature','constraints flag list (first column) and values (second column)');
+fielddisplay(md,'spctemperature','temperature constraints (NaN means no constraint)');
 fielddisplay(md,'basal_melting_rate','basal melting rate [m/a]');
Index: /issm/trunk/src/m/model/display/displayprognostic.m
===================================================================
--- /issm/trunk/src/m/model/display/displayprognostic.m	(revision 9074)
+++ /issm/trunk/src/m/model/display/displayprognostic.m	(revision 9075)
@@ -18,3 +18,3 @@
 
 disp(sprintf('\n      boundary conditions:'));
-fielddisplay(md,'spcthickness','constraints flag list (first column) and values (second column)');
+fielddisplay(md,'spcthickness','thickness constraints (NaN means no constraint)');
Index: /issm/trunk/src/m/model/ismodelselfconsistent.m
===================================================================
--- /issm/trunk/src/m/model/ismodelselfconsistent.m	(revision 9074)
+++ /issm/trunk/src/m/model/ismodelselfconsistent.m	(revision 9075)
@@ -224,5 +224,5 @@
 	if any(md.thickness<=0),
 		pos=find(md.thickness<=0);
-		if any(find(md.spcthickness(pos,1)==0)),
+		if any(isnan(md.spcthickness(pos))),
 			message(['model not consistent: model ' md.name ' has some nodes with 0 thickness']);
 		end
@@ -369,5 +369,5 @@
 			if any(md.thickness<=0),
 				pos=find(md.thickness<=0);
-				if any(find(md.spcthickness(pos,1)==0)),
+				if any(isnan(md.spcthickness(pos))),
 					message(['model not consistent: model ' md.name ' has some nodes with 0 thickness']);
 				end
@@ -458,11 +458,4 @@
 			checksize(md,fields,[md.numberofnodes 1]);
 			checknan(md,fields);
-
-			%CHECK THAT WE ARE NOT FULLY CONSTRAINED
-			if (md.dim==2),
-				if isnan(find(~md.spcthickness(:,1))),
-					message(['model not consistent: model ' md.name ' is totally constrained for prognostic, no need to solve!']);
-				end
-			end
 			%}}}
 		case HydrologyAnalysisEnum,
@@ -560,11 +553,4 @@
 			checksize(md,fields,[md.numberofnodes 1]);
 			checknan(md,fields);
-
-			%SPC				 
-			%	if ~md.prognostic_DG,
-			%		if any(md.spcthickness(find(md.nodeonboundary))~=1),		 
-			%			message(['model not consistent: model ' md.name ' should have all the nodes on boundary constrained in field spcthickness']);			 
-			%		end 
-			%	end
 
 			%Triangle with zero velocity
Index: /issm/trunk/src/m/model/outflow.m
===================================================================
--- /issm/trunk/src/m/model/outflow.m	(revision 9074)
+++ /issm/trunk/src/m/model/outflow.m	(revision 9075)
@@ -1,3 +1,7 @@
 function flag=outflow(md);
+%OUTFLOW - flag nodes on outflux boundary
+%
+%   Usage:
+%      flag=outflow(md);
 
 A=md.segments(:,1);
Index: /issm/trunk/src/m/solvers/solver_linear.m
===================================================================
--- /issm/trunk/src/m/solvers/solver_linear.m	(revision 9074)
+++ /issm/trunk/src/m/solvers/solver_linear.m	(revision 9075)
@@ -9,9 +9,14 @@
 
 	[K_ff,K_fs,p_f,df,kmax]=SystemMatrices(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters);
+	full(K_ff)
+	condest(K_ff)
 	ys  =CreateNodalConstraints(femmodel.nodes,configuration_type);
 	p_f =Reduceload( p_f, K_fs, ys);
+	full(p_f)
 
 	issmprintf(VerboseSolver(),'%s%g','      condition number of stiffness matrix: ',condest(K_ff));
 	u_f=Solver(K_ff,p_f,[],df,femmodel.parameters);
+	u_f
+	error('stop')
 	u_g= Mergesolutionfromftog( u_f, ys, femmodel.nodes,femmodel.parameters); 
 	[femmodel.elements,femmodel.materials]=InputUpdateFromSolution(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,u_g);
Index: /issm/trunk/src/m/utils/BC/SetIceSheetBC.m
===================================================================
--- /issm/trunk/src/m/utils/BC/SetIceSheetBC.m	(revision 9074)
+++ /issm/trunk/src/m/utils/BC/SetIceSheetBC.m	(revision 9075)
@@ -58,5 +58,5 @@
 end
 
-md.spcthickness=zeros(md.numberofnodes,2);
+md.spcthickness=NaN*ones(md.numberofnodes,1);
 
 if (length(md.observed_temperature)==md.numberofnodes),
Index: /issm/trunk/src/m/utils/BC/SetIceShelfBC.m
===================================================================
--- /issm/trunk/src/m/utils/BC/SetIceShelfBC.m	(revision 9074)
+++ /issm/trunk/src/m/utils/BC/SetIceShelfBC.m	(revision 9075)
@@ -90,5 +90,5 @@
 end
 
-md.spcthickness=zeros(md.numberofnodes,2);
+md.spcthickness=NaN*ones(md.numberofnodes,1);
 
 if (length(md.observed_temperature)==md.numberofnodes),
Index: /issm/trunk/src/m/utils/BC/SetMarineIceSheetBC.m
===================================================================
--- /issm/trunk/src/m/utils/BC/SetMarineIceSheetBC.m	(revision 9074)
+++ /issm/trunk/src/m/utils/BC/SetMarineIceSheetBC.m	(revision 9075)
@@ -101,5 +101,5 @@
 end
 
-md.spcthickness=zeros(md.numberofnodes,2);
+md.spcthickness=NaN*ones(md.numberofnodes,1);
 
 if (length(md.observed_temperature)==md.numberofnodes),
Index: /issm/trunk/src/m/utils/Interp/PatchToVec.m
===================================================================
--- /issm/trunk/src/m/utils/Interp/PatchToVec.m	(revision 9074)
+++ /issm/trunk/src/m/utils/Interp/PatchToVec.m	(revision 9075)
@@ -8,5 +8,8 @@
 switch(Patch.interpolation(1)),
 	case P0Enum,
-		vec(Patch.element)=Patch.value;
+		%vec(Patch.element)=Patch.value;
+		connectivity=sparse(Patch.index(:),1,1);
+		value       =sparse(Patch.index(:),1,Patch.value(:));
+		vec=full(value./connectivity);
 	case P1Enum,
 		connectivity=sparse(Patch.index(:),1,1);
