1 Introduction

Additive manufacturing or 3D printing is understood as the process of building up a structure layer by layer. Traditional manufacturing methods, such as injection molding [36], place constraints on the achievable shapes, whereas with 3D printing the complexity of the possible forms is much less limited. Traditional methods allow for a cheaper and faster production in high volume orders. However, as order volumes decrease and need for customizability increases, additive manufacturing becomes more attractive. It allows for production of parts just in time as they are needed. This reduces the logistical burden tremendously. Some even call 3D printing the next industrial revolution, [10].

According to [6] the industry sector of additive manufacturing has shown remarkable growth in previous years and is predicted to continue growing at a rate of 15% in the coming years. The additive manufacturing industry, spanning from machine sales to the service sector, is anticipated to reach $21.5 billion by 2025. The greatest market potential is seen in the sectors of consumer electronics, automotive, medical & dental, aerospace, industrial and architecture.

Additive manufacturing comes with its own constraints and problems. The production of a single unit takes longer and the surface structure has a rougher finish. This paper focuses on eliminating instabilities during the printing process which are caused by overhangs. These are problematic, because printing layer by layer can cause sagging of material. Avoiding these instabilities is mandatory for a reliable and reproducible printing process, which is necessary for a safe application of additive manufacturing on an industrial level.

Commonly, external support structures are added to alleviate that problem. On the downside, this method uses more material and takes longer to print. Removing support structures after the printing process is both time and labor intensive.

Topology optimization is concerned with the automatic optimal design of structures for a given physical setting, see [9]. From a mathematical point of view, topology optimization belongs to the area of optimal control of partial differential equations, [39]. Physical settings could for example include fluid dynamics, heat conduction or, as in the present setting, mechanics. Realizing the resulting designs can be challenging with traditional manufacturing methods, but is possible via additive manfucturing. For a broad overview of trends in topology optimization for additive manufacturing see [32].

Topology optimization is conducted by solving the arising partial differential equations and iteratively updating the design to improve a given objective function. Three common approaches are the SIMP method [8], the level set method [42] and the phase field method.

The phase field method was first introduced for free boundary problems [24] and phase transformations [31]. It has been widely used in solidification [16, 44], but also for example to model dendritic growth [28] or crack propagation [34]. It has been applied to topology optimization in [12, 18, 21, 38, 41, 43] and [13].

The problem of overhangs has been approached in different ways. As long as overhangs do not extend past an allowable self-supporting angle, they are printable. This is used in the work of [25] by incorporating projection operations to limit overhang angles. Another approach is to determine wether enough supporting material is present under a certain point. This method was developed in [30] and requires regular meshes. The problem of instabilities is here alleviated by incorporating an additive manufacturing constraint (AMC) in the modeling stage. Rigidness of the structure during the building process is taken into consideration.

When executing the topology optimization, the AMC is accounted for via a penalty term. While being printed, the resulting structure shall be stable without relying on manually added supports. This approach is introduced in the work of [2] and results are presented in [1]. In contrast to the phasefield approach used in the present paper, the authors use a level-set method, where the topology is perturbed by solving a Hamilton-Jacobi equation with a velocity term derived from the shape gradient.

As a novel approach the AMC is incorporated into the phase field method for topology optimization. Optimality conditions are derived. The approach is validated numerically by showing that the AMC increases stability during the manufacturing process.

This paper is structured in the following way: After explaining linear elasticity, the theoretical foundation of topology optimization is laid out in Sect. 2.3. The AMC is introduced in Sect. 2.4 and incorporated into the optimal control problem. First order optimality conditions are derived via a formal Lagrangian approach in Sect. 3. The discretization is explained in Sect. 4. To examine the influence of the AMC, numerical experiments are done with and without it in Sect. 5.

2 Problem setting

The aim of this chapter is to define the optimal control problem. After modeling the mechanics, topology optimization is explained and the AMC is formalized. First of all some notations are introduced.

2.1 Notation

Let \(\Omega \subset \mathbb{R}^{d}\), \(d=2,3\) be a bounded, regular domain and with a piecewise Lipschitz boundary Γ. Assume there exists a Dirichlet boundary \(\Gamma _{D}\subset \partial \Omega \) with surface area \(\vert \Gamma _{D} \vert > 0\). The space of square integrable functions \(L^{2}(\Omega )\) is used to define the Sobolev spaces

$$\begin{aligned} &H^{1}(\Omega ): = \bigl\{ \xi \in L^{2}(\Omega ): \partial _{i} \xi \in L^{2}(\Omega ), i=1, \ldots , d \bigr\} \quad \text{and } \\ &H^{1}_{D} \bigl( \Omega , \mathbb{R}^{d} \bigr): = \bigl\{ \xi \in H^{1} \bigl( \Omega , \mathbb{R}^{d} \bigr) | \xi = 0 \text{ on } \Gamma _{D} \bigr\} . \end{aligned}$$

For more details see [39]. The Frobenius inner product for the matrices \(\mathcal{M}\), \(\mathcal{N}\) is defined by the pairwise sum of element-products

$$ \mathcal{M}:\mathcal{N} : = \sum_{i,j=1}^{d} \mathcal{M}_{ij} \mathcal{N}_{ij}. $$

With the fourth order tensor C, the product \(C\mathcal{M}\) is defined via

$$ [ C\mathcal{M} ]_{ij} : = \sum_{k=1}^{d} \sum_{l=1}^{d} C_{ijkl} \mathcal{M}_{kl}. $$

2.2 Linear elasticity problem

Using the displacement \(u: \Omega \rightarrow \mathbb{R}^{d}\), the linearized strain tensor

$$ \mathcal{E} ( u ) : = \frac{1}{2} \bigl( \nabla u + \nabla u ^{T} \bigr) $$
(1)

is defined.

The distribution of material in Ω is described by a phase field \(\varphi \in L^{\infty } (\Omega )\) with

$$ 0 \leq \varphi \leq 1 $$
(2)

almost everywhere in Ω. Here, \(\varphi = 0\) describes void and \(\varphi = 1\) represents areas containing material. In a physically accurate setting each point in space either does or does not contain material, i.e. \(\varphi \in \{ 0,1 \} \), leading to a sharp transition. However, in the realm of optimization a smooth transition between material and void is desired in order to calculate derivatives. This is achieved by explicitly allowing impure phases, i.e. states with \(0 < \varphi < 1\). The transition is seen as the interface between material and void.

Consider the symmetric fourth order stiffness tensor \(C (\varphi )\) with continuously differentiable entries. It is assumed that the derivative of the stiffness tensor \(C' (\varphi )\) is globally Lipschitz continuous. A transition function with cubic behavior for \(\varphi \in [0,1 ]\) is employed. This is not essential in the phase field approach, but empirically leads to a faster convergence. For \(\zeta >0\) the transition function is defined via

$$ s(x):=\textstyle\begin{cases} 0 & \text{for } x< 0, \\ x^{3} & \text{for } 0 \leq x \leq 1, \\ s_{r}(x) & \text{for } 1< x \leq 1+\zeta, \\ 1+\zeta & \text{for } x>1+\zeta , \end{cases} $$

where \(s_{r}\) is a monotone \(C^{1,1}\)-function such that s is in \(C^{1,1}\).

The elasticity tensor for the whole domain is defined in the following way

$$ C (\varphi ) : = C_{\mathrm{mat}}s (\varphi )+C_{\mathrm{void}} \bigl(1-s ( \varphi ) \bigr), $$
(3)

where

$$\begin{aligned} C_{\mathrm{mat}} \mathcal{E} &: = \lambda _{\mathrm{mat}} \operatorname{tr} ( \mathcal{E} ) I + 2 \mu _{\mathrm{mat}} \mathcal{E}, \\ C_{\mathrm{void}} \mathcal{E} &: = \epsilon ^{2} C_{\mathrm{mat}} \mathcal{E} \end{aligned}$$
(4)

for a quadratic matrix \(\mathcal{E}\). The constants \(\lambda _{\mathrm{mat}}\geq 0 \) and \(\mu _{\mathrm{mat}} > 0\) are called Lamé parameters. The constant \(\epsilon >0\) is a small parameter, which will be related later to the interface width when defining the Ginzburg–Landau term in Equation (8).

A load f is acting on a part of the boundary labeled \(\Gamma _{f}\) and a volume force g is present where material φ is located. The above definition warrants \(0 \neq C_{\mathrm{void}} \ll C_{\mathrm{mat}}\), which ensures low stiffness in void, but avoids degeneracy.

With the outer normal vector n, the strong form of the mechanical system is defined via

$$ ( \operatorname{MS} ) \textstyle\begin{cases} -\operatorname{div} [ C (\varphi )\mathcal{E} (u^{m} ) ] = \varphi g &\text{in }\Omega, \\ u^{m}= 0 &\text{on }\Gamma _{D}, \\ [ C (\varphi )\mathcal{E} (u^{m} ) ] n = 0 &\text{on }\partial \Omega \setminus ( \overline{\Gamma }_{D}\cup \overline{\Gamma }_{f} ), \\ [ C (\varphi )\mathcal{E} (u^{m} ) ] n = f &\text{on }\Gamma _{f}. \end{cases} $$

The weak formulation is written as

$$\begin{aligned} & \int _{\Omega }C (\varphi )\mathcal{E} \bigl( u^{m} \bigr):\mathcal{E} \bigl( v^{m} \bigr) \,\text{d}x= F \bigl( v^{m}, \varphi \bigr) \quad \forall v^{m}\in H^{1}_{D} \bigl( \Omega , \mathbb{R}^{d} \bigr), \\ & \text{where} \quad F \bigl( v^{m},\varphi \bigr): = \int _{\Omega }\varphi g\cdot v^{m}\,\text{d}x+ \int _{\Gamma _{f}}f \cdot v^{m}\,\text{d}\omega . \end{aligned}$$
(5)

Definition 1

(Weak solution of the mechanical system)

The function \(u^{m}\in H^{1}_{D} ( \Omega , \mathbb{R}^{d} )\) is a weak solution of the mechanical system \(( MS )\), if it fulfills the weak formulation (5).

The superscript m is used throughout this paper in connection with the mechanical system. A unique \(u^{m}\) exists, as proven for the phase field method in [11]. A more general and thorough discussion on existence theory for elasticity problems can be found in [20].

2.3 Topology optimization

This section is based on [14]. The aim of topology optimization is to distribute a limited amount of material in an optimal sense. Without limiting the material usage, the solution of the optimal control problem defined in Sect. 2.5 would be trivial: \(\varphi \equiv 1\) on Ω, i.e. covering the whole domain with material.

An additional constraint makes the problem more interesting. Let m be the mass parameter with \(0 < m < 1\). The amount of material is restricted via a volume constraint

$$ \int _{\Omega }\varphi \,\text{d}x= m \vert \Omega \vert , $$
(6)

where \(| \Omega |\) denotes the Lebesque measure of the domain Ω. The admissible set is defined as

$$ \mathcal{G}^{m}: = \biggl\{ \varphi \in H^{1} ( \Omega , \mathbb{R} ) | 0\leq \varphi ( x )\leq 1 \text{ a.e. in }\Omega \text{ and } \int _{\Omega }\varphi \,\text{d}x= m \vert \Omega \vert \biggr\} . $$

The objective is to find a material distribution \(\varphi \in \mathcal{G}^{m}\) and a corresponding solution of the elasticity problem \(u:\Omega \rightarrow \mathbb{R}^{d}\) such that the mean compliance

$$ F ( u,\varphi ) $$
(7)

is minimized. If \(C(\varphi )\) would be allowed to become zero for \(\varphi = 0\), boundary forces could be avoided trivially by not placing material where these forces act. On the other hand, soft surrogate material close to \(\Gamma _{f}\) leads to large displacements, increasing the compliance. This ensures that optimal solutions always have material placed where boundary forces act. However, this minimization problem is not well-posed as explained in [3]. The regularity of the solution is not ensured. In computational examples this can lead to a checkerboard solution. Checkerboarding is the frequent occurrence of jumps between material and void, which is not desirable, see [37]. The algorithm might produce so-called porous solutions, which can be thought of as sponge-like microstructures. In many industrial cases this type of material is hard to realize and therefore undesirable. The ill-posedness can be alleviated by adding a perimeter regularization which was proven in [7]. The paper [38] explains that the perimeter can be approximated by the Ginzburg–Landau term

$$ E^{\epsilon } (\varphi ): = \int _{\Omega }\frac{\epsilon }{2} \vert \nabla \varphi \vert ^{2}+ \frac{1}{\epsilon }\psi (\varphi )\,\text{d}x, $$
(8)

for \(\epsilon > 0\) and \(\varphi \in H^{1} ( \Omega ,\mathbb{R} )\cap L^{\infty } (\Omega )\). For convergence properties as the interface parameter ϵ approaches zero see [40]. The first term penalizes transitions between material and void through the gradient of the material distribution. The second term contains a potential \(\psi \in C^{1,1} (\mathbb{R}, \mathbb{R} )\) with \(\psi \geq 0\). A commonly used potential is the double well potential

$$ \psi ( \varphi ) = \frac{1}{4} \bigl( (\varphi -1 )\varphi \bigr)^{2} =\frac{1}{4} \bigl(\varphi ^{2}-\varphi \bigr)^{2}. $$

The aim of the potential is to penalize impure phases, which are states where the phase field φ is not equal to 0 or 1.

Lemma 1

There exist positive constants , Λ̄ and \(\Lambda '\) such that for all symmetrical \(\mathcal{M}, \mathcal{N}\in \mathbb{R}^{d\times d}\setminus \{ 0 \} \) and all \(\varphi \in \mathbb{R}\) the following relationships hold:

(9)
$$\begin{aligned} & \bigl\vert C' (\varphi ) \mathcal{M}:\mathcal{N} \bigr\vert \leq \Lambda ' \vert \mathcal{M} \vert \vert \mathcal{N} \vert . \end{aligned}$$
(10)

Proof

Follows from construction of \(C(\varphi )\). □

Assumption A1

The data lays in \(L^{2}\)

$$ f\in L^{2} \bigl(\Gamma _{f}, \mathbb{R}^{d} \bigr),\qquad g\in L^{2} \bigl(\Omega , \mathbb{R}^{d} \bigr) . $$

2.4 Additive manufacturing constraint

In additive manufacturing a structure is created in a layer-by-layer approach. Following [2] the intermediate states are taken into consideration to ensure stability during manufacturing. This can be thought of as slicing the final topology into horizontal layers and leads to the definition of the intermediate shape up to height \(h>0\)

$$ \Omega _{h} : = \Omega \cap \bigl\{ x= ( x_{1}, \ldots , x_{d} )^{T} \in \mathbb{R}^{d}, 0\leq x_{d}\leq h \bigr\} . $$

With a layer thickness \(l>0\), the layer from height \(h-l\) to height h is defined via

$$ L_{h} : = \Omega _{h} \setminus \Omega _{h-l}. $$

The Dirichlet boundary for the AMC problems differs from the Dirichlet boundary of the mechanical problem. In the mechanical problem it describes areas where the structure is supported when forces are applied. In the constraint problems the process of additive manufacturing is simulated. Homogeneous Dirichlet boundary conditions are assumed for all parts of the geometry touching the building plate \(\Gamma _{0}\). Notice that \(\Gamma _{0}\) does not change for different intermediate shapes. During the manufacturing process no surface forces are applied to the structure. Each intermediate shape \(\Omega _{h}\) is only subjected to gravity g. It is assumed that gravity is the primary opponent to successful 3D printing, which is the case for example for fused deposition modeling. Other issues, like thermal problems in powder bed fusion [29], are not considered here.

As opposed to [2], where gravity acts on the whole intermediate structure, it is here restricted to the newest, upmost layer. Otherwise the compliances of the lower layers of the structure would be taken into account multiple times, whereas the top layer is only considered once. This would lead to designs with a heavy bias towards stability during the beginning of the printing process. Support structures would mainly arise in the lower parts of the design. Restricting gravity to the upmost layer can also be motivated physically: Since the lower layers of the structure are already cooled down and hardened, they will not be displaced much under the influence of gravity. Only applying gravity to the newly printed layer can be thought of as implicity considering the phase change of molten to hardened plastic filament. For a given height \(h>0\) the AMC system is defined as

(AMCS) { div [ C ( φ ) E ( u h c ) ] = φ g 1 L h in  Ω h , u h c = 0 on  Γ 0 , [ C ( φ ) E ( u h c ) ] n = 0 on  Ω h Γ 0 ,

Note that one cannot just define the system on the layer \(L_{h}\), since the Dirichlet boundary is not part of that domain. The weak formulation is written as

Ω h C ( φ ) E ( u h c ) : E ( v h ) d x = Ω h φ g 1 L h v h d x v h H 0 1 ( Ω h , R d ) : = { ξ H 1 ( Ω h , R d ) | ξ = 0  on  Γ 0 } .
(11)

Definition 2

(Weak solution of the AMC system)

The function \(u_{h}^{c}\in H^{1}_{0} ( \Omega _{h},\mathbb{R}^{d} )\) is a weak solution of the AMC system \(( \operatorname{AMCS} )\), if it fulfills the weak formulation (11) on the corresponding space \(\Omega _{h}\).

The mechanical system \(( \operatorname{MS} )\) describes the load case where a force is acting on the structure. On the other hand the AMC system \(( \operatorname{AMCS} )\) models the printing process, where only gravity is considered. To help distinguish between both systems the superscript c is used in conjunction with the constraint problems.

In order to judge the stiffness during the manufacturing process, the compliance of the layer \(L_{h}\) is defined

c L h := Ω h φg 1 L h u h c dx.

For large overhang angles gravity will cause large displacements and therefore increase the compliance. Since compliance is the inverse of stiffness, low compliance values are desirable, because they coincide with high stiffness during the printing process. A penalty function is defined with \(H>0\) via

P ( u c , φ ) := 0 H 1 h Ω h φg 1 L h u h c dxdh.

The idea is to slice the domain Ω into N layers and define successively growing domains \(\Omega _{h}\) with \(\Omega _{h_{i}} \subseteq \Omega _{h_{j}}\) for \({h_{i}}\leq {h_{j}}\).

A test geometry is created to show the effect of the weighting term \(\frac{1}{h}\). In Fig. 1(a) the material is represented by the red areas. Two vertical beams are connected via eight horizontal beams, which have large overhangs. The bottom beam touches the building plate and is therefore not critical. Each of the other horizontal beams would lead to problems during additive manfucturing. However, Fig. 1(b) shows that without weighting, the AMC penalty term \(P^{d}\) increases for higher layers. This is caused by a linearly growing amount of material beneath the current layer, which is also subject to displacement. The algorithm would focus on decreasing overhangs towards the top of the domain. With weighting the AMC penalty term is more evenly distributed independent of layer height. As desired, the algorithm would decrease overhangs everywhere in the domain.

Figure 1
figure 1

Weighting leads to a more even focus of the AMC penalty term

Up to this point, the height h has been a continuous parameter. To avoid double subscripts it is now used as an index of the domain. For example, \(u_{h}^{c}\) is the displacement of the structure up to the h-th layer. The layer \(L_{h}\) corresponds to \(\Omega _{h}\setminus \Omega _{h-1}\). The following notation is used:

$$ u^{c}: = \bigl\{ u_{h}^{c} \bigr\} _{h=1}^{N} \in H_{0}^{1} \bigl(\Omega _{1},\mathbb{R}^{d} \bigr)\times \cdots \times H_{0}^{1} \bigl(\Omega _{N},\mathbb{R}^{d} \bigr) =: H^{c}. $$

The outer integral of \(P (u^{c},\varphi )\) is approximated via a Riemann sum. For the discretized penalty function the constant factor \(\frac{H}{N}\) is dropped, yielding

P d ( u c , φ ) := h = 1 N 1 h Ω h φg 1 L h u h c dx.

Not only the final structure shall bend as little as possible, but also all intermediate structures. Towards calculating the penalty function an additional N elasticity problems have to be solved.

2.5 Optimal control problem

With \(\beta , \gamma > 0\) all ingredients have been gathered to write down the optimization problem

$$ \bigl( P^{\epsilon } \bigr) \textstyle\begin{cases} \min &J^{\epsilon } ( u^{m},u^{c},\varphi ) : = F ( u^{m},\varphi ) +\beta P^{d} (u^{c},\varphi ) + \gamma E^{\epsilon } (\varphi ), \\ \text{over} & ( u^{m},u^{c},\varphi )\in H_{D}^{1} ( \Omega ,\mathbb{R}^{d} ) \times H^{c} \times H^{1} ( \Omega ,\mathbb{R} ) \cap L^{\infty } (\Omega ), \\ \text{s.t.} & ( u^{m},\varphi ) \text{ fulfills } \text{(5)} \text{ on } \Omega , \\ & ( u_{h}^{c},\varphi ) \text{ fulfills } \text{(11)} \text{ on } \Omega _{h}, h=1,\ldots ,N, \\ &\text{ and }\varphi \in \mathcal{G}^{m}. \end{cases} $$

3 Formal derivation of optimality conditions

The aim of this chapter is to derive optimality conditions. A rigorous mathematical analysis was conducted in [11], where the AMC could be incorporated. Here, only the formal Lagrange approach is covered, see [39].

With the weak formulation of the mechanical system (5) and the weak forms of the AMC systems (11) the Lagrange functional can be defined via

L ( u m , u c , φ , v m , v c ) : = F ( u m , φ ) + β P d ( u c , φ ) + γ E ϵ ( φ ) Ω C ( φ ) E ( u m ) : E ( v m ) d x + F ( v m , φ ) β h = 1 N 1 h [ Ω h C ( φ ) E ( u h c ) : E ( v h ) d x Ω h φ g 1 L h v h d x ] λ Ω ( φ m ) d x .

The Gâteaux derivatives of the Lagrange function with respect to the states \(u^{m}\), \(u_{h}^{c}\), \(h=1,\ldots ,N\) in the directions \(q^{m}\), \(q_{h}\), \(h=1,\ldots ,N\) respectively are calculated. This results in the adjoint equations

L u m [ q m ] = Ω C ( φ ) E ( q m ) : E ( v m ) d x + Γ f f q m d ω + Ω φ g q m d x = ! 0 , L u h c [ q h ] = β h Ω h C ( φ ) E ( q h ) : E ( v h ) d x + β h Ω h φ g 1 L h q h d x = ! 0 ,

for \(h=1,\ldots ,N\). Note that these adjoint equations match the state equations (5), (11) for \(h=1,\ldots ,N\) respectively. With \(|\Gamma _{D}|>0\), \(|\Gamma _{0}|>0\) one can deduce

$$\begin{aligned} v^{m}&\equiv u^{m}, \end{aligned}$$
(12)
$$\begin{aligned} v_{h}&\equiv u_{h}^{c}, \quad h=1,\ldots ,N. \end{aligned}$$
(13)

The derivative of the Lagrange function with respect to φ in direction ω is

L φ [ ω ] = γ Ω ϵ φ ω + 1 ϵ ψ ( φ ) ω d x Ω C ( φ ) ω E ( u m ) : E ( u m ) d x + 2 Ω ω g u m d x β h = 1 N 1 h [ Ω h C ( φ ) ω E ( u h c ) : E ( u h c ) d x 2 Ω h ω g 1 L h u h c d x ] λ Ω ω d x .
(14)

Since \(\mathcal{G}^{m}\) is convex, any optimal control satisfies the corresponding variational inequality, see [39, Thm. 1.2.]. The results are summarized in the following theorem.

Theorem 1

Let \(\bar {\varphi }\in \mathcal{G}^{m}\) be a local solution of the optimality problem \(( P^{\epsilon } )\). The following first order necessary optimality conditions hold

State Equations

Ω C ( φ ¯ ) E ( u m ) : E ( v m ) d x = F ( v m , φ ¯ ) v m H D 1 ( Ω , R d ) , Ω C ( φ ¯ ) E ( u h c ) : E ( v h ) d x = Ω h φ ¯ g 1 L h v h d x v h H 0 1 ( Ω h , R d ) , h = 1 , , N

Variational Inequality

γ Ω ϵ φ ( φ φ ¯ ) + 1 ϵ ψ ( φ ) ( φ φ ¯ ) d x Ω C ( φ ) ( φ φ ¯ ) E ( u m ) : E ( u m ) d x + 2 Ω ( φ φ ¯ ) g u m d x β h = 1 N 1 h [ Ω h C ( φ ) ( φ φ ¯ ) E ( u h c ) : E ( u h c ) d x 2 Ω h ( φ φ ¯ ) g 1 L h u h c d x ] λ Ω ( φ φ ¯ ) d x 0 φ G m .

4 Discretization

Observations and theoretical derivations of linear elasticity take place in the three-dimensional space. However, two-dimensional models are computationally less demanding and will therefore be studied here. An Allen-Cahn interface propagation is explained, which allows stationary problems to be solved iteratively. The Primal-Dual Active-Set Method is presented to solve the optimal control problem.

The goal is to construct a thin, 3D-printable structure. The plane stress model is feasible since it assumes that the z-dimension is very small in comparison to the other dimensions. The Lamé parameters have to be adjusted, as explained in [22].

The goal is to iteratively solve the stationary problem. The idea of a phase field interface propagations stems from the work of [19] and [4]. After an initial material distribution \(\varphi _{0}\) is set, pseudo timestepping is used to evolve the solution. The negative derivative of the reduced cost functional is chosen as the direction of interface movement, thus

$$ -j' (\varphi ) \omega = - \frac{\partial \mathcal{L}}{\partial \varphi } [\omega ] = \int _{\Omega }\frac{\partial \varphi }{\partial t}\omega \,\text{d}x\approx \int _{\Omega }\frac{\varphi ^{k+1}-\varphi ^{k}}{\tau }\omega \,\text{d}x, $$
(15)

where τ is the length of a pseudo time-step. Thus

Ω φ t ω d x = γ ϵ Ω φ ω d x γ ϵ Ω ψ ( φ ) ω d x + Ω C ( φ ) ω E ( u m ) : E ( u m ) d x 2 Ω ω g u m d x + β h = 1 N 1 h [ Ω h C ( φ ) ω E ( u h c ) : E ( u h c ) d x 2 Ω h ω g 1 L h u h c d x ] . + λ Ω ω d x
(16)

Towards better stability the equation is discretized in time using a semi-implicit approach

1 τ Ω φ k + 1 ω d x + γ ϵ Ω φ k + 1 ω d x 1 τ Ω φ k ω d x γ ϵ Ω ψ ( φ k ) ω d x + Ω C ( φ k ) ω E ( u m ) : E ( u m ) d x 2 Ω ω g u m d x + β h = 1 N 1 h [ Ω h C ( φ k ) ω E ( u h c ) : E ( u h c ) d x 2 Ω h ω g 1 L h u h c d x ] + λ k Ω ω d x .
(17)

Note that the time-step τ is just a numerical construct and does not represent a physically relevant time, hence the word pseudo.

When formulating the optimality system the box constraint \(0\leq \varphi \leq 1\) was taken into account via the space \(\mathcal{G}^{m}\). In accordance with [39] Karush–Kuhn–Tucker multipliers \(\mu _{+}, \mu _{-} \in L^{p} (\Omega )\) with \(1< p\ll 2\) are introduced such that

$$\begin{aligned} &0 \leq \varphi \leq 1\quad \text{a.e. in } \Omega, \\ &\mu _{+} \geq 0,\qquad \mu _{-} \geq 0\quad \text{in } \Omega, \\ &(\mu _{+},\varphi -1 )_{L^{p}} = (\mu _{-},- \varphi )_{L^{p}}=0 \quad \text{in } \Omega . \end{aligned}$$
(18)

The box constraint for the phase field is made up of the two inequalities \(-\varphi ( x ) \leq 0\) and \(\varphi ( x )-1\leq 0 \). For example the second inequality is called active in \(x \in \Omega \) if \(\varphi ( x ) -1 = 0\) and inactive if \(\varphi ( x ) -1 < 0\). Adding the equations of (18) to the Lagrange function yields

$$\begin{aligned} \mathscr{L} :=\mathcal{L} - (\mu _{+},\varphi -1 )_{L^{p}}- (\mu _{-},-\varphi )_{L^{p}}, \end{aligned}$$

which leads to the unconstrained optimality problem

$$\begin{aligned} \min_{\varphi \in H^{1} (\Omega ,\mathbb{R} )}\sup_{\mu _{-}, \mu _{+} \in L^{p} (\Omega )_{+}, \lambda >0}\mathscr{L}( \varphi , \mu _{-}, \mu _{+}, \lambda ), \end{aligned}$$

where

$$ L^{p} (\Omega )_{+} : = \bigl\{ \xi \in L^{p} ( \Omega ) | \xi \geq 0 \text{ a.e. in } \Omega \bigr\} . $$

In an optimum the following holds:

$$\begin{aligned} \frac{\partial \mathscr{L}}{\partial \varphi } [\omega ] = \frac{\partial \mathcal{L}}{\partial \varphi } [\omega ]- (\mu _{+}, \omega )_{L^{p}}+ (\mu _{-}, \omega )_{L^{p}} = 0 . \end{aligned}$$
(19)

If \(0<\varphi <1\), then \(\mu _{-} = \mu _{+} = 0\). Otherwise,

$$\begin{aligned} &\text{if } \varphi =1 \quad \text{solve } (\mu _{+}, \omega )_{L^{p}}= \frac{\partial \mathcal{L}}{\partial \varphi } [\omega ] \quad \forall \omega \in H^{1} (\Omega ,\mathbb{R} ) \cap L^{\infty } (\Omega ). \end{aligned}$$
(20)
$$\begin{aligned} &\text{if } \varphi =0 \quad \text{solve } (\mu _{-}, \omega )_{L^{p}}=-\frac{\partial \mathcal{L}}{\partial \varphi } [\omega ] \quad \forall \omega \in H^{1} (\Omega ,\mathbb{R} ) \cap L^{\infty } (\Omega ), \end{aligned}$$
(21)

The regularity of \(\mu _{-}\), \(\mu _{+}\) follows from standard arguments by making use of the regularity of \(\frac{\partial \mathcal{L}}{\partial \varphi }\), see [26]. This incorporation of the box constraint via Karush–Kuhn–Tucker-multipliers leads to the Primal-Dual Active-Set Method, see [14]. In each step the active sets are updated using the result from the previous iteration. If there are no further changes in these sets, the algorithm has converged and terminates. The pseudocode is displayed in Algorithm 1.

Algorithm 1
figure a

Primal-Dual Active-Set-Method

Intuitively one can think of material flowing to the areas where it has the largest impact on decreasing the Lagrange functional. Notice that φ is not constrained per se and thus might end up being significantly smaller than 0 or larger than 1 in parts of the domain. The idea behind this algorithm is to enforce the box constraints. Start with a \(\varphi ^{0}\) that does fulfill all constraints and \(\mu _{+}^{0}, \mu _{-}^{0} \equiv 0\), leading to \(\mathcal{A}_{+}^{1}\) and \(\mathcal{A}_{-}^{1}\) being empty and thus \(\mu _{+}^{1}, \mu _{-}^{1} \equiv 0\). Eventually \(\varphi ^{k}\) will exceed 1 or fall below 0 in parts of the domain. Then the corresponding active set \(\mathcal{A}_{+}^{k+1}\) or \(\mathcal{A}_{-}^{k+1}\) will be nonempty and in turn φ set to 1 or 0, respectively. This ensures that the box constraints are met.

The potential ψ introduced in Sect. 2.3 has a local maximum in \(\varphi = 0.5\). As an initialization \(\varphi ^{0}\equiv 0.5\) is used throughout our numerical experiments. In [14] it is explained why numerical oscillations can occurr if the active set parameter c is chosen too small with respect to the mesh resolution. In our numerical experiments we did not observe oscillations when setting \(c=\frac{2}{h_{\min }^{2}}\), with \(h_{\min }\) being the minimum mesh size. The elasticity equations and the gradient equation are solved via the Finite Element Method. According to the work of [27] the Primal-Dual Active-Set-Method can be interpreted as a semismooth Newton method. This yields local superlinear convergence.

5 Numerical examples

The goal of this section is to show the effect of the AMC on the optimal topologies. Standard topology optimization examples of an MBB beam and a cantilever were chosen. The code is implemented using P1 finite elements in FEniCS, see [33] and [5]. The main computational challenge arises from a high number of layers leading to many intermediate elasticity problems that need to be solved in each iteration. If done in serial, this is quite time consuming. Here, multiprocessing is used to solve the different elasticity problems concurrently on different processors. This leads to a considerable speedup.

Here, only linearly elastic, homogeneous, isotropic materials are considered. For a formal definition see [17]. Without explicitly mentioning them, SI-units are used throughout. Young’s modulus E is set to \(3.5\times 10^{6}\) and the Poisson ratio ν is assumed to be 0.3. According to [35], this corresponds to the widely used 3D printing filament PLA. Computations are done for a surface force \(f = ( 0 , -1 )^{T}\) and the maximum number of iteration steps is set to 100. The results of the topology optimization depend on the following three parameters: the Ginzburg–Landau parameter ϵ, the Ginzburg–Landau term prefactor γ and AMC prefactor β.

5.1 Parameter study for ϵ and γ

The findings of this section do not take the AMC into account. This is achieved by setting \(\beta =0\). The parameters ϵ, γ can be varied to influence the topologies resulting from the optimization. The parameter γ is the prefactor of the Ginzburg–Landau term and thus controls the influence of the perimeter regularization, which can be interpreted as a surface tension. Larger values of γ cause the material to lump together to simple, non-filigree structures. A sensibly small γ allows for the creation of more filigree structures while still avoiding checkerboarding. The parameter ϵ regulates the influence of the two summands within the Ginzburg–Landau term. When ϵ is increased, the gradient term receives a higher weight. Penalizing the derivative causes less jumps to occur. However, impure phases with \(0<\varphi <1\) are more likely to appear. Often, ϵ is referred to as the interface thickness parameter. If it is set too large, filigree structures cannot emerge. When ϵ is decreased, a transition from material to void is penalized less. A smaller interface thickness brings about more filigree structures. If ϵ is very small, the potential term dominates. Fine, pure-phased, porous structures arise. It helps to decrease the mesh size, which allows for thinner beams to be displayed. These effects of the parameters ϵ and γ are summarized in Fig. 2.

Figure 2
figure 2

Influence of parameters

Finding a suitable pairing can be very time consuming. In order to alleviate this problem, the parameters ϵ and γ are chosen adaptively as suggested in [23]. The following turned out to be a good choice:

$$\begin{aligned} & \epsilon= 3 h_{\min }, \\ &\gamma ^{k+1}= c_{\mathrm{GL}} \frac{F ( u^{m},\varphi ^{k} )}{E^{\epsilon } (\varphi ^{k} )} \end{aligned}$$
(22)

with \(c_{\mathrm{GL}}\) set to 0.1.

5.2 Cantilever beam

The setting of a cantilever beam is shown in Fig. 3. The structure is fixed at the left hand side and a downward force is applied in the middle of the right hand side. The domain is discretized using \(26{,}667\) degrees of freedom. The material usage is fixed at 40%. Ten layers corresponding to ten intermediate building steps are considered for the AMC. Computations take around 14 minutes.

Figure 3
figure 3

Cantilever beam setting

In order to test the influence of AMC, calculations are done for different factors β. The results can be seen in Fig. 4. Blue areas represent void and red areas correspond to material. The white parts are the interface, where \(0<\varphi <1\).

Figure 4
figure 4

Effect of the AMC for the cantilever beam example

Figure 4(a) depicts the structure without influence of the AMC, i.e. \(\beta =0\). The material is concentrated in major beams. Not a lot of support structures are present to hold the major beams in place. Generally, the severity of an overhang can be measured by its angle to the normal axis. As a rule of thumb, an angle of over 45 is critical. Here diagonal structures can be seen that have an angle to the vertical axis of well above 45, making it difficult to print the structure.

The penalty term is introduced by successively increasing the factor β. A change in topology can be seen when β reaches 0.01, see Fig. 4(b). Supporting structures arise, which hold up the major beams while they are being printed. This leads to less deformations during additive manufacturing. The small beams are mostly vertically oriented and thus can be manufactured easily.

As the AMC parameter β is increased, more and more support structures arise, which can be observed in Figs. 4(e) and 4(f). More material is placed near the bottom of the domain. Beams are oriented more vertically than before and intersect each other. Smaller beams deform less, which makes the structure more stable.

Notice that opposed to the geometric approach in [25], overhangs are tackled indirectly and thus are not fully avoided.

The resulting values for the compliance, Ginzburg–Landau term and AMC penalty term can be found in Table 1. As one would expect the compliance increases as the influence of the AMC gets larger. However, for the largest β value it only increases by around 10%, whereas the AMC penalty term is decreased by 80%, making the printing process more stable.

Table 1 Effect of the AMC for the Cantilever beam example

5.3 MBB beam

The setting of an MBB beam can be seen in Fig. 5. The structure is fixed in both directions at the bottom left hand side, but allowed to move in the horizontal direction at the bottom right hand side. A vertical force is applied in the middle of the top of the domain. Making use of the symmetry axis in the middle of the MBB beam, only half of the domain is discretized. The \(400 \times 133\) crossed P1 finite elements lead to a total of \(106{,}934\) degrees of freedom. Different from the cantilever example, the number of layers is increased from 10 to 100, making multiprocessing even more valueable. In [2] the computation for the same number of layers using \(300 \times 100\) Q1 elements, corresponding to \(30{,}401\) degrees of freedom, is reported to take 237 hours. With more than three times the degrees of freedom, computations here take less than 3 hours. When \(30{,}401\) degrees of freedom are used, this time reduces to 24 minutes.

Figure 5
figure 5

Setting of an MBB beam

The amount of material is set to 20%. As before, β is increased to see the influence of the AMC. The results can be seen in Fig. 6. Without the AMC large overhangs arise. Especially the long horizontal beam at the top of the structure is difficult to print. It is not supported from below, likely causing molten material to sag during the manufacturing processing. As β is increased, a lot of smaller supporting structures are created. In Fig. 6(f) the area below the long horizontal beam is evenly filled with supports. One also notices that the thick 45 beam near the force boundary is becoming thinner and more vertical as β is increased. More support structures and vertically aligned beams make it easier to manufacture the design. In Table 2 the results are gathered. As β is increased, the compliance is increased by less than 10%, but the AMC penalty term decreases by almost 90%. While the structure with \(\beta =64\) deforms slightly more during its original use case, it is considerablly more stable during the printing process.

Figure 6
figure 6

Effect of the AMC for the MBB beam example

Table 2 Effect of the AMC for the MBB beam example

6 Conclusion

Instabilities during additive manufacturing motivated research on this topic. The AMC was incorporated into the optimal control problem. Optimality conditions arose from a formal Lagrangian approach. The numerical approach was discussed. Experiments showed that the AMC decreases overhangs and brings about support structures.

To the author’s best knowledge this is the first time the AMC is applied to the phase field method for topology optimization. First order optimality conditions were derived. An Allen-Cahn interface propagation iteratively solved the stationary optimality problem. After a pseudo time discretization the Primal Dual Active Set Algorithm was executed. It was discussed how the topology can be influenced by setting the parameters ϵ and γ. After applying the AMC noticeable changes occured. More support structures emerged, leading to smaller intermediate compliances and in turn to a higher stiffness during the manufacturing process. The influence of the penalty term is adjustable, which allows the structures to be fine-tuned according to demands. Less labor intensive post processing is necessary, giving this approach an advantage over manually added support structures. However, opposed to the geometric approach, large overhang angles are tackled indirectly and thus are not fully avoided. It would be beneficial to print different structures to find out how this influences the manufacturing process. Further research on this topic could include the incorporation of a micro field to represent lattice structures. This helps create printable light-weight constructions. Here, a phase flow approach was used. An implementation of the projected gradient method, see [15], could speed up the convergence. Additionally, one could implement an adaptive mesh, which is fine in the interface region and coarser otherwise. This would reduce computational costs and make three dimensional calculations less demanding. An integration of stress constraints is desirable for industrial applications. On a larger scope there are many more problems in additive manufacturing which can be tackled with optimization methods.