v0.15.0
New Features
- Adds new
desc.geometry.FourierXYCurveanddesc.coils.FourierXYCoilclasses, which are a form of planar curve and coil class which describe the curve in terms of cartesian x and y in the plane (as opposed to using polar radius likeFourierPlanarCurveandFourierPlanarCoil), which can make describing certain shapes (such as ellipses) easier. See #1504 for more information. - Adds
desc.objectives.PlasmaCoilSetMaxDistanceobjective, which allows setting a maximum distance the coils are allowed to be from the equilibrium, useful, for example, when trying to balance the need for space for a blanket while also ensuring the cryostat is not too large. See #1722 - Add
meshgrid_flattenutility for flattening 3d data to a 1d array in the correct order, essentially the opposite of meshgrid_reshape. - Adds ability to get top k eigenfunctions the corresponding eigenvalues from the ideal ballooning solver.
- Adds
desc.plotting.plot_field_linesfunction which can take in an inputdesc.magnetic_fields.MagneticFieldobject and plot a field line trajectory starting from some initial point in cylindrical coordinates. - Adds
gamma_ccompute quantity which is the integrand ofGamma_c. User can also plotgamma_cusing thedesc.plotting.plot_gammacfunction. (Note this function uses more memory than expected due to a performance regression in an upstream library. This is resolved in the next release).
Performance Improvements
- Use integration on the boundary (as opposed to volume integration) for more quantities where this is applicable (through use of Stoke's theorem), see #1094
- Minor memory improvements from a slight refactoring of
desc.equilibrium.Equilibrium.from_near_axismethod - Improve performance of
desc.magnetic_fields.field_line_integratefor fields with large stored attributes (such asdesc.magnetic_fields.SplineMagneticField(#1830) - Performance improvements for
desc.objectives.BallooningStabilityobjective (#1763, #1826) - Performance improvements for objectives which rely on coordinate mapping #1826
Minor Changes
- Adds
source_gridkwarg tofrom_fieldforSplineMagneticField, to allow for specifying the grid used to discretize the magnetic field the splined field is being created from. - Change default constraints for eq.optimize to just be ForceBalance, so now no other constraints are included by default, see #1725
- Allows
safenormalizeto work on multiple vectors. - Updates to docs
- Notes on role of
eq.Psiin vacuum free boundary in free boundary tutorial and coil optimization tutorial - Updates
Adding new objective functionstutorial - Adds example uses of
GenericObjectiveandObjectiveFromUserto advanced optimization tutorial - updates installation docs for della and adds new
uvinstall method
- Notes on role of
Bug Fixes
- ensures surfaces only compute things that make sense for their parametrizations, see #1724
- fixes bugs in VMEC I/O
- bug in
desc.vmec.write_vmec_inputfor spline profiles (see #1740) - fixes error when reading VMEC input files with
PMASS_TYPEdefined which could result in converted DESC input files lacking a pressure profile
- bug in
- Ensures the stochastic optimizer
sgdprints an iteration even if the first step satisfies the termination criterion - Fix
nanin reverse mode gradient caused byrotation_matrix - Fix some outstanding bugs with
desc.io.write_asciifunction - Fixes bug in
desc.geometry.FourierRZCurve from_valueswhen a numpy array. See #1828 - Ensures user supplied linear constraint
x_scalepassed todesc.optimize.Optimizer.optimizeis not overwritten by the default dynamically updatedx_scale
Deprecations
desc.io.write_asciimethod for equilibrium I/O is deprecated and not recommended for use. Users are recommended instead to use the hdf5 files as the primary method of I/O with DESC objects.- Deprecates
norm_Fandnorm_namekwargs fromdesc.plottingfunctions (plot_fsa,plot_section,plot_2d) in favor of the new compute quantity|F|_normalized, which is the magnitude of the force error normalized by the volume-averaged magnetic pressure gradient. - renames
linecolortocolorin thedesc.plottingmodule functions
Breaking Changes
- Significant changes to how DESC handles static attributes during JIT compilation. Going forward if any class/object has attributes that should be treated as static by
jax.jit, these should be declared at the class level like_static_attrs = ["foo", "bar"]. Generally, non-arraylike attributes such as functions, strings etc should be marked static, as well as any attributes used for control flow. Previously this was done automatically, but in a way that caused a lot of performance bugs and unnecessary recompilation. These changes have been implemented for all classes in thedescrepository, but if you have custom objectives or other local objects that subclass fromdescyou may need to add this yourself. JAX error messages usually do a good job of alerting you to things that need to be static, and feel free to open an issue withdescif you have any questions.
New Contributors
- @gretahibbard made their first contribution in #1529
Full Changelog: v0.14.2...v0.15.0