Abstract
In this paper, a new portable, low-cost magnet with a good homogeneity is presented. The single-layer central magnet structure based on Halbach-type array has been designed, simulated which can generate a magnetic field of 1 T under the weight of 2 kg. Magnetic strips placed at the ends of the central magnet are presented to improve the central homogeneity. In order to counteract the inhomogeneity resulting from manufacturing tolerances, a new compact shimming structure designed for miniature Halbach magnet is applied. With this structure a reduction of the full width at half maximum (FWHM) from 21 kHz to less than only 0.7 kHz, which is adequate for achieving a good NMR relaxation signal. This novel miniature magnet structure has achieved an excellent balance between cost and homogeneity for portable time domain NMR.
Introduction
Nuclear magnetic resonance (NMR) is the resonant energy exchange between RF magnetic fields and atomic nuclear spins subjected to static magnetic fields. Its quick, precise and non-destructive advantages make it a powerful means to be used in various applications, including materials science [1–4], biology [5,6] and medicine [7–11]. Nowadays, in order to improve detection resolution which is directly determined by the magnet homogeneity, state-of-the-art NMR equipment are usually based on superconducting magnets with field strength up to tens of Tesla and a weight of several tons, whose high and uniform magnetic fields lead to the high resolution and high signal-to-noise ratio. However, the bulky, expensive, and high-maintenance superconducting magnet is not necessary for portable time domain NMR which is only required to get relaxation time of sample. In this case, a miniature, affordable and low-maintenance magnet can make more beneficial.
At present, there are four main kinds of magnet used in the portable NMR device, including H-shape [12], C-shape [13], single-sided [14–18] and Halbach magnet [19–24]. H-shape and C-shape magnet both offer a good sample accessibility due to their structural openness. But in order to generate a closed magnetic circuit, bulky iron yokes are indispensable components which will directly increase the weight of magnets leading to a loss of portable. Single-sided magnets are designed to meet the demands of surface measurement of large sample or inside-out NMR probe. The Halbach magnet is that the field of multipole magnets can be approximated by an arrangement of individual magnet segments which are placed in an annulus form and polarized in the direction of the field lines generated by this magnetic multipole [25]. Although the Halbach magnets limit the openness of the sample area due to the closure of their specific structure, they have the largest field-to-mass ration and smallest stray field among all kinds of magnets. Now, they have been the focus of research in portable time domain NMR instruments. For instance, in [25], a small and low-cost Halbach magnet with three individual magnets was designed to produce homogeneous magnetic fields. It was able to achieve a field strength of 1 T and proton linewidths of 50 ppm FWHM when containing 3.2 μL sample. However, the sample accessibility of this magnet was a bit inconvenient that one of the bar magnets had to be removed before changing the sample. In [26], particle swarm optimization was used to optimize the parameters of Halbach magnet with multi-layers. In spite of the ideal theoretical homogeneity after optimization, the actual magnet after construction weighed above 20 kg and had a length of 600 mm, which could not meet the requirements of portable. In [27], Danieli, Blumich et al. designed a Halbach magnet whose homogeneity could be improved by the adjustment of rectangular magnetic blocks. Although the magnet can reach the requirements of chemical shift experiments under a light weight, the cost will be increased greatly because the precision of adjustment have to reach 1 μm which is difficult for conventional assembly. In general, although some constructive and creative structure of magnet have been proposed, there are still no suitable miniature and low-cost Halbach magnets can be used in the portable NMR for relaxation time measurement. Thus, a novel magnet structure need to be designed, which features light weight, easy-construction and compactness. In order to obtain signals of substances with shorter relaxation time components, it would be better with the smaller magnetic field homogeneity. Based on the results of our previous biological experiments [28,29], the homogeneity is preferably less than 400 ppm.
In the present work we discuss the design, assembly and passive shimming of a novel permanent magnet structure. The goal of the design is to generate an intense and homogeneous static magnetic field. Here, the finite element method is used to achieve the optimal height of a single-layer central Halbach magnet array made of samarium cobalt. To reduce the inhomogeneity introduced by the effect of the finite length of the magnet, a novel structure consisting of 20 magnetic strips made of neodymium-iron-boron is placed at the ends of the central magnet. Besides, considering the manufacturing tolerances, a new compact shimming structure has been designed after error analysis. The experimental results indicate that the field strength of the novel Halbach magnet is able to reach 1T under a weight of only 2 kg. And the final FWTH of 30 μL 0.1% copper sulfate doped water sample contained in 3 mm standard NMR tube is only 16 ppm, which is adequate for offering the potential for the detection of materials with short relaxation time or for the signal differentiation of multi-component substances.
Magnet design
Design characteristics
The magnetic flux density B (n) of an ideal dipolar cylindrical Halbach array consisting of n segments can be defined as follows [26]:
Nowadays, the Halbach magnets are usually designed to require more than dozens of independent magnet blocks [30–32] to achieve better theoretical homogeneity. However, with the number of blocks and number of layers increasing, manufacturing errors and positioning errors will also accumulate gradually, which will result in a huge difference between the actual field distribution and the theoretical result. Therefore, in order to reduce the manufacturing errors and improve the portability of the magnet, the initial magnet design was based on a single-layer Halbach array consisting of 16 individual rectangular and trapezoidal magnetic blocks made of SmCo32 (B r = 1.11 T, H cb = 796 kA/m) and determined inner and outer diameter (r inner = 9 mm, r outer = 24 mm) (see Fig. 1) which could be used to generate 1.061 T theoretical static field strength. The orientation of the magnetic field, which unlike traditional H-shape and C-shape, is perpendicular to the array axis, defines the x direction of our reference system, while y points along the direction of the bore.

Schematic diagram of a dipolar Halbach cylinder made by assembling eight trapezoidal segments and eight rectangular segments. The orientation of the magnetization of each segment is shown on the figure and the resultant field at the center of the magnet points along the x axis. Besides, the curved arrows indicate the angle error in error analysis.
For a single-layer Halbach magnet with determined diameters, it should be noted that the height of the magnet is a very significant parameter which directly determine the size, weight and field performance of magnet. Thus, in order to obtain the relationship between magnet height and field performance, the finite element method was used to simulate the performance of magnets with different heights. All the simulations were performed on a 64 GB standard 64-bit computer. The region of interest is centered in this magnet, then we focused on the field homogeneity with a cylindrical volume of 5 mm diameter and 5 mm length. And the homogeneity can be calculated by Eq. [2].

The magnetic field performance of Halbach magnets with different heights, the black continuous line represents the homogeneity of the target area, the blue dotted line represents the variation of the average magnetic field strength, and the red chain line represents the first-order difference of the homogeneity.
In order to achieve a better field performance, the central magnetic homogeneity needed to be further improved. According to the simulation of the homogeneity values of the same target area in the magnets with different end magnetic field intensities at the same height, it can be found that the homogeneity improve significantly with the increase of the end magnetic field strength, as is shown in Fig. 3a. Thus, to compensate the effect introduced by the finite length of the magnet, a straightforward and valid way to improve the field homogeneity of a Halbach magnet is to increase both end field strength. In order to ensure the compact size of the whole magnet, 20 magnet strips were inserted into both top and bottom covers which were placed at the ends of the magnet, which can improve central homogeneity effectively by slowing down the drop of both end field strength. For the material of the strips, neodymium magnets in grade N52 was chosen (B r = 1.11 T, H cb = 796 kA/m), since the remanence value is the largest among all optional magnetic materials. Each strip is 2.6 mm × 3 mm × 21 mm. Comparing the field strength values along the axis of the magnet before and after inserting strips (Fig. 3b), it could be found that the magnetic field strength of the end of the magnet has increased from 0.51 T to 0.59 T, an increase by 15.7%. The same simulation parameters and software were used to simulate the magnetic field distribution in the same target area. The results showed that the homogeneity of the same target area had been improved to 60.4 ppm after inserting the strips. Aluminum alloy of which relative permeability approach one was chosen as structural material to keep the overall mass of the system as small as possible. The size of the overall structure shown in Fig. 4 is ∅ 64 mm × 132 mm.

(a) The relationship between end field strength and the central homogeneity. (b) The field strength along the axial of the magnet before and after inserting the magnet strips made of N52. The black line represents the situation before inserting the strips. The red line represents the situation after inserting the strips. There is an obvious increase from 0.51 T to 0.59 T.

The design of Halbach magnet. The magnet including the main magnets made of SmCo32 in red, the magnetic strips made of N52 in brown, the guide sleeve made of PTFE in white and the nonmagnetic materials e.g. the aluminum shell and covers are marked in sliver. The right picture is the structure of the strips.
Although a homogeneous field is expected in theory for the optimum height and effective end strips, actually it is by far not achieved. This is because all the above simulation results depend on the ideal shape and magnetization of each magnetic block. However, it should be noted that the mechanical tolerances in the magnet holder and magnet themselves, as well as inhomogeneous magnetization of the individual magnetic block and temperature effect will lead to further homogeneity becoming worse comparing with ideal system. Therefore, an effective and practical Halbach magnet design must consider the effect of various tolerances. The first step is to conduct an error analysis to construct the actual engineering model. Typically, there are two main tolerances, including the errors in remanent field strength and magnetization angle, affecting the actual performance of the magnet.
Here, 16 magnetic blocks made of samarium cobalt material were regarded as error analysis objects, which were cut from the same big magnetic block, so that the magnetic remanence between magnetic blocks were almost the same. Therefore, it is only necessary to analyze the effect of the magnetization angle errors of the central magnetic block. Here, to have a better understanding, the magnetization angle of each magnetic block can be expressed in the form of three-dimensional coordinates. Thus, all SmCo32 magnetic blocks can be divided into 8 groups according to the same magnetization direction. The same group such as magnetic block 1 and 9 depicted in Fig. 1 have the same magnetization direction, and they can be considered as one factor in error analysis. Table 1 shows the specific grouping results. In order to better reflect the influence of magnetization angle error on actual magnetic field performance, the orthogonal experiment based on simulation was used. Considering the actual manufacturing conditions of the factory, the errors of each factor were characterized into three typical levels, +2.5°, +1.5° and −1.5°, where the angular deflection in a clockwise direction was regarded as a positive error (see Fig. 1) . Table 2 reflects the factor level table used in this experiment.
Grouping results of magnetization direction
Grouping results of magnetization direction
Factor level table
From the simulation results shown in Table 3, the effect of angle variations is much serious on the field homogeneity and the worst homogeneity can reach 4200 ppm which is almost 70 times worse than the theoretical value. Figure 5 shows the huge difference between the homogeneity considering manufacturing errors and theoretical homogeneity. And only when the errors among 8 groups are equal to each other, the homogeneity is almost similar with the ideal. However, it is impossible to make it in the real system. In addition, using the homogeneity as a response characteristic of the orthogonal experiment, the average response table for each level of each factor was made (see Table 4). Delta represents the difference between the maximum and minimum values of each level, which can be used to reveal the group that has the greatest impact on homogeneity. The result shows that the magnetization angle represented by E group has the greatest influence on the magnetic field homogeneity among all 8 groups, and the magnetization angle represented by A group has the least influence on the actual homogeneity. All of the above results have important reference significance for the manufacturing and selection of the magnetic blocks.
The orthogonal experiment results
Average response table

Comparison between ideal and the worst field distribution. (a) 2D map of ideal field distribution. (b) 2D map of field distribution considering manufacturing errors.

Magnet shimming structure. The effective length of shimming structure is 40 mm. Two pieces of drawers can be moved out easily along the center of magnet.
According to the error analysis, it can be found that the actual magnetic field performance of the magnet will be far worse than the ideal due to the existence of manufacturing tolerances. In order to ensure that the magnet design can obtain a magnetic field with higher homogeneity after construction, an effective shimming method is required to apply.
At present, many different shimming methods have been proposed to counteract the inhomogeneity after construction [33–37]. They can be characterized into active shimming and passive shimming. In active shimming, multiple sets of shim coils connected with complex and expensive current source are used to generate spatial magnetic field. However, it will greatly increase the cost and complexity of portable time domain NMR devices. Thus the passive shimming is the preferred method that can be applied to our miniature magnet.
The primary difficulty in implementing passive shimming lies in accurately predicting the sizes and locations of ferromagnetic pieces required to shim the inhomogeneity. An effective method to solve this problem is to use an optimization algorithm based on Linear Programming formulation with multiple objectives, which can be used to minimize both the inhomogeneity and the total thickness of the shims. The basic principle of this algorithm is to use the number of unit shims as the target objectives and the ideal magnetic field homogeneity as the constraint to establish a linear programming model, which can be described as follows [38]:
Here, i represents the shimming position, j represents the reference point, X i is the thickness of shim at location i, w i is the weighting factor, T is the allowable peak-to-peak field tolerance, B 0j is the initial magnetic field value measured at point j, N is the total number of shimming positions, and M is the total number of reference points for the evaluation of the field homogeneity. B m is the mean value between the maximum and minimum field strengths in the target area. ΔB ij represents the change in magnitude of the field at point j caused by a piece of shim with unit thickness placed at location i. This value can be determined by actually locating the shim with unit thickness sequentially at a predetermined number of locations and then measuring the change of field value at all reference points for each shim location selected.
All existing structures used in the passive shimming are suitable for the Halbach magnets with large caliber. For a magnet with limited caliber, it is difficult to place pieces of shims to the magnet center using these structures. Therefore, it is necessary to design a new miniature shimming structure integrated with our portable magnet, which allow multiple pieces of ferromagnetic material to be placed in the magnet hole easily to bring the field homogeneity from its initial value to a given value. In order to accomplish this, it is necessary to have control over the thickness of the shim at a given position and have sufficient locations in both the axial and circumferential directions. In order to allow effective shimming by increasing the number of degrees of freedom in a limited space, the shimming structure consists of two pieces of arc drawers which match the curvature of the magnet hole and are able to move along the length of the magnet (Fig. 6). There are a total of 180 shim holes which are characterized into 18 rows. The relative distance between the shim holes is 2 mm. The shims used in this magnet are made of SmCo18 (B r = 0.87 T, H cb = 645 kA/m), and the size is ∅1.5 mm × 0.2 mm. The magnetization direction is along the axial of the shims which is consistent with the direction of the main magnetic field after being placed into the shim holes.
All casings made of 6061 aluminum and magnetic blocks were fabricated in Hangzhou Permanent Magnet Group. According to the performance test, the actual remanent field of SmCo32 blocks was 1.101 T and N52 strips was 1.442 T. The maximum magnetization angle error of SmCo32 blocks was 1.87° and the minimum was 0.04°. The final prototype including all magnetic components weighted a total of 2.02 kg.
Although the temperature coefficient of magnet blocks made of samarium cobalt is much smaller than that of the neodymium magnets, the samarium cobalt magnets are more brittle. Therefore, in order to avoid destroying the magnetic blocks when assembling because the large attractive and repulsive force, a specific method was applied to assemble these magnet blocks. Figure 7 summarizes the steps involved in the assembly of Halbach array. The first step was to fix all aluminum “dummy” blocks that have the same shape and size as the magnetic blocks (see Fig. 7a). Adjusted the position of each “dummy” block by controlling the tightness of the screws in the casing to ensure the coaxiality of the magnetic array. The next step was to install all rectangular magnetic blocks. Figure 7b shows that all rectangular magnetic blocks are fixed at their correct positions as the existence of trapezoidal “dummy” blocks constrain the lateral movement of magnetic blocks. The following step was to replace remaining nonmagnetic blocks one by one by trapezoidal magnetic blocks until all magnetic blocks were assembled (Fig. 7d). After assembling all SmCo32 magnetic blocks, Nd52 magnetic strips were glued to the grooves of both covers (Fig. 7e). Finally, the top and bottom covers were fitted and screwed with the shell (Fig. 7f).

Process for assembling the Halbach magnet array inside the aluminum alloy shell (outer diameter is 64 mm and the total height is 138 mm). (a) Aluminum “dummy” blocks were installed to make preparations for real magnetic blocks. (b) All rectangular magnetic blocks were inserted to replace the corresponding “dummy” blocks firstly. (c) Partial trapezoidal magnet blocks were installed diagonally. (d) All magnetic blocks were fixed in their final positions before the top and bottom covers were fitted in place. (e) Magnetic strips made of Nd52 were glued to the grooves of the cover. (f) The actual magnet after fitting the top and bottom covers.
Performance of the magnet arrays
For magnets used in the NMR devices, field strength can be expressed as a Harmonic function of spatial position because there is no electrical and magnetical charge in the target area. According to the extremum theorem of the Harmonic function, the maximum and minimum field values must be on the surface of the target area. In order to measure a detailed field distribution information of the magnet after construction, the target surface was divided into 210 reference points (Fig. 9a). There are 176 points on the curved surface and 34 points on top and bottom. The actual field strength of each reference point was measured by a gaussmeter (F.W. Bell, model 8030, STF81-0404-10-T) in a three dimensional motion platform with a resolution of 0.01 mm (Fig. 8). After getting measured values of all reference points, the interpolation method was used to calculate the field strength of other non-reference points. According to the map of actual measured field distribution (Fig. 9b), the average field strength is 999.25 mT. And the inhomogeneity is 4500 ppm, which is 75 times worse than simulated homogeneity.

Experimental platform for detecting field distribution using hall sensor.

Establishment of the actual magnetic field in the target area. (a) Reference points of the target area. (b) The actual field distribution measured by hall sensor.
In order to improve the field homogeneity, the shimming structure and method described in Section 2.3 was applied. The first step was to generate sensitivity coefficient matrix, which represented the magnetic field effect of shim with unit thickness in different shimming positions. The sensitivity coefficient matrix can be obtained by measuring 180 times using a hall sensor (Fig. 10a). According to the matrix, the effective shimming positions are located on the five rows in the middle of the structure (Fig. 10b). And the shims in other positions have little effect on the target area. Then, the shims were placed in their positions according to the result of linear programming method. Figure 10c shows the central inhomogeneity was reduced to 298.8 ppm after adding shims.

Performance of passive shimming. (a) 3D map of sensitive coefficient matrix. (b) The magnetic field effect of key positions of shims. (c) The actual field distribution after adding permanent magnet shims manually.
The miniature Halbach magnet can be used for certain sample geometries in combination with exchangeable RF coils of different diameters ranging from 1 to 5 mm. The solenoid RF coil was wound around a 3.5 mm outer diameter ceramic structure made of zirconia (17 turns of 100 μm diameter insulated copper wire, 3.4 mm of length). The coil had an inductance of 2.13 μH measured by Agilent E5061B network analyzer. In series with the coil was connected a Murata trimmer capacitor (Model TZB4Z100AA10R00: 3–10 pF), which was used to tune the circuit to the 50 Ω at the operating frequency of 42.8 MHz. The experiments were driven by a fully digital LapNMR spectrometer. An external power amplifier Tomco BT00500-AlphaS was used to generate a power of about 25 watts at the operating frequency. It allowed us to set the dead time 12 μs long, and the 90° pulse 2.4 μs long. The probe was fixed at the center of the magnet by appropriate nonmagnetic structure.
To measure the improvements of the magnetic field homogeneity after passive shimming and after adding magnet strips, the full width at half maximum (FWHM) of 0.1% copper sulfate doped water sample contained in a 3 mm outer diameter standard NMR tube had been tested with 8 scans. Here, the homogeneity over the whole sample volume can be expressed by the FWHM, because the inhomogeneity will broaden the width of the spectral line directly [12,13]. As is shown in Fig. 11, after measuring the signal of the free induction decay of the copper sulfate doped water sample, a FWHM of 20996 Hz has been measured after construction, corresponding to a field homogeneity of 493 ppm (Fig. 11a). Then the homogeneity can be improved to a value of 23 ppm after passive shimming (Fig. 11b). Eventually, the homogeneity can be further improved to 16 ppm (Fig. 11c) after adding N52 magnet strips.

Fourier transform of the free induction decay of copper sulfate doped water sample in a standard NMR tube with 3 mm outer diameter. (a) The FWHM is 20996 Hz measured before passive shimming process. (b) After adding small shims with 977 Hz line width. (c) The FWHM can reach 671 Hz after adding magnet strips.
In this paper, a miniature Halbach magnet with low inhomogeneity has been designed for portable NMR devices. The magnet was composed of a central Halbach magnet made of SmCo32 plus twenty magnetic strips made of N52 placed at the ends of the central magnet. The magnet weighs only 2 kg which is easy to be held on hand. The magnetic field strength can reach up to 1 T which is correspond with the ideal simulation. In the proposed approach, a new shimming structure is used to counteract the additional inhomogeneity resulting from manufacturing tolerances and positioning errors. The thickness and position of the individual permanent magnets are obtained from the linear programming method and real-time magnetic field distribution. After effective passive shimming and adding magnet strips, a measured FWHM of 16 ppm can be obtained from a prototype which is adequate to get a high quality signal by reducing the error between
In conclusion, there are three advantages about this magnet. Firstly, the relative ease of construction and low cost of the magnet array. Secondly, the portability of the magnet, which does not require a lot of space. In addition, the final field performance is adequate enough for relaxation time measurements of portable time domain NMR. As our next work to further improve the achievable homogeneity, a more useful shimming structure with additional degrees of freedom of shim positions will be investigated to achieve a higher signal quality.
Footnotes
Acknowledgements
This work was supported by National Key Scientific Instrument and Equipment Development Project of China (Grant No. 51627808) and National Natural Science Foundation of China (Grant No. 51605098).
