Topology Optimization Considering Porosity Defects in Metal Additive Manufacturing

: In this paper, considering the porosity defects of Additive Manufacturing (AM), a level set topology optimization method for AM with porosity constraints is proposed. The concept of topological sensitivity is used to formulate a global porosity constraint function in the proposed method, and a level set topology optimization model considering porosity defects is obtained. To improve the robustness of the algorithm, the topology optimization model is solved in two phases. At first, the classical level set method without the porosity constraint is used to initially optimize the structure. During this process, the hole nucleation method combining bi ‐ directional evolution ‐ ary structural optimization (BESO) and the topological sensitivity is used. Secondly, the topology optimization considering the effects of porosity is implemented on the preliminary optimization results. After performing the two ‐ step optimization, a robust structure that alleviates the harmful impact of porosity defects is obtained. Finally, the robustness and effectiveness of the proposed method are validated by several two ‐ dimensional numerical examples.


Introduction
Topology optimization is a calculation method that achieves the optimal material configuration in the design domain according to the given boundary conditions and the load conditions. In the past decades, many effective topology optimization methods have been studied and applied, e.g., the homogenization method [1][2][3][4][5], the Solid Isotropic Material with Penalization (SIMP) method [6][7][8][9], the Evolutionary Structural Optimization (ESO) method [10][11][12][13][14], the Moving Morphable Component (MMC) method [15][16][17][18], and the level set method [19][20][21][22][23][24][25]. In particular, the level set method is introduced as an alternative new method in the structural optimization field. This method uses a higher-dimensional level set function to implicitly represent the structural boundary (zero level set) and then obtains the updated structural boundary via the evolution of the level set function during the optimization process. This implicit expression can avoid the relaxation of design variables and numerical instability. As a result, the level set topology optimization is recognized by many researchers.
The studies and applications of numerous optimization methods have made the field of structural optimization to develop rapidly. For example, Calleja-Ochoa et al. [26] established a method of designing and manufacturing micro-structured ultralight components to achieve the goal of lightweight. Topology optimization achieves lightweight structure but results in a more complex structure. Complex structures cannot be manufactured easily by traditional manufacturing processes (turning, milling, casting, etc.). However, the rapidly developing Additive Manufacturing (AM) technology is a forming method in which materials are overlapped layer by layer, which fully eliminates the limitation of geometric complexity. AM makes it possible to manufacture complex structures derived from topology optimization and provides technical support for the application of topology optimization. On the other hand, affected by the cost of AM, how to reduce the consumption of AM has become an urgent problem to be solved. The topology optimization can effectively reduce material consumption under the condition of satisfying structural performance, which provides a solution for reducing the manufacturing cost of AM. In theory, the characteristics and advantages of both topology optimization and AM enable them to complement each other.
AM has unlimited potential, but it does not have unlimited capabilities. Laser AM is based on the technical principles of point-by-point melting, line-by-line scanning, and layer-by-layer accumulating. The metal material undergoes complex thermodynamic behavior under the action of the laser, and the parts are fabricated after the cyclic process of heating, melting, cooling, and solidifying. When affected by many conditions such as laser power, scanning speed, powder materials, and temperature, defects will inevitably occur in the fabricated parts. In recent years, these defects of laser AM have been studied widely [27][28][29][30][31][32][33][34][35].
Porosity is one of the most common defects in laser metal AM. The shape of pores is relatively regular and mostly spherical, and the size is generally small (within 100 μm) [36][37][38][39]. Most of these defects are generated by gas remaining in the molten pool due to excessive or unstable energy input. In the process of material melting and solidifying, the gas in the molten pool does not have sufficient time to escape. Furthermore, the higher the temperature of the molten pool during the melting process, the higher the solubility of the gas in the molten pool. As the molten pool cools, the temperature and the solubility decrease, and the residual gas increases [39].
In the AM process, eliminating or suppressing porosity defects is a challenging problem. Gäumann et al. [40] presented Epitaxial laser metal forming (E-LMF) to effectively reduce porosity defects in AM process. Clijsters et al. [41] designed a real-time molten pool monitoring system which consists of an optical sensor, data processing, reference database, and quality evaluation. In this system, the sensor collects the melt pool information in the form of an optical signal, and then transmits it to the data processing module to establish the melt pool image. Then, the location and size of the defects are determined by comparing with the reference database. Finally, the process parameters are optimized by the feedback system to reduce the porosity. Although the proposed methods can effectively reduce the porosity defects, they cannot completely remove the porosity defects.
It is well known that stress concentration occurs near the defects of the fabricated part. Under the external load, the stress near the defects will increase significantly. When the ultimate strength of the material is exceeded, cracks are generated and gradually expand until fracture failure. Thus, the existence of porosity has a significant impact on the mechanical properties of the fabricated parts. Moreover, the pores not only are the source of fatigue cracks but also accelerate the expansion of fatigue cracks under the stress concentration, greatly reducing the fatigue life of the fabricated part. The more pores in the fabricated parts, the more cracks may occur. It is difficult to satisfy the requirements with the existence of porosity, which restricts the usability of the fabricated parts.
According to our investigation, few researchers consider the porosity defects of the AM in the topology optimization problem. In this paper, the concept of topological sensitivity is employed to construct a porosity constraint function in the form of domain integral and a level set topology optimization model considering the effects of porosity is proposed. To improve the robustness of the algorithm, the topology optimization model is solved by two steps. At first, the classical level set method is used to initially optimize the structure. Secondly, the porosity is taken into topology optimization of the structure after the initial optimization, and a robust structure that minimizes the impact of porosity is obtained.
Since the reinitialization retains the properties of the signed distance function, the holes cannot be automatically nucleated in the solid design domain, i.e., the topology change can only rely on the existing initial structural boundary. In the past few decades, some solutions have been proposed for hole nucleation. Allaire et al. [42] proposed a level set topology optimization method that inserts holes according to the value of topological sensitivity. He et al. [43] added topological sensitivity as a diffusive term of the Hamilton-Jacobi equation, so that new holes were automatically nucleated during the optimization process. Xia et al. [44] proposed a hole nucleation method in combination with bi-directional evolutionary structural optimization (BESO) based on the material removal scheme. Yaghmaei et al. [45] proposed a filtering level set method to nucleate holes and avoid reinitialization of level set function. Although the above hole nucleation method makes the level set method unnecessary to guess the initial structure, the effect of hole nucleation is not ideal for various reasons. Therefore, it is necessary to propose a new hole nucleation method.
In the present work, a new level set hole nucleation method is proposed by combining the BESO method with topological sensitivity. This method can automatically find and nucleate holes within the design domain.
The rest of this paper is organized as follows: Section 2 reviews the level set topology optimization methods. Section 3 describes the hole nucleation method combining BESO and topological sensitivity. In Section 4, a level set topology optimization model considering porosity defects is formulated, and the shape sensitivity of the constraint function is calculated. Section 5 lists the optimization procedure. Section 6 gives numerical examples and discussions. Finally, the paper is summarized in Section 7.

Level Set Topology Optimization
In the level set topology optimization of continuum structure, an optimal design Ω is sought in the design domain D, and ∂Ω is the boundary of Ω. The topology of the structure is described by the implicit level set function Φ(x) as: In the problem of maximizing structural stiffness (i.e., minimizing compliance), it is assumed that the constraint condition is the optimized structural volume, and the optimization objective is the compliance. When the load and boundary conditions are given, the topology optimization problem can be described as: where u is the displacement field, E is the elasticity tensor of the material, is the strain tensor, P is the body force, τ is the boundary force, Ω is the volume of the structure, and Vmax is the maximum admissible volume. This paper aims to study the topology optimization problem of the linear elastic structure, so the boundary ∂Ω of the design domain Ω consists of three parts: where ΓD is the Dirichlet boundary conditions and ΓN is the Neumann boundary conditions. Therefore, the linear elastic problem described in (2) is also expressed as: Then, the objective function based on compliance can be expressed as: Employing the level set function Φ(x), the level set topology optimization problem is written as follows: where a(u, v, Φ), L(v, Φ) and V(Φ) are expressed as: where H(⋅)is the Heaviside function, which is defined as: is the Dirichlet function, and its relationship with the Heaviside function is as follows: (9) To solve the Hamilton-Jacobi partial differential equation, the concept of shape sensitivity is introduced to calculate the velocity field Vn of the level set function. The Murat and Simon analysis [46] based on the Hadamard variational method was used to calculate shape sensitivity. Considering a smooth initial shape Ω0, all admissible shapes Ω are obtained by applying a smooth vector field θ: The above equation shows that all admissible shapes are represented by a vector , so (10) is also written as: where (Id + θ) is the diffeomorphic mapping of Ω0. Then, the shape sensitivity can be defined by the derivative with respect to θ. The shape expression (10) means that all admissible shapes will have the same topology as the initial shape Ω0. Therefore, the topology cannot be changed by continuously transforming the initial shape Ω0, which theoretically answers the reason why the level set topology optimization method cannot automatically nucleate holes.
Based on the above assumptions, the shape sensitivity of the objective J(Ω) on Ω0 can be defined as the Fréchet derivative at θ = 0: where J(Ω) has first-order continuous differentiability at θ = 0. According to the definition of shape sensitivity, shape sensitivity (12) is also rewritten as: Wang and Allaire have already calculated the shape sensitivity of the optimization problem (6). This paper will directly quote the results, and the detailed process is in Wang and Allaire et al. [19,25]. Lemma 1. The shape sensitivity of the compliance is: Lemma 2. The shape sensitivity of the volume constraint is:

BESO
BESO is developed from ESO which was originally proposed by Xie et al. [13] in 1992. ESO allows only to remove material from the structure, and those removed materials cannot be admitted in the later evolutions. Therefore, some elements with higher utilization are accidentally removed. Correspondingly, Xie et al. [14] proposed the BESO that can remove low-efficiency materials and add materials at key positions. This method is widely used in machinery, civil engineering, aerospace, and other fields because of its simple algorithm and easy programming.
In BESO, the sensitivity number is used to remove low-efficiency materials or add high-efficiency materials. In other words, material is removed or added in the design domain by comparing the value of the sensitivity number. Therefore, BESO regards the structure itself as the design variable of the optimization problem. The optimization problem is expressed as: where compliance C is the objective of the optimization problem, F is the load vectors, u is the displacement vectors, K is the global stiffness matrix, Vi is the elemental volume, V * is the total volume of the design domain, f is the volume fraction, and N is the number of elements in the design domain. The design variable xi is the elemental density with xi = 0 for a void element and xi = 1 for a solid element.
In BESO, the sensitivity number is compared with the sensitivity threshold. For solid elements, the sensitivity number is greater than or equal to the threshold. For void elements, the sensitivity number is less than the threshold. The elemental sensitivity number is defined as the change of the mean compliance or elemental strain energy: (17) To calculate the sensitivity of void elements, a sensitivity filter scheme is introduced. Furthermore, this filter method can solve the checkerboard and mesh dependency. The formula for sensitivity filter scheme is written as: where αi is the elemental sensitivity after filtering, and is the elemental sensitivity before filtering. The neighbor elements set Ni of the element i is defined as all elements whose spatial distance from the central cell i is less than or equal to the filtering radius Rmin. The weight factor ω(rij) of the spatial distance is: (19) where rij is the spatial distance between element j and central element i, defined as ||xj-xi||.
The sensitivity threshold α th can be determined by the target volume V k+1 . The target volume can be calculated by the current volume and the evolutionary volume ratio cer: If the current structure volume is equal to the volume constraint, the target volume V k+1 will remain Vmax.
The finite element analysis, sensitivity filtering, and structure update are continuously looped until the volume constraint and the convergence criterion (21) are satisfied.
where e is the change of objective, δ is the tolerance factor, and N is a positive integer.

Topological Sensitivity
The topological sensitivity defines the impact on the objective when a small hole is inserted at a certain position in the design domain. The topological sensitivity of the objective J(Ω) in a given design domain is defined as: where M(r) is the measure of the hole Br. According to reference [47], this paper takes the Lebesgue measure, which can be written as: According to the topological-shape sensitivity method [47], topological sensitivity can be solved by shape sensitivity. The relationship between shape sensitivity and topological sensitivity is expressed as: This paper aims to study the topology optimization problem based on the compliance, so it is necessary to solve the topological sensitivity of the compliance. According to the research of Novotny et al. [48], the topological sensitivity of compliance is: where λ and μ are the Lamé moduli of the material, which satisfy:

Hole Nucleation Method Combining BESO and Topological Sensitivities
The BESO method uses the sensitivity number as the criterion to remove low-efficiency materials or add high-efficiency materials to optimize the structure. The topological sensitivity describe the impact of inserting holes on the objective. Using topological sensitivity as the criterion for removing or adding materials in the BESO method has practical physical meaning. Therefore, the combination of BESO and topological sensitivity can be used as a hole nucleation method for level set topology optimization.
Thus, the sensitivity number αi of BESO can be replaced with the topological sensitivity: According to the idea of BESO, adding and removing materials in the current structure requires topological sensitivity threshold . The threshold is usually determined according to a given evolutionary volume ratio. Assuming that there are N elements in the design domain, the topological sensitivity of all elements is arranged according to the value, that is ⋯ ⋯ . According to (20), V elements are required to maintain holes (i.e., N-V solid elements), then the topological sensitivity threshold is: (30) However, only using the threshold as in (30) is likely to cause unstable optimization. As the BESO method always needs to add or remove materials, it will continue to add or remove materials from the boundary of the structure when the structure is close to the optimization result. In this case, the boundary based on the evolution of the level set method will continue to be updated, and the material will be added at the position where the material was removed by the BESO method, which will easily cause numerical instability and lead to optimization failure. Therefore, another topological sensitivity threshold needs to be introduced in the optimization, and its value is determined according to the average topological sensitivity of the structure boundary ∂Ω. The boundary threshold can be described as: where 0 < β < 1 is a user-defined threshold factor, and is the average topological sensitivity of the structure boundary ∂Ω.
Therefore, the topological sensitivity threshold of adding and removing materials can be defined as: The holes are nucleated every j iteration in this hole nucleation method. After multiple iterations, if the topological sensitivity in the solid domain is greater than or equal to the threshold , the hole nucleation process ends. The procedures of level set topology optimization combining BESO and topological sensitivity are as follows: 5. If the current iteration number is an integer multiple of j, nucleate hole by (45), then go to step 6. Otherwise, go to step 7; 6. Calculate the topological sensitivity threshold ; 7. Reinitialize the level set function; 8. Check whether the convergence criteria are satisfied. If not, repeat steps 2-8 until convergence.
The flowchart of level set topology optimization combining BESO and topological sensitivity is shown in Figure 1.

Constraint Function Considering Porosity Defects
Topology optimization is to find the optimal material distribution to achieve the best structural performance. However, the appearance of porosity in the subsequent AM process will affect the performance of the structure, causing the manufactured parts to fail to satisfy the performance requirements. Therefore, it is necessary to consider the effects of porosity during the structural topology optimization, so that the manufactured parts still satisfy the requirements.
In actual production, the generation of porosity is closely related to laser power, forming speed, scanning scheme, forming environment, and other factors in additive manufacturing. Our method cannot avoid the generation of porosity during the manufacturing process, that is, porosity will still be generated in the optimization results. However, we can consider these porosity defects in the optimization process, so as to reduce its effects on the structural performance of the optimization results. In other words, the optimization results without considering the porosity constraints cannot meet the actual working conditions due to the existence of porosity, while the optimization results considering the porosity constraints can still meet. Therefore, this method can greatly promote the combination of additive manufacturing and topology optimization, so as to greatly improve the production efficiency and capacity.
Topological sensitivity is defined as the impact of objective when a small hole is inserted, which is compatible with the impact of porosity on structural performance. Therefore, this paper will use topological sensitivity to define the porosity constraint function.

Formulation of Porosity Constraints
Assuming Bx,r = x + rB, x∈Ω represents a small pore with radius r at x in the design domain Ω, the design domain where the pore appears can be expressed as Ω0,x,r = Ω0 − Bx,r. The objective function J(Ω0) does not change significantly due to the appearance of pores in the design domain Ω0, so the change of structural performance before and after the appearance of pores can be expressed as: Introduce the definition of topological sensitivity in Section 3.2: , , , where M(Bx,r) is the measure of the pore Bx,r and lim After considering the porosity constraints, assuming that Ω is set as the structural design domain of the optimal design, and J(Ω ) is the corresponding objective function to characterize the structural performance, the change of structural performance can be obtained: According to the above analysis, the structural performance will decrease after considering the porosity constraint, so the inequality can be established： 0 where η ∈ 0,1 is a user-defined tolerance that indicates the admissible change of objective.
In level set topology optimization, the inequality is not conducive to solving by Lagrange method, so inequalities need to be transformed. According to the work of Allaire et al. [49,50], assuming [F] + ≡ max(F, 0), the inequality (37) satisfies: Equation (38) are constraints defined at various points in the design domain. This type of constraint is inconvenient for implementation in topology optimization and to solve shape sensitivity. Addressing the issue, the domain integral is established: Therefore, the topology optimization problem considering porosity constraints is expressed as: • . .

Shape Sensitivities of Porosity Constraints
The level set method topology optimization needs to solve the shape sensitivity of the objective and the constraint function. The shape sensitivity of the compliance and the volume constraint have been obtained in Section 2. Next, the shape sensitivity of the porosity constraint function will be derived.
The shape sensitivity of the constraint function is solved by the Céa method. Introducing Augmented Lagrangian: , , 1 2 : Under the optimization theory, the stagnation point of the Lagrangian is the optimality condition of the minimization problem. Therefore, the optimal value of the function can be solved by finding the stagnation point of the function. For a given Ω, (uΩ, pΩ) represents the stagnation point. At first, take the partial derivative of L(Ω, u, p) with respect to p: Let (42) be equal to 0, which is the same as the linear elastic equation in the optimization problem. Therefore, the solution of (42) is equal to the solution of the linear elastic equation, i.e., u = uΩ = ue.
Secondly, take the partial derivative of L(Ω, u, p) with respect to u: , , , : Let (43) be equal to 0, suppose its solution is p = pΩ, which results in: The shape sensitivity of the constraint function can be obtained by differentiating (Ω) = L (Ω, u, p). According to the chain derivation rule, the shape sensitivity of the objective function can be obtained as: Substituting (uΩ, pΩ) into (45), the second term Ω, , on the right side of (45) is equal to 0, so the shape sensitivity of the constraint function is: Quoting Lemma 4 and Lemma 5 in [20], the result is: when u∈ΓN, θ = 0. The shape sensitivity of the constraint function is: (51)

Optimization Procedure
In this paper, the Lagrangian method is used to solve the level set topology optimization problem (40), which transforms the optimization problem into the Lagrangian unconstrained minimization problem. The topology optimization problem is transformed into: where ℓ ℓ , ℓ and γ = (γ1, γ2) are the Lagrangian multipliers and the penalty factors of the constraint function, respectively.
The shape sensitivity of the augmented Lagrangian function can be derived as: Substituting J'(Ω)(θ) and C'p(Ω)(θ), the normal evolution velocity Vn of the Hamilton-Jacobi equation can be obtained.
When performing a one-step solution, it is easy to make the optimization considering the effects of porosity converge to the local optimal solution. Addressing the issue, the topology optimization is solved in two steps in this paper. For one thing, the hole nucleation method combining BESO and topological sensitivity can be used to reduce the influence of initial hole distribution on the optimization results. For another, the optimization results obtained in the previous step can be directly used in the second step, which improves the convergence efficiency of the optimization. Therefore, the level set topology optimization algorithm considering porosity constraints is summarized as follows: 1. Perform preliminary structural optimization according to the level set topology optimization combining BESO and topological sensitivity and obtain optimal results without considering porosity constraints; 2. Import optimization results without considering porosity constraints for subsequent optimization; 3. Initialize the level set function Φ2 according to the preliminary optimization results; The optimization process of level set topology optimization considering porosity constraints is shown in Figure 2.

Numerical Examples
In this Section, two examples are given to verify the effectiveness of the proposed porosity constraints. For the convenience of calculation, the measure M(Bx,r) of the small pores is expressed as: where d represents the structural dimension.
The Lagrangian multipliers and the penalty factors of (53) will be updated continuously with the rule: where ℓ ℓ , ℓ is updated every iteration and γ = (γ1, γ2) is updated every five iterations. In the level set topology optimization, it is difficult to select the initial values of Lagrangian multipliers and the penalty factors. The initial values of the following numerical examples follow the empirical formula: Since the main purpose of this Section is to verify the effectiveness of the method, all material properties and loads are dimensionless. The materials for all numerical examples are isotropic. Assume that the Young's modulus of the solid material is E1 = 1, the Young's modulus of the void material is E0 = 10 -3 , and the Poisson's ratio is ϑ = 0.3. All examples adopt four-node rectangular elements to mesh the design domain.

L-Shaped Beam
The design domain of this optimization problem is an L-shaped area with a ratio 1:1 of length L to height H, meshed with 4800 elements, as shown in Figure 3a. Its upper side is fixed, and a vertical load P = 1 is applied at the middle of its right-hand side. The upper bound of volume ratio is 0.4. The evolutionary volume ratio cer is set to 0.04, the filter radius Rmin is taken as 3, and the interval j of hole nucleation is 5. The initial shape is displayed in Figure 3b. At first, the level set topology optimization of hole nucleation combining BESO and topological sensitivity is employed. The optimized shape is shown in Figure 4. The optimization converges after 65 iterations, and the evolution of the volume fraction and the compliance are shown in Figure 5.   Secondly, the level set topology optimization considering porosity constraint is employed. The preliminary optimization results of the previous step are imported to perform topology optimization considering porosity constraint. The pores radius r is set to 0.625, and the tolerance η is taken as 0.3. The optimization converges after 14 iterations, and the evolution of the volume fraction, the compliance and porosity constraint are shown in Figure 6. The preliminary optimization results and the optimization results considering porosity constraint are shown in Figure 7a,b, respectively, and the corresponding porosity constraint distribution clouds are shown in Figure 7c,d. As shown in Figure 6, the optimization problem with porosity constraints converges after 14 iterations, the porosity constraint value decreases 30% from 14.6, but the objective compliance increases from 87.8 to 93.5. Without considering the porosity constraint, the maximum porosity constraint value appears near the reentrant corner of the optimization result shown in Figure 7c, while the porosity constraint value in other areas is almost zero. According to practical experience, the reentrant corner is easy to produce stress concentration under the loads. If there are pores in this area during manufacturing, cracks will be generated under the action of concentrated force, which will reduce the fatigue performance of parts. Therefore, the reentrant corner is more sensitive to porosity. If the reentrant corner is smoothed into a rounded area, the stress concentration can be effectively reduced, and the sensitivity to the porosity is also reduced. Therefore, under the effect of porosity constraints, the reentrant corner will be key optimization region of the structure. According to the optimization result in Figure 7d, under the effect of porosity constraints, the reentrant corner becomes smooth and presents a characteristic of fillet, while the other regions almost have no change. By observing the corresponding porosity constraint value in this area, it can be found that the porosity constraint value has decreased significantly, and the maximum porosity constraint value in this area has decreased from 1.92 to 1.14. According to the numerical analysis, the topology optimization method considering porosity constraints is effective and conforms to the actual situation. Comparing the changes in compliance with or without considering porosity constraint, there is a deviation that is within the admissible range.

C-Shaped Bracket
The design domain of the second example is a C-shaped area with a ratio 3:2 of length L to height H, meshed with 3600 elements, as shown in Figure 8a. Its lower side is fixed, and a vertical load P = 1 is applied at the bottom of its right-hand side. The upper bound of volume ratio is 0.4. The evolutionary volume ratio cer is set to 0.04, the filter radius Rmin is taken as 3, and the interval j of hole nucleation is 5. The initial shape is displayed in Figure 8b. At first, the level set topology optimization of hole nucleation combining BESO and topological sensitivity is employed. The optimized shape is shown in Figure 9. The optimization converges after 75 iterations, and the evolution of the volume fraction and the compliance are shown in Figure 10.   Secondly, the preliminary optimization results of C-shaped bracket are imported to perform topology optimization considering the porosity constraint. The pores radius r is set to 0.5, and the tolerance η is taken as 0.15. The optimization converges after 15 iterations, and the evolution of the volume fraction, the compliance, and porosity constraint are shown in Figure 11. The preliminary optimization results and the optimization results considering porosity constraint are shown in Figure 12a,b, respectively, and the corresponding porosity constraint distribution clouds are shown in Figure 12c,d. (c) (d) Figure 12. Optimization results and porosity constraint distribution clouds of C-shaped bracket, (a) optimized shape without considering porosity constraint; (b) optimized shape considering porosity constraint; (c) porosity constraint distribution clouds without considering porosity constraint; (d) porosity constraint distribution clouds considering porosity constraint.
As shown in Figure 11, the optimization problem with porosity constraints converges after 15 iterations, the porosity constraint value decreases 15% from 187.1, but the objective compliance increases from 293.7 to 323.3. Without considering the porosity constraint, the maximum porosity constraint value appears near the reentrant corner of the optimization result shown in Figure 12c, while the porosity constraint value in other areas is almost zero. Therefore, under the effect of porosity constraints, the reentrant corner will be key optimization region of the structure. According to the optimization results of Figure 12d, under the effect of porosity constraint, the reentrant corner becomes smooth and presents a characteristic of fillet. The results show that the porosity constraint value decreases obviously, and the maximum value decreases from 18.9 to 10.4. Comparing the changes in compliance with or without considering porosity constraint, there is a deviation that is within the admissible range. The optimization results of the C-shaped bracket are similar to the L-shaped beam, which further proves the effectiveness of the proposed method.

Conclusions
Porosity is one of the main defects of the manufactured parts by AM. The appearance of porosity will significantly reduce the mechanical and fatigue properties of fabricated parts and accelerate the failure of parts. To reduce the influence of porosity, the pores are considered in topology optimization for AM so as to obtain a robust optimization result. In this paper, the concept of topological sensitivity is used to establish the global porosity constraint function, and the shape sensitivity of the porosity constraint is analyzed. Considering the robustness of the algorithm, the topology optimization considering the porosity constraint is performed by two steps. In the preliminary optimization of the structure, a hole nucleation method combining BESO and topological sensitivity is proposed to solve the problem that the level set topology optimization method cannot automatically nucleate holes. Next, the preliminary optimization results are subjected to topology optimization considering porosity constraint, obtaining the results that can reduce the effects of porosity on structural performance. In the L-shaped beam, the porosity constraint value of the optimization results is reduced by 30%. In the C-shaped bracket, the value is reduced by 15%, but the compliance of the structural performance is only slightly increased. Compared with the decrease of porosity constraint value, the change of compliance is very small and within the admissible range. The step-by-step optimization method proposed in this paper will not increase the extra workload for engineers to guess the initial structure and improve the convergence efficiency of the optimization algorithm. This method provides a potential solution for multi-constraint topology optimization problems. In future work, the idea of using topological sensitivity to construct porosity constraints can also be used to consider additive manufacturing defects such as cracks and spheroidization in topology optimization, which further broadens the research field of topology optimization for additive manufacturing defects.