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

fourier bounce #1119

Merged
merged 120 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
d5b231e
Merge branch 'master' into ku/fourier_bounce
unalmis Aug 27, 2024
8d8aa78
MANUAL Merge branch 'bounce' into ku/fourier_bounce
unalmis Aug 28, 2024
a0e31ce
Fix missed things with manual merge in commit 8d8aa78
unalmis Aug 28, 2024
4d469e8
Merge branch 'master' into ku/fourier_bounce
unalmis Sep 16, 2024
dbd80a5
Reviving fourier bounce pull request
unalmis Sep 17, 2024
29fa913
Progressing
unalmis Sep 18, 2024
fa12723
Isolated issue of fourier series convergence to modding of theta by 2pi
unalmis Sep 18, 2024
5d93b3c
Merge branch 'master' into ku/fourier_bounce
unalmis Sep 18, 2024
e4f68b7
Update desc_from_clebsch function
unalmis Sep 18, 2024
fe60029
Merge branch 'master' into ku/fourier_bounce
unalmis Sep 18, 2024
a1fad7e
Merge branch 'ku/stop_angle_mod' into ku/fourier_bounce
unalmis Sep 19, 2024
7113d3f
Debugging cusp
unalmis Sep 19, 2024
0b14c20
document something that should be testd more
unalmis Sep 19, 2024
6c14202
Note that more poloidal resolution is needed
unalmis Sep 19, 2024
be0aa6b
Merge branch 'master' into ku/fourier_bounce
unalmis Sep 19, 2024
c348378
fix test
unalmis Sep 19, 2024
258dad0
-----
unalmis Sep 19, 2024
22df224
Document solution to discontinuity
unalmis Sep 19, 2024
2781681
Fix comment
unalmis Sep 19, 2024
41d440a
Remove unnecessary interpolation:
unalmis Sep 21, 2024
a5c87a4
Doing stuff marked todo
unalmis Sep 21, 2024
4eb6db2
testing
unalmis Sep 21, 2024
87dc90d
Improving API to avoid redundant computation
unalmis Sep 22, 2024
142c13c
Merge branch 'ku/fourier_bounce_part1' into ku/fourier_bounce
unalmis Sep 22, 2024
1d5a84d
Merge branch 'ku/fourier_bounce_part1' into ku/fourier_bounce
unalmis Sep 22, 2024
7977695
Document choice for quadrature
unalmis Sep 22, 2024
fe3d7b4
Merge branch 'ku/fourier_bounce_part1' into ku/fourier_bounce
unalmis Sep 22, 2024
53ca834
More documentation
unalmis Sep 22, 2024
679697f
Document multivaluedness bug and how to fix. likely will be done in n…
unalmis Sep 24, 2024
dfb3eee
Merge branch 'ku/fourier_bounce_part1' into ku/fourier_bounce
unalmis Sep 24, 2024
b270de8
Merge branch 'master' into ku/fourier_bounce
unalmis Sep 24, 2024
38e71e9
Marking test xfail
unalmis Sep 25, 2024
05cb195
Adding more tests and documentation
unalmis Sep 25, 2024
ff2d204
Merge branch 'master' into ku/fourier_bounce
unalmis Sep 26, 2024
134d826
short-circuit convergence of poloidal Fourier series
unalmis Sep 26, 2024
455353f
Remove resolved comment
unalmis Sep 26, 2024
f63f3b3
Stitch theta as well for robustness
unalmis Sep 26, 2024
19e6bd1
Merge branch 'master' into ku/fourier_bounce
unalmis Sep 27, 2024
b1de0d6
Solved the convergence issue
unalmis Sep 27, 2024
e028106
support vector valued to simplify multivalued function reconstruction
unalmis Sep 27, 2024
2ce57ee
Fix comment
unalmis Sep 27, 2024
32fcdb2
Merge branch 'master' into ku/fourier_bounce
unalmis Sep 29, 2024
7b1267a
Add explanation of math in c
unalmis Sep 29, 2024
47988d1
small but important typo in comment
unalmis Sep 29, 2024
f78d7bd
Merge branch 'master' into ku/fourier_bounce
unalmis Sep 30, 2024
ea227a1
Genealize to NFP!=1
unalmis Oct 2, 2024
18af538
Merge branch 'master' into ku/fourier_bounce
unalmis Oct 2, 2024
89762c7
Add NFP to get_rtz_grid
unalmis Oct 2, 2024
c3e465b
More NFP fixes
unalmis Oct 2, 2024
3871353
Got things working now
unalmis Oct 3, 2024
a5cf4bc
Merge branch 'master' into ku/fourier_bounce
unalmis Oct 3, 2024
60fc00f
Change NFP mismatch error back to warning
unalmis Oct 3, 2024
08b54af
Merge branch 'master' into ku/fourier_bounce
unalmis Oct 6, 2024
56dcbb2
Split compute quantities into periodic and secular terms
unalmis Oct 6, 2024
30d511e
Add ability to compute length along field line with fft
unalmis Oct 6, 2024
6870bcd
Make sure returned shape doesn't have extra dimension
unalmis Oct 6, 2024
5e72593
PUlling changes from downstream branch
unalmis Oct 6, 2024
ce64c53
Add missing key to stability fun test
unalmis Oct 6, 2024
7c88211
Document algorithm choices
unalmis Oct 6, 2024
1376e90
Update incorrect comment
unalmis Oct 6, 2024
d54a809
document better root finding method for later
unalmis Oct 7, 2024
8cef6d3
update ballooning notebook by explicitly comping gbdrift
unalmis Oct 7, 2024
0e07215
resolving jit error
unalmis Oct 7, 2024
47962de
Merge branch 'master' into ku/fourier_bounce
YigitElma Oct 12, 2024
4d3e49e
Document that almost-equispaced Kosloff/Tal-Ezer arcsin map gives wor…
unalmis Oct 14, 2024
3495a0d
Adding 2D plots, more quadrature tests, checking 2D PEST convergence
unalmis Oct 17, 2024
dcb7c17
Merge branch 'master' into ku/fourier_bounce
unalmis Oct 17, 2024
9ca889d
Doing review suggestions
unalmis Oct 17, 2024
aedb90f
Fix failing axis limit test
unalmis Oct 17, 2024
8fd8e21
Clarify documentation
unalmis Oct 17, 2024
7b440de
Merge branch 'master' into ku/fourier_bounce
unalmis Oct 17, 2024
a251d3e
Algorithm improvements, last major refactor
unalmis Oct 18, 2024
7e12015
Remove Bounce2D PEST ; will add back 2D plotting functions in later PR
unalmis Oct 18, 2024
263fb56
Add interp_fft_to_argmin for Gamma c Nemov
unalmis Oct 18, 2024
372aae8
Resolves test of bounce average with secular term
unalmis Oct 19, 2024
38da125
Improve interpolate to argmin test
unalmis Oct 19, 2024
7bf01e5
Update master compute data
unalmis Oct 19, 2024
55ee0c3
Fix comment
unalmis Oct 19, 2024
916dad5
reducing compile time
unalmis Oct 19, 2024
ed7833f
adding back use of vecdot
unalmis Oct 19, 2024
927ab54
Merging changes from downstream branch #1290
unalmis Oct 20, 2024
b229726
Pulling updates from downstream branch #1290
unalmis Oct 20, 2024
b9e867e
Increase codecoverage
unalmis Oct 20, 2024
332c053
Increasing coverage
unalmis Oct 20, 2024
7c8902a
Remove redundant parameter to Bounce2D. Last edit unless reviewers re…
unalmis Oct 21, 2024
635cf3d
making reviewer suggested changes
unalmis Oct 21, 2024
45f33c0
Merge branch 'master' into ku/fourier_bounce
unalmis Oct 21, 2024
6da03ab
Rename files as requested by reviewers
unalmis Oct 21, 2024
583dc3f
Apply suggestions from code review
unalmis Oct 21, 2024
9abb6a9
review comments
unalmis Oct 21, 2024
6ff8bce
More review inspired changes
unalmis Oct 22, 2024
f53e668
Merge branch 'master' into ku/fourier_bounce
dpanici Oct 23, 2024
7bef6a4
Merge branch 'master' into ku/fourier_bounce
unalmis Oct 29, 2024
e10c571
Cosmetic changes requested by @dpanici
unalmis Oct 29, 2024
edc8fc2
Merge branch 'master' into ku/fourier_bounce
unalmis Oct 30, 2024
3956822
Merge branch 'master' into ku/fourier_bounce
unalmis Oct 31, 2024
bc88b80
doing @dpanici review requests
unalmis Oct 31, 2024
b421baf
Merge branch 'master' into ku/fourier_bounce
unalmis Oct 31, 2024
e019670
Fixing comment from previous commit
unalmis Oct 31, 2024
a60faf9
Merge branch 'master' into ku/fourier_bounce
unalmis Nov 12, 2024
3ebbaef
Merge branch 'master' into ku/fourier_bounce
dpanici Nov 13, 2024
96143e4
Merge remote-tracking branch 'refs/remotes/origin/ku/fourier_bounce' …
unalmis Nov 13, 2024
8ee38bd
Merge branch 'master' into ku/fourier_bounce
unalmis Nov 16, 2024
cf4a855
Merge branch 'master' into ku/fourier_bounce
unalmis Nov 19, 2024
7f3477d
Merge branch 'master' into ku/fourier_bounce
unalmis Nov 20, 2024
0e67e84
Merge commit 'cf4a855' into ku/fourier_bounce
unalmis Nov 20, 2024
7708103
Merge branch 'master' into ku/fourier_bounce
unalmis Nov 24, 2024
4fe9a64
Merge branch 'master' into ku/fourier_bounce
unalmis Dec 3, 2024
b6526f9
Update comment
unalmis Dec 3, 2024
372ae9a
Merge branch 'master' into ku/fourier_bounce
unalmis Dec 3, 2024
0074136
Merge branch 'master' into ku/fourier_bounce
unalmis Dec 4, 2024
c462633
Moving downstream #1290 changes upstream #1119 as requested by reviewer.
unalmis Dec 4, 2024
877d7db
Reviewer requests
unalmis Dec 5, 2024
1d03f2f
Merge branch 'master' into ku/fourier_bounce
unalmis Dec 5, 2024
7e44363
Rory's requested changes
unalmis Dec 5, 2024
76dd4ab
Name change 2 (#1429)
unalmis Dec 5, 2024
0c87040
name change fallout
unalmis Dec 5, 2024
7a21ce3
Fix grid after review request change
unalmis Dec 5, 2024
f687e5c
Review dog
unalmis Dec 5, 2024
9250166
Fixing git corruption number 1
unalmis Dec 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions desc/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
from jax.lax import cond, fori_loop, scan, switch, while_loop
from jax.nn import softmax as softargmax
from jax.numpy import bincount, flatnonzero, repeat, take
from jax.numpy.fft import irfft, rfft, rfft2
from jax.numpy.fft import ifft, irfft, irfft2, rfft, rfft2
from jax.scipy.fft import dct, idct
from jax.scipy.linalg import block_diag, cho_factor, cho_solve, qr, solve_triangular
from jax.scipy.special import gammaln
Expand Down Expand Up @@ -434,7 +434,7 @@ def tangent_solve(g, y):
jit = lambda func, *args, **kwargs: func
execute_on_cpu = lambda func: func
import scipy.optimize
from numpy.fft import irfft, rfft, rfft2 # noqa: F401
from numpy.fft import ifft, irfft, irfft2, rfft, rfft2 # noqa: F401
from scipy.fft import dct, idct # noqa: F401
from scipy.integrate import odeint # noqa: F401
from scipy.linalg import ( # noqa: F401
Expand Down
50 changes: 47 additions & 3 deletions desc/compute/_basis_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3223,17 +3223,61 @@ def _e_sub_zeta_zz(params, transforms, profiles, data, **kwargs):
transforms={},
profiles=[],
coordinates="rtz",
data=["e^rho", "e^theta", "e^zeta", "alpha_r", "alpha_t", "alpha_z"],
data=["grad(alpha) (periodic)", "grad(alpha) (secular)"],
)
def _grad_alpha(params, transforms, profiles, data, **kwargs):
data["grad(alpha)"] = (
data["alpha_r"] * data["e^rho"].T
data["grad(alpha)"] = data["grad(alpha) (periodic)"] + data["grad(alpha) (secular)"]
return data


@register_compute_fun(
name="grad(alpha) (periodic)",
label="\\mathrm{periodic}(\\nabla \\alpha)",
units="m^{-1}",
units_long="Inverse meters",
description=(
"Gradient of field line label, which is perpendicular to the field line, "
"periodic component"
),
dim=3,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["e^rho", "e^theta", "e^zeta", "alpha_r (periodic)", "alpha_t", "alpha_z"],
)
def _periodic_grad_alpha(params, transforms, profiles, data, **kwargs):
data["grad(alpha) (periodic)"] = (
data["alpha_r (periodic)"] * data["e^rho"].T
+ data["alpha_t"] * data["e^theta"].T
+ data["alpha_z"] * data["e^zeta"].T
).T
return data


@register_compute_fun(
name="grad(alpha) (secular)",
label="\\mathrm{secular}(\\nabla \\alpha)",
units="m^{-1}",
units_long="Inverse meters",
description=(
"Gradient of field line label, which is perpendicular to the field line, "
"secular component"
),
dim=3,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["e^rho", "alpha_r (secular)"],
)
def _secular_grad_alpha(params, transforms, profiles, data, **kwargs):
data["grad(alpha) (secular)"] = (
data["alpha_r (secular)"][:, jnp.newaxis] * data["e^rho"]
)
return data


@register_compute_fun(
name="grad(psi)",
label="\\nabla\\psi",
Expand Down
46 changes: 40 additions & 6 deletions desc/compute/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1518,14 +1518,48 @@ def _alpha(params, transforms, profiles, data, **kwargs):
transforms={},
profiles=[],
coordinates="rtz",
data=["theta_PEST_r", "phi", "phi_r", "iota", "iota_r"],
data=["alpha_r (periodic)", "alpha_r (secular)"],
)
def _alpha_r(params, transforms, profiles, data, **kwargs):
data["alpha_r"] = (
data["theta_PEST_r"]
- data["iota_r"] * data["phi"]
- data["iota"] * data["phi_r"]
)
data["alpha_r"] = data["alpha_r (periodic)"] + data["alpha_r (secular)"]
return data


@register_compute_fun(
name="alpha_r (periodic)",
label="\\mathrm{periodic}(\\partial_\\rho \\alpha)",
units="~",
units_long="None",
description="Field line label, derivative wrt radial coordinate, "
"periodic component",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["theta_PEST_r", "iota", "phi_r"],
)
def _periodic_alpha_r(params, transforms, profiles, data, **kwargs):
data["alpha_r (periodic)"] = data["theta_PEST_r"] - data["iota"] * data["phi_r"]
return data


@register_compute_fun(
name="alpha_r (secular)",
label="\\mathrm{secular}(\\partial_\\rho \\alpha)",
units="~",
units_long="None",
description="Field line label, derivative wrt radial coordinate, "
"secular component",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["iota_r", "phi"],
)
def _secular_alpha_r(params, transforms, profiles, data, **kwargs):
data["alpha_r (secular)"] = -data["iota_r"] * data["phi"]
return data


Expand Down
128 changes: 104 additions & 24 deletions desc/compute/_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -1941,24 +1941,85 @@ def _g_sup_ra(params, transforms, profiles, data, **kwargs):
# Exact definition of the magnetic drifts taken from
# eqn. 48 of Introduction to Quasisymmetry by Landreman
# https://tinyurl.com/54udvaa4
label="\\mathrm{gbdrift} = 1/B^{2} (\\mathbf{b}\\times\\nabla B) \\cdot"
+ "\\nabla \\alpha",
units="1/(T-m^{2})",
units_long="inverse Tesla meters^2",
description="Binormal component of the geometric part of the gradB drift"
+ " used for local stability analyses, Gamma_c, epsilon_eff etc.",
label="(\\nabla \\vert B \\vert)_{\\mathrm{drift}} = "
"(\\mathbf{b} \\times \\nabla B) \\cdot \\nabla \\alpha / \\vert B \\vert^{2}",
units="1 / Wb",
units_long="Inverse webers",
description="Binormal, geometric part of the gradB drift. "
"Used for local stability analyses, gyrokinetics, and Gamma_c.",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["|B|^2", "b", "grad(alpha)", "grad(|B|)"],
data=["gbdrift (periodic)", "gbdrift (secular)"],
)
def _gbdrift(params, transforms, profiles, data, **kwargs):
data["gbdrift"] = (
1
data["gbdrift"] = data["gbdrift (periodic)"] + data["gbdrift (secular)"]
return data


@register_compute_fun(
name="gbdrift (periodic)",
label="\\mathrm{periodic}(\\nabla \\vert B \\vert)_{\\mathrm{drift}}",
units="1 / Wb",
units_long="Inverse webers",
description="Periodic, binormal, geometric part of the gradB drift.",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["|B|^2", "b", "grad(alpha) (periodic)", "grad(|B|)"],
)
def _periodic_gbdrift(params, transforms, profiles, data, **kwargs):
data["gbdrift (periodic)"] = (
dot(data["b"], cross(data["grad(|B|)"], data["grad(alpha) (periodic)"]))
/ data["|B|^2"]
)
return data


@register_compute_fun(
name="gbdrift (secular)",
label="\\mathrm{secular}(\\nabla \\vert B \\vert)_{\\mathrm{drift}}",
units="1 / Wb",
units_long="Inverse webers",
description="Secular, binormal, geometric part of the gradB drift.",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["|B|^2", "b", "grad(alpha) (secular)", "grad(|B|)"],
)
def _secular_gbdrift(params, transforms, profiles, data, **kwargs):
data["gbdrift (secular)"] = (
dot(data["b"], cross(data["grad(|B|)"], data["grad(alpha) (secular)"]))
/ data["|B|^2"]
)
return data


@register_compute_fun(
name="gbdrift (secular)/phi",
label="\\mathrm{secular}(\\nabla \\vert B \\vert)_{\\mathrm{drift}} / \\phi",
units="1 / Wb",
units_long="Inverse webers",
description="Secular, binormal, geometric part of the gradB drift divided "
"by the toroidal angle. This quantity is periodic.",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["|B|^2", "b", "e^rho", "grad(|B|)", "iota_r"],
)
def _secular_gbdrift_over_phi(params, transforms, profiles, data, **kwargs):
data["gbdrift (secular)/phi"] = (
dot(data["b"], cross(data["e^rho"], data["grad(|B|)"]))
* data["iota_r"]
/ data["|B|^2"]
* dot(data["b"], cross(data["grad(|B|)"], data["grad(alpha)"]))
)
return data

Expand All @@ -1970,34 +2031,53 @@ def _gbdrift(params, transforms, profiles, data, **kwargs):
# https://tinyurl.com/54udvaa4
label="\\mathrm{cvdrift} = 1/B^{3} (\\mathbf{b}\\times\\nabla(p + B^2/2))"
+ "\\cdot \\nabla \\alpha",
units="1/(T-m^{2})",
units_long="inverse Tesla meters^2",
description="Binormal component of the geometric part of the curvature drift"
+ " used for local stability analyses, Gamma_c, epsilon_eff etc.",
units="1 / Wb",
units_long="Inverse webers",
description="Binormal, geometric part of the curvature drift. "
"Used for local stability analyses and gyrokinetics.",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["p_r", "psi_r", "|B|^2", "gbdrift"],
data=["cvdrift (periodic)", "gbdrift (secular)"],
)
def _cvdrift(params, transforms, profiles, data, **kwargs):
dp_dpsi = mu_0 * data["p_r"] / data["psi_r"]
data["cvdrift"] = 1 / data["|B|^2"] * dp_dpsi + data["gbdrift"]
data["cvdrift"] = data["cvdrift (periodic)"] + data["gbdrift (secular)"]
return data


@register_compute_fun(
name="cvdrift (periodic)",
label="\\mathrm{cvdrift (periodic)}",
units="1 / Wb",
units_long="Inverse webers",
description="Periodic, binormal, geometric part of the curvature drift.",
dim=1,
params=[],
transforms={},
profiles=[],
coordinates="rtz",
data=["p_r", "psi_r", "|B|^2", "gbdrift (periodic)"],
)
def _periodic_cvdrift(params, transforms, profiles, data, **kwargs):
data["cvdrift (periodic)"] = (
mu_0 * data["p_r"] / data["psi_r"] / data["|B|^2"] + data["gbdrift (periodic)"]
)
return data


@register_compute_fun(
name="cvdrift0",
# Exact definition of the magnetic drifts taken from
# eqn. 48 of Introduction to Quasisymmetry by Landreman
# https://tinyurl.com/54udvaa4
# https://tinyurl.com/54udvaa4 up to dimensionless factors.
label="\\mathrm{cvdrift0} = 1/B^{2} (\\mathbf{b}\\times\\nabla B)"
+ "\\cdot \\nabla \\rho",
units="1/(T-m^{2})",
units_long="inverse Tesla meters^2",
description="Radial component of the geometric part of the curvature drift"
+ " used for local stability analyses, gyrokinetics, Gamma_c.",
+ "\\cdot (2 \\rho \\nabla \\rho)",
units="1 / Wb",
units_long="Inverse webers",
description="Radial, geometric part of the curvature drift."
+ " Used for local stability analyses, gyrokinetics, and Gamma_c.",
dim=1,
params=[],
transforms={},
Expand All @@ -2010,6 +2090,6 @@ def _cvdrift0(params, transforms, profiles, data, **kwargs):
2
* data["rho"]
/ data["|B|^2"]
* (dot(data["b"], cross(data["grad(|B|)"], data["e^rho"])))
* dot(data["b"], cross(data["grad(|B|)"], data["e^rho"]))
)
return data
12 changes: 8 additions & 4 deletions desc/equilibrium/equilibrium.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,8 +1061,10 @@ def need_src(name):
sym=self.sym
and all(
data_index[p][dep]["grid_requirement"].get("sym", True)
# TODO: GitHub issue #1206.
and not data_index[p][dep]["grid_requirement"].get("can_fft", False)
# TODO (#1206)
and not data_index[p][dep]["grid_requirement"].get(
"can_fft2", False
)
for dep in dep1dr
),
)
Expand Down Expand Up @@ -1109,8 +1111,10 @@ def need_src(name):
sym=self.sym
and all(
data_index[p][dep]["grid_requirement"].get("sym", True)
# TODO: GitHub issue #1206.
and not data_index[p][dep]["grid_requirement"].get("can_fft", False)
# TODO (#1206)
and not data_index[p][dep]["grid_requirement"].get(
"can_fft2", False
)
for dep in dep1dz
),
)
Expand Down
19 changes: 18 additions & 1 deletion desc/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class _Grid(IOAble, ABC):
"_inverse_poloidal_idx",
"_inverse_zeta_idx",
"_is_meshgrid",
"_can_fft2",
]

@abstractmethod
Expand Down Expand Up @@ -231,6 +232,16 @@ def is_meshgrid(self):
"""
return self.__dict__.setdefault("_is_meshgrid", False)

@property
def can_fft2(self):
"""bool: Whether this grid is compatible with 2D FFT.

Tensor product grid with uniformly spaced points on
(θ, ζ) ∈ [0, 2π) × [0, 2π/NFP).
"""
# TODO: GitHub issue 1243?
return self.__dict__.setdefault("_can_fft2", self.is_meshgrid and not self.sym)

@property
def coordinates(self):
"""Coordinates specified by the nodes.
Expand Down Expand Up @@ -682,6 +693,7 @@ class Grid(_Grid):
Use np.inf to denote no periodicity.
NFP : int
Number of field periods (Default = 1).
Change this only if your nodes are placed within one field period.
source_grid : Grid
Grid from which coordinates were mapped from.
sort : bool
Expand Down Expand Up @@ -805,7 +817,8 @@ def create_meshgrid(
NFP : int
Number of field periods (Default = 1).
Only makes sense to change from 1 if last coordinate is periodic
with some constant divided by ``NFP``.
with some constant divided by ``NFP`` and the nodes are placed
within one field period.

Returns
-------
Expand Down Expand Up @@ -927,6 +940,8 @@ class LinearGrid(_Grid):
Toroidal grid resolution.
NFP : int
Number of field periods (Default = 1).
Change this only if your nodes are placed within one field period
or should be interpreted as spanning one field period.
sym : bool
True for stellarator symmetry, False otherwise (Default = False).
axis : bool
Expand Down Expand Up @@ -1022,6 +1037,8 @@ def _create_nodes( # noqa: C901
Toroidal grid resolution.
NFP : int
Number of field periods (Default = 1).
Only change this if your nodes are placed within one field period
or should be interpreted as spanning one field period.
axis : bool
True to include a point at rho=0 (default), False for rho[0] = rho[1]/2.
endpoint : bool
Expand Down
Loading
Loading