-
-
Notifications
You must be signed in to change notification settings - Fork 572
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 771 secondary broadcast #776
Conversation
Codecov Report
@@ Coverage Diff @@
## master #776 +/- ##
==========================================
+ Coverage 98.38% 98.42% +0.04%
==========================================
Files 179 179
Lines 9916 9931 +15
==========================================
+ Hits 9756 9775 +19
+ Misses 160 156 -4
Continue to review full report at Codecov.
|
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.
looks great, thanks @tinosulzer ! just a few comments about docstrings/comments. not for this issue, but it might helpful to have a notebook that shows what the different broadcast types do, as i'm not sure it's obvious to new users why you need the different cases
pybamm/expression_tree/broadcasts.py
Outdated
|
||
class PrimaryBroadcast(Broadcast): | ||
"""A node in the expression tree representing a primary broadcasting operator. | ||
Broadcasts in a `primary` dimension only. That is, makes explicit copies |
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.
I'm not sure the "That is, makes explicit copies" is particularly clear?
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.
oh yeah I got distracted while writing this 😅
# electrode to particle | ||
if child.domain == []: | ||
pass | ||
elif child.domain[0] in [ |
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.
can we do a similar check that if the domain is current collector, the broadcast domain must be and electrode or separator?
pybamm/expression_tree/broadcasts.py
Outdated
|
||
|
||
class PrimaryBroadcast(Broadcast): | ||
class SecondaryBroadcast(Broadcast): | ||
"""A node in the expression tree representing a primary broadcasting operator. | ||
Broadcasts in a `primary` dimension only. That is, makes explicit copies |
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.
"secondary
dimension only", and as above the last part of this isn't clear to me
pybamm/expression_tree/broadcasts.py
Outdated
"See :meth:`Broadcast.check_and_set_domains`" | ||
|
||
# Can only do secondary broadcast from particle to electrode or from | ||
# current collector to electrode |
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.
from electrode to current collector?
"Clear domains, bypassing checks" | ||
self._domain = [] | ||
self._auxiliary_domains = {} | ||
|
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.
nice!
self.first_dimension = "r" | ||
self.second_dimension = "x" | ||
self.r_sol = first_dim_pts | ||
self.x_sol = second_dim_pts |
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.
nice job tidying this up!
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.
Have updated the docstrings and made the notebook, let me know if it's clearer
yep, this looks great thanks. the notebook is very clear! |
Description
Reformat broadcasting to make sure it's always done in the right order and get rid of hacks
Fixes #771
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: