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

Other useful variables #2740

Merged
merged 15 commits into from
Mar 6, 2023
Merged

Other useful variables #2740

merged 15 commits into from
Mar 6, 2023

Conversation

valentinsulzer
Copy link
Member

Description

Add some useful variables, fix plot_voltage_components and add example

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist:

  • No style issues: $ pre-commit run (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)
  • All tests pass: $ python run-tests.py --all
  • The documentation builds: $ python run-tests.py --doctest

You can run unit and doctests together at once, using $ python run-tests.py --quick.

Further checks:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@codecov
Copy link

codecov bot commented Mar 2, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change

Comparison is base (b2f8b62) 99.68% compared to head (6a3c26c) 99.68%.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2740   +/-   ##
========================================
  Coverage    99.68%   99.68%           
========================================
  Files          270      271    +1     
  Lines        18949    18991   +42     
========================================
+ Hits         18890    18932   +42     
  Misses          59       59           
Impacted Files Coverage Δ
pybamm/input/parameters/ecm/example_set.py 100.00% <ø> (ø)
pybamm/input/parameters/lithium_ion/Ai2020.py 100.00% <ø> (ø)
pybamm/input/parameters/lithium_ion/Chen2020.py 100.00% <ø> (ø)
...input/parameters/lithium_ion/Chen2020_composite.py 100.00% <ø> (ø)
pybamm/input/parameters/lithium_ion/Ecker2015.py 100.00% <ø> (ø)
pybamm/input/parameters/lithium_ion/Marquis2019.py 100.00% <ø> (ø)
pybamm/input/parameters/lithium_ion/Mohtat2020.py 100.00% <ø> (ø)
pybamm/input/parameters/lithium_ion/NCA_Kim2011.py 100.00% <ø> (ø)
pybamm/input/parameters/lithium_ion/OKane2022.py 100.00% <ø> (ø)
pybamm/input/parameters/lithium_ion/ORegan2022.py 100.00% <ø> (ø)
... and 46 more

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 at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@valentinsulzer
Copy link
Member Author

This PR looks nasty but it's mainly a lot of renaming variables, as detailed in CHANGELOG

Copy link
Member

@brosaplanella brosaplanella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks! Just a couple of small comments

CHANGELOG.md Outdated
## Features

- Renamed "Terminal voltage [V]" to just "Voltage [V]". "Terminal voltage [V]" can still be used and will return the same value as "Voltage [V]".
- Added "Anode potential [V]", which is the value of the surface potential difference (`phi_s - phi_e`) at the anode/separator interface, commonly controlled in fast-charging algorithms to avoid plating. Also added "Cathode potential [V]", which is the value of the surface potential difference at the cathode/separator interface. ([#2740](https://github.com/pybamm-team/PyBaMM/pull/2740))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be "Positive electrode" and "Negative electrode" so it is consistent with the other variables?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The full name for this would be "Negative electrode surface potential difference at the separator interface". But I think in the fast-charging literature it's just called "Anode potential". Which do you think is better here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmmm good point. The first choice is a bit of a mouthful, but I think we should use it to be consistent (i.e. use positive and negative electrode everywhere, rather than mixing it with anode and cathode). Especially, as just calling it "Anode potential" would be confusing with the existing "Negative electrode potential [V]", right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes true, I'll change it to the longer one

examples/scripts/compare_lithium_ion.py Outdated Show resolved Hide resolved
valentinsulzer and others added 3 commits March 6, 2023 10:28
Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
@valentinsulzer valentinsulzer merged commit 9d5f5a1 into develop Mar 6, 2023
@valentinsulzer valentinsulzer deleted the other-useful-variables branch March 6, 2023 19:04
@TomTranter
Copy link
Contributor

This caused liionpack to break as I was using the Measured battery ocv. Also when I changed to use the new OCV results looked strange and so I'm now using surface ocv.

@TomTranter
Copy link
Contributor

I think it might be nice to have some example of what they all mean and where they are used

@rtimms
Copy link
Contributor

rtimms commented Mar 31, 2023

What was "Measured open circuit voltage [V]" has been renamed to "Surface open-circuit voltage [V]". This is the OCV calculated from the surface concentration. "Open-circuit voltage [V]" is calculated from the bulk.

Since the thing you would actually measure as (pseudo) OCV in an experiment is the surface OCV, I wonder if "Open-circuit voltage [V]" and "Surface open-circuit voltage [V]" should be the same, and we should also have "Bulk open-circuit voltage [V]".

We could explain this more thoroughly in the plot voltage components notebook

@TomTranter
Copy link
Contributor

I agree if the more observable one is Surface that should be the "Open-circuit voltage [V]", what is the bulk one used for?

@rtimms
Copy link
Contributor

rtimms commented Mar 31, 2023

So you can separate out the effect of concentration gradients within the particle on the voltage

@valentinsulzer
Copy link
Member Author

valentinsulzer commented Mar 31, 2023

I think the "Open-circuit voltage" should be the one that you would eventually relax to if you turned the current off, i.e. the bulk one. What makes the surface one more observable?

@rtimms
Copy link
Contributor

rtimms commented Mar 31, 2023

It's just a point of notation where we should be consistent. If you asked people "what is the OCV?" in their model they would probably say U_p(c_p_surf) - U_n(c_n_surf) which is what we now call "Surface open-circuit voltage [V]". I agree that it makes sense to have a bulk open-circuit voltage variable (the one you relax to), but is this consistent with the defn most people have in their head when thinking about continuum models?

@valentinsulzer
Copy link
Member Author

Got it. There's also the option of just not defining "Open-circuit voltage" so you have to specify bulk or surface explicitly each time. We should update this either way before releasing

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 this pull request may close these issues.

4 participants