hiddenSymmetries / simsopt

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

added surface self-intersection test as well as second derivatives of surface aspect ratio #401

Closed andrewgiuliani closed 3 months ago

andrewgiuliani commented 3 months ago

This PR introduces a surface self-intersection test, and second derivatives of the surface aspect ratio with respect to the surface degrees of freedom.

The algorithm that checks for surface self-intersection first computes a surface cross section at a given cylindrical angle phi. Then, approximating the cross section as a piecewise linear polyline, the Bentley-Ottmann algorithm is used to check if any line segments overlap one another.

The second derivatives of surface aspect ratio are useful if being used as a surface label in the BoozerLS algorithm.

codecov[bot] commented 3 months ago

Codecov Report

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

Project coverage is 91.64%. Comparing base (1fb6e87) to head (3d1413b). Report is 10 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #401 +/- ## ========================================== + Coverage 91.56% 91.64% +0.08% ========================================== Files 74 74 Lines 12762 12987 +225 ========================================== + Hits 11685 11902 +217 - Misses 1077 1085 +8 ``` | [Flag](https://app.codecov.io/gh/hiddenSymmetries/simsopt/pull/401/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/401/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hiddenSymmetries) | `91.64% <100.00%> (+0.08%)` | :arrow_up: | 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.

landreman commented 3 months ago

I think test_is_self_intersecting is not being run in the CI, since ground and bentley_ottman are not installed there. Does it make sense to add these packages to simsopt's requirements? Or do you think these packages and their sub-dependencies are onerous to include for some users? If we don't include these packages in simsopt's general requirements, then I'd suggest manually installing them in the CI and extensive CI as in this line so test_is_self_intersecting is run.