PyBaMM icon indicating copy to clipboard operation
PyBaMM copied to clipboard

Tanks in series

Open parkec3 opened this issue 1 year ago • 5 comments

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.

  • [x] 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:

  • [x] 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

parkec3 avatar Aug 01 '24 20:08 parkec3

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.46%. Comparing base (1e3f139) to head (e121f32). Report is 344 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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 01 '24 20:08 codecov[bot]

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.

parkec3 avatar Aug 01 '24 21:08 parkec3

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

valentinsulzer avatar Aug 01 '24 21:08 valentinsulzer

It seems to be working now with Chen2020 parameter set.

parkec3 avatar Aug 02 '24 20:08 parkec3

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

rtimms avatar Aug 04 '24 23:08 rtimms

@parkec3 I am going to close this for now, we can re-open it in the future if you would like

kratman avatar Nov 04 '24 22:11 kratman