## 4 Examples
### Mesh Deformation Example  
In computational fluid dynamics simulation, the computational mesh should conform to the changing flow domain at each time step during the simulation process. However, mesh deformation methods may lead to the generation of inverted elements for large mesh deformations. Mesh smoothing and untangling algorithms are of great importance for improving the deformation capacity and deformation effect of mesh deformation methods under large deformations.  
In this example, an unstructured NACA0012 airfoil mesh with 5892 nodes and 11,363 triangular elements is tested. The size of the square domain is \(20\times 20\), while the chord length of airfoil is 1. The airfoil moves 6 units to the both down and right while it rotates 75 degrees counterclockwise around its aerodynamic center, which is a very typical case for mesh deformation. The deformed mesh obtained using the mesh deformation method proposed in Reference [33] is shown in Figure 7a, and the deformation is accomplished in a single step. Due to the large deformation, the deformed mesh has 459 inverted elements. The three untanglers in Mesquite and the proposed approach are used to optimize the deformed mesh. The optimization results are given in Table 2, and the optimized meshes are shown in Figure 7.  
None of the three untanglers in Mesquite can untangle the deformed mesh, and the number of inverted elements in the resulting meshes is even larger than that of the initial deformed mesh. Among them, the Size untangler has the worst optimization effect, and some nodes in the output mesh even locate outside the initial boundary.  
The proposed approach successfully untangle the deformed mesh. The average and minimal quality of the optimized mesh are 0.8102 and 0.4157, respectively. Unlike the local optimization-based method, the proposed approach can make full use of the boundary constraints to optimize the positions of interior nodes, and element geometric transformation and element stitching operations can improve the mesh quality iteratively during the optimization process.  
Of course, there is still room for further optimization of the mesh obtained by our method. Therefore, the Shape Improve Wrapper in Mesquite is used to optimize the mesh obtained by the proposed approach, and the average quality of the mesh is improved from 0.8102 to 0.9006, while the quality of the worst element is reduced to 0.2963. Optimization-based methods usually produce meshes with higher average quality, but they are also more time-consuming. In this example, the Shape Improve Wrapper takes 108.089 s to further optimize the mesh obtained by the proposed approach, while the proposed approach only takes 29.849 s to untangle and smooth the initial deformed mesh.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Methods** & **Time(s)** & \(q_{ave}\) & \(q_{min}\) & **Number of Inverted Elements** \\ \hline Initial mesh & – & 0.3243 & 0 & 459 \\ Untangle-Beta & 5.402 & 0.1766 & 0 & 5533 \\ Size & 900.233 & 0.1355 & 0 & 1637 \\ Shape-Size & 54.494 & 0.2829 & 0 & 3833 \\ EEGT & 29.849 & 0.8102 & 0.4157 & 0 \\ EEGT + Shape Improve Wrapper & 108.089 & 0.9006 & 0.2963 & 0 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Mesh quality statistics and the number of inverted elements for mesh deformation example. The mean ratio quality metric is used to measure the mesh quality.  
Figure 7: (**a**) Initial deformed mesh with 459 inverted elements. (**b**) Optimized mesh using the Untangle-Beta untangler. (**c**) Optimized mesh using the Size untangler. (**d**) Optimized mesh using the Shape-Size untangler. (**e**) Optimized mesh using the proposed approach. (**f**) Optimized mesh using the proposed approach and the Shape Improve Wrapper.