hiddenSymmetries / simsopt

Simons Stellarator Optimizer Code
https://simsopt.readthedocs.io
MIT License
83 stars 43 forks source link

adding an assert statement #415

Closed andrewgiuliani closed 2 months ago

andrewgiuliani commented 2 months ago

The user has the option to optimize coils using the BoozerLS algorithm while fixing the constant G to its theoretical value in vacuum field, i.e., providing G=None to boozer_surface.run_code(). When computing the gradient of an objective function that depends on such a BoozerLS surface (with G=None), the gradient formulas assume that coil currents are fixed. In order to avoid confusion, I have added an assert to prevent the algorithm from proceeding if the currents are unfixed, as the computed gradient would be incorrect.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 91.99%. Comparing base (6426096) to head (11f176b).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #415 +/- ## ======================================= Coverage 91.99% 91.99% ======================================= Files 75 75 Lines 13464 13464 ======================================= Hits 12386 12386 Misses 1078 1078 ``` | [Flag](https://app.codecov.io/gh/hiddenSymmetries/simsopt/pull/415/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hiddenSymmetries) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/hiddenSymmetries/simsopt/pull/415/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hiddenSymmetries) | `91.99% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hiddenSymmetries#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.