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

bugfix(double-layer cap scaling): rescaling overpotential RHS by 1/a #2175

Merged
merged 1 commit into from
Jul 17, 2022

Conversation

bardsleypt
Copy link

@bardsleypt bardsleypt commented Jul 16, 2022

Description

Rescaling RHS of overpotential differential equation by 1/a to correct for proper non-dimensionalization for non-constant specific-surface areas (i.e., non-constant active material volume fractions and/or particle radii).

Changes include:

  • Updating full_surface_form_conductivity RHS to rescale RHS of
    negative-electrode overpotential DE by a factor of 1/a, which
    remains present upon non-dimensionalization
  • 1/a scaling only affects DFN models with 'surface form' =
    'differential' and any of the following:
    • non-constant particle radii across electrodes
    • non-constant active material volume fractions across electrodes
    • loss of active material enabled
    • other forms of non-constant specific surface areas 'a'

See Discussion #2142 for further details

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: $ flake8
  • All tests pass: $ python run-tests.py --unit
  • The documentation builds: $ cd docs and then $ make clean; make html

You can run all three 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

Changes include:
  - Updating full_surface_form_conductivity RHS to rescale RHS of
    negative-electrode overpotential DE by a factor of 1/a, which
    remains present upon non-dimensionalization
  - 1/a scaling only affects DFN models with 'surface form' =
    'differential' and any of the following:
    - non-constant particle radii across electrodes
    - non-constant active material volume fractions across electrodes
    - loss of active material enabled
    - other forms of non-constant specific surface areas 'a'
@bardsleypt
Copy link
Author

bardsleypt commented Jul 16, 2022

I ran the tests, but a lot of the casadi interface tests seemt to fail - likely because of my install. I have had a hard time getting the dev install to run successfully for an M1 mac - pip doesn't want to install scikits.odes so manual installs and tox installs all fail. Any advice on this is appreciated, otherwise maybe someone can check the tests for me on a proper dev-installed machine?

Figured for this PR its a small enough change that it shouldn't be causing significant issues, at least not that can't be obviously tracked (failing surface-form unit test for example).

@bardsleypt bardsleypt marked this pull request as ready for review July 16, 2022 16:55
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.

The CI will catch any failing tests, I would be very very surprised if these changes caused tests to fail

@codecov
Copy link

codecov bot commented Jul 17, 2022

Codecov Report

Merging #2175 (e92487d) into develop (d4c5880) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           develop    #2175   +/-   ##
========================================
  Coverage    99.35%   99.35%           
========================================
  Files          356      356           
  Lines        19357    19357           
========================================
  Hits         19233    19233           
  Misses         124      124           
Impacted Files Coverage Δ
...e_potential_form/full_surface_form_conductivity.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d4c5880...e92487d. Read the comment docs.

@valentinsulzer
Copy link
Member

@all-contributors add @bardsleypt for bugs, code

@valentinsulzer valentinsulzer merged commit 72d1695 into pybamm-team:develop Jul 17, 2022
@allcontributors
Copy link
Contributor

@tinosulzer

I've put up a pull request to add @bardsleypt! 🎉

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.

2 participants