source: issm/trunk/src/m/classes/matice.m@ 26744

Last change on this file since 26744 was 26744, checked in by Mathieu Morlighem, 3 years ago

merged trunk-jpl and trunk for revision 26742

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