Introduction

Maintaining a highly homogeneous magnetic field is a key feature of many magnetic analysis methods and experiments in different scientific fields. Nuclear magnetic resonance (NMR) and magnetic resonance imaging (MRI) are given as examples. A uniform magnetic field is also required in some other applications such as magnetometers, neutron interferometers, magnetic traps, particle counters etc. The resolution of magnetic analysis methods can be improved by generating a stronger and more homogeneous field over the region of interest (ROI). As a result of production tolerances and of the magnetic field of the environment, the magnetic field of a permanent or electromagnetic system will be far from homogeneous compared with an ideal field of the system. The technique to correct the field inhomogeneity is typically called shimming of the magnetic system. In general, two shimming methods exists to increase the magnetic field homogeneity of a permanent magnet. (i) Passive shimming corrects the magnetic field by ferromagnetic materials placed on specific locations along the magnet1,2,3. (ii) Active shimming uses electro magnets with specialized coils to generate a correction field4,5. A passive shimming technique, manufactured by an additive manufacturing technology, for any kind of permanent magnetic systems is researched in this paper.

Several optimized permanent magnetic designs exist that obtain a homogeneous magnetic field6,7,8,9. Such magnetic designs can be found with different methods. Examples of numerical optimization methods include: (i) inverse magnetic field computation based on a finite elements method (FEM) where the magnetization M of a defined structure is optimized10,11, (ii) shape optimization improves existing designs for better performance12, (iii) parameter variation simulations can be used to find an optimal layout of predefined magnetic structures13,14 and (iv) topology optimization which allows the designer of magnetic systems to find a suitable topology of the magnets from scratch15,16,17.

The advantage of topology optimization is the ability to create complicated magnetic field shapes, but this freedom-of-design is also the biggest disadvantage in terms of manufacturing of such optimized structures. Time and cost intensive production processes are necessary. This disadvantage can be eradicated by additive manufacturing (AM) techniques. AM or colloquially called 3D printing is an affordable technique to manufacture models, prototypes, or end-user products with a minimum amount of assigned material and time. Recently, it has been shown that an end-user fused deposition modeling (FDM) 3D printer can be used to print polymer-bonded magnets with a complex shape11,16,18. The FDM technology works by heating up wire-shaped thermoplastic filaments above the softening point. A movable extruder presses the molten thermoplastic through a nozzle and builds up the object layer by layer19.

Soft magnetic materials can be in-situ synthesized by selective laser melting (SLM). SLM is a powder bed method, implying that objects are created layerwise from metal powder under influence of a localized heat source. After each finished layer, the workpiece is lowered by one layer thickness. Then, a new layer of powder is spread on the top of the object and defined areas are melted selectively by scanning the part’s cross-section with a laser beam. Typically, permalloys like FeNi3 or Ni-Fe-V and Ni-Fe-Mo are used, respectively20,21. A big advantage of this method is to manufacture dense soft magnetic objects with an arbitrary shape. While the saturation magnetization of these alloys is comparable to conventionally processed versions of similar composition, the coercivities were higher for the laser-processed alloys, presumably due to microstructural defects. Thus, the magnetic properties can be modified by the laser process parameters, that can be used to produce tailored soft magnets for various applications like transformers, electric motors and other electromagnetic devices.

In contrast to SLM produced dense magnets, magnets can also be manufactured by FDM from compound materials which consist of soft magnetic particles embedded in a thermoplastic filament22. Samples of commercially available extruded composite filament from Proto-Pasta (Magnetic Iron PLA) are printed. This filament consists of 40 wt.% Fe particles embedded in a polylactic acid (PLA) polymer matrix. The magnetic properties of soft magnetic compounds are mainly influenced by their filler fraction. Filling fraction of more than 65 vol.% would be necessary to fabricate functional soft magnetic parts.

This work describes the complete designing and manufacturing method for a magnetic system that generates a homogeneous magnetic field in a defined ROI. With topology and inverse stray field simulation tools, the optimized design can be found. The permanent magnetic structures are printed with a FDM technique. Printing and magnetization errors are considered. A SLM process produces the passive shimming elements for the error correction.

Method

The method to find a permanent magnetic design with passive shimming elements that generates a homogeneous magnetic field in a defined ROI should be described by a simple example with a poor magnetic homogeneity to demonstrate the technique. The inhomogeneity η inside the ROI is defined with the magnetic flux density B as

$$\begin{array}{l}\eta =\frac{{B}_{{\rm{\max }}}-{B}_{{\rm{\min }}}}{{B}_{{\rm{mean}}}}.\end{array}$$
(1)

The ROI has a radius of 6 mm and a thickness of 1 mm. The inhomogeneity η should be smaller than 10‰. As a starting point for the optimization, a naive design of two cylindrical permanent magnets with radius r = 10 mm, thickness t = 10 mm and a gap of g = 20 mm is chosen. Starting from such a design (Fig. 1(a)), the topology of this permanent magnetic system should be optimized (Fig. 1(b)) in oder to minimize the inhomogeneity η. After magnetization of the system along the z-axis, the field is measured and the quality of the print and magnetization is determined by an inverse stray field simulation10,11. The result of this simulation is an input for the topology optimization of the soft magnetic shimming elements (Fig. 1(c)).

Figure 1
figure 1

Optimization steps to generate a homogeneous magnetic field in the region ΩROI. (a) Permanent magnetic cylinder magnets (r = 10 mm, t = 10 mm) with a gap between the magnets of g = 20 mm. Magnetization along the z-axis. (b) Topology optimized permanent magnetic structure. (c) Printing errors and incorrect magnetization are corrected by topology optimized soft magnetic shimming elements (thickness: 1 mm).

Simulation Framework

In a simply connected domain without current, the stray field strength H of a magnetic body is given by

$${\boldsymbol{H}}=-\,\nabla u$$
(2)

with the magnetic scalar potential u. The relation between the magnetic flux density B and the field strength H is

$${\boldsymbol{B}}=\mu ({\boldsymbol{J}}){\boldsymbol{H}}+{\boldsymbol{J}}$$
(3)

with μ = μ0μr. μ0 is the vacuum permeability and J = μ0M are the magnetic polarization with the magnetization M. The nonlinear isotropic permeability μr(J) of the material is defined as

$${\mu }_{r}({\boldsymbol{J}})=\frac{{\boldsymbol{B}}({\boldsymbol{J}})}{{\boldsymbol{H}}}.$$
(4)

For the topology optimization framework we use a density based method, also known as solid isotropic microstructure with penalization (SIMP)16. This method is based on a 3D finite-element method (FEM) simulation algorithm. Each tetrahedral finite element has a density parameter \(\varrho \), which ranges from 0 (void) to 1 (bulk). This leads to only one design parameter per element23. Permanent magnetic systems with a magnetization M of an element in the design domain \({{\rm{\Omega }}}_{{\rm{hard}}}\in {{\mathbb{R}}}^{3}\) can be formulated for the design method as

$${\boldsymbol{M}}(\varrho )={\varrho }^{{\boldsymbol{k}}}{{\boldsymbol{M}}}_{0}$$
(5)

where \(\varrho \)ρ [0, 1] is the density value of a FEM element, M0 is the constant magnetization vector and k = 1 is the penalization parameter24. For nonlinear isotropic soft magnetic materials, the relative permeability μr(M) in the design domain \({{\rm{\Omega }}}_{{\rm{soft}}}\in {{\mathbb{R}}}^{3}\) can be reformulated for the design method to

$${\mu }_{r}({\boldsymbol{M}}(\varrho ))=({\mu }_{r0}({\boldsymbol{M}})-\mathrm{1)}{\varrho }^{k}+1$$
(6)

for topology optimization of nonlinear isotropic soft magnetic materials with the measured permeability μr0, a penalization parameter of k = 4 leads to good results.

The general topology optimization problem with the density method can be formulated as

$$\begin{array}{l}\mathrm{Find}:\,\mathop{{\rm{\min }}}\limits_{\varrho }\,{J}(\varrho )\\ {\rm{subject}}\,\mathrm{to}:\,{\int }_{{{\rm{\Omega }}}_{i}}\,\varrho ({\boldsymbol{r}}){\rm{d}}{\boldsymbol{r}}\le V;\\ 0\le \varrho ({\boldsymbol{r}})\le \mathrm{1,}\,{\boldsymbol{r}}\in {{\rm{\Omega }}}_{i}\end{array}$$
(7)

with the objective function J and the maximum Volume V of the design as a constraint; i {hard, soft} defines the permanent and soft magnetic domain, respectively.

In our case, to minimize the inhomogeneity of the magnetic flux density B in the ROI, following objective function J has to be minimized

$$J={\int }_{{{\rm{\Omega }}}_{{\rm{ROI}}}}|\nabla \otimes {\boldsymbol{H}}{|}^{2}{\rm{d}}{\boldsymbol{r}}.$$
(8)

No regularization is performed for this problem. Because, after several tests with different filters and perimeter controls, no improvement of the design quality or the magnetic homogeneity is detected25.

The finite-element package FEniCS is used to implement and solve the demagnetization field problem and the topology optimization method. FEniCS is an open-source software project with the goal to enable automated solution of nonlinear differential equations26. This involves the automation of: (i) discretization, (ii) discrete solution, (iii) error control, (iv) modeling and (v) optimization27. The topology optimization problem can be solved by the adjoint variable method (AVM)23. It is a well-known method for sensitivity analysis using FEM. The main advantage of this method is the low computational and storage costs compared to other techniques. To solve the topology optimization with the AVM method, the well-suited Dolfin-Adjoint library is used28,29. Dolfin-adjoint contains a framework to solve nonlinear partial differential equation (PDE) constraint optimization problems.

The models for the 3D printing process and the simulations are created in Salome 7.6. Meshing of the simulation models is performed in Salome 7.6 with the Netgen algorithm and tetrahedron elements30. Converting the.med Salome output file to the FEniCS.xml format is performed with Gmsh 2.10.1. The shell of the topology optimization is converted into a standard tessellation language (STL) file for the 3D printing process. The permanent magnetic model is sliced with Slic3r 1.3.0. The soft magnetic domain is sliced with EOS RP-Tools Version 6.2.7. Both geometries are sliced without any modifications of the topology optimization output. The design domain for the permanent magnetic region Ωhard consists of 93,306 tetrahedral elements with a mesh size of of 0.4 mm. The soft magnetic domain Ωsoft consists of 299,001 tetrahedral elements with a mesh size of of 0.15 mm. The mesh size is chosen so that it is in the same range as the 3D printer resolution.

Results

The topology optimized hard magnetic system should be realized by a FDM 3D printing process18. A prefabricated compound material (Neofer® 25/60p) from Magnetfabrik Bonn GmbH is used to realize the setup. It consists of NdFeB particles in a PA11 polymer matrix. The powder has a spherical form and the NdFeB grains have a uniaxial magnetocrystalline anisotropy and the orientation of the grains is random leading to isotropic magnetic properties of the bulk magnet. The powder is produced by employing an atomization process followed head treatment. The compound consist of 52 vol.% of the magnetic powder.

After printing of the optimized design (Fig. 1(b)), the objects are magnetized inside an electro magnet with a maximum flux density of 1.9 T along the z-axis. To deduce the quality of the print and the correct magnetization, the field in the ROI is scanned by a 3D stray field measurement setup18. By the help of an inverse stray field simulation framework, the magnetization distribution inside the permanent magnetic structure is calculated10,11. As shown in Fig. 2(a), the magnetization is not perfectly orientated along the z-axis. This error originates from a nonconforming magnetization, as well as other printing errors and it should be eradicated with soft magnetic shimming elements (Fig. 1(c)). For this reason, the recalculated magnetization is an input for the nonlinear soft magnetic topology optimization.

Figure 2
figure 2

Error correction with passive shimming elements. (a) Cut of the topology optimized magnet of Fig. 1, where the green area shows the hard magnetic region. Arrows represent the magnetization M of the inverse stray field simulation. The measured magnetic field in the ROI indicates a non-optimal magnetization of the polymer-bonded permanent magnet. (b) Topology optimized soft magnetic shimming elements that correct the magnetization and printing errors.

The first idea was to use a commercially available soft magnetic compound material (Iron Metal PLA Composite, Proto-Pasta). This compound material shows good printing capability. However, due to its low amount of soft magnetic particles of only 16 vol.%, it shows weak magnetic properties compared to complete dense soft magnetic materials.

For bonded soft magnets, the relation between coercivity and filler fraction ϕf can be described be the equation from Néel31,32

$${H}_{c}({\varphi }_{f})={H}_{c}\mathrm{(0)(1}-{\varphi }_{f})$$
(9)

with the coercivity Hc(0) of one isolated magnetic particle of the filler material and the coercivity Hc(ϕf) for a filler fraction ϕf. This relation leads for ϕf = 1 to a coercivity of Hc(1) = 0 A/m. Hc for soft magnets is small but not zero. Nevertheless, the relation describes the coercivity of bonded soft magnets very well33.

The relative permeability μc of soft magnetic compounds can be described by the equation from Bruggeman34,35

$${\mu }_{c}({\varphi }_{f})=\frac{{\mu }_{m}}{{\mathrm{(1}-{\varphi }_{f})}^{3}}$$
(10)

this model assumes that the permeability of the filler material μ → ∞ as a basis, as well as that the particles are far away from each other and intersection can be neglected. Therefore, this model is only applicable for low filler fractions (ϕf < 0.85). The permeability of the polymer matrix material is μm ≈ 1. In the case of the Iron Metal PLA Composite from Proto-Pasta, a theoretical permeability of only μ = 2 is reachable. This value of the permeability fits well with hysteresis measurement performed by a pulse field magnetometry (PFM) (Hirst PFM11) where the material is printed in a cube shape with edge length of 5 mm36,37. All measurements are carried out 3 times with the same parameters - temperature of 297 K and a magnetic field up to 4 T peak field. The internal field is Hint = Hext − JN/μ0, where Hext is the external field, N is the average demagnetisation factor for a cube (N = 1/3)38 and J is the material polarization. Figure 3(a) shows hysteresis measurements of the Iron Metal PLA Composite for FDM.

Figure 3
figure 3

Hysteresis measurements. The measurements are done for cubes of a = 5 mm and the loops are de-sheared with N = 1/3. (a) Polymer-bonded Iron Metal PLA Composite for FDM. (b) EOS MaraginSteel MS1, 1.2709 for SLM.

Since the permeability of the magnetic material produced by FDM is only around 2, we decided to utilize a different approach were we expect higher permeability and better properties for the shimming application. As mentioned before it is possible to manufacture soft magnetic materials additively by a SLM process. In our case, the SLM machine EOSINT M280 with a laser power of 400 W is used. A commercial available steel powder (EOS MaraginSteel MS1, 1.2709) is used for this work39. This powder has optimal properties for the SLM process. The printing parameters are summarized in Table 1.

Table 1 Printing parameters for the SLM of EOS MaraginSteel MS1, 1.2709.

Figure 3(b) shows hysteresis measurements of the EOS MaraginSteel MS1 material by SLM.

The hysteresis curve of the first quadrant is an input parameter for the topology optimization with a nonlinear soft magnetic material (Eq. 5). In combination with the recalculated magnetization distribution, the topology of the soft magnetic shimming elements can be simulated. The maximum radius and thickness of the elements is 10 mm and 1 mm, respectively. Figure 2(b) shows the simulated topology of the elements. The topology of the optimization is similar to “Rose rings” as expected in40, but due to the incorrect magnetization of the permanent magnets, the soft magnetic shimming elements are not rotational symmetric. For a better printing result, the ring shape is divided into two sections. This will avoid poor printing resulting from large overhangs.

The produced shimming elements are then mounted onto the permanent magnets. Figure 4(a) shows a picture of the fully assembled setup (with shimming elements) during the field measurement.

Figure 4
figure 4

Additive manufactured magnetic system. (a) Picture of the setup during the field measurement. (b) Measurement and simulation of the inhomogeneity η of the magnetic flux density along x-axis in the middle of the ROI. (Solid lines are simulation results).

The measurements of the inhomogeneity η along the x-axis for the different phases of magnet design are shown in Fig. 4(b) and are compared to simulation results. It is visible that inhomogeneity of the topology optimized permanent magnets is not completely symmetrical about the x-axis. This is a result of the printing and magnetization errors. Good conformity between simulation and measurement results is given at all different iteration steps. In case of the final design with mounted shimming elements, the maximum field density in the middle of the system is 24.64 mT and the maximum inhomogeneity with shimming elements is around 6‰.

The presented methodology can be continued with more than one layer of shimming elements. To show the opportunity of this technique we simulate two more shimming elements on the top of the first one. The printing errors are considered with the same inverse stray field calculations as above. Figure 5(a) shows the simulation results of the inhomogeneity η along the x-axis for the different amount of shimming elements. The field inhomogeneity can be decrease for each iteration optimized shimming elements. Results of the topology optimization simulations for each iteration can be seen in Fig. 5(b).

Figure 5
figure 5

Topology optimization results for more than one shimming element. (a) Simulation of the inhomogeneity η of the magnetic flux density along x-axis in the middle of the ROI. (b) Topology of the hard magnet (i1) and the different shimming elements (i2, i3, i4). Each shimming layer has a thickness of 1 mm.

Conclusion

Additive manufacturing offers new opportunities of magnetic field designs and manipulations. It can manufacture objects with highest individual design flexibility at minimum costs. The full potential of additive manufacturing comes into play when complex and customized parts have to be produced, which would otherwise be complicated to fabricate with conventional subtractive manufacturing methods.

Topology optimization of permanent and nonlinear soft magnetic materials offers the possibility to find the best possible topology of a given design domain for a desired field distribution. It needs to be said that that such optimization techniques can only find the best suitable design for a given arrangement of the design domains. Another disadvantage of such topology optimization algorithms is that the simulation results are difficult to manufacture with conventional manufacturing technologies. Additive manufacturing technologies opens here a new and easy way of the production process.

Nowadays, 3D printing of polymer-bonded permanent magnetic materials is an active research topic. 3D printing of soft magnetic materials by the aim of a FDM technique is not particular due to its low filler fraction of soft magnetic powder. For this reason, a SLM process is a better technique to manufacture soft magnets for field shaping applications. Nevertheless, if only a weak modification of the external field is necessary (field inhomogeneity in the range of parts per million), FDM with bonded soft magnetic materials could be suitable to shape the field in a small range.

A homogeneous magnetic field is necessary for many experiments and magnetic analysis methods. Traditionally, shimming elements of simple geometric shape are used to minimize field inhomogeneities. This work presents a additive manufacturing method to find a proper topology optimized design that generate a homogeneous magnetic field in a defined region. The inhomogeneity can be decrease by a factor of around 35. Even more, unavoidable printing and magnetization errors can be detected by an inverse stray field simulation technique which shows good accordance to the measured data. These errors can be considered in the next iteration step. Additional topology optimization simulations show the opportunity to make the magnetic field more homogeneous.

To improve this iterative shimming optimization, additional simulations and experiments, with locally varying permeabilities and thicknesses of the soft magnets should be considered. A FDM manufacturing process could offer a possibility to generate shimming elements with a location-dependent permeability. This would open a fourth dimension for the optimization process.