-
Notifications
You must be signed in to change notification settings - Fork 40
Add OmnigenityHarmonics Objective and new OmnigenousField types #1845
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
base: master
Are you sure you want to change the base?
Conversation
Memory benchmark result| Test Name | %Δ | Master (MB) | PR (MB) | Δ (MB) | Time PR (s) | Time Master (s) |
| -------------------------------------- | ------------ | ------------------ | ------------------ | ------------ | ------------------ | ------------------ |
test_objective_jac_w7x | 1.81 % | 3.912e+03 | 3.983e+03 | 70.78 | 38.06 | 34.75 |
test_proximal_jac_w7x_with_eq_update | 1.48 % | 6.512e+03 | 6.608e+03 | 96.38 | 155.35 | 158.39 |
test_proximal_freeb_jac | 0.51 % | 1.318e+04 | 1.325e+04 | 67.17 | 80.21 | 80.21 |
test_proximal_freeb_jac_blocked | 0.96 % | 7.610e+03 | 7.683e+03 | 73.39 | 72.81 | 72.60 |
test_proximal_freeb_jac_batched | 0.03 % | 7.619e+03 | 7.621e+03 | 2.52 | 73.42 | 70.98 |
test_proximal_jac_ripple | -2.02 % | 3.493e+03 | 3.422e+03 | -70.68 | 59.97 | 60.17 |
test_proximal_jac_ripple_bounce1d | -1.32 % | 3.532e+03 | 3.485e+03 | -46.68 | 77.35 | 76.65 |
test_eq_solve | 2.93 % | 1.984e+03 | 2.042e+03 | 58.14 | 128.29 | 126.75 |For the memory plots, go to the summary of |
|
For the tests to pass you should add the new objectives to the "specials" list as they need extra arguments compared to the typical objective, for example see DESC/tests/test_objective_funs.py Line 3169 in 4e87d19
If you can do this we can then make sure the normal tests pass. You should also add some tests like what exist for Omnigenity in test_objective_funs.py |
|
Another big code-related change would be to create a PR from a branch on the DESC repo, not on a fork from your repo. Edit: Ah, I remember some of the issues. Checking out and updating your PR becomes difficult on a cluster. |
|
some TODO items I see as needed for this PR:
For the point on S_function and D_function, perhaps a possible solution could be to use pickle to save them as .p files? I assume the functional forms are more complex than just fourier series (and hence must be stored instead of just storing the coefficients) for the piecewise omnigenity equilibria specifically? otherwise d_n and s_n would be sufficient info? |
64fb032 to
48b4b18
Compare
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
5e112c8 to
a6ab72c
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1845 +/- ##
==========================================
+ Coverage 95.78% 95.81% +0.03%
==========================================
Files 101 101
Lines 27728 28258 +530
==========================================
+ Hits 26558 27076 +518
- Misses 1170 1182 +12
🚀 New features to boost your workflow:
|
4918c3c to
df5a28d
Compare
…d OOPS OmnigenousField Add:OmnigenousField with Landreman-Catto mapping, workable with OmnigenousHarmonics Method
…e Transform; merge plotting functions; consolidate similar quantities in compute; add test cases; and provide tutorials.
Significantly improve the performance speed and memory of bounce integrals by factor of >=10 for computation of problem sizes in the tests, and larger improvements for bigger problems and Jacobian. - [x] Resolves PlasmaControl#1154 - [x] Resolves PlasmaControl#1294 - [x] Resolves PlasmaControl#1574 - [x] Resolves PlasmaControl#1851 - [x] Resolves PlasmaControl#1864 (not the actual regression, just makes computation less painful). - [x] Resolves PlasmaControl#1938
39b1d34 to
995d1f0
Compare
Description
This pull request introduces the OOPS (Omnigenity OPtimization like quasi-Symmetry) method into DESC, as described in [1]. OOPS leverages the concept of a homeomorphism to enable the optimization of omnigenity, as well as other concepts like pseudo-symetry and piecewise omnigenity, in spectral space, analogous to the optimization of quasisymmetry. A key advantage of this method is that it is independent of any specific parameterization. One can use the Cary-Shasharina mapping [2], the Landreman-Catto mapping [3], the current DESC mapping, or any others. It only requires a method for constructing the target magnetic field. Generally, it has better roubustness. The goal of this PR is to implement OOPS within DESC's flexible and efficient framework.
To facilitate discussion, I have created this Draft Pull Request. See same issue in #1846
Core Changes
The main changes included in this PR are:
OmnigenousFieldTypes: Two new parameterizations for omnigenous fields have been added inmagnetic_field/_core.py:OmnigenousFieldOOPS: The example mapping used in the OOPS paper [1].OmnigenousFieldLCForm: The mapping form proposed by Landreman et al. [3], referred to here as the "LCForm".OmnigenityHarmonicsObjective: A new objective,OmnigenityHarmonics, has been added toobjectives/_omnigenity.py. This objective enables the direct optimization ofOmnigenousField,OmnigenousFieldOOPS, andOmnigenousFieldLCFormin spectral space.compute/_omnigenity.py. The core addition is the function_B_omni_nonsymmetric, which calculates the non-symmetric components of the omnigenous field,B(η,α).plot_boozer_surface_XXXroutines forOmnigenousFieldOOPSandOmnigenousFieldLCFormhave been implemented inplotting.py.Examples
Here are some examples in Ref. [1]. They can be optimized using DESC. We have implemented an optimization workflow in DESC with objectives, procedures, and resolutions that are nearly identical to the corresponding SIMSOPT scripts. Following the same process, starting from a circular torus, we use a resolution continuation method to optimize the configuration up to a spectral resolution of

M=N=7. Depending on whether jax-cache is enabled, a precisely poloidal omnigenous (PO) configuration can be optimized within 10-15 minutes on a single NVIDIA RTX 5090 GPU. (With a configuration nearly identical to the one described in Ref. [1])Known I/O Limitation
While the I/O interface can successfully save and load the degrees of freedom of
OmnigenousFieldLCForm(s_dofs,d_dofs), it does not currently support serializing the function definitions themselves. This means that when loading from a saved state, the user must manually re-supply the Python functions forS_functionandD_function.References
[1] H. Liu, G. Yu, et al., "Optimizing omnigenity like quasisymmetry for stellarators," arxiv:2502.09350 (2025).
[2] J. R. Cary and S. G. Shasharina, Helical Plasma Confinement Devices with Good Confinement Properties, Phys. Rev. Lett. 78, 674 (1997).
[3] M. Landreman and P. J. Catto, "Omnigenity as generalized quasisymmetry," Physics of Plasmas 19, 056103 (2012).