files for reproduction#2026
Conversation
c2fb6c8 to
ca29113
Compare
dpanici
left a comment
There was a problem hiding this comment.
Files all seem fine, but could you add a README.md to the subfolder that has some info on how to run/setup, even just adding one line saying something like the specific either DESC version, tag, or commit hash which was used to make the figs would be good.
I can't do any of that until #1919 is merged to |
You can still create a tag for the commit you used for plots, and that tag will last forever (even if squashed). You should be able to do this
|
25fe59f to
a2436b3
Compare
efe2a8c to
2395793
Compare
2395793 to
e83e8fe
Compare
ceff949 to
1633152
Compare
9906dc0 to
05c38da
Compare
d2eebf4 to
8ef9e14
Compare
557decc to
fca8c61
Compare
f0b2171 to
7f586c8
Compare
3fa6c9d to
1dde4cc
Compare
 ## Inverse stream maps - [x] Significantly improves convergence of inverse stream maps. Resolves #1922 to my satisfaction. - [x] Truncation rule to remove aliasing error at the shortest wavelengths where the signal to noise ratio is lowest. - [x] Resolves #1928 and increases default objective resolution for `Y_B`. - [x] Method to plot frequency spectrum of inverse stream map. ## Improvements - [x] Check-pointing to increase speed and reduce memory consumption of reverse mode differentiation #1347. - [x] Adds ``low_ram`` mode which is same speed and less memory for `objective.compute`, but slower for `objective.grad` since JAX is poor at iterative algorithms. - [x] Fully resolves #1864 by avoiding materialization of a large tensor in memory. Previously, we had closed the issue by adding nuffts as a workaround. The improvement here actually solves the JAX regression. - [x] Reuses some computations in identifying bounce points to make more efficient. - [x] Increase cache hits, fusing, and reduce floating point error in computing bounce points (very important for accurate integrals). - [x] Transforms an improper field line integral to one on a compact domain where the integrand is periodic to achieve faster convergence. - [x] Improves performance complexity of `interp_to_argmin` for `Bounce2D` from fourth order to spectral as required for Alpert quadrature. - [x] Resolves #1389. ## Usability - [x] Updates plotting utilities to accept `kwargs` as was needed for my article. - [x] Method to compute integrals over plasma volume and velocity space in batches is now added to the public API. People kept asking how to use this private function and also used it for their work, so better to make it public. - [x] Method to make adding new bounce integral objectives simpler. Private for developers only. - [x] Unifies default parameter setup to resolve #1898 for bounce integrals. - [x] Resolves #1388. ## Bugs - [x] Fixes bug in ``test_compute_everything``. - [x] Fixes inverse stream map convergence. ## Benchmarks Just go to #2026 and run `effective_ripple_profile.py`. You will see the large performance improvement from `master`. The CI benchmarks do not reveal this because those benchmarks are essentially just noise. Note that, using the same parameter inputs, the resolution of this branch is also higher than `master` due to the faster convergence. - If you set `use_bounce1d=True` on that script, you will run out of memory as expected since it is an inferior approach (as expected, you get the OOM in the jacobian before you compute a single bounce integral). - If you set ``nufft_eps=0``, you need 175 GB to run that script on `master` (you'll get an OOM and JAX will tell you it needs 175GB), but only 34 GB on this branch. - Using nuffts, the script requires only 6.5 GB on this branch. # Examples ## HELIOTRON ### `Master` branch <img width="480" height="360" alt="test_theta_chebyshev_HELIOTRON" src="https://github.com/user-attachments/assets/9ae1e6c5-983f-48a2-a805-b28fb1aec1e1" /> ### This branch <img width="480" height="360" alt="test_delta_fourier_chebyshev_HELIOTRON" src="https://github.com/user-attachments/assets/3773b5bb-6230-4362-8136-dd91543ac217" /> ## W7-X ### `Master` branch <img width="480" height="360" alt="test_theta_chebyshev_W7-X" src="https://github.com/user-attachments/assets/f2ba109c-0c72-4efc-b432-ed2993ac0795" /> ### This branch <img width="480" height="360" alt="test_delta_fourier_chebyshev_W7-X" src="https://github.com/user-attachments/assets/ef9a642a-7bbc-41b8-a615-7bde6849856d" /> ### NCSX ### `Master` branch <img width="480" height="360" alt="test_theta_chebyshev_NCSX" src="https://github.com/user-attachments/assets/b3d4371d-0539-4c4b-a7a8-0e882258f2f7" /> ### This branch <img width="480" height="360" alt="test_delta_fourier_chebyshev_NCSX" src="https://github.com/user-attachments/assets/5c92c2c2-22de-47d9-bfd7-f3fbed40bb43" /> ## Removal of spectral aliasing <img width="480" height="360" alt="Figure_1" src="https://github.com/user-attachments/assets/c4e78659-b03d-41cb-8e0f-809066b67989" /> # Dynamic shapes - [x] resolves #1303 . - [x] Activates newton step to find bounce points. - It can be shown there exists O(sqrt(epsilon)) error for bounce integrals with 1/v_ll where epsilon is error of bounce point. For v_|| integrals error is conveniently O(epsilon times sqrt(epsilon)). Hence, the `spline` method would require thousands of knots per transit for just a couple digits of accuracy, and it would stop convergence at epsilon<=1e-5 (so sqrt(epsilon) <=3 digits) error due to condition number. Of course, the `spline=False` method has always computed the points with spectral accuracy and has very fast convergence after #1919 ; that method converges to epsilon = machine precision without the newton step. With the newton step, fast convergence is achieved with the spline method as well. - I suspect fast ion confinement optimization will be easier now. ## Benchmarks Here is a timing benchmark on my CPU with `nufft_eps=1e-6`. Prior to this PR, every adjoint call to nufft1 took `>= 1 second` and the full computation was `34 seconds`. Now every adjoint call to nufft1 is `250 milliseconds`, and the full computation is `14 seconds`. These `improvements become larger` as the `sparsity` grows and error tolerance parameter for the nuffts epsilon tends to 0. Likewise, the _improvement_ grows linearly with the `problem size`. As this is called within an optimization loop where time and memory are tight, the improvement is significant. ### Before <img width="510" height="135" alt="Screenshot From 2026-03-29 15-22-56" src="https://github.com/user-attachments/assets/0baf9a88-b775-4a9c-bb39-db568099aae7" /> <img width="510" height="135" alt="Screenshot From 2026-03-29 15-22-36" src="https://github.com/user-attachments/assets/2bc1f730-56af-43ad-9c5e-45e9991c0bd1" /> ### After <img width="510" height="135" alt="Screenshot From 2026-03-29 15-12-35" src="https://github.com/user-attachments/assets/306a6c34-32a3-46e3-8b8c-c4f259a32169" /> <img width="510" height="135" alt="Screenshot From 2026-03-29 15-15-59" src="https://github.com/user-attachments/assets/db12ecb3-210a-4732-a5fc-666ba47475d8" />
Adds files to reproduce the results in the article.