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

Last change on this file since 23716 was 23716, checked in by bdef, 6 years ago

CHG: shifting to py3 version of python interface (py2 compatible)

File size: 9.1 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.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
45 def __repr__(self): # {{{
46 string=" Materials:"
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 effectiveconductivity: (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 return string
70 #}}}
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
79 def setdefaultparameters(self): # {{{
80 #ice density (kg/m^3)
81 self.rho_ice=917.
82 #ocean water density (kg/m^3)
83 self.rho_water=1023.
84 #fresh water density (kg/m^3)
85 self.rho_freshwater=1000.
86 #water viscosity (N.s/m^2)
87 self.mu_water=0.001787
88 #ice heat capacity cp (J/kg/K)
89 self.heatcapacity=2093.
90 #ice latent heat of fusion L (J/kg)
91 self.latentheat=3.34*10**5
92 #ice thermal conductivity (W/m/K)
93 self.thermalconductivity=2.4
94 #temperate ice thermal conductivity (W/m/K)
95 self.temperateiceconductivity=0.24
96 #computation of effective conductivity
97 self.effectiveconductivity_averaging=1
98 #the melting point of ice at 1 atmosphere of pressure in K
99 self.meltingpoint=273.15
100 #rate of change of melting point with pressure (K/Pa)
101 self.beta=9.8*10**-8
102 #mixed layer (ice-water interface) heat capacity (J/kg/K)
103 self.mixed_layer_capacity=3974.
104 #thermal exchange velocity (ice-water interface) (m/s)
105 self.thermal_exchange_velocity=1.00*10**-4
106 #Rheology law: what is the temperature dependence of B with T
107 #available: none, paterson and arrhenius
108 self.rheology_law='Paterson'
109
110 # GIA:
111 self.lithosphere_shear_modulus = 6.7*10**10 # (Pa)
112 self.lithosphere_density = 3.32 # (g/cm^-3)
113 self.mantle_shear_modulus = 1.45*10**11 # (Pa)
114 self.mantle_density = 3.34 # (g/cm^-3)
115
116 #SLR
117 self.earth_density= 5512 #average density of the Earth, (kg/m^3)
118
119 return self
120 #}}}
121
122 def checkconsistency(self,md,solution,analyses): # {{{
123 md = checkfield(md,'fieldname','materials.rho_ice','>',0)
124 md = checkfield(md,'fieldname','materials.rho_water','>',0)
125 md = checkfield(md,'fieldname','materials.rho_freshwater','>',0)
126 md = checkfield(md,'fieldname','materials.mu_water','>',0)
127 md = checkfield(md,'fieldname','materials.rheology_E','>',0,'timeseries',1,'NaN',1,'Inf',1)
128 md = checkfield(md,'fieldname','materials.rheology_B','>',0,'timeseries',1,'NaN',1,'Inf',1)
129 md = checkfield(md,'fieldname','materials.rheology_n','>',0,'size',[md.mesh.numberofelements])
130 md = checkfield(md,'fieldname','materials.rheology_law','values',['None','BuddJacka','Cuffey','CuffeyTemperate','Paterson','Arrhenius','LliboutryDuval'])
131 md = checkfield(md,'fieldname','materials.effectiveconductivity_averaging','numel',[1],'values',[0,1,2])
132
133 if 'GiaAnalysis' in analyses:
134 md = checkfield(md,'fieldname','materials.lithosphere_shear_modulus','>',0,'numel',1)
135 md = checkfield(md,'fieldname','materials.lithosphere_density','>',0,'numel',1)
136 md = checkfield(md,'fieldname','materials.mantle_shear_modulus','>',0,'numel',1)
137 md = checkfield(md,'fieldname','materials.mantle_density','>',0,'numel',1)
138 if 'SealevelriseAnalysis' in analyses:
139 md = checkfield(md,'fieldname','materials.earth_density','>',0,'numel',1)
140 return md
141 # }}}
142
143 def marshall(self,prefix,md,fid): # {{{
144 WriteData(fid,prefix,'name','md.materials.type','data',4,'format','Integer')
145 WriteData(fid,prefix,'object',self,'class','materials','fieldname','rho_ice','format','Double')
146 WriteData(fid,prefix,'object',self,'class','materials','fieldname','rho_water','format','Double')
147 WriteData(fid,prefix,'object',self,'class','materials','fieldname','rho_freshwater','format','Double')
148 WriteData(fid,prefix,'object',self,'class','materials','fieldname','mu_water','format','Double')
149 WriteData(fid,prefix,'object',self,'class','materials','fieldname','heatcapacity','format','Double')
150 WriteData(fid,prefix,'object',self,'class','materials','fieldname','latentheat','format','Double')
151 WriteData(fid,prefix,'object',self,'class','materials','fieldname','thermalconductivity','format','Double')
152 WriteData(fid,prefix,'object',self,'class','materials','fieldname','temperateiceconductivity','format','Double')
153 WriteData(fid,prefix,'object',self,'class','materials','fieldname','effectiveconductivity_averaging','format','Integer')
154 WriteData(fid,prefix,'object',self,'class','materials','fieldname','meltingpoint','format','Double')
155 WriteData(fid,prefix,'object',self,'class','materials','fieldname','beta','format','Double')
156 WriteData(fid,prefix,'object',self,'class','materials','fieldname','mixed_layer_capacity','format','Double')
157 WriteData(fid,prefix,'object',self,'class','materials','fieldname','thermal_exchange_velocity','format','Double')
158 WriteData(fid,prefix,'object',self,'class','materials','fieldname','rheology_E','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts)
159 WriteData(fid,prefix,'object',self,'class','materials','fieldname','rheology_B','format','DoubleMat','mattype',1,'timeserieslength',md.mesh.numberofvertices+1,'yts',md.constants.yts)
160 WriteData(fid,prefix,'object',self,'class','materials','fieldname','rheology_n','format','DoubleMat','mattype',2)
161 WriteData(fid,prefix,'data',self.rheology_law,'name','md.materials.rheology_law','format','String')
162 WriteData(fid,prefix,'object',self,'class','materials','fieldname','lithosphere_shear_modulus','format','Double')
163 WriteData(fid,prefix,'object',self,'class','materials','fieldname','lithosphere_density','format','Double','scale',10^3)
164 WriteData(fid,prefix,'object',self,'class','materials','fieldname','mantle_shear_modulus','format','Double')
165 WriteData(fid,prefix,'object',self,'class','materials','fieldname','mantle_density','format','Double','scale',10^3)
166 WriteData(fid,prefix,'object',self,'class','materials','fieldname','earth_density','format','Double')
167 # }}}
Note: See TracBrowser for help on using the repository browser.