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

Adding pchip interpolator to pybamm.Interpolant class. #4590

Open
martinjrobins opened this issue Nov 15, 2024 · 1 comment
Open

Adding pchip interpolator to pybamm.Interpolant class. #4590

martinjrobins opened this issue Nov 15, 2024 · 1 comment

Comments

@martinjrobins
Copy link
Contributor

Discussed in #4589

Originally posted by MartinFuentetaja November 15, 2024
Hello everyone! I am trying to use Akima1D interpolator to interpolate the OCPs of gr/LFP cell. I have tried to use pchip instead of cubic spline (due to the flatness of the OCP of LFP). However, the following error arises:

NotImplementedError: The interpolator 'pchip' is not supported by CasAdi. Use 'linear' or 'cubic' instead. Alternatively, set 'model.convert_to_format = 'python'' and use a non-CasADi solver.

Therefore, I have also tried to implement Akima1D interpolator from scratch. However, I did not success.

I have to mention that it works with linear interpolator, however I would prefer to use another one.

@martinjrobins
Copy link
Contributor Author

Discussed in #4589

This is possible, the main piece of work would be to implement the pchip interpolant in the file pybamm/expression_tree/operations/convert_to_casadi.py. There is an issue on the casadi repo that gives an example of how to do this: casadi/casadi#2489

@martinjrobins martinjrobins changed the title Adding New interpolator to pybamm.Interpolant class. Adding pchip interpolator to pybamm.Interpolant class. Nov 15, 2024
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

No branches or pull requests

1 participant