Currently to restrict which modes of a boundary are in the optimization space, we have to do this slightly clunky procedure of defining the modes externally then passing them into the constraint.
# as opposed to SIMSOPT and STELLOPT where variables are assumed fixed, in DESC
# we assume variables are free. Here we decide which ones to fix, starting with
# the major radius (R mode = [0,0,0]) and all modes with m,n > k
R_modes = np.vstack(
(
[0, 0, 0],
eq.surface.R_basis.modes[
np.max(np.abs(eq.surface.R_basis.modes), 1) > k, :
],
)
)
Z_modes = eq.surface.Z_basis.modes[
np.max(np.abs(eq.surface.Z_basis.modes), 1) > k, :
]
# next we create the constraints, using the mode number arrays just created
# if we didn't pass those in, it would fix all the modes (like for the profiles)
constraints = (
ForceBalance(eq=eq),
FixBoundaryR(eq=eq, modes=R_modes),
FixBoundaryZ(eq=eq, modes=Z_modes),
FixPressure(eq=eq),
FixCurrent(eq=eq),
FixPsi(eq=eq),)
We could possibly add logic to FixBoundaryR and FixBoundaryZ to fix all modes within a certain M,N range, like something below
Currently to restrict which modes of a boundary are in the optimization space, we have to do this slightly clunky procedure of defining the modes externally then passing them into the constraint.
We could possibly add logic to
FixBoundaryR
andFixBoundaryZ
to fix all modes within a certain M,N range, like something below