Magnetic flux and flux density (B field)¶
cfsem.flux_density_linear_filament ¶
flux_density_linear_filament(
xyzp: Array3xN,
xyzfil: Array3xN,
dlxyzfil: Array3xN,
ifil: NDArray[float64],
wire_radius: float | NDArray[float64] = 0.0,
par: bool = True,
output: Literal["vector", "matrix"] = "vector",
) -> tuple[
NDArray[float64], NDArray[float64], NDArray[float64]
]
Biot-Savart law calculation for B-field contributions from many filament segments to many observation points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xyzp
|
Array3xN
|
[m] x,y,z coords of observation points |
required |
xyzfil
|
Array3xN
|
[m] x,y,z coords of filament segment start points |
required |
dlxyzfil
|
Array3xN
|
[m] x,y,z deltas from segment start to segment end |
required |
ifil
|
NDArray[float64]
|
[A] current in each filament segment |
required |
wire_radius
|
float | NDArray[float64]
|
[m] filament radius, scalar or array of length |
0.0
|
par
|
bool
|
Whether to use CPU parallelism |
True
|
output
|
Literal['vector', 'matrix']
|
|
'vector'
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
[T] (Bx, By, Bz) magnetic flux density at observation points, |
NDArray[float64]
|
or explicit |
Source code in cfsem/bindings.py
cfsem.flux_density_triangle_mesh ¶
flux_density_triangle_mesh(
obs: NDArray[float64],
nodes: NDArray[float64],
triangles: NDArray[int64],
s: NDArray[float64],
par: bool = True,
quad: str = "dunavant3",
) -> Array3xN
Biot-Savart law calculation for B-field contribution from a triangle mesh with one stream-function value per node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obs
|
NDArray[float64]
|
[m] observation points with shape |
required |
nodes
|
NDArray[float64]
|
[m] mesh node coordinates with shape |
required |
triangles
|
NDArray[int64]
|
node indices with shape |
required |
s
|
NDArray[float64]
|
[A] nodal stream-function values with shape |
required |
par
|
bool
|
Whether to use CPU parallelism |
True
|
quad
|
str
|
Triangle quadrature rule, one of |
'dunavant3'
|
Returns:
| Type | Description |
|---|---|
Array3xN
|
[T] (Bx, By, Bz) magnetic flux density at observation points |
Source code in cfsem/bindings.py
cfsem.flux_density_point_segment ¶
flux_density_point_segment(
xyzp: Array3xN,
xyzfil: Array3xN,
dlxyzfil: Array3xN,
ifil: NDArray[float64],
par: bool = True,
) -> Array3xN
Biot-Savart law calculation for B-field contributions from many filament segments to many observation points, treating each segment as a point source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xyzp
|
Array3xN
|
[m] x,y,z coords of observation points |
required |
xyzfil
|
Array3xN
|
[m] x,y,z coords of filament segment start points |
required |
dlxyzfil
|
Array3xN
|
[m] x,y,z deltas from segment start to segment end |
required |
ifil
|
NDArray[float64]
|
[A] current in each filament segment |
required |
par
|
bool
|
Whether to use CPU parallelism |
True
|
Returns:
| Type | Description |
|---|---|
Array3xN
|
[T] (Bx, By, Bz) magnetic flux density at observation points |
Source code in cfsem/bindings.py
cfsem.flux_density_circular_filament ¶
flux_density_circular_filament(
ifil: NDArray[float64],
rfil: NDArray[float64],
zfil: NDArray[float64],
rprime: NDArray[float64],
zprime: NDArray[float64],
par: bool = True,
) -> tuple[NDArray[float64], NDArray[float64]]
Off-axis Br,Bz components for a circular current filament in vacuum.
Near-exact formula (except numerically-evaluated elliptic integrals) See eqns. 12, 13 pg. 34 in [1], eqn 9.8.7 in [2], and all of [3].
Note the formula for Br as given by [1] is incorrect and does not satisfy the constraints of the calculation without correcting by a factor of (\(z / r\)).
References
[1] D. B. Montgomery and J. Terrell, “Some Useful Information For The Design Of Aircore Solenoids, Part I. Relationships Between Magnetic Field, Power, Ampere-Turns And Current Density. Part II. Homogeneous Magnetic Fields,” Massachusetts Inst. Of Tech. Francis Bitter National Magnet Lab, Cambridge, MA, Nov. 1961. Accessed: May 18, 2021. [Online]. Available: https://apps.dtic.mil/sti/citations/tr/AD0269073
[2] 8.02 Course Notes. Available: https://web.mit.edu/8.02t/www/802TEAL3D/visualizations/coursenotes/modules/guide09.pdf
[3] Eric Dennyson, "Magnet Formulas". Available: https://tiggerntatie.github.io/emagnet-py/offaxis/off_axis_loop.html
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ifil
|
NDArray[float64]
|
[A] filament current |
required |
rfil
|
NDArray[float64]
|
[m] filament R-coord |
required |
zfil
|
NDArray[float64]
|
[m] filament Z-coord |
required |
rprime
|
NDArray[float64]
|
[m] Observation point R-coord |
required |
zprime
|
NDArray[float64]
|
[m] Observation point Z-coord |
required |
par
|
bool
|
Whether to use CPU parallelism |
True
|
Returns:
| Type | Description |
|---|---|
tuple[NDArray[float64], NDArray[float64]]
|
[T] (Br, Bz) flux density components |
Source code in cfsem/bindings.py
cfsem.flux_density_ideal_solenoid ¶
Axial B-field on centerline of an ideal (infinitely long) solenoid.
This calc converges reasonably well for coil L/D > 20.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
current
|
float
|
[A] solenoid current |
required |
num_turns
|
float
|
[#] number of conductor turns |
required |
length
|
float
|
[m] length of winding pack |
required |
Returns:
| Type | Description |
|---|---|
float
|
[T] B-field on axis (in the direction aligned with the axis) |
Source code in cfsem/__init__.py
cfsem.flux_density_circular_filament_cartesian ¶
flux_density_circular_filament_cartesian(
ifil: NDArray[float64],
rfil: NDArray[float64],
zfil: NDArray[float64],
xyzp: Array3xN,
par: bool = True,
) -> Array3xN
Flux density of a circular filament in cartesian form at a set of locations given in cartesian coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ifil
|
NDArray[float64]
|
[A] filament current |
required |
rfil
|
NDArray[float64]
|
[m] filament R-coord |
required |
zfil
|
NDArray[float64]
|
[m] filament Z-coord |
required |
xyzp
|
Array3xN
|
[m] x,y,z coords of observation points |
required |
par
|
bool
|
Whether to use CPU parallelism |
True
|
Returns:
| Type | Description |
|---|---|
Array3xN
|
[T] flux density |
Source code in cfsem/bindings.py
cfsem.flux_density_dipole ¶
flux_density_dipole(
loc: Array3xN,
moment: Array3xN,
xyzp: Array3xN,
par: bool = True,
outer_radius: NDArray[float64] | None = None,
) -> Array3xN
Magnetic flux density of a dipole in cartesian coordiantes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loc
|
Array3xN
|
[m] x,y,z coordinates of dipole |
required |
moment
|
Array3xN
|
[A-m^2] dipole magnetic moment vector |
required |
xyzp
|
Array3xN
|
[m] x,y,z coords of observation points |
required |
par
|
bool
|
Whether to use CPU parallelism |
True
|
outer_radius
|
NDArray[float64] | None
|
[m] radius inside which to defer to magnetized sphere calc. Defaults to zeroes. |
None
|
Returns:
| Type | Description |
|---|---|
Array3xN
|
[T] flux density |