source: issm/trunk-jpl/src/m/classes/matenhancedice.py@ 23005

Last change on this file since 23005 was 23005, checked in by Mathieu Morlighem, 7 years ago

CHG: fixing wrong unit for rheology_B

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