Skip to content

Commit f260673

Browse files
committed
tighten epsilons
1 parent 3a94ce1 commit f260673

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

burnman/classes/solutionmodel.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from .material import material_property, cached_property
1313
from dataclasses import make_dataclass
1414

15+
np_eps = np.finfo(float).eps
16+
1517
Interaction = make_dataclass(
1618
"Interaction", ["inds", "expts", "f_r", "m_jr", "f_rs", "m_jrs"]
1719
)
@@ -104,7 +106,7 @@ def _non_ideal_interactions_subreg(p, n_endmembers, Wijk):
104106
return Wint
105107

106108

107-
def logish(x, eps=1.0e-7):
109+
def logish(x, eps=np_eps):
108110
"""
109111
2nd order series expansion of log(x) about eps:
110112
log(eps) - sum_k=1^infty (f_eps)^k / k
@@ -117,7 +119,7 @@ def logish(x, eps=1.0e-7):
117119
return ln
118120

119121

120-
def inverseish(x, eps=1.0e-5):
122+
def inverseish(x, eps=np_eps):
121123
"""
122124
1st order series expansion of 1/x about eps: 2/eps - x/eps/eps
123125
Prevents infinities at x=0

burnman/optimize/nonlinear_solvers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def __init__(
129129
regularization: float = 0.0,
130130
cond_lu_thresh: float = 1e12,
131131
cond_lstsq_thresh: float = 1e15,
132-
constraint_thresh: float = 1.0e-8,
132+
constraint_thresh: float = 2 * np.finfo(float).eps,
133133
):
134134
"""
135135
Initialize the solver instance.
@@ -183,7 +183,7 @@ def __init__(
183183
:type cond_lstsq_thresh: float, optional
184184
185185
:param constraint_thresh: Threshold for considering a constraint
186-
"active" when determining step feasibility, defaults to 1.0e-8.
186+
"active" when determining step feasibility, defaults to 2*eps.
187187
:type constraint_thresh: float, optional
188188
"""
189189
self.F = F

0 commit comments

Comments
 (0)