Skip to content

Commit

Permalink
change check_extrapolation to use t/y_event
Browse files Browse the repository at this point in the history
  • Loading branch information
pipliggins committed Sep 13, 2024
1 parent 35bcb78 commit 343cea4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/pybamm/solvers/base_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,9 +864,9 @@ def solve(
# If the new initial conditions are different
# and cannot be evaluated directly, set up again
self.set_up(model, model_inputs_list[0], t_eval, ics_only=True)
self._model_set_up[model]["initial conditions"] = (
model.concatenated_initial_conditions
)
self._model_set_up[model][
"initial conditions"
] = model.concatenated_initial_conditions
else:
# Set the standard initial conditions
self._set_initial_conditions(model, t_eval[0], model_inputs_list[0])
Expand Down Expand Up @@ -1478,8 +1478,12 @@ def check_extrapolation(self, solution, events):

# second pass: check if the extrapolation events are within the tolerance
last_state = solution.last_state
t = last_state.all_ts[0][0]
y = last_state.all_ys[0][:, 0]
if solution.t_event:
t = solution.t_event[0]
y = solution.y_event[:, 0]
else:
t = last_state.all_ts[0][0]
y = last_state.all_ys[0][:, 0]
inputs = last_state.all_inputs[0]

if isinstance(y, casadi.DM):
Expand Down

0 comments on commit 343cea4

Please sign in to comment.