Index: /issm/trunk/src/m/classes/public/ismodelselfconsistent.m
===================================================================
--- /issm/trunk/src/m/classes/public/ismodelselfconsistent.m	(revision 2659)
+++ /issm/trunk/src/m/classes/public/ismodelselfconsistent.m	(revision 2660)
@@ -122,11 +122,16 @@
 		error(['model not consistent: models with rifts are only supported in 2d for now!']);
 	end
-end
-if ~isstruct(md.rifts),
+	if ~isstruct(md.rifts),
+		error(['model not consistent: md.rifts should be a structure!']);
+	end
+	if ~isempty(find(md.segmentmarkers>=2)),
+		%We have segments with rift markers, but no rift structure!
+		error(['model not consistent: model ' md.name ' should be processed for rifts (run meshprocessrifts)!']);
+	end
+	%Check that rifts are filled with proper material
+	checkvalues(md,{'rifts.fill'},[WaterEnum() AirEnum() IceEnum() MelangeEnum()]);
+else
 	if ~isnan(md.rifts),
-		if ~isempty(find(md.segmentmarkers>=2)),
-			%We have segments with rift markers, but no rift structure!
-			error(['model not consistent: model ' md.name ' should be processed for rifts (run meshprocessrifts)!']);
-		end
+		error(['model not consistent: md.rifts shoud be NaN since md.numrifts is 0!']);
 	end
 end
@@ -432,2 +437,11 @@
 	end
 end
+
+function checkvalues(md,fields,values)
+	%CHECKVALUE - check that a field has a certain value
+	for i=1:length(fields),
+		if eval(['~ismember( md.' fields{i} ',values)']),
+			error(['model not consistent: field ' fields{i} ' should have values in ' num2str(values)]);
+		end
+	end
+end
