Skip to content
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

Reverse-Mode Differentiable Ideal-Ballooning Stability Solver #1170

Open
wants to merge 213 commits into
base: master
Choose a base branch
from

Conversation

rahulgaur104
Copy link
Collaborator

@rahulgaur104 rahulgaur104 commented Aug 8, 2024

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:

  • Add geometry coefficients
  • Test geometric coefficients. Maybe compare it with Patrick's fork in DESC. Add a test
  • Compare results with each other (ideal_ball_gamma1, ideal_ball_gamma2, Newcomb_metric) and with my older finite-difference solver
  • Eigendecomposition and adjoint of the matrices. Wrap the routine in DESC magic.
  • Compare results for the HELIOTRON case with COBRAVMEC
  • Write a test for HELIOTRON comparison with COBRAVMEC
  • Write a test for the Newcomb metric

rahulgaur104 and others added 30 commits August 24, 2023 15:56
N_alpha = int(source_grid.num_alpha)
N_zeta = int(len(phi) / N_alpha)

B = jnp.reshape(data["|B|"], (N_alpha, 1, N_zeta))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might have to change this after #1214 was merged, you can use
B = transforms['grid'].meshgrid_reshape(data['|B|'], "arz"), similar for the other places you reshape stuff to separate the fieldlines. I can do it tomorrow, let's see if the tests fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants