desc.grid.Grid
- class desc.grid.Grid(nodes, spacing=None, weights=None, coordinates='rtz', period=None, NFP=1, source_grid=None, sort=False, is_meshgrid=False, jitable=False, **kwargs)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)
spacing (ndarray of float, size(num_nodes, 3)) – Spacing between nodes in each direction.
weights (ndarray of float, size(num_nodes, )) – Quadrature weights for each node.
coordinates (str) – Coordinates that are specified by the nodes. raz : rho, alpha, zeta rvp : rho, theta_PEST, phi rtz : rho, theta, zeta
period (tuple of float) – Assumed periodicity for each coordinate. 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) – Whether to sort the nodes for use with FFT method.
is_meshgrid (bool) – Whether this grid is a tensor-product grid. Let the tuple (r, p, t) ∈ R³ denote a radial, poloidal, and toroidal coordinate value. The is_meshgrid flag denotes whether any coordinate can be iterated over along the relevant axis of the reshaped grid: nodes.reshape((num_poloidal, num_radial, num_toroidal, 3), order=”F”).
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
xat indices of unique surface label values.copy([deepcopy])Return a (deep)copy of this object.
copy_data_from_other(x, other_grid[, ...])Copy data x from other_grid to this grid at matching surface label.
create_meshgrid(nodes[, spacing, ...])Create a tensor-product grid from the given coordinates in a jitable manner.
equiv(other)Compare equivalence between DESC objects.
expand(x[, surface_label])Expand
xby duplicating elements to match the grid's pattern.get_label(label)Get general label that specifies direction given label.
load(load_from[, file_format])Initialize from file.
meshgrid_flatten(x, order)Flatten data to match standard ordering.
meshgrid_reshape(x, order)Reshape data to match grid coordinates.
replace_at_axis(x, y[, copy])Replace elements of
xwith elements ofyat the axis of grid.save(file_name[, file_format, file_mode])Save the object.
Attributes
Radial grid resolution.
Poloidal grid resolution.
Toroidal grid resolution.
Number of (toroidal) field periods.
Indices of nodes at magnetic axis.
Whether this grid is compatible with 2D FFT.
Coordinates specified by the nodes.
whether this grid is compatible with fft in the poloidal direction.
whether this grid is compatible with fft in the toroidal direction.
Indices that recover field line poloidal angles.
Indices that recover the unique poloidal coordinates.
Indices of unique_rho_idx that recover the rho coordinates.
Indices that recover unique straight field line poloidal angles.
Indices that recover unique theta coordinates.
Indices of unique_zeta_idx that recover the zeta coordinates.
Whether this grid is a tensor-product grid.
Pattern for placement of nodes in (rho,theta,zeta).
Node coordinates, in (rho,theta,zeta).
Number of unique field line poloidal angles.
Total number of nodes.
Number of unique poloidal angle coordinates.
Number of unique rho coordinates.
Number of unique theta coordinates.
Number of unique straight field line poloidal angles.
Number of unique zeta coordinates.
Periodicity of coordinates.
Coordinates from which this grid was mapped from.
Quadrature weights for integration over surfaces.
Truefor poloidal up/down symmetry,Falseotherwise.Indices of unique field line poloidal angles.
Indices of unique poloidal angle coordinates.
Indices of unique rho coordinates.
Indices of unique straight field line poloidal angles.
Indices of unique theta coordinates.
Indices of unique zeta coordinates.
Weight for each node, either exact quadrature or volume based.