Skip to content

Commit

Permalink
added isochemical consistency check
Browse files Browse the repository at this point in the history
  • Loading branch information
bobmyhill committed Mar 1, 2024
1 parent 64890b2 commit 9ecde6f
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/test_solidsolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from burnman.minerals.SLB_2011 import mg_post_perovskite
from burnman.minerals.SLB_2011 import fe_post_perovskite
from burnman.minerals.SLB_2011 import al_post_perovskite

from burnman.tools.eos import check_eos_consistency

class forsterite(Mineral):
def __init__(self):
Expand Down Expand Up @@ -399,6 +399,22 @@ def __init__(self, molar_fractions=None):
burnman.SolidSolution.__init__(self, molar_fractions)


class polynomial_esv_and_mbr_mixing_2(burnman.SolidSolution):
def __init__(self, molar_fractions=None):
self.name = "two_site_ss (subregular symmetric)"
self.solution_model = PolynomialSolution(
endmembers=[
[forsterite(), "[Mg]2"],
[fayalite(), "[Mg]2"],
],
ESV_interactions=[[600.0, 2.5, 0.5e-6, 0, 1, 1, 1]],
interaction_endmembers=[fayalite(), fo1],
endmember_coefficients_and_interactions=[[1.0, -1.0, 0, 1, 1, 1]],
)

burnman.SolidSolution.__init__(self, molar_fractions)


# Temkin solution
class temkin_ss(burnman.SolidSolution):
def __init__(self, molar_fractions=None):
Expand Down Expand Up @@ -928,6 +944,11 @@ def test_polynomial_using_subregular_volume(self):
self.assertArraysAlmostEqual(ss1.partial_entropies, ss2.partial_entropies)
self.assertArraysAlmostEqual(ss1.partial_volumes, ss2.partial_volumes)

def test_polynomial_consistency(self):
ss = polynomial_esv_and_mbr_mixing_2()
ss.set_composition([0.4, 0.6])
self.assertTrue(check_eos_consistency(ss))

def test_polynomial_mbr_mixing(self):
ss1 = polynomial_mbr_mixing()
ss2 = regular_copy_polynomial_mbr_mixing()
Expand Down

0 comments on commit 9ecde6f

Please sign in to comment.