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
RevLine 
[13131]1%MATICE class definition
[9636]2%
3% Usage:
[13131]4% matice=matice();
[9636]5
[13131]6classdef matice
[9636]7 properties (SetAccess=public)
[26744]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.;
[24313]16 effectiveconductivity_averaging = 0.;
[26744]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 = '';
[15396]24
[26744]25 %slc
26 earth_density = 0;
[15396]27
[9636]28 end
29 methods
[19105]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) % {{{
[9636]35 switch nargin
36 case 0
[19105]37 self=setdefaultparameters(self);
[13240]38 case 1
39 inputstruct=varargin{1};
[13254]40 list1 = properties('matice');
[13240]41 list2 = fieldnames(inputstruct);
[13254]42 for i=1:length(list1)
[13240]43 fieldname = list1{i};
44 if ismember(fieldname,list2),
[19105]45 self.(fieldname) = inputstruct.(fieldname);
[13240]46 end
47 end
[9636]48 otherwise
49 error('constructor not supported');
50 end
51 end % }}}
[19105]52 function self = setdefaultparameters(self) % {{{
[9636]53
54 %ice density (kg/m^3)
[19105]55 self.rho_ice=917.;
[9636]56
[12326]57 %ocean water density (kg/m^3)
[19105]58 self.rho_water=1023.;
[9636]59
[12326]60 %fresh water density (kg/m^3)
[19105]61 self.rho_freshwater=1000.;
[12326]62
[10565]63 %water viscosity (N.s/m^2)
[25836]64 self.mu_water=0.001787;
[10565]65
[9636]66 %ice heat capacity cp (J/kg/K)
[19105]67 self.heatcapacity=2093.;
[9636]68
69 %ice latent heat of fusion L (J/kg)
[19105]70 self.latentheat=3.34*10^5;
[9636]71
72 %ice thermal conductivity (W/m/K)
[19105]73 self.thermalconductivity=2.4;
[17806]74
75 %wet ice thermal conductivity (W/m/K)
[19105]76 self.temperateiceconductivity=.24;
[26744]77
[24313]78 %computation of effective conductivity
79 self.effectiveconductivity_averaging=1;
[9636]80
81 %the melting point of ice at 1 atmosphere of pressure in K
[19105]82 self.meltingpoint=273.15;
[9636]83
84 %rate of change of melting point with pressure (K/Pa)
[19105]85 self.beta=9.8*10^-8;
[9636]86
87 %mixed layer (ice-water interface) heat capacity (J/kg/K)
[19105]88 self.mixed_layer_capacity=3974.;
[9636]89
90 %thermal exchange velocity (ice-water interface) (m/s)
[19105]91 self.thermal_exchange_velocity=1.00*10^-4;
[9636]92
93 %Rheology law: what is the temperature dependence of B with T
94 %available: none, paterson and arrhenius
[19105]95 self.rheology_law='Paterson';
[15396]96
[26744]97 %Rheology for ice:
98 self.rheology_B=2.1*1e8;
99 self.rheology_n=3;
[15396]100
[20500]101 %SLR
102 self.earth_density= 5512; % average density of the Earth, (kg/m^3)
103
[9636]104 end % }}}
[19105]105 function md = checkconsistency(self,md,solution,analyses) % {{{
[26744]106
107 if strcmpi(solution,'TransientSolution') & md.transient.isslc,
108 md = checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1);
109 else
[25836]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);
[26744]115 md = checkfield(md,'fieldname','materials.rheology_n','>',0,'universal',1,'NaN',1,'Inf',1);
[25836]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
[15396]119
[9739]120 end % }}}
[19105]121 function disp(self) % {{{
[14310]122 disp(sprintf(' Materials:'));
[9636]123
[19105]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]');
[24313]131 fielddisplay(self,'effectiveconductivity_averaging','computation of effective conductivity: (0) arithmetic mean, (1) harmonic mean, (2) geometric mean (default)');
[19105]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]');
[23189]137 fielddisplay(self,'rheology_B','flow law parameter [Pa s^(1/n)]');
[19105]138 fielddisplay(self,'rheology_n','Glen''s flow law exponent');
[24313]139 fielddisplay(self,'rheology_law',['law for the temperature dependance of the rheology: ''None'', ''BuddJacka'', Cuffey'', ''CuffeyTemperate'', ''Paterson'', ''Arrhenius'', ''LliboutryDuval'', ''NyeH2O'', or ''NyeCO2''']);
[20500]140 fielddisplay(self,'earth_density','Mantle density [kg/m^-3]');
[9636]141 end % }}}
[21341]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');
[24313]152 WriteData(fid,prefix,'object',self,'class','materials','fieldname','effectiveconductivity_averaging','format','Integer');
[21341]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');
[25836]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);
[21341]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');
[10969]166 end % }}}
[20500]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);
[24313]177 writejsdouble(fid,[modelname '.materials.effectiveconductivity_averaging'],self.effectiveconductivity_averaging);
[20500]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 % }}}
[9636]189 end
190end
Note: See TracBrowser for help on using the repository browser.