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.ChebyshevDoubleFourierBasis(L, M, N)

3D basis: tensor product of Chebyshev polynomials and two Fourier series.

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

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

Coils

desc.coils.FourierRZCoil([current, R_n, ...])

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

desc.coils.FourierXYZCoil([current, X_n, ...])

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

desc.coils.FourierPlanarCoil([current, ...])

Coil that lines in a plane.

desc.coils.SplineXYZCoil(current, X, Y, Z[, ...])

Coil parameterized by spline points in X,Y,Z.

desc.coils.CoilSet(*coils[, name])

Set of coils of different geometry.

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 lies in a plane.

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

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

desc.geometry.SplineXYZCurve(X, Y, Z[, ...])

Curve parameterized by spline knots in X,Y,Z.

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

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

Grid

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.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.

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.

Magnetic Fields

desc.magnetic_fields.ScaledMagneticField(...)

Magnetic field scaled by a scalar value.

desc.magnetic_fields.SumMagneticField(*fields)

Sum of two or more magnetic field sources.

desc.magnetic_fields.ToroidalMagneticField(B0, R0)

Magnetic field purely in the toroidal (phi) direction.

desc.magnetic_fields.VerticalMagneticField(B0)

Uniform magnetic field purely in the vertical (Z) direction.

desc.magnetic_fields.PoloidalMagneticField(B0, ...)

Pure poloidal magnetic field (ie in theta direction).

desc.magnetic_fields.SplineMagneticField(R, ...)

Magnetic field from precomputed values on a grid.

desc.magnetic_fields.ScalarPotentialField(...)

Magnetic field due to a scalar magnetic potential in cylindrical coordinates.

desc.magnetic_fields.field_line_integrate(r0, ...)

Trace field lines by integration.

desc.magnetic_fields.read_BNORM_file(fname, ...)

Read BNORM-style .txt file containing Bnormal Fourier coefficients.

desc.magnetic_fields.biot_savart(eval_pts, ...)

Biot-Savart law following [1].

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

Target a particular value for the magnetic field scale length.

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

Fixes effective atomic number profile coefficients.

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

Fixes magnetic axis R coefficients.

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

Fixes magnetic axis Z coefficients.

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

Fixes toroidal current 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.FixIota([eq, target, ...])

Fixes rotational transform coefficients.

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

Fixes Fourier-Zernike R coefficients.

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

Fixes Fourier-Zernike Z coefficients.

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

Fixes pressure coefficients.

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

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

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.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.get_equilibrium_objective([...])

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

desc.objectives.get_fixed_axis_constraints([...])

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

desc.objectives.get_fixed_boundary_constraints([...])

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.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.ObjectiveFromUser(fun[, eq, ...])

Wrap a user defined objective function.

desc.objectives.ObjectiveFunction(objectives)

Objective function comprised of one or more Objectives.

desc.objectives.PlasmaVesselDistance(surface)

Target the distance between the plasma and a surrounding 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[, bounds, ...])

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

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([save_path])

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.