-
Notifications
You must be signed in to change notification settings - Fork 16
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
Feature: polyhedral cross-section current sources and a general VIM formulation of 3-D magnetostatics #2703
Conversation
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.
First run through, looks good gonna run the tests etc now
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.
Other than the tests I'm happy
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
9c89448
to
27706d8
Compare
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #2703 +/- ##
===========================================
- Coverage 79.97% 79.75% -0.23%
===========================================
Files 222 223 +1
Lines 24755 24986 +231
===========================================
+ Hits 19799 19928 +129
- Misses 4956 5058 +102 ☔ View full report in Codecov by Sentry. |
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
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.
On the whole looks good. A couple of questions. I'll add the test plotting stuff as its minor
also there is still an extra warning lying about: /home/runner/work/bluemira/bluemira/bluemira/magnetostatics/polyhedral_prism.py:323: NumbaPerformanceWarning: np.dot() is faster on contiguous arrays, called on (Array(float64, 1, 'C', False, aligned=True), Array(float64, 1, 'A', False, aligned=True) |
and possibly a rebase to bring in the new ruff config |
…2751) * arbitrary planar polyhedral * arbitrary planar polyhedral proper * DRY * 2d ring test with plot and point * added multiple points around circuit for single point test * tidy/remove commented lines * add tests * remove duplication from rebase and alterations to TestPolyhedral2DRing * reduced discretisation to lower run time and tolerance for 2DRing test * addded more points for below coil and changed method of array comparison * marked TestPolyhedral2DRing as longrun * reshuffle tests * reduce runtime and numpy asserts --------- Co-authored-by: CoronelBuendia <matti.coleman@gmail.com>
* add some text * add example python doc * add pic * fix doc * added python doc, pic and text * equal angles examples * modify picture * add note to documentation about limitations * missing word * Add cubic term that was missing in B field equation --------- Co-authored-by: Jonathan Matthews <jonathan.matthews@ukaea.uk> Co-authored-by: kj5248 <115085094+kj5248@users.noreply.github.com>
* make functions private * add __all__ * add note on kernels * first pass JITted source geometry * implement fabbri * reshuffle a little * clean up and JIT utilities * first pass JIT bottura * docstring * make arrays contiguous --------- Co-authored-by: Matti <matti.coleman@ukaea.uk>
2834b55
to
81e35f1
Compare
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
…ormulation of 3-D magnetostatics (#2703) * baseclasses and housekeeping * pause because PROCESS * 6 hours * write asserts * vector potential * add failing babic test * add singularity protection * add singularity protection * typing * add plotting to Babic Aykel test * baseclass shenanigans * DRY mixin * working arbirtrary geometry * clean up * clean up * kill some list reflection but still not fully JIT * fix signatures * add triangle test * rotate midpoints too * comments and clearer code * add some docstring equations * more docstring equations * parametrise babic aykel test * more source doucmentation * parametrise maths test * remove useless baseclass and make everything private * make more stuff private * make stuff private everywhere * better file docstring * biot savart private points * fix some polyhedral tests * add trapezoidal test * add polyhedral test... that fails too * add polyhedral test... that fails too * add polyhedral test... that fails too * add temporary sanity check * add geometry test * added test to check whether combined shape matching single shape (#2718) * added test to check whether combined shape matching single shape * fix duplication * add teardown method for each class * Add an alternative polyhedral VIM formulation (#2731) * working bottura * get rid of some minuses * kernel start * docstrings * ruff * make tests better written * more maths * fix API documentation * Add `ArbitraryPlanarPolyhedralXSCircuit` (#2704) * add baseclass * arbitrary planar polyhedral * arbitrary planar polyhedral proper * add tests * addplot test * DRY * remove unused zip * rebase and fix circuit tests * fix tests and add error for angles * better error * add vector potential flux test * remove sanity check * docstring change * copyright and remove tools * sonarcloud bug * Add test using ArbitraryPlanarPolyhedralXSCircuit for a 2D ring coil (#2751) * arbitrary planar polyhedral * arbitrary planar polyhedral proper * DRY * 2d ring test with plot and point * added multiple points around circuit for single point test * tidy/remove commented lines * add tests * remove duplication from rebase and alterations to TestPolyhedral2DRing * reduced discretisation to lower run time and tolerance for 2DRing test * addded more points for below coil and changed method of array comparison * marked TestPolyhedral2DRing as longrun * reshuffle tests * reduce runtime and numpy asserts --------- Co-authored-by: CoronelBuendia <matti.coleman@gmail.com> * `PolyhedralPrismCurrentSource` documentation (#2705) * add some text * add example python doc * add pic * fix doc * added python doc, pic and text * equal angles examples * modify picture * add note to documentation about limitations * missing word * Add cubic term that was missing in B field equation --------- Co-authored-by: Jonathan Matthews <jonathan.matthews@ukaea.uk> Co-authored-by: kj5248 <115085094+kj5248@users.noreply.github.com> * code smells * JIT `PolyhedralPrism` even more, and remove reflected lists (#2874) * make functions private * add __all__ * add note on kernels * first pass JITted source geometry * implement fabbri * reshuffle a little * clean up and JIT utilities * first pass JIT bottura * docstring * make arrays contiguous --------- Co-authored-by: Matti <matti.coleman@ukaea.uk> * plt show/close is automatic now * 🎨 Ruff * make tests check symmetry of field * resolve numba warning * trigger ruff * run precommit * fix sonarcloud issue --------- Co-authored-by: kj5248 <115085094+kj5248@users.noreply.github.com> Co-authored-by: Jonathan Matthews <jonathan.matthews@ukaea.uk> Co-authored-by: Matti <matti.coleman@ukaea.uk> Co-authored-by: je-cook <81617086+je-cook@users.noreply.github.com> Co-authored-by: james <james.cook1@ukaea.uk>
…ormulation of 3-D magnetostatics (#2703) * baseclasses and housekeeping * pause because PROCESS * 6 hours * write asserts * vector potential * add failing babic test * add singularity protection * add singularity protection * typing * add plotting to Babic Aykel test * baseclass shenanigans * DRY mixin * working arbirtrary geometry * clean up * clean up * kill some list reflection but still not fully JIT * fix signatures * add triangle test * rotate midpoints too * comments and clearer code * add some docstring equations * more docstring equations * parametrise babic aykel test * more source doucmentation * parametrise maths test * remove useless baseclass and make everything private * make more stuff private * make stuff private everywhere * better file docstring * biot savart private points * fix some polyhedral tests * add trapezoidal test * add polyhedral test... that fails too * add polyhedral test... that fails too * add polyhedral test... that fails too * add temporary sanity check * add geometry test * added test to check whether combined shape matching single shape (#2718) * added test to check whether combined shape matching single shape * fix duplication * add teardown method for each class * Add an alternative polyhedral VIM formulation (#2731) * working bottura * get rid of some minuses * kernel start * docstrings * ruff * make tests better written * more maths * fix API documentation * Add `ArbitraryPlanarPolyhedralXSCircuit` (#2704) * add baseclass * arbitrary planar polyhedral * arbitrary planar polyhedral proper * add tests * addplot test * DRY * remove unused zip * rebase and fix circuit tests * fix tests and add error for angles * better error * add vector potential flux test * remove sanity check * docstring change * copyright and remove tools * sonarcloud bug * Add test using ArbitraryPlanarPolyhedralXSCircuit for a 2D ring coil (#2751) * arbitrary planar polyhedral * arbitrary planar polyhedral proper * DRY * 2d ring test with plot and point * added multiple points around circuit for single point test * tidy/remove commented lines * add tests * remove duplication from rebase and alterations to TestPolyhedral2DRing * reduced discretisation to lower run time and tolerance for 2DRing test * addded more points for below coil and changed method of array comparison * marked TestPolyhedral2DRing as longrun * reshuffle tests * reduce runtime and numpy asserts --------- Co-authored-by: CoronelBuendia <matti.coleman@gmail.com> * `PolyhedralPrismCurrentSource` documentation (#2705) * add some text * add example python doc * add pic * fix doc * added python doc, pic and text * equal angles examples * modify picture * add note to documentation about limitations * missing word * Add cubic term that was missing in B field equation --------- Co-authored-by: Jonathan Matthews <jonathan.matthews@ukaea.uk> Co-authored-by: kj5248 <115085094+kj5248@users.noreply.github.com> * code smells * JIT `PolyhedralPrism` even more, and remove reflected lists (#2874) * make functions private * add __all__ * add note on kernels * first pass JITted source geometry * implement fabbri * reshuffle a little * clean up and JIT utilities * first pass JIT bottura * docstring * make arrays contiguous --------- Co-authored-by: Matti <matti.coleman@ukaea.uk> * plt show/close is automatic now * 🎨 Ruff * make tests check symmetry of field * resolve numba warning * trigger ruff * run precommit * fix sonarcloud issue --------- Co-authored-by: kj5248 <115085094+kj5248@users.noreply.github.com> Co-authored-by: Jonathan Matthews <jonathan.matthews@ukaea.uk> Co-authored-by: Matti <matti.coleman@ukaea.uk> Co-authored-by: je-cook <81617086+je-cook@users.noreply.github.com> Co-authored-by: james <james.cook1@ukaea.uk>
Linked Issues
Closes #1816 (almost)
This is useful for STEP, in that arbitrary cross-section conductors can be used, but I was interested in this stuff because I needed a general way to do volume integrals to calculate things like vector potential, and then self-inductance, etc. It's also potentially useful for stellarators, in that the conductors no longer need to be planar.
UPDATE (matti): As discussed 11/12 with the STEP team, at present we have only been successful in implementing a VIM method for arbitrary cross-sections with div J = 0 (equal end-cap angles). As it is possible to model their desired geometry using such a source term, I will update this feature branch to bring in an equal-angle VIM formulation with the necessary caveats. At a later date, and if a suitable implementation can be developed, we can replace it with a more general formulation.
Description
Adds
PolyhedralPrismCurrentSource
where you specify a set of x-zCoordinates
rather than rectangular dimensions.I've benchmarked results against the
RectangularPrismCurrentSource
, and it is a mixed bag:More generally, the formulation does allow for arbitrary construction of conducting geometry, and we may want to provide a mesh interface for this volume integral approach
NOTE:
RectangularPrismCurrentSource
will stay alive for the foreseeable future. It's considerably faster. I have yet to fully JIT the polyhedral one because of reflected list issues, but I did performance benchmark a fully JIT-ed version of the polyhedral stuff for n=4 (dodging list reflection) and it is still much, much slower.Interface Changes
Checklist
I confirm that I have completed the following checks:
pytest tests --reactor
pre-commit run --from-ref develop --to-ref HEAD
sphinx-build -W documentation/source documentation/build