# Halbach array

A Halbach array (German:) is a special arrangement of permanent magnets that augments the magnetic field on one side of the array while cancelling the field to near zero on the other side. This is achieved by having a spatially rotating pattern of magnetisation.
The rotating pattern of permanent magnets (on the front face; on the left, up, right, down) can be continued indefinitely and have the same effect. The effect of this arrangement is roughly similar to many horseshoe magnets placed adjacent to each other, with similar poles touching.
This magnetic orientation process replicates that applied by a magnetic recording tape head to the magnetic tape coating during the recording process. The principle was further described by James (Jim) M. Winey of Magnepan in 1970, for the ideal case of continuously rotating magnetization, induced by a one-sided stripe-shaped coil.
The effect was also discovered by John C. Mallinson in 1973, and these "one-sided flux" structures were initially described by him as a "curiosity", although at the time he recognized from this discovery the potential for significant improvements in magnetic tape technology.
Physicist Klaus Halbach, while at the Lawrence Berkeley National Laboratory during the 1980s, independently invented the Halbach array to focus particle accelerator beams.

## Linear arrays
### Magnetization

The magnetic flux distribution of a linear Halbach array may seem somewhat counter-intuitive to those familiar with simple magnets or solenoids. The reason for this flux distribution can be visualised using Mallinson's original diagram (note that it uses the negative y component, unlike the diagram in Mallinson's article). The diagram shows the field from a strip of ferromagnetic material with alternating magnetization in the y direction (top left) and in the x direction (top right). Note that the field above the plane is in the same direction for both structures, but the field below the plane is in opposite directions. The effect of superimposing both of these structures is shown in the figure.
The crucial point is that the flux will cancel below the plane and reinforce itself above the plane. In fact, any magnetization pattern where the components of magnetization are $\pi /2$ out of phase with each other will result in a one-sided flux. The mathematical transform that shifts the phase of all components of some function by $\pi /2$ is called a Hilbert transform; the components of the magnetization vector can therefore be any Hilbert-transform pair (the simplest of which is simply $\sin(x)\cos(y)$, as shown in the diagram above).
The field on the non-cancelling side of the ideal, continuously varying, infinite array is of the form
    $F(x,y)=F_{0}e^{ikx}e^{-ky},$
where
    $F(x,y)$ is the field in the form $F_{x}+iF_{y}$,
    $F_{0}$ is the magnitude of the field at the surface of the array,
    $k$ is the wavenumber (i.e., the spatial frequency) $2\pi /\lambda .$

### Applications

The advantages of one-sided flux distributions are twofold:
* The field is twice as large on the side on which the flux is confined (in the idealized case).
* There is no stray field produced (in the ideal case) on the opposite side. This helps with field confinement, usually a problem in the design of magnetic structures.
Thus they have a surprising number of applications, ranging from flat refrigerator magnets through industrial applications such as the brushless DC motor, voice coils, magnetic drug targeting to high-tech applications such as wiggler magnets used in particle accelerators and free-electron lasers.
The Inductrack Maglev train and Inductrack rocket-launch system utilize the Halbach array to lift the train by repelling loops of wire in the track.
Flat flexible (not hard ceramic ferrite) refrigerator magnets are created with a Halbach magnetization pattern for a stronger holding force when attached to a flat ferromagnetic surface (e.g. a fridge door) than the holding force from a uniform magnetization. They're made from powdered ferrite mixed in a flexible binder (e.g. plastic or rubber) that is exposed to a Halbach magnetization field pattern as it is extruded, permanently giving the ferrite particles in the magnetic compound this one-sided flux distribution (which can be viewed with magnetic viewing film).
Scaling up this design and adding a top sheet gives a wiggler magnet, used in synchrotrons and free-electron lasers. Wiggler magnets wiggle, or oscillate, an electron beam perpendicular to the magnetic field. As the electrons are undergoing acceleration, they radiate electromagnetic energy in their flight direction, and as they interact with the light already emitted, photons along its line are emitted in phase, resulting in a "laser-like" monochromatic and coherent beam.
The design shown above is usually known as a Halbach wiggler. The magnetization vectors in the magnetized sheets rotate in the opposite senses to each other; above, the top sheet's magnetization vector rotates clockwise, and the bottom sheet's magnetization vector rotates counter-clockwise. This design is chosen so that the x components of the magnetic fields from the sheets cancel, and the y components reinforce, so that the field is given by
    $H_{y}\approx \cos(kx),$
where k is the wavenumber of the magnetic sheet given by the spacing between magnetic blocks with the same magnetization vector.

### Variable linear arrays

A series of magnetic rods, magnetized perpendicular to their axes, can be arranged into a Halbach array. If each rod is then rotated alternately through 90°, the resultant field moves from one side of plane of the rods to the other, as shown schematically in the figure.
This arrangement allows the field to effectively be turned on and off above or below the plane of the rods, depending on the rotation of the rods. Such a device makes an efficient mechanical magnetic latch requiring no power. A detailed study of this arrangement has shown that each rod is subject to a strong torque from its neighboring rods, and therefore requires mechanical stabilization. However, a simple and efficient solution, providing both stabilization and the ability to rotate each rod alternately, is simply to provide an equal-gearing arrangement on each rod, as shown in the figure.

## Cylinder

A Halbach cylinder is a magnetized cylinder composed of ferromagnetic material producing (in the idealized case) an intense magnetic field confined entirely within the cylinder, with zero field outside. The cylinders can also be magnetized such that the magnetic field is entirely outside the cylinder, with zero field inside. Several magnetization distributions are shown in the figures.
The direction of magnetization within the ferromagnetic material, in plane perpendicular to the axis of the cylinder, is given by
    $M=M_{r}\left[\cos \left((k-1)\left(\varphi -{\frac {\pi }{2}}\right)\right){\widehat {\rho }}+\sin \left((k-1)\left(\varphi -{\frac {\pi }{2}}\right)\right){\widehat {\varphi }}\right],$
where M$_r$ is the ferromagnetic remanence (A/m). A positive value of k − 1 gives an internal magnetic field, and a negative one gives an external magnetic field.
Ideally, these structures would be created from an infinite-length cylinder of magnetic material with the direction of magnetization continuously varying. The magnetic flux produced by this ideal design would be perfectly uniform and be entirely confined to either the bore of the cylinder or the outside of the cylinder. Of course, the ideal case of infinite length is not realizable, and in practice the finite length of the cylinders produces end effects, which introduce non-uniformities in the field. The difficulty of manufacturing a cylinder with a continuously varying magnetization also usually leads to the design being broken into segments.

### Applications

These cylindrical structures are used in devices such as brushless AC motors, magnetic couplings and high-field cylinders. Both brushless motors and coupling devices use multipole field arrangements:
* Brushless motors or alternators typically use cylindrical designs in which all the flux is confined to the centre of the bore (such as k = 4 above, a 6-pole rotor) with the AC coils also contained within the bore. Such self-shielding motor or alternator designs are more efficient and produce higher torque or output than conventional motor or alternator designs.
* Magnetic-coupling devices transmit torque through magnetically transparent barriers (that is, the barrier is non-magnetic or is magnetic but not affected by an applied magnetic field), for instance, between sealed containers or pressurised vessels. The optimal torque couplings consists of a pair of coaxially nested cylinders with opposite +k and −k flux magnetization patterns, as this configuration is the only system for infinitely long cylinders that produces a torque. In the lowest-energy state, the outer flux of the inner cylinder exactly matches the internal flux of the outer cylinder. Rotating one cylinder relative to the other from this state results in a restoring torque.
* Cylindrical Halbach Arrays are used in Portable MRI Scanners. They offer the potential for a relatively lightweight, low to mid-field system with no cryogenics, a small fringe field, and no electrical power requirements or heat dissipation needs. The reduced stray fields also enhance safety and minimize interference with surrounding electronic devices.

### Uniform fields

For the special case of k = 2, the field inside the bore is uniform and is given by
    $H=M_{r}\ln \left({\frac {R_{\text{o}}}{R_{\text{i}}}}\right){\widehat {y}},$
where the inner and outer cylinder radii are R$_i$ and R$_o$ respectively. H is in the y direction. This is the simplest form of the Halbach cylinder, and it can be seen that if the ratio of outer to inner radii is greater than e, the flux inside the bore actually exceeds the remanence of the magnetic material used to create the cylinder. However, care has to be taken not to produce a field that exceeds the coercivity of the permanent magnets used, as this can result in demagnetization of the cylinder and the production of a much lower field than intended.
This cylindrical design is only one class of designs that produce a uniform field inside a cavity within an array of permanent magnets. Other classes of design include wedge designs, proposed by Abele and Jensen, in which wedges of magnetized material are arranged to provide uniform field within cavities inside the design as shown.
The direction of magnetization of the wedges in (A) can be calculated using a set of rules given by Abele and allows for great freedom in the shape of the cavity. Another class of design is the magnetic mangle (B), proposed by Coey and Cugat, in which uniformly magnetized rods are arranged such that their magnetization matches that of a Halbach cylinder, as shown for a 6-rod design. This design greatly increases access to the region of uniform field, at the expense of the volume of uniform field being smaller than in the cylindrical designs (although this area can be made larger by increasing the number of component rods). Rotating the rods relative to each other results in many possibilities, including a dynamically variable field and various dipolar configurations. It can be seen that the designs shown in (A) and (B) are closely related to the k = 2 Halbach cylinder. Other very simple designs for a uniform field include separated magnets with soft iron return paths, as shown in figure (C).
In recent years, these Halbach dipoles have been used to conduct low-field NMR experiments. Compared to commercially available (Bruker Minispec) standard plate geometries (C) of permanent magnets, they, as explained above, offer a huge bore diameter, while still having a reasonably homogeneous field.

#### Derivation in the ideal case

The method used to find the field created by the cylinder is mathematically very similar to that used to investigate a uniformly magnetised sphere.
Because of the symmetry of the arrangement along the cylinder's axis, the problem can be treated as two-dimensional. Work in plane-polar coordinates $(r,\theta )$ with associated unit vectors ${\hat {\mathbf {r} }}$ and ${\hat {\boldsymbol {\theta }}}$, and let the cylinder have radial extent $r_{\mathrm {i} }<r<r_{\mathrm {o} }$. Then the magnetisation in the cylinder walls, which has magnitude $M_{0}$, rotates smoothly as
    $\mathbf {M} _{\mathrm {cyl} }=M_{0}(\cos \theta \,{\hat {\mathbf {r} }}+\sin \theta \,{\hat {\boldsymbol {\theta }}}),$
while the magnetisation vanishes outside the walls, that is for the bore $r<r_{\mathrm {i} }$ and surroundings $r>r_{\mathrm {o} }$.
By definition, the auxiliary magnetic field strength $\mathbf {H}$ is related to the magnetisation and magnetic flux density $\mathbf {B}$ by $\mathbf {B} =\mu _{0}(\mathbf {H} +\mathbf {M} )$. Using Gauss' law $\nabla \cdot \mathbf {B} =0$, this is equivalently
Since the problem is static there are no free currents and all time derivatives vanish, so Ampère's law additionally requires $\nabla \times \mathbf {H} =0\implies \mathbf {H} =\nabla \varphi$, where $\varphi$ is the magnetic scalar potential (up to a sign under some definitions). Substituting this back into the previous Equation 1 governing $\mathbf {H}$ and $\mathbf {M}$, we find that we need to solve
which has the form of Poisson's equation.
Consider now the boundary conditions at the cylinder-air interfaces $r=r_{\mathrm {i} }$ and $r=r_{\mathrm {o} }$. Integrating $\nabla \times \mathbf {H} =0$ over a small loop straddling the boundary and applying Stokes' theorem requires that the parallel component of $\mathbf {H}$ is continuous. This in turn requires that $\varphi$ is continuous across the boundary. (More properly this implies that $\varphi$ must differ by a constant across the boundary, but since the physical quantities we are interested in depend on gradients of this potential, we can arbitrarily set the constant to zero for convenience.) To obtain a second set of conditions, integrate Equation 1 across a small volume straddling the boundary and apply the divergence theorem to find
    $\left[{\frac {\partial \varphi }{\partial r}}\right]=\pm \mathbf {M} \cdot {\hat {\mathbf {r} }},$
where the notation $[f]$ denotes a jump in the quantity $f$ across the boundary, and in our case the sign is negative at $r=r_{\mathrm {i} }$ and positive at $r=r_{\mathrm {o} }$. The sign difference is due to the relative orientation of the magnetisation and the surface normal to the part of the integration volume inside the cylinder walls being opposite at the inner and outer boundaries.
In plane-polar coordinates, the divergence of a vector field $\mathbf {F} =F_{r}{\hat {\mathbf {r} }}+F_{\theta }{\hat {\boldsymbol {\theta }}}$ is given by
Similarly, the gradient of a scalar field $f$ is given by
Combining these two relations, the Laplacian $\nabla ^{2}f=\nabla \cdot (\nabla f)$ becomes
Using Equation 3, the magnetisation divergence in the cylinder walls is
    ${\begin{aligned}\nabla \cdot \mathbf {M} _{\mathrm {cyl} }&={\frac {1}{r}}{\frac {\partial }{\partial r}}(rM_{0}\cos \theta )+{\frac {1}{r}}{\frac {\partial }{\partial \theta }}(M_{0}\sin \theta )\\[5pt]&={\frac {M_{0}\cos \theta }{r}}+{\frac {M_{0}\cos \theta }{r}}\\[5pt]&={\frac {2M_{0}\cos \theta }{r}}.\end{aligned}}$
Hence Equation 2, which is that we want to solve, becomes by using Equation 5
Look for a particular solution of this equation in the cylinder walls. With the benefit of hindsight, consider $\varphi _{\mathrm {p} }=r\ln r\cos \theta$, because then we have
    ${\begin{aligned}{\frac {1}{r}}{\frac {\partial }{\partial r}}\left(r{\frac {\partial \varphi _{\mathrm {p} }}{\partial r}}\right)&={\frac {1}{r}}{\frac {\partial }{\partial r}}\left[r{\frac {\partial }{\partial r}}(r\ln r\cos \theta )\right]\\[5pt]&={\frac {\cos \theta }{r}}{\frac {\partial }{\partial r}}\left[r(\ln r+1)\right]\\[5pt]&={\frac {\cos \theta }{r}}(\ln r+1+1)\\[5pt]&={\frac {\ln r\cos \theta }{r}}+{\frac {2\cos \theta }{r}}\end{aligned}}$
and also
    ${\begin{aligned}{\frac {1}{r^{2}}}{\frac {\partial ^{2}\varphi _{\mathrm {p} }}{\partial \theta ^{2}}}&={\frac {1}{r^{2}}}{\frac {\partial ^{2}}{\partial \theta ^{2}}}(r\ln r\cos \theta )\\[5pt]&=-{\frac {\ln r\cos \theta }{r}}.\end{aligned}}$
Hence $\nabla ^{2}\varphi _{\mathrm {p} }={\frac {2\cos \theta }{r}}$, and comparison with Equation 6 shows that $-M_{0}\varphi _{\mathrm {p} }=-M_{0}r\ln r\cos \theta$ is the appropriate particular solution.
Now consider the homogeneous equation for Equation 6, namely $\nabla ^{2}\varphi _{\mathrm {h} }=0$. This has the form of Laplace's equation. Through the method of separation of variables, it can be shown that the general homogeneous solution whose gradient is periodic in $\theta$ (such that all the physical quantities are single-valued) is given by
    $\varphi _{\mathrm {h} }=A_{0}+B_{0}\theta +C_{0}\ln r+\sum _{n=1}^{\infty }\left(A_{n}r^{n}+B_{n}r^{-n}\right)\cos n\theta +\sum _{n=1}^{\infty }\left(C_{n}r^{n}+D_{n}r^{-n}\right)\sin n\theta ,$
where the $A_{i},\ B_{i},\ C_{i},\ D_{i}$ are arbitrary constants. The desired solution will be the sum of the particular and homogeneous solutions that satisfies the boundary conditions. Again with the benefit of hindsight, let us set most of the constants to zero immediately and assert that the solution is
    $\varphi ={\begin{cases}\alpha r\cos \theta &r<r_{\mathrm {i} },\\\beta r\cos \theta -M_{0}r\ln r\cos \theta &r_{\mathrm {i} }<r<r_{\mathrm {o} },\\0&r>r_{\mathrm {o} },\end{cases}}$
where now $\alpha ,\ \beta$ are constants to be determined. If we can choose the constants such that the boundary conditions are satisfied, then by the uniqueness theorem for Poisson's equation, we must have found the solution.
The continuity conditions give
at the inner boundary and
at the outer boundary. The potential gradient has non-vanishing radial component $\beta \cos \theta -M_{0}\ln r\cos \theta -M_{0}\cos \theta$ in the cylinder walls and $\alpha \cos \theta$ in the bore, and so the conditions on the potential derivative become
    $(\beta \cos \theta -M_{0}\ln r_{\mathrm {i} }\cos \theta -M_{0}\cos \theta )-\alpha \cos \theta =-M_{0}\cos \theta \implies \beta -M_{0}\ln r_{\mathrm {i} }-\alpha =0\implies \alpha =\beta -M_{0}\ln r_{\mathrm {i} }$
at the inner boundary and
    $0-(\beta \cos \theta -M_{0}\ln r_{\mathrm {0} }\cos \theta -M_{0}\cos \theta )=M_{0}\cos \theta \implies \beta -M_{0}\ln r_{\mathrm {o} }=0$
at the outer boundary. Note that these are identical to Equations 7 and 8, so indeed the guess was consistent. Hence we have $\beta =M_{0}\ln r_{\mathrm {o} }$ and $\alpha =M_{0}\ln \left({\frac {r_{\mathrm {o} }}{r_{\mathrm {i} }}}\right)$, giving the solution
    $\varphi ={\begin{cases}M_{0}\ln \left({\frac {r_{\mathrm {o} }}{r_{\mathrm {i} }}}\right)r\cos \theta &r<r_{\mathrm {i} },\\M_{0}\ln \left({\frac {r_{\mathrm {o} }}{r}}\right)r\cos \theta &r_{\mathrm {i} }<r<r_{\mathrm {o} },\\0&r>r_{\mathrm {o} }.\end{cases}}$
Consequently, the magnetic field is given by
    $\mathbf {H} =\nabla \varphi ={\begin{cases}M_{0}\ln \left({\frac {r_{\mathrm {o} }}{r_{\mathrm {i} }}}\right)\cos \theta \,{\hat {\mathbf {r} }}-M_{0}\ln \left({\frac {r_{\mathrm {o} }}{r_{\mathrm {i} }}}\right)\sin \theta \,{\hat {\boldsymbol {\theta }}}&r<r_{\mathrm {i} },\\M_{0}\cos \theta \left[\ln \left({\frac {r_{\mathrm {o} }}{r}}\right)-1\right]\,{\hat {\mathbf {r} }}-M_{0}\ln \left({\frac {r_{\mathrm {o} }}{r}}\right)\sin \theta \,{\hat {\boldsymbol {\theta }}}&r_{\mathrm {i} }<r<r_{\mathrm {o} },\\0&r>r_{\mathrm {o} },\end{cases}}$
while the magnetic flux density can then be found everywhere using the previous definition $\mathbf {B} =\mu _{0}(\mathbf {H} +\mathbf {M} )$. In the bore, where the magnetisation vanishes, this reduces to $\mathbf {B} _{\mathrm {bore} }={\frac {1}{\mu _{0}}}\mathbf {H} _{\mathrm {bore} }$. Hence the magnitude of the flux density there is
    $B_{\mathrm {bore} }=\left|\mathbf {B} _{\mathrm {bore} }\right|={\sqrt {\cos ^{2}\theta +\sin ^{2}\theta }}{\frac {M_{0}}{\mu _{0}}}\ln \left({\frac {r_{\mathrm {o} }}{r_{\mathrm {i} }}}\right)={\frac {M_{0}}{\mu _{0}}}\ln \left({\frac {r_{\mathrm {o} }}{r_{\mathrm {i} }}}\right),$
which is independent of position. Similarly, outside the cylinder the magnetisation also vanishes, and since the magnetic field vanishes there, the flux density does too. So indeed the field is uniform inside and zero outside the ideal Halbach cylinder, with a magnitude depending on its physical dimensions.

### Varying the field

Halbach cylinders give a static field. However, cylinders can be nested, and by rotating one cylinder relative to the other, cancellation of the field and adjustment of the direction can be achieved. As the outside field of a cylinder is quite low, the relative rotation does not require strong forces. In the ideal case of infinitely long cylinders, no force would be required to rotate a cylinder with respect to the other.

## Sphere

If the two-dimensional magnetic distribution patterns of the Halbach cylinder are extended to three dimensions, the result is the Halbach sphere. These designs have an extremely uniform field within the interior of the design, as they are not affected by the "end effects" prevalent in the finite-length cylinder design. The magnitude of the uniform field for a sphere also increases to 4/3 the amount for the ideal cylindrical design with the same inner and outer radii. However, for a spherical struction, access to the region of uniform field is usually restricted to a narrow hole at the top and bottom of the design.
The equation for the field in a Halbach sphere is
    $B={\frac {4}{3}}B_{0}\ln \left({\frac {R_{\text{o}}}{R_{\text{i}}}}\right).$
Higher fields are possible by optimising the spherical design to take account of the fact that it is composed of point dipoles (and not line dipoles). This results in the stretching of the sphere to an elliptical shape and having a non-uniform distribution of magnetization over the component parts. Using this method, as well as soft pole pieces within the design, 4.5 T in a working volume of 20 mm$^3$ was achieved, and this was increased further to 5 T in 2002, although over a smaller working volume of 0.05 mm$^3$. As hard materials are temperature-dependent, refrigeration of the entire magnet array can increase the field within the working area further. This group also reported development of a 5.16 T Halbach dipole cylinder in 2003.