pleiades.RectangularCoil¶
-
class
pleiades.RectangularCoil(r0=1.0, z0=0.0, nr=1, nz=1, dr=0.1, dz=0.1, angle=0.0, **kwargs)[source]¶ A rectangular cross section coil in the R-Z plane
Parameters: - r0 (float) – The R location of the centroid of the coil
- z0 (float) – The Z location of the centroid of the coil
- nr (float, optional) – The number of current filaments in the R direction. Defaults to 10.
- nz (float, optional) – The number of current filaments in the Z direction. Defaults to 10.
- dr (float, optional) – The distance between current filaments in the R direction. Defaults to 0.01 m
- dz (float, optional) – The distance between current filaments in the Z direction. Defaults to 0.01 m
- nhat (iterable of float, optional) – A vector of (dr, dz) representing the orientation of the coil and the ‘local z direction’. This is the direction which applies to nz and dz when constructing current filament locations. The ‘r’ direction is found by the relation nhat x phi_hat = rhat. Defaults to (0, 1) meaning the local z axis is aligned with the global z axis and likewise for the r axis.
- **kwargs – Any valid keyword arguments for CurrentFilamentSet.
Variables: - r0 (float) – The R location of the centroid of the Coil
- z0 (float) – The Z location of the centroid of the Coil
- centroid (np.array) – Helper attribue for the R, Z location of the centroid of the Coil
- nr (float) – The number of current filaments in the R direction. Defaults to 10.
- nz (float) – The number of current filaments in the Z direction. Defaults to 10.
- dr (float) – The distance between current filaments in the R direction. Defaults to 0.1 m
- dz (float) – The distance between current filaments in the Z direction. Defaults to 0.1 m
- angle (float) – An angle in degrees representing the rotation of the coil and the ‘local z direction’ with respect to the global z axis. This is the direction which applies to nz and dz when constructing current filament locations. Defaults to 0 meaning the local z axis is aligned with the global z axis.
- verts (np.ndarray) – A 4x2 np.array representing the 4 vertices of the coil (read-only).
- area (float) – The area of the coil in m^2 (read-only).
- current_density (float) – The current density in the coil. This is equal to the total current divided by the area (read-only).
-
BR(current=None, mesh=None)¶ Compute the radial component of the magnetic field, BR.
Parameters: current (float, optional) – Specify a current value to override the current attribute for calculating the field. Defaults to None, which causes the current attribute to be used for the calculation Returns: BR Return type: np.array
-
BZ(current=None, mesh=None)¶ Compute the z component of the magnetic field, BZ.
Parameters: current (float, optional) – Specify a current value to override the current attribute for calculating the field. Defaults to None, which causes the current attribute to be used for the calculation Returns: BZ Return type: np.array
-
clone()¶ Create and return a copy of this coil
-
gBR(mesh=None)¶ Compute the Green’s function for the radial magnetic field, BR
Parameters: mesh (ndarray, optional) – An Nx2 array of points representing (R, Z) coordinates at which to calculate BR. Defaults to None, in which case the CurrentFilamentSet.mesh attribute is used. Returns: gBR – 1D array representing the Green’s function for BR and whose size is equal to the number of mesh. Return type: ndarray
-
gBZ(mesh=None)¶ Compute the Green’s function for the vertical magnetic field, BZ
Parameters: mesh (ndarray, optional) – An Nx2 array of points representing (R, Z) coordinates at which to calculate BZ. Defaults to None, in which case the CurrentFilamentSet.mesh attribute is used. Returns: gBZ – 1D array representing the Green’s function for BZ and whose size is equal to the number of mesh. Return type: ndarray
-
gpsi(mesh=None)¶ Compute the Green’s function for magnetic flux, \(psi\).
Parameters: mesh (ndarray, optional) – An Nx2 array of points representing (R, Z) coordinates at which to calculate the magnetic flux. Defaults to None, in which case the CurrentFilamentSet.mesh attribute is used. Returns: gpsi – 1D array representing the Green’s function for flux and whose size is equal to the number of mesh. Return type: ndarray
-
plot(ax, plot_patch=True, **kwargs)¶ Plot the current locations for the CurrentGroup
Parameters:
-
psi(current=None, mesh=None)¶ Compute the magnetic flux, \(psi\).
Parameters: - current (float, optional) – Specify a current value in amps to use instead of CurrentFilamentSet.current. Defaults to None, in which case the current attribute is used to calculate the flux.
- mesh (ndarray, optional) – An Nx2 array of points representing (R, Z) coordinates at which to calculate the magnetic flux. Defaults to None, in which case the CurrentFilamentSet.mesh attribute is used.
Returns: psi
Return type: ndarray
-
rotate(angle, pivot=(0.0, 0.0))[source]¶ Rotate the current group by a given angle around a specified pivot
Parameters: - angle (float) – The angle of the rotation in degrees as measured from the z axis
- pivot (iterable of float, optional) – The (R, Z) location of the pivot. Defaults to (0., 0.).
-
simplify()¶ Create a single coil object from weighted sum of current centroids.