Objectives, Optimizers, and Grids

Objectives and Constraints

desc.objectives defines a number of different metrics for stellarator optimization problems, which can be used as either objectives or constraints depending on how they are passed to the optimizer. Individual objectives are combined into an ObjectiveFunction that is then passed to the Optimizer.

ObjectiveFunction

desc.objectives.ObjectiveFunction(objectives)

Objective function comprised of one or more Objectives.

Equilibrium

desc.objectives.ForceBalance(eq[, target, ...])

Radial and helical MHD force balance.

desc.objectives.ForceBalanceAnisotropic(eq)

Force balance for anisotropic pressure equilibria.

desc.objectives.Energy(eq[, target, bounds, ...])

MHD energy.

desc.objectives.CurrentDensity(eq[, target, ...])

Radial, poloidal, and toroidal current density.

desc.objectives.RadialForceBalance(eq[, ...])

Radial MHD force balance.

desc.objectives.HelicalForceBalance(eq[, ...])

Helical MHD force balance.

Geometry

desc.objectives.AspectRatio(eq[, target, ...])

Aspect ratio = major radius / minor radius.

desc.objectives.Elongation(eq[, target, ...])

Elongation = semi-major radius / semi-minor radius.

desc.objectives.Volume(eq[, target, bounds, ...])

Plasma volume.

desc.objectives.MeanCurvature(eq[, target, ...])

Target a particular value for the mean curvature.

desc.objectives.PrincipalCurvature(eq[, ...])

Target a particular value for the (unsigned) principal curvature.

desc.objectives.PlasmaVesselDistance(eq, surface)

Target the distance between the plasma and a surrounding surface.

desc.objectives.BScaleLength(eq[, target, ...])

Target a particular value for the magnetic field scale length.

desc.objectives.GoodCoordinates(eq[, sigma, ...])

Target "good" coordinates, meaning non self-intersecting curves.

Omnigenity

desc.objectives.QuasisymmetryTwoTerm(eq[, ...])

Quasi-symmetry two-term error.

desc.objectives.QuasisymmetryTripleProduct(eq)

Quasi-symmetry triple product error.

desc.objectives.QuasisymmetryBoozer(eq[, ...])

Quasi-symmetry Boozer harmonics error.

desc.objectives.Omnigenity(eq, field[, ...])

Omnigenity error.

desc.objectives.Isodynamicity(eq[, target, ...])

Isodynamicity metric for cross field transport.

Stability

desc.objectives.MagneticWell(eq[, target, ...])

The magnetic well is a fast proxy for MHD stability.

desc.objectives.MercierStability(eq[, ...])

The Mercier criterion is a fast proxy for MHD stability.

Free boundary / Single stage optimization

desc.objectives.BoundaryError(eq, field[, ...])

Target for free boundary conditions on LCFS for finite beta equilibrium.

desc.objectives.VacuumBoundaryError(eq, field)

Target for free boundary conditions on LCFS for vacuum equilibrium.

Profiles

desc.objectives.RotationalTransform(eq[, ...])

Targets a rotational transform profile.

desc.objectives.Shear(eq[, target, bounds, ...])

Targets a shear profile (normalized derivative of rotational transform).

desc.objectives.ToroidalCurrent(eq[, ...])

Target toroidal current profile.

desc.objectives.Pressure(eq[, target, ...])

Target pressure profile.

desc.objectives.BootstrapRedlConsistency(eq)

Promote consistency of the bootstrap current for axisymmetry or quasi-symmetry.

Fixing degrees of freedom

desc.objectives.FixBoundaryR(eq[, target, ...])

Boundary condition on the R boundary parameters.

desc.objectives.FixBoundaryZ(eq[, target, ...])

Boundary condition on the Z boundary parameters.

desc.objectives.FixAxisR(eq[, target, ...])

Fixes magnetic axis R coefficients.

desc.objectives.FixAxisZ(eq[, target, ...])

Fixes magnetic axis Z coefficients.

desc.objectives.FixPsi(eq[, target, bounds, ...])

Fixes total toroidal magnetic flux within the last closed flux surface.

desc.objectives.FixPressure(eq[, target, ...])

Fixes pressure coefficients.

desc.objectives.FixIota(eq[, target, ...])

Fixes rotational transform coefficients.

desc.objectives.FixCurrent(eq[, target, ...])

Fixes toroidal current profile coefficients.

desc.objectives.FixAtomicNumber(eq[, ...])

Fixes effective atomic number profile coefficients.

desc.objectives.FixElectronDensity(eq[, ...])

Fixes electron density profile coefficients.

desc.objectives.FixElectronTemperature(eq[, ...])

Fixes electron temperature profile coefficients.

desc.objectives.FixIonTemperature(eq[, ...])

Fixes ion temperature profile coefficients.

desc.objectives.FixModeR(eq[, target, ...])

Fixes Fourier-Zernike R coefficients.

desc.objectives.FixModeZ(eq[, target, ...])

Fixes Fourier-Zernike Z coefficients.

desc.objectives.FixSumModesR(eq[, target, ...])

Fixes a linear sum of Fourier-Zernike R coefficients.

desc.objectives.FixSumModesZ(eq[, target, ...])

Fixes a linear sum of Fourier-Zernike Z coefficients.

desc.objectives.FixThetaSFL(eq[, name])

Fixes lambda=0 so that poloidal angle is the SFL poloidal angle.

desc.objectives.FixParameter(thing[, ...])

Fix specific degrees of freedom associated with a given Optimizable object.

User defined objectives

desc.objectives.GenericObjective(f, eq[, ...])

A generic objective that can compute any quantity from the data_index.

desc.objectives.ObjectiveFromUser(fun, eq[, ...])

Wrap a user defined objective function.

desc.objectives.LinearObjectiveFromUser(fun, ...)

Wrap a user defined linear objective function.

Utilities for getting common groups of constraints

desc.objectives.get_fixed_boundary_constraints(eq)

Get the constraints necessary for a typical fixed-boundary equilibrium problem.

desc.objectives.get_NAE_constraints(desc_eq, ...)

Get the constraints necessary for fixing NAE behavior in an equilibrium problem.

desc.objectives.get_fixed_axis_constraints(eq)

Get the constraints necessary for a fixed-axis equilibrium problem.

desc.objectives.get_equilibrium_objective(eq)

Get the objective function for a typical force balance equilibrium problem.

Optimization

desc.optimize.Optimizer is the primary interface, it contains wrappers for a number of different methods listed in Optimizers Supported.

desc.optimize.Optimizer(method)

A helper class to wrap several optimization routines.

There are also a number of optimizers written specifically for DESC that we also offer with a direct interface similar to scipy.optimize.minimize:

desc.optimize.lsqtr(fun, x0, jac[, bounds, ...])

Solve a least squares problem using a (quasi)-Newton trust region method.

desc.optimize.fmintr(fun, x0, grad[, hess, ...])

Minimize a scalar function using a (quasi)-Newton trust region method.

desc.optimize.fmin_auglag(fun, x0, grad[, ...])

Minimize a function with constraints using an augmented Lagrangian method.

desc.optimize.lsq_auglag(fun, x0, jac[, ...])

Minimize a function with constraints using an augmented Lagrangian method.

desc.optimize.sgd(fun, x0, grad[, args, ...])

Minimize a scalar function using stochastic gradient descent with momentum.

DESC also allows you to use custom optimizers by creating a wrapper function and registering it using desc.optimize.register_optimizer. See Adding optimizers for details

desc.optimize.register_optimizer(name, ...)

Decorator to wrap a function for optimization.

Grids

A grid defines a set of collocation nodes in computational coordinates where physics quantities are to be evaluated. DESC offers a number of options with different patterns and spacing. Each objective generally has a default grid that works for most cases, but often it is desired to specify where particular objectives should be targeted, such as targeting quasi-symmetry on particular surfaces. For this a user defined grid can be created and passed to the corresponding objective.

desc.grid.Grid(nodes[, sort, jitable])

Collocation grid with custom node placement.

desc.grid.LinearGrid([L, M, N, NFP, sym, ...])

Grid in which the nodes are linearly spaced in each coordinate.

desc.grid.QuadratureGrid(L, M, N[, NFP])

Grid used for numerical quadrature.

desc.grid.ConcentricGrid(L, M, N[, NFP, ...])

Grid in which the nodes are arranged in concentric circles.

desc.grid also contains utilities for finding the most and least rational surfaces for a given iota profile, for either avoiding or analyzing rational surfaces.

desc.grid.find_least_rational_surfaces(iota, n)

Find "least rational" surfaces for given iota profile.

desc.grid.find_most_rational_surfaces(iota, n)

Find "most rational" surfaces for a give iota profile.