[cig-commits] [commit] master: fix examples (1723bba)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Thu Dec 11 12:20:03 PST 2014
Repository : https://github.com/geodynamics/burnman
On branch : master
Link : https://github.com/geodynamics/burnman/compare/c5ec36a308413012ee5b0763ccb541c2ad56f382...bc315ff9a2ed1d4871962882f0626468342f1ffc
>---------------------------------------------------------------
commit 1723bba3f981481871ddda8c98d31470b0e0e871
Author: sannecottaar <sanne.cottaar at gmail.com>
Date: Wed Dec 10 11:29:37 2014 -0800
fix examples
>---------------------------------------------------------------
1723bba3f981481871ddda8c98d31470b0e0e871
burnman/mineral.py | 4 +++-
burnman/mineral_helpers.py | 2 +-
misc/paper_averaging.py | 4 ----
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/burnman/mineral.py b/burnman/mineral.py
index 5fde123..860fc96 100644
--- a/burnman/mineral.py
+++ b/burnman/mineral.py
@@ -44,7 +44,6 @@ class Mineral(Material):
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):
@@ -108,6 +107,9 @@ class Mineral(Material):
self.temperature = temperature
self.old_params = self.params
+ if self.method==None:
+ raise AttributeError, "no method set for mineral, or equation_of_state given in mineral.params"
+
self.V = self.method.volume(self.pressure, self.temperature, self.params)
self.gr = self.method.grueneisen_parameter(self.pressure, self.temperature, self.V, self.params)
self.K_T = self.method.isothermal_bulk_modulus(self.pressure, self.temperature, self.V, self.params)
diff --git a/burnman/mineral_helpers.py b/burnman/mineral_helpers.py
index 16fe49a..94d5a4f 100644
--- a/burnman/mineral_helpers.py
+++ b/burnman/mineral_helpers.py
@@ -45,7 +45,6 @@ class HelperSolidSolution(Mineral):
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
@@ -97,6 +96,7 @@ class HelperSpinTransition(Material):
self.ls_mat = ls_mat
self.hs_mat = hs_mat
self.active_mat = None
+ self.method=ls_mat.method
def debug_print(self, indent=""):
print "%sHelperSpinTransition:" % indent
diff --git a/misc/paper_averaging.py b/misc/paper_averaging.py
index d9c9f6d..07701af 100644
--- a/misc/paper_averaging.py
+++ b/misc/paper_averaging.py
@@ -58,17 +58,13 @@ if __name__ == "__main__":
(your choice in geotherm will not matter in this case))"""
amount_perovskite = 0.6
- method = 'slb3'
rock = burnman.Composite( [ (minerals.SLB_2011.mg_perovskite(), amount_perovskite),
(minerals.SLB_2011.wuestite(), 1.0-amount_perovskite) ] )
- rock.set_method(method)
perovskitite = burnman.Composite( [ (minerals.SLB_2011.mg_perovskite(), 1.0), ] )
- perovskitite.set_method(method)
periclasite = burnman.Composite( [ (minerals.SLB_2011.wuestite(), 1.0), ] )
- periclasite.set_method(method)
#seismic model for comparison:
# pick from .prem() .slow() .fast() (see burnman/seismic.py)
More information about the CIG-COMMITS
mailing list