[13131] | 1 | %MATICE class definition
|
---|
[9636] | 2 | %
|
---|
| 3 | % Usage:
|
---|
[13131] | 4 | % matice=matice();
|
---|
[9636] | 5 |
|
---|
[13131] | 6 | classdef matice
|
---|
[9636] | 7 | properties (SetAccess=public)
|
---|
[13094] | 8 | rho_ice = 0.;
|
---|
| 9 | rho_water = 0.;
|
---|
| 10 | rho_freshwater = 0.;
|
---|
| 11 | mu_water = 0.;
|
---|
| 12 | heatcapacity = 0.;
|
---|
| 13 | latentheat = 0.;
|
---|
| 14 | thermalconductivity = 0.;
|
---|
[17806] | 15 | temperateiceconductivity = 0.;
|
---|
[13094] | 16 | meltingpoint = 0.;
|
---|
| 17 | beta = 0.;
|
---|
| 18 | mixed_layer_capacity = 0.;
|
---|
| 19 | thermal_exchange_velocity = 0.;
|
---|
[10969] | 20 | rheology_B = NaN;
|
---|
| 21 | rheology_n = NaN;
|
---|
| 22 | rheology_law = '';
|
---|
[15396] | 23 |
|
---|
| 24 | %gia:
|
---|
| 25 | lithosphere_shear_modulus = 0.;
|
---|
| 26 | lithosphere_density = 0.;
|
---|
| 27 | mantle_shear_modulus = 0.;
|
---|
| 28 | mantle_density = 0.;
|
---|
| 29 |
|
---|
[9636] | 30 | end
|
---|
| 31 | methods
|
---|
[19105] | 32 | function createxml(self,fid) % {{{
|
---|
[17989] | 33 | fprintf(fid, '\n\n');
|
---|
| 34 | fprintf(fid, '<!-- materials -->\n');
|
---|
[19105] | 35 | 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>');
|
---|
| 36 | 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>');
|
---|
| 37 | 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>');
|
---|
[17989] | 38 |
|
---|
| 39 |
|
---|
[19105] | 40 | 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>');
|
---|
| 41 | 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>');
|
---|
| 42 | 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>');
|
---|
[17989] | 43 |
|
---|
| 44 |
|
---|
[19105] | 45 | 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>');
|
---|
| 46 | 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>');
|
---|
| 47 | 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>');
|
---|
[17989] | 48 |
|
---|
| 49 |
|
---|
[19105] | 50 | 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>');
|
---|
| 51 | 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>');
|
---|
| 52 | 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>');
|
---|
[17989] | 53 |
|
---|
| 54 |
|
---|
[19105] | 55 | 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>');
|
---|
| 56 | 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>');
|
---|
[17989] | 57 |
|
---|
| 58 | % rheology_law drop-down
|
---|
| 59 | 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>');
|
---|
| 60 | fprintf(fid,'%s\n',' <option value="None" type="string" default="true"> </option>');
|
---|
| 61 | fprintf(fid,'%s\n',' <option value="Paterson" type="string" default="false"> </option>');
|
---|
| 62 | fprintf(fid,'%s\n',' <option value="Arrhenius" type="string" default="false"> </option>');
|
---|
| 63 | fprintf(fid,'%s\n%s\n',' <option value="LliboutryDuval" type="string" default="false"> </option>','</parameter>');
|
---|
| 64 |
|
---|
| 65 |
|
---|
[19105] | 66 | 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>');
|
---|
| 67 | 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>');
|
---|
| 68 | 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>');
|
---|
| 69 | 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>');
|
---|
[17989] | 70 |
|
---|
| 71 |
|
---|
| 72 | end % }}}
|
---|
[19105] | 73 | function self = extrude(self,md) % {{{
|
---|
| 74 | self.rheology_B=project3d(md,'vector',self.rheology_B,'type','node');
|
---|
| 75 | self.rheology_n=project3d(md,'vector',self.rheology_n,'type','element');
|
---|
| 76 | end % }}}
|
---|
| 77 | function self = matice(varargin) % {{{
|
---|
[9636] | 78 | switch nargin
|
---|
| 79 | case 0
|
---|
[19105] | 80 | self=setdefaultparameters(self);
|
---|
[13240] | 81 | case 1
|
---|
| 82 | inputstruct=varargin{1};
|
---|
[13254] | 83 | list1 = properties('matice');
|
---|
[13240] | 84 | list2 = fieldnames(inputstruct);
|
---|
[13254] | 85 | for i=1:length(list1)
|
---|
[13240] | 86 | fieldname = list1{i};
|
---|
| 87 | if ismember(fieldname,list2),
|
---|
[19105] | 88 | self.(fieldname) = inputstruct.(fieldname);
|
---|
[13240] | 89 | end
|
---|
| 90 | end
|
---|
[9636] | 91 | otherwise
|
---|
| 92 | error('constructor not supported');
|
---|
| 93 | end
|
---|
| 94 | end % }}}
|
---|
[19105] | 95 | function self = setdefaultparameters(self) % {{{
|
---|
[9636] | 96 |
|
---|
| 97 | %ice density (kg/m^3)
|
---|
[19105] | 98 | self.rho_ice=917.;
|
---|
[9636] | 99 |
|
---|
[12326] | 100 | %ocean water density (kg/m^3)
|
---|
[19105] | 101 | self.rho_water=1023.;
|
---|
[9636] | 102 |
|
---|
[12326] | 103 | %fresh water density (kg/m^3)
|
---|
[19105] | 104 | self.rho_freshwater=1000.;
|
---|
[12326] | 105 |
|
---|
[10565] | 106 | %water viscosity (N.s/m^2)
|
---|
[19105] | 107 | self.mu_water=0.001787;
|
---|
[10565] | 108 |
|
---|
[9636] | 109 | %ice heat capacity cp (J/kg/K)
|
---|
[19105] | 110 | self.heatcapacity=2093.;
|
---|
[9636] | 111 |
|
---|
| 112 | %ice latent heat of fusion L (J/kg)
|
---|
[19105] | 113 | self.latentheat=3.34*10^5;
|
---|
[9636] | 114 |
|
---|
| 115 | %ice thermal conductivity (W/m/K)
|
---|
[19105] | 116 | self.thermalconductivity=2.4;
|
---|
[17806] | 117 |
|
---|
| 118 | %wet ice thermal conductivity (W/m/K)
|
---|
[19105] | 119 | self.temperateiceconductivity=.24;
|
---|
[9636] | 120 |
|
---|
| 121 | %the melting point of ice at 1 atmosphere of pressure in K
|
---|
[19105] | 122 | self.meltingpoint=273.15;
|
---|
[9636] | 123 |
|
---|
| 124 | %rate of change of melting point with pressure (K/Pa)
|
---|
[19105] | 125 | self.beta=9.8*10^-8;
|
---|
[9636] | 126 |
|
---|
| 127 | %mixed layer (ice-water interface) heat capacity (J/kg/K)
|
---|
[19105] | 128 | self.mixed_layer_capacity=3974.;
|
---|
[9636] | 129 |
|
---|
| 130 | %thermal exchange velocity (ice-water interface) (m/s)
|
---|
[19105] | 131 | self.thermal_exchange_velocity=1.00*10^-4;
|
---|
[9636] | 132 |
|
---|
| 133 | %Rheology law: what is the temperature dependence of B with T
|
---|
| 134 | %available: none, paterson and arrhenius
|
---|
[19105] | 135 | self.rheology_law='Paterson';
|
---|
[15396] | 136 |
|
---|
| 137 | % GIA:
|
---|
[19105] | 138 | self.lithosphere_shear_modulus = 6.7*10^10; % (Pa)
|
---|
| 139 | self.lithosphere_density = 3.32; % (g/cm^-3)
|
---|
| 140 | self.mantle_shear_modulus = 1.45*10^11; % (Pa)
|
---|
| 141 | self.mantle_density = 3.34; % (g/cm^-3)
|
---|
[15396] | 142 |
|
---|
[9636] | 143 | end % }}}
|
---|
[19105] | 144 | function md = checkconsistency(self,md,solution,analyses) % {{{
|
---|
[17806] | 145 | md = checkfield(md,'fieldname','materials.rho_ice','>',0);
|
---|
| 146 | md = checkfield(md,'fieldname','materials.rho_water','>',0);
|
---|
| 147 | md = checkfield(md,'fieldname','materials.rho_freshwater','>',0);
|
---|
| 148 | md = checkfield(md,'fieldname','materials.mu_water','>',0);
|
---|
[19105] | 149 | md = checkfield(md,'fieldname','materials.rheology_B','>',0,'timeseries',1,'NaN',1);
|
---|
[17806] | 150 | md = checkfield(md,'fieldname','materials.rheology_n','>',0,'size',[md.mesh.numberofelements 1]);
|
---|
| 151 | md = checkfield(md,'fieldname','materials.rheology_law','values',{'None' 'Cuffey' 'Paterson' 'Arrhenius' 'LliboutryDuval'});
|
---|
[15396] | 152 |
|
---|
| 153 | if ismember(GiaAnalysisEnum(),analyses),
|
---|
[17806] | 154 | md = checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',1);
|
---|
| 155 | md = checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',1);
|
---|
| 156 | md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1);
|
---|
| 157 | md = checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1);
|
---|
[15396] | 158 | end
|
---|
| 159 |
|
---|
[9739] | 160 | end % }}}
|
---|
[19105] | 161 | function disp(self) % {{{
|
---|
[14310] | 162 | disp(sprintf(' Materials:'));
|
---|
[9636] | 163 |
|
---|
[19105] | 164 | fielddisplay(self,'rho_ice','ice density [kg/m^3]');
|
---|
| 165 | fielddisplay(self,'rho_water','ocean water density [kg/m^3]');
|
---|
| 166 | fielddisplay(self,'rho_freshwater','fresh water density [kg/m^3]');
|
---|
| 167 | fielddisplay(self,'mu_water','water viscosity [N s/m^2]');
|
---|
| 168 | fielddisplay(self,'heatcapacity','heat capacity [J/kg/K]');
|
---|
| 169 | fielddisplay(self,'thermalconductivity',['ice thermal conductivity [W/m/K]']);
|
---|
| 170 | fielddisplay(self,'temperateiceconductivity','temperate ice thermal conductivity [W/m/K]');
|
---|
| 171 | fielddisplay(self,'meltingpoint','melting point of ice at 1atm in K');
|
---|
| 172 | fielddisplay(self,'latentheat','latent heat of fusion [J/kg]');
|
---|
| 173 | fielddisplay(self,'beta','rate of change of melting point with pressure [K/Pa]');
|
---|
| 174 | fielddisplay(self,'mixed_layer_capacity','mixed layer capacity [W/kg/K]');
|
---|
| 175 | fielddisplay(self,'thermal_exchange_velocity','thermal exchange velocity [m/s]');
|
---|
| 176 | fielddisplay(self,'rheology_B','flow law parameter [Pa/s^(1/n)]');
|
---|
| 177 | fielddisplay(self,'rheology_n','Glen''s flow law exponent');
|
---|
| 178 | fielddisplay(self,'rheology_law',['law for the temperature dependance of the rheology: ''None'', ''Cuffey'', ''Paterson'', ''Arrhenius'' or ''LliboutryDuval''']);
|
---|
| 179 | fielddisplay(self,'lithosphere_shear_modulus','Lithosphere shear modulus [Pa]');
|
---|
| 180 | fielddisplay(self,'lithosphere_density','Lithosphere density [g/cm^-3]');
|
---|
| 181 | fielddisplay(self,'mantle_shear_modulus','Mantle shear modulus [Pa]');
|
---|
| 182 | fielddisplay(self,'mantle_density','Mantle density [g/cm^-3]');
|
---|
[9636] | 183 | end % }}}
|
---|
[19105] | 184 | function marshall(self,md,fid) % {{{
|
---|
[13131] | 185 | WriteData(fid,'enum',MaterialsEnum(),'data',MaticeEnum(),'format','Integer');
|
---|
[19105] | 186 | WriteData(fid,'object',self,'class','materials','fieldname','rho_ice','format','Double');
|
---|
| 187 | WriteData(fid,'object',self,'class','materials','fieldname','rho_water','enum',MaterialsRhoSeawaterEnum(),'format','Double');
|
---|
| 188 | WriteData(fid,'object',self,'class','materials','fieldname','rho_freshwater','format','Double');
|
---|
| 189 | WriteData(fid,'object',self,'class','materials','fieldname','mu_water','format','Double');
|
---|
| 190 | WriteData(fid,'object',self,'class','materials','fieldname','heatcapacity','format','Double');
|
---|
| 191 | WriteData(fid,'object',self,'class','materials','fieldname','latentheat','format','Double');
|
---|
| 192 | WriteData(fid,'object',self,'class','materials','fieldname','thermalconductivity','format','Double');
|
---|
| 193 | WriteData(fid,'object',self,'class','materials','fieldname','temperateiceconductivity','format','Double');
|
---|
| 194 | WriteData(fid,'object',self,'class','materials','fieldname','meltingpoint','format','Double');
|
---|
| 195 | WriteData(fid,'object',self,'class','materials','fieldname','beta','format','Double');
|
---|
| 196 | WriteData(fid,'object',self,'class','materials','fieldname','mixed_layer_capacity','format','Double');
|
---|
| 197 | WriteData(fid,'object',self,'class','materials','fieldname','thermal_exchange_velocity','format','Double');
|
---|
| 198 | WriteData(fid,'object',self,'class','materials','fieldname','rheology_B','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
|
---|
| 199 | WriteData(fid,'object',self,'class','materials','fieldname','rheology_n','format','DoubleMat','mattype',2);
|
---|
| 200 | WriteData(fid,'data',StringToEnum(self.rheology_law),'enum',MaterialsRheologyLawEnum(),'format','Integer');
|
---|
[15396] | 201 |
|
---|
[19105] | 202 | WriteData(fid,'object',self,'class','materials','fieldname','lithosphere_shear_modulus','format','Double');
|
---|
| 203 | WriteData(fid,'object',self,'class','materials','fieldname','lithosphere_density','format','Double','scale',10^3);
|
---|
| 204 | WriteData(fid,'object',self,'class','materials','fieldname','mantle_shear_modulus','format','Double');
|
---|
| 205 | WriteData(fid,'object',self,'class','materials','fieldname','mantle_density','format','Double','scale',10^3);
|
---|
[10969] | 206 | end % }}}
|
---|
[9636] | 207 | end
|
---|
| 208 | end
|
---|