1 Introduction

A variety of engineering problems require the solution of open boundary problems, e.g. the simulation of acoustic phenomena or seismic waves. In magnetostatics of solids (magnets), the demagnetization fields inside a magnetic body and the stray fields outside the magnetic solid are directly affected by the magnets. For simple geometries, the stray field, which is proportional to the magnetization, can be captured by demagnetization coefficients. However, more complex geometries usually require a more sophisticated analysis of the considered fields over the whole domain. In these cases, the balance equation to be solved is the Gaussian law, which is defined over the magnetic solid and the surrounding external space. Thus, the analysis of an open boundary problem is necessary.

Since the stray field vanishes at a certain distance from the magnet, an approximate analysis can be restricted to a sufficiently large outer spatial region. Defining the boundary of the finite but sufficiently large exterior space is initially an intuitive process. However, a sufficiently precise choice can usually be made based on experience. In a complex application, the homogenization of magneto-elastic problems in the presence of large deformations, was solved in [1, 2] by Keip and Rambausek by defining a macroscopic boundary value problem considering a large but finite exterior domain. An overview of finite element open boundary techniques can also be found in [3]. Here, the authors divide the various techniques into 12 subgroups, such as truncation of outer boundaries, ballooning, infinite elements, infinitesimal scaling, absorbing boundary conditions, and others. A rule of thumb for the truncation radius is given in [3]. However, in our case the analysis of the Gaussian law requires a boundary condition at infinity to ensure the well-posedness of the problem, see [4]. A truncation of the outer boundary based on a finite element approach requires the replacement of the condition at infinity by a boundary condition on a finite artificial surface. Estimates of the error due to the boundary values at the finite boundary as well as higher-order boundary conditions to reduce the error are derived in [4] for several applications. A finite-difference time-domain free-space simulation method for solving unbounded electromagnetic problems based on an absorbing layer that absorbs electromagnetic waves without reflection has been proposed by [5]. Local and non local boundary conditions for the numerical solution of wave problems are reviewed in [6]. For the time dependent Maxwell equations in three dimensions an exact nonreflecting boundary condition is derived by [7].

For the numerical solution of linear magnetostatic problems consisting of a homogeneous magnet embedded in free space, the boundary element method (BEM) is ideally suited. Only the surfaces of the magnet need to be discretized and the surrounding space is captured exactly. If nonlinear material behavior is to be considered, the BEM can be coupled with the FEM, see [8]. Alternative (comparable) hybrid methods based on FEM-BEM couplings have been developed for time-harmonic eddy current problems in three-dimensional unbounded domains, see [9]. Standard coupled FEM-BEM often leads to unacceptable numerical costs for a large number of degrees of freedom. Hertel et al have shown in [10] that the memory requirements of these algorithms can be drastically reduced if special hierarchical matrices are used, see also [11]. A comparative study of finite difference based fast Fourier transform methods, tensor-grid methods and the finite-element method with shell transformation for the stray field calculation in micromagnetics is given by [12]. There, the authors investigate the above algorithms with respect to complexity, storage requirements and accuracy obtained for benchmark problems. Depending on the task, one or the other method proves to be advantageous.

Another discretization scheme for the solution of problems in infinite domains is the scaled boundary finite element method (SBFEM), which goes back to [13] and [14], see also [15] and the monograph [16] for a status quo of the SBFEM for bounded domains. This semi-analytical scheme retains advantages of both the finite element method and the boundary element method. In particular, its semi-analytical nature facilitates the accurate representation of radiation damping when modelling acoustic or dynamic problems in unbounded domains, see e.g. [17] and [18], respectively. An application of the SBFEM to two-dimensional electromagnetic field problems can be found in [19]. In a 3D context the surface of the domain of interest is discretized using 2D finite element meshes. It should be noted that the semi-analytical treatment of unbounded regions using SBFEM requires a certain piecewise regularity of the domain.

Our proposed concept is formally placed in the class of truncation of outer boundaries. Here we apply a static condensation, which can be interpreted as a model order reduction technique. We proceed as follows:

First, we define the boundary of the outer domain. The definition of the outer boundary of the region under consideration is based on the assumption that here the potential (i.e. the Dirichlet boundary condition) or the normal derivative of the potential (Neumann boundary condition) tends towards zero.

Second, we impose another (inner) boundary separating the solid from the outer space. This would provide the reduced system with the smallest number of degrees of freedom. However, we can also draw an arbitrary boundary within the region between the outer boundary and the boundary containing the solid. The only condition is that the region (denoted as exterior or outer domain in the following) between the inner and outer boundary behaves linearly.

Third, we perform a static condensation of the discretized exterior domain onto the degrees of freedom of the inner boundary.

Finally, a nonlinear finite element analysis of the condensed problem is performed. Since, as mentioned above, the assumption of homogeneous boundary conditions is essential for this procedure, a substitution of the basic variable, here the magnetic potential, is necessary. The solids to be investigated are placed in an externally imposed, spatially constant magnetic -field. For the external domain, this results in a linear distribution of the potential on the boundary. We now split the magnetic field, which is determined later, into the constant applied field and a fluctuation part. Thus, the descriptive differential equation is formulated with respect to the fluctuations, which by definition disappear on the outer boundary. Furthermore, the challenge arises that the imposed external field is variable, which requires an update of the condensed right-hand side. The numerical implementation of the proposed procedure is done within the finite element framework of AceGen and AceFEM, compare [20, 21].

2 Definition of the boundary value problem

This section presents the magnetic quantities of interest and the equations to be solved. For an introduction to magnetism and magnetic materials, refer to standard textbooks, such as [22, 23] or [24]. Let \({\mathcal {B}}\) be the domain of interest, parametrized in , which is subdivided into an interior \({\mathcal {B}}^\mathrm{int}\) and an exterior domain \({\mathcal {B}}^\mathrm{ext}\). To illustrate the problem, Fig. 1 shows a circular region with a circular inclusion. The outer domain is represented by the light grey circular ring and the inner domain by the yellow and orange inclusion. The interface between the interior and exterior domain is denoted by \(\partial {\mathcal {B}}^\mathrm{b}\) and the boundary of the outer domain is \(\partial {\mathcal {B}}^\mathrm{ext}\). Let us now consider the discretization of the individual domains. The discretization of the boundary of the interior domain \(\partial {\mathcal {B}}^\mathrm{b}\) ist denoted by \(\partial {\mathcal {B}}^\mathrm{int}\) with the outward unit normal . In analogy we write \(\partial {\mathcal {B}}^\mathrm{ext,i}\) for the discretization of the same interface associated with \({\mathcal {B}}^\mathrm{ext}\) with the outward unit normal . At associated points of both discretizations of \(\partial {\mathcal {B}}^\mathrm{b}\) the relation holds. Finally, the discrete representation of the outer boundary is \(\partial {\mathcal {B}}^\mathrm{ext,a}\).

Fig. 1
figure 1

Visualisation of the discretization of the subareas and definition of the inner and outer boundaries. a) shows the total domain of interest containing the interior and exterior subdomains, while b) defines the interior domain and c) the exterior domain

As a generic example we consider a boundary value problem of magnetostatics. The Gauss law of magnetostatics is

(1)

where is the magnetic induction. Let \({\varphi }\) denote the magnetic potential. Then, the magnetic field vector is defined as

(2)

Possible boundary conditions are the specification of a magnetic potential \({\varphi }_0\) and a magnetic flux \({\zeta }_0\):

(3)

with

$$\begin{aligned} \partial {\mathcal {B}}^\mathrm{ext,a}_{\varphi } \cup \partial {\mathcal {B}}^\mathrm{ext,a}_{B} {=} \partial {\mathcal {B}}^\mathrm{ext,a} \quad \text {and} \quad \partial {\mathcal {B}}^\mathrm{ext,a}_{\varphi } \cap \partial {\mathcal {B}}^\mathrm{ext,a}_{B} = \emptyset . \end{aligned}$$
(4)

The weak form of (1) appears as

(5)

with the virtual magnetic potential \({\delta \varphi }\) and the virtual magnetic field

(6)

By definition we assume linear behavior in the exterior domain. In this region we use the constitutive relation

(7)

where \(\mu _0 \) denotes the constant magnetic permeability. Now we split the weak form into the two terms

(8)

where we substitute the constitutive linear relation (7) in a tensorial manner . We start our considerations with an externally applied, constant magnetic -field over the whole domain . If there is no magnetic body with a different permeability located within , no interference fields (stray fields) can occur. If a magnetic body is placed in the external -field, a magnetization will be generated within the solid and it holds . Now, sources and sinks of the magnetization appear on the surface of the magnet, but according to Maxwell’s equation they must not exist, since . Thus, sources (sinks) of the magnetization must be understood as sinks (sources) of the magnetic field strength. Mathematically, this can be expressed as follows

(9)

This creates a magnetic field that opposes the magnetization inside the magnet, the demagnetizing field, also known as the stray field outside the magnet. Compare [24, 25] for further insights into the topic. In the following analysis we are interested in the computation of magnetization fields (-field) under consideration of the magnetic stray field (demagnetization field). The stray field in the external environment outside the magnet, is the magnetic field (-field) generated by the magnetization in a magnet. The typical task is now to calculate the above fields due to an externally applied constant -field for a magnet in a large external space. This external space represents, for example, a vacuum or the air environment. The stray fields distort the applied constant -field, especially in the immediate vicinity of the magnet, and decay from a certain distance so that they no longer have any effect on the applied field. Based on these preliminary considerations, an -field is applied, which we increase via the parameter \(\lambda \in \left[ 0,1\right] \). This facilitates the substitution of the magnetic potential as

(10)

Furthermore, this results in the following substitutions for the virtual magnetic potential and magnetic field

(11)

With these modifications, the weak forms (8) result in

(12)

For later use, we can now prescribe the magnetic potential on the complete outer boundary \(\partial {\mathcal {B}}^\mathrm{ext,a}\); thus \(\partial {\mathcal {B}}^\mathrm{ext,a} = \partial {\mathcal {B}}^\mathrm{ext,a}_{\varphi }\) and \(\partial {\mathcal {B}}^\mathrm{ext,a}_B = \emptyset \). If we take the substitution into account, it follows that the fluctuations on the outer rim must disappear by definition, i.e.

$$\begin{aligned} {{\widetilde{\varphi }}}= 0 \quad \text{ on }\; \partial {\mathcal {B}}^\mathrm{ext,a}_{\varphi } \;. \end{aligned}$$
(13)

Before we turn to the discrete formulation of the boundary value problem in the next section, we perform the formal linearisation of equation set (12). The linearization \(Lin G_{\varphi } = G|_n + \Delta G_{\varphi }\) yields the linear increments

(14)

3 Discrete formulation

By means of discretization of the body \({\mathcal {B}}\) with standard finite elements \({\mathcal {B}}^\mathrm{e}\) we obtain the representation

$$\begin{aligned}&\displaystyle {\mathcal {B}} \approx {\mathcal {B}}^\mathrm{h} = \bigcup \limits _{e=1}^{\mathrm{num}_{\mathrm{ele}}} {\mathcal {B}}^{\mathrm{e}} \quad \text {with}\nonumber \\&\displaystyle {\mathcal {B}}^{\mathrm{int}} \approx {\mathcal {B}}^{\mathrm{h, int}} = \bigcup \limits _{e=1}^{\mathrm{num}_{\mathrm{ele}}^{\mathrm{int}}} {\mathcal {B}}^{\mathrm{e, int}} \; , {\mathcal {B}}^{\mathrm{ext}} \approx {\mathcal {B}}^{\mathrm{h, ext}} = \bigcup \limits _{e=1}^{\mathrm{num}_{\mathrm{ele}}^{\mathrm{ext}}} {\mathcal {B}}^{\mathrm{e, ext}} \; ,\nonumber \\ \end{aligned}$$
(15)

where the index h characterises the discrete areas or elements. The number of elements in the exterior and in the interior domain are denoted by \(\mathrm{num_{ele}^{ext}}\) and \(\mathrm{num_{ele}^{int}}\), respectively; thus, the total number of elements is \(\mathrm{num_{ele}} = \mathrm{num_{ele}^{int}} + \mathrm{num_{ele}^{ext}}\). Due to the substitution of the magnetic potential by the sum of a basic affine component and a fluctuation field, we only have to discretize the fluctuation field and the virtual fluctuation field for a typical finite element \({\mathcal {B}}^\mathrm{e}\):

(16)

where \(n_{node}\) are the number of nodes per element, are the ansatz functions, denotes the matrix of ansatz functions, \({\widetilde{d}}^I\) the degrees of freedom, \(\delta {\widetilde{d}}^I\) the virtual degrees of freedom and are the associated element vectors of unknowns. The following approximations are introduced for the magnetic fields

(17)

where and denote the node-wise and element-wise B-matrices, respectively, containing the Cartesian derivatives of the shape functions.

3.1 The interior domain \({\mathcal {B}}^\mathrm{int}\)

Substituting Eq. (17) into the weak form and its linear increment, we obtain

(18)

with the element right-hand side and the element stiffness matrix . If we now assemble the algebraic system of the inner domain, we obtain the representations

(19)

with the stiffness matrix and the right-hand side associated with the interior domain. In view of the subsequent reduction of the total system, we partition the system of equations with respect to the degrees of freedom inside the interior domain \({\mathcal {B}}^\mathrm{int}\setminus \partial {\mathcal {B}}^\mathrm{int}\) and the degrees of freedom on the interphase \(\partial {\mathcal {B}}^\mathrm{int}\) between both domains, see Fig. 1:

(20)

with being the incremental global vector of unknowns.

3.2 Discretization of the external domain \({\mathcal {B}}^\mathrm{ext}\)

Substituting the constant and a fluctuation component of the magnetic field into the linear constitutive equation (7) yields

(21)

For the exterior system \({\mathcal {B}}^\mathrm{ext}\) the weak formulation is expressed as

(22)

Since \(\lambda \) and the given -field ( and therefore ) are constant in an incremental step, the linear increment results in

(23)

The algebraic system of equations for the external domain \({\mathcal {B}}^\mathrm{ext}\) appears in the form

(24)

with the global matrices, after carrying out the classical assembly procedure for \({\mathcal {B}}^\mathrm{ext}\),

(25)

With the aim of further reducing the size of the system of equations, we now partition the degrees of freedom, analogous to the procedure for the inner domain, according to the degrees of freedom on the interface between \({\mathcal {B}}^\mathrm{ext}\) and \({\mathcal {B}}^\mathrm{int}\) and the degrees of freedom within the outer domain \({\mathcal {B}}^\mathrm{ext}\setminus \partial {\mathcal {B}}^\mathrm{int}\)

(26)

with representing the global solution vector. Since the inner domain is generally characterised by nonlinear behavior, an iterative procedure must be applied to solve the entire system. Here, it is important to note that we also apply a load increase in the (linear) outer region via the parameter \(\lambda \) and that the right-hand side depends on the current fluctuation field, i.e. .

Table 1 Computational steps

3.3 Static condensation of the exterior domain

In a next step, we eliminate from equation (26) the degrees of freedom , where we have to take into account the explicit expressions for the right-hand side. Starting from

(27)

we first eliminate from (27)\(_2\):

(28)

Since the symmetric matrices and the matrices are constant, it is advisable from an algorithmic point of view to introduce the auxiliary matrix

(29)

Substituting Eqs. (28) and (29), we obtain

(30)

with the constant matrices and . Finally, we must carry out the assembling procedere of the discrete inner and outer domain, i.e. the assembly of the algebraic systems (30) and (20). This yields the final representation

(31)

The algorithmic steps are summarized in Table 1.

Table 2 Material parameters used for the nonlinear simulation

4 A simplified nonlinear magnetic model

To verify the performance of the proposed numerical scheme, where the degrees of freedom of the external domain have been eliminated by static condensation, we apply a simplified nonlinear constitutive law for the solid inside \({\mathcal {B}}^\mathrm{int}\) for the magnetic induction as a function of the magnetic field . In general, this relation can be expressed via the magnetic permeability and thus via the magnetic susceptibility :

(32)

where denotes the magnetization. The magnetic susceptibility is not constant in ferromagnets, but a non-linear function of the applied magnetic field strength and of the history of the material, i.e. . In ferromagnetic materials, a so-called saturation magnetization is generally observed, i.e. a material-dependent maximum value for the magnetization is reached. If we consider as differential susceptibility, i.e. , then this becomes zero when the saturation magnetization is reached. For the sake of simplicity, we will limit ourselves here to a magnetization curve without hysteresis. This is a characteristic of soft magnets, which do not show much hysteresis. However, the proposed procedure is also valid for the simulation of hard magnets with distinct hysteresis properties. Of course, this model also shows saturation. As a prototype for this we use the function

(33)

where \(M_S\) denotes the saturation magnetization, \(\beta \) a slope parameter and for otherwise . For the linearisation of the weak form, see (18), we need ; this appears for in the explicit form

(34)

with

(35)

otherwise we obtain

(36)

Note: This is a very simplified model to describe the magnetization in a solid. Classically, one assumes the existence of a free energy function \(U(m_1, m_2, m_3)\), which is formulated in series expansion of the direction cosines (\(m_i | i=1,2,3\)) of the magnetization relative to the crystal axes. In our consideration we start from an enthalpy function . For our chosen model the enthalpy function for the magnetization part is

(37)

For the discussion of phenomenological models of hysteresis we refer to [26, 27]. To demonstrate the feasibility of the model presented above a homogeneous boundary value problem is considered. The domain of interest corresponds to a square with dimensions of 4 \(\mu \)m \(\times \) 4 \(\mu \)m and the material parameters as defined in Table 2. In order to generate a magnetic response, the area is subjected to the external magnetic field A/ \(\mu \)m, where \({\lambda }\) is a load factor alternating between minus one and one. The corresponding response function can be found in Fig. 2, where denotes the Euclidean norm.

Fig. 2
figure 2

The normalized response curve for the load case described above

5 Stray field calculation with heterogeneous exterior domain

The method presented above is suitable for the approximation of large outer domains, while other established methods, such as the boundary element method or the scaled boundary finite element method, provide solutions for infinite domains. While the established methods can only give solutions for outer domains with a certain regularity, the proposed method has the decisive advantage of being able to take heterogeneous exterior domains into account. This means that interference fields in the outer space, e.g. generated by adjacent or nearby magnetic bodies, can also be taken into account. This is demonstrated in the following example. Three magnetic inclusions, identified as \({\mathcal {B}}^\mathrm{ext}_1\) (green), \({\mathcal {B}}^\mathrm{ext}_2\) (blue) and \({\mathcal {B}}^\mathrm{int}_2\) (red), are considered in direct proximity to one another. In the following, all distances are related to the coordinate system shown in Fig. 3. The green inclusion \({\mathcal {B}}^\mathrm{ext}_1\) is described by the center point P\(_1\) (-80 / -110) \(\mu \)m and the radius r\(_1\) = 35 \(\mu \)m. The blue inclusion is also characterised by a centre point P\(_2\) (80 / -130) \(\mu \)m and the radii r\(_2\) = 70 \(\mu \)m and r\(_3\) = 30 \(\mu \)m. The dimensions of the remaining coloured domains can be found in the drawing in Fig. 3. All three inclusions are surrounded by free space, here indicated by \({\mathcal {B}}^\mathrm{ext}_3\) (light blue) and \({\mathcal {B}}^\mathrm{int}_1\) (orange). To generate a magnetic response the whole domain is treated with an external magnetic field \({\overline{H}}_2\) = 6.3 \(\cdot 10^{-3}\) A/ \(\mu \)m.

Fig. 3
figure 3

The test setup for the analysis of the reduction method. Three differently shaped inclusions \({\mathcal {B}}^\mathrm{ext}_{1-2}\) and \({\mathcal {B}}^\mathrm{int}_{2}\) are embedded within a free space \({\mathcal {B}}^\mathrm{ext}_{3}\) and \({\mathcal {B}}^\mathrm{int}_{1}\). The external magnetic field \({\overline{H}}_2\) is applied in y direction. The green line framing \({\mathcal {B}}^\mathrm{int}_1\) and \({\mathcal {B}}^\mathrm{int}_2\) indicates the area that is graphically presented during post-processing

Fig. 4
figure 4

Cut out of the boundary value problem given in Fig. 3 for the graphic representation of the results, with a) dimensions and b) the corresponding mesh density

Since the magnetic particles are very closely located, their magnetic fields will influence each other. Due to the fact, that the magnetic stray field flattens out towards zero for large distances to the magnetic particles, a huge airspace must be considered. In this contribution, the airspace is taken into account in two different ways. Firstly, a reference solution was generated using the truncation method. Therefore, the FEM is applied to approximate the whole boundary value problem as sketched in Fig. 3, i.e. the airspace and the magnetic inclusions. Secondly, the static condensation is applied to the outer domain of the boundary value problem given in Fig. 3. This means that the outer domain is reduced onto the border of the interior domain , so that no further discretization of is required. Hence, the area to simulate is reduced to . The aim is to verify that both results match and to evaluate the performance of both methods. For the following calculations, identical magnetic properties are assigned to the magnetic inclusions, i.e. \(\mu ^\mathrm{mat}=1.25\cdot 10^{5}\) (ng \(\mu \)m)/ (A\(^2\) \(\mu \)s\(^2\)). The free space is considered to be vacuum with \(\mu ^\mathrm{air}=\mu _0\) being the magnetic vacuum permeability. The material behavior is approximated by a linear material model. Different numbers of degrees of freedom are assigned to the inner and outer domain. The much smaller inner domain has almost 9,000 degrees of freedom, while the outer domain has over 70,000 degrees of freedom. This corresponds to a total number of approximately 80,000 degrees of freedom in the overall system. Of course, the reference simulation provides results for the entire area, but since the outer space is very large, only a fraction of the boundary value problem is used for graphical representation. The cut out used for graphic processing includes the magnetic inhomogeneities and is shown below in Fig. 4.

Due to the close position of the inclusions to each other, the field lines corresponding to show a strong swirling of the fluctuation field around the inclusions, as shown in Fig. 5a. In contrast to the fluctuation field , the external magnetic field is a spatially constant distributed quantity. It has the same amplitude in every spatial point of the observed area . The external magnetic potential \({{\overline{\varphi }}}\) delivers a linear distribution over . For this reason, the external magnetic field is not shown graphically. Since the fluctuation field evolves cloud-like and the external field is constant, the entire magnetic field also changes spatially. The magnetic field is derived from the entire potential \(\varphi = {\widetilde{\varphi }}+{{\overline{\varphi }}}\). Hence, Fig. 5b presents the potential \(\varphi \) as a coloured contour plot and the derived magnetic field as streamlines.

Fig. 5
figure 5

Contour plot of a) the fluctuation potential \({\widetilde{\varphi }}\) and the streamline plot of and b) the bulk potential \(\varphi = {{\overline{\varphi }}} + {\widetilde{\varphi }}\) and the streamline plot of on the domain depicted in Fig. 4

Fig. 6
figure 6

Reduced boundary value problem with a) the considered area where the lines indicate the intersections A-A and B-B and b) the corresponding mesh density. Contour plots of the reduced domain of c) the fluctuation field \({\widetilde{\varphi }}\) and the streamline plot of and d) the bulk field \(\varphi = {{\overline{\varphi }}} + {\widetilde{\varphi }}\) and the streamline plot of

Fig. 7
figure 7

a) Shows the discrete values of the fluctuation potential \({\widetilde{\varphi }}\) along the intersection A-A, while b) presents the discrete values of the fluctuation field \({{\widetilde{H}}}_2\) along the intersection B-B. Solutions obtained by calculations over the whole domain (see Fig. 3) are presented as solid lines and the solutions of the reduced domain (Fig. 6) are given as circular points

The results of the reduced simulation must be identical to those of the reference solution within the internal domain . Since the outer space has already been taken into account in the preliminary static condensation, the domain to discretize with finite elements reduces to , compare Fig. 6. Therefore, the plots in Fig. 6 c and d only show the evolution of the magnetic potentials (\({\widetilde{\varphi }}\) and \(\varphi \)) and the corresponding fields ( and ) for the inner domain . Similar to Fig. 5, the corresponding potentials are shown as coloured contour plots and the derived magnetic fields are superimposed as stream plots. It is obvious that these variables behave analogously to those from the simulation that was calculated previously. The magnetic inclusion coloured in red in Fig. 6 a and b is responsible for most of the turbulence in the illustrations. However, the influences of the adjacent inclusions ( and ) are also clearly visible, since they were previously taken into account by the static condensation. The comparison of the potentials and fields presented in Figs. 5 and 6 already confirms a very good agreement of the observed quantities within the reduced domain. In order to emphasize the accuracy of the proposed method, discrete values of the reference solution (whole domain) and the solution obtained on the boundary value problem defined by only the interior domain, are taken along the marked intersection lines A-A and B-B (compare Fig. 6), see Fig. 7. The plots of the discrete values below are congruent and confirm the accuracy of the proposed scheme.

Fig. 8
figure 8

The population of the stiffness matrix corresponding to the full FEM solution is presented in a) together with the stiffness matrix corresponding to the reduced calculation marked by a red frame. The population of the reduced stiffness matrix is also presented in b) as a scaled plot

A characteristic of classic FEM stiffness matrices is a sparsely populated band structure. This is in complete contrast to the stiffness matrices of the reduced systems, which are typically fully or very densely populated matrices. In Fig. 8 both types of matrices are shown. In order to emphasize the differences between these two matrix types, the sparsely populated matrix of the pure FEM calculation is shown together with the significantly smaller, but dense, reduced matrix in Fig. 8a. The reduced matrix can also be seen in scaled size in Fig. 8b.

In order to evaluate the performance of the presented method against the reference simulation, the times required for solving the system of equations are compared. All following calculations are done using a standard laptop with an i5 processor and 16 GB of RAM. The system of equations described above was reduced in less than ten seconds. Since the reduction of the outer space was carried out as a preliminary calculation, it does not affect the actual solution procedure of the finite element simulation. Hence, the time needed for the reduction procedure is not included in the timing. Time savings are particularly noticeable in dynamic calculations, therefore the magnetic field applied to the boundary value problem described above is increased from zero to \({\overline{H}}_2\) within 100 load steps. Since the system of equations is solved repeatedly, the time difference adds up. The results obtained for both the reduced and the full FEM simulation are presented in Table 3. A large difference in time and therefore a significant gain of efficiency is obtained.

Although the performance advantage can already be seen for the linear simulations, the reduction will probably be of even greater advantage, especially for nonlinear and time-dependent calculations that require the consideration of an external area. In the case of a nonlinear simulation, several Newton iterations are usually required to solve the existing system of equations. Since each individual iteration takes longer for large systems of equations compared to reduced ones, the time savings for serial evaluations of systems of equations, as it is the case with time-dependent problems, are obvious. At this point, the same boundary value problem as utilized for the linear case is used, but the nonlinear material behavior, which is introduced in Sect. 4, is considered in \({\mathcal {B}}_{3}^\mathrm{int}\). Similar to the previous simulations, a reference solution is created with the truncation method, which is compared to the reduced method afterwards. For this purpose, the external magnetic field \({\overline{H}}_2\) is increased within 100 load steps in the y direction. The required times of the truncation and the reduced method for solving the systems of equations serially are given in Table 4.

Table 3 Required times for solving the linear system of equations
Table 4 Required times for solving the nonlinear system of equations
Fig. 9
figure 9

The test setup for the analysis of the reduction method in three dimensions. A magnetic, dodecahedral inclusion \({\mathcal {B}}^\mathrm{int}_{2}\) is surrounded by free space \({\mathcal {B}}^\mathrm{int}_{1}\). The full FEM discretization also considers an extended exterior domain \({\mathcal {B}}^\mathrm{ext}\). The results are plotted for the volume framed by the blue line

Table 5 Comparison of radii and degrees of freedom
Fig. 10
figure 10

Contour plots of a) the fluctuation potential, b) the fluctuation field \({{\widetilde{H}}}_2\) with streamlines and c) the magnetic induction \(B_2\) with streamlines

6 3D stray field calculation with homogeneous exterior domain

The method presented above cannot only be applied to two-dimensional boundary value problems, but also to three-dimensional problems. Since large extended domains in three dimensions can lead to extremely large systems of equations, their reduction is particularly useful. In this example, a magnetic dodecahedron-shaped grain is treated by an externally applied magnetic field \({\overline{H}}_2\) = 795.78 \(\cdot 10^{-3}\) A/ \(\mu \)m within a free space. The considered outer domain possesses a radius of 1000 \(\mu \)m, while the radius of the inner domain is 150 \(\mu \)m. The magnetic inclusion has an approximated radius of 70 \(\mu \)m. In this example, the domains and are considered to represent vacuum, while a permeability of \(\mu ^\mathrm{mat}=1.25\cdot 10^{5}\) (ng \(\mu \)m)/ (A\(^2\) \(\mu \)s\(^2\)) is assigned to the magnetic inclusion. The exact geometry, including the dimensions, can be found in Fig. 9. The radii of the extended outer domain , as well as of the inner domain are presented in Table 5 with the corresponding numbers of degrees of freedom within the domains and on the surfaces. By means of this comparison, the size difference between the two systems is emphasised.

Because a single inclusion is considered to be placed within a free space of vacuum, no adjacent sources of interference are obtained. Therefore, the externally applied field only generates a reaction within the magnetic inclusion , so that the magnetic potentials (\({\widetilde{\varphi }}\) and \(\varphi \)) and fields ( and ) can propagate without being disturbed. Since the results of the static condensation show good agreement with those of the truncation method, only the field curves in the reduced area are shown below. The fluctuation potential shown in Fig. 10a shows the typical cloud-like curves. Hence, the fluctuation field in Fig. 10b results in a spatially nonlinear distribution. Thus, the overall magnetic field in Fig. 10c also results in a spatially nonlinear distribution, which is particularly pronounced within the area of the inhomogeneity.

Table 6 Required times for solving the system of equations
Fig. 11
figure 11

The population of the stiffness matrix corresponding to the full FEM solution is presented in a) together with the stiffness matrix corresponding to the reduced calculation marked by a red frame. The population of the reduced stiffness matrix is also presented in b) as a scaled plot

To determine the time gain of a dynamic simulation through static condensation, the magnetic field is increased within 100 load steps, from zero to the maximum field strength of \({\overline{H}}_2\). Both simulations are timed and the results are compared in Table 6. The time advantage of the reduced simulation with a factor of 4.66 compared to the full FEM calculation is obvious. For larger systems an increase in time for the static condensation can be seen. However, the time spent for this calculation can be made up quickly, especially with dynamic simulations. That means, a reduction in three dimensions can also be worthwhile, if results in the outer space are not necessarily required.

Analogously to the two-dimensional FEM, the three-dimensional FEM also results in sparsely populated stiffness matrices. Since the reduced matrix is very densely populated, this advantage is lost through the static condensation of the outer domain onto the boundary of the interior domain as in the two-dimensional case. However, this disadvantage will be counterbalanced by the advantage of a significantly smaller reduced stiffness matrix. To illustrate the size differences, a comparison of the two matrices can be found in Fig. 11.

7 Conclusion and outlook

In the present work a method for the consideration of large, heterogeneous, unbounded domains in nonlinear finite element analyses of magnetostatic problems was presented. Compared to established methods such as the BEM or the SBFEM, this way of reducing the external space allows us to take interferences outside the reduced area into account. Due to the static condensation of the outer space, the system stiffness matrix is no longer sparsely populated, but very dense. However, with clever reduction it can be orders of magnitude smaller than the stiffness matrix of the pure FEM. Several numerical examples were used to illustrate the advantages of the statically condensed systems over a full FEM discretization of the exterior domain. For both linear and nonlinear material behavior in the reduced area, large differences in the required computing times of the proposed method and a pure FEM simulation have been observed. Since the method presented is a general scheme for representing external spaces, it can also be applied to other subject areas that are not necessarily related to magnetism.