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