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

ε and Γ_c objectives with Fourier Bounce #1290

Open
wants to merge 380 commits into
base: ku/fourier_bounce
Choose a base branch
from

Conversation

unalmis
Copy link
Collaborator

@unalmis unalmis commented Oct 3, 2024

This PR updates the Gamma_c, Gamma_c Velasco #1042 and effective ripple #1003 objectives to use the numerical methods from #1119.

unalmis and others added 30 commits July 1, 2024 20:24
which was used just to compute R0. probably not worth the memory
@unalmis
Copy link
Collaborator Author

unalmis commented Oct 23, 2024

Here's what I am trying to run based on your example script after checking out this branch
JAX errors in root stuff

I can't reproduce. maybe let's wait until things like #1293 get merged before debugging

This descript copies the comment at #1290 (comment).
Due to how we make sure enough resolution is used when we call `eq.compute`, the code I gave above actually computes this quantity by computing all dependencies of the effective ripple on this higher resolution grid:
```python
all_dependencies_grid = LinearGrid(rho=rho, M=eq.M_grid, N=eq.N_grid, NFP=eq.NFP, sym=False)
```
Because #1313 was not resolved yet, I had marked `effective ripple` as a quantity that should not be overriden when we call `eq.compute`. That means that once all the input data to the `effective ripple` was computed accurately on the above grid. The computation of the effective ripple itself used this grid
```python
eps_eff_grid = LinearGrid(rho=rho, theta=eq.M_grid, zeta=eq.N_grid, NFP=eq.NFP, sym=False)
```
This grid has half as many nodes in poloidal and toroidal directions on which we compute FFTs to do all the integrals. The plot above is the result of this computation against Neo. To generate the Neo plot we converted the equilibrium to boozer coordinates at three times the DESC equilibrium (eq.M, eq.N, etc.) resolution.

So the conclusion is that when all the bounce integrals are done using FFTs that are generated from half typical desc resolution, then effective ripple  converges to Neo produces from an input with boozer resolution three times the DESC resolution.

Now that #1313 is resolved, I have merged that PR into this branch, and marked effective ripple as a flux surface quantity (by saying resolution_requirement="tz"). That means unless `override_grid=False` is given then everything, including all the bounce integrals will be computed on a grid with resolution at least
```python
all_dependencies_grid = LinearGrid(rho=rho, M=eq.M_grid, N=eq.N_grid, NFP=eq.NFP, sym=False)
```

The old behavior can be recovered by marking `effective ripple 3/2` compute as something other than requiring theta and zeta resolution. i.e. changing `resolution_requirement="tz"` to `resolution_requirement="z"`. Then the code I gave above (repeated here), will reproduce that plot.
```python
eq = get("W7-X")
rho = np.linspace(1e-12, 1, 60)  # the axis limit IS implemented by the way
grid = LinearGrid(rho=rho, theta=eq.M_grid, zeta=eq.N_grid, NFP=eq.NFP, sym=False)
num_transit = 64
data = eq.compute(
    "effective ripple 3/2",
    grid=grid,
    theta=Bounce2D.compute_theta(eq, X=32, Y=64, rho=rho),
    num_transit=num_transit,
    num_quad=64,
    num_pitch=200,
    num_well=20 * num_transit,
)
```
@unalmis unalmis mentioned this pull request Oct 24, 2024
@dpanici
Copy link
Collaborator

dpanici commented Oct 30, 2024

If this PR depends on a function from a newer version of JAX @ddudt @unalmis , update the requirements to reflect this

@unalmis
Copy link
Collaborator Author

unalmis commented Oct 31, 2024

Here's what I am trying to run based on your example script after checking out this branch
JAX errors in root stuff

I can't reproduce. maybe let's wait until things like #1293 get merged before debugging

Still can't reproduce.

@unalmis unalmis changed the title ε and Γ_c objectives with Bounce2D ε and Γ_c objectives with Fourier Bounce Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stable only merges and reviewer requested changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants