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

Umbilic fourier bounce #1349

Draft
wants to merge 655 commits into
base: master
Choose a base branch
from
Draft

Umbilic fourier bounce #1349

wants to merge 655 commits into from

Conversation

rahulgaur104
Copy link
Collaborator

This is a dummy PR that combines fourier bounce with rg/NFP_fac so we can find umbilic equilibria with good omnigenity.
The purpose right now is to see if I can do such an optimization. The optimization throws a cryptic error when I combine combine umbilic with ripple (spline field.)

unalmis and others added 30 commits September 18, 2024 15:32
Due to using |B|^2 instead of jnp.sqrt(|B|^2)**2 in compute functions
the GitHUB CI fails on test_compute everything with he following errors.
So we increase the tolerance.

Not equal to tolerance rtol=1e-10, atol=1e-10
Parameterization: desc.equilibrium.equilibrium.Equilibrium. Name: J^rho.
Mismatched elements: 5 / 660 (0.758%)
Max absolute difference: 2.06564437e-08
Max relative difference: 1.97650683e-09
 x: array([-4.121012e+02, -1.125881e+03, -1.537982e+03, -1.537982e+03,
       -1.125881e+03, -4.121012e+02, -6.978519e+02, -1.423246e+03,
       -1.440419e+03, -2.124563e+03, -2.423728e+03, -1.091549e+03,...
 y: array([-4.121012e+02, -1.125881e+03, -1.537982e+03, -1.537982e+03,
       -1.125881e+03, -4.121012e+02, -6.978519e+02, -1.423246e+03,
       -1.440419e+03, -2.124563e+03, -2.423728e+03, -1.091549e+03,...

Not equal to tolerance rtol=1e-10, atol=1e-10
Parameterization: desc.equilibrium.equilibrium.Equilibrium. Name: F_helical.
Mismatched elements: 5 / 660 (0.758%)
Max absolute difference: 3.14466888e-08
Max relative difference: 1.97650684e-09
 x: array([-1.033077e-09,  3.099232e-09, -4.648847e-09,  1.549616e-09,
        1.033077e-09, -4.648847e-09, -1.095852e+02, -2.269565e+02,
       -2.359033e+02, -3.581634e+02, -4.179317e+02, -1.904907e+02,...
 y: array([-1.033077e-09,  3.099232e-09, -4.648847e-09,  1.549616e-09,
        1.033077e-09, -4.648847e-09, -1.095852e+02, -2.269565e+02,
       -2.359033e+02, -3.581634e+02, -4.179317e+02, -1.904907e+02,...

Not equal to tolerance rtol=1e-10, atol=1e-10
Parameterization: desc.equilibrium.equilibrium.Equilibrium. Name: F_theta.
Mismatched elements: 3 / 660 (0.455%)
Max absolute difference: 1.67492544e-08
Max relative difference: 1.97650688e-09
 x: array([-4.687658e-10,  1.406297e-09, -2.109446e-09,  7.031486e-10,
        4.687658e-10, -2.109446e-09, -4.906491e+01, -1.020250e+02,
       -1.067778e+02, -1.633828e+02, -1.919069e+02, -8.779719e+01,...
 y: array([-4.687658e-10,  1.406297e-09, -2.109446e-09,  7.031486e-10,
        4.687658e-10, -2.109446e-09, -4.906491e+01, -1.020250e+02,
       -1.067778e+02, -1.633828e+02, -1.919069e+02, -8.779719e+01,...

Not equal to tolerance rtol=1e-10, atol=1e-10
Parameterization: desc.equilibrium.equilibrium.Equilibrium. Name: J^zeta.
Mismatched elements: 1 / 660 (0.152%)
Max absolute difference: 1.62435754e-09
Max relative difference: 2.39065063e-10
 x: array([ 6.169842e+01,  6.169842e+01,  6.169842e+01,  6.169842e+01,
        6.169842e+01,  6.169842e+01,  1.094439e+04,  8.052767e+03,
        3.164126e+03, -2.186919e+03, -6.393220e+03, -8.582584e+03,...
 y: array([ 6.169842e+01,  6.169842e+01,  6.169842e+01,  6.169842e+01,
        6.169842e+01,  6.169842e+01,  1.094439e+04,  8.052767e+03,
        3.164126e+03, -2.186919e+03, -6.393220e+03, -8.582584e+03,...

Not equal to tolerance rtol=1e-10, atol=1e-10
Parameterization: desc.equilibrium.equilibrium.Equilibrium. Name: J.
Mismatched elements: 1 / 1980 (0.0505%)
Max absolute difference: 2.29847501e-08
Max relative difference: 2.3906495e-10
 x: array([[-1.179022e-12,  3.689596e+02,  1.645854e+03],
       [ 7.763537e-10,  3.689596e+02,  1.645854e+03],
       [-8.259202e-10,  3.689596e+02,  1.645854e+03],...
 y: array([[-1.179022e-12,  3.689596e+02,  1.645854e+03],
       [ 7.763537e-10,  3.689596e+02,  1.645854e+03],
       [-8.259202e-10,  3.689596e+02,  1.645854e+03],...

Not equal to tolerance rtol=1e-10, atol=1e-10
Parameterization: desc.equilibrium.equilibrium.Equilibrium. Name: F_rho.
Mismatched elements: 6 / 660 (0.909%)
Max absolute difference: 2.30247679e-08
Max relative difference: 3.13879473e-10
 x: array([ 1.044221e+03,  7.644227e+02,  2.797981e+02, -2.797981e+02,
       -7.644227e+02, -1.044221e+03,  8.748079e+02,  6.315174e+02,
        8.434725e+02,  9.728103e+02,  8.031394e+01, -9.269602e+02,...
 y: array([ 1.044221e+03,  7.644227e+02,  2.797981e+02, -2.797981e+02,
       -7.644227e+02, -1.044221e+03,  8.748079e+02,  6.315174e+02,
        8.434725e+02,  9.728103e+02,  8.031394e+01, -9.269602e+02,...

Not equal to tolerance rtol=1e-10, atol=1e-10
Parameterization: desc.equilibrium.equilibrium.Equilibrium. Name: J_phi.
Mismatched elements: 1 / 660 (0.152%)
Max absolute difference: 9.02218744e-09
Max relative difference: 2.3906495e-10
 x: array([ 3.689596e+02,  3.689596e+02,  3.689596e+02,  3.689596e+02,
        3.689596e+02,  3.689596e+02,  6.574153e+04,  4.829832e+04,
        1.893106e+04, -1.305157e+04, -3.808409e+04, -5.107903e+04,...
 y: array([ 3.689596e+02,  3.689596e+02,  3.689596e+02,  3.689596e+02,
        3.689596e+02,  3.689596e+02,  6.574153e+04,  4.829832e+04,
        1.893106e+04, -1.305157e+04, -3.808409e+04, -5.107903e+04,...

Not equal to tolerance rtol=1e-10, atol=1e-10
Parameterization: desc.equilibrium.equilibrium.Equilibrium. Name: J*sqrt(g).
Mismatched elements: 1 / 1980 (0.0505%)
Max absolute difference: 3.49973561e-08
Max relative difference: 2.39065196e-10
 x: array([[-2.577098e-10,  0.000000e+00,  2.590525e-10],
       [ 5.659700e-10,  5.283297e-10, -1.975447e-09],
       [-3.107391e-10, -1.188742e-09,  4.018067e-09],...
 y: array([[-2.577098e-10,  0.000000e+00,  2.590525e-10],
       [ 5.659700e-10,  5.283297e-10, -1.975447e-09],
       [-3.107391e-10, -1.188742e-09,  4.018067e-09],...

Not equal to tolerance rtol=1e-10, atol=1e-10
Parameterization: desc.equilibrium.equilibrium.Equilibrium. Name: J_rho.
Mismatched elements: 1 / 660 (0.152%)
Max absolute difference: 1.72271939e-08
Max relative difference: 1.49087068e-10
 x: array([-4.127112e+02, -1.127548e+03, -1.540259e+03, -1.540259e+03,
       -1.127548e+03, -4.127112e+02,  2.171914e+04,  4.405792e+04,
        2.387998e+04, -1.988408e+04, -4.441021e+04, -2.299714e+04,...
 y: array([-4.127112e+02, -1.127548e+03, -1.540259e+03, -1.540259e+03,
       -1.127548e+03, -4.127112e+02,  2.171914e+04,  4.405792e+04,
        2.387998e+04, -1.988408e+04, -4.441021e+04, -2.299714e+04,...

Not equal to tolerance rtol=1e-10, atol=1e-10
Parameterization: desc.equilibrium.equilibrium.Equilibrium. Name: F_zeta.
Mismatched elements: 3 / 660 (0.455%)
Max absolute difference: 1.86773832e-08
Max relative difference: 1.97650681e-09
 x: array([-4.897653e-10,  1.469296e-09, -2.203944e-09,  7.346479e-10,
        4.897653e-10, -2.203944e-09, -4.639982e+01, -9.736332e+01,
       -1.050441e+02, -1.705320e+02, -2.151820e+02, -1.034384e+02,...
 y: array([-4.897653e-10,  1.469296e-09, -2.203944e-09,  7.346479e-10,
        4.897653e-10, -2.203944e-09, -4.639982e+01, -9.736332e+01,
       -1.050441e+02, -1.705320e+02, -2.151820e+02, -1.034384e+02,...

Not equal to tolerance rtol=1e-10, atol=1e-10
Parameterization: desc.equilibrium.equilibrium.Equilibrium. Name: F.
Mismatched elements: 14 / 1980 (0.707%)
Max absolute difference: 7.244671e-08
Max relative difference: 3.84854726e-09
 x: array([[ 4.185952e+03, -8.299412e-11,  3.296918e-12],
       [ 4.185952e+03,  8.262415e-10, -2.076149e-09],
       [ 4.185952e+03, -9.693418e-10,  2.147146e-09],...
 y: array([[ 4.185952e+03, -8.299412e-11,  3.296918e-12],
       [ 4.185952e+03,  8.262415e-10, -2.076149e-09],
       [ 4.185952e+03, -9.693418e-10,  2.147146e-09],
For unoptimized |B|, typically higher N is needed to capture all oscillations. θ will likely always be fine with low N since it's essentially just proportional to iota at fixed alpha, so Chebyshev converges fast.
Rather than doing coordinate mapping on M * N tensor grid each large, do it on M * (N_{\theta} where N θ is small. Then use the resulting, accurate, θ(α, ζ) to compute the interpolation points in (α, ζ) so that |B| (α, ζ) can be constructed with large Chebyshev resolution. This reduces the number of points to perform root finding on each time we want to compute a neoclassical objective, decreases interpolation error, increases speed etc.
rahulgaur104 and others added 27 commits October 30, 2024 11:49
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@rahulgaur104 rahulgaur104 marked this pull request as draft November 9, 2024 06:38
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.

4 participants