bluemira.builders.tf_coils

Built-in build steps for making parameterised TF coils.

Classes

ParameterisedRippleSolver

A parameterised Biot-Savart HelmholtzCage solver.

RipplePointSelector

Baseclass for ripple point selection strategies.

EquispacedSelector

Equispaced ripple points along a wire for a given number of points.

ExtremaSelector

Select the extrema of the wire and constrain ripple there.

FixedSelector

Specified points at which to constrain the ripple, overrides any information

MaximiseSelector

Finds and constrains the maximum ripple along the specified wire during

RippleConstrainedLengthGOPParams

Parameters for the RippleConstrainedLengthGOP

RippleConstrainedLengthGOP

Toroidal field coil winding pack shape optimisation problem.

Module Contents

class bluemira.builders.tf_coils.ParameterisedRippleSolver(wp_xs: bluemira.geometry.wire.BluemiraWire, nx: int, ny: int, n_TF: int, R_0: float, z_0: float, B_0: float)

A parameterised Biot-Savart HelmholtzCage solver.

Parameters:
  • wp_xs (bluemira.geometry.wire.BluemiraWire) – Geometry of the TF coil winding pack cross-section

  • nx (int) – Number of radial Biot-Savart filaments to use

  • ny (int) – Number of toroidal Biot-Savart filaments to use

  • n_TF (int) – Number of TF coils

  • R_0 (float) – Major radius at which to calculate B_0

  • z_0 (float) – Vertical coordinate at which to calculate B_0

  • B_0 (float) – Toroidal field at (R_0, z_0)

wp_xs
nx
ny
n_TF
R_0
z_0
B_0
cage = None
update_cage(wire: bluemira.geometry.wire.BluemiraWire)

Update the HelmHoltzCage, setting the current to produce a field of B_0 at (R_0, z_0).

Parameters:

wire (bluemira.geometry.wire.BluemiraWire) – TF coil winding pack current centreline

_make_single_circuit(wire: bluemira.geometry.wire.BluemiraWire) bluemira.magnetostatics.biot_savart.BiotSavartFilament
Returns:

A single BioSavart Filament for a single TF coil

Parameters:

wire (bluemira.geometry.wire.BluemiraWire)

Return type:

bluemira.magnetostatics.biot_savart.BiotSavartFilament

ripple(x: float | numpy.ndarray, y: float | numpy.ndarray, z: float | numpy.ndarray) float | numpy.ndarray

Get the toroidal field ripple at points.

Parameters:
  • x (float | numpy.ndarray) – The x coordinate(s) of the points at which to calculate the ripple

  • y (float | numpy.ndarray) – The y coordinate(s) of the points at which to calculate the ripple

  • z (float | numpy.ndarray) – The z coordinate(s) of the points at which to calculate the ripple

Returns:

The value of the TF ripple at the point(s) [%]

Return type:

float | numpy.ndarray

class bluemira.builders.tf_coils.RipplePointSelector

Baseclass for ripple point selection strategies.

_wire: bluemira.geometry.wire.BluemiraWire = None
points: bluemira.geometry.coordinates.Coordinates = None
set_wire(wire: bluemira.geometry.wire.BluemiraWire)

Set the wire along which the points will be selected

Parameters:

wire (bluemira.geometry.wire.BluemiraWire) – Wire along which the points will be selected

make_ripple_constraint(parameterisation, solver, TF_ripple_limit, rip_con_tol) bluemira.geometry.optimisation.GeomConstraintT

Make the ripple OptimisationConstraint

Return type:

bluemira.geometry.optimisation.GeomConstraintT

_constrain_ripple(parameterisation: bluemira.geometry.parameterisations.GeometryParameterisation) numpy.ndarray

Ripple constraint function

Parameters:

parameterisation (bluemira.geometry.parameterisations.GeometryParameterisation) – Geometry parameterisation

Return type:

numpy.ndarray

class bluemira.builders.tf_coils.EquispacedSelector(n_rip_points: int, x_frac: float | None = None)

Bases: RipplePointSelector

Inheritance diagram of bluemira.builders.tf_coils.EquispacedSelector

Equispaced ripple points along a wire for a given number of points.

Parameters:
  • n_rip_points (int) – Number of points along the wire constrain the ripple

  • x_frac (float | None) – If specified, the fraction of radius above which the points will be selected. If unspecified, the points will be selected on the full wire

n_rip_points
x_frac = None
set_wire(wire: bluemira.geometry.wire.BluemiraWire)

Set the wire along which the points will be selected

Parameters:

wire (bluemira.geometry.wire.BluemiraWire) – Wire along which the points will be selected

class bluemira.builders.tf_coils.ExtremaSelector

Bases: RipplePointSelector

Inheritance diagram of bluemira.builders.tf_coils.ExtremaSelector

Select the extrema of the wire and constrain ripple there.

set_wire(wire: bluemira.geometry.wire.BluemiraWire)

Set the wire along which the points will be selected

Parameters:

wire (bluemira.geometry.wire.BluemiraWire) – Wire along which the points will be selected

class bluemira.builders.tf_coils.FixedSelector(points: bluemira.geometry.coordinates.Coordinates)

Bases: RipplePointSelector

Inheritance diagram of bluemira.builders.tf_coils.FixedSelector

Specified points at which to constrain the ripple, overrides any information relating directly to the separatrix.

Parameters:

points (bluemira.geometry.coordinates.Coordinates) – Points at which the ripple should be constrained.

points
class bluemira.builders.tf_coils.MaximiseSelector

Bases: RipplePointSelector

Inheritance diagram of bluemira.builders.tf_coils.MaximiseSelector

Finds and constrains the maximum ripple along the specified wire during each minimisation function call.

points = None
set_wire(wire: bluemira.geometry.wire.BluemiraWire)

Set the wire along which the points will be selected

Parameters:

wire (bluemira.geometry.wire.BluemiraWire) – Wire along which the points will be selected

make_ripple_constraint(parameterisation, solver, TF_ripple_limit, rip_con_tol) bluemira.geometry.optimisation.GeomConstraintT

Make the ripple OptimisationConstraint

Return type:

bluemira.geometry.optimisation.GeomConstraintT

_constrain_max_ripple(parameterisation: bluemira.geometry.parameterisations.GeometryParameterisation) float

Ripple constraint function

Parameters:

parameterisation (bluemira.geometry.parameterisations.GeometryParameterisation) – Geometry parameterisation

Return type:

float

class bluemira.builders.tf_coils.RippleConstrainedLengthGOPParams

Bases: bluemira.base.parameter_frame.ParameterFrame

Inheritance diagram of bluemira.builders.tf_coils.RippleConstrainedLengthGOPParams

Parameters for the RippleConstrainedLengthGOP

n_TF: bluemira.base.parameter_frame.Parameter[int]
R_0: bluemira.base.parameter_frame.Parameter[float]
z_0: bluemira.base.parameter_frame.Parameter[float]
B_0: bluemira.base.parameter_frame.Parameter[float]
TF_ripple_limit: bluemira.base.parameter_frame.Parameter[float]
class bluemira.builders.tf_coils.RippleConstrainedLengthGOP(parameterisation: bluemira.geometry.parameterisations.GeometryParameterisation, algorithm: str, opt_conditions: dict[str, float], opt_parameters: dict[str, float], params: bluemira.base.parameter_frame.typed.ParameterFrameLike, wp_cross_section: bluemira.geometry.wire.BluemiraWire, ripple_wire: bluemira.geometry.wire.BluemiraWire, ripple_selector: RipplePointSelector | None = None, keep_out_zone: bluemira.geometry.wire.BluemiraWire | None = None, rip_con_tol: float = 0.001, koz_con_tol: float = 0.001, nx: int = 1, ny: int = 1, n_koz_points: int = 100)

Bases: bluemira.geometry.optimisation.GeomOptimisationProblem

Inheritance diagram of bluemira.builders.tf_coils.RippleConstrainedLengthGOP

Toroidal field coil winding pack shape optimisation problem.

Parameters:
  • parameterisation (bluemira.geometry.parameterisations.GeometryParameterisation) – Geometry parameterisation for the winding pack current centreline

  • algorithm (str) – Optimisation algorithm to use

  • opt_conditions (dict[str, float]) – Optimisation termination conditions dictionary

  • opt_parameters (dict[str, float]) – Optimisation parameters dictionary

  • params (bluemira.base.parameter_frame.typed.ParameterFrameLike) – Parameters required to solve the optimisation problem

  • wp_cross_section (bluemira.geometry.wire.BluemiraWire) – Geometry of the TF coil winding pack cross-section

  • separatrix – Separatrix shape at which the TF ripple is to be constrained

  • ripple_selector (RipplePointSelector) – Selection strategy for the poitns at which to calculate ripple.

  • keep_out_zone (bluemira.geometry.wire.BluemiraWire | None) – Zone boundary which the WP may not enter

  • rip_con_tol (float) – Tolerance with which to apply the ripple constraints

  • kox_con_tol – Tolerance with which to apply the keep-out-zone constraints

  • nx (int) – Number of radial Biot-Savart filaments to use

  • ny (int) – Number of toroidal Biot-Savart filaments to use

  • n_koz_points (int) – Number of discretised points to use when enforcing the keep-out-zone constraint

  • ripple_wire (bluemira.geometry.wire.BluemiraWire)

  • koz_con_tol (float)

Notes

x^* = minimise: winding_pack_length

subject to:

\[\text{ripple}|\text{separatrix} \preceq \text{TF_ripple_limit SDF(wp_shape, keep_out_zone)} \preceq 0\]

The geometry parameterisation is updated in place

parameterisation
params
wp_cross_section
algorithm
opt_parameters
opt_conditions
ripple_wire
ripple_values = None
solver
_ripple_constraint
ripple_selector = None
static objective(parameterisation: bluemira.geometry.parameterisations.GeometryParameterisation) float

Objective function (minimise length)

Parameters:

parameterisation (bluemira.geometry.parameterisations.GeometryParameterisation)

Return type:

float

keep_out_zones() list[bluemira.geometry.optimisation.KeepOutZone]

Keep out zone

Return type:

list[bluemira.geometry.optimisation.KeepOutZone]

ineq_constraints() bluemira.geometry.optimisation.GeomConstraintT

Inequality constraints

Return type:

bluemira.geometry.optimisation.GeomConstraintT

optimise() bluemira.geometry.parameterisations.GeometryParameterisation

Solve the GeometryOptimisationProblem.

Return type:

bluemira.geometry.parameterisations.GeometryParameterisation

plot(ax: matplotlib.pyplot.Axes | None = None)

Plot the optimisation problem.

Parameters:

ax (matplotlib.pyplot.Axes | None) – The optional Axes to plot onto, by default None. If None then the current Axes will be used.