PlasmaControl / DESC

Stellarator Equilibrium and Optimization Suite
MIT License
98 stars 26 forks source link

Generic multigrid optimization utility #929

Open f0uriest opened 8 months ago

f0uriest commented 8 months ago

nstead of doing something like

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, :
]
boundary constraints = (
    FixBoundaryR(eq=eq, modes=R_modes),
    FixBoundaryZ(eq=eq, modes=Z_modes),
)

do something like


def multigrid_optimize(things, objective, constraints, ms):
    for m in ms:
        cons = constraints = (FixBoundaryR(modes > m), FixBoundaryR(modes > m))
        optimizer.optimize(things, objective, cons)

Possibly a new method of Optimizer?

dpanici commented 4 months ago

1117 related