Halbach array
A Halbach array 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. The principle was first invented 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. Although this magnetic flux distribution seems somewhat counter-intuitive to  those familiar with simple bar magnets or solenoids, the reason for this flux distribution can be intuitively 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 formula_1 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 formula_1 is called a Hilbert transform; the components of the magnetization vector can therefore be any Hilbert-transform pair (the simplest of which is simply formula_3, as shown in the diagram above). The field on the non-cancelling side of  the ideal, continuously varying, infinite array is of the form where Applications. The advantages of one-sided flux distributions are twofold: Although one-sided flux distributions may seem somewhat abstract, they have a surprising number of applications ranging from the refrigerator magnet 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. This device is also a key component of the Inductrack Maglev train and Inductrack rocket-launch system, wherein the Halbach array repels loops of wire that form the  track after the train has been accelerated to a speed able to lift. The simplest example of a one-sided flux magnet is a refrigerator magnet. These are usually composed of powdered ferrite in a binder such as plastic or rubber. The extruded magnet is exposed to a rotating field giving the ferrite particles in the magnetic compound a magnetization resulting in a one-sided flux distribution. This distribution increases the holding force of the magnet when placed on a permeable surface, compared to the holding force from, say, a uniform magnetization of the magnetic compound. 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 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 where "M" 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: Uniform fields. For the special case of "k" = 2, the field inside the bore is uniform and is given by where the inner and outer cylinder radii are "R" and "R" 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 formula_13 with  associated unit vectors formula_14 and formula_15, and let the cylinder have radial extent formula_16. Then the magnetisation in the cylinder walls, which has magnitude formula_17, rotates smoothly as while the magnetisation vanishes outside the walls, that is for the bore formula_19 and surroundings formula_20. By definition, the auxiliary magnetic field strength formula_21 is related to the magnetisation and magnetic flux density formula_22 by formula_23. Using Gauss' law formula_24, 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 formula_25, where formula_26 is the magnetic scalar potential  (up to a sign under some definitions). Substituting this back into the previous Equation governing formula_21 and formula_28, 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 formula_29 and formula_30. Integrating formula_31 over a small loop straddling the boundary and applying Stokes' theorem requires that the parallel component of formula_21 is continuous. This in turn requires that formula_26 is continuous across the boundary. (More properly this implies that formula_26 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 across a small volume straddling the boundary and apply the divergence theorem to find where the notation formula_36 denotes a jump in the quantity formula_37 across the boundary, and in our case the sign is negative at formula_29 and positive at formula_30. 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 formula_40 is given by Similarly, the gradient of a scalar field formula_37 is given by Combining these two relations, the Laplacian formula_42 becomes Using Equation , the magnetisation divergence in the cylinder walls is Hence Equation , which is that we want to solve, becomes by using Equation Look for a particular solution of this equation in the cylinder walls. With the benefit of hindsight, consider formula_44, because then we have and also Hence formula_47, and comparison with Equation shows that formula_48 is the appropriate particular solution. Now  consider the homogeneous equation for Equation , namely formula_49. 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 formula_50 (such that all the physical quantities are single-valued) is given by where the formula_52 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 where now formula_54 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 formula_55 in the cylinder walls and formula_56 in the bore, and so the conditions on the potential derivative become at the inner boundary and at the outer boundary. Note that these are identical to Equations and , so indeed the guess was consistent. Hence we have formula_59 and  formula_60, giving the solution Consequently, the magnetic field is given by while the magnetic flux density can then be found everywhere using the previous definition formula_23. In the bore, where the magnetisation vanishes, this reduces to formula_64. Hence the magnitude of the flux density there is 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 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 was achieved by Bloch "et al." in 1998, and this was increased further to 5 T in 2002, although over a smaller working volume of 0.05 mm. As hard materials are temperature-dependent, refrigeration of the entire magnet array can increase the field within the  working area further, as shown by Kumada "et al." This group also reported development of a 5.16 T Halbach dipole cylinder in 2003.