# Topology Optimization Considering Porosity Defects in Metal Additive Manufacturing
## 3 Hole Nucleation Method
### 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 \(\alpha_{i}\) of BESO can be replaced with the topological sensitivity:  
\[D_{T}^{i}=\lim_{r\to 0}\frac{1}{M^{\prime}(r)|V_{N}|}\frac{dJ(\Omega)}{d \theta}\bigg{|}_{\theta=0} \tag{29}\]  
According to the idea of BESO, adding and removing materials in the current structure requires topological sensitivity threshold \(D_{T}^{th}\). 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 \(D_{T}^{i}\) of all elements is arranged according to the value, that is \(D_{T}^{1}<D_{T}^{2}<\dots<D_{T}^{V}<\dots<D_{T}^{N}\). According to (20), V elements are required to maintain holes (i.e., N-V solid elements), then the topological sensitivity threshold is:  
\[D_{T}^{th}=D_{T}^{V} \tag{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 \(D_{T}^{th}\) needs to be introduced in the optimization, and its value is determined according to the average topological sensitivity of the structure boundary \(\partial\Omega\). The boundary threshold \(D_{T}^{th}\) can be described as:  
\[D_{T}^{th}=\beta\overline{D_{T}} \tag{31}\]  
where \(0<\beta<1\) is a user-defined threshold factor, and \(\overline{D_{T}}\) is the average topological sensitivity of the structure boundary \(\partial\Omega\).  
Therefore, the topological sensitivity threshold of adding and removing materials \(D_{T}^{th}\) can be defined as:  
\[D_{T}^{th}=\min\Bigl{(}D_{T}^{th},D_{T}^{th}\Bigr{)} \tag{32}\]  
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 \(D_{T}^{th}\), the hole nucleation process ends.  
The procedures of level set topology optimization combining BESO and topological sensitivity are as follows:Define the design domain and initialize level set function;  
Solve linear elasticity equation via the Finite Element Method;  
Calculate shape sensitivity, topological sensitivity, and the normal evolution velocity \(V_{n}\);  
Solve the Hamilton-Jacobi equation to update the level set function;  
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;  
Calculate the topological sensitivity threshold \(D_{T}{}^{th}\);  
Reinitialize the level set function;  
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.