3D Magnets
Note
- SI Units with the Sommerfeld convetion are used for this discussion: \(\mathbf{B} = \mu_0 \left( \mathbf{H} + \mathbf{M} \right)\)1
- However, the Kennelly Convetion is used for the creation of each magnet object in the library: \(\mathbf{B} = \mu_0\mathbf{H} + \mathbf{J}\)1
- In free space \(\mathbf{B} = \mu_0 \mathbf{H}\)
- In magnetised bodies, the demagnetising field \(\mathbf{H_d} = - N \mathbf{M}\), where \(N\) is the demagnetising factor.
The derived equations for 3D magnets were performed using the Coulombic Charge model rather than the Amperian current model of the 2D systems. More correctly they are derived in terms of the \(H\) field rather than \(B\), but which in free space only differ by a factor \(\mu_0\), i.e. \(\mathbf{B} = \mu_0 \mathbf{H}\).
In the Kennelly convention of electromagnetic units every factor \(\mu_0 M_r\) can be replaced by \(J\) or \(J_r\).
Prisms/Cuboids
For a uniformly magnetised cuboid, used in our experiments, with dimensions \(2a \times 2b \times 2c\) magnetised in the \(x\)-direction is3
where the functions \(F_1\) and \(F_2\) are
For a bar magnetised in \(z\), the above equations can be rewritten by a 90˚ rotation about \(y\), leading to4
where the functions \(F_1\) and \(F_2\) are
Similar equations can be attained for a magnet magnetised in \(y\) by a 90˚ rotation of the first set of equations about the \(z\)-axis.
Cylinders/Solenoids
Recalling that the magnetic field due to a cylinder of length \(2b\) and radius \(a\), with a current \(I\) running through \(n\) turns of wire along the symmetry axis is:
Note
- This is equivalent to the equation in the Cylinder section, where \(\mu_0 n I \equiv \mu_0 M_r\)
- For an infinite solenoid, this reduces to \(B_z = \mu_0 n I\) at its center
For the general case, including off-axis points the field in cylindrical coordinates becomes
and
where:
and \(C\) is Bulirsch's 'cel' function5.
Bulirsch's complete elliptic integral
See NIST Handbook of Mathematical Functions6
The three standard Legendre forms of the complete elliptic integrals can be written using the generalised complete elliptic integral of Bulirsch:
\(K(k) = C(k_c, 1, 1, 1)\)
\(E(K) = C(k_c, 1, 1, k_c^2)\)
\(\Pi(n, k) = C(k_c, n+1, 1, 1)\)
A simple algorirthm for solving the elliptic integrals6 is included as a @staticmethod
in the Cylinder
subclass. It is vectorised and JIT compiled as a Numpy ufunc using
Numba for improved performance:
Cylinder._cel(kc, p, c, s)
Example
Here is an example of how to use it, for the special case of \(k_c = 1\) for the first complete elliptic integral, \(K(1)\):
\(C\left(1, 1, 1, 1 \right) = \pi/2\)
import pymagnet as pm
import numpy as np
cel_value = pm.magnets.Cylinder._cel(1, 1, 1, 1)
print(np.allclose(cel_value, np.pi/2.0))
Spheres
Outside a uniformly magnetised sphere8 of radius \(a\), the stray field is identical to a magnetic dipole, and has a convenient representation in spherical coordinates:
Note
- SI Units with the Sommerfeld convetion are used for this discussion: \(\mathbf{B} = \mu_0 \left( \mathbf{H} + \mathbf{M} \right)\)1
- However, the Kennelly Convetion is used for the creation of each magnet object in the library: \(\mathbf{B} = \mu_0\mathbf{H} + \mathbf{J}\)1
- In free space \(\mathbf{B} = \mu_0 \mathbf{H}\)
- In magnetised bodies, the demagnetising field \(\mathbf{H_d} = - N \mathbf{M}\), where \(N\) is the demagnetising factor.
-
J. M. D. Coey, Magnetism and Magnetic Materials (Cambridge University Press, 2010). ↩↩↩↩
-
E. P. Furlani, Permanent Magnet and Electromechanical Devices (Academic Press, San Diego, 2001). ↩
-
Z. J. Yang, T. H. Johansen, H. Bratsberg, G. Helgesen, and A. T. Skjeltorp, Potential and Force between a Magnet and a Bulk Y1Ba2Cu3O7-δ Superconductor Studied by a Mechanical Pendulum, Superconductor Science and Technology 3, 591 (1990). ↩
-
J. M. Camacho and V. Sosa, Alternative Method to Calculate the Magnetic Field of Permanent Magnets with Azimuthal Symmetry, Revista Mexicana de Física E 59, 8 (2013). ↩
-
R. Bulirsch, Numerical Calculation of Elliptic Integrals and Elliptic Functions. III, Numer. Math. 13, 305 (1969). ↩
-
N. Derby and S. Olbert, Cylindrical Magnets and Ideal Solenoids, American Journal of Physics 78, 229 (2010). ↩