1 Introduction

This chapter deals with PDE-constrained topology and shape optimization and is motivated by a concrete application from electrical engineering, namely the design optimization of an electric motor. The goal is to identify an admissible subset Ω of the design region Ωd of the motor which yields the best possible performance of the motor. The performance is measured by a functional J which is related to the smoothness of the rotation or to the torque of the motor. In shape optimization, the domain can be modified by a smooth deformation of the boundary, whereas the topology optimization methods can also alter the connectivity of the domain by, e.g., introducing new holes.

In contrast to optimal control problems, here the set of admissible controls is a set of subsets of \(\mathbb R^d\), which does not admit a vector space structure. Nevertheless, we will use the notions of derivatives of the objective functional J with respect to the control variable Ω: On the one hand, the shape derivative represents the sensitivity of a domain-dependent functional with respect to a smooth variation of the boundary of this domain whereas, on the other hand, the topological derivative is the sensitivity of the functional with respect to a topological perturbation of the set Ω, i.e., with respect to the introduction of a hole in its interior. Starting out from an initial design, these sensitivities can be used to successively update the shape and topology of the control Ω in order to reach an optimal design. In our case, the set Ω is a subset of the computational domain D representing the motor, and its boundary ∂Ω represents a material interface, e.g., the interface between a ferromagnetic region and an air region of the motor. Both the shape derivative and the topological derivative of this PDE-constrained optimization problem involve the solution to the state equation u and the solution to the adjoint equation p. In a numerical algorithm, these quantities must be computed approximately in each iteration, which is often done by a finite element method. In order to obtain accurate approximations uh, ph to the state and adjoint variable, one has to take care of the material interface between the different subdomains. This interface evolves over the iterations of the algorithm and is, in general, not aligned with the underlying finite element mesh.

This book chapter is meant to give an overview over various aspects of topology and shape optimization approaches and many details and proofs are omitted. For more details and more mathematical rigor, we refer the interested reader to [20]. The rest of this chapter is organized as follows: The design optimization problem for the electric motor, which serves as a model problem throughout this chapter, is introduced in Section 2. In Section 3, we give an overview over established topology optimization methods and demonstrate the main steps in the derivation of the topological derivative for the optimization problem at hand, which is constrained by a quasilinear PDE constraint. Section 4 deals with shape optimization and we will derive the shape derivative for our problem. In Section 5, we give an overview over possible ways to treat moving interfaces in the context of finite elements, before combining all of these techniques to an efficient design tool in Section 6, where we will also give numerical optimization results.

2 Problem Description

We consider an interior permanent magnet electric motor as depicted in Figure 1 which consists of a fixed outer part (called the stator) and a rotating inner part (the rotor). The stator contains coils where alternating electric current is induced and the rotor holds permanent magnets which are magnetized in the directions indicated in Figure 1. Both parts contain a ferromagnetic subdomain and they are separated by a thin air gap. A rotation of the rotor occurs due to the interaction between the magnetic fields produced by magnets and the electric currents in the coils. As it is common for the simulation of electric motors at constant rotation speed, we consider the setting of two-dimensional magnetostatics. There, the magnetic flux density B is given as \(\mathbf B = \mbox{curl}\left ((0,0,u)^\top \right )\) where u solves the quasilinear boundary value problem

$$\displaystyle \begin{aligned} -\mbox{div}\, \left( \nu_{\varOmega}(x,|\nabla u|)\nabla u \right) &= J_3 - \nu_{0} \mbox{div}\, M^\perp, && x \in D, \end{aligned} $$
(1a)
$$\displaystyle \begin{aligned} u&=0, && x \in \partial D, \end{aligned} $$
(1b)

on a circular hold-all domain D where J3 denotes the currents impressed in the coil areas and M is the perpendicular of the permanent magnetization in the magnets. Here, Ω ⊂ Ωd denotes the unknown subset of the design region that is occupied with ferromagnetic material, and the magnetic reluctivity νΩ is a nonlinear function \(\hat {\nu }\) in the ferromagnetic subdomain and a constant ν0 in the rest of the motor,

$$\displaystyle \begin{aligned} \nu_{\varOmega}(x, s) = \begin{cases} \hat{\nu}(s), & x \in \varOmega_f,\\ \nu_0, & x \in D \setminus \varOmega_f. \end{cases} \end{aligned} $$
(2)

Here, Ωf consists of the fixed ferromagnetic domain \(\varOmega _f^{fix}\) outside the design region Ωd and the variable ferromagnetic subset of the design region Ω ⊂ Ωd, i.e., \(\overline {\varOmega _f} = \overline {\varOmega _f^{fix}} \cup \overline {\varOmega }\), see Figure 1. Note that, in general, the nonlinear function \(\hat {\nu }\) is not known in a closed form but is usually approximated from measured values, see [28].

Fig. 1
figure 1figure 1

Left: computational domain D representing electric motor with different subdomains. Right: zoom on upper left quarter (for a different rotor-to-stator constellation) with design region Ωd and fixed ferromagnetic set \(\varOmega _f^{fix}\). For a given design Ω ⊂ Ωd, we have \(\overline {\varOmega _f} = \overline {\varOmega _f^{fix}} \cup \overline {\varOmega }\)

The magnetic reluctivity νΩ, which is the reciprocal of the magnetic permeability μΩ, is much larger in the air subdomains compared to the ferromagnetic subdomains of the motor. Therefore, the distribution of ferromagnetic material inside the design area Ωd (i.e., the shape and topology of the unknown set Ω) influences the magnetic flux density B in Ωd and also in the rest of the motor. The magnetic flux density B inside the air gap between rotor and stator has a big impact on the behavior of the rotation of the motor. The goal of the optimization problem is to identify a subset Ω which minimizes the objective function J that is related to the smoothness of the rotation of the motor. The functional J depends on the magnetic flux density B in the air gap and will be introduced later in Section 6. The PDE-constrained design optimization problem reads

$$\displaystyle \begin{aligned} \begin{array}{rcl} &\displaystyle \underset{\varOmega}{\mbox{min}}\, J(u, \varOmega) \end{array} \end{aligned} $$
(3a)
$$\displaystyle \begin{aligned} \begin{array}{rcl} &\displaystyle \mbox{subject to}\; u \in H_0^1(D): \int_D \nu_{\varOmega}(x, |\nabla u|) \nabla u \cdot \nabla \eta \, \mbox{d}x = \langle F, \eta \rangle \quad \forall \eta \in H_0^1(D),\qquad {} \end{array} \end{aligned} $$
(3b)

where (3b) is the weak form of boundary value problem (1) with F ∈ H−1(D) given by

$$\displaystyle \begin{aligned} \langle F , \eta \rangle = \int_D J_3 \, \eta + \nu_{0} \, M^\perp \cdot \nabla \eta \, \mbox{d} x, \; \eta \in H_0^1(D). \end{aligned}$$

Remark 1

In applications of electric motors, the functional J is usually supported only in the air gap between the rotor and the stator. Since the design areas are part of the rotor, we assume that J does not depend on Ω directly, but only via the state variable u, J = J(u) ≠ J(u, Ω). Furthermore, we introduce the reduced functional \(\mathcal J(\varOmega ) = J(u(\varOmega ))\) where u(Ω) is the solution to (3b) for given Ω.

3 Topology Optimization

In this chapter, we employ a topology optimization algorithm which is based on the topological derivative. Beside this approach, there exist a number of other approaches to topology optimization. We give an overview over the most widely used methods in Section 3.1 before coming to the derivation of the topological derivative for the problem at hand in Section 3.2.

3.1 Overview of Topology Optimization Methods

The concept of topology optimization originates from applications in mechanical engineering but has been applied to a large variety of other applications such as fluid dynamics, acoustics, or electromagnetics. This section is meant to give a brief overview over the most common methods of topology optimization. For a more detailed discussion of the single approaches, we refer the reader to the review articles [14, 29, 34] and the references therein.

The starting point of numerical topology optimization is widely considered to be the seminal paper by Bendsøe and Kikuchi [9] introducing the homogenization method for topology optimization, followed by the paper [8], where Bendsøe introduced what is now known as the Solid Isotropic Material with Penalization (SIMP) method, giving rise to the large class of density-based methods.

3.1.1 Homogenization Method

The idea of the homogenization method is to represent a domain as a periodic microstructure (usually consisting of rectangular cells like a regular quadrilateral finite element grid) and then to find the optimal layout for each cell. Each of these cells is considered to consist of material and void regions (often a rectangular hole surrounded by solid material) and the dimensions and orientations of these holes are the design variables with respect to which the optimization is performed. Finally, one ends up with a perforated design which can be interpreted as a microstructure. A black-and-white structure can be obtained by setting those cells which are mostly occupied with material to solid, and the other cells to void. The method uses several degrees of freedom for each of the cells, resulting in a large number of degrees of freedom, which is considered a significant drawback of this method. For more details on the homogenization method, we refer the reader to the monograph [1] and the references therein.

3.1.2 Density Methods

In density-based approaches to topology optimization, a design can be represented by a function ρ which takes the value 1 in areas of material and the value 0 in void areas. We remark that, in applications of mechanical engineering, if ρ is 0, the elasticity tensor vanishes and the global stiffness matrix becomes singular. Therefore, it is common practice in density-based topology optimization of mechanical structures to replace the value of 0 by a small, but positive number ρmin > 0. The idea of density-based topology optimization approaches is to relax this strict 0–1 nature of the problem by allowing the function ρ to attain any value between 0 and 1. The function ρ is called a density variable. In order to enforce a 0–1 structure of the final design, the idea of [8] is to combine this idea with a penalization of intermediate density values, i.e., to replace the density function ρ in the state equation (and only there) by a penalized version of the density, \(\tilde {\rho }(\rho ) = \rho ^p\) for some p > 1. In combination with a constraint on the volume of the arising structure, the algorithm favors the use of “black” and “white” regions, i.e., regions where ρ = 1 and ρ = 0, respectively, because intermediate values “give very little stiffness at an unreasonable cost” [8]. As remarked in [29], a constraint which limits the volume is important for this penalizing effect to appear. The method described in [8] together with the choice \(\tilde {\rho }(\rho ) = \rho ^p\) for some p > 1 became well known as the SIMP method. We remark that the method is sensitive with respect to the value of p and that good results are usually obtained by using p = 3 or by gradually increasing the parameter from p = 1 to higher values in the course of the optimization procedure [29].

While the penalization of intermediate density values yields designs with a 0–1 structure, these problems usually lack existence of a solution, a fact which often results in a mesh dependence of the optimized designs. For a detailed survey on the numerical problems resulting from the ill-posedness of such problems, we refer the reader to [30]. The most widely used approach to regularizing these ill-posed problems is by applying a filter to the density variable ρ. This means that one replaces the actual density at a point by an average over the density values in a neighborhood of a certain radius R, called the filter radius. Other approaches include a filtering of the sensitivities, adding a bound on the perimeter of the arising structure or on the gradient of the density variable ρ, see [29, 30].

A more detailed overview of density-based topology optimization methods can be found in, e.g., [10, 29].

3.1.3 Phase-Field Method

The phase-field method for topology optimization is a density-based method using a linear material interpolation, \(\tilde {\rho }(\rho ) = \rho \). A regularization is achieved by adding a term to the cost functional which approximates the total variation of the density variable. This term is a Cahn-Hilliard type functional, which itself is a weighted sum of two terms. One of these two terms causes a regularizing effect whereas the other term penalizes intermediate density values. We mention that the choices of the weighting factor between these two parts, as well as the weight of the Cahn-Hilliard type functional relative to the objective function, are often crucial for obtaining good results. The phase-field method has been applied to many topology optimization problems, see, e.g., [12, 22].

3.1.4 Level Set Methods

In the level set method [27], a material interface is represented by the zero level set of an evolving function ψ = ψ(x, t) which attains positive values in one subdomain and negative values in the other. The evolution of ψ is given by the solution to the Hamilton-Jacobi equation

$$\displaystyle \begin{aligned} \frac{\partial}{\partial t} \psi + V \cdot \nabla \psi = 0, \end{aligned}$$

where t is a pseudo-time variable and V  determines the direction of the evolution. In applications from shape optimization, this vector field is given according to shape sensitivities. For a thorough overview over level set methods, we refer the reader to the review papers [29, 34].

3.1.5 Topological Derivative

The concept of the topological derivative was introduced in [17] as a means to allow for changes of the topology in the course of a classical shape optimization method. The topological derivative of a domain-dependent functional at an interior point of the domain describes its sensitivity with respect to the introduction of a hole around that point. We will deal with the topological derivative in detail in Section 3.2.

3.2 Topological Derivative for Nonlinear Magnetostatics

The topological derivative of a domain-dependent functional \(\mathcal J = \mathcal J(\varOmega )\) was introduced in a mathematically rigorous way in [31]. Given a domain Ω, an interior point x0 ∈ Ω, and a bounded domain ω which contains the origin, let ωε = x0 + εω represent the hole of radius ε around x0 and let \(\varOmega _{\varepsilon } := \varOmega \setminus \overline \omega _{\varepsilon }\) denote the perturbed domain. Then, the topological derivative of \(\mathcal J\) at the point x0 is defined as the quantity G(x0) satisfying a topological asymptotic expansion of the form

$$\displaystyle \begin{aligned} \mathcal J(\varOmega_{\varepsilon}) - \mathcal J(\varOmega) = f(\varepsilon)\, G(x_0) + o(f(\varepsilon)), \end{aligned}$$

where f is a positive function which tends to zero with ε, most often f(ε) = εd with d the space dimension. In many situations such as in the context of electromagnetics, one is not interested in a perturbation of the domain where a hole is excluded from the computational domain, but rather in a local perturbation of a material coefficient. In fact, in the context of magnetostatics, introducing a “hole” in the ferromagnetic subdomain corresponds to the introduction of a different material, namely air. Then, one is interested in an expansion of the form

$$\displaystyle \begin{aligned} J_\varepsilon(u_{\varepsilon}) - J_0(u_0) = f(\varepsilon) \, G(x_0) + o(f(\varepsilon)). \end{aligned} $$
(4)

Here, uε is the solution to the state equation where the material coefficient is perturbed within a radius ε around x0, and u0 is the solution to the unperturbed state equation. Likewise, Jε and J0 denote the objective functional in the perturbed and unperturbed configuration, respectively. We remark that this interpretation is possible in the context of electromagnetics where air is just a different material with a different, positive material coefficient, whereas in mechanical engineering an inclusion of void would lead to a loss of the ellipticity of the perturbed bilinear form.

It can be seen from the expansion (4) that, at points x0 where G(x0) < 0, for ε > 0 small enough, the objective value for the perturbed configuration is smaller than that in the unperturbed configuration, Jε(uε) − J0(u0) < 0. Thus, in order to minimize a given functional J, it is beneficial to change the material in areas where the topological derivative is negative. Using this information for the iterative introduction of holes at the most favorable positions is one possible topology optimization algorithm using the topological derivative. A different algorithm that is based on the topological derivative is the level set algorithm introduced in [5]. As opposed to the classical level set method for shape optimization, the updates are based on the topological derivative rather than on the shape derivative. Therefore, this algorithm can also nucleate new holes in the interior. More details on the algorithm can be found in [4].

3.2.1 Preliminaries

We show the main steps in the derivation of the topological derivative according to (4) in the context of two-dimensional magnetostatics. We consider a simplified version of the PDE constraint (3b) where, in the unperturbed configuration, the entire computational domain is occupied with ferromagnetic material. Let F ∈ H−1(D) denote the sources on the right-hand side of the PDE constraint and let Ωd denote the design subdomain which we assume to be compactly contained in D ∖supp(F), i.e., Ωd ⊂⊂ D ∖supp(F). Let x0 ∈ Ωd denote a fixed interior point around which the material coefficient is perturbed. Given a smooth bounded domain ω containing the origin, which represents the shape of the material perturbation, let ωε = x0 + εω for small ε > 0. Then, the ferromagnetic subdomain in the perturbed configuration is given by \(\varOmega _{\varepsilon } = \varOmega \setminus \overline {\omega }_{\varepsilon }\). For ε > 0 and \(W \in \mathbb R^2\), we define

$$\displaystyle \begin{aligned} T(W) = \hat{\nu}(|W|) W \quad \mbox{ and } \quad T_{\varepsilon}(x,W) = \nu_{\varOmega_{\varepsilon}}(x,|W|) W , \end{aligned}$$

where \(\nu _{\varOmega _\varepsilon }\) is defined according to (2). For the rest of this chapter, we will use ω = B(0, 1) the unit disk in \(\mathbb R^2\). For more details about a possible extension of the results to ellipse-shaped inclusions, see [20].

Let ε > 0 small enough such that ωε ⊂ Ωd. Using the notation introduced above, the state equation in the unperturbed and in the perturbed setting read

$$\displaystyle \begin{aligned} \begin{array}{rcl} \mbox{Find } u_0 \in H_0^1(D): \; \int_{D} T( \nabla u_0) \cdot \nabla \eta \,\mbox{ d} x &\displaystyle =&\displaystyle \langle F, \eta \rangle \; \forall \eta \in H_0^1(D), {} \end{array} \end{aligned} $$
(5)
$$\displaystyle \begin{aligned} \begin{array}{rcl} \mbox{Find } u_{\varepsilon} \in H_0^1(D): \; \int_{D} T_{\varepsilon}(x, \nabla u_{\varepsilon}) \cdot \nabla \eta \,\mbox{ d} x &\displaystyle =&\displaystyle \langle F, \eta \rangle \; \forall \eta \in H_0^1(D), {} \end{array} \end{aligned} $$
(6)

respectively. Note that the right-hand sides coincide since we assumed that x0 ∈ Ωd ⊂⊂ D ∖supp(F). We will be interested in the behavior of the difference between the solution to these two boundary value problems in terms of ε. By subtracting (5) from (6), we get the boundary value problem defining the variation of the direct state \(\tilde u_\varepsilon := u_{\varepsilon } - u_0\),

$$\displaystyle \begin{aligned} \begin{array}{rcl} \begin{aligned} {} \mbox{Find } \tilde{u}_{\varepsilon} \in H^1_0(D): \int_{D} &\displaystyle ( T_{\varepsilon}(x,\nabla u_0 + \nabla \tilde{u}_{\varepsilon}) - T_{\varepsilon}(x,\nabla u_0) ) \cdot \nabla \eta \, \mbox{d} x\\ &\displaystyle =- \int_{\omega_{\varepsilon}}(\nu_0 - \hat{\nu}(|\nabla u_0|)) \nabla u_0 \cdot \nabla \eta \, \mbox{d} x \quad \forall \eta \in H^1_0(D). \end{aligned} \end{array} \end{aligned} $$
(7)

Furthermore, for simplicity, we assume that the objective functional is the same in the perturbed and in the unperturbed configuration, Jε = J0 = J. Note that this is satisfied for functionals which are supported only outside the design area like in the case of electric motors, cf. Remark 1. For deriving the topological derivative, we make the following assumption on the objective function:

Assumption 1

For ε > 0, there exist\(\tilde G \in H^{-1}(D)\)and\(\delta _J \in \mathbb R\)such that

$$\displaystyle \begin{aligned} J(u_\varepsilon) - J(u_0) = \langle \tilde G, u_\varepsilon - u_0 \rangle + \delta_J \, \varepsilon^2 + o(\varepsilon^2). \end{aligned} $$
(8)

Note that this assumption is satisfied, e.g., for quadratic functionals which are supported only outside the design region.

Moreover, we introduce the following adjoint equations in the unperturbed and perturbed configurations:

$$\displaystyle \begin{aligned} \begin{array}{rcl} \mbox{Find } p_{0} \in H^1_0(D): \; \int_D \mathrm{D}T(\nabla u_0) \nabla p_{0} \cdot \nabla \eta \mbox{d} x &\displaystyle =&\displaystyle - \langle \tilde G, \eta \rangle \; \forall \eta \in H_0^1(D), \\ \mbox{Find } p_{\varepsilon} \in H^1_0(D): \; \int_D \mathrm{D}T_{\varepsilon}(x,\nabla u_0) \nabla p_{\varepsilon} \cdot \nabla \eta \mbox{d} x &\displaystyle =&\displaystyle - \langle \tilde G, \eta \rangle \; \forall \eta \in H_0^1(D). {} \end{array} \end{aligned} $$
(9)

Here, \(\tilde G\) is according to Assumption 1 and DT, DTε denote the Jacobians of the operators T, Tε, respectively. Also here, we introduce the difference between the solutions to the two problems above, called the variation of the adjoint state \(\tilde p_\varepsilon := p_{\varepsilon } - p_{0}\), which is the solution to

$$\displaystyle \begin{aligned} \begin{array}{rcl} \begin{aligned} \mbox{Find } \tilde{p}_{\varepsilon} \in H^1_0(D): \int_{D} &\displaystyle \mathrm{D}T_{\varepsilon}(x,\nabla u_0) \nabla \tilde{p}_{\varepsilon} \cdot \nabla \eta \, \mbox{d} x \\ &\displaystyle = -\int_{\omega_{\varepsilon}} (\nu_0 \, I - \mathrm{D}T(\nabla u_0) ) \nabla p_{0} \cdot \nabla \eta \, \mbox{d}x \quad \forall \eta \in H^1_0(D).{} \end{aligned} \end{array} \end{aligned} $$
(10)

For the rest of this section, we will drop the differential dx in the volume integrals as there is no danger of confusion.

3.2.2 Derivation of Topological Derivative

By virtue of Assumption 1, choosing f(ε) = ε2, it remains to show that there exists \(G_0 \in \mathbb R\) such that \(\langle \tilde G, \tilde {u}_{\varepsilon } \rangle = \varepsilon ^2 G_0 + o(\varepsilon ^2)\). Testing the perturbed adjoint equation (9) with \(\eta = \tilde {u}_{\varepsilon }\) and exploiting the symmetry of DTε, we get

$$\displaystyle \begin{aligned} \begin{array}{rcl} \langle \tilde G, \tilde{u}_{\varepsilon} \rangle &\displaystyle =&\displaystyle -\int_{D} \mathrm{D}T_{\varepsilon}(x,\nabla u_0) \nabla \tilde u_{\varepsilon} \cdot \nabla p_{\varepsilon} \\ &\displaystyle =&\displaystyle -\int_{D} \mathrm{D}T_{\varepsilon}(x,\nabla u_0) \nabla \tilde u_{\varepsilon} \cdot \nabla p_{\varepsilon} \\ &\displaystyle &\displaystyle + \int_{D} \left( T_{\varepsilon}(x, \nabla u_0 + \nabla \tilde{u}_{\varepsilon}) - T_{\varepsilon}(x,\nabla u_0) \right) \cdot \nabla p_{\varepsilon} \\ &\displaystyle &\displaystyle + \int_{\omega_{\varepsilon}}(\nu_0 - \hat{\nu}(|\nabla u_0|)) \nabla u_0 \cdot \nabla p_{\varepsilon}, \end{array} \end{aligned} $$

where we added the left- and right-hand side of (7) tested with η = pε. For ε > 0, \(V, W \in \mathbb R^2\), we introduce the operator

$$\displaystyle \begin{aligned} S^{\varepsilon}_{V}(x,W) := T_\varepsilon(x,V+W) - T_\varepsilon(x,V) - \mathrm{D}T_\varepsilon(x,V)W, {} \end{aligned} $$
(11)

which characterizes the nonlinearity of the operator Tε. Then, we get

$$\displaystyle \begin{aligned} \langle \tilde G, \tilde{u}_{\varepsilon} \rangle = \int_{\omega_{\varepsilon}}(\nu_0 - \hat{\nu}(|\nabla u_0|)) \nabla u_0 \cdot \nabla p_{\varepsilon} + \int_{D} S^{\varepsilon}_{\nabla u_0}(x,\nabla \tilde{u}_{\varepsilon}) \cdot \nabla p_{\varepsilon}. \end{aligned}$$

Noting that \(p_{\varepsilon } = p_{0} + \tilde {p}_{\varepsilon }\), and defining

$$\displaystyle \begin{aligned} \begin{array}{rcl} j_1(\varepsilon) &\displaystyle &\displaystyle := \int_{\omega_{\varepsilon}}(\nu_0 - \hat{\nu}(|\nabla u_0|)) \nabla u_0 \cdot ( \nabla p_{0} + \nabla \tilde{p}_{\varepsilon}), \\ j_2(\varepsilon) &\displaystyle &\displaystyle := \int_{D} S^{\varepsilon}_{\nabla u_0}(x,\nabla \tilde{u}_{\varepsilon}) \cdot ( \nabla p_{0} + \nabla \tilde{p}_{\varepsilon}), \end{array} \end{aligned} $$

we get from Assumption 1 that

$$\displaystyle \begin{aligned} J_{\varepsilon}(u_{\varepsilon}) - J_{0}(u_{0}) = j_1(\varepsilon) + j_2(\varepsilon) + \delta_J \varepsilon^2 + o(\varepsilon^2). \end{aligned}$$

In view of (4), it remains to show that there exist numbers J1, J2 such that

$$\displaystyle \begin{aligned} \begin{array}{rcl} j_1(\varepsilon) &\displaystyle =&\displaystyle \varepsilon^2 \, J_1 + o(\varepsilon^2), \quad \mbox{ and } {} \end{array} \end{aligned} $$
(12)
$$\displaystyle \begin{aligned} \begin{array}{rcl} j_2(\varepsilon) &\displaystyle =&\displaystyle \varepsilon^2 \, J_2 + o(\varepsilon^2). {} \end{array} \end{aligned} $$
(13)

Then, the topological derivative is given by G(x0) = J1 + J2 + δJ.

In what follows, we will first sketch the procedure to obtain the topological derivative in the case of a linear model, i.e., in the case where the nonlinear function \(\hat {\nu }\) introduced in (2) is replaced by a constant ν1 < ν0, before discussing the additional difficulties in the case of nonlinear material behavior in the ferromagnetic subdomain.

3.2.3 Linear Case

It can be seen from the definition of the operator Sε in (11) that, in the linear case, the second term j2(ε) vanishes. Thus, we only have to consider the term

$$\displaystyle \begin{aligned} \begin{array}{rcl} j_1(\varepsilon) &\displaystyle =&\displaystyle (\nu_0 - \nu_1) \int_{\omega_{\varepsilon}} \nabla u_0 \cdot ( \nabla p_{0} + \nabla \tilde{p}_{\varepsilon}) \\ &\displaystyle =&\displaystyle (\nu_0 - \nu_1) \int_{\omega_{\varepsilon}} \nabla u_0 \cdot \nabla p_{0}-\int_{D}\nu_\varepsilon \nabla \tilde{u}_{\varepsilon} \cdot \nabla \tilde{p}_{\varepsilon}, {} \end{array} \end{aligned} $$
(14)

where we used (7) with \(\eta = \tilde {p}_{\varepsilon }\) and introduced \(\nu _\varepsilon (x) = \chi _{D \setminus \omega _\varepsilon }(x)\,\nu _1 +\chi _{\omega _\varepsilon }(x)\, \nu _0 \) with χS denoting the characteristic function of a set S.

Assuming enough regularity for the unperturbed direct and adjoint state, it can be seen that, for the first term in (14), we have

$$\displaystyle \begin{aligned} (\nu_0 - \nu_1) \int_{\omega_{\varepsilon}} \nabla u_0 \cdot \nabla p_{0} = |\omega| \varepsilon^2 \, (\nu_0 - \nu_1)\, \nabla u_0(x_0) \cdot \nabla p_{0}(x_0) + o(\varepsilon^2) {} \end{aligned} $$
(15)

as ε approaches zero.

In order to treat the second term in (14), we define \(\tilde \nu (x) = \chi _{\mathbb R^2 \setminus \omega }(x) \nu _1 + \chi _{\omega }(x) \nu _0\) for \(x \in \mathbb R^2\), and introduce ε-independent approximations to boundary value problems (7) and (10). After a change of scale, we get the transmission problem defining the variation of the direct state at scale 1,

$$\displaystyle \begin{aligned} \begin{array}{rcl} &\displaystyle &\displaystyle \mbox{Find } H \in \mathcal H \mbox{ such that } \\ &\displaystyle &\displaystyle \int_{\mathbb R^2} \tilde \nu \, \nabla H \cdot \nabla \eta + (\nu_0 - \nu_1) \int_{\omega} \nabla u_0(x_0) \cdot \nabla \eta = 0 \quad \forall \eta \in \mathcal H,{} \end{array} \end{aligned} $$
(16)

approximating (7), and the problem defining the variation of the adjoint state at scale 1,

$$\displaystyle \begin{aligned} \begin{array}{rcl} &\displaystyle &\displaystyle \mbox{Find } K \in \mathcal H \mbox{ such that } \\ &\displaystyle &\displaystyle \int_{\mathbb R^2} \tilde \nu \, \nabla \eta \cdot \nabla K + (\nu_0 - \nu_1) \int_{\omega} \nabla p_{0}(x_0) \cdot \nabla \eta = 0 \quad \forall \eta \in \mathcal H, {} \end{array} \end{aligned} $$
(17)

as an approximation of (10), where \(\mathcal H\) is a suitable weighted Hilbert space over \(\mathbb R^2\). The solutions H, K are approximations to \(\tilde {u}_{\varepsilon }\) and \(\tilde {p}_{\varepsilon }\), respectively, at scale 1 and it holds

$$\displaystyle \begin{aligned} \tilde{u}_{\varepsilon}(x) \approx \varepsilon H(\varepsilon^{-1} x) \quad \mbox{and} \quad \tilde{p}_{\varepsilon}(x) \approx \varepsilon K(\varepsilon^{-1} x), \end{aligned}$$

for almost every x ∈ D. An important ingredient for deriving an expansion of the form (12) is to show that these ε-independent approximations of \(\tilde {u}_{\varepsilon }\) and \(\tilde {p}_{\varepsilon }\) have a sufficiently fast decay as |x| approaches infinity. This would imply that the impact of the local variation of the material is small “far away” from the inclusion. In the case of a linear state equation, this sufficiently fast decay can be established by convolution of the right-hand side of problems (16) and (17) with the fundamental solution of the Laplace equation. Exploiting these sufficiently fast decays allows us to show that

$$\displaystyle \begin{aligned} \int_{D}\nu_\varepsilon \nabla \tilde{u}_{\varepsilon} \cdot \nabla \tilde{p}_{\varepsilon} = \varepsilon^2 \int_{\mathbb R^2} \tilde \nu \, \nabla H \cdot \nabla K + o(\varepsilon^2), \end{aligned}$$

which, by means of (16) tested with η = K, together with the term (15), yields (12) with

$$\displaystyle \begin{aligned} J_1 = (\nu_0 - \nu_1)\int_{\omega} \nabla u_0(x_0) \cdot ( \nabla K + \nabla p_{0}(x_0) ) . \end{aligned}$$

It can be seen from (17) that K depends linearly on ∇p0(x0) and, therefore, J1 can be represented by means of a matrix \(\mathcal M\). Finally, in the linear case we get

$$\displaystyle \begin{aligned} \begin{array}{rcl} J_1 &\displaystyle =&\displaystyle \nabla u_0(x_0)^\top \, \mathcal M \, \nabla p_{0}(x_0), \\ J_2 &\displaystyle =&\displaystyle 0. \end{array} \end{aligned} $$

Here, \(\mathcal M = \nu _1 \mathcal P(\omega , \nu _0/\nu _1)\) where the matrix \(\mathcal P(\omega , \nu _0/\nu _1)\) only depends on the shape of the inclusion ω and the contrast ν0ν1 and is called a polarization matrix, see, e.g., [2]. Explicit formulas for these matrices are available if ω is a disk or ellipse in two space dimensions, or a ball or ellipsoid in three space dimensions, see also [2, 3]. We mention that in the case where ω is the unit disk in \(\mathbb R^2\), the polarization matrix in the linear setting reads

$$\displaystyle \begin{aligned} \mathcal P_{\omega, \nu_0/\nu_1} = 2 \,\pi \, \frac{\nu_0/\nu_1 -1}{\nu_0/ \nu_1+1} I, \end{aligned}$$

where I is the identity matrix. A more detailed derivation of the topological derivative in the linear setting can be found in [3].

3.2.4 Nonlinear Case

In the nonlinear case, the procedure to treat the term j1(ε) is similar. However, one big difference is that in the nonlinear setting a sufficiently fast decay of the variation of the direct state H cannot be shown by convolution, but other, more technical tools must be used, see [6, 20]. Furthermore, the term j2(ε) does not vanish here and an estimate of the type (13) has to be established. Under certain assumptions on the nonlinearity of the function \(\hat {\nu }\), this was done in [20]. If those assumptions on the ferromagnetic material are fulfilled, the result is the following:

Theorem 1 ([20])

Let ω = B(0, 1). Assume that the functional J fulfills Assumption 1 and that, for the unperturbed direct and adjoint state, it holds u0, p0 ∈ C1, β(D) for some β > 0. For\(V,W \in \mathbb R^2\), let\(\tilde S_V(x,W) = \chi _{\mathbb R^2 \setminus \omega }(x) \left ( T(V+W) -T(V) - \mathrm {D}T(V)W \right )\). Then, the topological derivative of the PDE-constrained optimization problem (3) according to (4) at point x0 ∈ Ωdreads

$$\displaystyle \begin{aligned} G(x_0)= \nabla u_0(x_0)^\top \mathcal M \nabla p_0(x_0) + \int_{\mathbb R^2} \tilde S_{\nabla u_0(x_0)}(x,\nabla H)\cdot (\nabla p_0(x_0) + \nabla K) + \delta_J \end{aligned} $$
(18)

with \(\mathcal M = \mathcal M(\omega , \mathrm {D}T(\nabla u_0(x_0)) ) \in \mathbb R^{2\times 2}\) and H and K being the variations of the direct and adjoint state at scale 1, respectively.

Remark 2

In order to make use of this formula in numerical optimization algorithms, the following aspects are treated in [20]:

  • An explicit formula for the matrix \(\mathcal M\) is computed. This matrix is related to the concept of polarization matrices.

  • The term

    $$\displaystyle \begin{aligned} J_2 =\int_{\mathbb R^2} \tilde S_{\nabla u_0(x_0)}(x,\nabla H)\cdot (\nabla p_0(x_0) + \nabla K) \end{aligned}$$

    seems to be computationally extremely costly since H depends on ∇u0(x0) via (16) and, thus, the (nonlinear) transmission problem (16) defining H would have to be solved for every point x0 in order to evaluate the term J2. This problem was overcome by exploiting a rotational invariance property of J2 with respect to a simultaneous rotation of the quantities ∇u0(x0) and ∇p0(x0). This property allows to precompute a range of typical values of J2 in a computationally expensive offline stage and to look up the precomputed values during the optimization procedure.

  • The formula of Theorem 1 represents the sensitivity of the objective function with respect to the introduction of an inclusion of air around a point x0. In order to be able to employ bidirectional optimization algorithms which are capable of both removing and reintroducing material at the most favorable positions such as the algorithm introduced in [5], also the topological derivative for the reverse scenario must be computed. We refer to these two topological derivatives as Gfair and Gairf.

4 Shape Optimization

In contrast to topology optimization, in shape optimization the connectivity of a domain is assumed to be fixed. Here, one is interested in finding the shape of a domain or subdomain which is optimal with respect to a given criterion by means of smooth variations of the boundary or of a material interface. In this section, we are concerned with finding the optimal shape of the ferromagnetic part Ω within the design area Ωd of the electric motor introduced in Section 2. An essential tool for gradient-based shape optimization is the notion of the sensitivity of a shape functional \(\mathcal J=\mathcal J(\varOmega )\) with respect to a smooth perturbation of the boundary of the shape Ω, called the shape derivative. A shape functional \(\mathcal J\) is said to be shape differentiable if the limit

$$\displaystyle \begin{aligned} d \mathcal J(\varOmega; V) = \underset{t \searrow 0}{\mbox{lim}} \frac{\mathcal J(\varOmega_t) - \mathcal J(\varOmega)}{t}\end{aligned} $$

exists and the mapping V ↦ \(d \mathcal J(\varOmega ;V)\) is linear and continuous with respect to the topology of \(C_c^\infty (D,\mathbb R^2)\). Here, Ωt = Tt(Ω) denotes the transformed domain under the flow Tt generated by a smooth vector field V .

We mention that there are two ways to define this flow given a smooth vector field V . In the perturbation of identity method, the transformation is given by Tt(X) = X + tV (X) for all \(X \in \mathbb R^d\) and t ≥ 0, whereas in the velocity or speed method, it is given as Tt(X) = x(t, X) with x(t, X) the solution to the initial value problem

$$\displaystyle \begin{aligned} \begin{array}{rcl} \frac{d}{d t} x(t, X) &\displaystyle =&\displaystyle V(x(t,X)), \quad 0<t<\tau,\\ x(0,X) &\displaystyle =&\displaystyle X, \end{array} \end{aligned} $$

which, for small τ > 0, has a unique solution, see [16, 32]. Note that, for simplicity, we assumed the vector field V  to be autonomous. We remark that both approaches are equivalent for the derivation of first-order shape derivatives but differ by an acceleration term in the case of second-order shape derivatives [16].

4.1 Representation of Shape Derivative

There are basically two ways how one can represent the shape derivative of a functional depending on a domain Ω: either as a distribution on the boundary ∂Ω which only depends on the normal component of the perturbation, called the Hadamard form, or in a more general volume form, also called the distributed shape derivative. If the shape Ω is regular enough, the Hadamard form can be rewritten as an integral over the boundary,

$$\displaystyle \begin{aligned} d \mathcal J(\varOmega; V) = \int_{\partial \varOmega} g_\varGamma \, V \cdot n \, \mbox{ d} s, {} \end{aligned} $$
(19)

with an integrable function gΓ. The volume form can be written as

$$\displaystyle \begin{aligned} d \mathcal J(\varOmega; V) = \int_{ \varOmega} g(V, \mathrm{D}V) \, \mbox{d} x, {}\end{aligned} $$
(20)

for some function g.

One obvious advantage of the boundary-based form (19) is that a descent direction V = −gΓn is readily available. However, in many situations this choice of V  might not be regular enough and has to be regularized. Furthermore, in many numerical procedures for shape optimization, it is not enough to have a descent direction that is only defined on the material interface and it has to be extended to a neighborhood or to the entire computational domain.

On the other hand, in the case where the shape derivative is given in the distributed form (20), the extraction of a descent direction V  such that \(d\mathcal J(\varOmega ; V)<0\) can also be achieved easily but requires the solution of an auxiliary boundary value problem of the form

$$\displaystyle \begin{aligned} \mbox{Find } V: b(V, W) = - d\mathcal J(\varOmega; W) \; \forall \, W, {}\end{aligned} $$
(21)

where V, W are elements of a suitable function space and b(⋅, ⋅) is a positive definite bilinear form on the same space. Obviously, a solution V  to (21) is a descent direction since \(d\mathcal J(\varOmega ; V) = - b(V,V) <0\). One benefit of the volume form is that it is more general, meaning that for shapes with lower regularity the distributed shape derivative (20) may be well defined whereas the Hadamard form (19) is not. A different aspect favoring the volume-based form (20) is concerned with numerical accuracy of the approximation of the shape derivative when the underlying state and adjoint equations are solved by the finite element method. In [24], the authors show that the finite element approximation to the volume-based form converges quadratically to the “true” shape derivative on the continuous level as the mesh size tends to zero, whereas the boundary-based form converges only linearly.

We mention that, in the case of the Hadamard form of the shape derivative (19), the auxiliary boundary value problem (21) with b(⋅, ⋅) defined on ∂Ω can be used to compute a regularized gradient descent velocity for the case where the choice V = −gΓn is not smooth enough.

A more detailed comparison between these two possible representations can be found in [25].

4.2 Shape Derivative for Nonlinear Magnetostatics

For the reasons mentioned above, we restrict ourselves to the shape derivative in its volume-based representation (20). The rigorous derivation of the shape derivative for the model problem involving the quasilinear PDE of two-dimensional magnetostatics, which was introduced in Section 2, can be found in [21]. There, the shape derivative was computed using the averaged adjoint method introduced in [33].

The shape derivative of the model problem (3) reads

$$\displaystyle \begin{aligned} \begin{array}{rcl} d\mathcal J(\varOmega;V) &\displaystyle =&\displaystyle - \int_{D} (J_3 \mbox{div}(V) + \nabla J_3\cdot V) p \,\mbox{d}x -\int_{\varOmega_{mag}} \nu_{0} \mathbb{P}'(0) \nabla p \cdot M^{\perp} \, \mbox{d} x \\ &\displaystyle &\displaystyle +\int_{D} \nu_\varOmega(x,|\nabla u|) \mathbb{Q}'(0)\nabla u\cdot \nabla p \,\mbox{d}x {} \\ &\displaystyle &\displaystyle -\int_{\varOmega_f} \frac{\hat{\nu}'(x,|\nabla u|)}{|\nabla u|} (D V^\top\nabla u \cdot \nabla u) (\nabla u\cdot \nabla p)\, \mbox{d}x, \end{array} \end{aligned} $$
(22)

where \(\mathbb {P}'(0)= (\mbox{div} \, V) I-\mathrm {D}V^\top \), \(\mathbb {Q}'(0)= (\mbox{div} \, V) I-\mathrm {D}V^\top -\mathrm {D}V\), \(I \in \mathbb R^{2\times 2}\) is the identity matrix, and \(u,p\in H^1_0(D)\) are the state and adjoint state, respectively.

5 Interface Handling

Both the topological derivative (18) and the shape derivative (22) involve the solution to the state equation (3b) and to the adjoint equation in the current configuration. These two quantities are usually computed approximately by means of the finite element method. In the course of the numerical optimization algorithm, the interface between the ferromagnetic and the air subdomain evolves. In order to get accurate solutions using standard finite element methods, this material interface must be resolved by the underlying mesh. We give an overview over the possible approaches to deal with evolving material interfaces in Section 5.1, before introducing our method in Section 5.2.

5.1 Finite Element Methods for Interface Problems

One way to deal with evolving interfaces in the context of finite elements is to create a new triangulation in each step of the algorithm, which is computationally very costly. Another approach, which is often used in shape optimization, is to start with a mesh that resolves the interface and to advect all nodes of the mesh in the direction of the descent vector field V  – provided that V  is defined on the whole computational domain. This procedure has the limitation that it does not allow for topological changes and can become problematic when more complex geometries with geometric constraints are involved, as it is the case for our model problem. Here, fixed parts of the electric motor like the circular air gap should not be altered under any circumstances.

The idea of the extended finite element method (XFEM) is to enrich the finite element basis by additional basis functions which are modified versions of the standard basis functions. The solution is seeked in the enriched space \(V_h^\varGamma = V_h \oplus V_h^x\) where Vh is a standard finite element space, and \(V_h^x\) the space of standard finite element functions which are supported at the interface, multiplied with a so-called enrichment function, see, e.g., [7, 19].

The idea of the immersed finite element method [26] is similar to that of the XFEM. However, rather than adding basis functions to the basis, existing basis functions of the finite element space which are supported across the interface are modified in such a way that the interface jump conditions are satisfied.

In the unfitted Nitsche method introduced in [23], a discontinuity or kink of the solution across an interface is enforced in a weak sense. This way of treating the interface conditions is often used in combination with XFEM, called the Nitsche-XFEM. In this method, just like in all other methods mentioned above, a crucial task is to establish stability of the method with respect to the location of the interface relative to the mesh. Generally, if an element of the underlying unfitted background mesh is cut by the interface very close to one of the vertices, the condition of the system becomes very bad. This issue is treated in the CutFEM [13], which is a stabilized version of the Nitsche-XFEM.

An alternative to these fixed mesh approaches is to modify the mesh and always work with a fitted discretization while still guaranteeing a certain quality of the mesh. We mention the deformable simplicial complex (DSC) method [15].

In [18], an interface finite element method on a fixed mesh is introduced where the interface is resolved by locally modifying the finite element basis functions. Optimal order of convergence and also, when choosing a special hierarchical basis, optimal conditioning of the system matrix are shown. We note that this parametric approach can be equivalently interpreted as a fitted finite element method where some of the mesh nodes close to the interface are moved in such a way that the interface is resolved by the mesh. In the next section, we will follow the approach of [18] and translate it to the case of triangular finite elements.

5.2 A Local Mesh Modification Strategy

We adapt the method presented in [18] for quadrilateral meshes to the case of piecewise linear finite elements on a triangular grid. Our method is based on the assumption that the mesh has a one-level hierarchy, i.e., that always four triangles of the mesh \(\mathcal T_h\) can be combined to one triangle of a coarser mesh \(\mathcal T_{2h}\). We will refer to this bigger triangle as a macro triangle and call \(\mathcal T_{2h}\) the macro mesh. Furthermore, we assume that each element of the macro mesh which is cut by the interface is intersected either in two distinct edges or in one vertex and the opposite edge. Note that this assumption can be enforced by choosing a fine enough macro mesh \(\mathcal T_{2h}\).

The idea of the method is the following: If a macro element is not cut by the material interface, it is left unchanged. For those macro elements which are cut by the interface in two distinct edges, two of the three vertices lying on the edges of the macro element are moved along these edges to the intersection points of the interface and the macro edge, see Figure 2. If necessary, the vertex lying on the third edge can be moved along that edge in order to avoid some angle to become too close to 180. The vertices of the macro element remain unchanged. Similarly, if the macro element is cut in one vertex and the opposite edge, the vertex lying on the intersected macro edge is moved to meet the intersection point and the other two vertices may be moved such that a maximum angle condition is satisfied. More details on this procedure can be found in [20] where also the optimal order of convergence of the finite element solution to the true solution in the L2(D) and in the H1(D) norm is shown.

Fig. 2
figure 2figure 2

Left: modification of one macro element that is cut by the material interface (blue). Right: mesh modification strategy for circular material interface

6 Numerical Optimization Results

In this section, we combine the results of Sections 3 and 4 and the method introduced in Section 5.2 to one efficient design tool. We describe the procedure in Section 6.1 before applying it to the model problem introduced in Section 2 in Section 6.2.

6.1 Combined Topology and Shape Optimization with Interface Handling

We present a two-stage algorithm where topology optimization is performed in the first stage in order to find the optimal connectivity of the design domain, followed by shape optimization in combination with the interface resolution method of Section 5.2 as a post-processing in order to obtain smoother designs.

In the first stage, topology optimization is performed using the level set algorithm [5]. In order to apply this algorithm, it is important to have the topological derivative for both directions, i.e., the sensitivity of the objective function with respect to the nucleation of a hole of air inside ferromagnetic material, Gfair, and the sensitivity for the creation of ferromagnetic material in an air region, Gairf.

The shape optimization is done by means of a gradient descent algorithm. Starting out from an initial design, the interface between the ferromagnetic and the air subdomain of the design area Ωd is moved a certain distance in a descent direction V  which was obtained from (21). The step size is chosen in such a way that a decrease of the objective functional is achieved. Note that, for the evaluation of the shape derivative on the right-hand side of (21), the state and adjoint equations have to be solved, which is done by the finite element method. In order to obtain accurate finite element solutions, the mesh modification strategy of Section 5.2 should be applied whenever the interface is updated.

The proposed optimization procedure is summarized in the following algorithm:

Algorithm 1

(Combined topology and shape optimization with interface handling)

  • Stage I: Apply the algorithm [ 5 ] to find an optimal topology.

  • Stage II: Use the final design of Stage I as an initial design and perform gradient-based shape optimization where for each solve of the state and adjoint equations, the local mesh adaptation strategy of Section 5.2 is applied.

A more detailed description of the algorithm can be found in [20].

6.2 Minimizing Total Harmonic Distortion

The goal of the model problem introduced in Section 2 was to achieve a smooth rotation of the rotor. This can be achieved by ensuring a smooth radial component of the magnetic flux density Br = B ⋅ n = ∇u ⋅ τ in the air gap between the rotor and the stator when the electric current is switched off (J3 = 0). Here, n and τ denote the unit normal and tangential vectors on a circular path in the air gap, respectively. For that purpose, we consider Br along this circular curve inside the air gap as a periodic signal and decompose it into its Fourier coefficients,

$$\displaystyle \begin{aligned} B_r(u)(\varphi) = \sum_{k=1}^\infty A_k \, \mbox{sin}\, (\omega \, k\, \varphi ) + B_k \, \mbox{cos} \, (\omega \, k \, \varphi ), \end{aligned} $$
(23)

where Ak, \(B_k \in \mathbb R\), φ ∈ [0, 2π], and ω denotes the number of pole pairs of the motor. In the motor introduced in Section 2, we have eight magnetic poles, thus ω = 4. Due to the geometry of the motor, the coefficients Ak are approximately zero and will be neglected. The total harmonic distortion (THD) measures the contributions of higher harmonics (i.e., k > 1) to the total signal, see [11]. For practical purposes, we only consider the first N = 20 harmonics. Then, the total harmonic distortion of Br reads

$$\displaystyle \begin{aligned} THD(B_r) = \sqrt{ \frac{ \sum_{k=2}^N B_k^2 }{\sum_{k=1}^N B_k^2} }, \end{aligned} $$

where the coefficients Bk are according to (23). The minimization of the THD filters out all higher harmonics. In order to make sure that the first harmonic does not become too small, we minimize the functional

$$\displaystyle \begin{aligned} J(u) = \frac{ THD(B_r(u))^2 }{ B_1(B_r(u)) }, \end{aligned} $$

where B1(Br(u)) denotes the coefficient B1 in (23). In our implementation, we computed the Fourier coefficients by a least square approach.

Figure 3 shows the evolution of the design by using Algorithm 1 starting from an initial design. The final design of Stage I obtained after a total of 47 iterations is approximated by an explicit polygonal interface, which serves as an initial guess for the shape optimization. The final design after the shape optimization procedure together with the local mesh modification strategy introduced in Section 5.2 can be seen in the bottom row of Figure 3. Figure 4 shows the curve Br for the initial and the final design of both stages of the optimization procedure, and Figure 5 the final design together with the magnetic field.

Fig. 3
figure 3figure 3

Top left: initial design. Top right: design after two iterations of topology optimization by algorithm [5]. Center left: final design of topology optimization after 47 iterations. Center right: initial design for shape optimization by approximation of topology optimization result. Bottom left: final design of shape optimization with mesh adaptation strategy after 10 iterations. Bottom right: zoom on modified mesh

Fig. 4
figure 4figure 4

Radial component of magnetic flux density along the air gap for initial and final designs. Left: Stage I (topology optimization). Right: Stage II (shape optimization)

Fig. 5
figure 5figure 5

Final designs after Stage II together with magnetic field lines

7 Conclusion

This book chapter was motivated by a concrete application from electrical engineering, the design optimization of an electric motor. We addressed the problem by a two-stage algorithm. In the first stage, we used a topology optimization approach which is based on the mathematical concept of the topological derivative. Here, the derivation and efficient implementation of the topological derivative for the optimization problem at hand, which is constrained by a nonlinear PDE, turned out to be particularly challenging. The second stage of the global algorithm is a shape optimization algorithm where we additionally took care to accurately resolve the evolving material interfaces by means of a mesh modification strategy. Finally, we showed numerical results obtained by applying the introduced algorithm to find a motor design which exhibits very smooth rotation properties.