-
-
Notifications
You must be signed in to change notification settings - Fork 568
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
Update NCA_Kim2011.py #2751
Update NCA_Kim2011.py #2751
Conversation
Fixing pybamm-team#2744. to make sure we hit the voltage cut-off, instead of the particle stoichiometry going above 1. Using the function in Kim2011 article to take the place of pybamm\input\parameters\lithium_ion\data\nca_ocp_Kim2011_data.csv for parameter 'Positive electrode OCP[V]' in Kim2011 parameter set. The function 'nca_ocp_Kim2011(sto)' in pybamm\input\parameters\lithium_ion\NCA_Kim2011.py is edited.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, you just need to remove import os
in this file since it is no longer used
detele 'import os' as it is not used now.
Hmm, tests are failing because the old NCA Kim error was being used to test for the error reporting, if you feel confident to fix it I would suggest adding a different example where the interpolant extrapolates instead. I think something like this should work x = np.linspace(0,2)
var = pybamm.Variable("var")
rhs = pybamm.Interpolant(x, x, var, name=name, interpolator="linear")
model = pybamm.BaseModel()
model.rhs[var] = rhs
model.initial_conditions[var] = 1
solver = pybamm.ScipySolver()
t_eval = [0,5]
# solution should grow exponentially and go above var=2, then the interpolant should error
solver.solve(model, t_eval) But you should test this locally first to make sure it does indeed raise the error. Let me know if you need help |
Sorry, I don't know what 'old NCA Kim error was being used to test for the error reporting' means. Could you explain it in detail? |
This test is failing since line 508 expects an error from the parameter set before you fixed it. PyBaMM/tests/unit/test_solvers/test_casadi_solver.py Lines 488 to 509 in f45f4a5
Instead, we should test using a standalone piece of code like the one I shared above, and still make sure the error is raised |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #2751 +/- ##
===========================================
- Coverage 99.69% 99.68% -0.01%
===========================================
Files 272 272
Lines 19034 19031 -3
===========================================
- Hits 18975 18972 -3
Misses 59 59
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
Although I still don't quite understand the reason and purpose of this test, I am very grateful for this update and your work. |
Fixing #2744 to make sure we hit the voltage cut-off, instead of the particle stoichiometry going above 1.
Using the function in Kim2011 article to take the place of pybamm\input\parameters\lithium_ion\data\nca_ocp_Kim2011_data.csv for parameter 'Positive electrode OCP[V]' in Kim2011 parameter set.
The function 'nca_ocp_Kim2011(sto)' in pybamm\input\parameters\lithium_ion\NCA_Kim2011.py is edited.