desc.coils.CoilSet

class desc.coils.CoilSet(*coils, NFP=1, sym=False, name='')Source

Set of coils of different geometry but shared parameterization and resolution.

Parameters:
  • coils (Coil or array-like of Coils) – Collection of coils. Must all be the same type and resolution.

  • NFP (int (optional)) – Number of field periods for enforcing field period symmetry. If NFP > 1, only include the unique coils in the first field period, and the magnetic field will be computed assuming ‘virtual’ coils from the other field periods. Default = 1.

  • sym (bool (optional)) – Whether to enforce stellarator symmetry. If sym = True, only include the unique coils in a half field period, and the magnetic field will be computed assuming ‘virtual’ coils from the other half field period. Default = False.

  • name (str) – Name of this CoilSet.

Methods

append(value)

S.append(value) -- append value to the end of the sequence

clear()

compute(names[, grid, params, transforms, data])

Compute the quantity given by name on grid, for each coil in the coilset.

compute_Bnormal(surface[, eval_grid, ...])

Compute Bnormal from self on the given surface.

compute_magnetic_field(coords[, params, ...])

Compute magnetic field at a set of points.

copy([deepcopy])

Return a (deep)copy of this object.

count(value)

equiv(other)

Compare equivalence between DESC objects.

extend(values)

S.extend(iterable) -- extend sequence by appending elements from the iterable

flip(*args, **kwargs)

Flip the coils across a plane.

from_makegrid_coilfile(coil_file[, method])

Create a CoilSet of SplineXYZCoils from a MAKEGRID-formatted coil txtfile.

from_symmetry(coils[, NFP, sym])

Create a coil group by reflection and symmetry.

index(value, [start, [stop]])

Raises ValueError if the value is not present.

insert(i, new_item)

Insert a new coil into the coilset at position i.

linspaced_angular(coil[, current, axis, ...])

Create a coil set by repeating a coil n times rotationally.

linspaced_linear(coil[, current, ...])

Create a coil group by repeating a coil n times in a straight line.

load(load_from[, file_format])

Initialize from file.

pack_params(params)

Convert a list of dictionary of parameters into a single array.

pop([index])

Raise IndexError if list is empty or index is out of range.

remove(value)

S.remove(value) -- remove first occurrence of value.

reverse()

S.reverse() -- reverse IN PLACE

rotate(*args, **kwargs)

Rotate the coils about an axis.

save(file_name[, file_format, file_mode])

Save the object.

save_BNORM_file(surface, fname[, basis_M, ...])

Create BNORM-style .txt file containing Bnormal Fourier coefficients.

save_in_makegrid_format(coilsFilename[, ...])

Save CoilSet as a MAKEGRID-formatted coil txtfile.

save_mgrid(path, Rmin, Rmax, Zmin, Zmax[, ...])

Save the magnetic field to an mgrid NetCDF file in "raw" format.

to_FourierXYZ([N, grid, s, name])

Convert all coils to FourierXYZCoil representation.

to_SplineXYZ([knots, grid, method, name])

Convert all coils to SplineXYZCoil.

translate(*args, **kwargs)

Translate the coils along an axis.

unpack_params(x)

Convert a single array of concatenated parameters into a dictionary.

Attributes

NFP

Number of (toroidal) field periods.

coils

coils in the coilset.

current

currents in each coil.

dim_x

total number of optimizable parameters.

dimensions

list of dictionary of integers of sizes of each parameter.

name

Name of the curve.

optimizable_params

string names of parameters that have been declared optimizable.

params_dict

list of dictionary of arrays of optimizable parameters.

sym

Whether this coil set is stellarator symmetric.

x_idx

list of dict of arrays of idx for each param in concatenated array.