Index: issm/trunk/src/m/classes/model.m
===================================================================
--- issm/trunk/src/m/classes/model.m	(revision 21729)
+++ issm/trunk/src/m/classes/model.m	(revision 22758)
@@ -40,4 +40,5 @@
 		levelset			  = 0;
 		calving          = 0;
+		love			     = 0;
 		gia				  = 0;
 		esa              = 0;
@@ -127,4 +128,9 @@
 			%2016 October 11
 			if isa(md.esa,'double'); md.esa=esa(); end
+			%2017 Dec 21st (needs to be here)
+			if isempty(md.settings)
+				disp('Warning: md.settings had to be reset, make sure to adjust md.settings.output_frequency and other fields');
+				md.settings = issmsettings();
+			end
 			%2017 February 10th
 			if md.settings.solver_residue_threshold==0,
@@ -135,4 +141,11 @@
 			%2017 May 4th
 			if isa(md.amr,'double'); md.amr=amr(); end
+			%2017 Aug 29th
+			if isa(md.love,'double'); md.love=fourierlove(); end
+			%2017 Oct 26th
+			if isa(md.calving,'calvingdev')
+				disp('Warning: calvingdev is now calvingvonmises');
+				md.calving=calvingvonmises(md.calving); 
+			end
 
 		end% }}}
@@ -177,8 +190,13 @@
 			%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'),
 				md.friction.coefficient=project2d(md,md.friction.coefficient,1);
+				md.friction.p=project2d(md,md.friction.p,1);
+				md.friction.q=project2d(md,md.friction.q,1);
+			elseif isa(md.friction,'frictioncoulomb'),
+				md.friction.coefficient=project2d(md,md.friction.coefficient,1);
+				md.friction.coefficientcoulomb=project2d(md,md.friction.coefficientcoulomb,1);
 				md.friction.p=project2d(md,md.friction.p,1);
 				md.friction.q=project2d(md,md.friction.q,1);
@@ -201,5 +219,5 @@
 			else
 				disp('friction type not supported');
-	    end
+			end
 
 			%observations
@@ -260,6 +278,6 @@
 				if(md.hydrology.isefficientlayer==1)
 					md.hydrology.spcepl_head=project2d(md,md.hydrology.spcepl_head,1);
-		    end
-	    end
+				end
+			end
 			
 			%materials
@@ -308,4 +326,18 @@
 			if ~isnan(md.mask.ice_levelset),
 				md.mask.ice_levelset=project2d(md,md.mask.ice_levelset,1);
+			end
+
+			%outputdefinitions
+			for i=1:length(md.outputdefinition.definitions)
+				if isobject(md.outputdefinition.definitions{i})
+					%get subfields
+					solutionsubfields=fields(md.outputdefinition.definitions{i});
+					for j=1:length(solutionsubfields),
+						field=md.outputdefinition.definitions{i}.(solutionsubfields{j});
+						if length(field)==md.mesh.numberofvertices | length(field)==md.mesh.numberofelements,
+							md.outputdefinition.definitions{i}.(solutionsubfields{j})=project2d(md,md.outputdefinition.definitions{i}.(solutionsubfields{j}),1);
+						end
+					end
+				end
 			end
 
@@ -320,4 +352,5 @@
 			if numel(md.mesh.long)==md.mesh.numberofvertices,	mesh.long=project2d(md,md.mesh.long,1); end
 			mesh.epsg=md.mesh.epsg;
+			if numel(md.mesh.scale_factor)==md.mesh.numberofvertices,	mesh.scale_factor=project2d(md,md.mesh.scale_factor,1); end
 			if ~isnan(md.mesh.vertexonboundary), mesh.vertexonboundary=project2d(md,md.mesh.vertexonboundary,1); end
 			if ~isnan(md.mesh.elementconnectivity), mesh.elementconnectivity=project2d(md,md.mesh.elementconnectivity,1); end
@@ -607,4 +640,20 @@
 			end
 
+			%OutputDefinitions fields
+			for i=1:length(md1.outputdefinition.definitions),
+				if isobject(md1.outputdefinition.definitions{i})
+					%get subfields
+					solutionsubfields=fields(md1.outputdefinition.definitions{i});
+					for j=1:length(solutionsubfields),
+						field=md1.outputdefinition.definitions{i}.(solutionsubfields{j});
+						if length(field)==numberofvertices1,
+							md2.outputdefinition.definitions{i}.(solutionsubfields{j})=field(pos_node);
+						elseif length(field)==numberofelements1,
+							md2.outputdefinition.definitions{i}.(solutionsubfields{j})=field(pos_elem);
+						end
+					end
+				end
+			end
+
 			%Keep track of pos_node and pos_elem
 			md2.mesh.extractedvertices=pos_node;
@@ -689,4 +738,5 @@
 			md.mesh.long                        = mesh2d.long;
 			md.mesh.epsg                        = mesh2d.epsg;
+			md.mesh.scale_factor                = mesh2d.scale_factor;
 
 			md.mesh.vertexonboundary            = mesh2d.vertexonboundary;
@@ -762,4 +812,5 @@
 			md.mesh.lat=project3d(md,'vector',md.mesh.lat,'type','node');
 			md.mesh.long=project3d(md,'vector',md.mesh.long,'type','node');
+			md.mesh.scale_factor=project3d(md,'vector',md.mesh.scale_factor,'type','node');
 
 			md.geometry=extrude(md.geometry,md);
@@ -793,4 +844,5 @@
 			md.qmu=extrude(md.qmu,md);
 			md.basalforcings=extrude(md.basalforcings,md);
+			md.outputdefinition=extrude(md.outputdefinition,md);
 
 			%increase connectivity if less than 25:
@@ -915,4 +967,5 @@
 			if isfield(structmd,'lat'), md.mesh.lat=structmd.lat; end
 			if isfield(structmd,'long'), md.mesh.long=structmd.long; end
+			if isfield(structmd,'scale_factor'), md.mesh.scale_factor=structmd.scale_factor; end
 			if isfield(structmd,'segments'), md.mesh.segments=structmd.segments; end
 			if isfield(structmd,'segmentmarkers'), md.mesh.segmentmarkers=structmd.segmentmarkers; end
@@ -1102,5 +1155,5 @@
 			md.debug            = debug();
 			md.verbose          = verbose();
-			md.settings         = settings();
+			md.settings         = issmsettings();
 			md.toolkits         = toolkits();
 			md.cluster          = generic();
@@ -1112,12 +1165,13 @@
 			md.steadystate      = steadystate();
 			md.transient        = transient();
-			md.levelset			  = levelset();
+			md.levelset         = levelset();
 			md.calving          = calving();
-			md.gia				  = giaivins();
+			md.gia              = giaivins();
+			md.love             = fourierlove();
 			md.esa              = esa();
 			md.autodiff         = autodiff();
 			md.inversion        = inversion();
 			md.qmu              = qmu();
-			md.amr				  = amr();
+			md.amr              = amr();
 			md.radaroverlay     = radaroverlay();
 			md.results          = struct();
@@ -1288,4 +1342,5 @@
 			disp(sprintf('%19s: %-22s -- %s','calving'         ,['[1x1 ' class(self.calving) ']'],'parameters for calving'));
 			disp(sprintf('%19s: %-22s -- %s','gia'        ,['[1x1 ' class(self.gia) ']'],'parameters for gia solution'));
+			disp(sprintf('%19s: %-22s -- %s','love'        ,['[1x1 ' class(self.love) ']'],'parameters for love solution'));
 			disp(sprintf('%19s: %-22s -- %s','esa'             ,['[1x1 ' class(self.esa) ']'],'parameters for elastic adjustment solution'));
 			disp(sprintf('%19s: %-22s -- %s','autodiff'        ,['[1x1 ' class(self.autodiff) ']'],'automatic differentiation parameters'));
