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

Cylindrical geometry operators #1824

Merged
merged 19 commits into from
Dec 3, 2021
Merged

Conversation

rtimms
Copy link
Contributor

@rtimms rtimms commented Nov 23, 2021

Description

Adds cylindrical finite volume method.

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 Nov 23, 2021

Codecov Report

Merging #1824 (826ff44) into develop (603fad8) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #1824   +/-   ##
========================================
  Coverage    99.26%   99.26%           
========================================
  Files          345      345           
  Lines        18954    18979   +25     
========================================
+ Hits         18815    18840   +25     
  Misses         139      139           
Impacted Files Coverage Δ
pybamm/spatial_methods/spectral_volume.py 98.11% <ø> (ø)
pybamm/expression_tree/independent_variable.py 100.00% <100.00%> (ø)
pybamm/geometry/battery_geometry.py 100.00% <100.00%> (ø)
pybamm/geometry/standard_spatial_vars.py 100.00% <100.00%> (ø)
pybamm/parameters/geometric_parameters.py 100.00% <100.00%> (ø)
pybamm/parameters/lithium_ion_parameters.py 100.00% <100.00%> (ø)
pybamm/spatial_methods/finite_volume.py 98.15% <100.00%> (+0.03%) ⬆️

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 603fad8...826ff44. 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.

Thanks, looks good! Lots of conflicts coming up with #1810 :(

@@ -30,6 +30,9 @@

y = pybamm.SpatialVariable("y", domain="current collector", coord_sys="cartesian")
z = pybamm.SpatialVariable("z", domain="current collector", coord_sys="cartesian")
r = pybamm.SpatialVariable(
"r", domain="current collector", coord_sys="cylindrical polar"
)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should be more specific with this one, like r_macro maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, I agree

Comment on lines 180 to 185
elif submesh.coord_sys == "cylindrical polar":
second_dim_repeats = self._get_auxiliary_domain_repeats(symbol.domains)

# create np.array of repeated submesh.edges
r_edges_numpy = np.kron(np.ones(second_dim_repeats), submesh.edges)
r_edges = pybamm.Vector(r_edges_numpy)
Copy link
Member

Choose a reason for hiding this comment

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

reduce code duplication here

2 * np.pi * (1 - r0),
decimal=3,
)

Copy link
Member

Choose a reason for hiding this comment

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

we really need to clean up this test file 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha tell me about it. My favourite bit was the test that said it was testing div(grad(r^2))=6 but it was actually testing div(grad(6))=0...

There's no rush to merge this, so I'll wait, fix conflicts with #1810 and also have a go at tidying up these tests a bit.

@rtimms rtimms merged commit 65d5cba into develop Dec 3, 2021
@rtimms rtimms deleted the cylindrical-geometry-operators branch December 3, 2021 19:49
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