-
-
Notifications
You must be signed in to change notification settings - Fork 563
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
IDAKLU solver sensitivities using IDAS #1477
Comments
@tinosulzer: were you planning that the API for sensitivities you have implemented in #1100 is just for the casadi solver, or should I also follow this for the idaklu solver? I'm worried that this API seems rather casadi specific, what are your thoughts on this? |
Ideally the API should just be something like sol = sim.solve(t_eval, inputs={"p": 2, "q": 3}
sol["variable"].data # returns the values
sol["variable"].sensitivity["q"] # returns the sensitivities wrt q which then works with any solver. This involves getting rid of the |
Should we put a flag or something going into |
IIRC in the 1100 branch I made it a flag in the |
is there any reason that the a = pybamm.InputParameter("a")
# ...
sol = solver.solve(model, t_eval, inputs={a: 1.0}) It also helps when I'm calculating the sensititivites of rhs and algebraic wrt the input parameters using |
actually, maybe if the user is using a pre-built model they won't have access to the Anyhoo, I've drafted out some changes to the base solver that I'm thinking of for the sensitivities. I'm thinking that if sensitivities are requested, then a dict of |
Sounds good
Won't this depend on which solver is used rather than the |
But some of the solvers support multiple |
also need to add flag to # calculate sensitivities for "a" input
sol = solver.solve(model, t_eval, inputs={"a": a_value}, calculate_sensitivites=["a"])
# calculate sensitivities for all input parameters
sol = solver.solve(model, t_eval, inputs={"a": a_value}, calculate_sensitivites=True) |
Summary
Extend the IDAKLU solver to return sensitivities of y wrt the parameters p
Motivation
It is useful to calculate sensitivities in, for example, model fitting to data. The IDAKLU solver already using IDA in sundials, and IDAS is another part of the sundials package which can calculate sensitivities, so in theory this should be easily achievable.
Additional context
Work on incorporating sensitivities for the casadi solver is already underway in #1100
The text was updated successfully, but these errors were encountered: