essos.coils¶
Classes¶
Class to store the curves |
|
Class to store the curves |
|
Class to store the curves |
|
Class to store the curves |
|
Class to store the curves |
Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
One-curve arclength resample to n_segments points on t∈[0,1), piecewise linear. |
|
Batch arclength resample. |
|
gamma_uni: (Ncoils, Nseg, 3), samples at t_j = j/Nseg, j=0..Nseg-1 |
|
Fast path (batched + JIT + rFFT). |
Module Contents¶
- essos.coils.compute_curvature(gammadash, gammadashdash)¶
- class essos.coils.Curves(dofs: jax.numpy.ndarray, n_segments: int = 100, nfp: int = 1, stellsym: bool = True)¶
Class to store the curves
Fourier Coefficients of the independent curves
- type:
jnp.ndarray - shape (n_indcurves, 3, 2*order+1)
- n_segments¶
Number of segments to discretize the curves
- Type:
int
- nfp¶
Number of field periods
- Type:
int
- stellsym¶
Stellarator symmetry
- Type:
bool
- order¶
Order of the Fourier series
- Type:
int
- curves jnp.ndarray - shape
Curves obtained by applying rotations and flipping corresponding to nfp fold rotational symmetry and optionally stellarator symmetry
- Type:
n_indcurves*nfp*(1+stellsym), 3, 2*order+1)
- gamma¶
Discretized curves
- Type:
jnp.array - shape (n_coils, n_segments, 3)
- gamma_dash¶
Discretized curves derivatives
- Type:
jnp.array - shape (n_coils, n_segments, 3)
- _dofs¶
- _n_segments = 100¶
- _nfp = 1¶
- _stellsym = True¶
- _order¶
- _curves¶
- quadpoints = None¶
- n_base_curves¶
- __str__()¶
- __repr__()¶
- _tree_flatten()¶
- classmethod _tree_unflatten(aux_data, children)¶
- _set_gamma()¶
- property dofs¶
- property curves¶
- property order¶
- property n_segments¶
- property nfp¶
- property stellsym¶
- property gamma¶
- property gamma_dash¶
- property gamma_dashdash¶
- property length¶
- property curvature¶
- __len__()¶
- __getitem__(key)¶
- __add__(other)¶
- __contains__(other)¶
- __eq__(other)¶
- __ne__(other)¶
- __iter__()¶
- __next__()¶
- save_curves(filename: str)¶
Save the curves to a file
- to_simsopt()¶
- plot(ax=None, show=True, plot_derivative=False, close=False, axis_equal=True, color='brown', linewidth=3, label=None, **kwargs)¶
- to_vtk(filename: str, close: bool = True, extra_data=None)¶
- class essos.coils.Curves_from_simsopt(simsopt_curves, nfp=1, stellsym=True)¶
Bases:
CurvesClass to store the curves
Fourier Coefficients of the independent curves
- type:
jnp.ndarray - shape (n_indcurves, 3, 2*order+1)
- n_segments¶
Number of segments to discretize the curves
- Type:
int
- nfp¶
Number of field periods
- Type:
int
- stellsym¶
Stellarator symmetry
- Type:
bool
- order¶
Order of the Fourier series
- Type:
int
- curves jnp.ndarray - shape
Curves obtained by applying rotations and flipping corresponding to nfp fold rotational symmetry and optionally stellarator symmetry
- Type:
n_indcurves*nfp*(1+stellsym), 3, 2*order+1)
- gamma¶
Discretized curves
- Type:
jnp.array - shape (n_coils, n_segments, 3)
- gamma_dash¶
Discretized curves derivatives
- Type:
jnp.array - shape (n_coils, n_segments, 3)
- class essos.coils.Coils(curves: Curves, currents: jax.numpy.ndarray)¶
Bases:
CurvesClass to store the curves
Fourier Coefficients of the independent curves
- type:
jnp.ndarray - shape (n_indcurves, 3, 2*order+1)
- n_segments¶
Number of segments to discretize the curves
- Type:
int
- nfp¶
Number of field periods
- Type:
int
- stellsym¶
Stellarator symmetry
- Type:
bool
- order¶
Order of the Fourier series
- Type:
int
- curves jnp.ndarray - shape
Curves obtained by applying rotations and flipping corresponding to nfp fold rotational symmetry and optionally stellarator symmetry
- Type:
n_indcurves*nfp*(1+stellsym), 3, 2*order+1)
- gamma¶
Discretized curves
- Type:
jnp.array - shape (n_coils, n_segments, 3)
- gamma_dash¶
Discretized curves derivatives
- Type:
jnp.array - shape (n_coils, n_segments, 3)
- _currents_scale¶
- _dofs_currents¶
- _currents¶
- __str__()¶
- __repr__()¶
- property dofs_curves¶
- property dofs_currents¶
- property currents_scale¶
- property x¶
- property currents¶
- __getitem__(key)¶
- __add__(other)¶
- __exclude_coil__(index)¶
- __contains__(other)¶
- __eq__(other)¶
- __ne__(other)¶
- _tree_flatten()¶
- save_coils(filename: str, text='')¶
Save the coils to a file
- to_simsopt()¶
- to_json(filename: str)¶
- class essos.coils.Coils_from_json(filename: str)¶
Bases:
CoilsClass to store the curves
Fourier Coefficients of the independent curves
- type:
jnp.ndarray - shape (n_indcurves, 3, 2*order+1)
- n_segments¶
Number of segments to discretize the curves
- Type:
int
- nfp¶
Number of field periods
- Type:
int
- stellsym¶
Stellarator symmetry
- Type:
bool
- order¶
Order of the Fourier series
- Type:
int
- curves jnp.ndarray - shape
Curves obtained by applying rotations and flipping corresponding to nfp fold rotational symmetry and optionally stellarator symmetry
- Type:
n_indcurves*nfp*(1+stellsym), 3, 2*order+1)
- gamma¶
Discretized curves
- Type:
jnp.array - shape (n_coils, n_segments, 3)
- gamma_dash¶
Discretized curves derivatives
- Type:
jnp.array - shape (n_coils, n_segments, 3)
- class essos.coils.Coils_from_simsopt(simsopt_coils, nfp=1, stellsym=True)¶
Bases:
CoilsClass to store the curves
Fourier Coefficients of the independent curves
- type:
jnp.ndarray - shape (n_indcurves, 3, 2*order+1)
- n_segments¶
Number of segments to discretize the curves
- Type:
int
- nfp¶
Number of field periods
- Type:
int
- stellsym¶
Stellarator symmetry
- Type:
bool
- order¶
Order of the Fourier series
- Type:
int
- curves jnp.ndarray - shape
Curves obtained by applying rotations and flipping corresponding to nfp fold rotational symmetry and optionally stellarator symmetry
- Type:
n_indcurves*nfp*(1+stellsym), 3, 2*order+1)
- gamma¶
Discretized curves
- Type:
jnp.array - shape (n_coils, n_segments, 3)
- gamma_dash¶
Discretized curves derivatives
- Type:
jnp.array - shape (n_coils, n_segments, 3)
- essos.coils.CreateEquallySpacedCurves(n_curves: int, order: int, R: float, r: float, n_segments: int = 100, nfp: int = 1, stellsym: bool = False) jax.numpy.ndarray¶
- essos.coils.RotatedCurve(curve, phi, flip)¶
- essos.coils.apply_symmetries_to_curves(base_curves, nfp, stellsym)¶
- essos.coils.apply_symmetries_to_gammas(base_gammas, nfp, stellsym)¶
- essos.coils.apply_symmetries_to_currents(base_currents, nfp, stellsym)¶
- essos.coils._resample_closed_curve_uniform_one(g: jax.numpy.ndarray, n_segments: int) jax.numpy.ndarray¶
One-curve arclength resample to n_segments points on t∈[0,1), piecewise linear. g: (M,3) closed curve (first≈last not required; we close internally). Returns: (n_segments,3)
- essos.coils._resample_closed_curve_uniform_batch(gammas: jax.numpy.ndarray, n_segments: int) jax.numpy.ndarray¶
Batch arclength resample. gammas: (Ncoils, M, 3) (all curves same M; if not, pre-interp in index space). Returns: (Ncoils, n_segments, 3)
- essos.coils._fit_real_fourier_batch(gamma_uni: jax.numpy.ndarray, order: int) jax.numpy.ndarray¶
gamma_uni: (Ncoils, Nseg, 3), samples at t_j = j/Nseg, j=0..Nseg-1 Returns dofs: (Ncoils, 3, 2*order+1) with [a0, sin1, cos1, …, sinK, cosK].
- essos.coils.fit_dofs_from_coils(coils_gamma: jax.numpy.ndarray, order: int, n_segments: int, assume_uniform: bool = False) tuple[jax.numpy.ndarray, jax.numpy.ndarray]¶
Fast path (batched + JIT + rFFT). coils_gamma: (Ncoils, M, 3) JAX array. If M != n_segments and assume_uniform=True,
curves are uniformly subsampled in index space. If assume_uniform=False, do arclength resampling (slower but accurate).
- Returns:
(Ncoils, 3, 2*order+1) gamma_resampled: (Ncoils, n_segments, 3)
- Return type:
dofs