Index: /issm/trunk-jpl/src/m/classes/autodiff.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/autodiff.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/autodiff.m	(revision 12663)
@@ -22,5 +22,5 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/balancethickness.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/balancethickness.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/balancethickness.m	(revision 12663)
@@ -25,11 +25,11 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 			%Early return
 			if solution~=BalancethicknessSolutionEnum, return; end
 
-			checkfield(md,'balancethickness.spcthickness','forcing',1);
-			checkfield(md,'balancethickness.thickening_rate','size',[md.mesh.numberofvertices 1],'NaN',1);
-			checkfield(md,'balancethickness.stabilization','size',[1 1],'values',[0 1 2 3]);
+			md = checkfield(md,'balancethickness.spcthickness','forcing',1);
+			md = checkfield(md,'balancethickness.thickening_rate','size',[md.mesh.numberofvertices 1],'NaN',1);
+			md = checkfield(md,'balancethickness.stabilization','size',[1 1],'values',[0 1 2 3]);
 		end % }}}
 		function disp(obj) % {{{
Index: /issm/trunk-jpl/src/m/classes/basalforcings.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/basalforcings.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/basalforcings.m	(revision 12663)
@@ -22,15 +22,15 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 			if ismember(PrognosticAnalysisEnum,analyses) & ~(solution==TransientSolutionEnum & md.transient.isprognostic==0),
-				checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1);
+				md = checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1);
 			end
 			if ismember(BalancethicknessAnalysisEnum,analyses),
-				checkfield(md,'basalforcings.melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'basalforcings.melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]);
 			end
 			if ismember(ThermalAnalysisEnum,analyses) & ~(solution==TransientSolutionEnum & md.transient.isthermal==0),
-				checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1);
-				checkfield(md,'basalforcings.geothermalflux','NaN',1,'forcing',1,'>=',0);
+				md = checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1);
+				md = checkfield(md,'basalforcings.geothermalflux','NaN',1,'forcing',1,'>=',0);
 			end
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/clusters/acenet.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/acenet.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/clusters/acenet.m	(revision 12663)
@@ -47,5 +47,5 @@
 		 end
 		 %}}}
-		 function checkconsistency(cluster,md,solution,analyses) % {{{
+		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
 			 available_queues={'debug','shortq','longq'};
Index: /issm/trunk-jpl/src/m/classes/clusters/castor.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/castor.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/clusters/castor.m	(revision 12663)
@@ -37,5 +37,5 @@
 		 end
 		 %}}}
-		 function checkconsistency(cluster,md,solution,analyses) % {{{
+		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
 			 available_queues={'shortc','longc'};
Index: /issm/trunk-jpl/src/m/classes/clusters/cosmos.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/cosmos.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/clusters/cosmos.m	(revision 12663)
@@ -37,5 +37,5 @@
 		 end
 		 %}}}
-		 function checkconsistency(cluster,md,solution,analyses) % {{{
+		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
 			 available_queues={'debug','shortq','longq'};
Index: /issm/trunk-jpl/src/m/classes/clusters/discover.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/discover.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/clusters/discover.m	(revision 12663)
@@ -56,5 +56,5 @@
 		 end
 		 %}}}
-		 function checkconsistency(cluster,md,solution,analyses) % {{{
+		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
 			 available_queues={'general_long','general','general_small','debug'};
@@ -65,23 +65,23 @@
 
 			 if ( strcmpi(cluster.queue,'general') & cluster.cpuspernode*cluster.numnodes < 17)
-				 checkmessage('cpus must be great than 17 for general queue');
+				 md = checkmessage(md,'cpus must be great than 17 for general queue');
 			 end
 			 %now, check cluster.cpuspernode according to processor type
 			 if ( strcmpi(cluster.processor,'neha')),
 				 if ((cluster.cpuspernode>8 ) | (cluster.cpuspernode<1)),
-					 checkmessage('cpuspernode should be between 1 and 8 for ''neha'' processors');
+					 md = checkmessage(md,'cpuspernode should be between 1 and 8 for ''neha'' processors');
 				 end
 			 elseif strcmpi(cluster.processor,'west'),
 				 if ((cluster.cpuspernode>12 ) | (cluster.cpuspernode<1)),
-					 checkmessage('cpuspernode should be between 1 and 12 for ''west'' processors');
+					 md = checkmessage(md,'cpuspernode should be between 1 and 12 for ''west'' processors');
 				 end
 			 else
-				 checkmessage('unknown processor type, should be ''neha'' or ''west'' ');
+				 md = checkmessage(md,'unknown processor type, should be ''neha'' or ''west'' ');
 			 end
 
 			 %Miscelaneous
-			 if isempty(cluster.login), checkmessage('login empty'); end
-			 if isempty(cluster.codepath), checkmessage('codepath empty'); end
-			 if isempty(cluster.executionpath), checkmessage('executionpath empty'); end
+			 if isempty(cluster.login), md = checkmessage(md,'login empty'); end
+			 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
+			 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
 
 		 end
Index: /issm/trunk-jpl/src/m/classes/clusters/gemini.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/gemini.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/clusters/gemini.m	(revision 12663)
@@ -37,5 +37,5 @@
 		 end
 		 %}}}
-		 function checkconsistency(cluster,md,solution,analyses) % {{{
+		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
 			 available_queues={'debug','shortg','longg'};
Index: /issm/trunk-jpl/src/m/classes/clusters/generic.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/generic.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/clusters/generic.m	(revision 12663)
@@ -50,7 +50,7 @@
 		 end
 		 %}}}
-		 function checkconsistency(cluster,md,solution,analyses) % {{{
+		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
 			 if cluster.np<1
-				 checkmessage(['number of processors should be at least 1']);
+				 md = checkmessage(md,['number of processors should be at least 1']);
 			 end
 			 if isnan(cluster.np),
Index: /issm/trunk-jpl/src/m/classes/clusters/greenplanet.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/greenplanet.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/clusters/greenplanet.m	(revision 12663)
@@ -48,5 +48,5 @@
 		 end
 		 %}}}
-		 function checkconsistency(cluster,md,solution,analyses) % {{{
+		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
 			 available_queues={'rignot','default'};
@@ -57,7 +57,7 @@
 
 			 %Miscelaneous
-			 if isempty(cluster.login), checkmessage('login empty'); end
-			 if isempty(cluster.codepath), checkmessage('codepath empty'); end
-			 if isempty(cluster.executionpath), checkmessage('executionpath empty'); end
+			 if isempty(cluster.login), md = checkmessage(md,'login empty'); end
+			 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
+			 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
 
 		 end
Index: /issm/trunk-jpl/src/m/classes/clusters/pfe.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/pfe.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/clusters/pfe.m	(revision 12663)
@@ -56,5 +56,5 @@
 		 end
 		 %}}}
-		 function checkconsistency(cluster,md,solution,analyses) % {{{
+		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
 			 available_queues={'long','normal','debug'};
@@ -68,9 +68,9 @@
 				 if cluster.hyperthreading,
 					 if ((cluster.cpuspernode>16 ) | (cluster.cpuspernode<1)),
-						 checkmessage('cpuspernode should be between 1 and 16 for ''neh'' and ''har'' processors in hyperthreading mode');
+						 md = checkmessage(md,'cpuspernode should be between 1 and 16 for ''neh'' and ''har'' processors in hyperthreading mode');
 					 end
 				 else
 					 if ((cluster.cpuspernode>8 ) | (cluster.cpuspernode<1)),
-						 checkmessage('cpuspernode should be between 1 and 8 for ''neh'' and ''har'' processors');
+						 md = checkmessage(md,'cpuspernode should be between 1 and 8 for ''neh'' and ''har'' processors');
 					 end
 				 end
@@ -78,19 +78,19 @@
 				 if cluster.hyperthreading,
 					 if ((cluster.cpuspernode>24 ) | (cluster.cpuspernode<1)),
-						 checkmessage('cpuspernode should be between 1 and 24 for ''wes'' processors in hyperthreading mode');
+						 md = checkmessage(md,'cpuspernode should be between 1 and 24 for ''wes'' processors in hyperthreading mode');
 					 end
 				 else
 					 if ((cluster.cpuspernode>12 ) | (cluster.cpuspernode<1)),
-						 checkmessage('cpuspernode should be between 1 and 12 for ''wes'' processors');
-					 end
-				 end
-			 else
-				 checkmessage('unknown processor type, should be ''neh'',''wes'' or ''har''');
+						 md = checkmessage(md,'cpuspernode should be between 1 and 12 for ''wes'' processors');
+					 end
+				 end
+			 else
+				 md = checkmessage(md,'unknown processor type, should be ''neh'',''wes'' or ''har''');
 			 end
 
 			 %Miscelaneous
-			 if isempty(cluster.login), checkmessage('login empty'); end
-			 if isempty(cluster.codepath), checkmessage('codepath empty'); end
-			 if isempty(cluster.executionpath), checkmessage('executionpath empty'); end
+			 if isempty(cluster.login), md = checkmessage(md,'login empty'); end
+			 if isempty(cluster.codepath), md = checkmessage(md,'codepath empty'); end
+			 if isempty(cluster.executionpath), md = checkmessage(md,'executionpath empty'); end
 
 		 end
Index: /issm/trunk-jpl/src/m/classes/clusters/pollux.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/pollux.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/clusters/pollux.m	(revision 12663)
@@ -37,5 +37,5 @@
 		 end
 		 %}}}
-		 function checkconsistency(cluster,md,solution,analyses) % {{{
+		 function md = checkconsistency(cluster,md,solution,analyses) % {{{
 
 			 available_queues={'shortp','longp'};
Index: /issm/trunk-jpl/src/m/classes/constants.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/constants.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/constants.m	(revision 12663)
@@ -31,9 +31,9 @@
 
 		end % }}}
-		function flag = checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
-			checkfield(md,'constants.g','>',0,'size',[1 1]);
-			checkfield(md,'constants.yts','>',0,'size',[1 1]);
-			checkfield(md,'constants.referencetemperature','size',[1 1]);
+			md = checkfield(md,'constants.g','>',0,'size',[1 1]);
+			md = checkfield(md,'constants.yts','>',0,'size',[1 1]);
+			md = checkfield(md,'constants.referencetemperature','size',[1 1]);
 
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/diagnostic.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/diagnostic.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/diagnostic.m	(revision 12663)
@@ -64,5 +64,5 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 			%Early return
@@ -70,32 +70,32 @@
 			%if ~ismember(DiagnosticHorizAnalysisEnum,analyses) |  (solution==TransientSolutionEnum & md.transient.isdiagnostic==0), return; end
 
-			checkfield(md,'diagnostic.spcvx','forcing',1);
-			checkfield(md,'diagnostic.spcvy','forcing',1);
-			if md.mesh.dimension==3, checkfield(md,'diagnostic.spcvz','forcing',1); end
-			checkfield(md,'diagnostic.restol','size',[1 1],'>',0);
-			checkfield(md,'diagnostic.reltol','size',[1 1]);
-			checkfield(md,'diagnostic.abstol','size',[1 1]);
-			checkfield(md,'diagnostic.isnewton','numel',1,'values',[0 1]);
-			checkfield(md,'diagnostic.stokesreconditioning','size',[1 1],'NaN',1);
-			checkfield(md,'diagnostic.viscosity_overshoot','size',[1 1],'NaN',1);
+			md = checkfield(md,'diagnostic.spcvx','forcing',1);
+			md = checkfield(md,'diagnostic.spcvy','forcing',1);
+			if md.mesh.dimension==3, md = checkfield(md,'diagnostic.spcvz','forcing',1); end
+			md = checkfield(md,'diagnostic.restol','size',[1 1],'>',0);
+			md = checkfield(md,'diagnostic.reltol','size',[1 1]);
+			md = checkfield(md,'diagnostic.abstol','size',[1 1]);
+			md = checkfield(md,'diagnostic.isnewton','numel',1,'values',[0 1]);
+			md = checkfield(md,'diagnostic.stokesreconditioning','size',[1 1],'NaN',1);
+			md = checkfield(md,'diagnostic.viscosity_overshoot','size',[1 1],'NaN',1);
 			if md.mesh.dimension==2,
-				checkfield(md,'diagnostic.icefront','size',[NaN 4],'NaN',1);
+				md = checkfield(md,'diagnostic.icefront','size',[NaN 4],'NaN',1);
 			else
-				checkfield(md,'diagnostic.icefront','size',[NaN 6],'NaN',1);
+				md = checkfield(md,'diagnostic.icefront','size',[NaN 6],'NaN',1);
 			end
-			checkfield(md,'diagnostic.icefront(:,end)','values',[0 1 2]);
-			checkfield(md,'diagnostic.maxiter','size',[1 1],'>=',1);
-			checkfield(md,'diagnostic.referential','size',[md.mesh.numberofvertices 6]);
+			md = checkfield(md,'diagnostic.icefront(:,end)','values',[0 1 2]);
+			md = checkfield(md,'diagnostic.maxiter','size',[1 1],'>=',1);
+			md = checkfield(md,'diagnostic.referential','size',[md.mesh.numberofvertices 6]);
 			if ~isempty(md.diagnostic.requested_outputs),
-				checkfield(md,'diagnostic.requested_outputs','size',[NaN 1]);
+				md = checkfield(md,'diagnostic.requested_outputs','size',[NaN 1]);
 			end
 
 			%singular solution
 			if ~any((~isnan(md.diagnostic.spcvx)+~isnan(md.diagnostic.spcvy))==2),
-				checkmessage(['model ' md.miscellaneous.name ' is not well posed (singular). You need at least one node with fixed velocity!'])
+				md = checkmessage(md,['model is not well posed (singular). You need at least one node with fixed velocity!']);
 			end
 			%CHECK THAT EACH LINES CONTAINS ONLY NAN VALUES OR NO NAN VALUES
 			if any(sum(isnan(md.diagnostic.referential),2)~=0 & sum(isnan(md.diagnostic.referential),2)~=6),
-				checkmessage(['model ' md.miscellaneous.name ' has problem with rotated spc. Each line of diagnostic.referential should contain either only NaN values or no NaN values']);
+				md = checkmessage(md,['Each line of diagnostic.referential should contain either only NaN values or no NaN values']);
 			end
 			%CHECK THAT THE TWO VECTORS PROVIDED ARE ORTHOGONAL
@@ -103,5 +103,5 @@
 				pos=find(sum(isnan(md.diagnostic.referential),2)==0);
 				if any(abs(dot(md.diagnostic.referential(pos,1:3)',md.diagnostic.referential(pos,4:6)'))>eps),
-					checkmessage(['model ' md.miscellaneous.name ' has problem with referential. Vectors in diagnostic.referential (colums 1 to 3 and 4 to 6) must be orthogonal']);
+					md = checkmessage(md,['Vectors in diagnostic.referential (colums 1 to 3 and 4 to 6) must be orthogonal']);
 				end
 			end
@@ -110,5 +110,5 @@
 				pos=find(md.mask.vertexongroundedice & md.mesh.vertexonbed);
 				if any(~isnan(md.diagnostic.referential(pos,:))),
-					checkmessage(['no referential should be specified for basal vertices of grounded ice']);
+					md = checkmessage(md,['no referential should be specified for basal vertices of grounded ice']);
 				end
 			end
Index: /issm/trunk-jpl/src/m/classes/flaim.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/flaim.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/flaim.m	(revision 12663)
@@ -32,14 +32,14 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 			%Early return
 			if solution~=FlaimSolutionEnum, return; end
 
-			checkfield(md,'flaim.tracks','file',1);
+			md = checkfield(md,'flaim.tracks','file',1);
 			if any(isnan(md.flaim.criterion)) || isempty(md.flaim.criterion)
-				checkfield(md,'flaim.targets','file',1);
+				md = checkfield(md,'flaim.targets','file',1);
 			else
-				checkfield(md,'flaim.criterion','numel',[md.mesh.numberofvertices md.mesh.numberofelements]);
+				md = checkfield(md,'flaim.criterion','numel',[md.mesh.numberofvertices md.mesh.numberofelements]);
 			end
 
Index: /issm/trunk-jpl/src/m/classes/flowequation.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/flowequation.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/flowequation.m	(revision 12663)
@@ -27,28 +27,30 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 			if ismember(DiagnosticHorizAnalysisEnum,analyses),
 
-				checkfield(md,'flowequation.ismacayealpattyn','numel',1,'values',[0 1]);
-				checkfield(md,'flowequation.ishutter','numel',1,'values',[0 1]);
-				checkfield(md,'flowequation.isstokes','numel',1,'values',[0 1]);
-				checkfield(md,'flowequation.bordermacayeal','size',[md.mesh.numberofvertices 1],'values',[0 1]);
-				checkfield(md,'flowequation.borderpattyn','size',[md.mesh.numberofvertices 1],'values',[0 1]);
-				checkfield(md,'flowequation.borderstokes','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+				md = checkfield(md,'flowequation.ismacayealpattyn','numel',1,'values',[0 1]);
+				md = checkfield(md,'flowequation.ishutter','numel',1,'values',[0 1]);
+				md = checkfield(md,'flowequation.isstokes','numel',1,'values',[0 1]);
+				md = checkfield(md,'flowequation.bordermacayeal','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+				md = checkfield(md,'flowequation.borderpattyn','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+				md = checkfield(md,'flowequation.borderstokes','size',[md.mesh.numberofvertices 1],'values',[0 1]);
 				if (md.mesh.dimension==2),
-					checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1:2]);
-					checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[1:2]);
+					md = checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[1:2]);
+					md = checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[1:2]);
 				else
-					checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[0:7]);
-					checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[0:7]);
+					md = checkfield(md,'flowequation.vertex_equation','size',[md.mesh.numberofvertices 1],'values',[0:7]);
+					md = checkfield(md,'flowequation.element_equation','size',[md.mesh.numberofelements 1],'values',[0:7]);
 				end
 				if (md.flowequation.ismacayealpattyn==0 && md.flowequation.ishutter==0 && md.flowequation.isstokes==0),
-					checkmessage(['no element types set for this model. At least one of ismacayealpattyn, ishutter or isstokes need to be =1']);
+					md = checkmessage(md,['no element types set for this model. At least one of ismacayealpattyn, ishutter or isstokes need to be =1']);
 				end
 			end
 			if ismember(DiagnosticHutterAnalysisEnum,analyses),
-				if any(md.flowequation.element_equation==1 & md.mask.elementonfloatingice),
-					disp(sprintf('\n !!! Warning: Hutter''s model is not consistent on ice shelves !!!\n'));
+				if any(md.flowequation.element_equation==1),
+					if(md.flowequation.element_equation & md.mask.elementonfloatingice),
+						disp(sprintf('\n !!! Warning: Hutter''s model is not consistent on ice shelves !!!\n'));
+					end
 				end
 			end
Index: /issm/trunk-jpl/src/m/classes/friction.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/friction.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/friction.m	(revision 12663)
@@ -22,12 +22,12 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 			%Early return
 			if ~ismember(DiagnosticHorizAnalysisEnum,analyses) & ~ismember(ThermalAnalysisEnum,analyses), return; end
 
-			checkfield(md,'friction.coefficient','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			checkfield(md,'friction.q','NaN',1,'size',[md.mesh.numberofelements 1]);
-			checkfield(md,'friction.p','NaN',1,'size',[md.mesh.numberofelements 1]);
+			md = checkfield(md,'friction.coefficient','NaN',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'friction.q','NaN',1,'size',[md.mesh.numberofelements 1]);
+			md = checkfield(md,'friction.p','NaN',1,'size',[md.mesh.numberofelements 1]);
 		end % }}}
 		function disp(obj) % {{{
Index: /issm/trunk-jpl/src/m/classes/geometry.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/geometry.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/geometry.m	(revision 12663)
@@ -24,14 +24,14 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
-			checkfield(md,'geometry.surface'  ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
-			checkfield(md,'geometry.bed'      ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
-			checkfield(md,'geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);
+			md = checkfield(md,'geometry.surface'  ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'geometry.bed'      ,'NaN',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'geometry.thickness','NaN',1,'size',[md.mesh.numberofvertices 1],'>',0);
 			if any((obj.thickness-obj.surface+obj.bed)>10^-9),
-				checkmessage(['equality thickness=surface-bed violated']);
+				md = checkmessage(md,['equality thickness=surface-bed violated']);
 			end 
 			if solution==TransientSolutionEnum & md.transient.isgroundingline,
-				checkfield(md,'geometry.bathymetry','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'geometry.bathymetry','NaN',1,'size',[md.mesh.numberofvertices 1]);
 			end
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/groundingline.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/groundingline.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/groundingline.m	(revision 12663)
@@ -28,19 +28,19 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
-			checkfield(md,'groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration'});
+			md = checkfield(md,'groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration'});
 
 			if ~strcmp(obj.migration,'None'),
 				if isnan(md.geometry.bathymetry),
-					checkmessage(['requesting grounding line migration, but bathymetry is absent!']);
+					md = checkmessage(md,['requesting grounding line migration, but bathymetry is absent!']);
 				end
 				pos=find(md.mask.vertexongroundedice); 
 				if any(abs(md.geometry.bed(pos)-md.geometry.bathymetry(pos))>10^-10),
-					checkmessage(['bathymetry not equal to bed on grounded ice !']);
+					md = checkmessage(md,['bathymetry not equal to bed on grounded ice !']);
 				end
 				pos=find(md.mask.vertexonfloatingice); 
 				if any(md.geometry.bathymetry(pos)-md.geometry.bed(pos)>10^-9),
-					checkmessage(['bathymetry superior to bed on floating ice !']);
+					md = checkmessage(md,['bathymetry superior to bed on floating ice !']);
 				end
 			end
Index: /issm/trunk-jpl/src/m/classes/hydrology.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/hydrology.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/hydrology.m	(revision 12663)
@@ -35,11 +35,11 @@
 			obj.stabilization=1;
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 			%Early return
 			if ~ismember(HydrologyAnalysisEnum,analyses), return; end
 
-			checkfield(md,'hydrology.spcwatercolumn','forcing',1);
-			checkfield(md,'hydrology.stabilization','>=',0);
+			md = checkfield(md,'hydrology.spcwatercolumn','forcing',1);
+			md = checkfield(md,'hydrology.stabilization','>=',0);
 		end % }}}
 		function disp(obj) % {{{
Index: /issm/trunk-jpl/src/m/classes/initialization.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/initialization.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/initialization.m	(revision 12663)
@@ -27,34 +27,34 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 			if ismember(DiagnosticHorizAnalysisEnum,analyses)
 				if ~isnan(md.initialization.vx) & ~isnan(md.initialization.vy),
-					checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
-					checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
+					md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
+					md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
 				end
 			end
 			if ismember(PrognosticAnalysisEnum,analyses),
-				checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
-				checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
 			end
 			if ismember(HydrologyAnalysisEnum,analyses),
-				checkfield(md,'initialization.watercolumn','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'initialization.watercolumn','NaN',1,'size',[md.mesh.numberofvertices 1]);
 			end
 			if ismember(BalancethicknessAnalysisEnum,analyses),
-				checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
-				checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
 				%Triangle with zero velocity
 				if any(sum(abs(md.initialization.vx(md.mesh.elements)),2)==0 & sum(abs(md.initialization.vy(md.mesh.elements)),2)==0)
-					checkmessage('at least one triangle has all its vertices with a zero velocity');
+					md = checkmessage(md,'at least one triangle has all its vertices with a zero velocity');
 				end
 			end
 			if ismember(ThermalAnalysisEnum,analyses),
-				checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
-				checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
-				checkfield(md,'initialization.vz','NaN',1,'size',[md.mesh.numberofvertices 1]);
-				checkfield(md,'initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'initialization.vx','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'initialization.vy','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'initialization.vz','NaN',1,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'initialization.pressure','NaN',1,'size',[md.mesh.numberofvertices 1]);
 			end
 			if (ismember(EnthalpyAnalysisEnum,analyses) & md.thermal.isenthalpy) | solution==EnthalpySolutionEnum,
-				checkfield(md,'initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices 1]);
+				md = checkfield(md,'initialization.waterfraction','>=',0,'size',[md.mesh.numberofvertices 1]);
 			end
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/inversion.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/inversion.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/inversion.m	(revision 12663)
@@ -75,5 +75,5 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 			%Early return
@@ -83,23 +83,23 @@
 			num_costfunc=size(md.inversion.cost_functions,2);
 
-			checkfield(md,'inversion.iscontrol','values',[0 1]);
-			checkfield(md,'inversion.tao','values',[0 1]);
-			checkfield(md,'inversion.incomplete_adjoint','values',[0 1]);
-			checkfield(md,'inversion.control_parameters','cell',1,'values',{'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'Vx' 'Vy'});
-			checkfield(md,'inversion.nsteps','numel',1,'>=',1);
-			checkfield(md,'inversion.maxiter_per_step','size',[md.inversion.nsteps 1],'>=',0);
-			checkfield(md,'inversion.step_threshold','size',[md.inversion.nsteps 1]);
-			checkfield(md,'inversion.cost_functions','size',[md.inversion.nsteps num_costfunc],'values',[101:105 201 501:503]);
-			checkfield(md,'inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);
-			checkfield(md,'inversion.gradient_only','values',[0 1]);
-			checkfield(md,'inversion.gradient_scaling','size',[md.inversion.nsteps num_controls]);
-			checkfield(md,'inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]);
-			checkfield(md,'inversion.max_parameters','size',[md.mesh.numberofvertices num_controls]);
+			md = checkfield(md,'inversion.iscontrol','values',[0 1]);
+			md = checkfield(md,'inversion.tao','values',[0 1]);
+			md = checkfield(md,'inversion.incomplete_adjoint','values',[0 1]);
+			md = checkfield(md,'inversion.control_parameters','cell',1,'values',{'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'Vx' 'Vy'});
+			md = checkfield(md,'inversion.nsteps','numel',1,'>=',1);
+			md = checkfield(md,'inversion.maxiter_per_step','size',[md.inversion.nsteps 1],'>=',0);
+			md = checkfield(md,'inversion.step_threshold','size',[md.inversion.nsteps 1]);
+			md = checkfield(md,'inversion.cost_functions','size',[md.inversion.nsteps num_costfunc],'values',[101:105 201 501:503]);
+			md = checkfield(md,'inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);
+			md = checkfield(md,'inversion.gradient_only','values',[0 1]);
+			md = checkfield(md,'inversion.gradient_scaling','size',[md.inversion.nsteps num_controls]);
+			md = checkfield(md,'inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]);
+			md = checkfield(md,'inversion.max_parameters','size',[md.mesh.numberofvertices num_controls]);
 
 			if solution==BalancethicknessSolutionEnum
-				checkfield(md,'inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
 			else
-				checkfield(md,'inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
-				checkfield(md,'inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
 			end
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/mask.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/mask.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/mask.m	(revision 12663)
@@ -25,12 +25,12 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
-			checkfield(md,'mask.elementonfloatingice','size',[md.mesh.numberofelements 1],'values',[0 1]);
-			checkfield(md,'mask.elementongroundedice','size',[md.mesh.numberofelements 1],'values',[0 1]);
-			checkfield(md,'mask.elementonwater'      ,'size',[md.mesh.numberofelements 1],'values',[0 1]);
-			checkfield(md,'mask.vertexonfloatingice','size',[md.mesh.numberofvertices 1],'values',[0 1]);
-			checkfield(md,'mask.vertexongroundedice','size',[md.mesh.numberofvertices 1],'values',[0 1]);
-			checkfield(md,'mask.vertexonwater'      ,'size',[md.mesh.numberofvertices 1],'values',[0 1]);
+			md = checkfield(md,'mask.elementonfloatingice','size',[md.mesh.numberofelements 1],'values',[0 1]);
+			md = checkfield(md,'mask.elementongroundedice','size',[md.mesh.numberofelements 1],'values',[0 1]);
+			md = checkfield(md,'mask.elementonwater'      ,'size',[md.mesh.numberofelements 1],'values',[0 1]);
+			md = checkfield(md,'mask.vertexonfloatingice','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+			md = checkfield(md,'mask.vertexongroundedice','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+			md = checkfield(md,'mask.vertexonwater'      ,'size',[md.mesh.numberofvertices 1],'values',[0 1]);
 		end % }}}
 		function disp(obj) % {{{
Index: /issm/trunk-jpl/src/m/classes/materials.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/materials.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/materials.m	(revision 12663)
@@ -69,12 +69,12 @@
 			obj.rheology_law='Paterson';
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
-			checkfield(md,'materials.rho_ice','>',0);
-			checkfield(md,'materials.rho_water','>',0);
-			checkfield(md,'materials.rho_freshwater','>',0);
-			checkfield(md,'materials.mu_water','>',0);
-			checkfield(md,'materials.rheology_B','>',0,'size',[md.mesh.numberofvertices 1]);
-			checkfield(md,'materials.rheology_n','>',0,'size',[md.mesh.numberofelements 1]);
-			checkfield(md,'materials.rheology_law','values',{'None' 'Paterson' 'Arrhenius'});
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
+			md = checkfield(md,'materials.rho_ice','>',0);
+			md = checkfield(md,'materials.rho_water','>',0);
+			md = checkfield(md,'materials.rho_freshwater','>',0);
+			md = checkfield(md,'materials.mu_water','>',0);
+			md = checkfield(md,'materials.rheology_B','>',0,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'materials.rheology_n','>',0,'size',[md.mesh.numberofelements 1]);
+			md = checkfield(md,'materials.rheology_law','values',{'None' 'Paterson' 'Arrhenius'});
 		end % }}}
 		function disp(obj) % {{{
Index: /issm/trunk-jpl/src/m/classes/mesh.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/mesh.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/mesh.m	(revision 12663)
@@ -64,33 +64,33 @@
 			obj.average_vertex_connectivity=25;
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
-			checkfield(md,'mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			checkfield(md,'mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			checkfield(md,'mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]);
-			checkfield(md,'mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
+			md = checkfield(md,'mesh.x','NaN',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'mesh.y','NaN',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'mesh.z','NaN',1,'size',[md.mesh.numberofvertices 1]);
+			md = checkfield(md,'mesh.elements','NaN',1,'>',0,'values',1:md.mesh.numberofvertices);
 			if(md.mesh.dimension==2),
-				checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 3]);
+				md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 3]);
 			else
-				checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 6]);
+				md = checkfield(md,'mesh.elements','size',[md.mesh.numberofelements 6]);
 			end
 			if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))));
-				checkmessage('orphan nodes have been found. Check the mesh outline');
+				md = checkmessage(md,'orphan nodes have been found. Check the mesh outline');
 			end
-			checkfield(md,'mesh.dimension','values',[2 3]);
-			checkfield(md,'mesh.numberoflayers','>=',0);
-			checkfield(md,'mesh.numberofelements','>',0);
-			checkfield(md,'mesh.numberofvertices','>',0);
+			md = checkfield(md,'mesh.dimension','values',[2 3]);
+			md = checkfield(md,'mesh.numberoflayers','>=',0);
+			md = checkfield(md,'mesh.numberofelements','>',0);
+			md = checkfield(md,'mesh.numberofvertices','>',0);
 			%no checks for numberofedges lat long and hemisphere
-			checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
-			checkfield(md,'mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]);
-			checkfield(md,'mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
-			checkfield(md,'mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+			md = checkfield(md,'mesh.elementonbed','size',[md.mesh.numberofelements 1],'values',[0 1]);
+			md = checkfield(md,'mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]);
+			md = checkfield(md,'mesh.vertexonbed','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+			md = checkfield(md,'mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
 			if (md.mesh.dimension==2),
-				checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
+				md = checkfield(md,'mesh.average_vertex_connectivity','>=',9,'message','''mesh.average_vertex_connectivity'' should be at least 9 in 2d');
 			else
-				checkfield(md,'mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d');
+				md = checkfield(md,'mesh.average_vertex_connectivity','>=',24,'message','''mesh.average_vertex_connectivity'' should be at least 24 in 3d');
 			end
-			checkfield(md,'mesh.elementconnectivity','size',[md.mesh.numberofelements 3],'NaN',1);
+			md = checkfield(md,'mesh.elementconnectivity','size',[md.mesh.numberofelements 3],'NaN',1);
 
 			%Solution specific checks
@@ -98,22 +98,22 @@
 				case PrognosticSolutionEnum,
 					if md.prognostic.stabilization==3,
-						checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
-						checkfield(md,'mesh.edges','size',[NaN 4]);
-						checkfield(md,'mesh.edges(:,1:3)','>',0);
+						md = checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
+						md = checkfield(md,'mesh.edges','size',[NaN 4]);
+						md = checkfield(md,'mesh.edges(:,1:3)','>',0);
 					end
 				case BalancethicknessSolutionEnum,
 					if md.balancethickness.stabilization==3,
-						checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
-						checkfield(md,'mesh.edges','size',[NaN 4]);
-						checkfield(md,'mesh.edges(:,1:3)','>',0);
+						md = checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
+						md = checkfield(md,'mesh.edges','size',[NaN 4]);
+						md = checkfield(md,'mesh.edges(:,1:3)','>',0);
 					end
 				case TransientSolutionEnum,
 					if md.transient.isprognostic & md.prognostic.stabilization==3,
-						checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
-						checkfield(md,'mesh.edges','size',[NaN 4]);
-						checkfield(md,'mesh.edges(:,1:3)','>',0);
+						md = checkfield(md,'mesh.dimension','values',2,'message','Discontinuous Galerkin only supported for 2d meshes');
+						md = checkfield(md,'mesh.edges','size',[NaN 4]);
+						md = checkfield(md,'mesh.edges(:,1:3)','>',0);
 					end
 				case ThermalSolutionEnum,
-					checkfield(md,'mesh.dimension','values',3,'message','thermal solution only supported on 3d meshes');
+					md = checkfield(md,'mesh.dimension','values',3,'message','thermal solution only supported on 3d meshes');
 			end
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/miscellaneous.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/miscellaneous.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/miscellaneous.m	(revision 12663)
@@ -19,7 +19,7 @@
 			end
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
-			checkfield(md,'miscellaneous.name','empty',1);
+			md = checkfield(md,'miscellaneous.name','empty',1);
 
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/model/model.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/model/model.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/model/model.m	(revision 12663)
@@ -83,4 +83,10 @@
 					 error('model constructor error message: 0 of 1 argument only in input.');
 				 end
+		 end
+		 %}}}
+		 function md = checkmessage(md,string) % {{{
+			 if(nargout~=1) error('wrong usage, model must be an output'); end
+			 disp(['model not consistent: ' string]);
+			 md.private.isconsistent=false;
 		 end
 		 %}}}
Index: /issm/trunk-jpl/src/m/classes/private.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/private.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/private.m	(revision 12663)
@@ -6,7 +6,8 @@
 classdef private
 	properties (SetAccess=public) 
-		 runtimename = '';
-		 bamg        = struct();
-		 solution    = '';
+		isconsistent = true;
+		runtimename  = '';
+		bamg         = struct();
+		solution     = '';
 	end
 	methods
@@ -22,5 +23,5 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 		end % }}}
@@ -28,4 +29,5 @@
 			disp(sprintf('   private parameters: do not change'));
 
+			fielddisplay(obj,'isconsistent','is model self consistent');
 			fielddisplay(obj,'runtimename','name of the run launched');
 			fielddisplay(obj,'bamg','structure with mesh properties construced if bamg is used to mesh the domain');
Index: /issm/trunk-jpl/src/m/classes/prognostic.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/prognostic.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/prognostic.m	(revision 12663)
@@ -36,13 +36,13 @@
 			obj.hydrostatic_adjustment='Absolute';
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 			%Early return,
 			if ~ismember(PrognosticAnalysisEnum,analyses) |  (solution==TransientSolutionEnum & md.transient.isprognostic==0), return; end
 
-			checkfield(md,'prognostic.spcthickness','forcing',1);
-			checkfield(md,'prognostic.hydrostatic_adjustment','values',{'Absolute' 'Incremental'});
-			checkfield(md,'prognostic.stabilization','values',[0 1 2 3]);
-			checkfield(md,'prognostic.min_thickness','>',0);
+			md = checkfield(md,'prognostic.spcthickness','forcing',1);
+			md = checkfield(md,'prognostic.hydrostatic_adjustment','values',{'Absolute' 'Incremental'});
+			md = checkfield(md,'prognostic.stabilization','values',[0 1 2 3]);
+			md = checkfield(md,'prognostic.min_thickness','>',0);
 
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/qmu.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/qmu.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/qmu.m	(revision 12663)
@@ -35,5 +35,5 @@
 	
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 			%Early return
@@ -41,27 +41,27 @@
 
 			if md.qmu.params.evaluation_concurrency~=1,
-				checkmessage(['concurrency should be set to 1 when running dakota in library mode']);
+				md = checkmessage(md,['concurrency should be set to 1 when running dakota in library mode']);
 			end
 			if ~isempty(md.qmu.partition),
 				if numel(md.qmu.partition)~=md.mesh.numberofvertices,
-					checkmessage(['user supplied partition for qmu analysis should have size md.mesh.numberofvertices x 1 ']);
+					md = checkmessage(md,['user supplied partition for qmu analysis should have size md.mesh.numberofvertices x 1 ']);
 				end
 				if find(md.qmu.partition)>=md.mesh.numberofvertices,
-					checkmessage(['user supplied partition should be indexed from 0 (c-convention)']);
+					md = checkmessage(md,['user supplied partition should be indexed from 0 (c-convention)']);
 				end
 				if min(md.qmu.partition)~=0,
-					checkmessage(['partition vector not indexed from 0 on']);
+					md = checkmessage(md,['partition vector not indexed from 0 on']);
 				end
 				if max(md.qmu.partition)>=md.mesh.numberofvertices,
-					checkmessage(['partition vector cannot have maximum index larger than number of nodes']);
+					md = checkmessage(md,['partition vector cannot have maximum index larger than number of nodes']);
 				end
 				if ~isempty(find(md.qmu.partition<0)),
-					checkmessage(['partition vector cannot have values less than 0']);
+					md = checkmessage(md,['partition vector cannot have values less than 0']);
 				end
 				if ~isempty(find(md.qmu.partition>=md.qmu.numberofpartitions)),
-					checkmessage(['partition vector cannot have values more than md.qmu.numberofpartitions-1']);
+					md = checkmessage(md,['partition vector cannot have values more than md.qmu.numberofpartitions-1']);
 				end
 				if max(md.qmu.partition)>=md.qmu.numberofpartitions,
-					checkmessage(['for qmu analysis, partitioning vector cannot go over npart, number of partition areas']);
+					md = checkmessage(md,['for qmu analysis, partitioning vector cannot go over npart, number of partition areas']);
 				end
 			end
@@ -69,5 +69,5 @@
 			if ~strcmpi(md.cluster.name,'none'),
 				if md.settings.waitonlock==0,
-					checkmessage(['waitonlock should be activated when running qmu in parallel mode!']);
+					md = checkmessage(md,['waitonlock should be activated when running qmu in parallel mode!']);
 				end
 			end
Index: /issm/trunk-jpl/src/m/classes/rifts.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/rifts.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/rifts.m	(revision 12663)
@@ -21,5 +21,5 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 			if isempty(obj.riftstruct) | isnans(obj.riftstruct),
 				numrifts=0;
@@ -29,17 +29,17 @@
 			if numrifts,
 				if ~(md.mesh.dimension==2),
-					checkmessage(['models with rifts are only supported in 2d for now!']);
+					md = checkmessage(md,['models with rifts are only supported in 2d for now!']);
 				end
 				if ~isstruct(obj.riftstruct),
-					checkmessage(['rifts.riftstruct should be a structure!']);
+					md = checkmessage(md,['rifts.riftstruct should be a structure!']);
 				end
 				if ~isempty(find(md.mesh.segmentmarkers>=2)),
 					%We have segments with rift markers, but no rift structure!
-					checkmessage(['model should be processed for rifts (run meshprocessrifts)!']);
+					md = checkmessage(md,['model should be processed for rifts (run meshprocessrifts)!']);
 				end
-				checkfield(md,'rifts.riftstruct.fill','values',[WaterEnum() AirEnum() IceEnum() MelangeEnum()]);
+				md = checkfield(md,'rifts.riftstruct.fill','values',[WaterEnum() AirEnum() IceEnum() MelangeEnum()]);
 			else
 				if ~isnans(obj.riftstruct),
-					checkmessage(['riftstruct shoud be NaN since numrifts is 0!']);
+					md = checkmessage(md,['riftstruct shoud be NaN since numrifts is 0!']);
 				end
 			end
Index: /issm/trunk-jpl/src/m/classes/settings.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/settings.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/settings.m	(revision 12663)
@@ -41,11 +41,11 @@
 			obj.waitonlock=Inf;
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
-			checkfield(md,'settings.io_gather','numel',1,'values',[0 1]);
-			checkfield(md,'settings.lowmem','numel',1,'values',[0 1]);
-			checkfield(md,'settings.results_as_patches','numel',1,'values',[0 1]);
-			checkfield(md,'settings.output_frequency','numel',1,'>=',1);
-			checkfield(md,'settings.waitonlock','numel',1);
+			md = checkfield(md,'settings.io_gather','numel',1,'values',[0 1]);
+			md = checkfield(md,'settings.lowmem','numel',1,'values',[0 1]);
+			md = checkfield(md,'settings.results_as_patches','numel',1,'values',[0 1]);
+			md = checkfield(md,'settings.output_frequency','numel',1,'>=',1);
+			md = checkfield(md,'settings.waitonlock','numel',1);
 
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/solver.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/solver.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/solver.m	(revision 12663)
@@ -54,9 +54,9 @@
 			 end
 		 end % }}}
-		 function checkconsistency(obj,md,solution,analyses) % {{{
+		 function md = checkconsistency(obj,md,solution,analyses) % {{{
 			 analyses=properties(obj);
 			 for i=1:numel(analyses),
 				 if isempty(fieldnames(obj.(analyses{i})))
-					 checkmessage(['md.solver.' analyses{i} ' is empty']);
+					 md = checkmessage(md,['md.solver.' analyses{i} ' is empty']);
 				 end
 			 end
Index: /issm/trunk-jpl/src/m/classes/steadystate.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/steadystate.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/steadystate.m	(revision 12663)
@@ -26,5 +26,5 @@
 			obj.reltol=0.01;
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 			%Early return
@@ -32,9 +32,9 @@
 
 			if md.timestepping.time_step~=0,
-				checkmessage(['for a steadystate computation, timestepping.time_step must be zero.']);
+				md = checkmessage(md,['for a steadystate computation, timestepping.time_step must be zero.']);
 			end
 
 			if isnan(md.diagnostic.reltol),
-				checkmessage(['for a steadystate computation, diagnostic.reltol (relative convergence criterion) must be defined!']);
+				md = checkmessage(md,['for a steadystate computation, diagnostic.reltol (relative convergence criterion) must be defined!']);
 			end
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/surfaceforcings.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/surfaceforcings.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/surfaceforcings.m	(revision 12663)
@@ -26,16 +26,16 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 			if ismember(PrognosticAnalysisEnum,analyses),
-				checkfield(md,'surfaceforcings.ispdd','numel',1,'values',[0 1]);
+				md = checkfield(md,'surfaceforcings.ispdd','numel',1,'values',[0 1]);
 				if(obj.ispdd)
-					checkfield(md,'surfaceforcings.monthlytemperatures','forcing',1,'NaN',1);
+					md = checkfield(md,'surfaceforcings.monthlytemperatures','forcing',1,'NaN',1);
 				else
-					checkfield(md,'surfaceforcings.mass_balance','forcing',1,'NaN',1);
+					md = checkfield(md,'surfaceforcings.mass_balance','forcing',1,'NaN',1);
 				end
 			end
 			if ismember(BalancethicknessAnalysisEnum,analyses),
-				checkfield(md,'surfaceforcings.mass_balance','size',[md.mesh.numberofvertices 1],'NaN',1);
+				md = checkfield(md,'surfaceforcings.mass_balance','size',[md.mesh.numberofvertices 1],'NaN',1);
 			end
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/thermal.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/thermal.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/thermal.m	(revision 12663)
@@ -40,14 +40,14 @@
 			obj.isenthalpy=0;
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 			%Early return
 			if (~ismember(ThermalAnalysisEnum,analyses) & ~ismember(EnthalpyAnalysisEnum,analyses)) | (solution==TransientSolutionEnum & md.transient.isthermal==0), return; end
 
-			checkfield(md,'thermal.stabilization','numel',1,'values',[0 1 2]);
-			checkfield(md,'thermal.spctemperature','forcing',1);
+			md = checkfield(md,'thermal.stabilization','numel',1,'values',[0 1 2]);
+			md = checkfield(md,'thermal.spctemperature','forcing',1);
 			if (ismember(EnthalpyAnalysisEnum,analyses) & md.thermal.isenthalpy & md.mesh.dimension==3),
-			checkfield(md,'thermal.spctemperature','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*(md.geometry.surface-md.mesh.z),'message','spctemperature should be below the adjusted melting point');
-			checkfield(md,'thermal.isenthalpy','numel',1,'values',[0 1]);
+			md = checkfield(md,'thermal.spctemperature','<',md.materials.meltingpoint-md.materials.beta*md.materials.rho_ice*md.constants.g*(md.geometry.surface-md.mesh.z),'message','spctemperature should be below the adjusted melting point');
+			md = checkfield(md,'thermal.isenthalpy','numel',1,'values',[0 1]);
 			end
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/timestepping.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/timestepping.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/timestepping.m	(revision 12663)
@@ -33,13 +33,13 @@
 			obj.cfl_coefficient=.5;
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
-			checkfield(md,'timestepping.start_time','numel',1,'NaN',1);
-			checkfield(md,'timestepping.final_time','numel',1,'NaN',1);
-			checkfield(md,'timestepping.time_step','numel',1,'>=',0,'NaN',1);
-			checkfield(md,'timestepping.time_adapt','numel',1,'values',[0 1]);
-			checkfield(md,'timestepping.cfl_coefficient','numel',1,'>',0,'<=',1);
+			md = checkfield(md,'timestepping.start_time','numel',1,'NaN',1);
+			md = checkfield(md,'timestepping.final_time','numel',1,'NaN',1);
+			md = checkfield(md,'timestepping.time_step','numel',1,'>=',0,'NaN',1);
+			md = checkfield(md,'timestepping.time_adapt','numel',1,'values',[0 1]);
+			md = checkfield(md,'timestepping.cfl_coefficient','numel',1,'>',0,'<=',1);
 			if obj.final_time-obj.start_time<0,
-				checkmessage('timestepping.final_time should be larger than timestepping.start_time');
+				md = checkmessage(md,'timestepping.final_time should be larger than timestepping.start_time');
 			end 
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/transient.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/transient.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/transient.m	(revision 12663)
@@ -30,13 +30,13 @@
 
 		end % }}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 			%Early return
 			if solution~=TransientSolutionEnum, return; end
 
-			checkfield(md,'transient.isprognostic','numel',1,'values',[0 1]);
-			checkfield(md,'transient.isdiagnostic','numel',1,'values',[0 1]);
-			checkfield(md,'transient.isthermal','numel',1,'values',[0 1]);
-			checkfield(md,'transient.isgroundingline','numel',1,'values',[0 1]);
+			md = checkfield(md,'transient.isprognostic','numel',1,'values',[0 1]);
+			md = checkfield(md,'transient.isdiagnostic','numel',1,'values',[0 1]);
+			md = checkfield(md,'transient.isthermal','numel',1,'values',[0 1]);
+			md = checkfield(md,'transient.isgroundingline','numel',1,'values',[0 1]);
 
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/verbose.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/verbose.m	(revision 12662)
+++ /issm/trunk-jpl/src/m/classes/verbose.m	(revision 12663)
@@ -99,5 +99,5 @@
 		end
 		%}}}
-		function checkconsistency(obj,md,solution,analyses) % {{{
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
 
 		end % }}}
