[cig-commits] [commit] master: automating setting of the equation of state (dce103b)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Thu Dec 11 12:19:59 PST 2014
Repository : https://github.com/geodynamics/burnman
On branch : master
Link : https://github.com/geodynamics/burnman/compare/c5ec36a308413012ee5b0763ccb541c2ad56f382...bc315ff9a2ed1d4871962882f0626468342f1ffc
>---------------------------------------------------------------
commit dce103b0b066e65a1b9570f666e07da86cebf23f
Author: sannecottaar <sanne.cottaar at gmail.com>
Date: Tue Dec 9 17:45:06 2014 -0800
automating setting of the equation of state
>---------------------------------------------------------------
dce103b0b066e65a1b9570f666e07da86cebf23f
burnman/mineral.py | 24 ++++++---------
burnman/mineral_helpers.py | 54 +++++++++++++++++++--------------
burnman/minerals/Matas_etal_2007.py | 7 +++++
burnman/minerals/Murakami_2013.py | 7 +++++
burnman/minerals/Murakami_etal_2012.py | 14 +++++++--
burnman/minerals/SLB_2005.py | 6 +++-
burnman/minerals/SLB_2011.py | 6 +++-
burnman/minerals/SLB_2011_ZSB_2013.py | 7 +++++
burnman/minerals/other.py | 6 ++--
examples/example_averaging.py | 4 ---
examples/example_beginner.py | 6 +---
examples/example_compare_all_methods.py | 3 +-
examples/example_compare_enstpyro.py | 17 -----------
examples/example_composition.py | 11 -------
examples/example_geotherms.py | 1 -
examples/example_grid.py | 1 -
examples/example_inv_murakami.py | 2 --
examples/example_optimize_pv.py | 15 ---------
examples/example_partition_coef.py | 15 ---------
examples/example_premite_isothermal.py | 1 -
examples/example_spintransition.py | 7 -----
examples/example_user_input_material.py | 3 +-
examples/example_woutput.py | 15 ---------
23 files changed, 91 insertions(+), 141 deletions(-)
diff --git a/burnman/mineral.py b/burnman/mineral.py
index d23a383..5fde123 100644
--- a/burnman/mineral.py
+++ b/burnman/mineral.py
@@ -39,20 +39,13 @@ class Mineral(Material):
"""
def __init__(self):
- self.params = { 'name':'generic',
- 'equation_of_state': 'slb3', #Equation of state used to fit the parameters
- 'V_0': 0., #Molar volume [m^3/(mole molecules)] at room pressure/temperature
- 'K_0': 0., #Reference bulk modulus [Pa] at room pressure/temperature
- 'Kprime_0': 0., #pressure derivative of bulk modulus
- 'G_0': 0., #reference shear modulus at room pressure/temperature
- 'Gprime_0': 0., #pressure derivative of shear modulus
- 'molar_mass': 0., #molar mass in units of [kg/mol]
- 'n': 0., #number of atoms per molecule
- 'Debye_0': 0., #Debye temperature for material. See Stixrude & Lithgow-Bertelloni, 2005 for values
- 'grueneisen_0': 0., #Gruneisen parameter for material. See Stixrude & Lithgow-Bertelloni, 2005 for values
- 'q_0': 0., #q value used in caluclations. See Stixrude & Lithgow-Bertelloni, 2005 for values
- 'eta_s_0': 0.0} #eta value used in calculations. See Stixrude & Lithgow-Bertelloni, 2005 for values
- self.method = None
+ if 'params' not in self.__dict__:
+ self.params={}
+ if 'equation_of_state' in self.params:
+ self.set_method(self.params['equation_of_state'])
+ else:
+ warnings.warn(" Equation of state is not defined in the database for this mineral. However, if you call set_method later, this is fine")
+ self.method=None
def set_method(self, method):
"""
@@ -62,6 +55,9 @@ class Mineral(Material):
or 'slb3'. Alternatively, you can pass a user defined
class which derives from the equation_of_state base class.
"""
+ if 'equation_of_state' in self.params:
+ if self.params['equation_of_state'] is not method:
+ warnings.warn('Overriding database equation of state. From '+self.params['equation_of_state'] +' to ' + method)
if( isinstance(method, basestring)):
if (method == "slb2"):
self.method = slb.SLB2()
diff --git a/burnman/mineral_helpers.py b/burnman/mineral_helpers.py
index ac5f400..16fe49a 100644
--- a/burnman/mineral_helpers.py
+++ b/burnman/mineral_helpers.py
@@ -35,17 +35,31 @@ class HelperSolidSolution(Mineral):
comes up with a new mineral by doing a weighted arithmetic
average of the end member minerals
"""
- self.base_materials = base_materials
- self.molar_fraction = molar_fraction
- assert(len(base_materials) == len(molar_fraction))
- assert(sum(molar_fraction) > 0.9999)
- assert(sum(molar_fraction) < 1.0001)
-
- #does not make sense to do a solid solution with different number of
- #atoms per formula unit, at least not simply...
- for m in base_materials:
- if(base_materials[0].params.has_key('n')):
- assert(m.params['n'] == base_materials[0].params['n'])
+ self.base_materials = base_materials
+ self.molar_fraction = molar_fraction
+ assert(len(base_materials) == len(molar_fraction))
+ assert(sum(molar_fraction) > 0.9999)
+ assert(sum(molar_fraction) < 1.0001)
+ #does not make sense to do a solid solution with different number of
+ #atoms per formula unit or different equations of state, at least not simply...
+ for m in base_materials:
+ if(base_materials[0].params.has_key('n')):
+ assert(m.params['n'] == base_materials[0].params['n'])
+ assert(m.params['equation_of_state']==base_materials[0].params['equation_of_state'])
+
+ self.method=base_materials[0].method
+
+ itrange = range(0, len(self.base_materials))
+
+ self.params = {}
+ for prop in self.base_materials[0].params:
+ try:
+ self.params[prop] = sum([ self.base_materials[i].params[prop] * self.molar_fraction[i] for i in itrange ])
+ except TypeError:
+ #if there is a type error, it is probably a string. Just go with the value of the first base_material.
+ self.params[prop] = self.base_materials[0].params[prop]
+
+
def debug_print(self, indent=""):
print "%sHelperSolidSolution(%s):" % (indent, self.to_string())
@@ -58,19 +72,13 @@ class HelperSolidSolution(Mineral):
for mat in self.base_materials:
mat.method = self.method
mat.set_state(pressure, temperature)
+ Mineral.__init__(self)
- itrange = range(0, len(self.base_materials))
-
- self.params = {}
-
- # some do arithmetic averaging of the end members
- for prop in self.base_materials[0].params:
- try:
- self.params[prop] = sum([ self.base_materials[i].params[prop] * self.molar_fraction[i] for i in itrange ])
- except TypeError:
- #if there is a type error, it is probably a string. Just go with the value of the first base_material.
- self.params[prop] = self.base_materials[0].params[prop]
- Mineral.set_state(self, pressure, temperature)
+ def set_state(self, pressure, temperature):
+ for mat in self.base_materials:
+ mat.method = self.method
+ mat.set_state(pressure, temperature)
+ Mineral.set_state(self,pressure,temperature)
class HelperSpinTransition(Material):
"""
diff --git a/burnman/minerals/Matas_etal_2007.py b/burnman/minerals/Matas_etal_2007.py
index c497514..532ae7c 100644
--- a/burnman/minerals/Matas_etal_2007.py
+++ b/burnman/minerals/Matas_etal_2007.py
@@ -27,6 +27,7 @@ class mg_perovskite(Mineral):
'grueneisen_0': 1.48,
'q_0': 1.4}
+ Mineral.__init__(self)
class fe_perovskite(Mineral):
def __init__(self):
@@ -43,6 +44,7 @@ class fe_perovskite(Mineral):
'grueneisen_0': 1.48,
'q_0': 1.4}
+ Mineral.__init__(self)
class al_perovskite(Mineral):
def __init__(self):
@@ -60,6 +62,8 @@ class al_perovskite(Mineral):
'q_0': 1.4}
+ Mineral.__init__(self)
+
class ca_perovskite(Mineral):
def __init__(self):
self.params = {
@@ -75,6 +79,7 @@ class ca_perovskite(Mineral):
'grueneisen_0': 1.53,
'q_0': 1.6}
+ Mineral.__init__(self)
class periclase (Mineral):
def __init__(self):
@@ -91,6 +96,7 @@ class periclase (Mineral):
'grueneisen_0': 1.41,
'q_0': 1.3 }
+ Mineral.__init__(self)
class wuestite (Mineral):
def __init__(self):
@@ -107,6 +113,7 @@ class wuestite (Mineral):
'grueneisen_0': 1.41,
'q_0': 1.3 }
+ Mineral.__init__(self)
ca_bridgmanite = ca_perovskite
mg_bridgmanite = mg_perovskite
diff --git a/burnman/minerals/Murakami_2013.py b/burnman/minerals/Murakami_2013.py
index 98b1e59..8bd33fc 100644
--- a/burnman/minerals/Murakami_2013.py
+++ b/burnman/minerals/Murakami_2013.py
@@ -29,9 +29,13 @@ class periclase (Mineral):
'grueneisen_0': 1.5,
'q_0': 1.5,
'eta_s_0': 2.3 }
+ Mineral.__init__(self)
class wuestite (Mineral):
+ """
+ Murakami 2013 and references therein
+ """
def __init__(self):
self.params = {
'equation_of_state':'slb2',
@@ -47,6 +51,7 @@ class wuestite (Mineral):
'q_0': 1.5,
'eta_s_0': 0.8 }
+ Mineral.__init__(self)
class ferropericlase(bmb.HelperSolidSolution):
def __init__(self, fe_num):
@@ -78,6 +83,7 @@ class mg_perovskite(Mineral):
'q_0': 1.4,
'eta_s_0': 2.6 }
+ Mineral.__init__(self)
class fe_perovskite(Mineral):
def __init__(self):
@@ -95,6 +101,7 @@ class fe_perovskite(Mineral):
'q_0': 1.4,
'eta_s_0': 2.1 }
+ Mineral.__init__(self)
mg_bridgmanite = mg_perovskite
fe_bridgmanite = fe_perovskite
diff --git a/burnman/minerals/Murakami_etal_2012.py b/burnman/minerals/Murakami_etal_2012.py
index bf63f20..ed4e4be 100644
--- a/burnman/minerals/Murakami_etal_2012.py
+++ b/burnman/minerals/Murakami_etal_2012.py
@@ -31,6 +31,7 @@ class mg_perovskite(Mineral):
'q_0': 1.4,
'eta_s_0': 2.4 }
+ Mineral.__init__(self)
class mg_perovskite_3rdorder(Mineral):
def __init__(self):
@@ -48,6 +49,7 @@ class mg_perovskite_3rdorder(Mineral):
'q_0': 1.4,
'eta_s_0': 2.4 }
+ Mineral.__init__(self)
class fe_perovskite(Mineral):
def __init__(self):
@@ -65,6 +67,7 @@ class fe_perovskite(Mineral):
'q_0': 1.4,
'eta_s_0': 2.4 }
+ Mineral.__init__(self)
class mg_periclase(Mineral):
def __init__(self):
@@ -82,6 +85,7 @@ class mg_periclase(Mineral):
'q_0': 1.5, #S&L-B 2005
'eta_s_0': 3.0 }
+ Mineral.__init__(self)
class fe_periclase(bmb.HelperSpinTransition):
def __init__(self):
@@ -109,6 +113,7 @@ class fe_periclase_HS(Mineral): # From Murakami's emails, see Cayman for detail
'q_0': 1.5,
'eta_s_0': 2.54 }
+ Mineral.__init__(self)
class fe_periclase_LS(Mineral): # From Murakami's emails, see Cayman for details, represents Mg# = .79
def __init__(self):
@@ -126,8 +131,9 @@ class fe_periclase_LS(Mineral): # From Murakami's emails, see Cayman for detail
'q_0': 1.5,
'eta_s_0': 2.54}
+ Mineral.__init__(self)
-class fe_periclase_HS_3rd(Mineral): # personal communication, Mg#=92
+class fe_periclase_HS_3rd(Mineral):
def __init__(self):
self.params = {
'equation_of_state':'slb3',
@@ -143,8 +149,9 @@ class fe_periclase_HS_3rd(Mineral): # personal communication, Mg#=92
'q_0': 1.5,
'eta_s_0': 2.54 }
+ Mineral.__init__(self)
-class fe_periclase_LS_3rd(Mineral): # personal communication, Mg#=92
+class fe_periclase_LS_3rd(Mineral):
def __init__(self):
self.params = {
'equation_of_state':'slb3',
@@ -160,6 +167,9 @@ class fe_periclase_LS_3rd(Mineral): # personal communication, Mg#=92
'q_0': 1.5,
'eta_s_0': 2.54}
+ Mineral.__init__(self)
+
+
mg_bridgmanite = mg_perovskite
fe_bridgmanite = fe_perovskite
mg_bridgmanite_3rdorder = mg_perovskite_3rdorder
diff --git a/burnman/minerals/SLB_2005.py b/burnman/minerals/SLB_2005.py
index df7a44c..708f8c3 100644
--- a/burnman/minerals/SLB_2005.py
+++ b/burnman/minerals/SLB_2005.py
@@ -29,6 +29,7 @@ class stishovite (Mineral):
'q_0': 2.4,
'eta_s_0': 5.0 }
+ Mineral.__init__(self)
class periclase (Mineral):
def __init__(self):
@@ -45,7 +46,7 @@ class periclase (Mineral):
'grueneisen_0': 1.5,
'q_0': 1.5,
'eta_s_0': 2.8 }
-
+ Mineral.__init__(self)
class wuestite (Mineral):
def __init__(self):
@@ -63,6 +64,7 @@ class wuestite (Mineral):
'q_0': 1.5,
'eta_s_0': 0.8 }
+ Mineral.__init__(self)
class ferropericlase(bmb.HelperSolidSolution):
def __init__(self, fe_num):
@@ -94,6 +96,7 @@ class mg_perovskite(Mineral):
'q_0': 1.4,
'eta_s_0': 2.6 }
+ Mineral.__init__(self)
class fe_perovskite(Mineral):
def __init__(self):
@@ -111,6 +114,7 @@ class fe_perovskite(Mineral):
'q_0': 1.4,
'eta_s_0': 2.1 }
+ Mineral.__init__(self)
class mg_fe_perovskite_pt_dependent(bmb.HelperFeDependent):
def __init__(self, iron_number_with_pt, idx):
diff --git a/burnman/minerals/SLB_2011.py b/burnman/minerals/SLB_2011.py
index c5896b8..2f7ab5d 100644
--- a/burnman/minerals/SLB_2011.py
+++ b/burnman/minerals/SLB_2011.py
@@ -41,7 +41,7 @@ class stishovite (Mineral):
'err_q_0': 2.2,
'err_eta_s_0' : 1.0
}
-
+ Mineral.__init__(self)
class periclase (Mineral):
def __init__(self):
@@ -69,6 +69,7 @@ class periclase (Mineral):
'err_q_0':.2,
'err_eta_s_0':.2 }
+ Mineral.__init__(self)
class wuestite (Mineral):
def __init__(self):
@@ -96,6 +97,7 @@ class wuestite (Mineral):
'err_q_0':1.0,
'err_eta_s_0':1.0}
+ Mineral.__init__(self)
class ferropericlase(bmb.HelperSolidSolution):
def __init__(self, fe_num):
@@ -137,6 +139,7 @@ class mg_perovskite(Mineral):
'err_q_0': .3,
'err_eta_s_0':.3}
+ Mineral.__init__(self)
class fe_perovskite(Mineral):
def __init__(self):
@@ -164,6 +167,7 @@ class fe_perovskite(Mineral):
'err_q_0':1.0,
'err_eta_s_0':1.0}
+ Mineral.__init__(self)
class mg_fe_perovskite_pt_dependent(bmb.HelperFeDependent):
def __init__(self, iron_number_with_pt, idx):
diff --git a/burnman/minerals/SLB_2011_ZSB_2013.py b/burnman/minerals/SLB_2011_ZSB_2013.py
index f2ed8a5..2152b04 100644
--- a/burnman/minerals/SLB_2011_ZSB_2013.py
+++ b/burnman/minerals/SLB_2011_ZSB_2013.py
@@ -41,6 +41,7 @@ class stishovite (Mineral):
'err_eta_s_0' : 1.0
}
+ Mineral.__init__(self)
class periclase (Mineral):
def __init__(self):
@@ -68,6 +69,7 @@ class periclase (Mineral):
'err_q_0':.2,
'err_eta_s_0':.2 }
+ Mineral.__init__(self)
class wuestite (Mineral):
def __init__(self):
@@ -95,6 +97,8 @@ class wuestite (Mineral):
'err_q_0':1.0,
'err_eta_s_0':1.0}
+ Mineral.__init__(self)
+
class ferropericlase(bmb.HelperSolidSolution):
def __init__(self, fe_num):
@@ -136,6 +140,7 @@ class mg_perovskite(Mineral):
'err_q_0': .3,
'err_eta_s_0':.3}
+ Mineral.__init__(self)
class fe_perovskite(Mineral):
def __init__(self):
@@ -163,6 +168,8 @@ class fe_perovskite(Mineral):
'err_q_0':1.0,
'err_eta_s_0':1.0}
+ Mineral.__init__(self)
+
class mg_fe_perovskite_pt_dependent(bmb.HelperFeDependent):
def __init__(self, iron_number_with_pt, idx):
diff --git a/burnman/minerals/other.py b/burnman/minerals/other.py
index f01a5ce..c699120 100644
--- a/burnman/minerals/other.py
+++ b/burnman/minerals/other.py
@@ -23,7 +23,7 @@ class Speziale_fe_periclase_HS(Mineral):
Speziale et al. 2007, Mg#=83
"""
def __init__(self):
- self.params = {
+ self.params = {
'equation_of_state': 'mgd3',
'V_0': 22.9e-6,
'K_0': 157.5e9,
@@ -33,7 +33,7 @@ class Speziale_fe_periclase_HS(Mineral):
'Debye_0': 587,
'grueneisen_0': 1.46,
'q_0': 1.2 }
-
+ Mineral.__init__(self)
class Speziale_fe_periclase_LS(Mineral):
"""
@@ -50,7 +50,7 @@ class Speziale_fe_periclase_LS(Mineral):
'Debye_0': 587.,
'grueneisen_0': 1.46,
'q_0': 1.2 }
-
+ Mineral.__init__(self)
diff --git a/examples/example_averaging.py b/examples/example_averaging.py
index d3696a6..5bbb0f2 100644
--- a/examples/example_averaging.py
+++ b/examples/example_averaging.py
@@ -54,18 +54,14 @@ if __name__ == "__main__":
(your choice in geotherm will not matter in this case))"""
amount_perovskite = 0.6
- method = 'slb3'
rock = burnman.Composite([amount_perovskite, 1.0-amount_perovskite],
[minerals.SLB_2005.mg_perovskite(),
minerals.SLB_2005.periclase()])
- rock.set_method(method)
perovskitite = minerals.SLB_2005.mg_perovskite()
- perovskitite.set_method(method)
periclasite = minerals.SLB_2005.periclase()
- periclasite.set_method(method)
#seismic model for comparison:
# pick from .prem() .slow() .fast() (see burnman/seismic.py)
diff --git a/examples/example_beginner.py b/examples/example_beginner.py
index b543fab..451e7ec 100644
--- a/examples/example_beginner.py
+++ b/examples/example_beginner.py
@@ -56,6 +56,7 @@ if __name__ == "__main__":
# Here "rock" has two constituent minerals: it is 80% Mg perovskite
# and 20% periclase. More minerals may be added by simply extending
# the list given to burnman.composite
+ # For the preset minerals from the SLB_2011, the equation of state formulation from Stixrude and Lithgow-Bertolloni (2005) will be used.
rock = burnman.Composite([0.8, 0.2], [minerals.SLB_2011.mg_perovskite(),
minerals.SLB_2011.periclase()])
@@ -77,11 +78,6 @@ if __name__ == "__main__":
temperature = burnman.geotherm.brown_shankland(pressure)
- # At this point we want to tell the rock which equation of state to use for
- # its thermoelastic calculations. In general, we recommend the 'slb3'
- # equation of state as the most self-consistent model. The parameters from
- # the SLB_2011 mineral library are fit using this model.
- rock.set_method('slb3')
# Here is the step which does the heavy lifting. burnman.velocities_from_rock
# sets the state of the rock at each of the pressures and temperatures defined,
diff --git a/examples/example_compare_all_methods.py b/examples/example_compare_all_methods.py
index d927b14..6ebe9e3 100644
--- a/examples/example_compare_all_methods.py
+++ b/examples/example_compare_all_methods.py
@@ -46,7 +46,8 @@ if __name__ == "__main__":
#Input adiabat potential temperature
T0 = 1500.0
- #Now we'll calculate the models for each method
+ #Now we'll calculate the models by forcing the rock to use a method. The preset eqauation of state for the Murakami_etal_2012 minerals is 'slb2'
+
""" 'slb2' (finite-strain 2nd order shear modulus,
stixrude and lithgow-bertelloni, 2005)
or 'slb3 (finite-strain 3rd order shear modulus,
diff --git a/examples/example_compare_enstpyro.py b/examples/example_compare_enstpyro.py
index 4772f77..b5f9bae 100644
--- a/examples/example_compare_enstpyro.py
+++ b/examples/example_compare_enstpyro.py
@@ -35,21 +35,6 @@ from burnman import minerals
if __name__ == "__main__":
###Input Model 1
- #INPUT for method
- """ choose 'slb2' (finite-strain 2nd order shear modulus,
- stixrude and lithgow-bertelloni, 2005)
- or 'slb3 (finite-strain 3rd order shear modulus,
- stixrude and lithgow-bertelloni, 2005)
- or 'mgd3' (mie-gruneisen-debeye 3rd order shear modulus,
- matas et al. 2007)
- or 'mgd2' (mie-gruneisen-debeye 2nd order shear modulus,
- matas et al. 2007)
- or 'bm2' (birch-murnaghan 2nd order, if you choose to ignore temperature
- (your choice in geotherm will not matter in this case))
- or 'bm3' (birch-murnaghan 3rd order, if you choose to ignore temperature
- (your choice in geotherm will not matter in this case))"""
- method = 'slb3'
-
#Carbonaceous chondrites From Mcdonough 2003
weight_percents_pyro = {'Mg':0.228, 'Fe': 0.0626, 'Si':0.21, 'Ca':0., 'Al':0.}
@@ -97,7 +82,6 @@ if __name__ == "__main__":
#Now we'll calculate the models.
- pyrolite.set_method(method)
@@ -108,7 +92,6 @@ if __name__ == "__main__":
print "Calculations are done for:"
pyrolite.debug_print()
- enstatite.set_method(method)
mat_rho_enst, mat_vp_enst, mat_vs_enst, mat_vphi_enst, mat_K_enst, mat_G_enst = \
diff --git a/examples/example_composition.py b/examples/example_composition.py
index 1a39a28..21c052c 100644
--- a/examples/example_composition.py
+++ b/examples/example_composition.py
@@ -57,16 +57,6 @@ from burnman import minerals
if __name__ == "__main__":
-#INPUT for method
- """ choose 'slb2' (finite-strain 2nd order sheer modulus, stixrude and
- lithgow-bertelloni, 2005)
- or 'slb3 (finite-strain 3rd order shear modulus, stixrude and lithgow-bertelloni, 2005)
- or 'mgd3' (mie-gruneisen-debeye 3rd order shear modulus, matas et al. 2007)
- or 'mgd2' (mie-gruneisen-debeye 2nd order shearl modulus, matas et al. 2007)
- or 'bm' (birch-murnaghan, if you choose to ignore temperature
- (your choice in geotherm will not matter in this case))"""
-
- method = 'slb3'
# To compute seismic velocities and other properties, we need to supply
@@ -127,7 +117,6 @@ if __name__ == "__main__":
temperature = burnman.geotherm.brown_shankland(seis_p)
- rock.set_method(method)
print "Calculations are done for:"
rock.debug_print()
diff --git a/examples/example_geotherms.py b/examples/example_geotherms.py
index 84f492d..5b028ac 100644
--- a/examples/example_geotherms.py
+++ b/examples/example_geotherms.py
@@ -72,7 +72,6 @@ if __name__ == "__main__":
pyrolite = burnman.Composite([0.7, 0.3],
[minerals.SLB_2005.mg_fe_perovskite(0.1),
minerals.SLB_2005.ferropericlase(0.4)])
- pyrolite.set_method("mgd3")
#next, define an anchor temperature at which we are starting.
#Perhaps 1500 K for the upper mantle
T0 = 1500.
diff --git a/examples/example_grid.py b/examples/example_grid.py
index bb541db..453ca29 100644
--- a/examples/example_grid.py
+++ b/examples/example_grid.py
@@ -47,7 +47,6 @@ if __name__ == "__main__":
tarray=np.tile(T,len(p))
parray=np.repeat(p,len(T))
- rock.set_method('slb3')
density, vp, vs, vphi, K, G = burnman.velocities_from_rock(rock, parray, tarray)
diff --git a/examples/example_inv_murakami.py b/examples/example_inv_murakami.py
index 756431a..74de0cb 100644
--- a/examples/example_inv_murakami.py
+++ b/examples/example_inv_murakami.py
@@ -26,13 +26,11 @@ if __name__ == "__main__":
print "preparations done"
def calc_velocities(a,b,c):
- method = 'slb3' #slb3|slb2|mgd3|mgd2
amount_perovskite = a
rock = burnman.Composite([amount_perovskite, 1.0-amount_perovskite],
[minerals.SLB_2005.mg_fe_perovskite(b),
minerals.SLB_2005.ferropericlase(c)])
- rock.set_method(method)
mat_rho, mat_vp, mat_vs, mat_vphi, mat_K, mat_G = burnman.velocities_from_rock(rock,seis_p, temperature)
return mat_vp, mat_vs, mat_rho
diff --git a/examples/example_optimize_pv.py b/examples/example_optimize_pv.py
index 3034a0c..754c950 100644
--- a/examples/example_optimize_pv.py
+++ b/examples/example_optimize_pv.py
@@ -40,20 +40,6 @@ if __name__ == "__main__":
### input variables ###
#######################
- #INPUT for method
- """ choose 'slb2' (finite-strain 2nd order shear modulus,
- stixrude and lithgow-bertelloni, 2005)
- or 'slb3 (finite-strain 3rd order shear modulus,
- stixrude and lithgow-bertelloni, 2005)
- or 'mgd3' (mie-gruneisen-debeye 3rd order shear modulus,
- matas et al. 2007)
- or 'mgd2' (mie-gruneisen-debeye 2nd order shear modulus,
- matas et al. 2007)
- or 'bm2' (birch-murnaghan 2nd order, if you choose to ignore temperature
- (your choice in geotherm will not matter in this case))
- or 'bm3' (birch-murnaghan 3rd order, if you choose to ignore temperature
- (your choice in geotherm will not matter in this case))"""
- method = 'slb2'
seismic_model = burnman.seismic.PREM() # pick from .prem() .slow() .fast() (see burnman/seismic.py)
number_of_points = 20 #set on how many depth slices the computations should be done
@@ -67,7 +53,6 @@ if __name__ == "__main__":
[minerals.Murakami_etal_2012.fe_perovskite(),
minerals.Murakami_etal_2012.fe_periclase()])
- rock.set_method(method)
mat_rho, mat_vp, mat_vs, mat_vphi, mat_K, mat_G = \
burnman.velocities_from_rock(rock, seis_p, temperature, burnman.averaging_schemes.VoigtReussHill())
diff --git a/examples/example_partition_coef.py b/examples/example_partition_coef.py
index 3d13347..5d2105f 100644
--- a/examples/example_partition_coef.py
+++ b/examples/example_partition_coef.py
@@ -39,20 +39,6 @@ from burnman import minerals
if __name__ == "__main__":
-#INPUT for method
- """ choose 'slb2' (finite-strain 2nd order shear modulus,
- stixrude and lithgow-bertelloni, 2005)
- or 'slb3 (finite-strain 3rd order shear modulus,
- stixrude and lithgow-bertelloni, 2005)
- or 'mgd3' (mie-gruneisen-debeye 3rd order shear modulus,
- matas et al. 2007)
- or 'mgd2' (mie-gruneisen-debeye 2nd order shear modulus,
- matas et al. 2007)
- or 'bm2' (birch-murnaghan 2nd order, if you choose to ignore temperature
- (your choice in geotherm will not matter in this case))
- or 'bm3' (birch-murnaghan 3rd order, if you choose to ignore temperature
- (your choice in geotherm will not matter in this case))"""
- method = 'slb3'
@@ -93,7 +79,6 @@ if __name__ == "__main__":
part_coef_fp[t],part_coef_pv[t] = burnman.calculate_partition_coefficient \
(seis_p[t],temperature[t],relative_molar_percent,Kd_0)
- rock.set_method(method)
mat_rho, mat_vp, mat_vs, mat_vphi, mat_K, mat_G = \
burnman.velocities_from_rock(rock, seis_p, temperature, \
diff --git a/examples/example_premite_isothermal.py b/examples/example_premite_isothermal.py
index 7a9f612..195fe4a 100644
--- a/examples/example_premite_isothermal.py
+++ b/examples/example_premite_isothermal.py
@@ -39,7 +39,6 @@ def calc_velocities(ref_rho, K_0, K_prime, G_0, G_prime):
rock.params['G_0'] = G_0
rock.params['Gprime_0'] = G_prime
- rock.set_method('bm3')
temperature = np.empty_like(seis_p)
mat_rho, mat_vp, mat_vs, mat_vphi, mat_K, mat_G = burnman.velocities_from_rock(rock,seis_p, temperature)
diff --git a/examples/example_spintransition.py b/examples/example_spintransition.py
index 13a9f1c..61ec18c 100644
--- a/examples/example_spintransition.py
+++ b/examples/example_spintransition.py
@@ -62,9 +62,6 @@ if __name__ == "__main__":
#
# Note the reference to the low spin and high spin minerals (_LS and _HS).
- # Set method, here set to 'slb2' as the shear wave moduli in
- # Murakami et al. 2012 were fit to second order
- rock.set_method('slb2')
# Now we calculate the velocities
mat_rho, mat_vp, mat_vs, mat_vphi, mat_K, mat_G = \
@@ -89,21 +86,18 @@ if __name__ == "__main__":
# example 2: Here we show the effects of using purely High Spin or Low Spin
rock = minerals.Murakami_etal_2012.fe_periclase_LS()
- rock.set_method('slb2')
mat_rho_LS, mat_vp_LS, mat_vs_LS, mat_vphi_LS, _, _ = \
burnman.velocities_from_rock(rock, seis_p, temperature, \
burnman.averaging_schemes.VoigtReussHill())
rock = minerals.Murakami_etal_2012.fe_periclase_HS()
- rock.set_method('slb2')
mat_rho_HS, mat_vp_HS, mat_vs_HS, mat_vphi_HS, _, _ = \
burnman.velocities_from_rock(rock, seis_p, temperature, \
burnman.averaging_schemes.VoigtReussHill())
rock = minerals.Murakami_etal_2012.fe_periclase()
- rock.set_method('slb2')
mat_rho_ON, mat_vp_ON, mat_vs_ON, mat_vphi_ON, _, _ = \
burnman.velocities_from_rock(rock, seis_p, temperature, \
burnman.averaging_schemes.VoigtReussHill())
@@ -126,7 +120,6 @@ if __name__ == "__main__":
#For other options see example_composition.py
rock = minerals.other.Speziale_fe_periclase()
- rock.set_method('slb3')
mat_rho, mat_vp, mat_vs, mat_vphi, mat_K, mat_G = \
burnman.velocities_from_rock(rock, seis_p, temperature, \
diff --git a/examples/example_user_input_material.py b/examples/example_user_input_material.py
index a5c94b7..005ce94 100644
--- a/examples/example_user_input_material.py
+++ b/examples/example_user_input_material.py
@@ -60,7 +60,6 @@ if __name__ == "__main__":
#in form name_of_mineral (burnman.mineral <- creates list with parameters)
class own_material (burnman.Mineral):
def __init__(self):
- burnman.Mineral.__init__(self)
self.params = {
'V_0': 10.844e-6, #Molar volume [m^3/(mole molecules)]
#at room pressure/temperature
@@ -81,7 +80,7 @@ if __name__ == "__main__":
'eta_s_0': 3.0 #full strain derivative of gruneisen parameter
#parameter. Values in Stixrude & Lithgow-Bertelloni, 2005
}
-
+ burnman.Mineral.__init__(self)
rock = own_material()
diff --git a/examples/example_woutput.py b/examples/example_woutput.py
index 12bd1ce..6e3aea3 100644
--- a/examples/example_woutput.py
+++ b/examples/example_woutput.py
@@ -40,20 +40,6 @@ if __name__ == "__main__":
### input variables ###
#######################
- #INPUT for method
- """ choose 'slb2' (finite-strain 2nd order shear modulus,
- stixrude and lithgow-bertelloni, 2005)
- or 'slb3 (finite-strain 3rd order shear modulus,
- stixrude and lithgow-bertelloni, 2005)
- or 'mgd3' (mie-gruneisen-debeye 3rd order shear modulus,
- matas et al. 2007)
- or 'mgd2' (mie-gruneisen-debeye 2nd order shear modulus,
- matas et al. 2007)
- or 'bm2' (birch-murnaghan 2nd order, if you choose to ignore temperature
- (your choice in geotherm will not matter in this case))
- or 'bm3' (birch-murnaghan 3rd order, if you choose to ignore temperature
- (your choice in geotherm will not matter in this case))"""
- method = 'mgd3'
#specify material
amount_perovskite = 0.95
@@ -66,7 +52,6 @@ if __name__ == "__main__":
temperature = burnman.geotherm.brown_shankland(pressures)
- rock.set_method(method) #append method of calculation to suite of minerals chosen
#Begin calculating velocities and density as depth
print "Calculations are done for:"
More information about the CIG-COMMITS
mailing list