Skip to content

Commit

Permalink
Account for change in scipy solver API
Browse files Browse the repository at this point in the history
  • Loading branch information
guyer committed Feb 6, 2025
1 parent 2876d0a commit daef9ef
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions fipy/solvers/scipy/scipyKrylovSolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@

import os
import warnings
import scipy

from .scipySolver import ScipySolver
from fipy.tools import numerix
from fipy.tools.timer import Timer
from fipy.tools.version import Version, parse_version

scipy_has_tol = (parse_version(scipy.__version__) < Version("1.12"))

class ScipyKrylovSolver(ScipySolver):
"""
Expand Down Expand Up @@ -76,12 +80,17 @@ def _solve_(self, L, x, b):
self._log.debug("BEGIN solve")

with Timer() as t:
if scipy_has_tol:
tolerance = dict(tol=rtol)
else:
tolerance = dict(rtol=rtol)

x, info = self.solveFnc(L, b, x,
tol=rtol,
atol=self.absolute_tolerance,
maxiter=self.iterations,
M=M,
callback=self._countIterations)
callback=self._countIterations,
**tolerance)

self._log.debug("END solve - {} ns".format(t.elapsed))

Expand Down

0 comments on commit daef9ef

Please sign in to comment.