Add errors, to MagneticWell and MercierStability objectives if grid contains axis.#2098
Open
Add errors, to MagneticWell and MercierStability objectives if grid contains axis.#2098
Conversation
…ves if grid contains axis.
Contributor
Memory benchmark result| Test Name | %Δ | Master (MB) | PR (MB) | Δ (MB) | Time PR (s) | Time Master (s) |
| -------------------------------------- | ------------ | ------------------ | ------------------ | ------------ | ------------------ | ------------------ |
test_objective_jac_w7x | 6.15 % | 3.824e+03 | 4.059e+03 | 235.11 | 39.56 | 36.64 |
test_proximal_jac_w7x_with_eq_update | 0.13 % | 6.655e+03 | 6.664e+03 | 8.86 | 165.25 | 162.83 |
test_proximal_freeb_jac | -0.22 % | 1.323e+04 | 1.320e+04 | -29.54 | 84.41 | 84.21 |
test_proximal_freeb_jac_blocked | -0.72 % | 7.559e+03 | 7.505e+03 | -54.43 | 74.79 | 72.45 |
test_proximal_freeb_jac_batched | 0.62 % | 7.454e+03 | 7.501e+03 | 46.36 | 73.57 | 72.56 |
test_proximal_jac_ripple | -1.35 % | 3.509e+03 | 3.462e+03 | -47.24 | 68.07 | 64.45 |
test_proximal_jac_ripple_bounce1d | -1.16 % | 3.573e+03 | 3.531e+03 | -41.40 | 76.42 | 76.51 |
test_eq_solve | -4.15 % | 2.091e+03 | 2.004e+03 | -86.77 | 94.73 | 93.91 |For the memory plots, go to the summary of |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2098 +/- ##
==========================================
- Coverage 94.52% 94.52% -0.01%
==========================================
Files 102 102
Lines 28785 28786 +1
==========================================
Hits 27210 27210
- Misses 1575 1576 +1
🚀 New features to boost your workflow:
|
ddudt
reviewed
Feb 19, 2026
desc/objectives/_stability.py
Outdated
Comment on lines
292
to
299
| errorif( | ||
| grid.axis.size, | ||
| ValueError, | ||
| "MagneticWell objective grid cannot contain an axis point, " | ||
| "as its on-axis limit is always zero." | ||
| " Instead, pass axis=False when making the grid, which will " | ||
| " automatically place a grid point close but not at rho=0.", | ||
| ) |
Collaborator
There was a problem hiding this comment.
I would prefer if we are able to correctly implement the axis limit, since it should be well defined and always 0.
Collaborator
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #2097 by ensuring the situation (which is a bit nonsensical anyways) is not reachable by the user.
Enforces what we already had assumed which was that the user should never pass an on-axis grid point to the MagneticWell or MercierStability objectives (the latter bc it is undefined and should be NaN, the former because it is just zero on-axis anyways by definition of its limit, and also we get NaN in the reverse mode gradient of the on-axis point)