Skip to content

Releases: PlasmaControl/DESC

v0.7.0

11 Jan 00:44
40bb94a
Compare
Choose a tag to compare

New Features

  • Add implementation of Surface.compute_curvature.
  • Add return_data flag to plotting functions to return dictionary of plotted data.
  • Add computation of beta, average B, surface curvature, magnetic field derivatives, and others.
    Full list at https://desc-docs.readthedocs.io/en/stable/variables.html
  • Modify Surface classes to always orient surfaces correctly to give the equilibrium a positive Jacobian. This means DESC will always use a right handed coordinate system in both cylindrical and flux coordinates. Previously the orientation of the flux coordinate system would depend on the boundary parameterization.
  • New utility function desc.compat.ensure_positive_jacobian for converting previously saved equilibria to a right handed coordinate system.

Major Changes

  • Refactored backend compute functions to calculate dependencies recursively. This should make it much easier to add new quantities, and reduces compilation times by 50-70%

Minor Changes

  • Refactor wrapping of scipy optimizers.
  • Add check for incompatible constraints in optimization.
  • Improvements to plot_1d to correctly plot flux surface average quantities.
  • Speed up calculation of Boozer transform.
  • Have stability objectives print their max, min and average value at end of solve.

Bug Fixes

  • Fix issue where if fixing specific boundary modes, the indices used to index the target do not match up with the indices of the A matrix.
  • Fix weighting of duplicate nodes for periodic domains.
  • Ensure transforms build correctly even with empty grid.
  • Ensure transforms always have 0,0,0 derivative.
  • Change normalization for poloidal field to avoid having a 0 normalization factor.

Full Changelog: v0.6.4...v0.7.0

v0.6.4

16 Dec 13:18
b905b76
Compare
Choose a tag to compare

Major Changes

  • All objectives now have a normalize argument that when true will nondimensionalize
    the physics value and scale to be approximately ~O(1) in magnitude. This should make it
    easier to tune weights when doing multiobjective optimization.
  • New objective RotationalTransform for targeting a particular iota profile in real
    space.
  • New function plot_boundaries to plot comparisons between boundary shapes.

Minor Changes

  • Maximum JAX version is now 0.4.1 (latest version as of release date). Minimum
    version is still 0.2.11 but this will likely change in the future.

Bug fixes

  • Fix indexing bug in biot-savart for coils that caused the output to have the wrong shape
  • Fix a bug occasionally preventing the optimizer from restarting correctly after
    trying a bad step

Full Changelog: v0.6.3...v0.6.4

v0.6.3

06 Dec 02:52
da5ff8c
Compare
Choose a tag to compare

Major Changes

  • Adds new function desc.continuation.solve_continuation which is a functional interface to the EquilibriaFamily.solve_continuation method
  • Adds new function desc.continuation.solve_continuation_automatic which uses conservative default settings in a continuation method for solving complicated equilibria.
  • Adds method Objective.xs(eq) for getting needed arguments for an objective. For example, objective.compute(*objective.xs(eq)).
  • Adds utility desc.perturbations.get_deltas for finding the differences between surfaces and profiles for perturbations.

Minor Changes

  • EquilibriaFamily can now be created with one or more Equilibrium objects, or no arguments to create an empty family
  • SplineMagneticField can now interpolate axisymmetric fields more efficiently.

Bug Fixes

  • Fix bug preventing lsqtr from terminating when maxiter is zero.
  • Fix bug when converting profiles to FourierZernikeProfile.
  • Fix bug where a FixBoundary constraint with only 1 mode constrained would throw an error during objective.build

Full Changelog: v0.6.2...v0.6.3

v0.6.2

02 Nov 20:37
aa18d20
Compare
Choose a tag to compare

Minor Changes:

  • Remove parent and children from Equilibrium - this was generally unused and caused memory leaks in long optimization runs.
  • Allow targeting current on multiple surfaces with ToroidalCurrent objective.
  • Refactored optimizer backends to get rid of unused code and use more standard BFGS implementation.
  • Added sgd optimizer for performing fixed step gradient descent, with or without momentum. In the future this will be upgraded to include other step size rules and line searches.
  • Allow selecting profile when loading VMEC equilibrium, as previously fixed iota was always assumed.
  • Ensure equilibrium and surface have same symmetry.

Bug fixes:

  • Fix floating point comparison when recovering solution after optimization, occasionally leading to the wrong iteration being returned as "optimal"
  • Fix plotting iota of a current-constrained with plot_1d function
  • Fix bug where having iota specified in an input file along with vacuum objective lead to error. Now specifying vacuum objective will ignore all profile inputs

Full Changelog: v0.6.1...v0.6.2

v0.6.1

11 Oct 19:22
1aa33df
Compare
Choose a tag to compare

New Features

  • plot_boundary function to plot boundary surfaces and multiple toroidal angles together in a single plot. This is a popular plot format in stellarator optimization papers when comparing boundary shapes.

Bug Fixes

  • Fix bugs for vacuum solve
    • Allow for constraining arguments that aren't used in the objective (i.e pressure when minimizing current density)
    • fix bug in CurrentDensity where only jacobi grid was being used
  • Fixes to wrapped objective and jit compiling
    • optimizer with wrapped objective would sometimes return the equilibrium after the final attempted step, even if that step was rejected for not lowering the objective, resulting in incorrect "optimal" result
    • Fixes a bug where the use_jit arg passed to objective.build would override any previously set value for use_jit (such as in the class constructor)
  • Grid spacing bugs fixed
    • fixed a bug where setting nodes with a linear spaced array versus asking for N linearly spaced nodes would result in different weights despite being the same nodes

Full Changelog: v0.6.0...v0.6.1

v0.6.0

28 Sep 12:12
10ff897
Compare
Choose a tag to compare

Major changes

  • Can now solve equilibria with fixed toroidal current, as opposed to fixed rotational transform.
    • input file now accepts c parameter for toroidal current profile (in Amps - note it should be an even polynomial and 0 on axis)
    • Equilibrium now has attribute current which can be set to any Profiletype (or None if using rotational transform)
    • Default Equilibrium is now fixed zero current rather than zero rotational transform.
    • For equilibria with both iota and current assigned, which to fix should be specified manually by using either FixIota or FixCurrent constraints
    • Note that computing iota from fixed current requires flux surface averages, so more oversampling in real space may be required to get correct values.
  • Near axis interface:
    • Equilibrium.from_near_axis allows users to load in a solution from pyQSC or pyQIC.
    • FourierRZToroidalSurface.from_near_axis allows users to create boundary surfaces that are approximately QP/QI based on an unpublished analytic model shared by Matt Landreman.

Minor changes

  • Plotting:
    • Document kwargs, according to matplotlib-style documentation
    • Add kwargs to plotting functions missing sensible/useful kwargs
    • Add check for unused kwargs to most plotting functions
    • Add norm_F option to plot_fsa
  • Transform:
    • Modifies Transform.fit to use the inverse of the forward method transform method (ie, direct1, direct2, fft) rather than always the full matrix inverse as in direct1
    • Removes weighting from transform.fit, to ensure that the inverse transform is the actual inverse of the forward transform.
  • Profiles:
    • Add methods and classes for adding, subtracting, multiplying, scaling profiles
    • Add class for anisotropic profiles using Fourier-Zernike basis (though the compute functions don't make use of the anisotropy yet)
  • Input/Output:
    • VMEC input conversion now allows for:
      • comma-separated lists of numbers, such as: AC = 1.0, 0.5, 0.2
      • non-stellarator symmetric axis initial guesses using the inputs RAXIS_CS and ZAXIS_CC
    • Add the Boozer currents I and G and the Mercier stability fields to VMEC outputs.
    • Make DESC input file reader agnostic to the case of the input options (i.e. spectral_indexing=ANSI in the input file will work now and register as ansi internally)
  • Misc:
    • Allow applying boundary conditions on interior surfaces: Adds a surface_label arg to FixBoundaryR and FixBoundaryZ, defaulting to the label of the given surface. That surface is fixed, instead of always the rho=1 surface.
    • Remove use_jit from Derivative class in favor of jiting attributes of ObjectiveFunction
    • Add jit to ObjectiveFunction.jvp, to hopefully speed up perturbations a bit
    • Enforce odd number of theta nodes for ConcentricGrid, to ensure correct flux surface averages
    • Remove ConcentricGrid rotation option, as this was generally unused and caused some issues with surface averages.

Bug fixes

  • Fix bug in derivative of abs(sqrt(g)) (thanks to Matt Landreman for reporting). Affected quantities are V_rr(r), D_well, D_Mercier, magnetic well
  • Fix a bug with using Transform.fit() for double Fourier series on multiple surfaces simultaneously. Performing the fit one surface at a time corrects this, but there could be room for speed improvements.
  • Rescale the Jacobian saved as gmnc & gmns when saving a VMEC output to reflect the VMEC radial coordinate convention of s = rho^2.

Full Changelog: v0.5.2...v0.6.0

v0.5.2

06 Sep 19:13
4f2c9b4
Compare
Choose a tag to compare

Major Changes

  • New objectives for MercierStability and MagneticWell

  • Change LinearGrid API to be more consistent with other Grid classes:

    • L, M, N now correspond to the grid spectral resolution, rather than the number of grid points
    • rho, theta, zeta can be passed as integers to specify the number of grid points (functionality that used to belong to L, M, N)
    • rho, theta, zeta still retain their functionality of specifying coordinate values if they are not integers
    • Other code that depends on LinearGrid was updated accordingly to use the new syntax
  • Poloidal grid points are now shifted when sym=True to give correct averages over a flux surface.

  • Added default continuation steps to converted VMEC input files

Minor Changes

  • add option to plot_comparison and plot_surfaces to not plot vartheta contours
  • Add better warnings for gpu and jax issues
  • add volume avg force and pressure gradient to the compute functions
  • change is_nested function to use jacobian sign instead of looking for intersections between surfaces
  • Allow alternate computation of multi-objective derivatives, computing individual jacobians and blocking together rather than computing all at once.

Bug Fixes

  • Fix nfev=1 and Some scalar solver Issues
  • Fix some formula errors in second derivatives of certain magnetic field components, caused by some hanging expressions.
  • fix bug where node pattern is always jacobi when force is used as objective
  • Allow hdf5 to store None attributes correctly
  • Fix profile parity and Z axis coefficients in VMECIO.save
  • Ensure axis coefficients are updated correctly after solving equilibrium

New Contributors

Full Changelog: v0.5.1...v0.5.2

v0.5.1

29 Jun 11:23
fc7bde6
Compare
Choose a tag to compare

v0.5.1

Github Commits

Major Changes

  • Add ability to change NFP after creation for equilibria, curves, and surfaces.
  • Fix rounding errors when building high resolution grids.
  • Rename LambdaGauge constraint to FixLambdaGauge for consistency.
  • Documentation updates to hdf5 output, VMEC conversion, plotting, etc.
  • Change default spectral indexing to "ansi".
  • Adds desc.examples.get to load boundaries, profiles, and full solutions from a number of example equilibria.
  • Default grid resolution is now 2x spectral resolution.
  • New surface method FourierRZToroidalSurface.from_input_file to create a surface from boundary coefficients in a DESC or VMEC input file.
  • Adds new tutorial notebooks demonstrating VMEC io, continuation, plotting, perturbations, optimization etc.
  • New documentation on perturbation theory and evaluating Zernike polynomials.
  • Fix bug preventing vacuum solutions from solving properly.

v0.5.0

21 Jun 13:13
bc6f39d
Compare
Choose a tag to compare

v0.5.0

Github Commits

Major Changes

  • New API for building objectives and solving/optimizing equilibria. A brief explainer can be found in the documentation
  • The Equilibrium class no longer "owns" an Optimizer or Objective, and does not build its own Transforms.
  • The ObjectiveFunction class is a "super-objective" that combines multiple "sub-objectives" which follow the ABC _Objective class.
  • Each sub-objective function can be used as either an "objective" (minimized during optimization) or a "constraint" (enforced exactly).
  • Each sub-objective function takes unique inputs that can be specified by a grid/surface/etc. or use default values from an Equilibrium.
  • Each sub-objective is responsible for building its own transforms or other constant matrices, and is also responsible for computing its own derivatives.
  • The super-objective dynamically builds the state vector with the independent variables from each sub-objective, and also combines the function values and derivatives by combining the outputs from each sub-objective.
  • The super-objective only takes a single argument (the state vector x or y). Perturbations are now performed wrt the full state vector y, which contains all of the individual parameters.
  • Adds ability to optimize physics quantities under equilibrium constraint using wide array of scipy and custom optimizers.
  • New objective for solving vacuum equilibria

v0.4.13

08 Mar 21:43
cba574f
Compare
Choose a tag to compare

Major Changes

  • Updates JAX dependencies to take advantage of new functionality and faster compile times:
  • Minimum jax version is now 0.2.11
  • Minimum jaxlib version is now 0.1.69
  • Pressure and Iota perturbations now weight mode numbers by L**2 + M**2 to avoid high frequency noise.
  • Custom weighting also allowed by passing weights array to perturb functions
  • Refactor basis.get_idx to use a lookup table rather than np.where. This means it works under JIT and AD, but only allows scalar inputs. To get multiple indices, call the method multiple times
  • ConcentricGrid now accepts a rotation argument to rotate the grid for either 'sin' or 'cos' symmetry, or False for no symmetry. This is independent of the sym argument, which eliminates nodes with theta > pi.
  • Derivative operators for spline based profile and magnetic field classes are now precomputed, giving roughly 30-40% speedup in evaluation.

Bug Fixes

  • Fixed a bug where some properties were not copied correctly when doing obj.copy(deepcopy=True)
  • Fixed sign convention on poloidal quantities when saving to VMEC format
  • Fixed bugs in Curve and Surface that would fail when setting coefficients in JAX arrays

Testing

  • Add tests for Heliotron example
  • Adds timing benchmarks for standard equilibrium solves

Examples

  • Fix sign convention issue with Heliotron boundary modes to be consistent with VMEC
  • Add example for Simsopt QA stellarator from A. Bader et al. 2021

Miscellaneous

  • renamed opsindex to Index for consistency with JAX
  • Move sign function from utils to backend, as it now needs JAX
  • lots of minor formatting changes in docstrings

Github Commits <https://github.com/PlasmaControl/DESC/compare/v0.4.12...v0.4.13>_