A Novel Optimization Method for Halbach Magnet

Portable nuclear magnetic resonance (NMR) instruments are widely used in many elds. However, the large volume, low uniformity and end effect limits the application of portable NMR instruments. In order to improve the uniformity and compensate the end effect, a Halbach structure with 9-layer permanent magnet is proposed, which is optimized by axially adjusting the magnet height based on the Halbach array principle and Quality factor (Q) is introduced to represent the magnetic eld uniformity at both ends of the central cylinder region. Each layer consists of 16 permanent magnets with trapezoidal cross section and the total volume is Φ240 × 141.8 mm. Through simulation, it is found that the nal magnetic ux density is 1.09 T and the uniformity is 418 ppm in the central region (Φ20 × 20 mm) of the optimized structure. The proposed structure has the advantages of small size, compactness in structure and homogeneity, which is very suitable for portable NMR systems.


Introduction
Nuclear magnetic resonance (NMR) technology has been widely used in many elds, such as material science 1, 2 , structural biology 3 , medicine 4, 5 and so on. Magnetic resonance equipment also has the problems of low magnetic eld intensity, poor uniformity and low utilization rate of magnetic materials. In order to increase the intensity of the magnetic eld required by the NMR equipment, more magnetic materials have to be used in the equipment. This will enlarge the volume and increase the weight of the equipment, which is contradictory to the concept of portable. Since the emergence of new materials such as NdFeB and SmCo 6 , it is possible for NMR equipment to be portable.
There are four main structures of portable NMR equipment: single-sided 7,8 , C-type 9 , H-type 10 and Halbach array 11,12 , in which the Harbach array is use widely due to the characteristics of miniaturization 13,14 . The magnetization directions in the magnetic blocks are different, which makes the magnetic eld lines converge on one side and weaken on the other side 15,16 . The magnetic eld intensity can be greater than the remanence of permanent magnetic materials and also there is no iron yoke in the structure 17,18 .
Moresi and Magin designed a portable Halbach magnet structure. The magnetic eld uniformity is improved by using two high permeability iron plates, but the weight of the whole structure is greatly increased by using iron plates 19 . In 2004, Raich and Blümler proposed a new structure called NMR Mandhala (Magnet Arrangements for Novel Discrete Halbach Layout) by combining theoretical derivation and simulation optimization. The rectangular, circular and polygonal magnets was also suitable to the structure. The proposed NMR Mandhala structure was with mass of 11.4 kg, homogeneity of 700 ppm and center frequency of 12.8 MHz 20 , which produces good uniform using magnetic blocks of the same shape and remanence 21 . However, the volume of the device still greatly limited its application in portable NMR instruments. In 2007, Blümich proposed a method to improve magnetic eld homogeneity. They moved the four magnets on the Halbach magnetic ring to 5 mm along its magnetization direction, which increased the uniformity by 10 times. The magnetic eld intensity was 0.22T and the homogeneity was 0.05T/m 22 . However, this method also reduces the magnetic eld intensity. and closed with the minimum force at a certain angle. The weight of this structure was 3.1 kg, and the magnetic eld intensity was 0.57 T. The spherical region with a diameter of 5 mm, in which the uniformity is better than 200 ppm. However, the working area of this structure is too small, which is only suitable for measuring objects such as plants 25 . Later, Menzel and Chen et al. developed a formula, which is used to calculate the magnetic eld intensity of equidistant stack ring 26, 27 .
In order to design a portable Halbach permanent magnet with good uniformity and effective compensation for end effect. We present an optimization method which can axial adjust the height of the magnet to compensate for the end effect.
The main contribution in this paper are as follows: 1) Only a small amount of magnetic material needs to be added to the original structure to effectively compensate for the end effect and improve uniformity. 2) Quality factor (Q) is introduced to represent magnetic eld performance. In ensuring the magnetic eld density and uniformity at the same time, through Q as far as possible to play the performance of magnetic materials and reduce volume. 3) The structure is small in size and compact, which is very suitable for portable NMR systems.
The remainder of this paper is organized as follows: First, we explain the principle of Halbach in Section "Halbach array principle". Then, we propose the parameters of the original structure in section "Design". Finally, in section "Simulation method", an novel optimization method with axial adjustment the height of the magnetic block is proposed, which is compared with another optimization method.

Halbach Array Principle
There are many magnetic blocks in Halbach array which are arranged in order. The magnetic blocks are with different magnetization directions, so the magnetic eld lines converges on one side and weakens on the other side 15,16 . As shown in Fig. 1a, theoretical model can be obtained by continuous change of magnetization direction according to speci c rules. In ideal case, a transverse magnetic eld can be generated in the central region of the structure and the magnetic elds at each point are equal. Its magnetic eld intensity 16 B 0 is given by Eq. (1): Where, B r is the remanence of magnetic material, r out and r in are the outer radius and inner radius of the Halbach array, respectively.
Due to the actual machining problems and the magnetization direction of the magnetic block, it is di cult to have a continuously changing magnetization direction in the magnetic ring. Therefore, in practice, several magnetic blocks are spliced together to construct a discrete structure to approximately replace the theoretical model 28 . As shown in Fig. 1b, the magnetization direction angle β of magnetic block in discrete structure varies twice as much as the rotation angle θ. The magnetization angle can be given by Eq. (2): where, i = 0, 1,. . ., M-1, θ = 2π/M, and M = 2 P , P is an integer greater than 2. M is the number of permanent magnet blocks contained in a magnetic ring. In Fig. 1 it is found that the magnetic block with trapezoidal cross section is closer to the theoretical model, and the trapezoidal cross section is convenient for machining. Therefore, the magnetic block with trapezoidal cross section is selected to construct the Halbach array in this paper. The partial structure of the magnetic ring is shown in Fig. 2, and the height of the trapezoidal section d = r out -r in , the width of the baseline a and the topline b are a = r in tan(θ/2) and b = r out tan(θ/2), respectively 30 .
If your manuscript reports research with non-human animals, the Methods section starts with a statement con rming that the research complies with all relevant ethical regulations; naming the board and institution that approved the study protocol; and con rming that the ARRIVE guidelines were used to report the research.

Design
The purpose of this study is to generate magnetic eld intensity greater than 1 T in the central region to satisfy the detection requirements. The structural height is required to be 150 mm, and the uniformity in the central region (Φ20 × 20 mm) is required to be 500 ppm.
A permanent magnet structure with r in = 30 mm and r out = 120 mm was designed in previous work. The magnet material was NdFeB-48M, with coercivity H c = 1027 kA/m and remanence B r = 1.38 T. In the research work of Soltner and Blisümler 24 , it is known that single-layer Halbach magnet structure cannot construct a relatively uniform magnetic eld in the central region due to its limited height. Therefore, in order to improve the uniformity, 9-layers of Halbach magnetic rings are considered. Each layer consists of 16 trapezoidal magnetic blocks. The height of the magnetic ring is 10 mm and the interval between two magnetic rings is 6 mm. The nal structure has a size of Φ240 × 138 mm. The permanent magnet structure was constructed in Ansys Workbench and Ansys Maxwell. The simulation results are that the maximum magnetic eld intensity is 1.027 T and the homogeneity is 8612 ppm.
When the magnet is short in height, which will cause the end effect, resulting in poor uniformity. The magnetic eld intensity at both ends of the central region is small, as shown in Fig. 3a. The magnetic eld intensity in the central part of the region is large, as shown in Fig. 3b. The key to compensating for the end effect is to improve the uniformity at both ends of the region. The uniformity of the two ends of the central region is marked H 1 , and H 1 is given by Eq.

Simulation Method
In order to compensate the end effect, an optimization method is proposed in section "Simulation method". The optimization method we propose is divided into two parts: the part 1 is to raise the height of the outer layer and the part 2 is to reduce the height of the inner layer.
Before optimizing, we named the magnetic rings and the magnetic blocks. As shown in Fig. 4a, the 1-3 layers and the 7-9 layers are named the outer layer, and the 4-6 layers are named the inner layer. Then we name the rst and ninth layers as Level 1. Accordingly, we named the 2nd and 8th layers as Level 2, and so on until Level 5. Each level is symmetrical about Level 5. Each layer of magnetic ring has 16 magnetic blocks. There are 8-pairs of magnetic blocks with the same magnetization direction. These 8-pairs of magnetic blocks are shown in Fig. 4b. During optimization, the height of each magnetic block should be adjusted axially, and the uniformity change of the central cylinder area (Φ20 × 20 mm) should be analyzed. Finally adjust the height of magnetic block according to a quality factor (Q), and Q given by Eq. (5): Where, H 1 represents the uniformity at both ends of the region. H 1-original represents the uniformity of both ends of the region before this level of optimization. The molecule represents the ability to improve the magnetic eld uniformity at both ends after the height of the magnetic block changing. H T represents the sum of the height of these magnets. Q represents the ability of unit magnetic block to improve the uniformity at both ends of the region. In ensuring the magnetic eld density and uniformity at the same time, through Q as far as possible to play the performance of magnetic materials and reduce volume.

Simulation Results
For the optimization of the part 1, we axially adjust the height of Level 1. Each time the height of a pair of magnets is adjusted from 10.1 mm to 13.9 mm, and the interval is 0.1 mm. As shown in Table 1, the second column represents the best uniformity of the magnetic block at this height. The speci c value of uniformity is represented by the third column. The fourth column represents the Q of the magnetic block at this height, where the Q is maximum. The last column represents the sum of quality factors for the period from 10.1 mm to 13.9 mm in height, which is called Q Total .
As the rst group of experiments, we selected the largest pair 5 and pair 1 in Q Total , and adjusted their height from 10.1 mm to 14 mm at the same time. The remaining magnetic block height is set to 10 mm. As the second group of experiments, we selected pair 5, pair 1 and pair 8, which are the top three pairs of magnetic blocks in Q Total , and adjusted their heights from 10.1 mm to 14 mm at the same time. The remaining magnetic block height is set to 10 mm. Accordingly, there are seven groups of experiments. Seven groups of experiments are selected as shown in Table 2.
From the fth column of Table 2, Q is gradually decreasing. Only the Q of the fourth group of experiments is increased compared with that of the previous group. For the two ends of the structure, increasing the amount of magnetic materials at both ends of the magnetic ring will improve the uniformity of the central region. So we want to add as much the amount of magnetic material as possible to both ends of the magnetic ring. And through the quality factor as far as possible to play the performance of magnetic materials and reduce volume. So we choose the magnetic block height represented by the fourth group of experiments as the magnetic block height of Level 1. The height of the ve pairs of magnets is determined to be 13.8 mm. The remaining magnetic blocks height are set to 10 mm. The optimized results are that the H 1 of Level 1 is 2730 ppm and the uniformity of this structure is 6711 ppm.
This optimization method is used to Level 2 to Level 5 to improve uniformity. The adjustment is shown in Table 3. It can be seen from Table 3 that the magnetic eld uniformity is effectively improved by axial adjustment.
It can be found from Figs. 5a,b that the original structure and the optimized structure have little difference in the magnetic eld intensity, but the uniformity of the original structure is poor. The magnetic eld distribution of the optimized structure is shown in Figs. 6a,b. The optimized structure uses 13.38% more magnetic materials than the original structure, and the uniformity is improved by 95.17%. The maximum magnetic eld intensity is 1.09 T and the homogeneity is 418 ppm. The whole structure has a size of Φ240 × 141.8 mm.
In order to show the correctness of the optimization method, we set up a compare group. The optimization process of the compare group is to adjust the magnetic block height of each magnetic ring. All magnetic blocks in magnetic ring are of the same height. The height of the magnetic ring was adjusted from 10.1 mm to 14 mm with an interval of 0.1 mm. The results are shown in Table 4. The compare group used more 18.89% magnetic materials than the original structure, and the uniformity was increased by 95.84%. The compare group used more magnetic materials than optimized structure. But their magnetic eld intensity and uniformity have little difference. Through simulation, it is found that if the magnetic block in the magnetic ring is at the same height, the performance of magnetic materials cannot be maximized. The proposed optimization method can ensure the magnetic eld density and uniformity at the same time, as far as possible to play the performance of magnetic materials.

Discussion
We present an optimization method which can axial adjust the height of the magnet to compensate for the end effect. Only a small amount of magnetic material needs to be added to the original structure to effectively compensate for the end effect and improve uniformity. In ensuring the uniformity at the same time, through the quality factor (Q) as far as possible to play the performance of magnetic materials and reduce volume. The optimized structure uses 13.38% more magnetic materials than the original structure, and the uniformity is improved by 95.17%. The optimized permanent magnet structure generated a 1.09 T magnetic eld intensity and the uniformity is 418 ppm. Moreover, this method can be combined with genetic algorithm to more accurately adjust the height of the magnetic block and improve uniformity.
Then we will build the halbach multilayer permanent magnet structure based on the optimization model, and further test its performance.

Data availability
All data generated or analyzed during this study are included in this published article.          The magnetic eld intensity of the optimization results changing along the coordinate axis directions.