Conceptual design of a compact high gradient quadrupole magnet of varying strength using permanent magnets

A concept is presented to design magnets using cylindrical-shaped permanent-magnet blocks, where various types of magnetic fields can be produced by either rotating or varying the size of the magnetic blocks within a given mechanical structure. A general method is introduced to calculate the 3D magnetic field produced by a set of permanent magnets. An analytical expression of the 2D field and the condition to generate various magnetic fields like dipole, quadrupole, and sextupole are derived. Using the 2D result as a starting point, a computer code is developed to get the optimum orientation of the magnets to obtain the user-specific target field profile over a given volume in 3D. Designs of two quadrupole magnets are presented, one using 12 and the other using 24 permanent-magnet blocks. Variation of the quadrupole strength is achieved using tuning coils of a suitable current density and specially designed end tubes. A new concept is introduced to reduce the integrated quadrupole field strength by inserting two hollow cylindrical tubes made of iron, one at each end. This will not affect the field gradient at the center but reduce the integrated field strength by shielding the magnetic field near the ends where the tubes are inserted. The advantages of this scheme are that it is easy to implement, the magnetic axis will not shift, and it will prevent interference with nearby devices. Around 40% integrated field variation is achieved using this method in the present example. To get a realistic estimation of the field quality, a complete 3D model using a nonlinear B - H curve is also studied using a finite-element-based computer code. An example to generate around an 80 T/m quadrupole field gradient is also presented. DOI:


I. INTRODUCTION
The future particle accelerator projects like Compact Linear Collider (CLIC), International Linear Collider, and Future Circular Collider [1][2][3] need large numbers of precision magnets. To meet this, efforts are on to build compact, low-cost, and efficient magnets to minimize the cost implication of such megaprojects. Over the years, progress in the field of permanent-magnet (PM) materials like Sm 2 Co 17 and Nd 2 Fe 14 B have been quite impressive. A combination of declining costs and improved material quality have made permanent magnets competitive with conventional and superconducting magnets in many applications. High-field magnets made from these materials have found applications in high gradient adjustable quadrupoles, injection lines, correctors, and damping ring magnets and undulators. Quadrupole, dipole, and combined function magnets have been successfully installed in the Fermilab main injector tunnel [4,5].
Several storage-ring-based light sources, which are currently being upgraded for an increase in brilliance, will require strong quadrupoles with limited field tuning [6][7][8].
The design of multipole magnets using PM material was already reported in the literature, where special emphasis was given on quadrupole (QP) because of their widespread use [9][10][11]. Such PM-based quadrupoles can generate high-field gradients and have been under scrutiny mainly in two areas: the main accelerator focusing magnet in linear colliders and final-focus magnets in both circular and linear accelerators.
Tunable quadrupoles using PMs have been built using rotating PM rods or small movable shunts or using a tuning rod concept [12,13]. The rotating QP consists of two rotating inner segments and two fixed outer segments. The rotating magnets provide the adjustment, while the fixed QP provides the bulk of the focusing field. The rotating segments move in opposite directions to adjust the integrated quadrupole strength [14]. A hybrid QP magnet design using a Halbach-type PM along with a printed circuit has also been reported [15]. The degree of tunability of either of these designs is around 20%. An approach to create strong focusing systems using a highfield, small-bore permanent-magnet quadrupole (PMQ) was reported. A final-focus system uses three PMQs, each composed of 16 neodymium iron boride sectors in a Halbach geometry. As the magnets are of a fixed field strength, the focusing system is tuned by adjusting the position of the three PMQs along the beam line axis, in analogy to familiar camera optics [16]. The PMQ for the drive beam decelerator was developed having a strength of tuning range of 3.5-43 T/m [17]. A summary of the work on both fixed and variable strength PMs suitable for use in and around linacs can be found in Ref. [18].
The design of the high gradient quadrupole magnets for the European Synchrotron Radiation Facility was presented using conventional electromagnets, where the gradient of 90 T/m was achieved for a 12.5 mm bore radius [19]. A compact QP with a field tunability of 20% for the cellcoupled drift tube linac for Linac 4 at CERN was reported in Ref. [13]. The typical length, bore radius, and integrated QP field strength were 140 mm, 22.5 mm, and 1.6 T, respectively. In all the above cases, the quadrupoles were built using both an iron pole tip and PM blocks, and the field variations were obtained by mechanically displacing or rotating the magnetic blocks.
There is a need of truly cost-effective and easy-to-fabricate magnets, which will not generate much heat load for future particle accelerators. Considering all such facts, I designed the magnets using cylindrical-shaped PM blocks, where various types of magnetic fields can be generated by either rotating or varying the size of the PM blocks within a given mechanical structure. In this report, I introduce a general method to calculate the 3D magnetic field produced by a set of permanent magnets, which is easy to compute using a PC. Cylindrical-shaped PM blocks are chosen so that the variation of the direction of magnetization can be adjusted by mechanically rotating the blocks during the fabrication of the magnet. This will enable us to use the magnets having a wider variation in the direction of magnetization. Such cylindricalshaped PMs are available from several vendors in different sizes. I have considered the following models to demonstrate the design of compact high gradient quadrupole magnets with limited tunability.
(i) The generation of around a 25 T/m field gradient in a bore radius of 23 mm using 12 cylindrical-shaped PMs of 7 mm radius each. I have considered a 1.14 T remanent magnetic field for this calculation. In one mechanical structure, cylindrical-shaped PMs of different radius like 7, 6, and 5 mm can be inserted to generate PMQs of different strength like 25, 18.2, and 12.5 T/m, respectively. It will help in large-scale magnet manufacturing. On top of this, a 2-2.8 T/m gradient may be generated for tunability using the proper shaped current carrying conductors with a suitable current density. Using a bipolar power supply, a 2.8 T/m quadrupole gradient can be added or subtracted from the main field strength. In this case, current-carrying conductors are situated outside the magnet assembly, so air cooling with a proper heat sink is sufficient to manage the heat load. The gradient change can be faster here, as there is no mechanical movement, and the change of magnet axis will also be small.
(ii) I have also introduced a new concept to reduce the integrated quadrupole field strength R ∞ −∞ g:dl by inserting two cylindrical iron tubes, one near each end. This will not affect the field gradient at the center but will shield the magnetic field completely near the ends, where the tubes are inserted. The effective length of the PMQ is very close to the physical length, and this means the extent of the fringe field is small. Initially, the end iron tubes are placed outside the PMQ. Under this condition, the PMQ will produce the maximum R ∞ −∞ g:dl. The end tube can be inserted inside the PMQ with the help of a motor. As the end tube comes closer to the PMQ, it will reduce the effective length of the magnet by shielding the magnetic field inside the tube area and thereby reducing the integrated field strength. Therefore, by varying the current in the correction coils and the position of the end tubes, the integrated field strength can be tuned to a considerable amount. The movement of the end tube is simpler compared to the movement of the magnet blocks or the magnet poles, reported earlier [12,13]. The advantages of this scheme are that it is easy to implement, the magnetic axis will not shift, and it will prevent interference with nearby devices by restricting the fringe field.
(iii) I also present an example of producing an 11 T/m quadrupole gradient using 24 PM blocks. PM blocks, each having 3.4 mm radius, when symmetrically placed on the circumference of a cylindrical enclosure of 3 cm radius will generate an 11.2 T/m field gradient. In this case, around 0.1% gradient variation, which is defined as a good field zone, is extended up to 67% of the bore radius.
(iv) It is possible to generate around an 80 T/m field gradient if the bore radius is reduced to 11.5 mm. The high gradient is produced by using two layers of PMs. The inner layer contains a set of 12 magnets, each having 3.5 mm radius, and the outer layer contains a set of 12 magnets, each having 6 mm radius.

II. CALCULATIONS
A. Calculation of three-dimensional (3D) magnetic field produced by permanent magnets In this section, I shall present the analytical expression of the magnetic field produced by cylindrical-shaped PMs of a finite length. The magnetization of the material M s is expressed in A/m and remanence B r in T. These are related by B r ¼ μ 0 M s . I have used the charge model to find the field expression. The magnet is converted to an equivalent charge distribution, and the field expression is evaluated by treating the charge distribution as a field source. In the charge-free region, the magnetostatic field equations can be expressed as ∇ × H ¼ 0 and ∇:B ¼ 0. Under such conditions, a field can be obtained from the magnetic scalar potential Φ m using the relation H ¼ −∇Φ m . Using the above condition along with the relation B ¼ μ 0 ðH þ MÞ, The solution of the equation can be written in terms of the free space Green's function, and the following expression is obtained: where r and r / are the observation and source points, respectively, ∇ / operates on the primed coordinates, and the integration is over the volume for which the magnetization exists. For uniformly magnetized materials, M is confined to a volume and falls abruptly to zero outside the volume. Therefore, where s is the surface that bounds v andn is the outward unit normal to s. In the present case, the volume charge density is zero, and the surface charge density is Therefore, the magnetic field can be expressed as where ∇ acts on unprimed variables, a is the radius of the magnet, and the extent of the magnet along z is from z 1 to z 2 . After simplification, the radial component of the magnetic field is given by Similarly, the azimuthal component of the magnetic field is expressed by B ϕ ðr; ϕ; zÞ The axial magnetic field component is given by Now a numerical integration should be done to get the 3D field. However, an analytical solution of such a problem exists in 2D. Therefore, first the 2D field is evaluated for a cylindrical magnet, and then the analytical conditions required to obtain the desired field are found out using several such magnets. This solution will be the starting point for obtaining the global solution for optimizing the 3D field, which in turn will provide the size and orientation of the magnets.

B. Calculation of two-dimensional (2D) magnetic fields due to permanent magnets
In this section, the 2D magnetic field produced by permanent magnets is calculated. If the extent of the magnet in the z direction is very large as compared to the other directions and the magnetization vector is a function of x and y, then it may be considered as 2D. For a homogeneously magnetized magnet, the material can be treated as a vacuum with an imprinted current density, where H c and B r are the coercivity and remanence of the material, respectively. In such a case, H c and B r are constant within the material, and ∇ × H c and ∇:B r are zero everywhere except at the surface, where current sheets are present. The complex conjugate of the magnet field produced at z 0 by a magnet located at z can be expressed by Carrying out an integration over x first and then integrating by parts, The area of integration is considered to be a thin strip of vacuum outside the magnet so that the line integral over y vanishes. Applying the same technique, I 2 is evaluated. On simplification, It is clear from this expression that if the direction of magnetization of a magnet rotates by an angle β with respect to the magnetization of a reference magnet, then the magnetic field produced by the magnet will be rotated by an angle −β compared to the field produced by the reference magnet without a change in amplitude. This means the field produced by the magnet can be obtained by replacing B r to B r e iβ in the above Eq. (12). In this way, the resultant field produced by several identical magnets having different directions of magnetization can be calculated [9,20]. Now, I calculate the resultant magnetic field produced by P numbers of geometrically identical magnets placed symmetrically on the circumference of a circle of radius r c . So, the angular positions of all the magnets are where N varies from 1 to P: Further simplifying the above field expression by using the identity Assume that the reference magnet placed at ðr c ; 0Þ and the direction of magnetization is along the X axis. Another geometrically identical magnet placed on the circumference of the circle at ðr c ; αÞ and its magnetization makes an angle β with the X axis as shown in Fig. 1.
The complex conjugate of the magnetic field produced at z 0 by the magnet can be expressed as where a is the radius of each magnet. So, for P numbers of geometrically identical magnets, the resultant magnetic field will be Therefore, the following conditions must be satisfied to produce a uniform magnetic field in the X direction: Similarly, the condition to generate a uniform field in the Y direction is The condition for producing a QP field ð ∂B y ∂x Þ is The condition for producing a sextupole field is I shall use these conditions to produce different field patterns, like DP, QP, etc., by rotating the direction of magnetization as given in Eqs. (17)- (20). Once the number of magnets, P, is fixed, then the positions of the magnets,α N ¼ ðN − 1Þ 2π P , are fixed and the orientation of the magnetization, β N , will determine the field pattern.
FIG. 1. Position of the reference magnet at ðr c ; 0Þ with magnetization along the X axis and another magnet placed at an arbitrary angle at ðr c ; αÞ whose magnetization makes an angle β with the X axis.

A. 2D simulation results using 12 PMs
To test the theoretical model, I have calculated the field produced by 12 identical cylindrical permanent magnets placed around the circumference of a cylindrically shaped aperture of 3 cm radius, leading to an overall magnet radius of 6 cm.
It is possible to use PMs of different radii of 5, 6, and 7 mm in the same mechanical structure with a proper arrangement as shown in Fig. 2. If the positions of all 12 PMs and their orientations are made as per the prediction of Eq. (19), then a central field gradient of 12.5-25 T/m can be produced as obtained from the 2D calculation. Figure 3 shows that the maximum 25 T/m field gradient can be produced from a 2.3 cm bore radius magnet with a good field zone of 1.2 cm radius, when 12 PMs each having a radius of 7 mm are used. The field gradient is reduced to 18.2 and 12.5 T/m when the radii of each magnet are reduced to 6 and 5 mm, respectively. A remanent magnetic field of 1.14 T is considered for these calculations.
It is to be mentioned here that a given mechanical structure having 12 PM blocks each of radius 7 mm can generate a dipole field of 0.39 T, a QP gradient of 25 T/m, and a sextupole gradient of 1311 T/m 2 if the direction of magnetization satisfies Eq. (18), (19), and (20), respectively. Therefore, by placing a set of magnets with proper orientations in a given mechanical structure, a dipole, a quadrupole, or a sextupole can be generated. However, in this report, emphasis is given for making a quadrupole magnet of varying strength.
It is proposed to use AA 6061-T6 material for the structure. Three tapped grub screws for each magnet are provided. Antifriction pads of circular arc are sandwiched between the grub screw and the magnet to prevent the rotation of each magnet as shown in Fig. 2. Forces acting on magnet no. 1 are calculated using Maxwell stress. The forces in the X, Y, and Z directions are 264.4, −0.14, and −0.04 N, respectively. The torques around the 0, 0, 0 point are −19.9, −19.67, and −1.40 Nmm around the X, Y, and Z direction, respectively. Now, I shall analyze how to vary the quadrupole strength of the magnet. For this purpose, the model of 12 PMs, each having 6 mm radius, is chosen. An option for creating a gradient field of 2.79 T/m is provided using optimized gradient tuning coils having a current density of 10 A/mm 2 . A copper bar 2 cm thick is bent into a circular arc of 4 cm inner radius with an angular extent of 60°, which acts as a conductor for the gradient tuning coil. Four such conductors are symmetrically placed outside the magnet assembly. In the first quadrant, the arc of the conductor started at 30°and ends at −30°in the fourth quadrant as shown in Fig. 2. This arrangement of four conductors generates a gradient field in ∂B y ∂x , and its strength is 2.79 T/m when the current density in the conductor is set to 10 A/mm 2 . As it is a single turn coil, its inductance is less, which allows faster variation of the field gradient. These kinds of coils are widely used in superconducting magnets with a very high current density. Their positional accuracy and the 3D effect are well known and were reported earlier [21,22].
The magnetic field gradient produced by the excitation of the gradient tune coil in addition to the 12 PMs along with the multipole present is shown in Fig. 4. The field gradient can vary from 18.2 to 21 T/m by varying the current density in the tune coil from 0 to 10 A/mm 2 .
The directions of the current in the four tune coils are set using the sequence of −, þ, −, and þ along the Z direction, respectively. The current density can be varied from −10 to 10 A/mm 2 by using a bipolar power supply. This will vary the gradient from 15.4 to 21 T/m. This new and simple concept generates a field gradient, whose strength can be adjusted by varying the current in the coil. It will not generate much heat load. If a ð1 × 1Þ cm 2 copper conductor is used, then the maximum heat generated per coil will be 472 W for a current density of 10 A/mm 2 . However, for all practical purposes, a 3.58 A/mm 2 current density will be sufficient to meet the beam tuning requirement. Under this condition, a 1.0 T/m gradient will be obtained, and the heat generated per coil will be 61 W. Moreover, the values of all the other multipoles normalized with quadrupole are within 7 × 10 −5 . The excitation of the tuning coil is not generating any unwanted effect. However, a detailed 3D analysis needs to be done to get the realistic estimation of the multipole.

B. Estimation of magnetization and positional error
For a practical installation, the tolerance in positional accuracy and the error in magnetization angle orientation shall be within achievable limits. Magnetic errors are imperfections of PM characteristic like a fluctuation of the direction of magnetization from the ideal one. A positional error is linked to an assembly imperfection. It is assumed that these errors are random in nature. A tolerance study is carried out by randomly varying the direction of magnetization of each magnet.
A numerical analysis is presented here for various parameter variations. AE1.0°, respectively, from its ideal orientation. The simulation result predicts that the higher-order multipoles are within AE5 × 10 −4 for a AE0.50°random variation of the angle of magnetization of each magnet from the ideal one. These kind of results are acceptable for accelerator magnets.
A set of imperfect positions of 12 PMs are generated assuming the random error distributions, and the multipole content of the imperfect magnet is estimated from simulation results. Figure 6 shows the contribution of the random positional error of AE25, AE35, and AE50 μm, respectively, to the normalized multipole components.
Following these results, the mechanical tolerances of the positions of each magnet is set to AE35 μm, and the allowable random deviation of the angle of magnetization is set to AE0.50°. These are standard tolerances that are generally used for the building of accelerator magnets.
In our recent work, we have presented a highly scalable and versatile family of dipole magnet designs suitable for high-resolution magnetic resonance imaging, constructed entirely from cylindrical permanent-magnet rods. With optional correction rods that start out in a zero field configuration, we have shown that these designs can be tuned to compensate for manufacturing errors by adjusting the rotations of these rods [23].

C. 3D simulation results using 12 PMs
The dimensions and the number of PM blocks required to build a magnet depends on the specified requirement of the field gradient and the good field zone. An analytical expression of a 3D field produced by cylindrical-shaped PMs is given by Eqs. (5)- (7). Using the 2D result as a starting point, a computer code is developed to get the orientation of the magnet to obtain the user-specific field pattern and field uniformity over a given volume in 3D. The algorithm provides a globally optimal arrangement of magnets for a given field pattern and uniformity [23,24]. The analytical expression of the field produced by the PM is quite accurate. Therefore, an analytical study based on a 2D model is found to provide reasonably accurate values of these parameters. The optimal direction of magnetization obtained for the 3D case is slightly different from the 2D result. However, in the 3D optimized case, an additional horizontal field is produced and a better gradient uniformity is obtained at the cost of a reduced gradient value. As the additional horizontal field is undesirable for accelerator application, 2D analytical results are used for further 3D analysis. In the case of the analytical field expression, a fixed remanent field is used rather than a nonlinear B-H curve. Therefore, to get a realistic estimation of field quality, a complete 3D model using a nonlinear B-H curve is studied using a finite-element-based computer code, OPERA [25].
The general field expression of the accelerator magnet can be expressed by where A n and B n are the skew and normal components, respectively, for 2n pole magnets and R ref is the reference radius of measurement. The vertical field in the good field zone of the magnet over a circle of radius r can be expressed as QPM field strength 2B 2 r (¼gr, where g is the QPM gradient) was found out by measuring the field on a circle of radius r and by performing FFT. The field strength is computed from the center of the QPM to 20 cm away on either side from the center of the magnets, where the fringe field is negligible. The length of the magnet is 20 cm, and its span is from −10 to 10 cm along the Z axis.  Figure 7 shows the arrangement of the 12 PMs whose direction of magnetization are as per the expression given in Eq. (19). The field (in Gauss) pattern within the radius of 1.4 cm is also plotted.
The variation of the gradient along the length of the magnet is shown in Fig. 8. The effective length of the magnet, L effective ¼ R g:dz g 0 ¼ 20.02 cm, is calculated using the data. The length of the magnet is 20 cm. Therefore, the effective length is almost equal to the length of the magnet. A default B-H curve with a maximum remanent field of 1 T is used for the analysis. Therefore, the gradient is slightly lower than that obtained from the 2D calculation.

D. Vary the integrated field strength using end tubes
In this section, a new concept will be studied to reduce the integrated quadrupole field strength, R ∞ −∞ g:dl, by inserting two cylindrical iron tubes, one near each end. This will not affect the field gradient at the center but completely shield the magnetic field near the end, where the tube is inserted. The effective length of the PMQ is very close to the physical length, which means that the extent of the fringe field is small. Initially, the end iron tube will be placed outside the PMQ. In this condition, the PMQ will produce the maximum R ∞ −∞ g:dl. The end tube can be inserted inside the QPM with the help of a motor. As the end tube comes closer to the PMQ, it will reduce the effective length of the magnet by shielding the magnetic field inside the tube area and thereby reduce the integrated field strength. Figure 9 shows the two movable end tubes, one at each end.
High-precision motorized actuators of 25 mm travel range are readily available. A positional accuracy of 10 μm can be achieved by a stepper motor coupled to a precision ground lead screw-nut mechanism. The spindle of the actuator, which moves forward and backward when the motor rotates, is made nonrotating to bring in extra precision. The end tube can be fixed with an aluminum arm and can be positioned with AE20 μm accuracy with the help of a motorized actuator. Forces acting on the iron cylinder are −0.64, 1.13, and 88.02 N in the X, Y, and Z direction, respectively. High-precision motorized actuators can handle such force. A schematic diagram of the magnet assembly along with the movement mechanism of the end tube is shown in Fig. 10.
To verify the prediction, a 2D simulation has been performed using the finite element code PANDIRA [26]. A model of the quadrupole is built using 12 PM blocks and added tuning coils outside the magnet assembly. The iron tube was then placed at the center of the magnet. Figure 11 shows the field lines obtained from this analysis.
These results confirm our prediction that the iron tube can effectively shield the magnetic field without introducing any unwanted multipoles. Field lines are redistributed in the iron tube and not allowed to enter in the good field zone. Now, the analysis is extended for the 3D case. A complete 3D model is built and 2-cm-long iron tubes are placed, one at each end of the magnet as shown in Figs. 9 and 10. These end tubes are movable. The distances of the end tubes are measured from the edge of the magnet. If the tubes are outside (inside) the magnet, then the distance is defined as positive (negative). The distance is defined as infinity (inf) in the absence of end tubes. A standard nonlinear B-H loop is used for the end iron tube. Earlier, we have experimentally measured the variations of integrated quadrupole field strength in the presence of nearby magnets for various field excitations and also by varying the distance between the magnets using a rotating coil [26,20]. We have found that, in the presence of the accompanying magnet in the ring, the integrated quadrupole field strength reduces. The present concept has been derived from our earlier experimental results [27]. Figure 12 shows the variation of the gradient along the length of the magnet, when the distances of the end tube vary. The integrated field strength is calculated by integrating the gradient over the length of the magnet. In the absence of end tubes, which means the distance is inf, the fringe field is extended up to 5 cm from the edge on each side and the maximum integrated quadrupole field strength is obtained. As the end tubes are brought closer, it screens the field, and thereby the integrated field strength is reduced.
However, the peak gradient remains almost the same. The variation of integrated quadrupole gradient with the distance of the end tubes measured from the edge of the magnet is shown in Fig. 13. It is observed that the R g:dl is reduced from 3.4 to 2.4 T when the end tubes each of 2 cm length are brought from a far distance to −2 cm inside the magnet. If a further reduction of R g:dl is required, then the length of the end tube should be increased. As a matter of fact, if the length of each end tube is taken half of the length of the magnet, then it can reduce the R g:dl to a negligible value when the tubes are brought inside the magnet. A very interesting fact observed from Fig. 12 is that the variation of the gradient along the length of the magnet remains very similar for the following two cases: (i) Case 1.-The length of the magnet is 20 cm, and each end tube is placed −1 cm inside the magnet from the edge.
(ii) Case 2.-The length of the magnet is 18 cm, and each end tube is placed at the edge of the magnet (dist ¼ 0 cm). This is because when the end tube of 2 cm length is placed −1 cm inside the magnet of length 20 cm, it screens the field for 1 cm length on each side. It thereby effectively reduces the length of the magnet to 18 cm (20-1-1 ¼ 18). The calculated R g:dl is 2.729 and 2.721 T for case 1 and case 2, respectively, and the effective length is 16.18 and 16.13 cm, respectively. It is pertinent to mention that the effective length of a magnet of 20 cm length is 20.011 cm in the absence of an end tube. But, the effective length is reduced to 18.19 cm when the end tube is placed at each end of the magnet.
Multipole components, integrated over the magnet, normalized with the quadrupole component in the case of a magnet without an end tube and when the tubes are placed at 0, −1, and −2 cm from the edge of the magnet are shown in Fig. 14. It indicates that the higher-order multipoles are within AE2 × 10 −4 except the octupole component (n ¼ 4), which is of the order of 6 × 10 −4 .
To understand the increase of the octupole component, the variation of the octupole component in arbitrary unit along the length of the magnet in the case of a magnet without end tubes and when two end tubes are placed at −2 cm from the edge of the magnet is plotted in Fig. 15. A magnetic field is calculated on the circle of a reference radius at various points along the length of the magnet. After doing FFT, various multipoles are calculated along the length of the magnet. At the center of the magnet, the value of the octupole component is negligible as expected.
In the absence of an end tube, at the edge it gradually becomes negative and then becomes gradually positive just outside the magnet, and finally, away from the magnet, it becomes zero. The crossover from negative to positive takes place at z ¼ 10 cm, and it is symmetric around it. So, when the components are integrated along the length, they cancel each other and give a very low value. However,

E. Generation of 80 T/m QP gradient
It is possible to generate around a 80 T/m field gradient if the bore radius is reduced to 11.5 mm. The high gradient is produced by using two layers of PMs. The inner layer contains a set of 12 magnets each having a 3.5 mm radius, and magnets are placed on the circumference of a circle of 15 mm radius. The outer layer contains a set of 12 magnets each having a 6 mm radius, and magnets are placed on the circumference of a circle of 25 mm radius. This combination of two layers of magnets produces a QP gradient of 80.83 T/m. Figure 16 shows the arrangement of magnets in two layers for producing an 80.83 T/m quadrupole gradient. The radius of each magnet for the inner and outer layers is 3.5 and 6 mm, respectively.
The variation of the quadrupole field gradient at the center of the magnet in the case of two layers is shown in Fig. 17(a). It is observed that the 0.1% gradient uniformity is extended up to a radius of 6 mm, which is called the radius of good field zone. Values of the various harmonics normalized with the quadrupole strength are also presented in Fig. 17(b). All the higher-order harmonics are of the order of 10 −5 except the 12th pole component, which is 1.5 × 10 −4 . These harmonics are acceptable for accelerator magnets.

F. 2D and 3D simulation results using 24 PMs
In this section, the simulation results obtained using 24 cylindrical-shaped PMs will be presented. All 24 magnets are symmetrically placed on the circumference of a cylinder of radius 3 cm, and each magnet has a 3.4 mm radius. In the case of the 3D analysis, the length of the magnet is taken as 20 cm.
The assembly of 24 PMs can generate a 11.2 T/m peak gradient at the center of the magnet. An additional 2.8 T/m gradient can be obtained by applying a 10 A/mm 2 current in the tuning coils as shown in Fig. 18.
The good field zone of 0.1% gradient variation is extended up to a 1.78 cm radius for the assembly of 24 PMs as shown in Fig. 19. Multipole components, as obtained from the 2D calculation, normalized with the quadrupole component are shown in Fig. 20. All the multipoles for the assembly of 24 PMs are of the order of 10 −6 except the DP component, which is 2.7 × 10 −5 , whereas, for the 12 PMs assembly, these values are of the order of 10 −5 for the 2D calculation.
Therefore, as the number of PMs is increased from 12 to 24, the quadrupole field gradient reduces but the good field zone increases and higher-order multipoles reduce. So, when the number of magnets is increased at the cost of the field gradient, then the magnet assembly will move towards the ideal quadrupole magnet with very low higher harmonics.
A complete 3D model is built to study the integrated field gradient and the effective length of the magnet.
The 3D arrangement of 24 PMs in a quadrupole magnet and the field in Gauss in the good field zone at the center of the magnet (Z ¼ 0) are shown in Fig. 21. The field pattern in Gauss in the PM blocks is also shown in the same figure. Measuring the field on a circle of radius r and by doing a FFT, the QP gradient was found out. The field strength is computed from the center of the QPM to 20 cm away along either side from the center of the magnets, where the fringe field is negligible. The length of the magnet is 20 cm, and its span is from −10 to 10 cm along the Z axis. The variation of the field gradient in T/m along the length of the magnet for the 24 PMs assembly QP is shown in Fig. 22. Using the data, the effective length of the magnet is calculated to be 20.02 cm ðL effective ¼ assembly, the effective length is very close to the length of the magnet.

IV. CONCLUSION
I present a method to design magnets using cylindricalshaped permanent magnets, where various types of magnetic field can be produced by either rotating or varying the size of the magnets within a given mechanical structure with a special emphasis on making a QPM. Cylindricalshaped PM blocks is chosen so that the variation of the direction of magnetization can be adjusted by mechanically rotating the blocks during fabrication. In a given mechanical structure having 12 PM blocks, each of radius 7 mm, can generate a dipole field of 0.39 T, a quadrupole gradient of 25 T/m, and a sextupole gradient of 1311 T/m 2 if the direction of magnetization satisfies Eq. (18), (19), and (20), respectively. In one mechanical structure, 12 cylindricalshaped magnets of different radius like 7, 6, and 5 mm are used to generate a quadrupole gradient of 25, 18.2, and 12.5 T/m, respectively. On top of this, a 2 − 2.8 T/m gradient is generated for tuning using the proper shaped current-carrying conductor. A tolerance study is carried out by randomly varying the direction of magnetization and the position of each magnet from the ideal one. Following these results, the mechanical tolerance of the positions of each magnet is set to AE35 μm, and the allowable random deviation of the angle of magnetization is set to AE0.50°.
A new concept is introduced to reduce the integrated quadrupole field strength by inserting two cylindrical iron tubes, one near each end. The advantages of this scheme are that it is easy to implement, the magnetic axis will not shift, and it will prevent interference with nearby devices by restricting the fringe field. In the present model, the integrated quadrupole field strength can vary from 3.4 to 2.4 T when the end tube of 2 cm length is brought from a far off distance to −2 cm inside the magnet at each end for a 12 PM block assembly each having a 6 mm radius.
By increasing the length of the end tubes, a further reduction of the integrated field strength is possible. This concept is applicable for other different shaped magnets as well.
The QP field gradient of 80 T/m is produced by using two layers of PMs. The inner layer contains a set of 12 magnets, each having a 3.5 mm radius, and the outer layer contains a set of 12 magnets, each having a 6 mm radius.
The assembly of 24 PMs each having a 3.4 mm radius can generate an 11 T/m peak gradient at the center of the magnet. The good field zone of 0.1% gradient variation is extended up to 1.78 cm radius, which is 67% of the bore radius. Therefore, as the number of PMs is increased from 12 to 24, the quadrupole field gradient reduces but the good field zone increases and higher-order multipoles reduce.