bluemira.equilibria.coils._coil

Coil and coil grouping objects

Classes

Coil

Coil Object

Module Contents

class bluemira.equilibria.coils._coil.Coil(x: float, z: float, dx: float | None = None, dz: float | None = None, name: str | None = None, ctype: str | bluemira.base.constants.CoilType = CoilType.NONE, current: float = 0, j_max: float = np.nan, b_max: float = np.nan, discretisation: float = np.nan, n_turns: int = 1, resistance: float = 0, *, psi_analytic: bool = False, Bx_analytic: bool = True, Bz_analytic: bool = True, fix_size: bool | None = None)

Bases: bluemira.equilibria.coils._field.CoilFieldsMixin

Inheritance diagram of bluemira.equilibria.coils._coil.Coil

Coil Object

For use with PF/CS/passive coils. All coils have a rectangular cross section.

Parameters:
  • x (float) – Coil geometric centre x coordinate [m]

  • z (float) – Coil geometric centre z coordinate [m]

  • dx (float | None) – Coil radial half-width [m] from coil centre to edge (either side)

  • dz (float | None) – Coil vertical half-width [m] from coil centre to edge (either side)

  • name (str | None) – The name of the coil

  • ctype (str | bluemira.base.constants.CoilType) – Type of coil as defined in CoilType

  • current (float) – Coil current [A] (default = 0)

  • j_max (float) – Maximum current density in the coil [A/m^2]

  • b_max (float) – Maximum magnetic field at the coil [T]

  • discretisation (float) – discretise the coil, value in [m]. The minimum size is COIL_DISCR

  • n_turns (int) – Number of turns

  • fix_size (bool | None) – Whether or not to fix the coil size. Default is True if coil size is input and False if no size is input. You can not choose to fix the size if you have not chosen the size.

  • resistance (float)

  • psi_analytic (bool)

  • Bx_analytic (bool)

  • Bz_analytic (bool)

Notes

If dx and dz are specified the coil size is fixed when modifying j_max or current

__slots__ = ('_b_max', '_ctype', '_current', '_current_radius', '_discretisation', '_dx', '_dz',...
_dx = None
_dz = None
_discretisation
_flag_sizefix
property x: float

Coil x position

Return type:

float

property z: float

Coil z position

Return type:

float

property dx: float | None

Coil width (half)

Return type:

float | None

property dz: float | None

Coil height (half)

Return type:

float | None

property discretisation: float

Coil discretisation

Return type:

float

property current: float

Coil current

Return type:

float

property j_max: float

Coil max current density

Return type:

float

property b_max: float

Coil max field

Return type:

float

property ctype: bluemira.base.constants.CoilType

Coil type

Return type:

bluemira.base.constants.CoilType

name = None
n_turns = 1
property resistance

Coil resistance

_number = 1
__repr__()

Pretty printing

plot(ax: matplotlib.axes.Axes | None = None, *, subcoil: bool = True, label: bool = False, force: collections.abc.Iterable | None = None, **kwargs) bluemira.equilibria.plotting.CoilGroupPlotter | None

Plot a Coil

Parameters:
  • ax (matplotlib.axes.Axes | None) – Matplotlib axis object

  • subcoil (bool) – plot coil discretisations

  • label (bool) – show coil labels on plot

  • force (collections.abc.Iterable | None) – force arrows iterable

  • kwargs – passed to matplotlib’s Axes.plot

Returns:

the axis if created

Return type:

bluemira.equilibria.plotting.CoilGroupPlotter | None

static n_coils() int

Number of coils in coil

Notes

Allows n_coils to be accessed if an individual coil or a CoilGroup

Return type:

int

property position: numpy.ndarray

Coil x, z position

Return type:

numpy.ndarray

property area: float

The cross-sectional area of the coil

Return type:

The cross-sectional area of the coil [m^2]

Notes

\[\text{area} = 4 \cdot dx \cdot dz\]
property volume: float

The volume of the coil

Return type:

The volume of the coil [m^3]

Notes

\[\text{volume} =\text{area} \cdot 2 \pi x\]
property x_boundary

Coil x coordinate boundary

property z_boundary

Coil z coordinate boundary

property _quad_boundary

Coil quadrature x,z coordinate boundary

property fix_size

Boolean representing if the coil size is fixed or not.

assign_material(j_max: float = NBTI_J_MAX, b_max: float = NBTI_B_MAX, resistance: float = 0) None

Assigns EM material properties to coil

Parameters:
  • j_max (float) – Overwrite default constant material max current density [A/m^2]

  • b_max (float) – Overwrite default constant material max field [T]

  • resistance (float)

Return type:

None

Notes

Will always modify both j_max and b_max of the coil with either the default or specified values.

get_max_current()
Returns:

Max current

_discretise()

Discretise a coil for greens function magnetic field calculations

Notes

Only discretisation method currently implemented is rectangular.

Possible improvement: multiple discretisations for different coils

_validate_size()
_set_coil_attributes()
_rectangular_discretisation()

Discretise a coil into filaments based on the length in [m] of the discretisation. Each filament will be plotted as a rectangle with the filament at its centre.

resize(current: float | None = None)

Resize coil given a current

Parameters:

current (float | None)

_resize(current)
_re_discretise()

Re discretise and re set attributes if sizing information changes.

_make_size(current: float | None = None)

Size the coil based on a current and a current density.

Returns:

  • change in x

  • change in z

Parameters:

current (float | None)

static _make_boundary(x_c: float, z_c: float, dx: float, dz: float) tuple[numpy.ndarray, numpy.ndarray]

Makes the coil boundary vectors

Parameters:
  • x_c (float) – x coordinate of centre

  • z_c (float) – z coordinate of centre

  • dx (float) – dx of coil

  • dz (float) – dz of coil

Returns:

  • x_boundary – Radial coordinates of the boundary

  • z_boundary – Vertical coordinates of the boundary

Return type:

tuple[numpy.ndarray, numpy.ndarray]

Note

Only rectangular coils