def check_mgd_shim_duffy_kenichi(): """ Attemmpts to recreate Shim Duffy Kenichi (2002) """ plt.close() #Create gold material from Table 1 gold = burnman.material() gold.params = { 'name': 'gold', 'V_0': 10.22e-6, 'K_0': 167.0e9, 'Kprime_0': 5.0, 'molar_mass': .196966, 'n': 1.0, 'Debye_0': 170., 'grueneisen_0': 2.97, #this does better with gr = 2.93. Why? 'q_0': 1.0 } gold.set_method('mgd3') #Total pressures, pulled from Table 2 ref_pressures = [ np.array([ 0., 3.55, 7.55, 12.06, 17.16, 22.91, 29.42, 36.77, 45.11, 54.56, 65.29, 77.50, 91.42, 107.32, 125.51, 146.38, 170.38, 198.07 ]) ] ref_pressures.append( np.array([ 4.99, 8.53, 12.53, 17.04, 22.13, 27.88, 34.38, 41.73, 50.06, 59.50, 70.22, 82.43, 96.33, 112.22, 130.40, 151.25, 175.24, 202.90 ])) ref_pressures.append( np.array([ 12.14, 15.69, 19.68, 24.19, 29.28, 35.03, 41.53, 48.88, 57.20, 66.64, 77.37, 89.57, 103.47, 119.35, 137.53, 158.38, 182.36, 210.02 ])) ref_pressures.append( np.array([ 19.30, 22.84, 26.84, 31.35, 36.44, 42.19, 48.68, 56.03, 64.35, 73.80, 84.52, 96.72, 110.62, 126.50, 144.68, 165.53, 189.51, 217.17 ])) eos = mgd.mgd3() pressures = np.empty_like(ref_pressures) ref_dv = np.linspace(0.0, 0.34, len(pressures[0])) ref_volumes = (1 - ref_dv) * gold.params['V_0'] T = np.array([300., 1000., 2000., 3000.]) for t in range(len(pressures)): for i in range(len(pressures[t])): pressures[t][i] = eos.pressure(T[t], ref_volumes[i], gold.params) plt.plot(ref_dv, (pressures[t] / 1.e9 - ref_pressures[t])) plt.ylim(-1, 1) plt.ylabel("Difference in pressure (GPa)") plt.xlabel("1-dV/V") plt.title("Comparing with Shim, Duffy, and Kenichi (2002)") plt.show()
def check_mgd_fei_mao_shu_hu(): """ Benchmark agains Fei Mao Shu Hu (1991) """ mgfeo = burnman.material() mgfeo.params = { 'name': 'MgFeO', 'V_0': 11.657e-6, 'K_0': 157.0e9, 'Kprime_0': 4.0, 'molar_mass': .196966, 'n': 2.0, 'Debye_0': 500., 'grueneisen_0': 1.50, 'q_0': 1.1 } mgfeo.set_method('mgd3') #pulled from table 1 temperatures = np.array([ 300, 300, 483, 483, 483, 590, 593, 593, 593, 700, 600, 500, 650, 600, 600, 650, 700, 737, 727, 673, 600, 543, 565, 585, 600, 628, 654, 745, 768, 747, 726, 700, 676 ]) volumes = np.array([ 77.418, 72.327, 74.427, 73.655, 72.595, 74.1, 73.834, 73.101, 70.845, 73.024, 72.630, 68.644, 72.969, 72.324, 71.857, 72.128, 73.283, 73.337, 72.963, 71.969, 69.894, 67.430, 67.607, 67.737, 68.204, 68.518, 68.955, 70.777, 72.921, 72.476, 72.152, 71.858, 71.473 ]) #change from cubic angstroms per unit cell to cubic meters per mol of molecules. volumes = volumes / 1.e30 * 6.022141e23 / 4.0 ref_pressures = np.array([ 0.0, 12.23, 7.77, 9.69, 12.54, 9.21, 9.90, 11.83, 18.35, 12.68, 13.15, 25.16, 12.53, 14.01, 15.34, 14.86, 11.99, 12.08, 13.03, 15.46, 21.44, 29.98, 29.41, 29.05, 27.36, 26.38, 24.97, 19.49, 13.39, 14.48, 15.27, 15.95, 16.94 ]) ref_pressures = ref_pressures pressures = np.empty_like(volumes) eos = mgd.mgd3() for i in range(len(temperatures)): pressures[i] = eos.pressure(temperatures[i], volumes[i], mgfeo.params) plt.scatter(temperatures, (pressures / 1.e9 - ref_pressures)) plt.ylim(-1, 1) plt.title("Comparing with Fei, Mao, Shu, and Hu (1991)") plt.xlabel("Temperature (K) at various volumes") plt.ylabel("Difference in total pressure (GPa)") plt.show()
def check_birch_murnaghan(): """ Recreates Stixrude and Lithgow-Bertelloni (2005) Figure 1, bulk and shear modulus without thermal corrections """ plt.close() #make a test mineral test_mineral = burnman.material() test_mineral.params = { 'name': 'test', 'V_0': 6.844e-6, 'K_0': 259.0e9, 'Kprime_0': 4.0, 'G_0': 175.0e9, 'Gprime_0': 1.7, 'molar_mass': .0, 'n': 0., 'Debye_0': 0., 'grueneisen_0': 0., 'q_0': 0. } pressure = np.linspace(0., 140.e9, 100) volume = np.empty_like(pressure) bulk_modulus = np.empty_like(pressure) shear_modulus = np.empty_like(pressure) #calculate its static properties for i in range(len(pressure)): volume[i] = bm.volume(pressure[i], test_mineral.params) bulk_modulus[i] = bm.bulk_modulus(volume[i], test_mineral.params) shear_modulus[i] = bm.shear_modulus_third_order( volume[i], test_mineral.params ) #third order is used for the plot we are comparing against #compare with figure 1 plt.plot(pressure / 1.e9, bulk_modulus / 1.e9, pressure / 1.e9, shear_modulus / 1.e9) fig1 = mpimg.imread('input_figures/slb_fig1.png') plt.imshow(fig1, extent=[0, 140, 0, 800], aspect='auto') plt.plot(pressure / 1.e9, bulk_modulus / 1.e9, 'g+', pressure / 1.e9, shear_modulus / 1.e9, 'g+') plt.ylim(0, 800) plt.xlim(0, 140) plt.xlabel("Pressure (GPa)") plt.ylabel("Modulus (GPa)") plt.title( "Comparing with Figure 1 of Stixrude and Lithgow-Bertelloni (2005)") plt.show()
def check_slb_fig3(): """ Benchmark grueneisen parameter against figure 3 of Stixrude and Lithgow-Bertelloni (2005b) """ perovskite = burnman.material() perovskite.params = { 'name': 'perovksite', 'V_0': burnman.tools.molar_volume_from_unit_cell_volume(168.27, 4.), 'grueneisen_0': 1.63, 'q_0': 1.7 } volume = np.linspace(0.6, 1.0, 100) grueneisen_slb = np.empty_like(volume) grueneisen_mgd = np.empty_like(volume) q_slb = np.empty_like(volume) q_mgd = np.empty_like(volume) slb_eos = slb.slb2() mgd_eos = mgd.mgd2() #calculate its thermal properties for i in range(len(volume)): #call with dummy pressure and temperatures, they do not change it grueneisen_slb[i] = slb_eos.grueneisen_parameter( 0., 0., volume[i] * perovskite.params['V_0'], perovskite.params) grueneisen_mgd[i] = mgd_eos.grueneisen_parameter( 0., 0., volume[i] * perovskite.params['V_0'], perovskite.params) q_slb[i] = slb_eos.volume_dependent_q(1. / volume[i], perovskite.params) q_mgd[i] = perovskite.params['q_0'] #compare with figure 7 fig1 = mpimg.imread('input_figures/slb_fig3.png') plt.imshow(fig1, extent=[0.6, 1.0, 0.35, 2.0], aspect='auto') plt.plot(volume, grueneisen_slb, 'g+', volume, grueneisen_mgd, 'b+') plt.plot(volume, q_slb, 'g+', volume, q_mgd, 'b+') plt.xlim(0.6, 1.0) plt.ylim(0.35, 2.0) plt.ylabel("Grueneisen parameter") plt.xlabel("Relative Volume V/V0") plt.title( "Comparing with Figure 3 of Stixrude and Lithgow-Bertelloni (2005)") plt.show()
def check_birch_murnaghan(): """ Recreates Stixrude and Lithgow-Bertelloni (2005) Figure 1, bulk and shear modulus without thermal corrections """ plt.close() #make a test mineral test_mineral = burnman.material() test_mineral.params ={'name':'test', 'V_0': 6.844e-6, 'K_0': 259.0e9, 'Kprime_0': 4.0, 'G_0': 175.0e9, 'Gprime_0': 1.7, 'molar_mass': .0, 'n': 0., 'Debye_0': 0., 'grueneisen_0': 0., 'q_0': 0.} pressure = np.linspace(0., 140.e9, 100) volume = np.empty_like(pressure) bulk_modulus = np.empty_like(pressure) shear_modulus = np.empty_like(pressure) #calculate its static properties for i in range(len(pressure)): volume[i] = bm.volume(pressure[i], test_mineral.params) bulk_modulus[i] = bm.bulk_modulus(volume[i], test_mineral.params) shear_modulus[i] = bm.shear_modulus_third_order(volume[i], test_mineral.params) #third order is used for the plot we are comparing against #compare with figure 1 plt.plot(pressure/1.e9, bulk_modulus/1.e9, pressure/1.e9, shear_modulus/1.e9) fig1 = mpimg.imread('input_figures/slb_fig1.png') plt.imshow(fig1, extent=[0,140,0,800], aspect='auto') plt.plot(pressure/1.e9, bulk_modulus/1.e9, 'g+', pressure/1.e9, shear_modulus/1.e9, 'g+') plt.ylim(0,800) plt.xlim(0,140) plt.xlabel("Pressure (GPa)") plt.ylabel("Modulus (GPa)") plt.title("Comparing with Figure 1 of Stixrude and Lithgow-Bertelloni (2005)") plt.show()
def check_mgd_shim_duffy_kenichi(): """ Attemmpts to recreate Shim Duffy Kenichi (2002) """ plt.close() #Create gold material from Table 1 gold = burnman.material() gold.params = {'name': 'gold', 'V_0': 10.22e-6, 'K_0': 167.0e9, 'Kprime_0': 5.0, 'molar_mass': .196966, 'n': 1.0, 'Debye_0': 170., 'grueneisen_0': 2.97, #this does better with gr = 2.93. Why? 'q_0': 1.0} gold.set_method('mgd3') #Total pressures, pulled from Table 2 ref_pressures = [np.array([0., 3.55, 7.55, 12.06, 17.16, 22.91, 29.42, 36.77, 45.11, 54.56, 65.29, 77.50, 91.42, 107.32, 125.51, 146.38, 170.38, 198.07])] ref_pressures.append( np.array([4.99,8.53,12.53,17.04,22.13,27.88,34.38,41.73,50.06,59.50,70.22,82.43,96.33,112.22,130.40,151.25,175.24,202.90])) ref_pressures.append( np.array([12.14,15.69,19.68,24.19,29.28,35.03,41.53,48.88,57.20,66.64,77.37,89.57,103.47,119.35,137.53,158.38,182.36,210.02])) ref_pressures.append( np.array([19.30,22.84,26.84,31.35,36.44,42.19,48.68,56.03,64.35,73.80,84.52,96.72,110.62,126.50,144.68,165.53,189.51,217.17])) eos = mgd.mgd3() pressures = np.empty_like(ref_pressures) ref_dv = np.linspace(0.0, 0.34, len(pressures[0])) ref_volumes = (1-ref_dv)*gold.params['V_0'] T= np.array([300., 1000.,2000.,3000.]) for t in range(len(pressures)): for i in range(len(pressures[t])): pressures[t][i] = eos.pressure(T[t],ref_volumes[i], gold.params) plt.plot(ref_dv, (pressures[t]/1.e9-ref_pressures[t])) plt.ylim(-1,1) plt.ylabel("Difference in pressure (GPa)") plt.xlabel("1-dV/V") plt.title("Comparing with Shim, Duffy, and Kenichi (2002)") plt.show()
def check_slb_fig3(): """ Benchmark grueneisen parameter against figure 3 of Stixrude and Lithgow-Bertelloni (2005b) """ perovskite= burnman.material() perovskite.params = { 'name': 'perovksite', 'V_0': burnman.tools.molar_volume_from_unit_cell_volume(168.27, 4.), 'grueneisen_0': 1.63, 'q_0': 1.7} volume = np.linspace(0.6, 1.0, 100) grueneisen_slb = np.empty_like(volume) grueneisen_mgd = np.empty_like(volume) q_slb = np.empty_like(volume) q_mgd = np.empty_like(volume) slb_eos = slb.slb2() mgd_eos = mgd.mgd2() #calculate its thermal properties for i in range(len(volume)): #call with dummy pressure and temperatures, they do not change it grueneisen_slb[i] = slb_eos.grueneisen_parameter(0., 0., volume[i]*perovskite.params['V_0'], perovskite.params) grueneisen_mgd[i] = mgd_eos.grueneisen_parameter(0., 0., volume[i]*perovskite.params['V_0'], perovskite.params) q_slb[i] = slb_eos.volume_dependent_q(1./volume[i], perovskite.params) q_mgd[i] = perovskite.params['q_0'] #compare with figure 7 fig1 = mpimg.imread('input_figures/slb_fig3.png') plt.imshow(fig1, extent=[0.6, 1.0,0.35,2.0], aspect='auto') plt.plot(volume, grueneisen_slb, 'g+', volume, grueneisen_mgd, 'b+') plt.plot(volume, q_slb, 'g+', volume, q_mgd, 'b+') plt.xlim(0.6,1.0) plt.ylim(0.35,2.0) plt.ylabel("Grueneisen parameter") plt.xlabel("Relative Volume V/V0") plt.title("Comparing with Figure 3 of Stixrude and Lithgow-Bertelloni (2005)") plt.show()
def check_mgd_fei_mao_shu_hu(): """ Benchmark agains Fei Mao Shu Hu (1991) """ mgfeo = burnman.material() mgfeo.params = { 'name': 'MgFeO', 'V_0': 11.657e-6, 'K_0': 157.0e9, 'Kprime_0': 4.0, 'molar_mass': .196966, 'n': 2.0, 'Debye_0': 500., 'grueneisen_0': 1.50, 'q_0': 1.1} mgfeo.set_method('mgd3') #pulled from table 1 temperatures = np.array([300,300,483,483,483,590,593,593,593,700,600,500,650,600,600,650,700,737,727,673,600,543,565,585,600,628,654,745,768,747,726,700,676]) volumes = np.array([77.418,72.327,74.427,73.655,72.595,74.1,73.834,73.101,70.845,73.024,72.630,68.644,72.969,72.324,71.857,72.128,73.283,73.337,72.963,71.969,69.894,67.430,67.607,67.737,68.204,68.518,68.955,70.777,72.921,72.476,72.152,71.858,71.473]) #change from cubic angstroms per unit cell to cubic meters per mol of molecules. volumes = volumes/1.e30*6.022141e23/4.0 ref_pressures = np.array([0.0, 12.23,7.77,9.69,12.54,9.21,9.90,11.83,18.35,12.68,13.15,25.16,12.53,14.01,15.34,14.86,11.99,12.08,13.03,15.46,21.44,29.98,29.41,29.05,27.36,26.38,24.97,19.49,13.39,14.48,15.27,15.95,16.94]) ref_pressures = ref_pressures pressures = np.empty_like(volumes) eos = mgd.mgd3() for i in range(len(temperatures)): pressures[i] = eos.pressure(temperatures[i],volumes[i], mgfeo.params) plt.scatter(temperatures, (pressures/1.e9-ref_pressures)) plt.ylim(-1,1) plt.title("Comparing with Fei, Mao, Shu, and Hu (1991)") plt.xlabel("Temperature (K) at various volumes") plt.ylabel("Difference in total pressure (GPa)") plt.show()
vs_l2 = [ (vs[i] - obs_vs[i])*(vs[i] - obs_vs[i]) for i in range(len(obs_vs)) ] l2_error = sum(vs_l2) return l2_error mg_perovskite_data = np.loadtxt("Murakami_perovskite.txt") obs_pressures = mg_perovskite_data[:,0]*1.e9 obs_vs = mg_perovskite_data[:,2]*1000. pressures = np.linspace(25.e9, 135.e9, 100) #make the mineral to fit guess = [200.e9, 2.0] mg_perovskite_test = burnman.material() mg_perovskite_test.params['V_0'] = 24.45e-6 mg_perovskite_test.params['K_0'] = 281.e9 mg_perovskite_test.params['Kprime_0'] = 4.1 mg_perovskite_test.params['molar_mass'] = .10227 #first, do the second-order fit mg_perovskite_test.set_method("bm2") func = lambda x : error( x, mg_perovskite_test, obs_pressures, obs_vs) sol = opt.fmin(func, guess) print "2nd order fit: G = ", sol[0]/1.e9, "GPa\tG' = ", sol[1] model_vs_2nd_order_correct = calc_shear_velocities(sol[0], sol[1], mg_perovskite_test, pressures) mg_perovskite_test.set_method("bm3") model_vs_2nd_order_incorrect = calc_shear_velocities(sol[0], sol[1], mg_perovskite_test, pressures) #now do third-order fit
def check_slb_fig7(): """ Calculates all values for forsterite and benchmarks with figure 7 from Stixrude and Lithgow-Bertelloni (2005) """ forsterite = burnman.material() forsterite.params = { 'name': 'forsterite', 'V_0': 43.60e-6, 'K_0': 128.0e9, 'Kprime_0': 4.2, 'G_0' : 82.0e9, 'Gprime_0' : 1.4, 'n': 7.0, 'Debye_0': 809., 'grueneisen_0': .99, 'q_0': 2.1, 'eta_s_0' : 2.4} forsterite.set_method('slb3') temperature = np.linspace(0., 2000., 200) volume = np.empty_like(temperature) bulk_modulus = np.empty_like(temperature) shear_modulus = np.empty_like(temperature) heat_capacity = np.empty_like(temperature) pressure = 1.0e5 forsterite.set_state(pressure, 300.) Ks_0 = forsterite.adiabatic_bulk_modulus() #calculate its thermal properties for i in range(len(temperature)): forsterite.set_state(pressure, temperature[i]) volume[i] = forsterite.molar_volume()/forsterite.params['V_0'] bulk_modulus[i] = forsterite.adiabatic_bulk_modulus()/Ks_0 shear_modulus[i] = forsterite.shear_modulus()/forsterite.params['G_0'] heat_capacity[i] = forsterite.heat_capacity_p()/forsterite.params['n'] #compare with figure 7 fig1 = mpimg.imread('input_figures/slb_fig7_vol.png') plt.imshow(fig1, extent=[0,2200,0.99,1.08], aspect='auto') plt.plot(temperature, volume, 'g+') plt.ylim(0.99,1.08) plt.xlim(0,2200) plt.xlabel("Temperature (K)") plt.ylabel("Relative Volume V/V0") plt.title("Comparing with Figure 7 of Stixrude and Lithgow-Bertelloni (2005)") plt.show() fig1 = mpimg.imread('input_figures/slb_fig7_Cp.png') plt.imshow(fig1, extent=[0,2200,0.,70.], aspect='auto') plt.plot(temperature, heat_capacity, 'g+') plt.ylim(0,70) plt.xlim(0,2200) plt.xlabel("Temperature (K)") plt.ylabel("Heat Capacity Cp") plt.title("Comparing with adiabatic_bulk_modulus7 of Stixrude and Lithgow-Bertelloni (2005)") plt.show() fig1 = mpimg.imread('input_figures/slb_fig7_K.png') plt.imshow(fig1, extent=[0,2200,0.6,1.02], aspect='auto') plt.plot(temperature, bulk_modulus, 'g+') plt.ylim(0.6,1.02) plt.xlim(0,2200) plt.xlabel("Temperature (K)") plt.ylabel("Relative Bulk Modulus K/K0") plt.title("Comparing with Figure 7 of Stixrude and Lithgow-Bertelloni (2005)") plt.show() fig1 = mpimg.imread('input_figures/slb_fig7_G.png') plt.imshow(fig1, extent=[0,2200,0.6,1.02], aspect='auto') plt.plot(temperature, shear_modulus, 'g+') plt.ylim(0.6,1.02) plt.xlim(0,2200) plt.xlabel("Temperature (K)") plt.ylabel("Relative Shear Modulus G/G0") plt.title("Comparing with Figure 7 of Stixrude and Lithgow-Bertelloni (2005)") plt.show()
def check_slb_fig7_txt(): """ Calculates all values for forsterite and benchmarks with values from Stixrude and Lithgow-Bertelloni (personal communication) """ forsterite = burnman.material() forsterite.params = { 'name': 'forsterite', 'V_0': 43.603e-6, 'K_0': 127.955e9, 'Kprime_0': 4.232, 'G_0' : 81.6e9, 'Gprime_0' : 1.4, 'molar_mass': .140695, 'n': 7.0, 'Debye_0': 809.183, 'grueneisen_0': .993, 'q_0': 2.093, 'eta_s_0' : 2.364} forsterite.set_method('slb3') data = np.loadtxt("input_minphys/slb_fig7.txt", skiprows=1) temperature = np.array(data[:,2]) pressure = np.array(data[:,0]) rho = np.array(data[:,3]) frho = np.empty_like(rho) rho_comp = np.empty_like(rho) Kt = np.array(data[:,4]) fKt = np.empty_like(Kt) Kt_comp = np.empty_like(Kt) Ks = np.array(data[:,5]) fKs = np.empty_like(Ks) Ks_comp = np.empty_like(Ks) G = np.array(data[:,6]) fG = np.empty_like(G) G_comp = np.empty_like(G) VB = np.array(data[:,7]) fVB = np.empty_like(VB) VB_comp = np.empty_like(VB) VS = np.array(data[:,8]) fVS = np.empty_like(VS) VS_comp = np.empty_like(VS) VP = np.array(data[:,9]) fVP = np.empty_like(VP) VP_comp = np.empty_like(VP) vol = np.array(data[:,10]) fvol = np.empty_like(vol) vol_comp = np.empty_like(vol) alpha = np.array(data[:,11]) falpha = np.empty_like(alpha) alpha_comp = np.empty_like(alpha) Cp = np.array(data[:,12]) fCp = np.empty_like(Cp) Cp_comp = np.empty_like(Cp) gr = np.array(data[:,13]) gr_comp = np.empty_like(gr) for i in range(len(temperature)): forsterite.set_state(pressure[i], temperature[i]) rho_comp[i] = 100.*(forsterite.density()/1000. - rho[i])/rho[i] Kt_comp[i] = 100.*(forsterite.isothermal_bulk_modulus()/1.e9 - Kt[i])/Kt[i] Ks_comp[i] = 100.*(forsterite.adiabatic_bulk_modulus()/1.e9 - Ks[i])/Ks[i] G_comp[i] = 100.*(forsterite.shear_modulus()/1.e9 - G[i])/G[i] VB_comp[i] = 100.*(forsterite.v_phi()/1000. - VB[i])/VB[i] VS_comp[i] = 100.*(forsterite.v_s()/1000. - VS[i])/VS[i] VP_comp[i] = 100.*(forsterite.v_p()/1000. - VP[i])/VP[i] vol_comp[i] = 100.*(forsterite.molar_volume()*1.e6 - vol[i])/vol[i] alpha_comp[i] = 100.*(forsterite.thermal_expansivity()/1.e-5 - alpha[i])/(alpha[-1]) Cp_comp[i] = 100.*(forsterite.heat_capacity_p()/forsterite.params['molar_mass']/1000. - Cp[i])/(Cp[-1]) gr_comp[i] = (forsterite.grueneisen_parameter() - gr[i])/gr[i] plt.plot(temperature, rho_comp, label=r'$\rho$') plt.plot(temperature, Kt_comp, label=r'$K_S$') plt.plot(temperature, Ks_comp, label=r'$K_T$') plt.plot(temperature, G_comp, label=r'$G$') plt.plot(temperature, VS_comp, label=r'$V_S$') plt.plot(temperature, VP_comp, label=r'$V_P$') plt.plot(temperature, VB_comp, label = r'$V_\phi$') plt.plot(temperature, vol_comp, label = r'$V$') plt.plot(temperature, alpha_comp, label = r'$\alpha$') plt.plot(temperature, Cp_comp, label = r'$c_P$') plt.plot(temperature, gr_comp, label = r'$\gamma$') plt.xlim([0, 2750]) plt.ylim([-0.001, 0.001]) plt.xticks([0,800,1600,2200]) plt.xlabel("Temperature (K)") plt.ylabel("Percent Difference from HeFESTo") plt.legend(loc="center right") plt.savefig("output_figures/benchmark1.pdf") plt.show()
def check_slb_fig7_txt(): """ Calculates all values for forsterite and benchmarks with values from Stixrude and Lithgow-Bertelloni (personal communication) """ forsterite = burnman.material() forsterite.params = { 'name': 'forsterite', 'V_0': 43.603e-6, 'K_0': 127.955e9, 'Kprime_0': 4.232, 'G_0': 81.6e9, 'Gprime_0': 1.4, 'molar_mass': .140695, 'n': 7.0, 'Debye_0': 809.183, 'grueneisen_0': .993, 'q_0': 2.093, 'eta_s_0': 2.364 } forsterite.set_method('slb3') data = np.loadtxt("slb_benchmark.txt", skiprows=1) temperature = np.array(data[:, 2]) pressure = np.array(data[:, 0]) rho = np.array(data[:, 3]) frho = np.empty_like(rho) rho_comp = np.empty_like(rho) Kt = np.array(data[:, 4]) fKt = np.empty_like(Kt) Kt_comp = np.empty_like(Kt) Ks = np.array(data[:, 5]) fKs = np.empty_like(Ks) Ks_comp = np.empty_like(Ks) G = np.array(data[:, 6]) fG = np.empty_like(G) G_comp = np.empty_like(G) VB = np.array(data[:, 7]) fVB = np.empty_like(VB) VB_comp = np.empty_like(VB) VS = np.array(data[:, 8]) fVS = np.empty_like(VS) VS_comp = np.empty_like(VS) VP = np.array(data[:, 9]) fVP = np.empty_like(VP) VP_comp = np.empty_like(VP) vol = np.array(data[:, 10]) fvol = np.empty_like(vol) vol_comp = np.empty_like(vol) alpha = np.array(data[:, 11]) falpha = np.empty_like(alpha) alpha_comp = np.empty_like(alpha) Cp = np.array(data[:, 12]) fCp = np.empty_like(Cp) Cp_comp = np.empty_like(Cp) gr = np.array(data[:, 13]) gr_comp = np.empty_like(gr) for i in range(len(temperature)): forsterite.set_state(pressure[i], temperature[i]) rho_comp[i] = 100. * (forsterite.density() / 1000. - rho[i]) / rho[i] Kt_comp[i] = 100. * (forsterite.isothermal_bulk_modulus() / 1.e9 - Kt[i]) / Kt[i] Ks_comp[i] = 100. * (forsterite.adiabatic_bulk_modulus() / 1.e9 - Ks[i]) / Ks[i] G_comp[i] = 100. * (forsterite.shear_modulus() / 1.e9 - G[i]) / G[i] VB_comp[i] = 100. * (forsterite.v_phi() / 1000. - VB[i]) / VB[i] VS_comp[i] = 100. * (forsterite.v_s() / 1000. - VS[i]) / VS[i] VP_comp[i] = 100. * (forsterite.v_p() / 1000. - VP[i]) / VP[i] vol_comp[i] = 100. * (forsterite.molar_volume() * 1.e6 - vol[i]) / vol[i] alpha_comp[i] = 100. * (forsterite.thermal_expansivity() / 1.e-5 - alpha[i]) / (alpha[-1]) Cp_comp[i] = 100. * (forsterite.heat_capacity_p() / forsterite.params['molar_mass'] / 1000. - Cp[i]) / (Cp[-1]) gr_comp[i] = (forsterite.grueneisen_parameter() - gr[i]) / gr[i] plt.plot(temperature, rho_comp, label=r'$\rho$') plt.plot(temperature, Kt_comp, label=r'$K_S$') plt.plot(temperature, Ks_comp, label=r'$K_T$') plt.plot(temperature, G_comp, label=r'$G$') plt.plot(temperature, VS_comp, label=r'$V_S$') plt.plot(temperature, VP_comp, label=r'$V_P$') plt.plot(temperature, VB_comp, label=r'$V_\phi$') plt.plot(temperature, vol_comp, label=r'$V$') plt.plot(temperature, alpha_comp, label=r'$\alpha$') plt.plot(temperature, Cp_comp, label=r'$c_P$') plt.plot(temperature, gr_comp, label=r'$\gamma$') plt.xlim([0, 2200]) plt.ylim([-0.002, 0.002]) plt.yticks([-0.002, -0.001, 0, 0.001, 0.002]) plt.xticks([0, 800, 1600, 2200]) plt.xlabel("Temperature (K)") plt.ylabel("Difference (\%)") plt.legend(loc="lower center", prop=prop, ncol=4) plt.savefig("benchmark1.pdf", bbox_inches='tight') plt.show()
def check_slb_fig7(): """ Calculates all values for forsterite and benchmarks with figure 7 from Stixrude and Lithgow-Bertelloni (2005) """ forsterite = burnman.material() forsterite.params = { 'name': 'forsterite', 'V_0': 43.60e-6, 'K_0': 128.0e9, 'Kprime_0': 4.2, 'G_0': 82.0e9, 'Gprime_0': 1.4, 'n': 7.0, 'Debye_0': 809., 'grueneisen_0': .99, 'q_0': 2.1, 'eta_s_0': 2.4 } forsterite.set_method('slb3') temperature = np.linspace(0., 2000., 200) volume = np.empty_like(temperature) bulk_modulus = np.empty_like(temperature) shear_modulus = np.empty_like(temperature) heat_capacity = np.empty_like(temperature) pressure = 1.0e5 forsterite.set_state(pressure, 300.) Ks_0 = forsterite.adiabatic_bulk_modulus() #calculate its thermal properties for i in range(len(temperature)): forsterite.set_state(pressure, temperature[i]) volume[i] = forsterite.molar_volume() / forsterite.params['V_0'] bulk_modulus[i] = forsterite.adiabatic_bulk_modulus() / Ks_0 shear_modulus[i] = forsterite.shear_modulus( ) / forsterite.params['G_0'] heat_capacity[i] = forsterite.heat_capacity_p( ) / forsterite.params['n'] #compare with figure 7 fig1 = mpimg.imread('input_figures/slb_fig7_vol.png') plt.imshow(fig1, extent=[0, 2200, 0.99, 1.08], aspect='auto') plt.plot(temperature, volume, 'g+') plt.ylim(0.99, 1.08) plt.xlim(0, 2200) plt.xlabel("Temperature (K)") plt.ylabel("Relative Volume V/V0") plt.title( "Comparing with Figure 7 of Stixrude and Lithgow-Bertelloni (2005)") plt.show() fig1 = mpimg.imread('input_figures/slb_fig7_Cp.png') plt.imshow(fig1, extent=[0, 2200, 0., 70.], aspect='auto') plt.plot(temperature, heat_capacity, 'g+') plt.ylim(0, 70) plt.xlim(0, 2200) plt.xlabel("Temperature (K)") plt.ylabel("Heat Capacity Cp") plt.title( "Comparing with adiabatic_bulk_modulus7 of Stixrude and Lithgow-Bertelloni (2005)" ) plt.show() fig1 = mpimg.imread('input_figures/slb_fig7_K.png') plt.imshow(fig1, extent=[0, 2200, 0.6, 1.02], aspect='auto') plt.plot(temperature, bulk_modulus, 'g+') plt.ylim(0.6, 1.02) plt.xlim(0, 2200) plt.xlabel("Temperature (K)") plt.ylabel("Relative Bulk Modulus K/K0") plt.title( "Comparing with Figure 7 of Stixrude and Lithgow-Bertelloni (2005)") plt.show() fig1 = mpimg.imread('input_figures/slb_fig7_G.png') plt.imshow(fig1, extent=[0, 2200, 0.6, 1.02], aspect='auto') plt.plot(temperature, shear_modulus, 'g+') plt.ylim(0.6, 1.02) plt.xlim(0, 2200) plt.xlabel("Temperature (K)") plt.ylabel("Relative Shear Modulus G/G0") plt.title( "Comparing with Figure 7 of Stixrude and Lithgow-Bertelloni (2005)") plt.show()
import burnman.minerals_base as mb import numpy as np import colors plt.figure(dpi=100, figsize=(12, 6)) prop = {'size': 12} plt.rc('text', usetex=True) plt.rcParams['text.latex.preamble'] = '\usepackage{relsize}' dashstyle2 = (7, 3) dashstyle3 = (3, 2) method = 'slb2' #define the minerals from table 6.3 mg_perovskite = burnman.material() mg_perovskite.params = { 'name': 'Mg perovskite', 'molar_mass': 0.1004, 'V_0': 24.43e-6, 'K_0': 253.0e9, 'Kprime_0': 3.9, 'G_0': 172.9e9, 'Gprime_0': 1.56, 'n': 5.0, 'Debye_0': 1100., 'grueneisen_0': 1.40, 'q_0': 1.40, 'eta_s_0': 2.6 } mg_perovskite.set_method('slb2')
import numpy as np import colors plt.figure(dpi=100,figsize=(12,6)) prop={'size':12} plt.rc('text', usetex=True) plt.rcParams['text.latex.preamble'] = '\usepackage{relsize}' dashstyle2=(7,3) dashstyle3=(3,2) method = 'slb2' #define the minerals from table 6.3 mg_perovskite = burnman.material() mg_perovskite.params = { 'name': 'Mg perovskite', 'molar_mass' : 0.1004, 'V_0': 24.43e-6, 'K_0': 253.0e9, 'Kprime_0': 3.9, 'G_0' : 172.9e9, 'Gprime_0' : 1.56, 'n': 5.0, 'Debye_0': 1100., 'grueneisen_0': 1.40, 'q_0': 1.40, 'eta_s_0' : 2.6} mg_perovskite.set_method('slb2') fe_perovskite = burnman.material()