DESC icon indicating copy to clipboard operation
DESC copied to clipboard

Adding adjoint ideal-ballooning stability solver to DESC

Open rahulgaur104 opened this issue 2 years ago • 4 comments

Infinite-n ideal MHD ballooning modes are of significant interest to both the tokamak and the stellarator community. These instabilities are also related to smaller-scale kinetic instabilities, which cause significant heat loss from fusion reactors. This commit adds the ability to both analyze and optimize MHD equilibria against the ideal ballooning mode.

An adjoint implementation of an ideal ballooning solver has only been successfully demonstrated previously on a much smaller scale. If this commit works, it would be at least an order of magnitude faster than the linked code.

Here are the tasks:

  • [x] Add geometry coefficients
  • [x] Test geometric coefficients. Maybe compare it with Patrick's fork in DESC. Add a test
  • [x] Add the differential pseudospectral matrix operators
  • [x] Compare the spectral solution with the finite-difference solution (both eigenvalues and eigenfunction). Add a new test
  • [x] Compare results with my older solver
  • [x] Eigendecomposition and adjoint of the matrices. Wrap the routine in DESC magic.
  • [x] Compare results for the HELIOTRON case with COBRAVMEC

rahulgaur104 avatar Aug 22 '23 14:08 rahulgaur104

Codecov Report

Merging #631 (5d15cc0) into master (065bef8) will decrease coverage by 0.28%. The diff coverage is 79.55%.

:exclamation: Current head 5d15cc0 differs from pull request most recent head 452e7f4. Consider uploading reports for the commit 452e7f4 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #631      +/-   ##
==========================================
- Coverage   94.96%   94.68%   -0.28%     
==========================================
  Files          79       79              
  Lines       19296    19355      +59     
==========================================
+ Hits        18325    18327       +2     
- Misses        971     1028      +57     
Files Coverage Δ
desc/compute/_basis_vectors.py 100.00% <100.00%> (ø)
desc/compute/_core.py 100.00% <100.00%> (ø)
desc/compute/_metric.py 100.00% <100.00%> (ø)
desc/compute/_stability.py 73.30% <68.02%> (-26.70%) :arrow_down:

... and 14 files with indirect coverage changes

codecov[bot] avatar Sep 01 '23 18:09 codecov[bot]

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Can we benchmark against COBRAVMEC for the Heliotron example?

ddudt avatar Mar 27 '24 20:03 ddudt

Uploading some comparison results here

HELIOTRON_unstable_comparison

NCSX_unstable_comparison

VMEC-DESC-comparison-HELIOTRON

rahulgaur104 avatar Apr 03 '24 19:04 rahulgaur104

Closing and opening a new PR that imports changes from a repo in the main branch because forked branch is causing issues!

rahulgaur104 avatar Aug 08 '24 03:08 rahulgaur104