1 Introduction

We consider a coupled model described by the domain bounded in ℝ2 and decomposed into two sub-domains Ω and ω in such way that the interior sub-domain ω is surrounded by the exterior sub-domain Ω. In the interior sub-domain the physical phenomenon are described by the linear partial differential equation (PDE), and in the exterior domain the processes are governed by nonlinear PDEs subject to some external function. An example of such a system constitutes a gravity flow around an elastic obstacle. Here the Navier-Stokes equation, which is nonlinear, is coupled through transmission conditions with the linear static or dynamic elasticity system. Such situations have numerous physical interpretations. Let us mention here only two : the water flow around submarine or gas flow inside the jet engine. For real life models the coupling conditions are still a subject of research (Ignatowa et al. 2013).

In the paper we assume that the number and the radii of hollow voids are given, and we determine only the locations.

The topological derivative, introduced in Sokolowski and Zochowski (1999), and developed in the papers Sokolowski and żochowski 2003, 2005, 2008, was created specifically in order to asses the influence of voids or inclusions on the solutions of PDE’s. The method of topology optimization based on the asymptotic analysis works very well for the solutions strongly sensitive on the appearance of holes, otherwise the information obtained, while analytically correct, is more fuzzy, especially if contaminated by numerical errors. What’s more, particularly in case of multiple voids, there may occur several configurations constituting local minima for the associated topological optimization problem. Of course, in case of general domain optimisation from scratch, the approach based on topological derivative is not the only one, see Allaire (2002) and Bendsoe and Sigmund (2003).

Our goal in this paper consists in proposing the combination of genetic algorithm and information given by the topological derivative for solving such difficult problems or at least providing the initial approximation of the solutions. The idea of combining heuristic and strict methods for modelling physical structures was recently used for example in Patelli and Schuëller (2012) but the way we use information contained in the topological derivative is new. Namely, we construct on its basis the probability density used in generation of initial populations and supplying additional elements as needed.

Of course, in order to use the topological derivative it was necessary to compute its value. Therefore the essential part of the paper is devoted to obtaining the appropriate analytic formulas for the given nonlinear problem. We employ the domain decomposition technique in order to split the coupled model into separate parts. The interaction of these parts in both domains is modelled by the appropriate Steklov-Poincaré non–local boundary operator, which can be defined for the linear part and includes the information about the design in its interior. It means that we can apply the asymptotic analysis for decoupled elliptic boundary value problems and determine topological derivatives for shape functionals of interest.

The Steklov-Poincaré operators appear in boundary conditions of the fluid or gas (non–linear) models in the second sub-domain. This transmission of the behaviour of the linear part to the non–linear part allows us to apply the tools of shape and topology design to the coupled models. For example, if the non–linear part represents the compressible Navier-Stokes equation, we may use recent results concerning its shape optimization, see Plotnikov and Sokolowski (2008).

In the numerical part of the paper the proposed ideas are tested using the comparatively simple elitist genetic algorithm, see Michalewicz (1996). It should be stressed here that it was not our goal to devise the type of genetic algorithm which uses the additional information in an optimal way. We wanted to compare two situations:

  • the algorithm using probability density obtained from topological derivative,

  • the same algorithm using uniform density, that is lacking any knowledge about the physics of the problem,

and to compare the average convergence speed in both cases.

Let us stress again that the approach proposed here applies to situation, when the topological derivative does not give clear answers (as happens quite often) but nevertheless may help in the search for them.

2 Problem formulation

Let D and ω be two bounded domains in \(\mathbb {R}^{2}\) with the smooth boundaries ω and Γ = D. We suppose that D = Ω ∪ ω has a geometry presented in Fig. 1, where \({\Omega } = D \setminus \overline {\omega }\), such that Ω=Γ∪ ω. In the domain D we consider the following nonlinear boundary value problem for a fixed function φ:

$$\begin{array}{@{}rcl@{}} -{\Delta} U(x)&=&F(x, U(x)), \quad x\in D, \\ U(x)&=&0, \quad x\in{\Gamma}, \\ U(x)=\varphi(x), \, \partial_{n} U(x)&=&\partial_{n} \varphi(x), \quad x\in\partial\omega. \end{array}$$
(1)

The function F(x, U(x)) is defined as follows

$$F(x, U(x))=\left\{ \begin{array}{ll} -U^{3}(x)+f(x), &x\in {\Omega}, \\ 0, &x\in\omega, \end{array} \right.$$
(2)

where f is a constant or linear function. The boundary condition on the common boundary ω constitutes the so-called transmission condition.

Fig. 1
figure 1

Domain Ω ∪ ω

Next we introduce a small perturbation in the domain ω by creating a small hole B ε at the point 𝓞, chosen, without loss of generality, at the origin, see Fig. 2.

Fig. 2
figure 2

Domain Ω and \(\omega _{\varepsilon }= \omega \setminus \overline {B}_{\varepsilon }\)

We denote

$$\begin{array}{@{}rcl@{}} \omega_{\varepsilon}&=&\omega\setminus\overline {B}_{\varepsilon} \end{array}$$
(3)
$$\begin{array}{@{}rcl@{}} \partial\omega_{\varepsilon}&=&\partial\omega\cup \partial B_{\varepsilon} \end{array}$$
(4)

The problem (1) can then be redefined in the perturbed domain as follows:

$$\begin{array}{@{}rcl@{}} -{\Delta} U_{\varepsilon}(x)&=&F(x, U_{\varepsilon}(x)), \quad x\in D\setminus\overline{B}_{\varepsilon}, \\ U_{\varepsilon}(x)&=&0, \quad x\in{\Gamma}, \\ U_{\varepsilon}(x)=\varphi(x), \, \partial_{n} U_{\varepsilon}(x)&=&\partial_{n} \varphi(x), \quad x\in\partial\omega, \\ \partial_{n} U_{\varepsilon}(x)&=&0, \quad x\in\partial B_{\varepsilon} \end{array}$$
(5)

where again φ is a fixed function and F(x, U ε (x)) is defined by:

$$F(x, U_{\varepsilon}(x))=\left\{ \begin{array}{rl} -U_{\varepsilon}^{3}(x)+f(x), &x\in {\Omega}, \\ 0, &x\in\omega_{\varepsilon}. \end{array} \right.$$
(6)

with f the same as in (2).

According to Sokołowski and żochowski (2005, 2008) we can rewrite the condition in (5) using the Steklov-Poincaré operator \(\mathcal {A}_{\varepsilon }\) defined below in the domain ω ε . The operator \(\mathcal {A}_{\varepsilon }\) is a mapping of H 1/2( ω) → H −1/2( ω). It means that for each function φH 1/2( ω) we have

$$\mathcal{A}_{\varepsilon}: \varphi\in H^{1/2}(\partial\omega)\longrightarrow \partial_{n} U_{\varepsilon} \in H^{-1/2}(\partial\omega).$$
(7)

The problem (5) can then be rewritten as follows:

$$\begin{array}{rl} -{\Delta} U_{\varepsilon}(x)&=F(x, U_{\varepsilon}(x)), \quad x\in D\setminus\overline{B}_{\varepsilon}, \\ U_{\varepsilon}(x)&=0, \quad x\in{\Gamma}, \\ \partial_{n} U_{\varepsilon}(x)&=\mathcal{A}_{\varepsilon} (U_{\varepsilon}(x)), \quad x\in\partial\omega, \\ \partial_{n} U_{\varepsilon}(x)&=0, \quad x\in\partial B_{\varepsilon} \end{array}$$
(8)

with the function F defined as in (6).

3 Expansion of the Steklov-Poincaré operator

In order to find the form of the topological derivative, we have to determine the approximation of the operator

$$\mathcal{A}_{\varepsilon}:H^{1/2}(\partial\omega)\to H^{-1/2}(\partial\omega)\, \text{ on }\, \partial\omega.$$

To this goal we consider both linear and nonlinear problems separately. In the domain Ω we have the following nonlinear problem

$$\begin{array}{@{}rcl@{}} -{\Delta} v_{\varepsilon}(x)+v_{\varepsilon}^{3}(x)&=&f(x), \quad x\in {\Omega}, \\ v_{\varepsilon}(x)&=&0, \quad x\in{\Gamma}, \\ \partial_{n} v_{\varepsilon}(x)&=&\mathcal{A}_{\varepsilon}(v_{\varepsilon} (x)), \quad x\in\partial\omega. \end{array}$$
(9)

The Steklov-Poincaré operator is defined using the linear boundary value problem. If in the domain ω ε we have

$$\begin{array}{@{}rcl@{}} -{\Delta} u_{\varepsilon}(x)&=&0, \quad x\in\omega_{\varepsilon}\\ u_{\varepsilon}(x)&=&\varphi(x), \quad x\in\partial\omega\\ \partial_{n} u_{\varepsilon}(x)&=&0, \quad x\in\partial B_{\varepsilon} \end{array}$$
(10)

then \(\mathcal {A}_{\varepsilon }(\varphi )=\partial _{n} u_{\varepsilon }\).

From (10) we may immediately compute the corresponding energy functional

$$\begin{array}{@{}rcl@{}} \begin{array}{ll} 0=-\int\limits_{\omega_{\varepsilon}}\Delta u_{\varepsilon} \cdot u_{\varepsilon} ddx &= \int\limits_{\omega_{\varepsilon}} |\nabla u_{\varepsilon}|^{2} ddx - \int\limits_{\partial\omega} \partial_{n} u_{\varepsilon} \cdot u_{\varepsilon}ddx \\ &=\int\limits_{\omega_{\varepsilon}}|\nabla u_{\varepsilon}|^{2}ddx -\int\limits_{\partial\omega} \mathcal{A}_{\varepsilon}(\varphi)\cdot \varphi ddx. \end{array} \end{array}$$
(11)

Thus the Steklov-Poincaré operator on the common boundary ω allows us to compute the energy functional in the domain ω ε .

$$\int\limits_{\omega_{\varepsilon}}|\nabla u_{\varepsilon}|^{2}dx= \int\limits_{\partial\omega} \mathcal{A}_{\varepsilon}(\varphi) \cdot \varphi dx$$
(12)

for each function φH −1/2( ω). Since the operator \(\mathcal {A}_{\varepsilon }\) is symmetric, we can also write the energy as:

$$\int\limits_{\omega_{\varepsilon}}|\nabla u_{\varepsilon}|^{2}dx= \langle\mathcal{A}_{\varepsilon}(\varphi), \varphi\rangle_{(H^{-1/2}\times H^{1/2}) (\partial\omega)}$$
(13)

The topological asymptotic expansion for the energy functional can be written in the following way (Sokołowski and Zolésio 1992; Sokołowski and żochowski 1999) (see also the general theory in Mazja et al. (1991) and Nazarov (1999)):

$$\int\limits_{\omega_{\varepsilon}}|\nabla u_{\varepsilon}|^{2}dx= \int\limits_{\omega}|\nabla u|^{2}dx-2\pi\varepsilon^{2}|\nabla u(\mathcal{O})|^{2} +o(\varepsilon^{2})$$
(14)

where u is the solution to the linear problem (10) for ε = 0 defined in the unperturbed domain ω. Thus, according to Sokołowski and żochowski (2005) and Kowalewski et al. (2010) we have the following expansion of the Steklov-Poincaré operator:

$$\mathcal{A}_{\varepsilon}=\mathcal{A}+ \varepsilon^{2} \mathcal{B}+o(\varepsilon^{2})$$
(15)

in the operator norm \(\mathcal {L}(H^{1/2}(\partial \omega );H^{-1/2}(\partial \omega ))\), and, by the symmetry of the operator this expansion can also be written in the following way:

$$\langle \mathcal{A}_{\varepsilon}(\varphi), \phi \rangle=\langle \mathcal{A} (\varphi), \phi \rangle+\varepsilon^{2}\langle \mathcal{B}(\varphi), \phi \rangle+o(\varepsilon^{2}).$$
(16)

As a result, the first term in the asymptotic expansion of the energy functional has the form

$$\langle \mathcal{B}(\varphi), \phi \rangle = -2\pi \nabla u (\mathcal{O}) \cdot \nabla u(\mathcal{O})$$
(17)

in the domain ω.

4 Topological derivative

Let us consider the following shape functional

$$J(v_{\varepsilon})=\frac{1}{2}\int\limits_{\Omega}(v_{\varepsilon}-z_{d})^{2} dx,$$
(18)

with v ε the solution to the semi-linear problem (9) and z d a fixed target function defined in the domain Ω. Let us introduce also the adjoint state, which is used usually in order to simplify the form of topological derivative:

$$\begin{array}{@{}rcl@{}} -{\Delta} p+3v^{2} p&=&(v-z_{d}), \quad\text{in}\; {\Omega}, \\ -{\Delta} p&=&0, \quad \text{in}\;\omega\\ p&=&0, \quad\text{on}\;{\Gamma}, \end{array}$$
(19)

where v is solution to (9) for ε = 0.

Theorem 1

The topological derivative of the functional J has the following form:

$$\mathcal{T}_{\Omega}(\mathcal{O}) = -\langle\mathcal{B}(v), p\rangle = 2\pi\nabla v(\mathcal{O}) \cdot \nabla p(\mathcal{O}).$$
(20)

Proof

Let us assume that the solution to the nonlinear problem (9) has the following expansion

$$v_{\varepsilon}(x)=v(x)+\varepsilon^{2}w(x)+ \tilde{v}_{\varepsilon}(x)\cdot o\left(\varepsilon^{2}\right).$$
(21)

Then from (9) we get

$$\begin{array}{@{}rcl@{}} &-&{\Delta} (v+\varepsilon^{2}w)+(v+ \varepsilon^{2}w)^{3}=f, \;\;\; \text{in}\; {\Omega}, \\ &&v+\varepsilon^{2}w=0, \;\;\;\text{on}\;{\Gamma}, \\ &&\partial_{n}(v+\varepsilon^{2}w)=\mathcal{A}(v+\varepsilon^{2}w)+\varepsilon^{2} \mathcal{B} (v+\varepsilon^{2}w)\\ &&+\dots, \;\;\; \text{on}\;\partial \omega \end{array}$$
(22)

Since

$$(v+\varepsilon^{2}w)^{3}=v^{3}+3v^{2}\varepsilon^{2} w+3v\varepsilon^{4} w^{2}+\varepsilon^{6} w^{3}$$
(23)

we get two nonlinear boundary value problems. The first one comes from (22) taking into account the terms without ε:

$$\begin{array}{@{}rcl@{}} -{\Delta} v+v^{3}&=&f, \;\;\;\text{in}\; {\Omega}, \\ v&=&0, \;\;\;\text{on}\;{\Gamma}, \\ \partial_{n} v &=&\mathcal{A}(v), \;\;\;\text{on}\; \partial\omega. \end{array}$$
(24)

where v is solution to (9) for ε = 0. The second one corresponds to the terms with ε 2:

$$\begin{array}{@{}rcl@{}} -{\Delta} w+3v^{2} w&=&0, \;\;\;\text{in}\; {\Omega}, \\ w&=&0, \;\;\;\text{on}\;{\Gamma}, \\ \partial_{n} w &=&\mathcal{A}(w)+\mathcal{B}(v), \;\;\;\text{on}\; \partial\omega. \end{array}$$
(25)

As a result the shape functional depending on the solution v ε can be written in the following way:

$$\begin{array}{@{}rcl@{}} J(v_\varepsilon)&=&\dfrac{1}{2}\int\limits_{\Omega}(v_{\varepsilon}-z_d)^2 ddx\nonumber =\dfrac{1}{2}\int\limits_{\Omega}(v+\varepsilon^2 w-z_d)^2 ddx\\ &=&J(v)+\varepsilon^2 \int\limits_{\Omega} w(v-z_d)ddx +\dots \end{array}$$
(26)

Next we apply the adjoint state to replace the last integral and obtain:

$$\begin{array}{ll} \int\limits_{\Omega} w(v &- z_d)ddx= \int\limits_{\Omega} w(-\Delta p+3v^2p)ddx \\&=\int\limits_{\Omega}p(-\Delta w + 3 v^2 w)ddx \\&\kern3.4pc + \int\limits_{\Gamma}( \partial_n w\cdot p - \partial_n p\cdot wddx\\ &\qquad\qquad -\int\limits_{\partial\omega}(\partial_n w\cdot p - \partial_n p\cdot w) ddx\\ &=\int\limits_{\partial\omega}(\partial_n p\cdot w-\partial_n w\cdot p)ddx\\ &=\int\limits_{\omega}\Delta p\cdot w ddx+ \int\limits_{\omega}\nabla w\cdot \nabla p ddx -\int\limits_{\partial\omega}\partial_n w\cdot {\kern-1pt}p ddx\\ &=\int\limits_{\omega}\nabla w \cdot \nabla pddx-\int\limits_{\partial\omega}(\mathcal{A}(w)+\mathcal{B}(v))p ddx \\ &=\int\limits_{\omega}\nabla w \cdot \nabla p ddx -\int\limits_{\partial\omega} \mathcal{A}(w)p ddx -\int\limits_{\partial\omega}\mathcal{B}(v)p ddx\\ &=-\langle \mathcal{B}(v),p\rangle = 2\pi\nabla v(\mathcal{O}) \cdot \nabla p(\mathcal{O}). \end{array}$$
(27)

5 Numerical investigations

The shape optimization problem considered in this section consists in finding locations and sizes of a finite number of ball-shaped holes in the domain which minimize a certain integral functional. The standard approach would use the values of topological derivative for initial location of these holes, and then shape derivative would be applied for fine tuning their sizes and positions (Fulmanski et al. 2007; Iguernane et al. 2009). Such a method is fast, but there is a danger of landing in a local optimum, especially when the number of holes is bigger than one.

The main idea of the approach proposed in this paper is to combine the genetic algorithm (in order to avoid local optima) and continuous method using topological derivative for speeding up computations. This is illustrated by the examples based on boundary value problem described in preceding sections and cases of:

  • one hole of fixed size;

  • two holes of fixed sizes;

  • three holes of fixed sizes;

The topological derivative is used here for constructing the probability density defined on the domain in which the holes are allowed to appear. Then this density is used in the random selection of locations for the initial population of single holes, their pairs or triples. The same probability is used to supplement the population in consecutive generations.

The approach exploiting the information supplied by topological derivative is compared to the method using exactly the same genetic algorithm, but with uniform distribution of holes locations. The performance is measured in both cases statistically over several runs.

5.1 Solution of boundary value problems

For the sake of numerical experiments we assume that the domain D is a square 〈−1, 1〉 × 〈−1, 1〉 in ℝ2. In D we define a sub-domain ω as a circle of the center at the point \(\mathcal {O}=(0, 0)\) and the radius r = 0.5. Thus D consists of two open sub-domains ω and \({\Omega }=D\setminus \overline {\omega }\), see Fig. 3, with the boundaries Γ = D and ω.

Fig. 3
figure 3

Domain D = Ω∪ω.

In the interior domain we define a linear elliptic boundary value problem as follows:

$$\begin{array}{@{}rcl@{}} -{\Delta} u(x)&=&0, \quad x\in\omega\\ u(x)&=&v(x), \quad x\in\partial\omega \end{array}$$
(28)

Outside the circle ω, in the domain Ω, we define the following semi-linear boundary value problem with the Dirichlet condition on the exterior boundary Γ of the square and the transmission condition on the common boundary ω of the circle:

$$\begin{array}{@{}rcl@{}} -{\Delta} v(x)+v^{3}(x)&=&f(x), \quad x\in {\Omega}, \\ v(x)&=&0, \quad x\in{\Gamma}, \\ \partial_{n} v(x)&=&\mathcal{A}(v(x)), \quad x\in\partial\omega. \end{array}$$
(29)

The operator 𝓐 is the Steklov-Poincaré operator and the function f(x) is given.

In order to solve numerically the coupled problem described in (28) and (29), we introduce a characteristic function χ of the domain Ω,

$$\chi({\Omega})=\left\{ \begin{array}{ll} 1&x\in{\Omega}, \\ 0&x\in\omega. \end{array} \right.$$
(30)

Then the coupled problem under consideration can be rewritten in the following way:

$$\begin{array}{@{}rcl@{}} -{\Delta} w(x)+\chi({\Omega})w^{3}(x)&=&\chi({\Omega})f(x), \quad x\in D, \\ w(x)&=&0, \quad x\in{\Gamma}. \end{array}$$
(31)

Let \(\mathcal {V}(D)=\{v\in {H_{0}^{1}}(D):v=0\ \text {on}\ {\Gamma }\}\). Multiplying (31) by a function \(\varphi \in \mathcal {V}\) and integrating by parts we get the following weak formulation:

$$\begin{array}{@{}rcl@{}} {\displaystyle\int\limits_{\Omega} \nabla w(x)\nabla\varphi(x)dx -\int\limits_{\partial\omega} \nonumber \dfrac{\partial w(x)}{\partial n_1}\varphi(x)dS}\kern5.2pc \\ \nonumber {+\displaystyle\int\limits_{\omega}\nabla w(x)\nabla\varphi(x)dx- \int\limits_{\partial\omega}\dfrac{\partial w(x)}{\partial n_2}\varphi(x)dS}\kern4.5pc \\{+\displaystyle\int\limits_{\Omega}w^3(x)\varphi(x)dx =\int\limits_{\Omega}f(x)\varphi(x)dx, \forall\varphi\in\mathcal{V}(D).}. \end{array}$$
(32)

Here we denote by n 1 the outward normal vector to ω, and by n 2 the outward normal vector to Ω. If we suppose that w|Ω = v, w| ω = u, then we get the following variational formulations of the nonlinear problem in the domain Ω:

$$\left\{ \begin{array}{ll} \text{Find}\ v(x)\ \text{such, that}\\ \displaystyle\int\limits_{\Omega}\nabla v(x)\nabla\varphi(x)dx+\int\limits_{\Omega}v^{3}(x)\varphi(x)dx= \int\limits_{\Omega}f(x)\varphi(x)dx\\\quad\forall\varphi\in\mathcal{V}(D), \end{array} \right.$$
(33)

with the transmission condition on the common boundary ensured by:

$$\int\limits_{\partial\omega}\frac{\partial u(x)}{\partial n_{1}}\varphi(x)dS+ \int\limits_{\partial\omega}\frac{\partial v(x)}{\partial n_{2}}\varphi(x)dS=0.$$
(34)

Similarly, for u = v on ω we obtain the variational formulation in the domain ω:

$$\left\{ \begin{array}{l} \text{Find}\ u(x)\ \text{such, that}\ u=v\ \text{on}\ \partial\omega\ \text{and}\\ \displaystyle\int\limits_{\omega}\nabla u(x)\nabla\varphi(x)dx=0, \quad\forall\varphi\in\mathcal{V}(D). \end{array} \right.$$
(35)

5.2 Optimization problem

In our numerical experiments we use the tracking type shape functional with a known element z d , so an optimal value is 0.

In the first case we consider the instance of the single hole. Let us set \(\omega _{\varepsilon }=\omega \setminus \overline {B}_{\varepsilon }({\mathcal {O}})\), where \(B_{\varepsilon }({\mathcal {O}})\) is a small hole created in the interior circular domain ω at certain point 𝓞 and of fixed radius ε. Thus, D ε = Ω∪ω ε and in such domain we define a target function z d as a solution to the following boundary value problem:

$$\begin{array}{ll} -{\Delta} z_{d}(x)+\chi({\Omega}){z_{d}^{3}}(x)&=\chi({\Omega})f(x), \quad x\in D_{\varepsilon}, \\ \quad\quad\quad\quad\quad\quad\quad z_{d}(x)&=0, \quad x\in{\Gamma}, \\ \quad\quad\quad\quad\quad\quad\quad\frac{\partial z_{d}}{\partial n}&=0, \quad x\in\partial B_{\varepsilon}. \end{array}$$
(36)

The cost functional that we want to minimize is of the tracking type, as mentioned above, and depends on the location 𝓞 of the hole:

$$J(v_{\varepsilon})=\frac{1}{2}\int\limits_{\Omega}(v_{\varepsilon}(x)-z_{d}(x))^{2} dx,$$
(37)

where v ε is the solution to the semi-linear problem in perturbed domain

$$\begin{array}{@{}rcl@{}} -{\Delta} v_{\varepsilon}(x)+v_{\varepsilon}^{3}(x)&=&f(x), \quad x\in {\Omega}, \\ v_{\varepsilon}(x)&=&0, \quad x\in{\Gamma}, \\ \partial_{n} v_{\varepsilon}(x)&=&\mathcal{A}_{\varepsilon}(v_{\varepsilon}(x)), \quad x\in \partial\omega. \end{array}$$
(38)

In order to minimize this shape functional we are looking for the optimal perforation of the domain ω. To this end, we apply the genetic algorithm, which uses the values of topological derivative as the probability density to determine the best location of an optimal hole. For this shape functional, due to the Theorem 1, the topological derivative is given by the following formula:

$$\mathcal{T}_{\Omega}(\mathcal{O}) = 2\pi\nabla v(\mathcal{O}) \cdot \nabla p(\mathcal{O}).$$
(39)

where p is the so-called adjoint state being a solution to the linear boundary value problem (19).

All numerical computations were performed using Matlab and its PDE toolbox. In particular, the triangulation of intact and perforated domains was done using the built-in procedures. The boundary value problems were solved using linear finite elements.

For the sake of obtaining the topological derivative we are interested only in values of functions in the subdomain ω. We assume that ω is divided into M triangles represented by the matrix T = [t i j ], i = 1, …, M, j = 1, 2, 3, where t i denotes labels of points constituting vertices of the i-th triangle. We assume also that vertices in ω have labels k = 1, …, N.

In this approximation the topological derivative is a piecewise constant function on triangles belonging to ω, represented by the vector D = [d i ], i = 1, …, M with

$$d_{i} = 2\pi\nabla v_{i} \cdot \nabla p_{i}.$$
(40)

where ∇v i , ∇p i are constant on the i-th triangle values of gradients.

Using these values the probability density is constructed in the following way. First we approximate, using the standard procedure, the function D by the piecewise linear function represented by the vector of nodal values \(\tilde {D}=[\tilde {d}_{k}], \;k=1, \dots , N\). Then let \(\tilde {D}_{max}=\max \limits _{k=1, \dots , N} \tilde {d}_{k}\) and \(\tilde {s}_{k}=\tilde {D}_{max}-\tilde {d}_{k}\). Thus the function represented by nodal values \(\tilde {S}=[\tilde {s}_{k}], \;k=1, \dots , N\) is the biggest at nodes where \(\tilde {D}\) has minimum and vanishes at nodes where \(\tilde {D}\) achieves maximum.

From \(\tilde {S}\) we construct the probability density at nodal points by normalization

$$\mathcal{P}_{k}=\frac{\tilde{s}_{k}} {\frac{1}{3}\sum\limits_{i=1}^{M}\text{area}(t_{i*}) \sum\limits_{j=1}^{3} \tilde{s}_{t_{ij}}}, \qquad k=1, \dots, N$$
(41)

5.3 Genetic algorithm

Initial population

The initial population consists of circular holes represented by the coordinates of their centres (the radius of the hole is fixed and is the same for each hole). Thus, each element of population represents a point in a space for which the dimension is determined by the number of coordinates of the holes centres. In case of one hole, the element of the population constitutes a vector [x 0, y 0] of two coordinates of the center of the circular hole. In case of two holes, the individual is given by a vector of four coordinates defining centres [x 1, y 1, x 2, y 2] of two holes. For three holes, the individuals are represented by vectors of six coordinates [x 1, y 1, x 2, y 2, x 3, y 3]. The initial population is randomly initialized with a constant number \(\mathcal {S}\) of individuals. Since we compare two versions of algorithms, two kinds of initializations are used. In the first case, we apply the probability density function defined in (41). In the second case, when we do not use the information contained in topological derivative, the probability density is uniform on ω, which corresponds to d i = const in (40).

Since the values of probability density function are defined only in the nodes of the discretized domain, we need the following procedure to draw a random point, not necessarily the node, in the domain.

Let t i = [t i j ], i = 1, …, M be a i-th triangle with vertices [t i1, t i2, t i3]. The values \(\mathcal {P}_{t_{ij}}\), i = 1…N, j = 1…3 are the probabilities connected with these vertices. The probability P(t i) of the i-th triangle t i is calculated through the formula

$$P(t_{i*})=\frac{1}{3} \text{area}(t_{i*}) \sum\limits_{j=1}^{3}\mathcal{P}_{t_{ij}}, \quad i=1, \dots, M$$
(42)

For each triangle t i we define the vector λ i = [λ i j ], j = 1, 2, 3, such that

$$\lambda_{ij}=\mathcal{P}_{t_{ij}}\cdot r_{j}, \quad i=1, \dots, M, \quad j=1, 2, 3,$$
(43)

Here r j are three independent random numbers generated using uniform distribution on [0, 1] interval. The point \(\hat {p}\in t_{i*}\) is selected using these λ i j and in dependence of probability density in the corners

$$\hat{p}=\frac{1}{\sum\limits_{j=1}^{3}\lambda_{ij}}\cdot \sum\limits_{j=1}^{3}\lambda_{ij}x(t_{ij}).$$
(44)

This procedure may be summarized as follows:

  • first we select the triangle according to its average probability;

  • next we select the point inside this triangle taking into account the values of probability density in the corners.

In case of two holes, selection of the initial population consists in drawing the pairs of holes. A pair of holes is retained only if the distance between their centres is greater that the fixed value 2ε, where ε is the radius of the hole. Similar condition is used for triples. If the condition is not verified, the pair or triple is eliminated and the drawing continues until the required number or elements is reached.

Evaluation

The fitness value of every individual is evaluated using the cost functional 𝓙 such that the minimization of 𝓙 is equivalent to the maximization of the fitness value. Since the population is considered as a vector of individuals sorted according to their fitness values, the lower value of the cost functional means the higher position in the population vector.

Crossover

Once the initialization and evaluation are complete, the crossover operations perform genetic code exchange between pairs of individuals. These pairs are chosen in following way. First we define, as a parameter, a number of dominating elements which are always at the beginning of the population vector. Then every dominating element undergoes crossover with every subordinate element. Let α be a random number with uniform distribution on [0, 1], different in every formula. In case of one hole, the crossover of two individuals x = [x 1, x 2] and y = [y 1, y 2] results in z = [z 1, z 2] given by

$$\left[\begin{array}{l}z_{1}\\z_{2}\end{array}\right]=\alpha \left[\begin{array} {l}x_{1}\\x_{2}\end{array}\right]+(1-\alpha)\left[\begin{array}{l}y_{1}\\y_{2}\end{array}\right].$$
(45)

In case of two holes, the crossover of x = [x 1, x 2, x 3, x 4] and y = [y 1, y 2, y 3, y 4] gives two individuals z = [z 1, z 2, z 3, z 4] and \(z^{\prime }=[z^{\prime }_{1}, z^{\prime }_{2}, z^{\prime }_{3}, z^{\prime }_{4}]^{\top }\) according to formulae

$$\left[\begin{array}{l}z_{1}\\z_{2}\\z_{3}\\z_{4}\end{array}\right]=\alpha \left[\begin{array} {l}x_{1}\\x_{2}\\x_{3}\\x_{4}\end{array}\right]+(1-\alpha)\left[\begin{array} {l}y_{1}\\y_{2}\\y_{3}\\y_{4}\end{array}\right],$$
(46)

and

$$\left[\begin{array} {l}z^{\prime}_{1}\\z^{\prime}_{2}\\z^{\prime}_{3}\\z^{\prime}_{4}\end{array}\right]=\alpha \left[\begin{array}{l}x_{3}\\x_{4}\\x_{1}\\x_{1}\end{array}\right]+(1-\alpha)\left[\begin{array} {l}y_{1}\\y_{2}\\y_{3}\\y_{4}\end{array}\right].$$
(47)

The triples were treated a little differently. The transformation mapping two triangles Δ1, Δ2 into each other, consisting of rotation and scaling, was constructed, so that Δ2 = T1). Then the result of crossover was given by

$${\Delta} = (I+\alpha T)({\Delta}_{1}).$$
(48)

The elements obtained in this way are added to the initial population increasing its size.

Mutation

Mutation is a mechanism for extending the search on the new areas of the design space and increasing the variability of the population. Each element produced during the crossover is perturbed with a given probability (in our case 0.2) within the fixed range δ (in our case δ = ε) according to the formula

$$z^{*}=z+\left[\begin{array}{l}1-2\alpha_{1}\\ 1-2\alpha_{2}\end{array}\right]\cdot\delta,$$
(49)

in case of single hole, and for pair of holes

$$z^{*}=z+\left[\begin{array}{l}1-2\alpha_{1}\\ 1-2\alpha_{2}\\ 1-2\alpha_{3}\\ 1-2\alpha_{4}\end{array}\right]\cdot\delta.$$
(50)

where α i are random numbers from the interval [0, 1]. The generalization to triples is obvious.

New generation

In the next step the population consisting of old individuals and those produced in the crossover stage is pruned by removing the elements violating the constraints (distance between centres greater then 2ε in case of two or three holes) and sorted according to fitness value.

The next generation contains \(\frac {2}{3}S\) of the best elements. In order to prevent locking in local optima, \(\frac {1}{3}S\) individuals are again drawn randomly using appropriate probabilities, i.e. the one based on topological derivative or uniform on ω.

5.4 Numerical results

In the first example we consider a case with one hole. As a target domain we take a square with one hole inside the interior circular sub-domain. The center of this hole is at point (−0.2;0.2) and the radius is 0.08. The goal functional is computed using z d corresponding to the function f(x) = x 1. The size of the initial population for GA is 21 genes, with 3 dominants, and the number of generations is 10. The optimization process is repeated 20 times which gives the average results presented in Fig. 4. As we see, the algorithm using topological derivative gives on average faster convergence. The value of density probability is shown in Fig. 5.

Fig. 4
figure 4

Value of shape functional due to the topological derivative density (solid line) and the uniform distribution density (dashed line) in case of one hole

Fig. 5
figure 5

Value of probability density for one hole

In the second example the reference shape contained two holes with radius 0.05 located at (−0.1, 0.2, ) and (0.2, −0.1). The goal functional consisted of the sum of two parts with different reference functions z d1, z d2 corresponding to right–hand sides f 1 = x 1 + x 2 and f 2 = x 1x 2. As a result, the topological derivative was also computed twice, and the value of the final 𝓣 was the sum of these two parts. It is shown in Fig. 6 while the Fig. 7 presents the average performance of both types of genetic algorithms. Figure 8 shows the typical last population of the genetic algorithm using topological derivative. Nearly all members of this population overlap.

Fig. 6
figure 6

Value of probability density for two holes

Fig. 7
figure 7

Value of shape functional due to the topological derivative density (solid line) and the uniform distribution density (dashed line) in case of two holes

Fig. 8
figure 8

The best individuals given by the topological derivative

In the third example we consider a case with three holes. As a target domain we take a square with three circular holes located at points (−0.1, 0.2, ), (0.2, −0.1) and (−0.2, −0.2) inside the interior sub-domain ω. The goal functional consists of the sum of two parts with different reference functions z d1, z d2 corresponding to right–hand sides f 1 = x 1 + x 2 and f 2 = x 1x 2. As a result, the topological derivative was also computed twice, and the value of the final 𝓣 was the sum of these two parts.

It is shown in Fig. 9 while the Fig. 10 presents the average performance of both types of genetic algorithms. Figure 11 shows the typical last population of the genetic algorithm using topological derivative. Nearly all members of this population overlap.

Fig. 9
figure 9

Value of probability density for three holes

Fig. 10
figure 10

Value of shape functional due to the topological derivative density (solid line) and the uniform distribution density (dashed line) in case of three holes

Fig. 11
figure 11

The best individuals given by the topological derivative algorithm in case of three holes

6 Conclusions

The problems considered in the paper, especially those including several holes, are quite difficult because the voids which we want to localize are screened from the observation. They are contained in ω, while the goal functional is computed on Ω. As a result, the goal functionals are not very sensitive to the changes of the configuration and this impedes the use of algorithms based on gradients (shape derivatives).

The genetic algorithms do not use derivatives and are suitable for such situation. What’s more, as shown in the paper, they can utilize even imprecise information through modifying appropriate probabilities. The idea to use topological derivative in this context seems to be new.