import os, sys, numpy as np, matplotlib.pyplot as plt #hack to allow scripts to be placed in subdirectories next to burnman: if not os.path.exists('burnman') and os.path.exists('../burnman'): sys.path.insert(1,os.path.abspath('..')) import burnman from burnman import minerals from burnman import tools if __name__ == "__main__": phases = [minerals.stishovite(), \ minerals.periclase(), \ minerals.wustite(), \ minerals.ferropericlase(0), \ minerals.mg_fe_perovskite(0), \ minerals.mg_perovskite(), \ minerals.fe_perovskite(), \ minerals.Catalli_fe_perovskite("on"), \ minerals.Murakami_fe_perovskite(), \ minerals.Murakami_fe_periclase("on")] #minerals.Speziale_fe_periclase("on"), \ #mg_fe_perovskite_pt_dependent #ferropericlase_pt_dependent params = ['ref_V','ref_K','K_prime','ref_mu','mu_prime','molar_mass','n','ref_Debye','ref_grueneisen','q0','eta_0s'] def create_list(mineral,paramname): row = [ p.__class__.__name__ ]
#what about a geotherm defined from datapoints given in a file (our inline)? table = [[1e9,1600],[30e9,1700],[130e9,2700]] #this could also be loaded from a file, just uncomment this #table = tools.read_table("data/example_geotherm.txt") table_pressure = np.array(table)[:,0] table_temperature = np.array(table)[:,1] my_geotherm = lambda p: burnman.tools.lookup_and_interpolate(table_pressure, table_temperature, p) temperature4 = [my_geotherm(p) for p in pressures] #finally, we can also calculate a self consistent geotherm for an assemblage of minerals #based on self compression of the composite rock. First we need to define an assemblage phases = [minerals.mg_fe_perovskite(0.1), minerals.ferropericlase(0.4)] for ph in phases: ph.set_method("mgd") molar_abundances = [0.7, 0.3] #next, define an anchor temperature at which we are starting. Perhaps 1500 K for the upper mantle T0 = 1500. #then generate temperature values using the self consistent function. This takes more time than the above methods temperature5 = burnman.geotherm.self_consistent(pressures, T0, phases, molar_abundances) #you can also look at burnman/geotherm.py to see how the geotherms are implemented plt.plot(pressures/1e9,temperature1,'-r',label="Brown, Shankland") plt.plot(pressures/1e9,temperature2,'-g',label="Watson, Baxter") plt.plot(pressures/1e9,temperature3,'-b',label="handwritten linear") plt.plot(pressures/1e9,temperature4,'-k',label="handwritten from table")
# To compute seismic velocities and other properties, we need to supply # burnman with a list of minerals (phaes) and their molar abundances. Minerals # are classes found in burnman.minerals and are derived from # burnman.minerals.material. # Here are a few ways to define phases and molar_abundances: #Example 1: two simple fixed minerals if True: phases = [minerals.Murakami_fe_perovskite(), minerals.Murakami_fe_periclase_LS()] amount_perovskite = 0.95 molar_abundances = [amount_perovskite, 1.0-amount_perovskite] #Example 2: specify fixed iron content if False: phases = [minerals.mg_fe_perovskite(0.8), minerals.ferropericlase(0.8)] amount_perovskite = 0.95 molar_abundances = [amount_perovskite, 1.0-amount_perovskite] #Example 3: input weight percentages #See comments in burnman/composition.py for references to partition coefficent calculation if False: weight_percents = {'Mg':0.213, 'Fe': 0.08, 'Si':0.27, 'Ca':0., 'Al':0.} 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) phases = [minerals.mg_fe_perovskite_pt_dependent(iron_content,0), \ minerals.ferropericlase_pt_dependent(iron_content,1)] molar_abundances = [phase_fractions['pv'],phase_fractions['fp']] #Example 4: three materials if False: