Tuneable homogeneous kG magnetic field production using permanent magnets

We present a permanent magnet arrangement that can achieve a tuneable axial magnetic field from 1.80(8)-2.67(2) kG along the z-axis, where (x,y) = (0,0), with a rms field variation of less than 1% over a length of 25 mm. The instrument consists of an arrangement of off-the-shelf N42 neodymium-iron-boron (NdFeB) axially magnetized ring magnets, of varying outer and inner diameters. The magnets are organized into four cylindrical brass holders, whose relative separation can be manipulated to achieve the desired magnetic field strength and homogeneity over the region of interest. We present magnetic field computations and Marquardt-Levenberg fits to experimental data and demonstrate excellent agreement between theory and experiment. The apparatus has been designed to accommodate a cylindrical atomic vapor cell of length 25 mm and diameter 25 mm to lie within the bore of the ring magnets. The design has a clear aperture of 20 mm in the x-y plane along the z-axis, which opens up new avenues for imaging exploration in atomic spectroscopy.


I. INTRODUCTION
There are a vast number of situations in experimental atomic and optical physics where magnetic fields are utilized, from a Zeeman slower necessary to slow and cool an atomic beam [1,2], to magneto-optical filters (MOFs) that use thermal atomic vapors in magnetic fields [3]. MOFs find a wide range of applications in other disciplines including e.g. quantum key distribution [4]; optical isolators [5]; atmospheric LI-DAR [6,7]; and laser frequency stabilization [8,9]. In certain cases there is the need to produce large, uniform magnetic fields (i.e. > 1 kG) in order to study a specific branch of physics, in particular thermal vapor experiments working in the hyperfine Paschen-Back regime [10,11]. It is not an easy feat to produce large uniform magnetic fields: a workaround is typically to reduce the physical dimensions of the interrogation region over which the experiments are performed [12,13]. However, this is not applicable to all situations and the need to produce large magnetic fields over increasingly large length-scales is ever pressing. A particular example is in solar flare forecasting [14]: the Sun is imaged through an optical system referred to as a solar filter [15,16]. The solar images taken are used to extract the line-of-sight solar magnetic field that is necessary for the forecasting model [17][18][19]. The optimum parameters for a solar filter of a particular atomic species depends on numerous factors, including the axial magnetic field, vapor cell length and vapor temperature. The optimum parameters can be determined theoretically using a modified version of ElecSus, which is a software package that calculates the electric susceptibility of an atomic medium [20], and it is these parameters that set the physical constraints on the magnetic field strength, geometry and dimensions of the solar filter. Often, solar filters require axial magnetic fields of several kilogauss that are uniform over length-scales of tens of millimeters along the z-axis [21]. Additionally, since these filters are used in imaging, large clear apertures are required in the x-y plane, which adds to the complexity of designing a system that can produce large magnetic * danielle.boddy@durham.ac.uk fields. It is these constraints that we have complied with in this work.
Magnetic fields can be produced via an electromagnet, which uses a coil of wire and a current supply, or by a permanent magnet. There are many pros and cons to choosing either method. One particular benefit to using the electromagnet is the ability to tune the magnetic field by simply changing the current supplied to the coil; this is advantageous when testing a new idea or characterizing an experiment. However, to produce magnetic fields of several kG using electromagnets, cooling is typically required to prevent over-heating of the coils if used continuously [22][23][24]. On the flip side, permanent magnet arrangements do not have any power requirements, hence no cooling, nor do they suffer from magnetic field noise due to current fluctuations originating from the power supplies. A "set and forget" approach is ideal when making a system transportable and controlled remotely, as this reduces the number of potential technical failures during fieldwork. It is for this reason that we have opted to pursue the permanent magnet route. With appropriately designed hardware, we address the tuneability problem and demonstrate field homogeneity over the required length-scale.
The remainder of the paper is organized as follows: in Section II A we present the magnetic field computation; Section II B discusses the functionality of the hardware and limitations to the maximum achievable magnetic field; we illustrate the performance of the assembly in Section III; and finally conclusions are drawn and an outlook provided in Section IV.

II. DESIGN OVERVIEW
The magnet geometries described in this paper were designed specifically for a potassium solar filter. The requirements are: a maximum axial magnetic field of ≈ 2.7 kG; a field homogeneity over 25 mm along the z-axis; a clear imaging window of a minimum of 20 mm diameter in the x-y plane; minimal contribution from the xand y-components of the magnetic field across the imaging window; and ≈ 1 kG tuning range of the magnetic field strength along the z-axis.

A. Magnetic field computation
Finding a permanent magnet arrangement that abides by the constraints stated in section II is a complex task. There are many software packages available that enable the magnetic field to be determined, however we chose to use Magpylib [25], which is a python package for magnetic field computation. The Magpylib package is open source and provides visual aids of the magnet geometry, which assisted the design of hardware mount.
The criteria of the instrument, outlined in section II, state there must be a clear aperture of 20 mm in diameter in the x-y plane along the magnetic field axis (i.e. z-axis) to permit solar imaging through the atomic vapor cell. Since the magnetic field is a vector quantity, B ≡ (B x , B y , B z ), using magnets with cylindrical symmetry will make the design simpler to facilitate. We focus our studies on ring magnets with opposite polarity on opposite faces as this produces an axial magnetic field.
In order to design an appropriate magnet assembly we must first understand the magnetic field profile of a single ring magnet. Figure 1 illustrates the magnetic field profile of a ring magnet with outer diameter 2R o = 5 mm, inner diameter 2R i = 2.5 mm, length 2d = 5 mm, as shown in Fig. 1 a), and remanence field B 0 = 12.8 kG, which is typical of N42 grade NdFeB magnets. Although this ring magnet does not meet our constraints, we can learn a lot from the figure. In Fig. 1 b) iv), the magnetic field profile is shown in the x-z plane and, due to cylindrical symmetry, we can assume the profile is identical in the y-z plane also. The arrows demonstrate the field direction, while the color of the arrow represents the magnitude of the field. Inside the physical profile of the magnet, the field is strongest. Within the bore of the ring magnet we see that the field is the opposite to that inside the magnet and a lot weaker, as evidenced by the change in color of the arrow. Additionally, the field lines within the bore of the ring magnet are not evenly spaced along the x-axis and display curvature, indicating that the field along x is not homogeneous. This is evident in Fig. 1 b) i) and ii), which show the B x and B z component of the magnetic field as a function of x for three z positions. At x = 0 mm, we see that B x = 0 for all z positions. However, as we translate along x, the argument that B x = 0 is no longer valid except for the case when z = 0 mm. The further we move from (x,z) = (0,0), the larger the x component of the field becomes. Additionally, we see that B z begins to reduce as we move further from z = 0 mm. In practice it is difficult to measure an individual component of the magnetic field and it is typically the magnitude of the total field that is measured at a particular point in space. Figure 1 b) iii) illustrates the magnitude of the total field as a function of x for three z positions discussed in Fig. 1 b) i) and ii). The magnitude of the total field along x is not homogeneous and displays curvature similar to that of the B z component of the magnetic field, since this component is dominant over B x and B y in this design. The details of why this occurs will not be discussed in detail here, as it is beyond the scope of this paper, however a thorough description and investigation can be found in ref [26].
This simple picture aids our understanding of the magnetic 2R o = 10 mm  [25]. Slices of the magnetic field components i) B x and ii) B z as a function of x taken at z = 0 mm (green), z = 1 mm (blue), and z = 2 mm (red). Vertical black dotted lines represent the physical profile of the magnet, i.e. ± 5 mm illustrates the outside diameter of the ring, whereas ± 2.5 mm illustrates the inside diameter of the ring. Also shown is the total magnitude of the magnetic field given by Eq. 2 as a function of x taken at z = 0 mm (green), z = 1 mm (blue), and z = 2 mm (red). iv) Magnetic field profile displayed in the x-z plane illustrated in magnitude by color and direction by arrows.
field profile of ring magnets. There are three take home messages that we learn from Fig. 1. First, there is always a radial component of the magnetic field when (x,y) = (0,0). Nevertheless, with an appropriately designed magnet assembly, the radial component can be made to be significantly smaller than the axial field component, so much so that we can neglect it in our computations. It is for this reason that we can assume that a cylindrical magnet with uniform magnetization, whose axis is aligned with the z = 0 axis and B x = B y = 0, has the following z-component of the magnetic field [27], (1) Here, 2d is the length of the cylinder, R is its radius, B 0 is the remanence field, and z 0 is the position of the cylinder's centre along the z-axis. The magnetic field for a ring is calculated using the principle of superposition. For a ring magnet with outer radius R o and inner radius R i the field is that from a cylinder of radius R o minus the field from a cylinder with R i .
Second, to produce field homogeneity along x, and similarly y, the physical dimensions of the magnets used should significantly exceed the area of required field homogeneity. For example, if we require a clear aperture of diameter 4 mm in the x-y plane with field homogeneity along z and minimal radial components, the magnet ring specifications illustrated in Fig. 1 a), particularly the dimension 2R i = 5 mm, would be inadequate as there are huge field variations when x > +1 mm and x < -1 mm. This ring magnet is more likely suited for a region of interest of diameter 2 mm in the x-y plane.
Third, there will always be a reduction of the field strength and a flip of the field direction on the axis of the ring magnet upon exit of the bore of the magnet. This occurs at approximately ± 3 mm in Fig. 1 b) iv). Thus it is pertinent to have the length of the ring magnet exceeding the desired homogeneity length along the z-axis.
Using Magpylib, we were able to address the three take home messages specific to our case. We prioritized our search on ring magnets with inner diameter greater than 25 mm for two reasons: we needed to fit a 25 mm diameter vapor cell inside the central bore of the magnets and; for our imaging purposes, we required a clear aperture of diameter 20 mm with minimal magnetic field variations across x-y and along z. Additionally, since we require field homogeneity along the z-axis of 25 mm (the length of our vapor cell), the length (or thickness) of the ring magnet must exceed 25 mm. In an ideal scenario, the length of the ring magnet would be infinite, but this is not feasible when making an experimental instrument. An alternative to using excess magnet length is to increase the magnetic field at the boundaries of the region of interest, in our case at the edges of the vapor cell (i.e. at z = ± 12.5 mm). The field can be increased by either using an additional ring magnet on the boundaries that has a higher remanence field (i.e. higher grade/strength) or by using a greater quantity of magnetic material. We chose the latter route as working with higher strength magnets are more difficult to manoeuvre and more dangerous to handle. Figure 2 illustrates a ring magnet geometry that meets the criteria outlined in section II. The magnets used in this computation are commercial off-the-shelf neodymium-iron-boron (NdFeB) (N42) ring magnets of thickness 5 mm. We use three sizes: outer diameter (OD) 90 mm, inner diameter ID64   OD60, ID40   OD40, ID25  OD40, ID25   OD90, ID64 OD60, ID40 x z y c) . 2. a) Illustration of the concentric magnet arrangement in the x-y plane used in the computation model. "OD" and "ID" correspond to the outer and inner diameters of the magnets, respectively, with the number succeeding either OD or ID indicating the dimension in millimeters. The design can be thought of as four magnet groups, illustrated by use of four colors: purple; red; green; and blue. The red and green magnet groups consist of three magnet layers, with each layer containing two concentric magnets. The purple and blue magnet groups consist of one magnet layer with three concentric magnets. b) Illustration of the magnet arrange in the x-z plane. The magnet groups are positioned accordingly: purple positioned at z 1 ; red at z 2 ; green at z 3 ; and blue at z 4 . c) Theoretical calculation of the axial magnetic field, B z , using Eq. 1. The field from each individual magnet group is shown and illustrated via their corresponding color, with the magnet group position shown using dotted lines and z i label, where i = 1, 2, 3, or 4. The total magnetic field is a superposition of the fields from the four magnet groups and is shown via a solid black line. Also shown are dashed black vertical lines that define a boundary between which is the region of interest for the field homogeneity, where for this case B mean = 2.8 kG with a root-mean-square field variation of less than 1%. 64 mm; OD60, ID40; OD40, ID25. The arrangement and positioning of the magnets is shown in Fig. 2 a) and b). The design is composed of two halves that have exact-reflective symmetry about the z = 0 mm mirror line: one half contains the magnets positioned at z 1 and z 2 (colored purple and red, respectively); while the other half contains the magnets posi-tioned at z 3 and z 4 (colored green and blue, respectively). The red and green magnet groups comprise of three magnet layers, with each layer consisting of two concentric ring magnets (OD90, ID64 and OD60, ID40) with the same polarity. The polarity between each adjacent face of the layers is opposite, hence the layers attract, resulting in zero separation between the layers. The length, or thickness, of both the red and green group is 15 mm; this exceeds the edges of the vapor cell that are positioned at z ± 12.5 mm. Furthermore, the smallest inner diameter magnet used in these groups is 40 mm, which can also accommodate a vapor cell of diameter 25 mm.
The purple and blue magnet groups comprise of one magnet layer composed of three concentric ring magnets (OD90, ID64; OD60, ID40; and OD40, ID25) with the same polarity: these magnet groups are used to boost the field at the vapor cell boundaries, as discussed in the third take home message. In total there are 18 magnets in the system [28]. The axial magnetic field for this arrangement is calculated using Eq. 1 and the total field is shown in Fig. 2 c), as well as the individual contributions from the four magnet groups. The black dashed vertical lines define the positions of cylindrical vapor cell faces. The mean axial magnetic field between the two cell faces is B mean = 2.8 kG with a root-mean-square field variation of less than 1%. By changing the positions (z 1 , z 2 , z 3 and z 4 ) with respect to z = 0, we can change the magnetic field strength while still maintaining field homogeneity over the region of interest. As a rule of thumb, the red and green magnet groups control the strength of the field, while the purple and blue magnet groups tend to control the extent of the homogeneity. Figure 3 illustrates the magnetic field profile in the x-z plane determined using Magpylib for the magnet arrangement shown in Fig. 2. As shown in Fig 3 b), the magnetic field strength is at its strongest inside the magnets, as expected. Within the bore of the magnets, where the vapor cell resides, the field lines are uniform across x, which is evident in Fig. 3 a) i) and ii). Shown are the B x and B z components as a function of x for three z positions, which encompass the region of interest. Since the magnitude of the total magnetic field, B total , is given by the contribution of B x and B y is less than 1%. This is evident in Fig 3 a) iii) where the magnitude of the field along x echoes the B z profile shown in Fig 3 a) ii).

B. Hardware criteria
The magnet holder consists of two halves, that are mirror images of one another, and can be separated to permit insertion of a vapor cell to lie within the bore of the magnets. Each half consists of a square block and two cylinders, as shown in Fig. 4 a): one we define as the "large" cylinder; the other we define as the "small" cylinder. The large cylinder contains either the green or red magnet group, as shown in Fig. 2.  Fig. 1. a) Slices of the magnetic field components i) B x and ii) B z as a function of x taken at z = 0.0 mm (green), z = 6.0 mm (blue) and z = 12.5 mm (red). The vertical, black dashed lines illustrate the clear imaging window we require. The B z component greatly exceeds that of the B x , and correspondingly B y , components of the magnetic field. From Eq. 2, the contribution is less than 1%. Bottom: Magnetic field displayed in the x-z plane illustrated in magnitude by color and direction by arrows.
The small cylinder contains either the purple or blue magnet group.
The large cylinder back plate is threaded on the outside with a pitch of 2 mm and screws into the square block, permitting axial translation of 2 mm per rotation. The thickness of the square block sets how much the large cylinder can translate along the z-axis -a square block thickness of 20 mm is sufficient to produce the fields investigated in this paper. The front plate of the large cylinder is threaded on the inside of its bore with a pitch of 2 mm. The back plate of the small cylinder is threaded on the outside which enables the small cylinder to be screwed into the internal bore of the large cylinder front plate. This permits an axial translation of the small cylinder of 2 mm per one full 2π rotation, with respect to the large cylinder. This pitch is sufficient to provide the tuning control we require. Photographs of the complete assembly are shown in Fig. 4 b). In the bottom photograph the large imaging window is clearly visible.  4. a) An exploded view schematic illustration of one half of the magnet holder, which is composed of a square block, a "large" cylinder and a "small" cylinder. Also shown are the magnets and black plastic spacers. b) Photographs of the complete assembly. c) Measured magnetic field profile B z (black dots) when the assembly is set to give maximum field. The average magnetic field over the region of interest, illustrated via the black dashed lines, is B mean = 2.67 kG with a root-mean-square deviation of 20 G over this region, i.e. 1% variation. Also shown are the individual contributions from the four magnet groups that are colored accordingly, as outlined in figure 2, with the positions and corresponding errors extracted from the Marquardt-Levenberg fit (grey solid line) [29] using Eq. 1 and the experimental data. The normalized residuals, R, are also shown. Figure 4 c) illustrates the measured maximum field strength and the field profile along the z-axis, for the magnets and hardware used in this design [30]. The mean magnetic field along the z-axis over the region of interest of z = ±12.5 mm is B mean = 2.67 kG with a root-mean-square field variation of 20 G, which is on the order of ≈ 1% variation. Also stated are the positions of the magnet groups in their respective colors. Below, normalized residuals are also displayed.
The material chosen for the magnet holder is brass. Brass is non-magnetic and is durable enough to withstand cross-threading while screwing the cylinders closer together or further apart when tuning the magnetic field strength. To vary the cylinders positions, additional holes were included on each cylinder front plates such that custom tools could be inserted and used to rotate the cylinders and, hence, translate them. CAD drawings for these tools are included in the Supplementary Materials.
The assembly has been designed such that N42 grade Nd-FeB magnets can be used and achieve the fields necessary for our investigation. Magnets of this strength are easier to control and position, compared to N52 grade magnets, however, assembling the magnets into the cylinders must be approached with caution. An assembly guide has been provided in the Supplementary Materials, including CAD drawings for assembly jigs and photographs for visual aids.

III. RESULTS
In the remainder of the paper, we demonstrate how we can manipulate the magnetic field profile by varying the positions of the magnet groups using the hardware discussed in section II B. We compare our measurements to theoretical calculations using Eq. 1.
An axial Hall probe was used to measure B z as a function of z. Figure 5 shows three examples of the measured field profile. In each example, the maximum measured magnetic field is distinct due to different positioning of the magnet groups, as discussed in section II A. The experimental data is fitted using Eq. 1, where we have assumed the magnet dimensions are fixed. We have extracted the positions of the four magnet groups and the remanence field using a Marquardt-Levenberg fit: the errors in the fit parameters are estimated using the square-root of the diagonal elements of the covariance matrix [29]. The positions of the magnet groups, the mean magnetic field and root-mean-square deviation within the region of interest, shown via a vertical dashed line, are stated in each subplot. Also shown are the associated normalized residuals for each subplot, which demonstrate excellent agreement between theory and experiment.
In Fig. 5 a) we produce an axial magnetic field of 1.80(8) kG and we achieve homogeneity over a length of 25 mm as required. However, we see that we have two local field maxima at approximately ± 40 mm. We attribute these to inappropriate small cylinder positions, and bringing the positions of the small cylinders closer to z = 0 will eradicate these. In spite of this, we have achieved the field required over the region of interest. As shown in Fig. 4 c), the maximum field we can achieve is B mean = 2.67(2) kG due to the hardware constraints, as illustrated in Fig. 4 a). We can achieve any value of field between the maximum and 1.80 (8) kG; examples are shown in Fig. 5 b) and c).

IV. CONCLUSION
In conclusion, we have presented a permanent magnetic field design that can produce an axial magnetic field of FIG. 5. Measured axial magnetic field (black dots) with an optimized fit (solid grey line) is shown for three arrangements of the magnet groups. Also shown are the normalized residuals for each subplot. Vertical black dashed lines indicate the vapor cell face positions. The mean magnetic field along the length of the vapor cell, i.e. between the two black dashed vertical lines, and root-mean-square deviation is stated in each subplot, as well as the magnet group positions. several kilogauss with field homogeneity over a length-scale of tens of millimeters, with negligible contribution from the radial field components. The hardware permits field tuneability ranging from 1.80(8) kG to 2.67(2) kG with rms field variation of less than 1%, and we demonstrate that Marquardt-Levenberg fits to experimental data demonstrates excellent agreement between theory. The design is such that a cylindrical vapor cell of length 25 mm and diameter 25 mm can be placed within the bore of the ring magnets, with a clear aperture of 20 mm for imaging through the vapor cell. The design will be of significance, and benefit, to those interested in atomic spectroscopy in large axial magnetic fields.

V. SUPPLEMENTARY MATERIAL
The supplementary material contains hardware CAD drawings (including drawings for jigs required for assembly and tuning tools), parts list (including a bill-of-materials) for the design discussed here and assembly advice.

VI. ACKNOWLEDGMENTS
We gratefully acknowledge Ifan Hughes and Steven Wrathmall helpful discussions, Clare Higgins for editorial discussions, Stephen Lishman and Malcolm Robertshaw for mechanical design assistance and fabrication, and EPSRC (Grant No. EP/R002061/1) and STFC (Grant No. ST/V005979/1) for funding.

VII. DATA AVAILABILITY
The data that support the findings of this study are openly available in DRO at https://doi.org/10.15128, reference number r2xs55mc08w [31].