Releases: hiddenSymmetries/simsopt
v0.2.02
simsopt v0.2.0
This release introduces some additions and bug fixes for majority of modules in simsopt.
Changes introduced:
- New class for Reiman magnetic field (see section 5 of Reiman, Greenside (1986), "Calculation of three-dimensional MHD equilibria with islands and stochastic regions", Computer Physics Communications 43 (157-167)) is added by Rogerio. This field has the advantage of allowing an exact calculation of the island width which can be used for island width optimization (example: https://arxiv.org/abs/2102.04497).
- Faster Biot-Savart code by Florian
- A simplified logging interface is introduced by Bharat. Logging can be enabled by using the following two lines in your driver script:
from simsopt import initialize_logging
initialize_logging(filename="simsopt.log") # Filename option can be omitted in which case the default name is default.log
- Some modules are rearranged.
- Top-level imports for important classes are introduced.
- Automatic linting script implemented by Florian. Before you submit your additions/changes to simsopt as PR, please run the
run_autopep
script. Requires autopep8 and flake8. - A new exception class to handle failures in objective function (credits to Matt Landremann).
- Bug fixes.
- Improved documentation.
Boozer surfaces in simsopt
This release introduces boozer surface and computation of aspect ratio of surfaces and some major refactoring of surfaces-related code.
Major changes:
-
SurfaceXYZFourier surfaces are introduced, where (phi, theta) correspond to the Boozer angles on the surface, by solving a nonlinear least squares problem in boozersurface.py.
-
minimizeBoozerScalarizedLBFGS solves a scalarized constrained optimization problem using LBFGS, where
min 0.5* || f(x) ||^2_2 + 0.5 * constraint_weight * (label - labeltarget)^2
+0.5constraint_weight * (y(varphi=0,theta=0) -0)^2+0.5constraint_weight * (z(varphi=0,theta=0) -0)^2
where || f(x)||^2_2 is the sum of squares of the Boozer residual at
a set of quadrature points.
The final two terms in the objective function are boundary conditions to ensure that the parametrization of the surface is unique. -
minimizeBoozerScalarizedNewton solves the same scalarized constrained optimization problem as above, but instead of LBFGS, Newton's method is used.
-
minimizeBoozerConstrainedNewton solves the full constrained optimization problem using Newton's method.
min 0.5*|| f(x) ||^2_2
subject to
label - labeltarget = 0
y(varphi=0,theta=0) - 0 = 0
z(varphi=0,theta=0) - 0 = 0
The user is free to choose either a geometric constraint, e.g. area, or a toroidal flux constraint.
objectives.py is split into coilobjectives.py and surfaceobjectives.py -
Computation of aspect ratio of surfaces using the VMEC definition of aspect ratio is done in the Surface.aspect_ratio.
-
New capability of computing cross-sections of surfaces at a given cylindrical angle. This is done using bisection in the Surface.cross_section.
-
An implementation of SurfaceXYZFourier.to_RZFourier using Surface.cross_section. This is done by computing cross-sections of the SurfaceXYZFourier object and then fitting a SurfaceRZFourier to those cross-sections.
Surfaces in simsopt.geo
Major changes:
simsopt.geo
subpackage introduces a surface class, and two specific implementations SurfaceRZFourier and SurfaceXYZFourier. The interface is closely aligned to the Curve classes, i.e. s.gamma() return an array of dimension (numquadpoints_phi, numquadpoints_theta, 3
), and there are implementation for tangential derivatives and derivatives wrt to the dofs.- The two curve classes are renamed into CurveXYZFourier and CurveRZFourier for consistency.
- Magnetic flux is added to Biot-Savart computation.