New Features
- Adds
desc.objectives.DeflationOperator, a new objective class which can be used to apply deflation techniques to equilibrium and optimization problems to find multiple local minima or multiple solutions from a single initial point, either by wrapping an existingdesc.objectives._Objectiveobject or by including as an additional penalty or constraint. Also adds a tutorial showing this functionality. - Sub-objectives of an
ObjectiveFunctioncan now have differentuse_jitvalues than theObjectiveFunction. These objectives have to be built before building theObjectiveFunction. - Adds
num_neighborsparameter toCoilSetMinDistancethat limits the pairwise distance computation to the nearest neighbors per coil, reducing memory useage for large coilsets. - Method to plot frequency spectrum of inverse stream map in field line coordinates
Bounce2D.plot_angle_spectrum. - Method to compute bounce integrals in batches is now added to the public API
Bounce2D.batch. - Initiated deprecation of
Bounce2D.compute_fieldline_lengthin favor ofeq.compute("V_psi"). - The quadrature resolution in
Bounce2D.compute_fieldline_lengthnow corresponds to the resolution over a single field period instead of the resolution over a toroidal transit. - Adds an optional attribute
ion_densityto theEquilibriumclass, to allow the ion density profile to be set independently of the electron density and effective atomic number. Also adds compute functions for"ni_rr"and"Zeff_rr". - Modernizes dependencies to use
nvidia-ml-pyin place ofnvgpu.
Important
If you are updating an existing software environment uninstall pynvml first and then reinstall the dependencies to correctly get nvidia-ml-py.
Bug Fixes
- Fixes SyntaxError thrown when loading hdf5 data from file-like objects.
- Fixes a bug in
OmnigenousField.change_resolutionwhen changingL_B. - Scaling a
ScaledProfileor taking power of aPowerProfilenow only updates thescale/powerattributes instead of nesting theScaledProfile/PowerProfiles. jax.Arrays in_static_attrswill be automatically converted tonp.ndarrayto prevent stalling code. In general, jax arrays should be omitted in_static_attrs.- Fixes a bug in
desc.magnetic_fields.fieldline_integratewhen calling with an integerbs_chunk_size.
Performance Improvements
- Reduces import time of
descmodules.- Now,
desc.compute._build_data_indexuses depth-first search algorithm to construct the dependency tree. - Some of the default value computations at import time are removed (i.e.
desc.integrals.bounce_integral.default_quad)
- Now,
- Significantly improves convergence of inverse stream maps (#1919).
- Check-pointing to bounce integrals to improve speed and reduce memory of reverse mode differentiation.
- Resolves a JAX memory regression in bounce integrals by avoiding materialization of a large tensor in memory. Previously, we had closed the issue by adding nuffts as a workaround. This update actually solves the issue for the case when a user specifies to not use nuffts as well.
ObjectiveFunction.print_valuecan now use the previously computedcompute_scaled_errorvalues to print. For bounded objectives, we fall back to computingcompute_unscaled. Additionally,compute_scaled_errorand array splitting are used in other parts of the code to prevent recompilation for one-time tasks, which makes initialization faster.
Deprecations
constantsargument ofcompute,jvp,jac,gradandhessmethods (including all of their variants) to all objective classes (includingObjectiveFunctionand wrappers) is deprecated and will be removed in a future release. This argument was not necessary, and the code will still work if user doesn't pass it. Users should update their custom objectives for this change. In addition,constantsproperty of theObjectiveFunctionand all sub-classes of_Objectiveis deprecated.
New Contributors
- @andycthea made their first contribution in #2123
- @TElder-thea made their first contribution in #2140
- @matthewfeickert made their first contribution in #2163
Full Changelog: v0.17.1...v0.17.2