Skip to content
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

Strain optimization #346

Merged
merged 48 commits into from
Oct 1, 2023
Merged

Strain optimization #346

merged 48 commits into from
Oct 1, 2023

Conversation

ejpaul
Copy link
Contributor

@ejpaul ejpaul commented Aug 10, 2023

This PR is based on work by @phuslage for the optimization of coil curves and the HTS winding angle to reduce torsional and hard-way bending strain as defined in :

Paz Soldan, "Non-planar coil winding angle optimization for compatibility with 
non-insulated high-temperature superconducting magnets", Journal of Plasma Physics 
86 (2020), doi:10.1017/S0022377820001208. 

The orientation of the HTS tape normal is defined by the FramedCurve class, which is inherited by FramedCurveFrenet or FramedCurveCentroid. The FramedCurve defines a curve and an orthonormal frame, where the tangent vector is aligned with the curve tangent. The frame can be rotated by an angle alpha with respect to the Frenet or centroid reference frames. The FramedCurve class evaluates geometric properties of the frame, such as the torsion and binormal curvature. This class is also used to set up a multi-filament coil using the CurveFilament class.

The strains are evaluated in the StrainOpt class, which is defined by a FramedCurve and a tape width. The objective functions LPTorsionalStrainPenalty and LPBinormalCurvatureStrainPenalty can be used for optimization with respect to the coil or rotation dofs.

An example of optimization with respect to the rotation dofs is provided in strain_optimization_simple.py

@codecov
Copy link

codecov bot commented Aug 10, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (f8f9d59) 91.07% compared to head (60329b3) 90.93%.
Report is 18 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #346      +/-   ##
==========================================
- Coverage   91.07%   90.93%   -0.14%     
==========================================
  Files          70       72       +2     
  Lines       12367    12681     +314     
==========================================
+ Hits        11263    11532     +269     
- Misses       1104     1149      +45     
Flag Coverage Δ
unittests 90.93% <100.00%> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/simsopt/geo/__init__.py 100.00% <100.00%> (ø)
src/simsopt/geo/finitebuild.py 100.00% <100.00%> (+0.64%) ⬆️
src/simsopt/geo/framedcurve.py 100.00% <100.00%> (ø)
src/simsopt/geo/strain_optimization.py 100.00% <100.00%> (ø)

... and 10 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

phuslage
phuslage previously approved these changes Sep 15, 2023
examples/3_Advanced/strain_simple.py Outdated Show resolved Hide resolved
examples/3_Advanced/strain_simple.py Outdated Show resolved Hide resolved
src/simsopt/geo/strain_optimization.py Outdated Show resolved Hide resolved
f2 = J.J()
errf = np.abs((f1-f2)/(2*eps) - df)
errf_old = errf

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we add a test that checks whether the cost functions vanish for a circular coil.

@landreman
Copy link
Contributor

Is this PR ready for another review? If so can you merge master in and resolve merge conflicts?

@ejpaul
Copy link
Contributor Author

ejpaul commented Sep 30, 2023

Is this PR ready for another review? If so can you merge master in and resolve merge conflicts?

@landreman Yes, it is ready. I have merged in master.

@landreman landreman self-requested a review September 30, 2023 23:41
Copy link
Contributor

@landreman landreman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Since StrainOpt was not intended to be used as an objective function in optimization, the Opt in the name might be confusing to users. So I took the liberty of renaming it to CoilStrain, and adding to the docs to clarify. Hope that's ok. Feel free to merge whenever you're ready.

@ejpaul
Copy link
Contributor Author

ejpaul commented Oct 1, 2023

Looks good. Since StrainOpt was not intended to be used as an objective function in optimization, the Opt in the name might be confusing to users. So I took the liberty of renaming it to CoilStrain, and adding to the docs to clarify. Hope that's ok. Feel free to merge whenever you're ready.

Thanks, Matt!

@ejpaul ejpaul merged commit 085177e into master Oct 1, 2023
44 of 47 checks passed
@ejpaul ejpaul deleted the strain_optimization_cu branch October 1, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants