bfieldtools.line_conductor.LineConductor¶
-
class
bfieldtools.line_conductor.
LineConductor
(loops=None, mesh=None, scalars=None, **kwargs)¶ Class that inherits Trimesh.path.Path3D for handling discretized current loops. Functions inside assume that vertices are unique for each entity.
Init with inheritance. First priority is given to passed loops parameter, if not present will compute loops from mesh and scalars.
- Parameters
- loops: list of array-like (x, 3)
Each list element corresponds to a Polyline (current loop), with the last element being connected to the first
- mesh: Trimesh mesh object
mesh geometry
- scalars: array-like or StreamFunction
scalar function defined in the vertices of the mesh
- kwargs: dict
passed to scalar_contour if called. Relevant kw:s are N_contours and contours
-
simplify
(self, min_edge=0.001, angle_threshold=0.02, smooth=True)¶ Simplifies contour paths.
- Parameters
- c: array-like
List of polygons describing closed loops.
- min_edge: float
Minimum edge length. Edges shorter than this are merged.
- angle_threshold: float
Minimum angle. Edges with smaller angle differences are merged.
- smooth: bool
If True, apply smoothing to the polygon shapes.
- Returns
- simplified_linepath: LineConductor
-
plot_loops
(self, **kwargs)¶ Plots loops in 3D using mayavi, see viz.plot_3d_current_loops for more details
- Parameters
- colors: str
-
magnetic_field
(self, points, separate_loops=False)¶ Compute magnetic field in some point due to a unit current in the loops
- Parameters
- points: array (N_p, 3)
- separate_loops: Boolean
If True, don’t combine contributions of separate loops
- Returns
- Bfield: array (N_p, 3) or array (N_loops, N_p, 3)
-
vector_potential
(self, points, separate_loops=False, **kwargs)¶ Compute magnetic vector potential in some point due to a unit current in the loops
- Parameters
- points: array (N_p, 3)
- separate_loops: Boolean
If True, don’t combine contributions of separate loops
- Returns
- Aield: array (N_p, 3) or array (N_loops, N_p, 3)
-
scalar_potential
(self, points, separate_loops=False, **kwargs)¶ Compute magnetic scalar potential in some point due to a unit current in the loops
- Parameters
- points: array (N_p, 3)
- separate_loops: Boolean
If True, don’t combine contributions of separate loops
- Returns
- Ufield: array (N_p,) or array (N_loops, N_p)
-
line_mutual_inductance
(self, path, separate_loops=False, **kwargs)¶ Calculate mutual inductance between self and another line current (path)
- Parameters
- pathPath3d or LineConductor object
The other line conductor
- separate_loopsTYPE, optional
If True, return the inductance separately for each loop. The default is False.
- Returns
- M: array
If separate loops, shape (N_loops, N_loops_path). Otherwise (N_loops_path,). where N_loops_path = len(path.entities)
-
mesh_mutual_inductance
(self, mesh, separate_loops=False, **kwargs)¶ Computes the mutual inductance between the polyline loops and a mesh_conductor mesh.
- Parameters
- meshTrimesh mesh object
Mesh with N_verts vertices.
- separate_loopsBoolean, optional
If True, return the inductance separately for each loop. The default is False.
- **kwargsdict
Passed to mesh_impedance.mesh2line_mutual_inductance
- Returns
- M: array
If separate loops, shape (N_loops, N_verts). Otherwise (N_verts,).