-
Notifications
You must be signed in to change notification settings - Fork 71
Passive Arrays Branch PR Part 1: Force and torque overhaul #509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…on.py working fully with Jax objects. Had to make some changes for correctly dealing with coils obtained by symmetries, and rotated curves, and so far can plot the curves and initial surface errors correctly.
…s, and now optimizing over the sum of the net forces squared over all the coils.
…energy and inductance calculations working. Started a version of the self force from hurwitz paper but havent finished, and not sure how I will debug.
…at the frenet frame is not implemented for the JaxCurves so need to do this myself in the curve.py file. Also tested that the torque and tve objectives along have good-looking taylor tests and do sensible things when run them on the basic stage two example.
…ion objectives that compute the net torques and net forces from one set of coils onto another set of coils with different parameters (e.g. TF coils vs dipole coils with differing number of quadpoints).
…26 dipole coils and some fiddling, can get to 9e-4 or so solution in Bn_over_B. Feels like plenty still to hyperparameter tune there. Still need to test and debug the self force calculation and double check all the tve stuff. Then run a self force scan and add to paper.
…is in the self force calculations.
…y on desktop later.
…ions. Net force minimization does minimize net forces better but at cost of much higher pointwise forces. Maybe can combine the objectives.
…lculation from JaxCurves. Switching to Greene to try gpus again.
…ce calculations by directly computing BiotSavart, rather than calling a BiotSavart object in the loop, which gets very slow with many coils as the number of Optimizable objects balloon. Self forces also appear intolerably high, even for basic planar TF coils. Need to discuss this.
…es in this commit.
…ies/simsopt into planar_coil_arrays
…ying to get various examples in order now and generate Pareto plots.
src/simsopt/field/coil.py
Outdated
| """ | ||
|
|
||
| def __init__(self, curve, current): | ||
| def __init__(self, curve, current, regularization=regularization_circ(0.05)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akaptano what is the plan here?
| #!/usr/bin/env python | ||
|
|
||
| """ | ||
| coil_force_pareto_scans.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should move this example to another location. The pareto scans are useful, but examples may not be the right home for them, since they are more of a utility than an instruction example. I don't exactly know where to put them for now, since we dont have a directory for this type of thing in simsopt at the moment.
| optimization_tools.py | ||
| --------------------- | ||
|
|
||
| This module provides tools for large-scale parameter scans and optimization workflows for stellarator coil design using SIMSOPT. It includes routines for: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should talk about what to do with this function. PyTorch, for example, has a separate module, PytorchLightning, where useful tools have been built for accelerating typical tasks. Anyhow, there are some options.
| #!/usr/bin/env python | ||
|
|
||
| """ | ||
| initiation.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree the scans are useful. I think we need to find the right home for them.
| pointData = {**pointData, **extra_data} | ||
| curves_to_vtk(curves, filename, close=close, extra_data=pointData) | ||
|
|
||
| def coils_via_symmetries(curves, currents, nfp, stellsym, regularizations=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see. i think there is value in having the RegularizedCurve class or something similar.
…zation related functions. Moved some functions from permanent magnet helpers, which was getting full of functions that were not specific to permanent magnets.
…reto scan functionality to a helper function file. Added a simple unit test for the new helper function file, but probably coverage is very bad on this right now. Will have to take a look at this more carefully once the coverage updates online.
… of a bunch of functions to coil_optimization_helper_functions.
|
@mishapadidar I have implemented the RegularizedCoil class and moved some of the pareto scans to a file utils/coil_optimization_helper_functions.py. Unfortunately this also ballooned the PR a bit, since now those helper functions need unit tests. Let me know if you have any last changes. |
|
@mishapadidar @andrewgiuliani friendly monthly reminder |
|
Hi, Alan, these are great changes. To continue with the review process, it would be helpful to break up this PR into more pieces. The idea is to try to separate the PR into self-contained pieces. We will be able to review smaller pieces more quickly. Here is a suggested breakdown.
At this point, the core functionality of this PR will have landed. The remaining bits such as |
As discussed with @mishapadidar, @landreman and others, I am opening a pull request here to first get the force and torque overhaul changes merged into main. Then I will open a new pull request that adds in the dipole array and passive coil array work. Then a third pull request will be opened for other fixes on that branch. My hope is to have this ready by the end of today May 8.
To be clear, I have stripped out all of the passive and dipole array stuff. However this still includes a number of little fixes in addition to the big changes in the force and torque calculations. In addition, I have systematically added comments to all the changed files to narrate my thinking as you do your review. To summarize, the changes include: