[cig-commits] [commit] master: add tests (d9daef5)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Fri Dec 19 07:41:50 PST 2014
Repository : https://github.com/geodynamics/burnman
On branch : master
Link : https://github.com/geodynamics/burnman/compare/a84740600d8235a03743adbcc32c83d3305d8785...4d93dd51f8af08989195fbc04c7df47185fea2fc
>---------------------------------------------------------------
commit d9daef52e56b753ec7a099fe5f9bbd3701aceb33
Author: Timo Heister <timo.heister at gmail.com>
Date: Sun Dec 14 21:16:48 2014 -0800
add tests
>---------------------------------------------------------------
d9daef52e56b753ec7a099fe5f9bbd3701aceb33
tests/test_spin.py | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/tests/test_spin.py b/tests/test_spin.py
index caa0824..567e3f2 100644
--- a/tests/test_spin.py
+++ b/tests/test_spin.py
@@ -31,6 +31,49 @@ class spin_transition(BurnManTest):
f,c = mins[0].unroll()
self.assertFloatEqual(c[0].v_s(), mins[2].v_s())
+ def test_no_set_state(self):
+ m = minerals.Murakami_etal_2012.fe_periclase()
+ m.set_state(5e9, 300)
+ self.assertIsInstance(m.unroll()[1][0], minerals.Murakami_etal_2012.fe_periclase_HS)
+ m.set_state(70e9, 300)
+ self.assertIsInstance(m.unroll()[1][0], minerals.Murakami_etal_2012.fe_periclase_LS)
+
+
+class TestHelperSolidSolution(BurnManTest):
+ def test1(self):
+ m = minerals.other.ferropericlase(0.1)
+ m.set_state(5e9, 300)
+ self.assertFloatEqual(m.v_s(), 5821.42007777)
+ m = minerals.other.ferropericlase(0.7)
+ m.set_state(5e9, 300)
+ self.assertFloatEqual(m.v_s(), 4061.92139873)
+
+
+class TestHelperFEdep(BurnManTest):
+ def test(self):
+ weight_percents = {'Mg':0.213, 'Fe': 0.08, 'Si':0.27, 'Ca':0., 'Al':0.}
+ Kd_0 = .59 #Fig 5 Nakajima et al 2012
+
+ phase_fractions, relative_molar_percent = burnman. \
+ calculate_phase_percents(weight_percents)
+ iron_content = lambda p,t: burnman.calculate_partition_coefficient \
+ (p,t,relative_molar_percent,Kd_0)
+
+ rock = burnman.Composite([phase_fractions['pv'], phase_fractions['fp']],
+ [minerals.SLB_2005.mg_fe_perovskite_pt_dependent(iron_content,0),
+ minerals.SLB_2005.ferropericlase_pt_dependent(iron_content,1)])
+ rock.set_state(5e9, 300)
+ fractions, mins = rock.unroll()
+ self.assertArraysAlmostEqual(fractions, [0.9428714062806316, 0.057128593719368403])
+ self.assertIsInstance(mins[0], minerals.SLB_2005.mg_fe_perovskite)
+ self.assertIsInstance(mins[1], minerals.SLB_2005.ferropericlase)
+ self.assertFloatEqual(mins[0].molar_mass(), 0.101752790682)
+
+ rock.set_state(7e9, 700)
+ fractions, mins = rock.unroll()
+ self.assertFloatEqual(mins[0].molar_mass(), 0.104161162508)
+
+
if __name__ == '__main__':
unittest.main()
More information about the CIG-COMMITS
mailing list