API Documentation

Basis

desc.basis.PowerSeries(L[, sym])

1D basis set for flux surface quantities.

desc.basis.FourierSeries(N[, NFP, sym])

1D basis set for use with the magnetic axis.

desc.basis.DoubleFourierSeries(M, N[, NFP, sym])

2D basis set for use on a single flux surface.

desc.basis.ZernikePolynomial(L, M[, sym, ...])

2D basis set for analytic functions in a unit disc.

desc.basis.FourierZernikeBasis(L, M, N[, ...])

3D basis set for analytic functions in a toroidal volume.

Continuation

desc.continuation.solve_continuation(eqfam)

Solve for an equilibrium by continuation method.

desc.continuation.solve_continuation_automatic(eq)

Solve for an equilibrium using an automatic continuation method.

Derivatives

Note that the derivative module also exposes the Derivative class, which is an alias for AutoDiffDerivative if JAX is installed, or FiniteDiffDerivative if not.

desc.derivatives.AutoDiffDerivative(fun[, ...])

Computes derivatives using automatic differentiation with JAX.

desc.derivatives.FiniteDiffDerivative(fun[, ...])

Computes derivatives using 2nd order centered finite differences.

Equilibrium

desc.equilibrium.Equilibrium([Psi, NFP, L, ...])

Equilibrium is an object that represents a plasma equilibrium.

desc.equilibrium.EquilibriaFamily(*args)

EquilibriaFamily stores a list of Equilibria.

Examples

desc.examples.get(name[, data])

Get example equilibria and data.

desc.examples.listall()

Return a list of examples that DESC has.

Geometry

desc.geometry.FourierRZCurve([R_n, Z_n, ...])

Curve parameterized by fourier series for R,Z in terms of toroidal angle phi.

desc.geometry.FourierXYZCurve([X_n, Y_n, ...])

Curve parameterized by fourier series for X,Y,Z in terms of arbitrary angle phi.

desc.geometry.FourierPlanarCurve([center, ...])

Curve that lines in a plane.

desc.geometry.FourierRZToroidalSurface([...])

Toroidal surface represented by Fourier series in poloidal and toroidal angles.

desc.geometry.ZernikeRZToroidalSection([...])

A toroidal cross section represented by a Zernike polynomial in R,Z.

Grid

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

Base class for collocation grids.

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.

IO

desc.io.InputReader([cl_args])

Reads command line arguments and parses input files.

desc.io.load(load_from[, file_format])

Load any DESC object from previously saved file.

Objective Functions

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

Aspect ratio = major radius / minor radius.

desc.objectives.BootstrapRedlConsistency([...])

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

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

Radial, poloidal, and toroidal current density.

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

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

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

MHD energy.

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

Radial and helical MHD force balance.

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

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

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

Helical MHD force balance.

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

Isodynamicity metric for cross field transport.

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

The magnetic well is a fast proxy for MHD stability.

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

Target a particular value for the mean curvature.

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

The Mercier criterion is a fast proxy for MHD stability.

desc.objectives.ObjectiveFunction(objectives)

Objective function comprised of one or more Objectives.

desc.objectives.PlasmaVesselDistance(surface)

Target the distance between the plasma and a surounding surface.

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

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

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

Quasi-symmetry Boozer harmonics error.

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

Quasi-symmetry two-term error.

desc.objectives.QuasisymmetryTripleProduct([...])

Quasi-symmetry triple product error.

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

Radial MHD force balance.

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

Targets a rotational transform profile.

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

Target toroidal current profile.

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

Plasma volume.

Optimize

desc.optimize.Optimizer(method)

A helper class to wrap several optimization routines.

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

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

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

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

Perturbations

desc.perturbations.get_deltas(things1, things2)

Compute differences between parameters for perturbations.

desc.perturbations.perturb(eq, objective, ...)

Perturb an Equilibrium with respect to input parameters.

desc.perturbations.optimal_perturb(eq, ...)

Perturb an Equilibrium with respect to input parameters to optimize an objective.

Plotting

desc.plotting.plot_1d(eq, name[, grid, log, ...])

Plot 1D profiles.

desc.plotting.plot_2d(eq, name[, grid, log, ...])

Plot 2D cross-sections.

desc.plotting.plot_3d(eq, name[, grid, log, ...])

Plot 3D surfaces.

desc.plotting.plot_basis(basis[, return_data])

Plot basis functions.

desc.plotting.plot_boozer_modes(eq[, log, ...])

Plot Fourier harmonics of \(|B|\) in Boozer coordinates.

desc.plotting.plot_boozer_surface(eq[, ...])

Plot \(|B|\) on a surface vs the Boozer poloidal and toroidal angles.

desc.plotting.plot_boundaries(eqs[, labels, ...])

Plot stellarator boundaries at multiple toroidal coordinates.

desc.plotting.plot_boundary(eq[, zeta, ...])

Plot stellarator boundary at multiple toroidal coordinates.

desc.plotting.plot_coefficients(eq[, L, M, ...])

Plot spectral coefficient magnitudes vs spectral mode number.

desc.plotting.plot_coils(coils[, grid, ax, ...])

Create 3D plot of coil geometry.

desc.plotting.plot_comparison(eqs[, rho, ...])

Plot comparison between flux surfaces of multiple equilibria.

desc.plotting.plot_field_lines_sfl(eq, rho)

Plots field lines on specified flux surface.

desc.plotting.plot_fsa(eq, name[, ...])

Plot flux surface averages of quantities.

desc.plotting.plot_grid(grid[, return_data])

Plot the location of collocation nodes on the zeta=0 plane.

desc.plotting.plot_logo([savepath])

Plot the DESC logo.

desc.plotting.plot_qs_error(eq[, log, fB, ...])

Plot quasi-symmetry errors f_B, f_C, and f_T as normalized flux functions.

desc.plotting.plot_section(eq, name[, grid, ...])

Plot Poincare sections.

desc.plotting.plot_surfaces(eq[, rho, ...])

Plot flux surfaces.

Profiles

desc.profiles.PowerSeriesProfile([params, ...])

Profile represented by a monic power series.

desc.profiles.SplineProfile([values, knots, ...])

Profile represented by a piecewise cubic spline.

desc.profiles.MTanhProfile([params, grid, name])

Profile represented by a modified hyperbolic tangent + polynomial.

desc.profiles.ScaledProfile(scale, profile, ...)

Profile times a constant value.

desc.profiles.SumProfile(*profiles, **kwargs)

Sum of two or more Profiles.

desc.profiles.ProductProfile(*profiles, **kwargs)

Product of two or more Profiles.

Transform

desc.transform.Transform(grid, basis[, ...])

Transforms from spectral coefficients to real space values.

VMEC

desc.vmec.VMECIO()

Performs input from VMEC netCDF files to DESC Equilibrium and vice-versa.