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

Update strain_optimization.py #384

Merged
merged 1 commit into from
Dec 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions examples/2_Intermediate/strain_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
86 (2020), doi:10.1017/S0022377820001208.

The orientation of the tape is defined with respect to the Frenet-Serret Frame

Authors: Paul Huslage, Elizabeth Paul
"""

import numpy as np
from scipy.optimize import minimize
from simsopt.geo import CoilStrain, LPTorsionalStrainPenalty, LPBinormalCurvatureStrainPenalty
from simsopt.geo import FrameRotation, FramedCurveFrenet, CurveXYZFourier
from simsopt.geo import FrameRotation, FramedCurveCentroid, CurveXYZFourier
from simsopt.configs import get_hsx_data
from simsopt.util import in_github_actions

Expand All @@ -26,15 +28,15 @@
curve_scaled = CurveXYZFourier(curve.quadpoints, curve.order)
curve_scaled.x = curve.x * scale_factor # scale coil to magnify the strains
rot_order = 10 # order of the Fourier expression for the rotation of the filament pack
width = 1e-3 # tape width
width = 3e-3 # tape width

curve_scaled.fix_all() # fix curve DOFs -> only optimize winding angle
rotation = FrameRotation(curve_scaled.quadpoints, rot_order)

framedcurve = FramedCurveFrenet(curve_scaled, rotation)
framedcurve = FramedCurveCentroid(curve_scaled, rotation)

tor_threshold = 0.02 # Threshold for strain parameters
cur_threshold = 0.02
tor_threshold = 0.002 # Threshold for strain parameters
cur_threshold = 0.002

Jtor = LPTorsionalStrainPenalty(framedcurve, p=2, threshold=tor_threshold)
Jbin = LPBinormalCurvatureStrainPenalty(
Expand Down
Loading