コード例 #1
0
    
    #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")
コード例 #2
0
ファイル: table.py プロジェクト: tjhei/burnman_old
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__ ]
        for param in params: