Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Casadi extrapolate warning/error #976

Closed
brosaplanella opened this issue May 1, 2020 · 5 comments · Fixed by #1315
Closed

Casadi extrapolate warning/error #976

brosaplanella opened this issue May 1, 2020 · 5 comments · Fixed by #1315

Comments

@brosaplanella
Copy link
Member

When Casadi extrapolates you get errors like

At t = 0.300171, , mxstep steps taken before reaching tout.
psetup failed: .../casadi/interfaces/sundials/idas_interface.cpp:830: Linear solve failed
psetup failed: .../casadi/interfaces/sundials/idas_interface.cpp:830: Linear solve failed
psetup failed: .../casadi/interfaces/sundials/idas_interface.cpp:830: Linear solve failed
psetup failed: .../casadi/interfaces/sundials/idas_interface.cpp:830: Linear solve failed

which are hard to trace back to the interpolant. It would be useful to throw a warning/error when this happens which is more insightful.

@valentinsulzer
Copy link
Member

It's not possible to do this directly as we don't have control over the casadi objects.
But we could add a new type of event to the model, which automatically gets added when an interpolant is added to the model?

@brosaplanella
Copy link
Member Author

You mean an event in the solver?

@valentinsulzer
Copy link
Member

Yes, events are stored in the model then used by the solver

@valentinsulzer
Copy link
Member

Can you create a branch and add a test where it fails?

@brosaplanella
Copy link
Member Author

Looking into this issue at the moment and trying to recall what we discussed. The issue is that the Casadi interpolant throws NaNs when it extrapolates (side note here: the default interpolant behaviour is to extrapolate, is Casadi ignoring it or is it taking extrapolate=False?).

Adding events would be an easy fix (we then would know which interpolant broke and on which limit). But what do we want to do then? Stop the simulation and just tell the user that this was the issue? Throw an error? Throw a warning?

brosaplanella added a commit to brosaplanella/PyBaMM that referenced this issue Dec 30, 2020
brosaplanella added a commit to brosaplanella/PyBaMM that referenced this issue Jan 1, 2021
brosaplanella added a commit to brosaplanella/PyBaMM that referenced this issue Jan 1, 2021
brosaplanella added a commit to brosaplanella/PyBaMM that referenced this issue Jan 2, 2021
brosaplanella added a commit to brosaplanella/PyBaMM that referenced this issue Jan 3, 2021
brosaplanella added a commit to brosaplanella/PyBaMM that referenced this issue Jan 3, 2021
brosaplanella added a commit to brosaplanella/PyBaMM that referenced this issue Jan 3, 2021
brosaplanella added a commit to brosaplanella/PyBaMM that referenced this issue Jan 3, 2021
brosaplanella added a commit to brosaplanella/PyBaMM that referenced this issue Jan 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants