* :func:`burnman.equilibrate` ''' from __future__ import absolute_import from __future__ import print_function import numpy as np import matplotlib.pyplot as plt import burnman from burnman import equilibrate from burnman.minerals import SLB_2011 if __name__ == "__main__": # Initialize the minerals we will use in this example. ol = SLB_2011.mg_fe_olivine() wad = SLB_2011.mg_fe_wadsleyite() rw = SLB_2011.mg_fe_ringwoodite() # Set the starting guess compositions for each of the solutions ol.set_composition([0.90, 0.10]) wad.set_composition([0.90, 0.10]) rw.set_composition([0.80, 0.20]) # Initialize the figure that will be used to plot the binary diagram fig = plt.figure() ax = [fig.add_subplot(1, 1, 1)] # Loop over three temperatures for T, color in [(1200., 'blue'), (1600., 'purple'), (2000., 'red')]:
import os.path import sys sys.path.insert(1, os.path.abspath('../..')) import burnman from burnman.minerals import SLB_2011 from burnman.minerals import HP_2011_ds62 from burnman import constants import numpy as np def p(v1, v2): return (v2 - v1) / v1 # filemin = [['SLB2011', '../../burnman/data/input_perplex/fo_SLB2011_params.dat', SLB_2011.fo()], [ 'HP2011', '../../burnman/data/input_perplex/fo_HP2011_params.dat', HP_2011_ds62.fo()]] for database, f, mineral in filemin: f = open(f, 'r') datalines = [line.strip() for idx, line in enumerate(f.read().split('\n')) if line.strip() and idx > 0] data = [list(map(float, "%".join(line.split("%")[:1]).split())) for line in datalines] P, T, H, S, V, C_p, alpha, beta, rho = list(zip(*data)) variables = ['G', 'H', 'S', 'V', 'C_p', 'alpha', 'K_T', 'rho'] fo = mineral percentage_diff = [] PT = []
import burnman from burnman import equilibrate from burnman.minerals import HP_2011_ds62, SLB_2011, JH_2015 from burnman.tools.polytope import simplify_composite_with_composition run_aluminosilicates = True run_ordering = True run_gt_solvus = True run_fper_ol = True run_fixed_ol_composition = True run_upper_mantle = True run_lower_mantle = True run_olivine_polymorphs = True gt = SLB_2011.garnet() ol = SLB_2011.mg_fe_olivine() wad = SLB_2011.mg_fe_wadsleyite() rw = SLB_2011.mg_fe_ringwoodite() bdg = SLB_2011.mg_fe_bridgmanite() ppv = SLB_2011.post_perovskite() fper = SLB_2011.ferropericlase() opx = SLB_2011.orthopyroxene() stv = SLB_2011.stishovite() coe = SLB_2011.coesite() cpv = SLB_2011.ca_perovskite() if __name__ == "__main__" and run_aluminosilicates: """ Creates the classic aluminosilicate diagram involving univariate reactions between andalusite, sillimanite and kyanite.
import burnman from burnman.minerals import SLB_2011 from burnman.minerals import HP_2011_ds62 from burnman import constants import numpy as np def p(v1, v2): return (v2 - v1) / v1 # filemin = [[ 'SLB2011', '../../burnman/data/input_perplex/fo_SLB2011_params.dat', SLB_2011.fo() ], [ 'HP2011', '../../burnman/data/input_perplex/fo_HP2011_params.dat', HP_2011_ds62.fo() ]] for database, f, mineral in filemin: f = open(f, 'r') datalines = [ line.strip() for idx, line in enumerate(f.read().split('\n')) if line.strip() and idx > 0 ] data = [ list(map(float, "%".join(line.split("%")[:1]).split()))
import os.path, sys sys.path.insert(1,os.path.abspath('../..')) import burnman from burnman.minerals import SLB_2011 from burnman.minerals import HP_2011_ds62 from burnman.minerals import Sundman_1991 from burnman import constants import numpy as np def p(v1, v2): return (v2-v1)/v1 ### filemin=[['SLB2011', '../../burnman/data/input_perplex/fo_SLB2011_params.dat', SLB_2011.fo()],['HP2011', '../../burnman/data/input_perplex/fo_HP2011_params.dat', HP_2011_ds62.fo()]] for database, f, mineral in filemin: f = open(f, 'r') datalines = [ line.strip() for idx, line in enumerate(f.read().split('\n')) if line.strip() and idx>0 ] data = [ list(map(float,"%".join(line.split("%")[:1]).split())) for line in datalines ] P, T, H, S, V, C_p, alpha, beta, rho = list(zip(*data)) variables=['H','S','V','C_p','alpha','beta','rho'] fo = mineral percentage_diff=[] PT=[] print('Benchmarks for', database, 'database with method', fo.params['equation_of_state']) print(variables)
from burnman import AnisotropicMineral from burnman.minerals import SLB_2011 from burnman.tools.eos import check_anisotropic_eos_consistency from burnman.tools.plot import plot_projected_elastic_properties if __name__ == "__main__": # Let's create a first approximation to an olivine mineral. # Olivine is orthorhombic. # BurnMan has an AnisotropicMineral class, which requires as input: # 1) An isotropic mineral (from which it gets the V-P-T relations) # 2) A standard state cell parameters vector # 3) A 4D numpy array containing constants describing the # anisotropic tensor state function. fo = SLB_2011.forsterite() cell_lengths = np.array([4.7646, 10.2296, 5.9942]) cell_lengths *= np.cbrt(fo.params['V_0'] / np.prod(cell_lengths)) cell_parameters = np.array( [cell_lengths[0], cell_lengths[1], cell_lengths[2], 90, 90, 90]) # The constants function is given as an expansion in ln(V/V0) and # thermal pressure (see paper). Here we are only interested in a single # 6x6 block with indexing constants[:, :, 1, 0], which corresponds to # S_{Tpq} / beta_RT, where S_{Tpq} is the isothermal compliance tensor # in Voigt form (values in the off-diagonal blocks and lower diagonal block # are multiplied by factors of 2 and 4 respectively, and beta_RT is # the Reuss isothermal compressibility, # both measured at the reference state. # This block is the most important; the other blocks are pressure and
'G_0': 81599990000.0, 'Gprime_0': 1.46257, 'eta_s_0': 2.29972, 'n': sum(forsterite_formula.values()), 'molar_mass': formula_mass(forsterite_formula)} forsterite = burnman.Mineral(params=forsterite_params) """ BurnMan also contains the Stixrude and Lithgow-Bertelloni (2011) dataset, so we can also create an object corresponding to this mineral directly. """ forsterite = SLB_2011.forsterite() """ In petrology, we are often interested in phases for which we have little experimental or theoretical information. One common example is when we want to approximate the properties of an ordered phase relative to its disordered counterparts. In many cases, a reasonable procedure is to make a mechanical mixture of the known phases, such that they are the correct composition of the unknown phase, and then apply a linear correction to the Gibbs energy of the phase (i.e. Delta G = Delta E - T Delta S + P Delta V). In BurnMan, we do this using the CombinedMineral class. In the lines below, we create an ordered orthopyroxene with composition MgFeSi2O6 from a 50:50 mixture of enstatite and ferrosilite. We make this compound 6 kJ/mol more stable than the mechanical mixture. """
print('Formulae corresponding to these independent endmember ' 'occupancies:') print( site_occupancies_to_strings([['Mg', 'Al', 'Si'], ['Mg', 'Al', 'Si']], [1, 1], ind_occupancies)) print('The complete set of endmembers expressed as proportions of the ' 'independent endmember set:') print(py_maj_poly.endmembers_as_independent_endmember_amounts) print('\nWe can also create a polytope using the site-species occupancies ' 'of a set of independent endmembers of a solution. ' 'Here we do this for the garnet solid solution provided in the ' 'Stixrude and Lithgow-Bertelloni database.') gt = SLB_2011.garnet() print('Endmember compositions:') for f in gt.endmember_formulae: print(formula_to_string(f)) gt_poly = solution_polytope_from_endmember_occupancies( gt.solution_model.endmember_occupancies, return_fractions=True) assert np.all( np.abs(gt.solution_model.endmember_occupancies - gt_poly.independent_endmember_occupancies) < 1.e-5) print('Endmembers as independent endmember amounts:') print(gt_poly.endmembers_as_independent_endmember_amounts)