1 | //MATICE class definition
|
---|
2 | //
|
---|
3 | // Usage:
|
---|
4 | // matice=matice();
|
---|
5 |
|
---|
6 | function matice(){
|
---|
7 | //methods
|
---|
8 | this.setdefaultparameters = function(){ // {{{
|
---|
9 |
|
---|
10 | //ice density (kg/m^3)
|
---|
11 | this.rho_ice=917.;
|
---|
12 |
|
---|
13 | //ocean water density (kg/m^3)
|
---|
14 | this.rho_water=1023.;
|
---|
15 |
|
---|
16 | //fresh water density (kg/m^3)
|
---|
17 | this.rho_freshwater=1000.;
|
---|
18 |
|
---|
19 | //water viscosity (N.s/m^2)
|
---|
20 | this.mu_water=0.001787;
|
---|
21 |
|
---|
22 | //ice heat capacity cp (J/kg/K)
|
---|
23 | this.heatcapacity=2093.;
|
---|
24 |
|
---|
25 | //ice latent heat of fusion L (J/kg)
|
---|
26 | this.latentheat=3.34*10^5;
|
---|
27 |
|
---|
28 | //ice thermal conductivity (W/m/K)
|
---|
29 | this.thermalconductivity=2.4;
|
---|
30 |
|
---|
31 | //wet ice thermal conductivity (W/m/K)
|
---|
32 | this.temperateiceconductivity=.24;
|
---|
33 |
|
---|
34 | //the melting point of ice at 1 atmosphere of pressure in K
|
---|
35 | this.meltingpoint=273.15;
|
---|
36 |
|
---|
37 | //rate of change of melting point with pressure (K/Pa)
|
---|
38 | this.beta=9.8*10^-8;
|
---|
39 |
|
---|
40 | //mixed layer (ice-water interface) heat capacity (J/kg/K)
|
---|
41 | this.mixed_layer_capacity=3974.;
|
---|
42 |
|
---|
43 | //thermal exchange velocity (ice-water interface) (m/s)
|
---|
44 | this.thermal_exchange_velocity=1.00*10^-4;
|
---|
45 |
|
---|
46 | //Rheology law: what is the temperature dependence of B with T
|
---|
47 | //available: none, paterson and arrhenius
|
---|
48 | this.rheology_law='Paterson';
|
---|
49 |
|
---|
50 | // GIA:
|
---|
51 | this.lithosphere_shear_modulus = 6.7*Math.pow(10,10); // (Pa)
|
---|
52 | this.lithosphere_density = 3.32; // (g/cm^-3)
|
---|
53 | this.mantle_shear_modulus = 1.45*Math.pow(10,11); // (Pa)
|
---|
54 | this.mantle_density = 3.34; // (g/cm^-3)
|
---|
55 |
|
---|
56 | //SLR
|
---|
57 | this.earth_density= 5512; // average density of the Earth, (kg/m^3)
|
---|
58 |
|
---|
59 |
|
---|
60 | } //}}}
|
---|
61 | this.disp = function() {// {{{
|
---|
62 | console.log(sprintf(' Materials:'));
|
---|
63 |
|
---|
64 | fielddisplay(this,'rho_ice','ice density [kg/m^3]');
|
---|
65 | fielddisplay(this,'rho_water','ocean water density [kg/m^3]');
|
---|
66 | fielddisplay(this,'rho_freshwater','fresh water density [kg/m^3]');
|
---|
67 | fielddisplay(this,'mu_water','water viscosity [N s/m^2]');
|
---|
68 | fielddisplay(this,'heatcapacity','heat capacity [J/kg/K]');
|
---|
69 | fielddisplay(this,'thermalconductivity','ice thermal conductivity [W/m/K]');
|
---|
70 | fielddisplay(this,'temperateiceconductivity','temperate ice thermal conductivity [W/m/K]');
|
---|
71 | fielddisplay(this,'meltingpoint','melting point of ice at 1atm in K');
|
---|
72 | fielddisplay(this,'latentheat','latent heat of fusion [J/kg]');
|
---|
73 | fielddisplay(this,'beta','rate of change of melting point with pressure [K/Pa]');
|
---|
74 | fielddisplay(this,'mixed_layer_capacity','mixed layer capacity [W/kg/K]');
|
---|
75 | fielddisplay(this,'thermal_exchange_velocity','thermal exchange velocity [m/s]');
|
---|
76 | fielddisplay(this,'rheology_B','flow law parameter [Pa/s^(1/n)]');
|
---|
77 | fielddisplay(this,'rheology_n',"Glen's flow law exponent");
|
---|
78 | fielddisplay(this,'rheology_law',"law for the temperature dependance of the rheology: 'None', 'Cuffey', 'CuffeyTemperate', 'Paterson', 'Arrhenius' or 'LliboutryDuval'");
|
---|
79 | fielddisplay(this,'lithosphere_shear_modulus','Lithosphere shear modulus [Pa]');
|
---|
80 | fielddisplay(this,'lithosphere_density','Lithosphere density [g/cm^-3]');
|
---|
81 | fielddisplay(this,'mantle_shear_modulus','Mantle shear modulus [Pa]');
|
---|
82 | fielddisplay(this,'mantle_density','Mantle density [g/cm^-3]');
|
---|
83 | fielddisplay(this,'earth_density','Mantle density [kg/m^-3]');
|
---|
84 |
|
---|
85 | } // }}}
|
---|
86 | this.extrude = function(md) {
|
---|
87 | this.rheology_B=project3d(md,'vector',this.rheology_B,'type','node');
|
---|
88 | this.rheology_n=project3d(md,'vector',this.rheology_n,'type','element');
|
---|
89 | return this;
|
---|
90 | }
|
---|
91 | this.classname = function() {// {{{
|
---|
92 | return "matice";
|
---|
93 | } // }}}
|
---|
94 | this.checkconsistency = function(md,solution,analyses) { // {{{
|
---|
95 | checkfield(md,'fieldname','materials.rho_ice','>',0);
|
---|
96 | checkfield(md,'fieldname','materials.rho_water','>',0);
|
---|
97 | checkfield(md,'fieldname','materials.rho_freshwater','>',0);
|
---|
98 | checkfield(md,'fieldname','materials.mu_water','>',0);
|
---|
99 | checkfield(md,'fieldname','materials.rheology_B','>',0,'timeseries',1,'NaN',1,'Inf',1);
|
---|
100 | checkfield(md,'fieldname','materials.rheology_n','>',0,'size',[md.mesh.numberofelements,1]);
|
---|
101 | checkfield(md,'fieldname','materials.rheology_law','values',['None','Cuffey','CuffeyTemperate','Paterson','Arrhenius','LliboutryDuval']);
|
---|
102 |
|
---|
103 | if(ArrayAnyEqual(ArrayIsMember(GiaAnalysisEnum(),analyses),1)){
|
---|
104 | checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',1);
|
---|
105 | checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',1);
|
---|
106 | checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1);
|
---|
107 | checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1);
|
---|
108 | }
|
---|
109 | if (ArrayAnyEqual(ArrayIsMember(SealevelriseAnalysisEnum(),analyses),1)){
|
---|
110 | checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1);
|
---|
111 | }
|
---|
112 |
|
---|
113 |
|
---|
114 | } // }}}
|
---|
115 | this.marshall=function(md,prefix,fid) { //{{{
|
---|
116 | WriteData(fid,prefix,'name','md.materials.type','data',MaticeEnum(),'format','Integer');
|
---|
117 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','rho_ice','format','Double');
|
---|
118 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','rho_water','format','Double');
|
---|
119 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','rho_freshwater','format','Double');
|
---|
120 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','mu_water','format','Double');
|
---|
121 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','heatcapacity','format','Double');
|
---|
122 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','latentheat','format','Double');
|
---|
123 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','thermalconductivity','format','Double');
|
---|
124 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','temperateiceconductivity','format','Double');
|
---|
125 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','meltingpoint','format','Double');
|
---|
126 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','beta','format','Double');
|
---|
127 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','mixed_layer_capacity','format','Double');
|
---|
128 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','thermal_exchange_velocity','format','Double');
|
---|
129 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','rheology_B','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1);
|
---|
130 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','rheology_n','format','DoubleMat','mattype',2);
|
---|
131 | WriteData(fid,prefix,'data',StringToEnum(this.rheology_law),'name','md.materials.rheology_law','format','Integer');
|
---|
132 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','lithosphere_shear_modulus','format','Double');
|
---|
133 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','lithosphere_density','format','Double','scale',10^3);
|
---|
134 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','mantle_shear_modulus','format','Double');
|
---|
135 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','mantle_density','format','Double','scale',10^3);
|
---|
136 | WriteData(fid,prefix,'object',this,'class','materials','fieldname','earth_density','format','Double');
|
---|
137 |
|
---|
138 | }//}}}
|
---|
139 | this.fix=function() { //{{{
|
---|
140 | }//}}}
|
---|
141 | //properties
|
---|
142 | // {{{
|
---|
143 | this.rho_ice = 0.;
|
---|
144 | this.rho_water = 0.;
|
---|
145 | this.rho_freshwater = 0.;
|
---|
146 | this.mu_water = 0.;
|
---|
147 | this.heatcapacity = 0.;
|
---|
148 | this.latentheat = 0.;
|
---|
149 | this.thermalconductivity = 0.;
|
---|
150 | this.temperateiceconductivity = 0.;
|
---|
151 | this.meltingpoint = 0.;
|
---|
152 | this.beta = 0.;
|
---|
153 | this.mixed_layer_capacity = 0.;
|
---|
154 | this.thermal_exchange_velocity = 0.;
|
---|
155 | this.rheology_B = NaN;
|
---|
156 | this.rheology_n = NaN;
|
---|
157 | this.rheology_law = '';
|
---|
158 |
|
---|
159 | //gia:
|
---|
160 | this.lithosphere_shear_modulus = 0.;
|
---|
161 | this.lithosphere_density = 0.;
|
---|
162 | this.mantle_shear_modulus = 0.;
|
---|
163 | this.mantle_density = 0.;
|
---|
164 |
|
---|
165 | //SLR
|
---|
166 | this.earth_density= 5512; // average density of the Earth, (kg/m^3)
|
---|
167 |
|
---|
168 | this.setdefaultparameters();
|
---|
169 | //}}}
|
---|
170 | }
|
---|