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

Constraint degeneracy #1297

Open
Alan-Goodman opened this issue Oct 10, 2024 · 1 comment · May be fixed by #1300
Open

Constraint degeneracy #1297

Alan-Goodman opened this issue Oct 10, 2024 · 1 comment · May be fixed by #1300

Comments

@Alan-Goodman
Copy link

When I have this in my optimisation:

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),
        # try to keep the aspect ratio between 7 and 9
        AspectRatio(eq=eq, bounds=(0, 10)),
        # similarly, try to keep it from getting too elongated
        Elongation(eq=eq, bounds=(0, 6)),
        # Keep volume the same as the initial volume
        #Volume(eq=eq0, target=eq0.compute("V")["V"]),
        # target for average iota
        RotationalTransform(eq=eq, target=1.1, loss_function="mean"),
        # fix major radius
        FixBoundaryR(eq=eq, modes=[0, 0, 0]),
        FixBoundaryR(eq=eq, modes=R_modes),
        # fix vacuum profiles
        FixPressure(eq=eq),
        FixCurrent(eq=eq),
        FixPsi(eq=eq),
    )
    optimizer = Optimizer("lsq-auglag")

...there is a bug, because of FixBoundaryR(0,0,0) and the FixBoundaryR(modes), which both fix the (000) mode. This should presumably not bug out, I assume?

@dpanici
Copy link
Collaborator

dpanici commented Oct 14, 2024

Correct, thanks for catching this Alan!

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 a pull request may close this issue.

2 participants