Skip to content

Commit

Permalink
more robust solver
Browse files Browse the repository at this point in the history
  • Loading branch information
joyxyz1994 committed Dec 14, 2024
1 parent 76c9275 commit 22a303e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion qsdsan/sanunits/_metal_dosage.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,17 @@ def _compile_AE(self):
ka_si = self._ka_si

def solve_sp(Me_in, SP_in):
return flx.bisection(
try:
sp = flx.bisection(
_precipitation_mass_balance, 0, SP_in, args=(
Me_in, SP_in, Ksp_mass, x, y, i, j, alpha
))
except:
sp = flx.aitken_secant(
_precipitation_mass_balance, SP_in, args=(
Me_in, SP_in, Ksp_mass, x, y, i, j, alpha
))
return sp

def solve_ss(SS_in):
return flx.IQ_interpolation(
Expand Down

0 comments on commit 22a303e

Please sign in to comment.