v0.13.0
New Features
- Adds function
solve_regularized_surface_currenttodesc.magnetic_fieldsmodule that implements the REGCOIL algorithm (Landreman, (2017)) for surface current normal field optimization, which can run on both CPUs and GPUs.- Can specify the tuple
current_helicity=(M_coil, N_coil)to determine if resulting contours correspond to helical topology (both(M_coil, N_coil)not equal to 0), modular (N_coilequal to 0 andM_coilnonzero) or windowpane/saddle (M_coilandN_coilboth zero) M_coilis the number of poloidal transits a coil makes before returning to itself, whileN_coilis the number of toroidal transits a coil makes before returning to itself (this is sort of like the QShelicity)- if multiple values of the regularization parameter are input, will return a family of surface current fields (as a list) corresponding to the solution at each regularization value
- Can specify the tuple
- Adds method
to_CoilSettoFourierCurrentPotentialFieldwhich implements a coil cutting algorithm to discretize the surface current into coils- works for both modular and helical coils
- Adds a new objective
SurfaceCurrentRegularization(which minimizesw*|K|, the regularization term from surface current in the REGCOIL algorithm, withwbeing the objective weight which act as the regularization parameter)- use of both this and the
QuadraticFluxobjective allows for REGCOIL solutions to be obtained through the optimization framework, and combined with other objectives as well.
- use of both this and the
- Adds a new tutorial showing how to use
REGCOILfeatures, as well as a new section in the stage two optimization notebook using REGCOIL to obtain an initial guess for filamentary coil optimization. - Adds
from_input_filemethod toEquilibriumclass to generate anEquilibriumobject with boundary, profiles, resolution and flux specified in a given DESC or VMEC input file - Adds
SurfaceQuadraticFluxobjective which minimizes the quadratic magnetic flux through aFourierRZToroidalSurfaceobject, allowing for optimizing for Quadratic flux minimizing (QFM) surfaces. - Allows
ToroidalFluxobjective to acceptFourierRZToroidalSurfaceso it can be used to specify the toroidal flux through a QFM surface. - Adds
eq_fixedflag toToroidalFluxto allow for the equilibrium/QFM surface to vary during optimization, useful for single-stage optimizations. - Adds tutorial notebook showcasing QFM surface capability.
- Adds
rotate_zetafunction todesc.compatto rotate anEquilibriumaround Z axis.
Minor Changes
- Changes local area weighting of Bn in
QuadraticFluxobjective to be the square root of the local area element (Note that any existing optimizations using this objective may need different weights to achieve the same result now.) - Adds an
NFPattribute toScalarPotentialField,VectorPotentialFieldandDommaschkPotentialField, to allowSplineMagneticField.from_fieldandMagneticField.save_mgridto efficiently take advantage of the discrete toroidal symmetry of these fields, if present. - Adds support for
numpyversion2.0.0 - Various improvements to optimization algorithms for improving performance of equilibrium solving and optimization, especially on GPUs.
Bug Fixes
- Fixes bug that occurs when taking the gradient of
rootandroot_scalarwith newer versions of JAX (>=0.4.34) and unpins the JAX version. - Changes
FixLambdaGaugeconstraint to now enforce zero flux surface average for lambda, instead of enforcing lambda(rho,0,0)=0 as it was incorrectly doing before. - Fixes bug in
softmin/softmaximplementation. - Fixes bug that occurred when using
ProximalProjectionwith a scalar optimization algorithm. - Fixes bug where
from desc.plotting import *would not importdesc.plotting.poincare_plot
Full Changelog: v0.12.3...v0.13.0