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