Skip to content

Commit 74b207f

Browse files
committed
change tol
1 parent 9f44b23 commit 74b207f

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

burnman/optimize/nonlinear_solvers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@ def constraints(x):
277277
x_j_min = (
278278
sol.x + lmda_bounds[0] * dx
279279
) # because lmda must be getting smaller, no need to check constraints
280+
281+
if np.isnan(x_j_min).any():
282+
print(sol.x)
283+
print(lmda_bounds[0])
284+
print(dx)
285+
raise Exception(f"Parameter values include np.nan: {x_j_min}.")
286+
280287
F_j_min = F(x_j_min)
281288
dxbar_j_min = lu_solve(luJ, -F_j_min)
282289
dxbar_j_min_norm = np.linalg.norm(dxbar_j_min, ord=2)

burnman/tools/equilibration.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,10 @@ def set_compositions_and_state_from_parameters(assemblage, parameters):
164164
i += 1
165165

166166
if not np.all(phase_amounts > -1.0e-8):
167+
print(assemblage)
168+
print(parameters)
167169
raise Exception(
168-
f"Phase amounts should be >-1.0e-8 but they are {repr(phase_amounts)}.\n"
169-
f"Parameters: {repr(parameters)}.\n"
170-
f"{repr(assemblage)}."
170+
f"Phase amounts should be >-1.0e-8 but they are {phase_amounts}."
171171
)
172172
phase_amounts = np.abs(phase_amounts)
173173
assemblage.n_moles = sum(phase_amounts)
@@ -218,7 +218,14 @@ def F(
218218
:returns: The vector corresponding to F(x).
219219
:rtype: numpy.array
220220
"""
221-
221+
if np.isnan(x).any():
222+
raise Exception(
223+
f"Parameter values include np.nan for \n{assemblage}\n"
224+
f"Equality constraints: {equality_constraints}\n"
225+
f"Compositional vector: {reduced_composition_vector}\n"
226+
"Free compositional vectors: "
227+
f"{reduced_free_composition_vectors}."
228+
)
222229
set_compositions_and_state_from_parameters(assemblage, x)
223230
new_endmember_amounts = get_endmember_amounts(assemblage)
224231

misc/benchmarks/slb_2024_benchmarks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,14 @@ def check_fig_3_fcc_ferric_fper():
187187
Composite([fper]), {"Fe": 1.0, "O": 1.1}
188188
)
189189
fper = assemblage.phases[0]
190+
print("fper endmember formulae:")
191+
print([mbr[1] for mbr in fper.endmembers])
190192

191193
composition = {"Fe": 1.0, "O": 1.0}
192194
assemblage = Composite([bcc, fper, mag], [0.5, 0.49, 0.01])
193-
fper.set_composition([0.05, 0.0, 0.95])
195+
fper.set_composition([0.04, 0.01, 0.95])
194196
equality_constraints = [["P", 1.0e5], ["phase_fraction", (mag, 0.0)]]
195-
sol = equilibrate(composition, assemblage, equality_constraints, tol=1.0e-5)
197+
sol = equilibrate(composition, assemblage, equality_constraints)
196198
T_a_wu_mag = sol[0].assemblage.temperature
197199
print(f"BCC-fper-mag triple point at 1 bar: {T_a_wu_mag:.2f} K")
198200

0 commit comments

Comments
 (0)