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

Issue 609 broadcast to cell edges #891

Merged
merged 7 commits into from Mar 16, 2020

Conversation

valentinsulzer
Copy link
Member

Description

Add BroadcastToEdge object and edit fluxes in relevant submodels to use this.
Also edited the particle submodels, hopefully a bit clearer now.

Fixes #609

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 15, 2020

Codecov Report

Merging #891 into develop will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #891      +/-   ##
===========================================
+ Coverage    97.79%   97.79%   +<.01%     
===========================================
  Files          210      207       -3     
  Lines        10603    10631      +28     
===========================================
+ Hits         10369    10397      +28     
  Misses         234      234
Impacted Files Coverage Δ
...well/diffusion/leading_stefan_maxwell_diffusion.py 100% <100%> (ø) ⬆️
...models/submodels/thermal/x_lumped/base_x_lumped.py 100% <100%> (ø) ⬆️
...bamm/models/full_battery_models/lithium_ion/dfn.py 100% <100%> (ø) ⬆️
pybamm/expression_tree/independent_variable.py 100% <100%> (ø) ⬆️
...m/models/submodels/particle/fast_many_particles.py 100% <100%> (ø)
.../models/submodels/particle/fast_single_particle.py 100% <100%> (ø)
pybamm/expression_tree/broadcasts.py 100% <100%> (ø) ⬆️
pybamm/spatial_methods/spatial_method.py 95.95% <100%> (+0.17%) ⬆️
...amm/models/submodels/oxygen_diffusion/no_oxygen.py 100% <100%> (ø) ⬆️
pybamm/geometry/standard_spatial_vars.py 100% <100%> (ø) ⬆️
... and 12 more

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 986ff2c...afc9e73. Read the comment docs.

Copy link
Contributor

@rtimms rtimms left a comment

Choose a reason for hiding this comment

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

looks good thanks!

@@ -901,6 +901,9 @@ def x_average(symbol):
:class:`Symbol`
the new averaged symbol
"""
# Can't take average if the symbol evaluates on edges
Copy link
Contributor

Choose a reason for hiding this comment

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

why can't we average on edges? is it just that it isn't implemented? (if so, no need to do this now. it can be a separate issue if/when we need it)

Copy link
Member Author

Choose a reason for hiding this comment

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

No reason why we can't in theory. I'm not sure what the proper implementation would be in a finite volume context though? For nodes it's clearly just sum all the values, but for edges I don't know what it should be: maybe N[-1] - N[0]?

@valentinsulzer valentinsulzer merged commit c20d403 into develop Mar 16, 2020
@valentinsulzer valentinsulzer deleted the issue-609-broadcast-to-cell-edges branch March 16, 2020 13:41
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.

Broadcast to cell edges
2 participants