@@ -60,6 +60,7 @@ def check_fper_entropy():
6060def check_fig_1_fper_relaxed ():
6161 print ("\n Checking Figure 1..." )
6262 fper = SLB_2024 .ferropericlase_relaxed ()
63+ fper_unrelaxed = SLB_2024 .ferropericlase ()
6364 c = molar_volume_from_unit_cell_volume (1.0 , SLB_2024 .periclase ().params ["Z" ])
6465
6566 pressures = np .linspace (1.0e5 , 140.0e9 , 141 )
@@ -80,7 +81,26 @@ def check_fig_1_fper_relaxed():
8081 ax [3 ].imshow (fig4 , extent = [0.0 , 200.0 , 0.0 , 4000.0 ], aspect = "auto" )
8182
8283 for x_fe in [0.1 , 0.3 , 0.5 , 1.0 ]:
83- fper .set_composition ([1.0 - x_fe , x_fe , 0.0 , 0.0 ])
84+ # First, we need to equilibrate the system at 1 bar and 1473 K
85+ # according to the caption of SLB2024 Figure 1
86+ assemblage = Composite ([fper_unrelaxed , SLB_2024 .gamma_fcc_iron ()], [0.5 , 0.5 ])
87+ composition = {
88+ "Mg" : (1.0 - x_fe ),
89+ "Fe" : 1.0 ,
90+ "O" : 1.0 ,
91+ "Na" : 1.0e-9 ,
92+ "Al" : 1.0e-9 ,
93+ }
94+ fper_unrelaxed .set_composition (
95+ [1.0 - x_fe , x_fe * 0.98 , x_fe * 0.01 , 0.0 , x_fe * 0.01 ]
96+ )
97+ equality_constraints = [["P" , 1.0e5 ], ["T" , 1473.0 ]]
98+ _ , _ = equilibrate (composition , assemblage , equality_constraints )
99+ f = fper_unrelaxed .molar_fractions
100+ molar_fractions = [f [0 ], f [1 ] + f [2 ], f [3 ], f [4 ]] # combine HS and LS Fe
101+
102+ # Now use that composition of ferropericlase in the relaxed solution
103+ fper .set_composition (molar_fractions )
84104 Vs , K_Ss = fper .evaluate (["V" , "K_S" ], pressures , temperatures )
85105
86106 ax [0 ].plot (pressures / 1.0e9 , Vs / c , linestyle = ":" , linewidth = 3.0 )
@@ -353,6 +373,7 @@ def check_fig_7_fO2():
353373 wu = simplify_composite_with_composition (
354374 Composite ([wu ]), {"Fe" : 1 , "O" : 1.01 }
355375 ).phases [0 ]
376+ assert len (wu .endmembers ) == 3 # check that the simplification worked
356377
357378 hepv = SLB_2024 .hepv ()
358379 hppv = SLB_2024 .hppv ()
@@ -435,17 +456,15 @@ def check_fig_7_fO2():
435456 T = 1500.0
436457 for i , P in enumerate (pressures ):
437458 assemblage .set_state (P , T )
438- try :
439- sol = equilibrate (assemblage .formula , assemblage , [["P" , P ], ["T" , T ]])[
440- 0
441- ]
442- if sol .success :
443- mu_O2 = assemblage .chemical_potential ([{"O" : 2.0 }])[0 ]
444- O2_gas .set_state (1.0e5 , T )
445- O2_gibbs = O2_gas .gibbs + f
446- logfO2 [i ] = (mu_O2 - O2_gibbs ) / (gas_constant * T ) / np .log (10.0 )
447- except AssertionError :
448- pass
459+ sol , _ = equilibrate (
460+ assemblage .formula , assemblage , [["P" , P ], ["T" , T ]], tol = 1.0e-10
461+ )
462+ if sol .success :
463+ mu_O2 = sol .assemblage .chemical_potential ([{"O" : 2.0 }])[0 ]
464+ O2_gas .set_state (1.0e5 , T )
465+ O2_gibbs = O2_gas .gibbs + f
466+ logfO2 [i ] = (mu_O2 - O2_gibbs ) / (gas_constant * T ) / np .log (10.0 )
467+
449468 ax [0 ].plot (pressures / 1.0e9 , logfO2 , linestyle = ":" , linewidth = 3.0 )
450469
451470 ax [0 ].set_ylim (- 14 , 22 )
0 commit comments