Skip to content

Issue 1253 reformat dfn half cell - #1282

Merged
brosaplanella merged 19 commits into
pybamm-team:developfrom
brosaplanella:issue-1253-reformat-dfn-half-cell
Dec 22, 2020
Merged

brosaplanella merged 19 commits into
pybamm-team:developfrom
brosaplanella:issue-1253-reformat-dfn-half-cell

Conversation

@brosaplanella

@brosaplanella brosaplanella commented Dec 9, 2020 •

Copy link
Copy Markdown
Member

Description

Reformatted the Basic DFN half-cell model. In the new setup, the lithium counter always sits on the left and the working electrode on the right. The new geometry has a working electrode and a working particle.

Fixes #1253

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

@brosaplanella
brosaplanella marked this pull request as draft December 9, 2020 10:09
@codecov

codecov Bot commented Dec 9, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #1282 (ad0144e) into develop (96029c0) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #1282   +/-   ##
========================================
  Coverage    98.09%   98.10%           
========================================
  Files          270      272    +2     
  Lines        15155    15214   +59     
========================================
+ Hits         14866    14925   +59     
  Misses         289      289           
Impacted Files Coverage Δ
pybamm/expression_tree/symbol.py 98.57% <ø> (ø)
pybamm/solvers/processed_variable.py 99.61% <ø> (ø)
pybamm/expression_tree/unary_operators.py 100.00% <100.00%> (ø)
pybamm/geometry/half_cell_geometry.py 100.00% <100.00%> (ø)
pybamm/geometry/half_cell_spatial_vars.py 100.00% <100.00%> (ø)
..._battery_models/lithium_ion/basic_dfn_half_cell.py 99.31% <100.00%> (+0.09%) ⬆️
pybamm/parameters/geometric_parameters.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 96029c0...ad0144e. Read the comment docs.

@brosaplanella
brosaplanella marked this pull request as ready for review December 9, 2020 18:54

@valentinsulzer valentinsulzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @brosaplanella , looks good, but my worry is this is going to have to be developed completely separately from the existing submodel structure (including degradation mechanisms, etc)

"separator": 13,
"positive electrode": 17,
"working electrode": 19,
"working particle": 23,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Need to check why this was necessary but not urgent

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think this has to do because the separator and current collector were defined in fixed_domain_sizes but the new domains weren't, so when they interact it breaks down...

Also, random question related to that. When we get the size of a variable defined in a domain in fixed_domain_sizes, why do we take the sum and not the product? I thought the idea of assigning prime numbers to the domains was to get unique signatures for each combination.

Comment thread pybamm/models/full_battery_models/lithium_ion/basic_dfn_half_cell.py Outdated
@brosaplanella

Copy link
Copy Markdown
Member Author

Thanks @brosaplanella , looks good, but my worry is this is going to have to be developed completely separately from the existing submodel structure (including degradation mechanisms, etc)

I agree. I was debating if I wanted to created the PR until I had integrated it into the submodel structure, but I thought it would be much better to get feedback at this stage.

The problem with the old version, apart from signs changing depending on which is the working electrode, was that you got a lot of unused variables. Probably this is not ideal either though... Is there any other way we can do this? The only way I can think of bringing all the models closer together is by redefining them so you can define each electrode separately, but that would be a major reformat of PyBaMM...

@TomTranter

Copy link
Copy Markdown
Contributor

I was running the DFN_half_cell example and changing "Lithium counter electrode thickness [m]" and it didn't appear to change anything...

@brosaplanella

Copy link
Copy Markdown
Member Author

I was running the DFN_half_cell example and changing "Lithium counter electrode thickness [m]" and it didn't appear to change anything...

This only appears in the Ohmic losses in the lithium counter, but the conductivity is so high that you probably won't see any change unless you plug in a massive lithium counter.

@brosaplanella
brosaplanella merged commit cbacc30 into pybamm-team:develop Dec 22, 2020
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.

Reformat DFN half-cell

3 participants