Index: ../trunk-jpl/src/m/classes/materials.py =================================================================== --- ../trunk-jpl/src/m/classes/materials.py (revision 24755) +++ ../trunk-jpl/src/m/classes/materials.py (revision 24756) @@ -4,30 +4,6 @@ from checkfield import checkfield from WriteData import WriteData - -def naturetointeger(strnat): #{{{ - - intnat = np.zeros(len(strnat)) - for i in range(len(intnat)): - if strnat[i] == 'damageice': - intnat[i] = 1 - elif strnat[i] == 'estar': - intnat[i] = 2 - elif strnat[i] == 'ice': - intnat[i] = 3 - elif strnat[i] == 'enhancedice': - intnat[i] = 4 - elif strnat[i] == 'litho': - intnat[i] = 6 - elif strnat[i] == 'hydro': - intnat[i] = 7 - else: - raise RuntimeError("materials constructor error message: nature of the material not supported yet! (''ice'' or ''litho'')") - - return intnat - # }}} - - class materials(object): """ MATERIALS class definition @@ -44,8 +20,8 @@ self.nature = args for i in range(len(self.nature)): - if not(self.nature[i] == 'litho' or self.nature[i] == 'ice'): - raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho')") + if not(self.nature[i] == 'litho' or self.nature[i] == 'ice' or self.nature[i] == 'hydro'): + raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')") #start filling in the dynamic fields: for i in range(len(self.nature)): @@ -52,7 +28,6 @@ nat = self.nature[i] if nat == 'ice': setattr(self, 'rho_ice', 0) - setattr(self, 'rho_ice', 0) setattr(self, 'rho_water', 0) setattr(self, 'rho_freshwater', 0) setattr(self, 'mu_water', 0) @@ -78,61 +53,17 @@ setattr(self, 'isburgers', 0) setattr(self, 'density', 0) setattr(self, 'issolid', 0) + elif nat == 'hydro': + setattr(self, 'rho_ice', 0) + setattr(self, 'rho_water', 0) + setattr(self, 'earth_density', 0) else: - raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho')") - #set default parameters: + raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')") + + #set default parameters: self.setdefaultparameters() #}}} - def __repr__(self): # {{{ - string = " Materials:" - for i in range(len(self.nature)): - nat = self.nature[i] - if nat == 'ice': - string = "%s\n%s" % (string, 'Ice:') - string = "%s\n%s" % (string, fielddisplay(self, "rho_ice", "ice density [kg / m^3]")) - string = "%s\n%s" % (string, fielddisplay(self, "rho_water", "water density [kg / m^3]")) - string = "%s\n%s" % (string, fielddisplay(self, "rho_freshwater", "fresh water density [kg / m^3]")) - string = "%s\n%s" % (string, fielddisplay(self, "mu_water", "water viscosity [N s / m^2]")) - string = "%s\n%s" % (string, fielddisplay(self, "heatcapacity", "heat capacity [J / kg / K]")) - string = "%s\n%s" % (string, fielddisplay(self, "thermalconductivity", "ice thermal conductivity [W / m / K]")) - string = "%s\n%s" % (string, fielddisplay(self, "temperateiceconductivity", "temperate ice thermal conductivity [W / m / K]")) - string = "%s\n%s" % (string, fielddisplay(self, "meltingpoint", "melting point of ice at 1atm in K")) - string = "%s\n%s" % (string, fielddisplay(self, "latentheat", "latent heat of fusion [J / m^3]")) - string = "%s\n%s" % (string, fielddisplay(self, "beta", "rate of change of melting point with pressure [K / Pa]")) - string = "%s\n%s" % (string, fielddisplay(self, "mixed_layer_capacity", "mixed layer capacity [W / kg / K]")) - string = "%s\n%s" % (string, fielddisplay(self, "thermal_exchange_velocity", "thermal exchange velocity [m / s]")) - string = "%s\n%s" % (string, fielddisplay(self, "rheology_B", "flow law parameter [Pa s^(1 / n)]")) - string = "%s\n%s" % (string, fielddisplay(self, "rheology_n", "Glen's flow law exponent")) - string = "%s\n%s" % (string, fielddisplay(self, "rheology_law", "law for the temperature dependance of the rheology: 'None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius', 'LliboutryDuval', 'NyeCO2', or 'NyeH2O'")) - elif nat == 'litho': - string = "%s\n%s" % (string, 'Litho:') - string = "%s\n%s" % (string, fielddisplay(self, 'numlayers', 'number of layers (default 2)')) - string = "%s\n%s" % (string, fielddisplay(self, 'radius', 'array describing the radius for each interface (numlayers + 1) [m]')) - string = "%s\n%s" % (string, fielddisplay(self, 'viscosity', 'array describing each layer''s viscosity (numlayers) [Pa.s]')) - string = "%s\n%s" % (string, fielddisplay(self, 'lame_lambda', 'array describing the lame lambda parameter (numlayers) [Pa]')) - string = "%s\n%s" % (string, fielddisplay(self, 'lame_mu', 'array describing the shear modulus for each layers (numlayers) [Pa]')) - string = "%s\n%s" % (string, fielddisplay(self, 'burgers_viscosity', 'array describing each layer''s transient viscosity, only for Burgers rheologies (numlayers) [Pa.s]')) - string = "%s\n%s" % (string, fielddisplay(self, 'burgers_mu', 'array describing each layer''s transient shear modulus, only for Burgers rheologies (numlayers) [Pa]')) - string = "%s\n%s" % (string, fielddisplay(self, 'isburgers', 'array describing whether we adopt a MaxWell (0) or Burgers (1) rheology (default 0)')) - string = "%s\n%s" % (string, fielddisplay(self, 'density', 'array describing each layer''s density (numlayers) [kg / m^3]')) - string = "%s\n%s" % (string, fielddisplay(self, 'issolid', 'array describing whether the layer is solid or liquid (default 1) (numlayers)')) - - else: - raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho')") - - return string - #}}} - - def extrude(self, md): # {{{ - for i in range(len(self.nature)): - nat = self.nature[i] - if nat == 'ice': - self.rheology_B = project3d(md, 'vector', self.rheology_B, 'type', 'node') - self.rheology_n = project3d(md, 'vector', self.rheology_n, 'type', 'element') - return self - #}}} - def setdefaultparameters(self): # {{{ for i in range(len(self.nature)): nat = self.nature[i] @@ -164,7 +95,6 @@ #Rheology law: what is the temperature dependence of B with T #available: none, paterson and arrhenius self.rheology_law = 'Paterson' - elif nat == 'litho': #we default to a configuration that enables running GIA solutions using giacaron and / or giaivins. self.numlayers = 2 @@ -179,13 +109,63 @@ self.isburgers = [0, 0] self.density = [5.51 * 1e3, 5.50 * 1e3] # (Pa) #mantle and lithosphere density [kg / m^3] self.issolid = [1, 1] # is layer solid or liquid. - + elif nat == 'hydro': + #ice density (kg / m^3) + self.rho_ice = 917. + #ocean water density (kg / m^3) + self.rho_water = 1023. + #average density of the Earth (kg / m^3) + self.earth_density = 5512 else: - raise RuntimeError("materials setdefaultparameters error message: nature of the material not supported yet! ('ice' or 'litho')") + raise RuntimeError("materials setdefaultparameters error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')") return self #}}} + def __repr__(self): # {{{ + string = " Materials:" + for i in range(len(self.nature)): + nat = self.nature[i] + if nat == 'ice': + string = "%s\n%s" % (string, 'Ice:') + string = "%s\n%s" % (string, fielddisplay(self, "rho_ice", "ice density [kg / m^3]")) + string = "%s\n%s" % (string, fielddisplay(self, "rho_water", "ocean water density [kg / m^3]")) + string = "%s\n%s" % (string, fielddisplay(self, "rho_freshwater", "fresh water density [kg / m^3]")) + string = "%s\n%s" % (string, fielddisplay(self, "mu_water", "water viscosity [N s / m^2]")) + string = "%s\n%s" % (string, fielddisplay(self, "heatcapacity", "heat capacity [J / kg / K]")) + string = "%s\n%s" % (string, fielddisplay(self, "thermalconductivity", "ice thermal conductivity [W / m / K]")) + string = "%s\n%s" % (string, fielddisplay(self, "temperateiceconductivity", "temperate ice thermal conductivity [W / m / K]")) + string = "%s\n%s" % (string, fielddisplay(self, "meltingpoint", "melting point of ice at 1atm in K")) + string = "%s\n%s" % (string, fielddisplay(self, "latentheat", "latent heat of fusion [J / m^3]")) + string = "%s\n%s" % (string, fielddisplay(self, "beta", "rate of change of melting point with pressure [K / Pa]")) + string = "%s\n%s" % (string, fielddisplay(self, "mixed_layer_capacity", "mixed layer capacity [W / kg / K]")) + string = "%s\n%s" % (string, fielddisplay(self, "thermal_exchange_velocity", "thermal exchange velocity [m / s]")) + string = "%s\n%s" % (string, fielddisplay(self, "rheology_B", "flow law parameter [Pa s^(1 / n)]")) + string = "%s\n%s" % (string, fielddisplay(self, "rheology_n", "Glen's flow law exponent")) + string = "%s\n%s" % (string, fielddisplay(self, "rheology_law", "law for the temperature dependance of the rheology: 'None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius', 'LliboutryDuval', 'NyeCO2', or 'NyeH2O'")) + elif nat == 'litho': + string = "%s\n%s" % (string, 'Litho:') + string = "%s\n%s" % (string, fielddisplay(self, 'numlayers', 'number of layers (default 2)')) + string = "%s\n%s" % (string, fielddisplay(self, 'radius', 'array describing the radius for each interface (numlayers + 1) [m]')) + string = "%s\n%s" % (string, fielddisplay(self, 'viscosity', 'array describing each layer''s viscosity (numlayers) [Pa.s]')) + string = "%s\n%s" % (string, fielddisplay(self, 'lame_lambda', 'array describing the lame lambda parameter (numlayers) [Pa]')) + string = "%s\n%s" % (string, fielddisplay(self, 'lame_mu', 'array describing the shear modulus for each layers (numlayers) [Pa]')) + string = "%s\n%s" % (string, fielddisplay(self, 'burgers_viscosity', 'array describing each layer''s transient viscosity, only for Burgers rheologies (numlayers) [Pa.s]')) + string = "%s\n%s" % (string, fielddisplay(self, 'burgers_mu', 'array describing each layer''s transient shear modulus, only for Burgers rheologies (numlayers) [Pa]')) + string = "%s\n%s" % (string, fielddisplay(self, 'isburgers', 'array describing whether we adopt a MaxWell (0) or Burgers (1) rheology (default 0)')) + string = "%s\n%s" % (string, fielddisplay(self, 'density', 'array describing each layer''s density (numlayers) [kg / m^3]')) + string = "%s\n%s" % (string, fielddisplay(self, 'issolid', 'array describing whether the layer is solid or liquid (default 1) (numlayers)')) + elif nat == 'hydro': + string = "%s\n%s" % (string, 'Hydro:') + string = "%s\n%s" % (string, fielddisplay(self, "rho_ice", "ice density [kg / m^3]")) + string = "%s\n%s" % (string, fielddisplay(self, "rho_water", "ocean water density [kg / m^3]")) + string = "%s\n%s" % (string, fielddisplay(self, "earth_density", "mantle density [kg / m^3]")) + else: + raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')") + + return string + #}}} + def checkconsistency(self, md, solution, analyses): # {{{ for i in range(len(self.nature)): nat = self.nature[i] @@ -197,7 +177,6 @@ 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]) md = checkfield(md, 'fieldname', 'materials.rheology_law', 'values', ['None', 'BuddJacka', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius', 'LliboutryDuval', 'NyeCO2', 'NyeH2O']) - elif nat == 'litho': if 'LoveAnalysis' not in analyses: return md @@ -223,9 +202,12 @@ for i in range(md.materials.numlayers - 1): if (not md.materials.issolid[i]) and (not md.materials.issolid[i + 1]): #if there are at least two consecutive indices that contain issolid = 0 raise RuntimeError("%s%i%s" % ('2 or more adjacent fluid layers detected starting at layer ', i, '. This is not supported yet. Consider merging them.')) - + elif nat == 'hydro': + md = checkfield(md, 'fieldname', 'materials.rho_ice', '>', 0) + md = checkfield(md, 'fieldname', 'materials.rho_water', '>', 0) + md = checkfield(md, 'fieldname', 'materials.earth_density', '>', 0, 'numel', [1]) else: - raise RuntimeError("materials checkconsistency error message: nature of the material not supported yet! ('ice' or 'litho')") + raise RuntimeError("materials checkconsistency error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')") return md # }}} @@ -232,8 +214,8 @@ def marshall(self, prefix, md, fid): # {{{ #1: MatdamageiceEnum 2: MatestarEnum 3: MaticeEnum 4: MatenhancediceEnum 5: MaterialsEnum - WriteData(fid, prefix, 'name', 'md.materials.type', 'data', 6, 'format', 'Integer') WriteData(fid, prefix, 'name', 'md.materials.nature', 'data', naturetointeger(self.nature), 'format', 'IntMat', 'mattype', 3) + WriteData(fid, prefix, 'name', 'md.materials.type', 'data', 5, 'format', 'Integer') #DANGER, this can evolve if you have classes for i in range(len(self.nature)): nat = self.nature[i] @@ -254,7 +236,6 @@ WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rheology_B', 'format', 'DoubleMat', 'mattype', 1, 'timeserieslength', md.mesh.numberofvertices + 1, 'yts', md.constants.yts) WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rheology_n', 'format', 'DoubleMat', 'mattype', 2) WriteData(fid, prefix, 'data', self.rheology_law, 'name', 'md.materials.rheology_law', 'format', 'String') - elif nat == 'litho': WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'numlayers', 'format', 'Integer') WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'radius', 'format', 'DoubleMat', 'mattype', 3) @@ -266,7 +247,43 @@ WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'isburgers', 'format', 'DoubleMat', 'mattype', 3) WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'burgers_viscosity', 'format', 'DoubleMat', 'mattype', 3) WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'burgers_mu', 'format', 'DoubleMat', 'mattype', 3) - + elif nat == 'hydro': + WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_ice', 'format', 'Double') + WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'rho_water', 'format', 'Double') + WriteData(fid, prefix, 'object', self, 'class', 'materials', 'fieldname', 'earth_density', 'format', 'Double') else: - raise RuntimeError("materials constructor error message: nature of the material not supported yet! (''ice'' or ''litho'')") + raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')") # }}} + + def extrude(self, md): # {{{ + for i in range(len(self.nature)): + nat = self.nature[i] + if nat == 'ice': + self.rheology_B = project3d(md, 'vector', self.rheology_B, 'type', 'node') + self.rheology_n = project3d(md, 'vector', self.rheology_n, 'type', 'element') + return self + #}}} + +def naturetointeger(strnat): #{{{ + intnat = np.zeros(len(strnat)) + + for i in range(len(intnat)): + if strnat[i] == 'damageice': + intnat[i] = 1 + elif strnat[i] == 'estar': + intnat[i] = 2 + elif strnat[i] == 'ice': + intnat[i] = 3 + elif strnat[i] == 'enhancedice': + intnat[i] = 4 + # elif strnat[i] == 'materials': + # intnat[i] = 5 #this case will never happen, kept to ensure equivalent of codes between IoCodeToMeterialsEnum and IoCodeToNatureEnum + elif strnat[i] == 'litho': + intnat[i] = 6 + elif strnat[i] == 'hydro': + intnat[i] = 7 + else: + raise RuntimeError("materials constructor error message: nature of the material not supported yet! ('ice' or 'litho' or 'hydro')") + + return intnat +# }}} Index: ../trunk-jpl/src/m/classes/materials.m =================================================================== --- ../trunk-jpl/src/m/classes/materials.m (revision 24755) +++ ../trunk-jpl/src/m/classes/materials.m (revision 24756) @@ -4,7 +4,7 @@ % materials=materials(); classdef materials < dynamicprops - properties (SetAccess=public) + properties (SetAccess=public) nature={}; %all properties are dynamic. end @@ -12,20 +12,20 @@ function self = materials(varargin) % {{{ if nargin==0 self.nature={'ice'}; - else + else self.nature=varargin; end - - %check this is acceptable: + + %check this is acceptable: for i=1:length(self.nature), - if ~(strcmpi(self.nature{i},'litho') | strcmpi(self.nature{i},'ice') | strcmpi(self.nature{i},'hydro')), + if ~(strcmpi(self.nature{i},'litho') | strcmpi(self.nature{i},'ice') | strcmpi(self.nature{i},'hydro')), error('materials constructor error message: nature of the material not supported yet! (''ice'' or ''litho'' or ''hydro'')'); end end - - %start filling in the dynamic fields: + + %start filling in the dynamic fields: for i=1:length(self.nature), - nat=self.nature{i}; + nat=self.nature{i}; switch nat case 'ice' self.addprop('rho_ice'); @@ -36,7 +36,7 @@ self.addprop('latentheat'); self.addprop('thermalconductivity'); self.addprop('temperateiceconductivity'); - self.addprop('meltingpoint'); + self.addprop('meltingpoint'); self.addprop('beta'); self.addprop('mixed_layer_capacity'); self.addprop('thermal_exchange_velocity'); @@ -45,7 +45,7 @@ self.addprop('rheology_law'); case 'litho' self.addprop('numlayers'); - self.addprop('radius'); + self.addprop('radius'); self.addprop('viscosity'); self.addprop('lame_lambda'); self.addprop('lame_mu'); @@ -69,7 +69,7 @@ function self = setdefaultparameters(self) % {{{ for i=1:length(self.nature), - nat=self.nature{i}; + nat=self.nature{i}; switch nat case 'ice' %ice density (kg/m^3) @@ -82,7 +82,7 @@ self.rho_freshwater=1000.; %water viscosity (N.s/m^2) - self.mu_water=0.001787; + self.mu_water=0.001787; %ice heat capacity cp (J/kg/K) self.heatcapacity=2093.; @@ -92,7 +92,7 @@ %ice thermal conductivity (W/m/K) self.thermalconductivity=2.4; - + %wet ice thermal conductivity (W/m/K) self.temperateiceconductivity=.24; @@ -113,11 +113,11 @@ self.rheology_law='Paterson'; case 'litho' - %we default to a configuration that enables running GIA solutions using giacaron and/or giaivins. + %we default to a configuration that enables running GIA solutions using giacaron and/or giaivins. self.numlayers=2; %center of the earth (approximation, must not be 0), then the lab (lithosphere/asthenosphere boundary) then the surface - %(with 1d3 to avoid numerical singularities) + %(with 1d3 to avoid numerical singularities) self.radius=[1e3;6278*1e3;6378*1e3]; self.viscosity=[1e21;1e40]; %mantle and lithosphere viscosity (respectively) [Pa.s] @@ -135,8 +135,8 @@ %ocean water density (kg/m^3) self.rho_water=1023.; - %SLR - self.earth_density= 5512; % average density of the Earth, (kg/m^3) + % average density of the Earth (kg/m^3) + self.earth_density=5512; otherwise error('materials constructor error message: nature of the material not supported yet! (''ice'' or ''litho'' or ''hydro'')'); @@ -147,7 +147,7 @@ disp(sprintf(' Materials:')); for i=1:length(self.nature), - nat=self.nature{i}; + nat=self.nature{i}; switch nat case 'ice' disp(sprintf(' \nIce:')); @@ -182,7 +182,7 @@ disp(sprintf(' \nHydro:')); fielddisplay(self,'rho_ice','ice density [kg/m^3]'); fielddisplay(self,'rho_water','ocean water density [kg/m^3]'); - fielddisplay(self,'earth_density','Mantle density [kg/m^-3]'); + fielddisplay(self,'earth_density','mantle density [kg/m^3]'); otherwise error('materials constructor error message: nature of the material not supported yet! (''ice'' or ''litho'' or ''hydro'')'); @@ -192,7 +192,7 @@ function md = checkconsistency(self,md,solution,analyses) % {{{ for i=1:length(self.nature), - nat=self.nature{i}; + nat=self.nature{i}; switch nat case 'ice' md = checkfield(md,'fieldname','materials.rho_ice','>',0); @@ -216,11 +216,11 @@ md = checkfield(md,'fieldname','materials.burgers_mu','Inf',1,'size',[md.materials.numlayers 1],'>=',0); for i=1:md.materials.numlayers, - if md.materials.isburgers(i) & (isnan(md.materials.burgers_viscosity(i) | isnan(md.materials.burgers_mu(i)))), + if md.materials.isburgers(i) & (isnan(md.materials.burgers_viscosity(i) | isnan(md.materials.burgers_mu(i)))), error('materials checkconsistency error message: Litho burgers_viscosity or burgers_mu has NaN values, inconsistent with isburgers choice'); end end - if md.materials.issolid(1)==0 | md.materials.lame_mu(1)==0 + if md.materials.issolid(1)==0 | md.materials.lame_mu(1)==0 error('First layer must be solid (issolid(1) > 0 AND lame_mu(1) > 0). Add a weak inner core if necessary.'); end ind=find(md.materials.issolid==0); @@ -241,12 +241,12 @@ end % }}} function marshall(self,prefix,md,fid) % {{{ - %1: MatdamageiceEnum 2: MatestarEnum 3: MaticeEnum 4: MatenhancediceEnum 5: MaterialsEnum + %1: MatdamageiceEnum 2: MatestarEnum 3: MaticeEnum 4: MatenhancediceEnum 5: MaterialsEnum WriteData(fid,prefix,'name','md.materials.nature','data',naturetointeger(self.nature),'format','IntMat','mattype',3); - WriteData(fid,prefix,'name','md.materials.type','data',5,'format','Integer'); %DANGER, this can evolve if you have classes. + WriteData(fid,prefix,'name','md.materials.type','data',5,'format','Integer'); %DANGER, this can evolve if you have classes. for i=1:length(self.nature), - nat=self.nature{i}; + nat=self.nature{i}; switch nat case 'ice' WriteData(fid,prefix,'object',self,'class','materials','fieldname','rho_ice','format','Double'); @@ -270,11 +270,11 @@ WriteData(fid,prefix,'object',self,'class','materials','fieldname','lame_mu','format','DoubleMat','mattype',3); WriteData(fid,prefix,'object',self,'class','materials','fieldname','lame_lambda','format','DoubleMat','mattype',3); WriteData(fid,prefix,'object',self,'class','materials','fieldname','issolid','format','DoubleMat','mattype',3); - WriteData(fid,prefix,'object',self,'class','materials','fieldname','density','format','DoubleMat','mattype',3); - WriteData(fid,prefix,'object',self,'class','materials','fieldname','viscosity','format','DoubleMat','mattype',3); - WriteData(fid,prefix,'object',self,'class','materials','fieldname','isburgers','format','DoubleMat','mattype',3); - WriteData(fid,prefix,'object',self,'class','materials','fieldname','burgers_viscosity','format','DoubleMat','mattype',3); - WriteData(fid,prefix,'object',self,'class','materials','fieldname','burgers_mu','format','DoubleMat','mattype',3); + WriteData(fid,prefix,'object',self,'class','materials','fieldname','density','format','DoubleMat','mattype',3); + WriteData(fid,prefix,'object',self,'class','materials','fieldname','viscosity','format','DoubleMat','mattype',3); + WriteData(fid,prefix,'object',self,'class','materials','fieldname','isburgers','format','DoubleMat','mattype',3); + WriteData(fid,prefix,'object',self,'class','materials','fieldname','burgers_viscosity','format','DoubleMat','mattype',3); + WriteData(fid,prefix,'object',self,'class','materials','fieldname','burgers_mu','format','DoubleMat','mattype',3); case 'hydro' WriteData(fid,prefix,'object',self,'class','materials','fieldname','rho_ice','format','Double'); WriteData(fid,prefix,'object',self,'class','materials','fieldname','rho_water','format','Double'); @@ -287,7 +287,7 @@ end % }}} function self = extrude(self,md) % {{{ for i=1:length(self.nature), - nat=self.nature{i}; + nat=self.nature{i}; switch nat case 'ice' self.rheology_B=project3d(md,'vector',self.rheology_B,'type','node'); @@ -296,9 +296,9 @@ end end % }}} function savemodeljs(self,fid,modelname) % {{{ - + for i=1:length(self.nature), - nat=self.nature{i}; + nat=self.nature{i}; switch nat case 'ice' writejsdouble(fid,[modelname '.materials.rho_ice'],self.rho_ice); @@ -323,11 +323,11 @@ writejsdouble(fid,[modelname '.materials.lame_mu'],self.lame_mu); writejsdouble(fid,[modelname '.materials.lame_lambda'],self.lame_lambda); writejsdouble(fid,[modelname '.materials.issolid'],self.issolid); - writejsdouble(fid,[modelname '.materials.density'],self.density); - writejsdouble(fid,[modelname '.materials.viscosity'],self.viscosity); - writejsdouble(fid,[modelname '.materials.isburgers'],self.isburgers); - writejsdouble(fid,[modelname '.materials.burgers_viscosity'],self.burgers_viscosity); - writejsdouble(fid,[modelname '.materials.burgers_mu'],self.burgers_mu); + writejsdouble(fid,[modelname '.materials.density'],self.density); + writejsdouble(fid,[modelname '.materials.viscosity'],self.viscosity); + writejsdouble(fid,[modelname '.materials.isburgers'],self.isburgers); + writejsdouble(fid,[modelname '.materials.burgers_viscosity'],self.burgers_viscosity); + writejsdouble(fid,[modelname '.materials.burgers_mu'],self.burgers_mu); case 'hydro' writejsdouble(fid,[modelname '.materials.rho_ice'],self.rho_ice); @@ -344,26 +344,27 @@ end % }}} end end - function intnat = naturetointeger(strnat) % {{{ - intnat=zeros(length(strnat),1); - for i=1:length(strnat), - switch strnat{i}, - case 'damageice' - intnat(i)=1; - case 'estar' - intnat(i)=2; - case 'ice' - intnat(i)=3; - case 'enhancedice' - intnat(i)=4; - %case 'materials' %this case will never happen, kept to ensure equivalent of codes between IoCodeToMaterialsEnumm and IoCodeToNatureEnum - % intnat(i)=5; - case 'litho' - intnat(i)=6; - case 'hydro' - intnat(i)=7; - otherwise - error('materials constructor error message: nature of the material not supported yet! (''ice'' or ''litho'' or ''hydro'')'); - end - end - end % }}} + +function intnat = naturetointeger(strnat) % {{{ + intnat=zeros(length(strnat),1); + for i=1:length(strnat), + switch strnat{i}, + case 'damageice' + intnat(i)=1; + case 'estar' + intnat(i)=2; + case 'ice' + intnat(i)=3; + case 'enhancedice' + intnat(i)=4; + %case 'materials' %this case will never happen, kept to ensure equivalent of codes between IoCodeToMaterialsEnum and IoCodeToNatureEnum + % intnat(i)=5; + case 'litho' + intnat(i)=6; + case 'hydro' + intnat(i)=7; + otherwise + error('materials constructor error message: nature of the material not supported yet! (''ice'' or ''litho'' or ''hydro'')'); + end + end +end % }}}