bfieldtools.coil_optimize.optimize_streamfunctions¶
-
bfieldtools.coil_optimize.
optimize_streamfunctions
(mesh_conductor, bfield_specification, objective='minimum_inductive_energy', solver=None, solver_opts={})¶ Quadratic optimization of coil stream function according to a specified objective.
Utilizes CVXPY and a numerical iterative solver.
- Parameters
- mesh_conductor: MeshConductor object
Contains Trimesh mesh as well as physical properties, e.g. inductance
- bfield_specification: list
List in which element is a dictionary containing a coil specification. See notes for specification syntax.
- objective: string or dict
if string, either ‘minimum_inductive_energy’ or ‘minimum_ohmic_power’ if tuple, should contain: (a, b), where a and b are floats describing the inductive and resitive weighting factors. The resistance matrix is scaled according to the largest singular value of the inductance matrix for consistent behavior across meshes.
- solver: string
string specifying which solver CVXPY will use
- solver_opt: dict
dict containing solver options CVXPY will pass to the solver
- Returns
- s: vector
Vector with length len(mesh_conductor.mesh.vertices), containing the optimized current density values at each mesh vertex
- prob: CVXPY problem object
CVXPY problem object containing data, formulation, solution, metric etc
Notes
- Each specification is a dict, which contains
coupling: Coupling matrix (N_r, N_verts, 3)
target: (N_r, 3)
abs_error: float or (N_r, 3)
rel_error: float or (N_r, 3)
Either abs_error, rel_error or both must be present.