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

Newman tobias model #1423

Merged
merged 14 commits into from
Mar 12, 2021
Merged

Newman tobias model #1423

merged 14 commits into from
Mar 12, 2021

Conversation

rtimms
Copy link
Contributor

@rtimms rtimms commented Mar 10, 2021

Description

Adds a new lithium-ion model based on the formulation in JS Newman and CW Tobias. "Theoretical Analysis of Current Distribution in Porous Electrodes". Journal of The Electrochemical Society,1962.

The model assumes uniform (constant) concentration in the electrolyte and includes a single ODE in each electrode for the average particle concentration. Options can be passed to allow different particle models, but there is only ever a single particle in each electrode (i.e. we solve for the x-averaged concentration).

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

@codecov
Copy link

codecov bot commented Mar 10, 2021

Codecov Report

Merging #1423 (d14a041) into develop (0808b3e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #1423   +/-   ##
========================================
  Coverage    98.27%   98.28%           
========================================
  Files          279      280    +1     
  Lines        16131    16165   +34     
========================================
+ Hits         15853    15887   +34     
  Misses         278      278           
Impacted Files Coverage Δ
...m/models/full_battery_models/base_battery_model.py 99.67% <ø> (-0.01%) ⬇️
...models/full_battery_models/lithium_ion/__init__.py 100.00% <100.00%> (ø)
...s/full_battery_models/lithium_ion/newman_tobias.py 100.00% <100.00%> (ø)
...ls/electrolyte_diffusion/constant_concentration.py 100.00% <100.00%> (ø)
pybamm/simulation.py 97.94% <100.00%> (+<0.01%) ⬆️

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 0808b3e...d14a041. Read the comment docs.

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.

Looks great, thanks! Need to do changelog

@@ -95,14 +95,3 @@ def set_initial_conditions(self, variables):
c_e = variables["Electrolyte concentration"]

self.initial_conditions = {c_e: self.param.c_e_init}

def set_boundary_conditions(self, variables):
Copy link
Member

Choose a reason for hiding this comment

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

I think at some point we moved these into the submodels to be clearer what the submodels are. It's not too much repeated code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, I will put them back. I did it this way as you also need to provide boundary conditions for the constant concentration model so that grad(c_e) ends up having the correct shape.

@@ -168,6 +168,10 @@ def positive_radius(x):

param["Negative particle radius [m]"] = negative_radius
param["Positive particle radius [m]"] = positive_radius
# Only get 3dp of accuracy in some tests at 1C with particle distribution
# TODO: investigate if there is a bug or some way to improve the
# implementation
Copy link
Member

Choose a reason for hiding this comment

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

is this related to what @brosaplanella was seeing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

looks like it. you can get 4dp of accuracy everywhere else.

@rtimms rtimms merged commit 1a6aeda into develop Mar 12, 2021
@rtimms rtimms deleted the newman-tobias branch March 12, 2021 12:25
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