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

Tanks in series #4310

Draft
wants to merge 19 commits into
base: develop
Choose a base branch
from
Draft

Tanks in series #4310

wants to merge 19 commits into from

Conversation

parkec3
Copy link
Contributor

@parkec3 parkec3 commented Aug 1, 2024

Tanks-In-Series Model

Implementation of the tanks in series model within Pybamm. Based on DOI: 10.1149/2.0342001JES.

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

codecov bot commented Aug 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.46%. Comparing base (1e3f139) to head (e121f32).
Report is 4 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4310      +/-   ##
===========================================
- Coverage    99.50%   99.46%   -0.05%     
===========================================
  Files          289      290       +1     
  Lines        22146    22242      +96     
===========================================
+ Hits         22037    22123      +86     
- Misses         109      119      +10     

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

@parkec3
Copy link
Contributor Author

parkec3 commented Aug 1, 2024

I have the model written up in a .py file, but I think there is an issue with domains/discretization. I'm getting this error when I run the following code:

image image

Initially, I got an error of size (400,1) vs (1,1), and then I used pybamm.x_average(param.n.prim.c_init) on the initial conditions for the negative particle concentration, but the size still doesn't match up.

@valentinsulzer
Copy link
Member

You need to average in both x- and r-directions, you can use param.n.prim.c_init_av which is already averaged

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.

Definitely on the right track! Still needs tests and documentations, we can talk about how to add those.

@parkec3
Copy link
Contributor Author

parkec3 commented Aug 2, 2024

It seems to be working now with Chen2020 parameter set.

@rtimms
Copy link
Contributor

rtimms commented Aug 4, 2024

Looking good! Have you done a comparison to other models, e.g. using this example?

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.

3 participants