Index: /issm/trunk-jpl/src/m/classes/model.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/model.m	(revision 21826)
+++ /issm/trunk-jpl/src/m/classes/model.m	(revision 21827)
@@ -177,5 +177,5 @@
 			%Start with changing all the fields from the 3d mesh 
 
-			%dealing with the friciton law
+			%dealing with the friction law
 			%drag is limited to nodes that are on the bedrock.
 			if isa(md.friction,'friction'),
@@ -206,5 +206,5 @@
 			else
 				disp('friction type not supported');
-	    end
+			end
 
 			%observations
Index: /issm/trunk-jpl/src/m/classes/model.py
===================================================================
--- /issm/trunk-jpl/src/m/classes/model.py	(revision 21826)
+++ /issm/trunk-jpl/src/m/classes/model.py	(revision 21827)
@@ -689,10 +689,18 @@
 			raise StandardError("only a 3D model can be collapsed")
 		
+		#dealing with the friction law
 		#drag is limited to nodes that are on the bedrock.
-		md.friction.coefficient=project2d(md,md.friction.coefficient,1)
+		if hasattr(md.friction,'coefficient'): md.friction.coefficient=project2d(md,md.friction.coefficient,1)
 
 		#p and q (same deal, except for element that are on the bedrock: )
-		md.friction.p=project2d(md,md.friction.p,1)
-		md.friction.q=project2d(md,md.friction.q,1)
+		if hasattr(md.friction,'p'): md.friction.p=project2d(md,md.friction.p,1)
+		if hasattr(md.friction,'q'): md.friction.q=project2d(md,md.friction.q,1)
+		
+		if hasattr(md.friction,'coefficientcoulomb'): md.friction.q=project2d(md,md.friction.coefficientcoulomb,1)
+		if hasattr(md.friction,'C'): md.friction.q=project2d(md,md.friction.C,1)
+		if hasattr(md.friction,'As'): md.friction.q=project2d(md,md.friction.As,1)
+		if hasattr(md.friction,'effective_pressure'): md.friction.q=project2d(md,md.friction.effective_pressure,1)
+		if hasattr(md.friction,'water_layer'): md.friction.q=project2d(md,md.friction.water_layer,1)
+		if hasattr(md.friction,'m'): md.friction.q=project2d(md,md.friction.m,1)
 
 		#observations
@@ -731,6 +739,5 @@
 			md.flowequation.borderFS=project2d(md,md.flowequation.borderFS,1)
 
-
-      # Hydrologydc variables
+		# Hydrologydc variables
 		if hasattr(md.hydrology,'hydrologydc'):
 			md.hydrology.spcsediment_head=project2d(md,md.hydrology.spcsediment_head,1)
@@ -794,6 +801,5 @@
 								elif np.size(subfield)==md.mesh.numberofelements:
 									setattr(fieldr,solutionsubfield,project2d(md,subfield,1))
-								else:
-									setattr(fieldr,solutionsubfield,subfield)
+
 
 		#Initialize with the 2d mesh
@@ -812,4 +818,7 @@
 		mesh.epsg=md.mesh.epsg
 		md.mesh=mesh
+		md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices)[0]
+		md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity)[0]
+		md.mesh.segments=contourenvelope(md)
 
 		return md
Index: /issm/trunk-jpl/src/m/classes/regionaloutput.py
===================================================================
--- /issm/trunk-jpl/src/m/classes/regionaloutput.py	(revision 21826)
+++ /issm/trunk-jpl/src/m/classes/regionaloutput.py	(revision 21827)
@@ -1,2 +1,3 @@
+from project3d import project3d
 from fielddisplay import fielddisplay
 from pairoptions import pairoptions
@@ -4,4 +5,6 @@
 from WriteData import WriteData
 from MeshProfileIntersection import MeshProfileIntersection
+from ContourToMesh import ContourToMesh
+import numpy as np
 import os
 
@@ -37,8 +40,12 @@
 
 		#get name
-		modelname=getfieldvalue(options,'model');
-		self.maskexpstring=getfieldvalue(options,'maskexpstring');
-		self.setmaskfromexp(self,md)
-		error('regionaloutput error message: ''mask'' field or ''maskexpstring'' and ''model'' fields should be defined!');
+		if options.getfieldvalue('model',0):
+			if options.getfieldvalue('maskexpstring',0):
+				modelname=options.getfieldvalue('model')
+				self.maskexpstring=options.getfieldvalue('maskexpstring')
+				self.setmaskfromexp(modelname)
+			
+		if (len(self.mask)<=1 & np.any(np.isnan(self.mask))):
+			error('regionaloutput error message: ''mask'' field or ''maskexpstring'' and ''model'' fields should be defined!');
 
 		#}}}
@@ -61,5 +68,5 @@
 	#}}}
 	def setmaskfromexp(self,md):    # {{{
-		if len(self.maskexpstring,0) > 0:
+		if len(self.maskexpstring) > 0:
 			self.mask=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,self.maskexpstring,'node',1)
 			
@@ -74,9 +81,9 @@
 			raise RuntimeError("regionaloutput error message: 'outputnamestring' field should be a string!") 
 		
-		if len(self.maskexpstring,0) > 0:
-			if not os.path.isfile(self.profilename):
+		if len(self.maskexpstring) > 0:
+			if not os.path.isfile(self.maskexpstring):
 				raise RuntimeError("regionaloutput error message: file name for mask exp does not point to a legitimate file on disk!")
 			else:
-				self.setmaskfromexp(self,md)
+				self.setmaskfromexp(md)
 
 		OutputdefinitionStringArray=[]
@@ -85,7 +92,6 @@
 			OutputdefinitionStringArray.append(x)
 
-		md = checkfield(md,'field',self.definitionstring,'values',OutputdefinitionStringArray])
-      md = checkfield(md,'field',self.mask,'size',[md.mesh.numberofvertices 1],'NaN',1,'Inf',1)
-		
+		md = checkfield(md,'field',self.definitionstring,'values',OutputdefinitionStringArray)
+		md = checkfield(md,'field',self.mask,'size',[md.mesh.numberofvertices],'NaN',1,'Inf',1)
 		return md
 	# }}}
@@ -93,5 +99,5 @@
 
 		#before marshalling, make sure mask is set: 
-		self.setmaskfromexp(self,md)
+		self.setmaskfromexp(md)
 
 		#ok, marshall strings and mask: 
Index: /issm/trunk-jpl/test/NightlyRun/test408.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test408.py	(revision 21826)
+++ /issm/trunk-jpl/test/NightlyRun/test408.py	(revision 21827)
@@ -24,8 +24,8 @@
 md.transient.isthermal=False
 md.transient.isgroundingline=True
-md.extrude(3,1.)
 md=setflowequation(md,'SSA','all')
 md.cluster=generic('name',gethostname(),'np',3)
 md.transient.requested_outputs=['default','GroundedArea','FloatingArea','TotalFloatingBmb','TotalGroundedBmb','TotalSmb']
+md.extrude(3,1.)
 md=solve(md,'Transient')
 
Index: /issm/trunk-jpl/test/NightlyRun/test443.m
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test443.m	(revision 21826)
+++ /issm/trunk-jpl/test/NightlyRun/test443.m	(revision 21827)
@@ -44,4 +44,5 @@
 
 md=extrude(md,3,1);
+md2=collapse(md);
 md=solve(md,'Transient');
 
@@ -50,7 +51,8 @@
 	'Thickness1','GroundedArea1','FloatingArea1','TotalFloatingBmb1','TotalGroundedBmb1','TotalSmb1',...
 	'IceMass3','IceVolume3','IceVolumeAboveFloatation3','IceVolumeAboveFloatation23',...
-	'Thickness3','GroundedArea3','FloatingArea3','TotalFloatingBmb3','TotalGroundedBmb3','TotalSmb3'};
+	'Thickness3','GroundedArea3','FloatingArea3','TotalFloatingBmb3','TotalGroundedBmb3','TotalSmb3',...
+	'ExtrudedMask','CollapsedMask'};
 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+	1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
 field_values={...
 	(md.results.TransientSolution(1).IceMass1),...
@@ -74,3 +76,5 @@
 	(md.results.TransientSolution(3).TotalGroundedBmb1),...
 	(md.results.TransientSolution(3).TotalSmb1),...
+	length(md.outputdefinition.definitions{1}.mask),...
+	length(md2.outputdefinition.definitions{1}.mask),...
 	};
Index: /issm/trunk-jpl/test/NightlyRun/test443.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test443.py	(revision 21827)
+++ /issm/trunk-jpl/test/NightlyRun/test443.py	(revision 21827)
@@ -0,0 +1,80 @@
+#Test Name: SquareSheetShelfTranSSA3dAggressiveRegionalOutput
+import numpy as np
+from model import *
+from socket import gethostname
+
+from triangle import *
+from setmask import *
+from parameterize import *
+from setflowequation import *
+from solve import *
+from frictioncoulomb import frictioncoulomb
+from ContourToMesh import ContourToMesh
+from regionaloutput import regionaloutput
+
+md=triangle(model(),'../Exp/Square.exp',150000.)
+md=setmask(md,'../Exp/SquareShelf.exp','')
+md=parameterize(md,'../Par/SquareSheetShelf.py')
+md.geometry.bed=copy.deepcopy(md.geometry.base)
+pos=np.nonzero(md.mask.groundedice_levelset<0.)
+md.geometry.bed[pos]=md.geometry.bed[pos]-10
+md.friction=frictioncoulomb()
+md.friction.coefficient=20*np.ones(md.mesh.numberofvertices)
+md.friction.p=1*np.ones(md.mesh.numberofelements)
+md.friction.q=1*np.ones(md.mesh.numberofelements)
+md.friction.coefficientcoulomb=0.02*np.ones(md.mesh.numberofvertices)
+md.transient.isthermal=False
+md.transient.isgroundingline=True
+md.groundingline.migration='AggressiveMigration';
+
+md.settings.output_frequency=2
+md=setflowequation(md,'SSA','all')
+md.cluster=generic('name',gethostname(),'np',3)
+
+regionalmask=np.zeros((md.mesh.numberofvertices))
+inflag=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,'../Exp/SquareHalfRight.exp','node',1)
+regionalmask[np.nonzero(inflag)[0]] = 1.
+md.transient.requested_outputs=['default','GroundedArea1','FloatingArea1','TotalFloatingBmb1','TotalGroundedBmb1','TotalSmb1','IceMass1','IceVolume1','IceVolumeAboveFloatation1','IceVolumeAboveFloatation2','IceVolumeAboveFloatation']
+
+md.outputdefinition.definitions=[regionaloutput('name','GroundedArea1','outputnamestring','GroundedArea','mask',regionalmask,'definitionstring','Outputdefinition1'),
+		regionaloutput('name','FloatingArea1','outputnamestring','FloatingArea','mask',regionalmask,'definitionstring','Outputdefinition2'),
+		regionaloutput('name','TotalFloatingBmb1','outputnamestring','TotalFloatingBmb','mask',regionalmask,'definitionstring','Outputdefinition3'),
+		regionaloutput('name','TotalGroundedBmb1','outputnamestring','TotalGroundedBmb','mask',regionalmask,'definitionstring','Outputdefinition4'),
+		regionaloutput('name','IceMass1','outputnamestring','IceMass','mask',regionalmask,'definitionstring','Outputdefinition5'),
+		regionaloutput('name','IceVolume1','outputnamestring','IceVolume','mask',regionalmask,'definitionstring','Outputdefinition6'),
+		regionaloutput('name','IceVolumeAboveFloatation1','outputnamestring','IceVolumeAboveFloatation','mask',regionalmask,'definitionstring','Outputdefinition7'),
+		regionaloutput('name','TotalSmb1','outputnamestring','TotalSmb','mask',regionalmask,'definitionstring','Outputdefinition8'),
+		regionaloutput('name','IceVolumeAboveFloatation2','outputnamestring','IceVolumeAboveFloatation','maskexpstring','../Exp/SquareHalfRight.exp','definitionstring','Outputdefinition9','model',md)]
+
+md.extrude(3,1.)
+md2=copy.deepcopy(md)
+md2.collapse()
+md=solve(md,'Transient')
+
+#Fields and tolerances to track changes
+field_names     =['IceMass1','IceVolume1','IceVolumeAboveFloatation1','IceVolumeAboveFloatation21','Thickness1','GroundedArea1','FloatingArea1','TotalFloatingBmb1','TotalGroundedBmb1','TotalSmb1','IceMass3','IceVolume3','IceVolumeAboveFloatation3','IceVolumeAboveFloatation23','Thickness3','GroundedArea3','FloatingArea3','TotalFloatingBmb3','TotalGroundedBmb3','TotalSmb3','ExtrudedMask','CollapsedMask']
+field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
+field_values=[\
+	md.results.TransientSolution[0].IceMass1,\
+	md.results.TransientSolution[0].IceVolume1,\
+	md.results.TransientSolution[0].IceVolumeAboveFloatation1,\
+	md.results.TransientSolution[0].IceVolumeAboveFloatation2,\
+	md.results.TransientSolution[0].Thickness,\
+	md.results.TransientSolution[0].GroundedArea1,\
+	md.results.TransientSolution[0].FloatingArea1,\
+	md.results.TransientSolution[0].TotalFloatingBmb1,\
+	md.results.TransientSolution[0].TotalGroundedBmb1,\
+	md.results.TransientSolution[0].TotalSmb1,\
+	md.results.TransientSolution[2].IceMass1,\
+	md.results.TransientSolution[2].IceVolume1,\
+	md.results.TransientSolution[2].IceVolumeAboveFloatation1,\
+	md.results.TransientSolution[2].IceVolumeAboveFloatation2,\
+	md.results.TransientSolution[2].Thickness,\
+	md.results.TransientSolution[2].GroundedArea1,\
+	md.results.TransientSolution[2].FloatingArea1,\
+	md.results.TransientSolution[2].TotalFloatingBmb1,\
+	md.results.TransientSolution[2].TotalGroundedBmb1,\
+	md.results.TransientSolution[2].TotalSmb1,\
+	len(md.outputdefinition.definitions[0].mask),\
+	len(md2.outputdefinition.definitions[0].mask),\
+	]
