bfieldtools.mesh_conductor.StreamFunction

class bfieldtools.mesh_conductor.StreamFunction(input_array, mesh_conductor=None)

Class for representing stream function(s) on a MeshConductor

Handles the mapping between different bases, e.g. inner vertices <-> all vertices <-> surface harmonics

Parameters:
vals: array of shape (N,) or (N,M)

where N corresponds to the number of inner vertices in the mesh_conductor or the the number of all vertices in the MeshConductor.

Multiple (M) stream functions can be stored in the object by specifying vals with shape (N,M)

mesh_conductor:

MeshConductor object

__getitem__(self, k)

Return self[key].

property vert

Returns the stream function in vertex basis

property inner

Returns the stream function in inner basis

property power

Stream-function resistive power

property magnetic_energy

Stream-function magnetic energy

coil_inductance(self, Nloops)
Parameters
Nloopsthe number of wire loops in the discrete coil (int)
Returns
inductance: scalar (float)
plot(self, background=True, contours=False, **kwargs)

Plot the stream function

discretize(self, N_contours=10, contours=None)

Wrapper method for contour.scalar_contour, turns the piecewise linear stream function into isolines/contours in the form of polylines.

Parameters
N_contours: int

Number of contours to generate

contours: array-like

Optional argument for manual input of contour levels. Overrides N_contours

Returns
contour_polys: list

list with length N_contours. Each list element is anumpy array containing the coordinats of each polygon vertex.

contour_values: array-like

Vector containing the scalar function value for each contour line