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

Rename parameter "Exchange-current density for plating" to "Exchange-current density for lithium metal electrode" #3429

Conversation

agriyakhetarpal
Copy link
Member

@agriyakhetarpal agriyakhetarpal commented Oct 9, 2023

Description

Closes #3428, adds a check for the use of the "Exchange-current density for plating [A.m-2]" parameter because it is to be renamed to "Exchange-current density for lithium-metal electrode [A.m-2]"

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.

  • Bug fix (non-breaking change which fixes an issue)

Key checklist:

  • No style issues: $ pre-commit run (or $ nox -s pre-commit) (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 (or $ nox -s tests)
  • The documentation builds: $ python run-tests.py --doctest (or $ nox -s doctests)

You can run integration tests, unit tests, and doctests together at once, using $ python run-tests.py --quick (or $ nox -s quick).

Further checks:

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

@@ -147,6 +147,10 @@ def test_check_parameter_values(self):
# since + has other meanings in regex
with self.assertRaisesRegex(ValueError, "Thermodynamic factor"):
pybamm.ParameterValues({"1 + dlnf/dlnc": 1})
# renamed to "Exchange-current density for lithium-metal electrode [A.m-2]"
Copy link
Member Author

@agriyakhetarpal agriyakhetarpal Oct 10, 2023

Choose a reason for hiding this comment

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

I used assertRaisesRegex here to catch the error but it had problems parsing the minus sign (-) in the units, so I ended up switching to the usual assertRaises instead. Please let me know if this is correct (works fine for me because the error is indeed raised, the method of catching the error is slightly different)

Copy link
Member

Choose a reason for hiding this comment

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

I usually test a substring that works e.g. "Exchange-current density for plating"

Copy link
Member Author

@agriyakhetarpal agriyakhetarpal Oct 10, 2023

Choose a reason for hiding this comment

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

Okay, I managed to fix that using raw strings in order to keep regex happy.

I do have a separate question about how or if the units should be accounted for: because if the units are to be included in the error checking, Exchange-current density for plating [A.m-2] will raise an error as expected, but Exchange-current density for plating (without the units) will not

@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (535c034) 99.58% compared to head (c1ac296) 99.58%.
Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3429   +/-   ##
========================================
  Coverage    99.58%   99.58%           
========================================
  Files          256      256           
  Lines        19998    20000    +2     
========================================
+ Hits         19915    19917    +2     
  Misses          83       83           
Files Coverage Δ
pybamm/input/parameters/lithium_ion/Mohtat2020.py 100.00% <ø> (ø)
pybamm/input/parameters/lithium_ion/OKane2022.py 100.00% <ø> (ø)
...rs/lithium_ion/OKane2022_graphite_SiOx_halfcell.py 100.00% <ø> (ø)
pybamm/parameters/lithium_ion_parameters.py 100.00% <ø> (ø)
pybamm/parameters/parameter_values.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brosaplanella
Copy link
Member

Tagging @Saransh-cpp as this should be included in the release

Copy link
Member

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

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

it should be "lithium metal" not "lithium-metal"

@@ -147,6 +147,10 @@ def test_check_parameter_values(self):
# since + has other meanings in regex
with self.assertRaisesRegex(ValueError, "Thermodynamic factor"):
pybamm.ParameterValues({"1 + dlnf/dlnc": 1})
# renamed to "Exchange-current density for lithium-metal electrode [A.m-2]"
Copy link
Member

Choose a reason for hiding this comment

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

I usually test a substring that works e.g. "Exchange-current density for plating"

@agriyakhetarpal
Copy link
Member Author

There is a reference for "plating" here

"Exchange-current density for plating [A.m-2]"
"": plating_exchange_current_density_OKane2020,

however, another reference for "lithium metal electrode" already exists here

"Exchange-current density for lithium metal electrode [A.m-2]"
"": li_metal_electrolyte_exchange_current_density_Xu2019,

which one should I keep or modify?

@valentinsulzer
Copy link
Member

Both, one is for the plating on the lithium meta electrode and the other is for plating in a porous electrode

Tagging @DrSOKane to make sure the changes get made correctly

@agriyakhetarpal
Copy link
Member Author

Makes sense, we would have to rename one of them to keep both of them though because we can't have duplicate keys

@agriyakhetarpal agriyakhetarpal changed the title Rename parameter "Exchange-current density for plating" to "Exchange-current density for lithium-metal electrode" Rename parameter "Exchange-current density for plating" to "Exchange-current density for lithium metal electrode" Oct 10, 2023
@valentinsulzer
Copy link
Member

What do you mean? They should both be kept as-is for that parameter set (I believe the reason for introducing the "Exchange-current density for lithium metal electrode" name was precisely to avoid this conflict)

@valentinsulzer
Copy link
Member

Sorry instructions weren't clear on how to fix this, I'll open a new PR with the fix

@agriyakhetarpal agriyakhetarpal deleted the lithium-plating-parameter-error-message branch October 12, 2023 21:58
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.

Add better error about the new "exchange-current density for lithium metal electrode [A.m-2]" parameter
3 participants