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

replacing rounded faraday constant with exact value in bpx.py #4290

Merged
merged 10 commits into from
Jul 31, 2024

Conversation

dion-w
Copy link
Contributor

@dion-w dion-w commented Jul 24, 2024

Description

The faraday constant has an exact value, calculated by the exact values of the avogadro constant and the elementray charge [see here]. Using a rounded value may introduce systemic errors further down the line that can be easily avoided with this new value.

Fixes # (issue)

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
  • [not needed] Tests added that prove fix is effective or that feature works

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.46%. Comparing base (f255c38) to head (ffb465a).
Report is 163 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4290   +/-   ##
========================================
  Coverage    99.45%   99.46%           
========================================
  Files          288      288           
  Lines        22091    22079   -12     
========================================
- Hits         21971    21960   -11     
+ Misses         120      119    -1     

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

dion-w and others added 2 commits July 24, 2024 13:37
Copy link
Member

@arjxn-py arjxn-py left a comment

Choose a reason for hiding this comment

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

Thanks @dion-w, looks good

Copy link
Member

@agriyakhetarpal agriyakhetarpal left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, @dion-w! Just a small suggestion on the style for the CHANGELOG entry (maybe we should catch things like this with a Markdown linter as well).

CHANGELOG.md Outdated Show resolved Hide resolved
@rtimms
Copy link
Contributor

rtimms commented Jul 24, 2024

FYI you can do pybamm.constants.F or pybamm.constants.F.value if you need a number instead of a symbol.

@kratman
Copy link
Contributor

kratman commented Jul 24, 2024

FYI you can do pybamm.constants.F or pybamm.constants.F.value if you need a number instead of a symbol.

I agree, using a constant from a library is better than updating this file.

One other thing to check would be if the BPX standard specifies a value for Faraday constant. Sometimes standards specify the precision to ensure that things are constant between implementations

pybamm/parameters/bpx.py Outdated Show resolved Hide resolved
@agriyakhetarpal agriyakhetarpal requested a review from kratman July 31, 2024 11:09
@agriyakhetarpal
Copy link
Member

Re-requested review/approval from @kratman since he previously requested changes

@kratman kratman merged commit 8983f43 into pybamm-team:develop Jul 31, 2024
26 checks passed
js1tr3 pushed a commit to js1tr3/PyBaMM that referenced this pull request Aug 12, 2024
…-team#4290)

* updated faraday constant to exact value in bpx.py

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Agriya Khetarpal <[email protected]>

* Update CHANGELOG.md

* Update pybamm/parameters/bpx.py

Co-authored-by: Eric G. Kratz <[email protected]>

* Update CHANGELOG.md

Co-authored-by: Agriya Khetarpal <[email protected]>

---------

Co-authored-by: Agriya Khetarpal <[email protected]>
Co-authored-by: Eric G. Kratz <[email protected]>
Co-authored-by: Arjun Verma <[email protected]>
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.

5 participants