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.

Fast ion confinement

desc.objectives.GammaC(eq, *[, target, ...])

Proxy for fast ion confinement.

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.MirrorRatio(eq, *[, grid, ...])

Target a particular value mirror ratio.

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

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

Neoclassical

desc.objectives.EffectiveRipple(eq, *[, ...])

Proxy for neoclassical transport in the banana regime.

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.

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

A type of ideal MHD instability.

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.

Coil Optimization

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

Target B*n = 0 on LCFS.

desc.objectives.SurfaceQuadraticFlux(...[, ...])

Target B*n = 0 on a surface.

desc.objectives.CoilLength(coil[, target, ...])

Coil length.

desc.objectives.CoilCurvature(coil[, ...])

Coil curvature.

desc.objectives.CoilTorsion(coil[, target, ...])

Coil torsion.

desc.objectives.CoilSetLinkingNumber(coil[, ...])

Prevents coils from becoming interlinked.

desc.objectives.CoilSetMinDistance(coil[, ...])

Target the minimum distance between coils in a coilset.

desc.objectives.PlasmaCoilSetDistanceBound(eq, ...)

Target the distance between the plasma and coilset.

desc.objectives.PlasmaCoilSetMinDistance(eq, ...)

Target the minimum distance between the plasma and coilset.

desc.objectives.CoilIntegratedCurvature(coil)

Coil integrated curvature.

desc.objectives.CoilCurrentLength(coil[, ...])

Coil current length.

desc.objectives.CoilArclengthVariance(coils)

Variance of ||dx/ds|| along the curve.

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

Target the toroidal flux in an equilibrium from a magnetic field.

desc.objectives.SurfaceCurrentRegularization(...)

Target the surface current magnitude.

desc.objectives.LinkingCurrentConsistency(eq, ...)

Target the self-consistent poloidal linking current between the plasma and coils.

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.

Power Balance

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

Fusion power.

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

Heating power required by the ISS04 energy confinement time scaling.

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.FixAnisotropy(eq[, target, ...])

Fixes anisotropic pressure 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[, weight, ...])

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

desc.objectives.FixCoilCurrent(coil[, ...])

Fixes current(s) in a Coil or CoilSet.

desc.objectives.FixSumCoilCurrent(coil[, ...])

Fixes the sum of coil current(s) in a Coil or CoilSet.

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

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

desc.objectives.ShareParameters(things[, ...])

Fix specific degrees of freedom to be the same between Optimizable things.

User defined objectives

desc.objectives.ExternalObjective(eq, *, ...)

Wrap an external code.

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

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

desc.objectives.ObjectiveFromUser(fun, thing)

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 one of stochastic gradient descent methods.

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[, spacing, weights, ...])

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.