Alphabetical Listing

Basis

desc.basis.ChebyshevPolynomial(L)

Shifted Chebyshev polynomial of the first kind.

desc.basis.ChebyshevDoubleFourierBasis(L, M, N)

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

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

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

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

1D basis set for use with the magnetic axis.

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

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

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

1D basis set for flux surface quantities.

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

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

Coils

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

Set of coils of different geometry but shared parameterization and resolution.

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

Coil that lies in a plane.

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

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

desc.coils.FourierXYCoil([current, center, ...])

Coil that lies in a plane.

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

Coil parameterized by Fourier series for X,Y,Z in terms of an arbitrary angle s.

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

Set of coils or coilsets of different geometry.

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

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

desc.coils.initialize_helical_coils(eq, ...)

Initialize a CoilSet of helical coils for stage 2 optimization.

desc.coils.initialize_modular_coils(eq, ...)

Initialize a CoilSet of modular coils for stage 2 optimization.

desc.coils.initialize_saddle_coils(eq, num_coils)

Initialize a CoilSet of saddle coils for stage 2 optimization.

Compatibility

desc.compat.contract_equilibrium(eq, inner_rho)

Contract an equilibrium so that an inner flux surface is the new boundary.

desc.compat.ensure_positive_jacobian(eq)

Convert an Equilibrium to have a positive coordinate Jacobian.

desc.compat.flip_helicity(eq)

Change the sign of the helicity of an Equilibrium.

desc.compat.flip_theta(eq)

Change the gauge freedom of the poloidal angle of an Equilibrium.

desc.compat.rescale(eq[, L, B, ...])

Rescale an Equilibrium in size L and magnetic field strength B.

desc.compat.rotate_zeta(eq, angle[, copy])

Rotate the equilibrium about the toroidal direction.

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.

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

Computes derivatives using automatic differentiation with JAX.

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.

External

Note that these objectives and utility functions are not regularly tested and maybe incompatible with newer version of the external code. Please see the README of the desc.external for more details.

desc.external.paraview.export_coils_to_paraview(...)

Export coils data for Paraview as VTP files.

desc.external.paraview.export_surface_to_paraview(...)

Export a constant rho surface data for Paraview as VTK file.

desc.external.paraview.export_volume_to_paraview(eq, ...)

Export equilibrium volume data for Paraview as VTK file.

desc.external.terpsichore.TERPSICHORE(eq, *)

Computes ideal MHD linear stability from calls to the code TERPSICHORE.

Geometry

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

Curve that lies in a plane.

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

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

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

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

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

Curve that lies in a plane.

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

Curve parameterized by Fourier series for X,Y,Z in terms of an arbitrary angle s.

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.ConcentricGrid(L, M, N[, NFP, ...])

Grid in which the nodes are arranged in concentric circles.

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

Integrals

desc.integrals.Bounce2D(grid, data, angle[, ...])

Computes bounce integrals using pseudo-spectral methods.

desc.integrals.Bounce1D(grid, data[, quad, ...])

Computes bounce integrals using one-dimensional local spline methods.

IO

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

Load any DESC object from previously saved file.

Magnetic Fields

desc.magnetic_fields.CurrentPotentialField(...)

Magnetic field due to a surface current potential on a toroidal surface.

desc.magnetic_fields.FourierCurrentPotentialField([...])

Magnetic field due to a surface current potential on a toroidal surface.

desc.magnetic_fields.DommaschkPotentialField([...])

Magnetic field due to a Dommaschk scalar magnetic potential in rpz coordinates.

desc.magnetic_fields.MagneticFieldFromUser(fun)

Wrap an arbitrary function for calculating magnetic field in lab coordinates.

desc.magnetic_fields.OmnigenousField([L_B, ...])

A magnetic field with perfect omnigenity (but is not necessarily analytic).

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

Pure poloidal magnetic field (ie in theta direction).

desc.magnetic_fields.ScalarPotentialField(...)

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

desc.magnetic_fields.ScaledMagneticField(...)

Magnetic field scaled by a scalar value.

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

Magnetic field from precomputed values on a grid.

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.VectorPotentialField(...)

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

desc.magnetic_fields.VerticalMagneticField(B0)

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

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

Trace field lines by integration, using diffrax package.

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

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

desc.magnetic_fields.solve_regularized_surface_current(...)

Runs REGCOIL-like algorithm to find the current potential for the surface.

Objective Functions

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

Aspect ratio = major radius / minor radius.

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

A type of ideal MHD instability.

desc.objectives.BootstrapRedlConsistency(eq)

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

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

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

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

Target a particular value for the magnetic field scale length.

desc.objectives.CoilArclengthVariance(coils)

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

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

Coil current length.

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

Coil curvature.

desc.objectives.CoilIntegratedCurvature(coil)

Coil integrated curvature.

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

Coil length.

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

Prevents coils from becoming interlinked.

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

Target the minimum distance between coils in a coilset.

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

Coil torsion.

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

Radial, poloidal, and toroidal current density.

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

Proxy for neoclassical transport in the banana regime.

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

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

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

MHD energy.

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

Wrap an external code.

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

Fixes anisotropic pressure coefficients.

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.FixCoilCurrent(coil[, ...])

Fixes current(s) in a Coil or CoilSet.

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.FixNearAxisR(eq[, order, N, ...])

Fixes an equilibrium's near-axis behavior in R to specified order.

desc.objectives.FixNearAxisZ(eq[, order, N, ...])

Fixes an equilibrium's near-axis behavior in Z to specified order.

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

Fixes an equilibrium's near-axis behavior in lambda to specified order.

desc.objectives.FixOmniBmax(field[, target, ...])

Ensures the B_max contour is straight in Boozer coordinates.

desc.objectives.FixOmniMap(field[, target, ...])

Fixes OmnigenousField.x_lmn coefficients.

desc.objectives.FixOmniWell(field[, target, ...])

Fixes OmnigenousField.B_lm coefficients.

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

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

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.FixSumCoilCurrent(coil[, ...])

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

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

Fixes a linear sum of Fourier-Zernike lambda 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.ForceBalance(eq[, target, ...])

Radial and helical MHD force balance.

desc.objectives.ForceBalanceAnisotropic(eq)

Force balance for anisotropic pressure equilibria.

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

Fusion power.

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

Proxy for fast ion confinement.

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

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

desc.objectives.get_equilibrium_objective(eq)

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

desc.objectives.get_fixed_axis_constraints(eq)

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

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

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

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

Heating power required by the ISS04 energy confinement time scaling.

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

Helical MHD force balance.

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

Isodynamicity metric for cross field transport.

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

Wrap a user defined linear objective function.

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

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

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

Target a particular value mirror ratio.

desc.objectives.ObjectiveFromUser(fun, thing)

Wrap a user defined objective function.

desc.objectives.ObjectiveFunction(objectives)

Objective function comprised of one or more Objectives.

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

Omnigenity error.

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.PlasmaVesselDistance(eq, surface)

Target the distance between the plasma and a surrounding surface.

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

Target pressure profile.

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

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

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

Target B*n = 0 on LCFS.

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

Quasi-symmetry Boozer harmonics error.

desc.objectives.QuasisymmetryTripleProduct(eq)

Quasi-symmetry triple product error.

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

Quasi-symmetry two-term error.

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

Radial MHD force balance.

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

Targets a rotational transform profile.

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

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

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

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

desc.objectives.SurfaceCurrentRegularization(...)

Target the surface current magnitude.

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

Target B*n = 0 on a surface.

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

Target toroidal current profile.

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

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

desc.objectives.VacuumBoundaryError(eq, field)

Target for free boundary conditions on LCFS for vacuum equilibrium.

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

Plasma volume.

Optimize

desc.optimize.Optimizer(method)

A helper class to wrap several optimization routines.

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

Minimize a function with constraints using an augmented Lagrangian method.

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

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

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

Minimize a function with constraints using an augmented Lagrangian method.

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

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

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

Decorator to wrap a function for optimization.

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

Minimize a scalar function using one of stochastic gradient descent methods.

Particles

desc.particles.CurveParticleInitializer(curve, N)

Randomly sample particles starting on a curve.

desc.particles.ManualParticleInitializerFlux(...)

Manually specify particle starting positions and energy in flux coordinates.

desc.particles.ManualParticleInitializerLab(R0, ...)

Manually specify particle starting positions and energy in lab coordinates.

desc.particles.SurfaceParticleInitializer(...)

Randomly sample particles starting on a surface.

desc.particles.VacuumGuidingCenterTrajectory(frame)

Guiding center trajectories in vacuum, conserving energy and mu.

desc.particles.trace_particles(field, ...[, ...])

Trace charged particles in an equilibrium or external magnetic field.

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

Plot basis functions.

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

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

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

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

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(field, R0, Z0)

Field line plot from external magnetic field.

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

Plot flux surface averages of quantities.

desc.plotting.plot_gammac(eq[, rho, alphas, ...])

Plot the energetic proxy metric γ_c for a single flux surface.

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_particle_trajectories(...)

Plot particle trajectories in a magnetic field.

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.

desc.plotting.poincare_plot(field, R0, Z0[, ...])

Poincare plot of field lines from external magnetic field.

Profiles

desc.profiles.FourierZernikeProfile([...])

Possibly anisotropic profile represented by Fourier-Zernike basis.

desc.profiles.HermiteSplineProfile(f, df[, ...])

Radial profile represented by a piecewise cubic Hermite spline.

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

Profile represented by a modified hyperbolic tangent + polynomial.

desc.profiles.PowerProfile(power, profile, ...)

Profile raised to a power.

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

Profile represented by a monic power series.

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

Product of two or more Profiles.

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

Profile times a constant value.

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

Radial profile represented by a piecewise cubic spline.

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

Sum of two or more Profiles.

desc.profiles.TwoPowerProfile([params, name])

Profile represented by two powers.

Transform

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

Transforms from spectral coefficients to real space values.

VMEC and Other Codes

desc.vmec.VMECIO()

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

desc.vmec_utils.make_boozmn_output(eq, path)

Create and save a booz_xform-style .nc output file.