Releases: PlasmaControl/DESC
Releases · PlasmaControl/DESC
v0.7.0
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
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 still0.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
Major Changes
- Adds new function
desc.continuation.solve_continuation
which is a functional interface to theEquilibriaFamily.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 moreEquilibrium
objects, or no arguments to create an empty familySplineMagneticField
can now interpolate axisymmetric fields more efficiently.
Bug Fixes
- Fix bug preventing
lsqtr
from terminating whenmaxiter
is zero. - Fix bug when converting profiles to
FourierZernikeProfile
. - Fix bug where a
FixBoundary
constraint with only 1 mode constrained would throw an error duringobjective.build
Full Changelog: v0.6.2...v0.6.3
v0.6.2
Minor Changes:
- Remove
parent
andchildren
fromEquilibrium
- 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
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 toobjective.build
would override any previously set value foruse_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
- fixed a bug where setting nodes with a linear spaced array versus asking for
Full Changelog: v0.6.0...v0.6.1
v0.6.0
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 attributecurrent
which can be set to anyProfile
type (orNone
if using rotational transform)- Default
Equilibrium
is now fixed zero current rather than zero rotational transform. - For equilibria with both
iota
andcurrent
assigned, which to fix should be specified manually by using eitherFixIota
orFixCurrent
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.
- input file now accepts
- Near axis interface:
Equilibrium.from_near_axis
allows users to load in a solution frompyQSC
orpyQIC
.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 toplot_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 indirect1
- Removes weighting from
transform.fit
, to ensure that the inverse transform is the actual inverse of the forward transform.
- Modifies
- 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
andZAXIS_CC
- comma-separated lists of numbers, such as:
- Add the Boozer currents
I
andG
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 asansi
internally)
- VMEC input conversion now allows for:
- Misc:
- Allow applying boundary conditions on interior surfaces: Adds a
surface_label
arg toFixBoundaryR
andFixBoundaryZ
, defaulting to the label of the given surface. That surface is fixed, instead of always the rho=1 surface. - Remove
use_jit
fromDerivative
class in favor ofjit
ing attributes ofObjectiveFunction
- Add
jit
toObjectiveFunction.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.
- Allow applying boundary conditions on interior surfaces: Adds a
Bug fixes
- Fix bug in derivative of abs(
sqrt(g)
) (thanks to Matt Landreman for reporting). Affected quantities areV_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 ofs = rho^2
.
Full Changelog: v0.5.2...v0.6.0
v0.5.2
Major Changes
-
New objectives for
MercierStability
andMagneticWell
-
Change
LinearGrid
API to be more consistent with otherGrid
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
andplot_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
v0.5.1
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 toFixLambdaGauge
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
v0.5.0
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" anOptimizer
orObjective
, and does not build its ownTransform
s. - 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
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 toperturb
functions - Refactor
basis.get_idx
to use a lookup table rather thannp.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, orFalse
for no symmetry. This is independent of thesym
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
andSurface
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
toIndex
for consistency with JAX - Move
sign
function fromutils
tobackend
, 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>
_