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

Implement sodium-ion DFN #4451

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open

Implement sodium-ion DFN #4451

wants to merge 14 commits into from

Conversation

brosaplanella
Copy link
Sponsor Member

@brosaplanella brosaplanella commented Sep 18, 2024

Description

Implemented DFN for sodium-ion (same as lithium-ion but in a separate file to avoid conflicts). Implemented parameter value from Chayambuka et al (2022) (actual values and data taken from this COMSOL example).

When adding the CITATION I also modified many citation keys to be consistent with the format (FirstAuthorYear). Hence the many files changed.

Fixes #4397 (not an issue but a discussion)

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 (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

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link

codecov bot commented Sep 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.46%. Comparing base (5bb146f) to head (26631e0).
Report is 2 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff            @@
##           develop    #4451    +/-   ##
=========================================
  Coverage    99.46%   99.46%            
=========================================
  Files          293      297     +4     
  Lines        22381    22512   +131     
=========================================
+ Hits         22261    22392   +131     
  Misses         120      120            

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

Copy link
Contributor

@rtimms rtimms left a comment

Choose a reason for hiding this comment

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

thanks @brosaplanella looks good, can you add a test in the basic model tests? sorry, realise this is draft and not finished


class BasicDFN(pybamm.lithium_ion.BaseModel):
"""Doyle-Fuller-Newman (DFN) model of a sodium-ion battery, from
:footcite:t:`Marquis2019`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the Na-ion paper have the same model equations? It would be good to reference that paper here for more context I think, and then say eqns are from Marquis (except they aren't quite ahah)

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Not quite, but because I took the parameters from the COMSOL implementation it is actually quite similar to the Marquis et al. Happy to cite either, not sure what will be less confusing to the users.

@brosaplanella
Copy link
Sponsor Member Author

Doctests are failing but I don't know why. @agriyakhetarpal can you help with this?

Copy link
Member

@agriyakhetarpal agriyakhetarpal Sep 19, 2024

Choose a reason for hiding this comment

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

@brosaplanella, I can't comment on the line directly since it hasn't been modified, so I'm commenting on the file – the fix is in line 29. Changing it to

:footcite:t:`Rieger2016`

should fix the doctest failure.

"Positive particle diffusivity [m2.s-1]": NVPF_diffusivity_Chayambuka2022,
"Positive electrode OCP [V]": NVPF_ocp_Chayambuka2022,
"Positive electrode porosity": 0.23,
"Positive electrode active material volume fraction": 1 - 0.23 - 0.22,
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason why this is not just a single number?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

This number is not directly reported in the paper, they provide the other two and say everything adds up to one. Given that one needs to go through the paper to find this, I thought it would be better to leave it this way so it is apparent what's going on. I will add a comment to make it clear.

Copy link
Contributor

Choose a reason for hiding this comment

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

Personally, I think this just looks confusing. I don't see any harm in making it a single number

"Negative particle diffusivity [m2.s-1]": HC_diffusivity_Chayambuka2022,
"Negative electrode OCP [V]": HC_ocp_Chayambuka2022,
"Negative electrode porosity": 0.51,
"Negative electrode active material volume fraction": 1 - 0.51 - 0.001,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as the other comment

# `param` is a class containing all the relevant parameters and functions for
# this model. These are purely symbolic at this stage, and will be set by the
# `ParameterValues` class when the model is processed.
param = self.param
Copy link
Contributor

Choose a reason for hiding this comment

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

if these are the same, then why not just use self.param instead?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Actually, I just copied this from the lithium_ion BasicDFN. I believe we do that in all the basic models, so we don't have to do self.param every time (there any a lot of occurrences) and the code is easier to read. I personally think it is useful as it is easier to read through the model.

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