API Reference
ABSCAB
-
_cwl_A_phi_f(rhoP, zP) Normalized A_phi of Circular Wire Loop, far-field.
Compute the normalized tangential component of the magnetic vector potential of a circular wire loop. This formulation is useful for points away from the wire (“far-field”) at rhoP < 1/2 or rhoP > 2 or \(|zP| >= 1\).
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized tangential component of magnetic vector potential
- Return type
float
- Meta private
-
_cwl_A_phi_n(rhoP, zP) Normalized A_phi of Circular Wire Loop, near-field.
Compute the normalized tangential component of the magnetic vector potential of a circular wire loop. This formulation is useful for points close to the wire (“near-field”) at 1/2 <= rhoP <= 2 and \(|zP| < 1\).
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized tangential component of magnetic vector potential
- Return type
float
- Meta private
-
_cwl_A_phi_v(zP) Normalized A_phi of Circular Wire Loop, along rhoP=1, near-field.
Compute the normalized tangential component of the magnetic vector potential of a circular wire loop. This formulation is useful for points along rhoP=1 with \(|zP| < 1\).
- Parameters
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized tangential component of magnetic vector potential
- Return type
float
- Meta private
-
_cwl_B_rho_f(rhoP, zP) Normalized B_rho of Circular Wire Loop, far-field.
Compute the normalized radial component of the magnetic field of a circular wire loop. This formulation is useful for points away from the wire (“far-field”) at rhoP < 1/2 or rhoP > 2 or \(|zP| >= 1\).
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized radial component of magnetic field
- Return type
float
- Meta private
-
_cwl_B_rho_n(rhoP, zP) Normalized B_rho of Circular Wire Loop, near-field.
Compute the normalized radial component of the magnetic field of a circular wire loop. This formulation is useful for points close to the wire (“near-field”) at 1/2 <= rhoP <= 2 and \(|zP| < 1\).
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized radial component of magnetic field
- Return type
float
- Meta private
-
_cwl_B_rho_v(zP) Normalized B_rho of Circular Wire Loop, along rhoP=1, near-field.
Compute the normalized tangential component of the magnetic vector potential of a circular wire loop. This formulation is useful for points along rhoP=1 with \(|zP| < 1\).
- Parameters
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized radial component of magnetic field
- Return type
float
- Meta private
-
_cwl_B_z_f1(rhoP, zP) Normalized B_z of Circular Wire Loop, far-field (1).
Compute the normalized vertical component of the magnetic field of a circular wire loop. This formulation is useful for certain points away from the wire (“far-field”) at rhoP < 1/2 or (rhoP <= 2 and \(|zP| >= 1\)).
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized vertical component of magnetic field
- Return type
float
- Meta private
-
_cwl_B_z_f2(rhoP, zP) Normalized B_z of Circular Wire Loop, far-field (2).
Compute the normalized vertical component of the magnetic field of a circular wire loop. This formulation is useful for certain other points away from the wire (“far-field”) at rhoP > 2.
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized vertical component of magnetic field
- Return type
float
- Meta private
-
_cwl_B_z_n(rhoP, zP) Normalized B_z of Circular Wire Loop, near-field.
Compute the normalized vertical component of the magnetic field of a circular wire loop. This formulation is useful for points close to the wire (“near-field”) at 1/2 <= rhoP <= 2, but not rhoP=1, and \(|zP| <= 1\).
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized vertical component of magnetic field
- Return type
float
- Meta private
-
_cwl_B_z_v(zP) Normalized B_z of Circular Wire Loop, along rhoP=1, near-field.
Compute the normalized tangential component of the magnetic vector potential of a circular wire loop. This formulation is useful for points along rhoP=1 with \(|zP| < 1\).
- Parameters
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized radial component of magnetic field
- Return type
float
- Meta private
-
_sws_A_z_ax(zP) Normalized A_z of Straight Wire Segment, along rhoP=0.
Compute the normalized axial component of magnetic vector potential of straight wire segment, evaluated along axis of wire segment (rho = 0).
- Parameters
zP (float) – normalized axial coordinate of evaluation location; must not be in [0, 1] (on wire segment)
- Returns
normalized axial component of magnetic vector potential
- Return type
float
- Meta private
-
_sws_A_z_ax_f(zP) Normalized A_z of Straight Wire Segment, along rhoP=0, far-field.
Compute the normalized axial component of magnetic vector potential of straight wire segment, evaluated along axis of wire segment (rho = 0). This is a special case for points away from the wire (“far-field”) for zP < -1 or zP >= 2.
- Parameters
zP (float) – normalized vertical coordinate of evaluation location
- Returns
normalized axial component of magnetic vector potential
- Return type
float
- Meta private
-
_sws_A_z_ax_n(zP) Normalized A_z of Straight Wire Segment, along rhoP=0, near-field.
Compute the normalized axial component of magnetic vector potential of straight wire segment, evaluated along axis of wire segment (rhoP = 0). This is a special case for points close to the wire (“near-field”) for -1 <= zP < 2.
- Parameters
zP (float) – normalized axial coordinate of evaluation location; must not be in [0, 1] (on wire segment)
- Returns
normalized axial component of magnetic vector potential
- Return type
float
- Meta private
-
_sws_A_z_f(rhoP, zP) Normalized A_z of Straight Wire Segment, far-field.
Compute the normalized axial component of the magnetic vector potential of a straight wire segment. This formulation is useful for points away from the wire (“far-field”) at rhoP >= 1 or zP <= -1 or zP > 2.
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized axial component of magnetic vector potential
- Return type
float
- Meta private
-
_sws_A_z_n(rhoP, zP) Normalized A_z of Straight Wire Segment, near-field.
Compute the normalized axial component of the magnetic vector potential of a straight wire segment. This formulation is useful for points close to the wire (“near-field”) at rhoP < 1 and -1 < zP <= 2.
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized axial component of magnetic vector potential
- Return type
float
- Meta private
-
_sws_A_z_rad(rhoP) Normalized A_z of Straight Wire Segment, along zP=0 or zP=1.
Compute the normalized axial component of the magnetic vector potential of a straight wire segment, evaluated radially along the endpoints of the wire segment (zP = 0 or zP = 1).
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location; must not be zero (on wire segment)
- Returns
normalized axial component of magnetic vector potential
- Return type
float
- Meta private
-
_sws_A_z_rad_f(rhoP) Normalized A_z of Straight Wire Segment, along zP=0 or zP=1, far-field.
Compute the normalized axial component of the magnetic vector potential of a straight wire segment, evaluated radially along the endpoints of the wire segment (zP = 0 or zP = 1). This is a special case for points away from the wire (“far-field”) for rhoP > 1.
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location; must not be zero (on wire segment)
- Returns
normalized axial component of magnetic vector potential
- Return type
float
- Meta private
-
_sws_A_z_rad_n(rhoP) Normalized A_z of Straight Wire Segment, along zP=0 or zP=1, near-field.
Compute the normalized axial component of the magnetic vector potential of a straight wire segment, evaluated radially along the endpoints of the wire segment (zP = 0 or zP = 1). This is a special case for points close to the wire (“near-field”) for rhoP <= 1.
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location; must not be zero (on wire segment)
- Returns
normalized axial component of magnetic vector potential
- Return type
float
- Meta private
-
_sws_B_phi_f(rhoP, zP) Normalized B_phi of Straight Wire Segment, far-field.
Compute the normalized tangential component of the magnetic field of a straight wire segment. This formulation is useful for points away from the wire (“far-field”) at rhoP >= 1 or zP <= 0 or zP >= 1 or rhoP/(1-zP) >= 1 or rhoP/zP >= 1.
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized tangential component of magnetic field
- Return type
float
- Meta private
-
_sws_B_phi_n(rhoP, zP) Normalized B_phi of Straight Wire Segment, near-field.
Compute the normalized tangential component of the magnetic field of a straight wire segment. This formulation is useful for points close to the wire (“near-field”) at rhoP < 1 and 0 < zP < 1 and rhoP/(1-zP) < 1 and rhoP/zP < 1.
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized tangential component of magnetic field
- Return type
float
- Meta private
-
_sws_B_phi_rad(rhoP) Normalized B_phi of Straight Wire Segment, along zP=0 or zP=1.
Compute the normalized tangential component of the magnetic field of a straight wire segment, evaluated radially along the endpoints of the wire segment (zP = 0 or zP = 1).
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
- Returns
normalized tangential component of magnetic field
- Return type
float
- Meta private
-
circularWireLoop_A_phi(rhoP, zP) Compute the normalized tangential component of the magnetic vector potential of a circular wire loop.
This method selects the proper special case method to use for computing the normalized tangential component of the magnetic vector potential of a circular wire loop for given evaluation location (rhoP, zP).
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized tangential component of magnetic vector potential
- Return type
float
- Meta private
-
circularWireLoop_B_rho(rhoP, zP) Compute the normalized radial component of the magnetic field of a circular wire loop.
This method selects the proper special case method to use for computing the normalized radial component of the magnetic field of a circular wire loop for given evaluation location (rhoP, zP).
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized radial component of magnetic field
- Return type
float
- Meta private
-
circularWireLoop_B_z(rhoP, zP) Compute the normalized vertical component of the magnetic field of a circular wire loop.
This method selects the proper special case method to use for computing the normalized vertical component of the magnetic field of a circular wire loop for given evaluation location (rhoP, zP).
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized radial component of magnetic field
- Return type
float
- Meta private
-
magneticFieldCircularFilament(center, normal, radius, current, evalPos) Compute the magnetic field of a circular wire loop.
- Parameters
center (arr(float)) – [3: x, y, z] origin of loop (in meters)
normal (arr(float)) – [3: x, y, z] normal vector of loop (in meters); will be normalized internally
radius (float) – radius of the wire loop (in meters)
current (float) – loop current (in A)
evalPos (arr(float)) – [nEvalPos][3: x, y, z] evaluation locations (in meters)
- Returns
[nEvalPos][3: B_x, B_y, B_z] Cartesian components of the magnetic field evaluated at the given locations (in T)
- Return type
arr(float)
-
magneticFieldPolygonFilament(vertices, current, evalPos, useCompensatedSummation=True) Compute the magnetic field of a polygon filament at a number of evaluation locations.
- Parameters
vertices (arr(float)) – [numVertices][3: x, y, z] points along polygon; in m
current (float) – current along polygon; in A
evalPos (arr(float)) – [numEvalPos][3: x, y, z] evaluation locations; in m
useCompensatedSummation (bool) – If true, use Kahan-Babuska compensated summation to compute the superposition of the contributions from the polygon vertices; otherwise, use standard += summation.
- Returns
[numEvalPos][3: x, y, z] magnetic field at evaluation locations; in T
- Return type
arr(float)
-
magneticFieldPolygonFilamentVertexSupplier(numVertices, vertexSupplier, current, evalPos, useCompensatedSummation=True) Compute the magnetic field of a polygon filament at a number of evaluation locations.
- Parameters
numVertices (int) – number of polygon vertices to take into account
i), arr(float) vertexSupplier (callable(int) – should return points along polygon as [3: x, y, z] for i=0,1,…,(numVertices-1); in m
current (float) – current along polygon; in A
evalPos (arr(float)) – [numEvalPos][3: x, y, z] evaluation locations; in m
useCompensatedSummation (bool) – If true, use Kahan-Babuska compensated summation to compute the superposition of the contributions from the polygon vertices; otherwise, use standard += summation.
- Returns
[numEvalPos][3: x, y, z] magnetic field at evaluation locations; in T
- Return type
arr(float)
-
straightWireSegment_A_z(rhoP, zP) Compute the normalized axial component of the magnetic vector potential of a straight wire segment.
This method selects the proper special case method to use for computing the normalized axial component of the magnetic vector potential of a straight wire segment for given evaluation location (rhoP, zP).
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized axial component of magnetic vector potential
- Return type
float
- Meta private
-
straightWireSegment_B_phi(rhoP, zP) Compute the normalized tangential component of the magnetic field of a straight wire segment.
This method selects the proper special case method to use for computing the normalized tangential component of the magnetic field of a straight wire segment for given evaluation location (rhoP, zP).
- Parameters
rhoP (float) – normalized radial coordinate of evaluation location
zP (float) – normalized axial coordinate of evaluation location
- Returns
normalized tangential component of magnetic field
- Return type
float
- Meta private
-
vectorPotentialCircularFilament(center, normal, radius, current, evalPos) Compute the magnetic vector potential of a circular wire loop.
- Parameters
center (arr(float)) – [3: x, y, z] origin of loop (in meters)
normal (arr(float)) – [3: x, y, z] normal vector of loop (in meters); will be normalized internally
radius (float) – radius of the wire loop (in meters)
current (float) – loop current (in A)
evalPos (arr(float)) – [nEvalPos][3: x, y, z] evaluation locations (in meters)
- Returns
[nEvalPos][3: A_x, A_y, A_z] Cartesian components of the magnetic vector potential evaluated at the given locations (in Tm)
- Return type
arr(float)
-
vectorPotentialPolygonFilament(vertices, current, evalPos, useCompensatedSummation=True) Compute the magnetic vector potential of a polygon filament at a number of evaluation locations.
- Parameters
vertices (arr(float)) – [numVertices][3: x, y, z] points along polygon; in m
current (float) – current along polygon; in A
evalPos (arr(float)) – [numEvalPos][3: x, y, z] evaluation locations; in m
useCompensatedSummation (bool) – If true, use Kahan-Babuska compensated summation to compute the superposition of the contributions from the polygon vertices; otherwise, use standard += summation.
- Returns
[numEvalPos][3: x, y, z] magnetic vector potential at evaluation locations; in Tm
- Return type
arr(float)
-
vectorPotentialPolygonFilamentVertexSupplier(numVertices, vertexSupplier, current, evalPos, useCompensatedSummation=True) Compute the magnetic vector potential of a polygon filament at a number of evaluation locations.
- Parameters
numVertices (int) – number of polygon vertices to take into account
i), arr(float) vertexSupplier (callable(int) – should return points along polygon as [3: x, y, z] for i=0,1,…,(numVertices-1); in m
current (float) – current along polygon; in A
evalPos (arr(float)) – [numEvalPos][3: x, y, z] evaluation locations; in m
useCompensatedSummation (bool) – If true, use Kahan-Babuska compensated summation to compute the superposition of the contributions from the polygon vertices; otherwise, use standard += summation.
- Returns
[numEvalPos][3: x, y, z] magnetic vector potential at evaluation locations; in Tm
- Return type
arr(float)
-
MU_0= 1.25663706212e-06 vacuum magnetic permeability in Vs/Am (CODATA-2018)
-
MU_0_BY_2_PI= 2.0000000010887514e-07 vacuum magnetic permeability, divided by \(2 \pi\)
-
MU_0_BY_4_PI= 1.0000000005443757e-07 vacuum magnetic permeability, divided by \(4 \pi\)
-
MU_0_BY_PI= 4.000000002177503e-07 vacuum magnetic permeability, divided by \(\pi\)
Bulisch Generalized Complete Elliptic Integral
-
cel(k_c, p, a, b) Generalized Complete Elliptic Integral by Bulirsch (1969).
The generalized complete elliptic integral is computed using an iterative algorithm presented by R. Bulirsch in “Numerical Calculation of Elliptic Integrals and Elliptic Functions. III” in “Numerische Mathematik” 13, 305-315 (1969):
\[cel(k_c, p, a, b) = \int\limits_0^{\pi/2} \frac{a \cos^2{\varphi} + b \sin^2{\varphi}}{ \cos^2{\varphi} + p \sin^2{\varphi}} \frac{\mathrm{d}\varphi}{\sqrt{\cos^2{\varphi} + k_c^2 \sin^2{\varphi}}}\]- Parameters
k_c (float) – parameter k_c of cel(); absolute value must not be 0
p (float) – parameter p of cel()
a (float) – parameter a of cel()
b (float) – parameter b of cel()
- Returns
value of cel(k_c, p, a, b)
- Return type
float
-
PI_2= 1.5707963267948966 half of pi
-
SQRT_EPS= 1.4901161193847656e-08 sqrt of machine epsilon
Kahan-Babushka Compensated Summation
-
compAdd(contribution, compSum) Add a single contribution to a compensated summation.
Add a single contribution to the sum. The compensated sum is obtained by summing the final values of s, cs and ccs after this method has been called for all contributions.
- Parameters
contribution (float) – contribution to add to the sum
compSum (arr(float)) – [3: s, cs, ccs] target for output