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