desc.grid.Grid

class desc.grid.Grid(nodes, sort=False, jitable=False)Source

Collocation grid with custom node placement.

Unlike subclasses LinearGrid and ConcentricGrid, the base Grid allows the user to pass in a custom set of collocation nodes.

Parameters:
  • nodes (ndarray of float, size(num_nodes,3)) – Node coordinates, in (rho,theta,zeta)

  • sort (bool) – Whether to sort the nodes for use with FFT method.

  • jitable (bool) – Whether to skip certain checks and conditionals that don’t work under jit. Allows grid to be created on the fly with custom nodes, but weights, symmetry etc may be wrong if grid contains duplicate nodes.

Methods

compress(x[, surface_label])

Return elements of x at indices of unique surface label values.

copy([deepcopy])

Return a (deep)copy of this object.

equiv(other)

Compare equivalence between DESC objects.

expand(x[, surface_label])

Expand x by duplicating elements to match the grid's pattern.

load(load_from[, file_format])

Initialize from file.

replace_at_axis(x, y[, copy])

Replace elements of x with elements of y at the axis of grid.

save(file_name[, file_format, file_mode])

Save the object.

Attributes

L

Radial grid resolution.

M

Poloidal grid resolution.

N

Toroidal grid resolution.

NFP

Number of (toroidal) field periods.

axis

Indices of nodes at magnetic axis.

inverse_rho_idx

Indices of unique_rho_idx that recover the rho coordinates.

inverse_theta_idx

Indices of unique_theta_idx that recover the theta coordinates.

inverse_zeta_idx

Indices of unique_zeta_idx that recover the zeta coordinates.

node_pattern

Pattern for placement of nodes in (rho,theta,zeta).

nodes

Node coordinates, in (rho,theta,zeta).

num_nodes

Total number of nodes.

num_rho

Number of unique rho coordinates.

num_theta

Number of unique theta coordinates.

num_zeta

Number of unique zeta coordinates.

spacing

Node spacing, in (rho,theta,zeta).

sym

True for stellarator symmetry, False otherwise.

unique_rho_idx

Indices of unique rho coordinates.

unique_theta_idx

Indices of unique theta coordinates.

unique_zeta_idx

Indices of unique zeta coordinates.

weights

Weight for each node, either exact quadrature or volume based.