Skip to content

Commit

Permalink
Merge pull request #3871 from pybamm-team/fix-electrode-particle
Browse files Browse the repository at this point in the history
fix deprecation warning and check for electrode/particle diffusivity
  • Loading branch information
valentinsulzer authored Mar 7, 2024
2 parents e765855 + 801de39 commit dfdc376
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions pybamm/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ def __getitem__(self, key):
try:
return super().__getitem__(key)
except KeyError:
if "electrode diffusivity" in key:
if "particle diffusivity" in key:
warn(
f"The parameter '{key}' has been renamed to '{key.replace('electrode', 'particle')}'",
f"The parameter '{key.replace('particle', 'electrode')}' "
f"has been renamed to '{key}'",
DeprecationWarning,
)
return super().__getitem__(key.replace("electrode", "particle"))
return super().__getitem__(key.replace("particle", "electrode"))
if key in ["Negative electrode SOC", "Positive electrode SOC"]:
domain = key.split(" ")[0]
raise KeyError(
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_fuzzy_dict(self):
"SEI current": 3,
"Lithium plating current": 4,
"A dimensional variable [m]": 5,
"Positive particle diffusivity [m2.s-1]": 6,
"Positive electrode diffusivity [m2.s-1]": 6,
}
)
self.assertEqual(d["test"], 1)
Expand Down

0 comments on commit dfdc376

Please sign in to comment.