Skip to content

v0.15.0

Choose a tag to compare

@dpanici dpanici released this 21 Aug 23:06
· 158 commits to master since this release
c155aac

New Features

  • Adds new desc.geometry.FourierXYCurve and desc.coils.FourierXYCoil classes, 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 like FourierPlanarCurve and FourierPlanarCoil), which can make describing certain shapes (such as ellipses) easier. See #1504 for more information.
  • Adds desc.objectives.PlasmaCoilSetMaxDistance objective, 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_flatten utility 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_lines function which can take in an input desc.magnetic_fields.MagneticField object and plot a field line trajectory starting from some initial point in cylindrical coordinates.
  • Addsgamma_c compute quantity which is the integrand of Gamma_c. User can also plot gamma_c using the desc.plotting.plot_gammac function. (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_axis method
  • Improve performance of desc.magnetic_fields.field_line_integrate for fields with large stored attributes (such as desc.magnetic_fields.SplineMagneticField (#1830)
  • Performance improvements for desc.objectives.BallooningStability objective (#1763, #1826)
  • Performance improvements for objectives which rely on coordinate mapping #1826

Minor Changes

  • Adds source_grid kwarg to from_field for SplineMagneticField , 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 safenormalize to work on multiple vectors.
  • Updates to docs

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_input for spline profiles (see #1740)
    • fixes error when reading VMEC input files with PMASS_TYPE defined which could result in converted DESC input files lacking a pressure profile
  • Ensures the stochastic optimizer sgd prints an iteration even if the first step satisfies the termination criterion
  • Fix nan in reverse mode gradient caused by rotation_matrix
  • Fix some outstanding bugs with desc.io.write_ascii function
  • Fixes bug in desc.geometry.FourierRZCurve from_values when a numpy array. See #1828
  • Ensures user supplied linear constraint x_scale passed to desc.optimize.Optimizer.optimize is not overwritten by the default dynamically updated x_scale

Deprecations

  • desc.io.write_ascii method 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_F and norm_name kwargs from desc.plotting functions (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 linecolor to color in the desc.plotting module 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 the desc repository, but if you have custom objectives or other local objects that subclass from desc you 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 with desc if you have any questions.

New Contributors

Full Changelog: v0.14.2...v0.15.0