Index: issm/trunk/src/m/classes/matice.m
===================================================================
--- issm/trunk/src/m/classes/matice.m	(revision 19105)
+++ issm/trunk/src/m/classes/matice.m	(revision 20500)
@@ -28,47 +28,9 @@
 		mantle_density             = 0.;
 
+		%slr
+		earth_density              = 0;
+
 	end
 	methods
-		function createxml(self,fid) % {{{
-			fprintf(fid, '\n\n');
-			fprintf(fid, '<!-- materials -->\n');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_ice" type="',class(self.rho_ice),'" default="',convert2str(self.rho_ice),'">','     <section name="materials" />','     <help> ice density [kg/m^3] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_water" type="',class(self.rho_water),'" default="',convert2str(self.rho_water),'">','     <section name="materials" />','     <help> ocean water density [kg/m^3] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_freshwater" type="',class(self.rho_freshwater),'" default="',convert2str(self.rho_freshwater),'">','     <section name="materials" />','     <help> fresh water density [kg/m^3] </help>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mu_water" type="',class(self.mu_water),'" default="',convert2str(self.mu_water),'">','     <section name="materials" />','     <help> water viscosity [N s/m^2] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="heatcapacity" type="',class(self.heatcapacity),'" default="',convert2str(self.heatcapacity),'">','     <section name="materials" />','     <help> heat capacity [J/kg/K] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="latentheat" type="',class(self.latentheat),'" default="',convert2str(self.latentheat),'">','     <section name="materials" />','     <help> latent heat of fusion [J/kg] </help>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermalconductivity" type="',class(self.thermalconductivity),'" default="',convert2str(self.thermalconductivity),'">','     <section name="materials" />','     <help> ice thermal conductivity [W/m/K] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="temperateiceconductivity" type="',class(self.temperateiceconductivity),'" default="',convert2str(self.temperateiceconductivity),'">','     <section name="materials" />','     <help> temperate ice thermal conductivity [W/m/K] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="meltingpoint" type="',class(self.meltingpoint),'" default="',convert2str(self.meltingpoint),'">','     <section name="materials" />','     <help> melting point of ice at 1atm in K </help>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="beta" type="',class(self.beta),'" default="',convert2str(self.beta),'">','     <section name="materials" />','     <help> rate of change of melting point with pressure [K/Pa] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mixed_layer_capacity" type="',class(self.mixed_layer_capacity),'" default="',convert2str(self.mixed_layer_capacity),'">','     <section name="materials" />','     <help> mixed layer capacity [W/kg/K] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermal_exchange_velocity" type="',class(self.thermal_exchange_velocity),'" default="',convert2str(self.thermal_exchange_velocity),'">','     <section name="materials" />','     <help> thermal exchange velocity [m/s] </help>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_B" type="',class(self.rheology_B),'" default="',convert2str(self.rheology_B),'">','     <section name="materials" />','     <help> flow law parameter [Pa/s^(1/n)] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_n" type="',class(self.rheology_n),'" default="',convert2str(self.rheology_n),'">','     <section name="materials" />','     <help> Glens flow law exponent </help>','</parameter>');
-
-			% rheology_law drop-down
-			fprintf(fid,'%s\n%s\n%s\n%s\n','<parameter key ="rheology_law" type="alternative" optional="false">','     <section name="materials" />','     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>');
-			fprintf(fid,'%s\n','       <option value="None" type="string" default="true"> </option>');
-			fprintf(fid,'%s\n','       <option value="Paterson" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n','       <option value="Arrhenius" type="string" default="false"> </option>');
-			fprintf(fid,'%s\n%s\n','       <option value="LliboutryDuval" type="string" default="false"> </option>','</parameter>');
-
-
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_shear_modulus" type="',class(self.lithosphere_shear_modulus),'" default="',convert2str(self.lithosphere_shear_modulus),'">','     <section name="materials" />','     <help> Lithosphere shear modulus [Pa] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_density" type="',class(self.lithosphere_density),'" default="',convert2str(self.lithosphere_density),'">','     <section name="materials" />','     <help> Lithosphere density [g/cm^-3] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_shear_modulus" type="',class(self.mantle_shear_modulus),'" default="',convert2str(self.mantle_shear_modulus),'">','     <section name="materials" />','     <help> Mantle shear modulus [Pa] </help>','</parameter>');
-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_density" type="',class(self.mantle_density),'" default="',convert2str(self.mantle_density),'">','     <section name="materials" />','     <help> Mantle density [g/cm^-3] </help>','</parameter>');
-
-
-		end % }}}
 		function self = extrude(self,md) % {{{
 			self.rheology_B=project3d(md,'vector',self.rheology_B,'type','node');
@@ -141,4 +103,7 @@
 			self.mantle_density             = 3.34;       % (g/cm^-3)
 
+			%SLR
+			self.earth_density= 5512;  % average density of the Earth, (kg/m^3)
+
 		end % }}}
 		function md = checkconsistency(self,md,solution,analyses) % {{{
@@ -147,5 +112,5 @@
 			md = checkfield(md,'fieldname','materials.rho_freshwater','>',0);
 			md = checkfield(md,'fieldname','materials.mu_water','>',0);
-			md = checkfield(md,'fieldname','materials.rheology_B','>',0,'timeseries',1,'NaN',1);
+			md = checkfield(md,'fieldname','materials.rheology_B','>',0,'timeseries',1,'NaN',1,'Inf',1);
 			md = checkfield(md,'fieldname','materials.rheology_n','>',0,'size',[md.mesh.numberofelements 1]);
 			md = checkfield(md,'fieldname','materials.rheology_law','values',{'None' 'Cuffey' 'Paterson' 'Arrhenius' 'LliboutryDuval'});
@@ -156,4 +121,7 @@
 				md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1);
 				md = checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1);
+			end
+			if ismember(SealevelriseAnalysisEnum(),analyses),
+				md = checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1);
 			end
 
@@ -181,4 +149,5 @@
 			fielddisplay(self,'mantle_shear_modulus','Mantle shear modulus [Pa]');
 			fielddisplay(self,'mantle_density','Mantle density [g/cm^-3]');
+			fielddisplay(self,'earth_density','Mantle density [kg/m^-3]');
 		end % }}}
 		function marshall(self,md,fid) % {{{
@@ -204,4 +173,30 @@
 			WriteData(fid,'object',self,'class','materials','fieldname','mantle_shear_modulus','format','Double');
 			WriteData(fid,'object',self,'class','materials','fieldname','mantle_density','format','Double','scale',10^3);
+			WriteData(fid,'object',self,'class','materials','fieldname','earth_density','format','Double');
+		end % }}}
+		function savemodeljs(self,fid,modelname) % {{{
+		
+			writejsdouble(fid,[modelname '.materials.rho_ice'],self.rho_ice);
+			writejsdouble(fid,[modelname '.materials.rho_water'],self.rho_water);
+			writejsdouble(fid,[modelname '.materials.rho_freshwater'],self.rho_freshwater);
+			writejsdouble(fid,[modelname '.materials.mu_water'],self.mu_water);
+			writejsdouble(fid,[modelname '.materials.heatcapacity'],self.heatcapacity);
+			writejsdouble(fid,[modelname '.materials.latentheat'],self.latentheat);
+			writejsdouble(fid,[modelname '.materials.thermalconductivity'],self.thermalconductivity);
+			writejsdouble(fid,[modelname '.materials.temperateiceconductivity'],self.temperateiceconductivity);
+			writejsdouble(fid,[modelname '.materials.meltingpoint'],self.meltingpoint);
+			writejsdouble(fid,[modelname '.materials.beta'],self.beta);
+			writejsdouble(fid,[modelname '.materials.mixed_layer_capacity'],self.mixed_layer_capacity);
+			writejsdouble(fid,[modelname '.materials.thermal_exchange_velocity'],self.thermal_exchange_velocity);
+			writejsdouble(fid,[modelname '.materials.mixed_layer_capacity'],self.mixed_layer_capacity);
+			writejs1Darray(fid,[modelname '.materials.rheology_B'],self.rheology_B);
+			writejs1Darray(fid,[modelname '.materials.rheology_n'],self.rheology_n);
+			writejsstring(fid,[modelname '.materials.rheology_law'],self.rheology_law);
+			writejsdouble(fid,[modelname '.materials.lithosphere_shear_modulus'],self.lithosphere_shear_modulus);
+			writejsdouble(fid,[modelname '.materials.lithosphere_density'],self.lithosphere_density);
+			writejsdouble(fid,[modelname '.materials.mantle_shear_modulus'],self.mantle_shear_modulus);
+			writejsdouble(fid,[modelname '.materials.mantle_density'],self.mantle_density);
+			writejsdouble(fid,[modelname '.materials.earth_density'],self.earth_density);
+
 		end % }}}
 	end
