You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Cannot do convergence study with IDAKLUSolver due to error with atol
To Reproduce
Run the following code:
importpybammimportnumpyasnpmodel=pybamm.lithium_ion.SPM()
solver=pybamm.IDAKLUSolver()
# load parameter values and geometrygeometry=model.default_geometryparam=model.default_parameter_values# Process parametersparam.process_model(model)
param.process_geometry(geometry)
# Calculate time for each solver and each number of grid pointsvar=pybamm.standard_spatial_varst_eval=np.linspace(0, 0.17, 100)
fornptsin [100, 200]:
# discretisevar_pts= {
spatial_var: nptsforspatial_varin [var.x_n, var.x_s, var.x_p, var.r_n, var.r_p]
}
mesh=pybamm.Mesh(geometry, model.default_submesh_types, var_pts)
disc=pybamm.Discretisation(mesh, model.default_spatial_methods)
model_disc=disc.process_model(model, inplace=False)
# solvesolution=solver.solve(model_disc, t_eval)
Expected behaviour
No output
Actual behaviour
It goes through the first solve fine, but fails on the second solve
Traceback (most recent call last):
File "/mnt/c/Users/vsulzer/Documents/Energy_Storage/PyBaMM/bug.py", line 30, in <module>
solution = solver.solve(model_disc, t_eval)
File "/mnt/c/Users/vsulzer/Documents/Energy_Storage/PyBaMM/pybamm/solvers/base_solver.py", line 84, in solve
solution, solve_time, termination = self.compute_solution(model, t_eval)
File "/mnt/c/Users/vsulzer/Documents/Energy_Storage/PyBaMM/pybamm/solvers/dae_solver.py", line 90, in compute_solution
jacobian=self.jacobian,
File "/mnt/c/Users/vsulzer/Documents/Energy_Storage/PyBaMM/pybamm/solvers/idaklu_solver.py", line 158, in integrate
self._check_atol_type(y0.size)
File "/mnt/c/Users/vsulzer/Documents/Energy_Storage/PyBaMM/pybamm/solvers/idaklu_solver.py", line 124, in _check_atol_type
of the same shape at y0"""
pybamm.expression_tree.exceptions.SolverError: Absolute tolerances must be either a scalar or a numpy arrray
of the same shape at y0
The text was updated successfully, but these errors were encountered:
Note this is fixed by making _check_atol_type return atol directly (instead of setting self._atol and then reading atol=self._atol, but you might want to do it differently?
Describe the bug
Cannot do convergence study with IDAKLUSolver due to error with
atol
To Reproduce
Run the following code:
Expected behaviour
No output
Actual behaviour
It goes through the first solve fine, but fails on the second solve
The text was updated successfully, but these errors were encountered: