Skip to content

Commit

Permalink
Merge pull request #384 from hiddenSymmetries/mbkumar-patch-1
Browse files Browse the repository at this point in the history
Update strain_optimization.py
  • Loading branch information
mbkumar authored Dec 17, 2023
2 parents 50f41d6 + 39ca311 commit d95a479
Showing 1 changed file with 7 additions and 5 deletions.
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

0 comments on commit d95a479

Please sign in to comment.