-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
Many-Particle Models #1529
Many-Particle Models #1529
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks great now!
You can merge develop and push again to trigger the tests with the fix to new_copy |
elif self.domain == "Positive": | ||
N_s_xav_distribution = -self.param.D_p( | ||
c_s_xav_distribution, T_k_xav | ||
) * pybamm.grad(c_s_xav_distribution) / R | ||
) * pybamm.grad(c_s_xav_distribution) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just to make the definition of the nondimensional flux consistent with FickianManyParticles
(where you can have a size distribution in x), and also the scaling used for the MP-DFN in our recent JES paper. The rhs
is unchanged, as the factor of / R
is just moved to lines 166 and 172, turning an / R
into / R ** 2
. Should make it easier to combine the "distribution" and "no distribution" submodels later on.
Meant to make this change much earlier, but seems I forgot. Sorry for the confusion here!
Codecov Report
@@ Coverage Diff @@
## develop #1529 +/- ##
===========================================
+ Coverage 97.78% 97.84% +0.05%
===========================================
Files 323 329 +6
Lines 17552 17987 +435
===========================================
+ Hits 17164 17599 +435
Misses 388 388
Continue to review full report at Codecov.
|
To describe the last few commits: I've added a few more tests to increase the coverage, particularly for For the |
Yeah we could definitely reduce some duplication in the processed variable tests |
Had a go at reducing the duplication by moving code into a method |
@all-contributors add @tobykirk for ideas, code, tests |
@tinosulzer I've put up a pull request to add @tobykirk! 🎉 |
Description
This branch adds the Many-Particle Model or MPM, a full lithium-ion battery model including a distribution of particle sizes in each electrode. The particle size is implemented as an additional "dimension", where the user specifies the continuous particle-size distribution which is then discretized. The model, it's features and how to use it are detailed in the notebook
examples/notebooks/MPM.ipynb
.Included is a new submodel module
particle.size_distribution
with 2 submodelsFickianSingleSizeDistribution
andFastSingleSizeDistribution
(and a base distribution model) used by the MPM. These are the "X-averaged" ones, with submodels incorporating x-variation (FickianManySizeDistributions
, etc.) to be merged later (pending the ability to have 4 domains). Changes to the existing code are currently quite minimal (probably to a fault!), mainly adding functionality where possible.The branch includes all the base functionality for the new "particle size" domain/dimension, including additions to
R_n
andR_p
)f_a_dist_n
,f_a_dist_p
)BaseInterface
andBaseKinetics
(where special treatment of variables that depend on "particle size" is needed)ProcessedVariable
QuickPlot
R_average()
operator, for convenient particle-size averagingNot currently compatible with the degradation models, i.e., SEI, particle cracking/swelling, lithium plating - they are not allowed as options.
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.
Key checklist:
$ flake8
$ python run-tests.py --unit
$ cd docs
and then$ make clean; make html
You can run all three at once, using
$ python run-tests.py --quick
.Further checks: