Skip to content

Commit

Permalink
#633 fixed small comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Scottmar93 committed Oct 11, 2019
1 parent 1173d69 commit 70b0d11
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/scripts/compare-dae-solver.py
Expand Up @@ -28,8 +28,8 @@
# solve model
t_eval = np.linspace(0, 0.2, 100)

klu_sol = pybamm.KLU(tol=1e-8).solve(model, t_eval)
scikits_sol = pybamm.ScikitsDaeSolver(tol=1e-8).solve(model, t_eval)
klu_sol = pybamm.KLU(atol=1e-8, rtol=1e-8).solve(model, t_eval)
scikits_sol = pybamm.ScikitsDaeSolver(atol=1e-8, rtol=1e-8).solve(model, t_eval)

# plot
models = [model, model]
Expand Down
6 changes: 6 additions & 0 deletions pybamm/solvers/klu_sparse_solver.py
Expand Up @@ -68,6 +68,12 @@ def integrate(self, residuals, y0, t_eval, events, mass_matrix, jacobian):
(see `SUNDIALS docs. <https://computation.llnl.gov/projects/sundials>`).
"""

if not jacobian:
pybamm.SolverError("KLU requires the Jacobian to be provided")

if not events:
pybamm.SolverError("KLU requires events to be provided")

def eqsres(t, y, ydot, return_residuals):
return_residuals[:] = residuals(t, y, ydot)

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_solvers/test_klu.py
Expand Up @@ -4,7 +4,7 @@
import unittest


@unittest.skipIf(pybamm.have_klu(), "klu is not installed")
@unittest.skipIf(pybamm.have_klu(), "klu solver is not installed")
class TestKLUSolver(unittest.TestCase):
def test_on_spme(self):
model = pybamm.lithium_ion.SPMe()
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_solvers/test_klu_sparse_solver.py
Expand Up @@ -7,7 +7,7 @@
import unittest


@unittest.skipIf(pybamm.have_klu(), "klu is not installed")
@unittest.skipIf(pybamm.have_klu(), "klu solver is not installed")
class TestKLUSolver(unittest.TestCase):
def test_ida_roberts_klu(self):
# this test implements a python version of the ida Roberts
Expand Down

0 comments on commit 70b0d11

Please sign in to comment.