# Three-Dimensional Hyperbolic Mesh Generation Method Based on the Neural Network
## 2 Methodology
Secondly, if \(u\) is the solution of the equation set 2 on the surface, then the two constraint boundaries correspond to the boundaries in the computational domain, which means the \(\xi\) values that the network output on these points were the extreme value of the computational domain range. Since the values of \(\xi\) on the initial boundary increase in a clockwise direction, all points on the left boundary should have the same value of 0.1, and all points on the right boundary should have the same value of 0.9. Denote the target values for these boundaries as \(T_{\xi}\), and this part of the loss function could be written as:  
\[\overline{\sum}(u_{\xi}-T_{\xi})_{P_{i}}^{2}. \tag{6}\]  
Thirdly, for the surface region where the governing equation is defined, every point within the region must satisfy the governing equation. This requires taking the gradient operation of \(u\), which can be easily achieved through automatic differentiation. Since the region for each grid generation is only part of the surface, the points we choose are also within this part of the region, as shown by the gray points in Figure 2. Substituting each point into \(u\) after taking the gradient operation and then calculating values according to the governing equation, the error for each part should also approach zero. Therefore, suppose the unit normal vector of each point on the surface is \(V_{normal}\) and the given Jacobian determinant is \(J_{a}\), and this part of the loss function can be expressed as:  
\[\sum(\
abla u_{\xi}\cdot\
abla u_{\eta})_{P_{k}}^{2}+\sum(V_{normal}\cdot( \
abla u_{\xi}\times\
abla u_{\eta}))_{P_{k}}^{2}+\sum(V_{normal}\cdot\
abla u _{\eta}-J_{a})_{P_{k}}^{2}. \tag{7}\]  
Finally, regarding the outer boundary control strategy, in two-dimensional problems, we achieved control of the outer boundary by advancing inward simultaneously from both the outer and initial boundaries. This approach can result in poor grid quality at the interface, necessitating optimization. Therefore, in the three-dimensional process, we adopted a new variance constraint. Specifically, according to the mapping relationship, the external boundary corresponds to the value of \(\eta_{\text{max}}\). However, when generating grids in sub-regions and given the specified \(J_{a}\), we cannot predetermine the value of \(\eta_{\text{max}}\). Therefore, we can only ensure that the neural network outputs the same \(\eta\) values for all points on the outer boundary, meaning the variance is zero. Thus, considering the yellow points in Figure 2, this part of the loss function can be expressed as:  
\[\sum(\text{var}(u_{\eta}))_{P_{k}}. \tag{8}\]  
It is important to note that the loss function 8 only needs to be included during the generation of the final portion of the surface. In other regions that are far from the outer boundary, this component does not need to be considered. At this point, we have completed the construction of the loss function for three-dimensional surface grid generation. It is shown at the end of the first row in Figure 2.0 The total loss is the sum of all the loss parts:  
\[ \begin{array}{l}Loss=\overline{\sum}(u-T)_{P_{k}}^{2}+\overline{\sum}(u_{\xi }-T_{\xi})_{P_{j}}^{2}++\Big{\langle}\overline{\sum}(\text{var}(u_{\eta}))_{P_ {k}}\Big{\rangle}+\\ \overline{\sum}(\
abla u_{\xi}\cdot\
abla u_{\eta})_{P_{k}}^{2}+\overline{\sum }(V_{normal}\cdot(\
abla u_{\xi}\times\
abla u_{\eta}))_{P_{k}}^{2}+\overline {\sum}(V_{normal}\cdot\
abla u_{\eta}-J_{a})_{P_{k}}^{2}\end{array} . \tag{9}\]  
In expression 9, the term within angle brackets is optional. For three-dimensional solid mesh generation, the process is the same as the three-dimensional surface, as shown in the second row of Figure 2. The difference is that all boundaries are surfaces instead of lines. Additionally, the constraint boundaries along the advancing direction become two sets. In this case, we also need to select points on different surfaces.