Skip to content

Commit

Permalink
ε and Γ_c with Fourier Bounce (#1290)
Browse files Browse the repository at this point in the history
This PR updates the
- `Gamma_c` #1042 
- `effective ripple` #1003

objectives to use the numerical methods from #1119
  • Loading branch information
unalmis authored Dec 24, 2024
2 parents e357a9b + 08b31b2 commit 7d378c2
Show file tree
Hide file tree
Showing 47 changed files with 2,815 additions and 1,611 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
Changelog
=========

New Feature
New Features

- Bounce integral methods with ``desc.integrals.Bounce2D``.
- Effective ripple ``desc.objectives.EffectiveRipple`` and Gamma_c ``desc.objectives.Gamma_c`` optimization objectives.
- See GitHub pull requests [#1003](https://github.com/PlasmaControl/DESC/pull/1003), [#1042](https://github.com/PlasmaControl/DESC/pull/1042), [#1119](https://github.com/PlasmaControl/DESC/pull/1119), and [#1290](https://github.com/PlasmaControl/DESC/pull/1290) for more details.
- Many new compute quantities for partial derivatives in different coordinate systems.
- Adds a new profile class ``PowerProfile`` for raising profiles to a power.
- Add ``desc.objectives.LinkingCurrentConsistency`` for ensuring that coils in a stage 2 or single stage optimization provide the required linking current for a given equilibrium.
- Adds an option ``scaled_termination`` (defaults to True) to all of the desc optimizers to measure the norms for ``xtol`` and ``gtol`` in the scaled norm provided by ``x_scale`` (which defaults to using an adaptive scaling based on the Jacobian or Hessian). This should make things more robust when optimizing parameters with widely different magnitudes. The old behavior can be recovered by passing ``options={"scaled_termination": False}``.
- Adds an option ``scaled_termination`` (defaults to True) to all the desc optimizers to measure the norms for ``xtol`` and ``gtol`` in the scaled norm provided by ``x_scale`` (which defaults to using an adaptive scaling based on the Jacobian or Hessian). This should make things more robust when optimizing parameters with widely different magnitudes. The old behavior can be recovered by passing ``options={"scaled_termination": False}``.
- ``desc.objectives.Omnigenity`` is now vectorized and able to optimize multiple surfaces at the same time. Previously it was required to use a different objective for each surface.
- Adds a new objective ``desc.objectives.MirrorRatio`` for targeting a particular mirror ratio on each flux surface, for either an ``Equilibrium`` or ``OmnigenousField``.
- Adds the output quantities ``wb`` and ``wp`` to ``VMECIO.save``.
Expand All @@ -14,11 +18,14 @@ Bug Fixes

- Small bug fix to use the correct normalization length ``a`` in the BallooningStability objective.
- Fixed I/O bug when saving/loading ``_Profile`` classes that do not have a ``_params`` attribute.
- Minor bugs described in [#1323](https://github.com/PlasmaControl/DESC/pull/1323).
- Corrects basis vectors computations made on surface objects [#1175](https://github.com/PlasmaControl/DESC/pull/1175).

v0.13.0
-------

New Features

- Adds ``from_input_file`` method to ``Equilibrium`` class to generate an ``Equilibrium`` object with boundary, profiles, resolution and flux specified in a given DESC or VMEC input file
- Adds function ``solve_regularized_surface_current`` to ``desc.magnetic_fields`` module that implements the REGCOIL algorithm (Landreman, (2017)) for surface current normal field optimization
* Can specify the tuple ``current_helicity=(M_coil, N_coil)`` to determine if resulting contours correspond to helical topology (both ``(M_coil, N_coil)`` not equal to 0), modular (``N_coil`` equal to 0 and ``M_coil`` nonzero) or windowpane/saddle (``M_coil`` and ``N_coil`` both zero)
Expand Down
9 changes: 9 additions & 0 deletions desc/batching.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ def _chunk_vmapped_function(
return functools.partial(_eval_fun_in_chunks, vmapped_fun, chunk_size, argnums)


def batch_map(fun, fun_input, batch_size):
"""Compute vectorized ``fun`` in batches."""
return (
fun(fun_input)
if batch_size is None
else _eval_fun_in_chunks(fun, batch_size, (0,), fun_input)
)


def _parse_in_axes(in_axes):
if isinstance(in_axes, int):
in_axes = (in_axes,)
Expand Down
1 change: 1 addition & 0 deletions desc/compute/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
_bootstrap,
_core,
_curve,
_deprecated,
_equil,
_field,
_geometry,
Expand Down
Loading

0 comments on commit 7d378c2

Please sign in to comment.