Introduction

Magnetic materials are used in a wide range of applications, ranging from permanent magnets, magnetic machines, up to magnetic sensors and magnetic recording devices. Solving the Inverse Magnetostatic Problem allows to reconstruct the internal magnetization state of a magnetic component, by means of magnetic field measurements outside of the magnetic part, which is of importance for quality control. Compared with the forward problem, where the magnetic state is known and the strayfield is calculated, inverse problems are much harder to solve, since they typically are much worse conditioned and often not uniquely solveable. Inverse problem solvers are based on stable and reliable solvers for the forward problem. In the case of magnetostatic Maxwell equations, Finite Element (FEM) formulations, combined with methods to handle the open-boundary, have proven to be the methods of choice for many efficient and accurate methods1,2,3.

The applications of inverse problems can be coarsely divided into optimal design and source identification. Optimal design problems define a desired strayfield and try to calculate optimal material distributions or geometries to reach these requirements as accurate as possible4,5. In contrast to this, source identification problems try to reconstruct the state of existing magnetic components. The identification of (permanent) magnetic materials has e.g. been successfully applied for reconstructing the state of magnetic rollers used in copy machines6, magnetically biased chokes7, or even for the magnetic anomaly created by ferromagnetic ships8.

The presented solver for the inverse 3D magnetostatic Maxwell equations, is based on the well-established Fredkin-Koehler-Method3, which uses a hybrid FEM-BEM coupling for efficient handling of the open-boundary conditions. Combined with a hierarchical matrix compression technique for the dense boundary integral matrices, the algorithm is able to handle large-scale problems. Additionally, the use of a general Tikhonov regularization (see e.g. ref. 9), provides a very flexible means to define application specific regularizations.

Adjoint Method

Forward Problem

The demagnetization field of a magnetic body is defined as , where the magnetic scalar potential u is given by

with jump and boundary conditions

where m is the magnetization and is the magnetic region.

The forward problem requires the solution of the potential u on the region h generated by the magnetization in a magnetic region m (see Fig. 1). This problem is solved by considering a single region  = mh with m ( x ) = 0 for x h. The hybrid FEM/BEM method introduced by Fredkin and Koehler3 is one of the most accurate methods for the solution of this problem and will be used in the following. Consider the following splitting of the solution u:

Figure 1: Discretized magnetization region m (blue) and measurement region h (brown).
figure 1

Since the strayfield problem is scale-invariant, length units are omitted. The magnetization is defined on a unit cube. Measurement boxes of thickness 0.04 are located next to each side of the cube, using an airgap of 0.1 (the 2 boxes in front are not shown in the figure).

Here u1 is defined by

This Neumann problem is solved with the finite-element method. While u1 solves for the right-hand side m and fulfills the jump condition of the normal derivative − m · n , it is not continuous across ∂ as required. This jump is compensated by u2 which is defined as

This system is solved by the following double-layer potential

For efficiency reasons the double-layer potential is only computed on the boundary ∂ using a Galerkin boundary-element method. Subsequently these values are used as Dirichlet boundary conditions to solve u2 within using the finite-element method.

All potentials are calculated using piecewise linear basis function () and the derived strayfield would be constant within each element. Thus, a mass lumping procedure needs to be used to project the field onto piecewise linear basis functions which are defined on each vertex of the mesh.

Inverse Problem

The inverse problem can be understood as a PDE constrained optimization problem. Due to the ill-posedness of the inverse problem, some additional information needs to be provided to allow reasonable results. This can be achieved by using Tikhonov regularization, which uses an additional penalty term which should be considered for the optimization. A possible candidate for the objective function is

where hm is the prescribed (measured) field in h and α is the Tikhonov constant corresponding to the regularization functional T( m ). This functional should be minimized, constrained by

with boundary conditions as given above. We aim to solve this problem using a gradient based iterative minimizer. The constraint F gives an implicit expression for u( m ) which allows to directly calculate the desired gradient by

The inefficient direct calculation of the term can be avoided using the adjoint approach, which makes use of the derivative of the constraint equation to eliminate the problematic term. Compared with a naive implementation using a dense system matrix , the computational as well as storage costs can be reduced from to :

where λ is given by the adjoint equation

Since the Poisson problem is self-adjoint, the adjoint system (19) can be solved along the lines of the forward problem. Computing the variational derivative on the RHS yields

where the sources (RHS) live on h and the solution is only computed on m. The same boundary conditions as for the forward problem hold. Thus, the above described hybrid method is applied. The gradient of J is then finally given by

Note that and are projected onto before computing (20) and (21) respectively. The algorithm is implemented using Magnum.Fe10, which is based on the finite element library FEniCS11. This allows a very comfortable definition of the regularization functional. Furthermore, automatic differentiation can be used for the calculation of the corresponding partial derivatives. The algorithm was verified by comparison with a FEM-only implementation, using the dolfin-adjoint library12, which allows to automatically derive the adjoint equation for a given forward problem.

Numerical Experiments

The presented algorithm is validated by the reconstruction of the flower-state within a magnetic unit cube. The strayfield is calculated within measurement planes next to each side of the cube (see Fig. 1). The magnetic state of the cube is parametrized by

where is an open parameter that allows to change the strength of the flower state. For the proper reconstruction of the magnetic state additional knowledge about the solution needs to be provided. For all presented results a smooth reconstructed magnetization is desired which suggests using the following default regularization functional

For this specific flower-state the absolute value of the magnetization is known to be constant. Thus, the solution of the inverse problem could be simplified by using the following penaltization functional

The assumption of a constant magnetization may be a good approximation for (isotropic) permanent magnetic materials. Due to the large magnetic remanence and the relatively small susceptibility the induced magnetization may be negligible (see ref. 13 for a simple model of isotropic permanent magnetic materials).

A Gaussian noise with zero mean and a standard deviation σ = 10−4 has been added to the field, calculated by the forward problem, which should simulate unavoidable measurement errors. The minimization problem is solved by a gradient descent method combined with a line-search strategy. As expected, reconstruction without using a proper regularization leads to large magnetization vectors near to the edges of the unit cube. Increasing the regularization parameter α, first avoids the over-fitting of the noisy measurement data, but finally leads to blurring of the reconstruction results if α gets too large. Determining the optimal alpha is a crucial step for the solution of an inverse problem. The results for the reconstruction of a flower state with ctilt = 2 using α = 10−3 is visualized in Fig. 2. Although there are some deviations of the reconstructed magnetization from the reference state. It can be seen that the created strayfield is nearly identical. As stated above this is a clear indication of the bad condition of the inverse problem.

Figure 2: Reconstruction of a flower-state within a unit cube according to Eqn. (22) using ctilt = 2.
figure 2

A cut through the y = 0 plane is visualized. Starting from the initial parametrized flower state in m the magnetic strayfield is calculated within the fieldboxes h (green arrows). In order to simulate measurement errors a Gaussian noise with σ = 10−4 has been added to the forward strayfield. The reconstructed magnetization as well as strayfield are computed using α = 10−3 (red arrows). The relative differences of initial and reconstructed states are indicated by the gray-scale. Maximal relative errors of the x-components amount to 0.25 for the magnetization, and 5 · 10−3 for the induced magnetic field, respectively.

Using the so-called L-curve method14, allows to visualize the trade-off between the reconstruction of the strayfield and the fulfillment of the regularization constraint. Plotting the regularization norm (also called solution norm) over the residual norm for different regularization parameters α, shows an L-shaped curve. The optimal αopt can be selected at the corner of the L-curve which means that α is large enough to reduce the regularization norm significantly, but it does not change the residual norm too much. The resulting L-curves for the reconstruction of the flower state for different noise levels are summarized in Fig. 3. An optimal value αopt ≈ 5 · 10−5 can be found.

Figure 3
figure 3

L-curves for the reconstruction of the flower state for different noise levels σ.

The application of the presented method to optimal design problems should now be demonstrated by means of a Halbach cylinder configuration. The goal is to find a magnetization configuration within a cylindrical domain, which creates a homogeneous strayfield inside of the cylinder. The magnetization domain m has an outer radius ro = 1.0, an inner radius ri = 0.6, and a height of h = 2.0, while a cylindrical measurement domain h with radius rm = 0.5 and the same height is used. The magnetization vectors should have constant norm, which suggests using the constant-norm penaltization functional (24). The analytic solution for a cylindical Halbach array15 can be expressed in cylindrical coordinates as

where ρ, ϕ are the cylindrical coordinates, with the corresponding unit vectors eρ, eϕ.

As visualized in Fig. 4 there is a nearly perfect match of the reconstructed and the analytical Halbach configuration.

Figure 4: Optimal design problem of a Halbach cylinder creating a homogeneous strayfield inside of the cylinder.
figure 4

Starting from a homogeneous strayfield the presented algorithm reproduces a Halbach like magnetization configuration within m (red arrows). A constant-norm regularization with α = 104 is used and shows a nearly perfect match with the analytical solution (green arrows). The resulting strayfield is calculated inside h and shows a nearly homogeneous distribution (red arrows). The relative errors of the magnetization magnitude and the reconstruced strayfield are indicated by the gray-scale, and their maximum amount to 2% and 6%, respectively.

Conclusion

An efficient algorithm for the solution of inverse problems has been introduced. The use of the Finite Element library FEniCS allows to easily define application specific regularization functionals in a very flexible way. Thus, the implemented algorithm is suitable for a wide range of applications including reverse engineering of magnetic components, design and optimization of magnetic circuits and topology optimization, respectively. Using the hybrid FEM-BEM method proposed by Fredkin-Koehler allows to handle the open-boundary problem accurately and without the need for global mesh including a large airbox. Source identification has been validated by the successful reconstruction of the magnetic flower-state within a unit cube by means of Tikhonov regularization. The selection of a suitable regularization parameter has been demonstrated using the L-curve method. Finally, the application of the method to an optimal design problem has been demonstrated by means of an Halbach cylinder, which is nearly perfectly reproduced.

Additional Information

How to cite this article: Bruckner, F. et al. Solving Large-Scale Inverse Magnetostatic Problems using the Adjoint Method. Sci. Rep. 7, 40816; doi: 10.1038/srep40816 (2017).

Publisher's note: Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.