Skip to content

Commit

Permalink
Merge pull request #2613 from pybamm-team/termination-success
Browse files Browse the repository at this point in the history
change success to final time
  • Loading branch information
valentinsulzer authored Jan 26, 2023
2 parents 8543525 + 938ff95 commit 932a133
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
- Steps in `Experiment` can now be tagged and cycle numbers be searched based on those tags ([#2593](https://github.com/pybamm-team/PyBaMM/pull/2593)).
- New `contact resistance` option, new parameter `Contact resistance [Ohm]` and new variable `Contact overpotential [V]` ([#2598](https://github.com/pybamm-team/PyBaMM/pull/2598)).

## Bug fixes

- Changed termination from "success" to "final time" for algebraic solvers to match ODE/DAE solvers ([#2613](https://github.com/pybamm-team/PyBaMM/pull/2613)).

# [v22.12](https://github.com/pybamm-team/PyBaMM/tree/v22.12) - 2022-12-31

## Features
Expand Down
4 changes: 3 additions & 1 deletion pybamm/solvers/algebraic_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ def jac_norm(y):
y_diff = np.r_[[y0_diff] * len(t_eval)].T
y_sol = np.r_[y_diff, y_alg]
# Return solution object (no events, so pass None to t_event, y_event)
sol = pybamm.Solution(t_eval, y_sol, model, inputs_dict, termination="success")
sol = pybamm.Solution(
t_eval, y_sol, model, inputs_dict, termination="final time"
)
sol.integration_time = integration_time
return sol
2 changes: 0 additions & 2 deletions pybamm/solvers/base_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1302,8 +1302,6 @@ def get_termination_reason(self, solution, events):

pybamm.logger.debug("Finish post-processing events")
return solution, solution.termination
elif solution.termination == "success":
return solution, solution.termination

def check_extrapolation(self, solution, events):
"""
Expand Down
2 changes: 1 addition & 1 deletion pybamm/solvers/casadi_algebraic_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def _integrate(self, model, t_eval, inputs_dict=None):
y_sol,
model,
inputs_dict,
termination="success",
termination="final time",
sensitivities=explicit_sensitivities,
)
sol.integration_time = integration_time
Expand Down
2 changes: 1 addition & 1 deletion pybamm/solvers/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def first_state(self):
self.all_inputs[:1],
None,
None,
"success",
"final time",
)
new_sol._all_inputs_casadi = self.all_inputs_casadi[:1]
new_sol._sub_solutions = self.sub_solutions[:1]
Expand Down

0 comments on commit 932a133

Please sign in to comment.