MQENet: A Mesh Quality Evaluation Neural Network Based on Dynamic Graph
  Attention
With the development of computational fluid dynamics, the requirements for
the fluid simulation accuracy in industrial applications have also increased.
The quality of the generated mesh directly affects the simulation accuracy.
However, previous mesh quality metrics and models cannot evaluate meshes
comprehensively and objectively. To this end, we propose MQENet, a structured
mesh quality evaluation neural network based on dynamic graph attention. MQENet
treats the mesh evaluation task as a graph classification task for classifying
the quality of the input structured mesh. To make graphs generated from
structured meshes more informative, MQENet introduces two novel structured mesh
preprocessing algorithms. These two algorithms can also improve the conversion
efficiency of structured mesh data. Experimental results on the benchmark
structured mesh dataset NACA-Market show the effectiveness of MQENet in the
mesh quality evaluation task.
Haoxuan Zhang, Haisheng Li, Nan Li, Xiaochuan Wang
# MQENet: A Mesh Quality Evaluation Neural Network Based on Dynamic Graph Attention

###### Abstract

With the development of computational fluid dynamics, the requirements for the fluid simulation accuracy in industrial applications have also increased. The quality of the generated mesh directly affects the simulation accuracy. However, previous mesh quality metrics and models cannot evaluate meshes comprehensively and objectively. To this end, we propose MQENet, a structured mesh quality evaluation neural network based on dynamic graph attention. MQENet treats the mesh evaluation task as a graph classification task for classifying the quality of the input structured mesh. To make graphs generated from structured meshes more informative, MQENet introduces two novel structured mesh preprocessing algorithms. These two algorithms can also improve the conversion efficiency of structured mesh data. Experimental results on the benchmark structured mesh dataset NACA-Market show the effectiveness of MQENet in the mesh quality evaluation task.

Mesh quality; Graph attention; Mesh preprocessing; Structured mesh; Computational fluid dynamics

## 1 Introduction

Mesh generation is the first step in numerical calculations in Computational Fluid Dynamics (CFD)[1]. In NASA's research report, titled "CFD vision 2030 study: a path to revolutionary computational aerosciences"[2], mesh generation is listed as one of the six important research areas in the future. In modern CFD applications, mesh quality evaluation is vital in the mesh generation process[3]. More importantly, the mesh quality greatly affects the accuracy of CFD simulation results[4], so researchers began to pay attention to the study of mesh quality evaluation.

In the traditional mesh quality evaluation, meshes usually utilize element-based mesh quality metrics. For 2D or surface meshes, there are some quality metrics such as area ratio, element aspect ratio, interior angle size, and smoothness. These metrics cannot comprehensively evaluate the quality of meshes, and there is no objective threshold to measure the quality of the mesh. Instead, the threshold is often determined based on the knowledge and experience of professionals.

With the development of deep learning, more and more models have been proposed and have been widely used in computer graphics [5, 6], computer vision [7, 8] and natural language processing[9, 10]. Deep learning technology aims to improve automation and intelligence in various fields, replacing many manual operations. Some researchers have proposed using deep learning models to evaluate structured mesh quality[11, 12, 13, 14]. These methods use convolutional neural networks (CNNs),
graph neural networks (GNNs) and other models to achieve good results on structured mesh quality evaluation tasks. However, due to the dynamic topology in different structured data, the features hidden in the meshes are difficult to be dynamically extracted. These deep learning-based evaluation techniques pay roughly the same attention to the majority of the topology in the structured mesh, resulting in a partial loss of accuracy. Thus, structured mesh quality evaluation based on deep learning is still a challenging task.

To make deep learning better adapt to the application of graph data, GNNs are proposed[15]. Structured meshes can naturally form a graph, so it is very appropriate to adopt GNNs in structured mesh evaluation task. But existing algorithms for converting structured meshes into graphs cannot express the rich information in meshes well. In this paper, we employ dynamic graph attention to accomplish intelligent mesh quality evaluation. We propose MQENet, a graph attention neural network, for evaluating structured mesh quality without human interaction We also design two efficient structured mesh preprocessing algorithms for converting structured meshes into graphs, which can be adapted to our proposed graph neural network. The main contributions of this study include.

* We propose MQENet, a structured mesh quality evaluation neural network based on dynamic graph attention. The network represents meshes as graphs and realizes the graph classification task with mesh quality labels by extracting features from structured meshes.
* We propose two novel structured mesh preprocessing algorithms, the point-based graph with proximity distance and the element-based graph with sparse operation. We improve the conversion efficiency compared to existing algorithms and allow the generated graph to have more features.
* We evaluate MQENet on the mesh benchmark dataset NACA-Market. Experimental results illustrate the effectiveness of MQENet. Meanwhile, MQENet can process mesh data faster than other models.

## 2 Related work

### Mesh quality evaluation

Mesh quality evaluation has been widely studied in various ways. Since it is difficult to define an evaluation function that takes the entire mesh as input, mesh quality evaluation typically utilizes element-based mesh quality metrics. Several mesh quality evaluation metrics have been proposed. Li et al. [16] summarized the mesh quality metrics for commonly used 2D and 3D meshes. For 2D mesh cells, their focus is mainly on two metrics: shape and size. 2D meshes are mainly include unstructured meshes and structured meshes. The metrics for 2D unstructured meshes primarily include element length, aspect ratio and skewness. The aspect ratio of a 2D unstructured mesh [17] is measured as:

\[\text{aspect ratio}=\frac{L_{\text{max}(L_{0},L_{1},L_{2})}}{4\sqrt{3}S} \tag{1}\]

where \(L_{\text{max}(L_{0},L_{1},L_{2})}\) is the length of the longest side of the unstructured mesh. \(L_{0},L_{1},L_{2}\) are the lengths of the sides of the unstructured mesh and \(S\) is the area of the unstructured mesh.
Skewness [18] is a mesh angle metric that indicates how close a mesh cell is to an ideal cell:

\[\text{skewness}=\max[\frac{Q_{\text{max}}-Q_{\text{ideal}}}{180-Q_{\text{ideal}}}, \frac{Q_{\text{ideal}}-Q_{\text{min}}}{Q_{\text{ideal}}}] \tag{2}\]

where \(Q_{\text{max}}\) and \(Q_{\text{min}}\) are the maximum and minimum angles in the mesh element, respectively. \(Q_{\text{ideal}}\) is the angle for an ideally shaped mesh element.

Although these mesh quality metrics are widely used in practice, their thresholds are often highly subjective, and it is difficult to evaluate the quality of a mesh cell from a comprehensive perspective.

In addition to the above mesh quality metrics, traditional machine learning methods are also used to evaluate mesh quality. Chetouani [19] proposed a 3D mesh quality metric based on feature fusion, which evaluates the 3D mesh quality by using the Support Vector Regression (SVR) model. Combined with the specified mesh quality metrics and geometric attributes, SVR is used to predict quality scores. Sprave et al. [20] extract low-level attributes through the neighborhood graph of the mesh. They consider the quality index of a mesh element by evaluating and summarizing the neighborhood quality index value. However, traditional machine learning methods generally have weak generalization, making it difficult to deal with data of different distributions after training.

In recent years, deep learning has been applied in various fields. To solve the above shortcomings, Chen et al. [11] proposed GridNet, a structured mesh quality evaluation based on CNNs. They also propose the structured mesh dataset NACA-Market. GridNet takes the mesh file as input and automatically evaluates the mesh quality. Chen et al. [12] also proposed an automatic hexahedral mesh evaluation framework, MVENet. It takes hexahedral mesh data as input, and studies the effect of mesh point distribution on numerical accuracy based on region segmentation and deep neural network. They employ a supervised learning process to fit the relationship between the hexahedral meshes and their quality. Wang et al. [13] proposed GMeshNet, a graph neural network to evaluate the quality of structured meshes, which converts the mesh quality evaluation task into a graph classification task.

To sum up, traditional mesh quality metrics have significant limitations. These metrics can only evaluate a single aspect of mesh quality and rely on the expertise of professionals. Traditional machine learning methods primarily rely on manual techniques to construct mesh features when evaluating mesh quality. Deep learning-based evaluation techniques struggle to handle dynamic topology in structured meshes, resulting in difficulties achieving satisfactory accuracy.

### Graph neural network

Recent research on analyzing graphs with machine learning has gained significant attention due to the expressive power of graphs [21]. GNNs are deep learning based methods that operate on the graph domain.

Graph Convolutional Networks (GCNs) are the core part of GNNs. GCNs exploit the graph structure and aggregate node information from neighborhoods in convolutional manners [22]. Graph Attention Network (GAT) is one of the most popular
GCN architecture [23], which is considered to be a very advanced architecture in graph representation learning. Zheng et al. [24] used GAT to obtain different levels of representations to efficiently solve natural problems. Leeson et al. [25] proposed GRAVES, an algorithm selection technique in software based on GAT, which enables neural networks to make more accurate predictions by using several attention mechanisms. Cirstea et al. [26] proposed Graph-attention Recurrent neural Networks (GRN) to achieve accurate forecasting of time series.

Graph pooling is an essential component of GNNs. In order to obtain effective and reasonable graph representations, many scholars have proposed various types of graph pooling designs. Ying et al. [27] proposed a differentiable graph pooling module called DiffPool, which can generates hierarchical representations of graphs. It can be seamlessly combined with different GNNs' architecture in an end-to-end manner. Ranjan et al. [28] proposed adaptive structure aware pooling, a sparse and differentiable pooling method that addresses the limitations of previous graph pooling architectures. Ma et al. [29] proposed a path integral-based graph neural network (PAN) for graph classification and regression tasks.

Taken together, the research on GNNs has been increasing, and it has been applied in some scenarios. Since meshes can be easily represented as graph data, it is most suitable to use GNNs to process meshes. However, to the best of our knowledge, there has been very little research on GNNs for mesh quality evaluation tasks. The potential application value of GNNs need to be further explored. Therefore, this paper proposes a structured mesh quality evaluation network based on graph attention. The proposed method improves the performance on mesh datasets compared with other approaches.

## 3 Methods

In this section, we elaborate on the technical details of two efficient mesh preprocessing algorithms and our proposed mesh quality evaluation neural network, MQENet.

### Overview

To extract more useful high-level features from mesh elements in structured meshes, we design a neural network based on dynamic graph attention. The architecture of MQENet is shown in Figure 1.

Our proposed MQENet employs a hierarchical structure, including graph convolutional layers, graph pooling layers, graph readout operations and a multi-layer perceptron. MQENet utilizes two efficient mesh preprocessing algorithms, the point-based graph with proximity distance and the element-based graph with sparse operation, to convert meshes into graphs. GATv2 [30] and SAGPool [31] are selected as the graph convolution layer and graph pooling layer, respectively. The graph convolution layer learns the weight of neighbor nodes through a dynamic attention mechanism, which can realize the weighted aggregation of neighbor nodes. The graph pooling layer computes the projection score via a learnable vector. These scores are used to select the top-ranked nodes, thereby retaining the most valuable mesh elements. Finally, a Multi-Layer Perceptron (MLP) is used to classify the mesh quality.
### Efficient mesh preprocessing algorithm based on node and element representation

GNNs are deep learning models used for processing graph data. This paper takes structured mesh data as input, so how to convert mesh data into graph data is a challenging task. Currently, two algorithms have been proposed [13], but they both have some problems. The point-based graph representations use only mesh nodes as graph nodes and adjacent edges as graph edges. This method does not consider the relationship between non-adjacent meshes. On the other hand, the element-based graph representation considers the diagonal elements as 1, which increases the complexity and time of mesh data conversion.

This paper proposes two efficient mesh preprocessing algorithms based on node and element representation. Inspired by Pfaff et al. [32], the point-based graph with proximity distance for structured mesh is designed. It introduces the concept of proximity distance on the basis of the previous point-based graph. For mesh data, a mesh not only have an adjacency relationship with the directly connected mesh, but also have adjacency relationships with other meshes that have relationships but are not connected. Proximity distance edges join other mesh nodes in the graph that have spatial proximity to the current mesh node by given a fixed distance, which enhances features in mesh data. By modifying the diagonal elements, the element-based graph with sparse operation is designed, which improve the efficiency of mesh data conversion.

#### 3.2.1 The point-based graph with proximity distance

A graph is pair of \(G=(V,E)\), where \(V=\{v_{i}\|i\in N\}\) is the set of vertices from mesh nodes, N is the number of the vertices and \(E=\{e_{ij}\|e_{ij}=(v_{i},v_{j}),(v_{i},v_{j})\in V^{2}\}\) is the set of edges from connections between meshes. For an undirected graph, \(e_{ij}\) is identical to \(e_{ji}\). A graph corresponding to a mesh consists of its own nodes and elements.

We obtain the feature matrix \(X_{S}\in\mathbb{R}^{4N*3}\) and the adjacency matrix \(A_{S}\in\mathbb{R}^{4N*4N}\) by analyzing the coordinates in the mesh file, where \(N\) is the number of meshes. Proximity distance edges are created by spatial proximity: that is, given a fixed value

Figure 1: The architecture of MQENet. MQENet takes structured meshes as input and uses two mesh preprocessing schemes, the point-based graph and the element-based graph. After preprocessing, GATv2 is used to extract mesh quality features in graph nodes. SAGPool is used to filter the most important graph nodes for mesh quality. It is worth noting that graph readout operations are performed after each graph pooling. Finally, all readout graphs are concatenated and classified to obtain the mesh quality labels.
\(r_{P}\) on the order of the smallest mesh edge lengths, we add a proximity distance edge between nodes \(i\) and \(j\) if \(|dist_{ij}|<r_{P}\). So we can get the proximity distance matrix \(A_{P}\).The input feature matrix \(X\) and adjacency matrix \(A\) of mesh are generated by

\[X=X_{S},A=A_{S}\cup A_{P} \tag{3}\]

This encourages using proximity distance edges to pass information between nodes that are spatially close, but distant in the mesh domain, as shown in Figure 2. We use a coordinate-based sparse matrix to store the obtained feature matrix \(X\) and adjacency matrix \(A\), which can improve the mesh processing speed in MQENet.

#### 3.2.2 The element-based graph with sparse operation

In addition to using mesh nodes as graph nodes, using mesh elements (mesh cells) as graph nodes is also a representation method. Wang et al. [13] proposed a graph representation technique based on mesh elements. However, they set the diagonal elements of the adjacency matrix to 1 when processing meshes, which undoubtedly increases the subsequent calculation cost. This paper improves the method of Wang et al. by modifying the diagonal elements to 0 and proposes a graph representation method based on mesh elements with sparse operations.

First, the feature matrix \(X\in\mathbb{R}^{N*f}\) and the adjacency matrix of mesh nodes \(A_{N}\in\mathbb{R}^{4N*4N}\) based on point are obtained from the raw mesh file, where \(f\) is the number of feature (we found if the mesh is a structured mesh, \(f=6\)). Then, we suppose there is an element management matrix \(E\), where \(E=[e_{ij}]\in\mathbb{R}^{4N*N}\), and \(e_{ij}=1\) if node \(i\) in element \(j\), otherwise \(e_{ij}=0\). Finally, we can obtain the strength matrix between two mesh elements:

\[S=E^{T}A_{N}E\]

Figure 2: The figure shows the structured mesh of a partial wing. It can be seen that two points A,B are completely unconnected if the proximity distance is not introduced.
If two structured mesh share one edge, the strength is 6. So the adjacency matrix of mesh elements \(A\) is

\[A_{ij}=\left\{\begin{array}{ll}1,&\mathrm{if}S_{ij}=6\\ 0,&\mathrm{otherwise}\end{array}\right. \tag{5}\]

As shown in Figure 3, this paper takes two structured meshes as an example to describe the calculation process of the adjacency matrix of mesh elements \(A\) in detail. Since the calculation does not involve mesh node coordinates, no coordinates are assigned to each node here. Among them, the adjacency matrix of mesh nodes \(A_{N}\) and the element management matrix \(E\) are

\[A_{N}=\begin{bmatrix}0&1&0&1&0&0&0&0&0\\ 1&0&1&0&1&0&0&0&0\\ 0&1&0&0&0&1&0&0&0\\ 1&0&0&0&1&0&1&0&0\\ 0&1&0&1&0&1&0&1&0\\ 0&0&1&0&1&0&0&0&1\\ 0&0&0&1&0&0&0&1&0\\ 0&0&0&0&1&0&1&0&1\\ 0&0&0&0&0&1&0&1&0\end{bmatrix},E=\begin{bmatrix}1&0&0&0\\ 1&1&0&0\\ 0&1&0&0\\ 1&0&1&0\\ 1&1&1&1\\ 0&1&0&1\\ 0&0&1&0\\ 0&0&1&0\\ 0&0&0&1\end{bmatrix} \tag{6}\]

Through equation (4), the strength matrix can be obtained as

\[S=E^{T}A_{N}E=\begin{bmatrix}8&6&6&4\\ 6&8&4&6\\ 6&4&8&6\\ 4&6&6&8\end{bmatrix} \tag{7}\]

Through equation (5), the adjacency matrix of mesh elements in figure 3 can be obtained as

\[A=\begin{bmatrix}0&1&1&0\\ 1&0&0&1\\ 1&0&0&1\\ 0&1&1&0\end{bmatrix} \tag{8}\]

Figure 3: The process of converting mesh elements to graph data. Each mesh cell (mesh element) is treated as a node in the graph. Adjacency relationship only occurs when two meshes share an edge.
The mesh preprocessing algorithm proposed in this paper can convert a data with 30,400 meshes into graph data in 0.73 seconds (the algorithm designed by Wang et al. takes 0.79 seconds).

### Dynamic graph attention layers

Different from the tasks at the node level, the graph classification task requires global information of the graph data. This information includes both the structural information of the graph and the attribute information of each node.

In this paper, GATv2, based on the dynamic graph attention, is selected as the graph convolution layer in MQENet. The difference from GAT is that the dynamic graph attention assigns different attention scores for different nodes, while the scores obtained by the static attention mechanism are exactly the same. This shortcoming makes it difficult for GAT to distinguish the quality of different structured meshes and even hinders GAT from fitting the training data.

Some GNNs' architecture regard the weights of all neighbors as the same. To solve this problem, GAT uses the score function \(\alpha:\mathbb{R}^{d}\times\mathbb{R}^{d}\rightarrow\mathbb{R}\) to score node pairs \((h_{i},h_{j})\):

\[\alpha(h_{i},h_{j})=\text{LeakyReLU}(b^{T}\cdot[Wh_{i}\|Wh_{j}]) \tag{9}\]

where \(b\in\mathbb{R}^{2d^{\prime}},W\in\mathbb{R}^{d^{\prime}\times d}\) are learnable parameters, \(\|\) denotes vector concatenation and LeakyReLU is a type of activation function based on a ReLU.

We can obtain a more expressive dynamic attention by modifying the order of operations in the GAT. The problem with the GAT is that \(W\) and \(b\) in its scoring function are used for calculations in sequence, and they are likely to collapse into a linear layer. To solve this problem, we can move \(b^{T}\) out of the non-linear result before performing the operation:

\[\alpha(h_{i},h_{j})=b^{T}\text{LeakyReLU}(W\cdot[h_{i}\|h_{j}]) \tag{10}\]

In this way, GATv2 has powerful feature extraction capabilities for dynamic topology in structured meshes. For any two structured mesh elements or nodes, we can get the corresponding dynamic attention score \(\alpha\), as shown in Figure 1. Additionally, LayerNorm [33] and LeakyReLU are performed. The feature matrix \(X_{h}^{\prime}\in\mathbb{R}^{N\times n}\) input to the next pooling layer is:

\[X_{h}^{\prime}=\text{GATv2}(\text{LeakyReLU}(\text{LayerNorm}(X_{h})),A_{h}) \tag{11}\]

where \(X_{h}\in\mathbb{R}^{N\times m}\) and \(A_{h}\in\mathbb{R}^{N\times N}\) are the feature matrix and the adjacency matrix from structured meshes, respectively. \(N\) is the number of the graph nodes, \(m\) is the number of input features and \(n\) is the number of output features.

Since GNNs with a number of network layers (more than two layers) are very prone to over-smoothing problems, we added a residual connection mechanism [34] in the graph convolutional layer to prevent this problem:

\[X_{h}^{\prime}=X_{h}^{\prime}+X_{h} \tag{12}\]
### Self attention pooling layers

Most graph pooling techniques need to calculate the distribution matrix of nodes in the process of clustering. However, the space-time complexity of the distribution matrix calculation algorithm is proportional to the nodes and edges of the graph. Mesh data may contain a large number of nodes and elements, which makes it difficult for most graph pooling techniques to be applied to mesh quality evaluation tasks. Thus, we adopt SAGPool to pool the graph data.

As shown in Figure 1, SAGPool adaptively learns the importance of nodes from the graph through graph convolution, and then uses the TopK [35] to discard nodes. Specifically, aggregation operations are used to assign an importance score to each node.

\[Z=\tanh(D_{h}^{-}\frac{1}{2}A_{h}D_{h}^{-}\frac{1}{2}X_{h}^{\prime}W_{att}) \tag{13}\]

where \(\tanh\) represents the activation function, \(D_{h}\in\mathbb{R}^{N\times N}\)is the degree matrix of \(A_{h}\) and \(W_{att}\in\mathbb{R}^{n\times 1}\) represents the weight parameter.

The pooling operation can be performed according to the importance score and the topology of the graph. Based on the score calculated by Equation 13, only \(\lceil kN\rceil\) nodes are reserved.

\[idx=\text{top-rank}(Z,\lceil kN\rceil),Z_{\text{mask}}=Z_{\text{idx}} \tag{14}\]

where \(k\in(0,1]\) is the pooling ratio.

Repeatedly stacking SAGPool can perform graph pooling, and finally reduce the dimensions of each graph to the same dimension. The reconstructed feature matrix and adjacency matrix are obtained by

\[X_{h+1}=X_{h[idx,:]}^{\prime}\odot Z_{\text{mask}},A_{h+1}=A_{h[idx,idx]} \tag{15}\]

### Graph readout operations

To read out graph data from MQENet, we make graph data more complete by concatenating the global average readout operation and the global maximum readout operation. Due to the different node positions in the graph, it is difficult to obtain an accurate representation of each node. We choose JK-net [36] to obtain an accurate representation at different levels and realize the flexible use of different neighborhood ranges for each node to achieve better structure-aware representation. The final representation is the input to an MLP for classification. Additionally, BatchNorm [37] and LeakyReLU are adopted to stabilize the training process.

## 4 Experiments

In this section, we evaluate MQENet on the benchmark structured mesh datasets NACA-Market. The datasets, implementation details and experimental results are introduced.
### Datasets

Currently, there are very few benchmark structured mesh datasets available for mesh evaluation tasks. Only two datasets, NACA-Market and AirfoilSet, exist. Among them, only NACA-Market is a public dataset. So we choose the NACA-Market dataset to evaluate MQENet. NACA-Market is a mesh quality evaluation dataset of NACA0012 airfoils with eight labels, totaling 10,240 meshes. Each subset of 1,024 meshes corresponds to airfoils of one size, with a total of ten sizes. All the meshes belong to eight different quality labels, with an average of 1,280 meshes per label. The eight labels consist of three structured mesh quality evaluation metrics, which are orthogonality, smoothness and distribution, as shown in Figure 4. In the experiments, we use ten NACA-Market subsets, which include 1,024 meshes and 8 label, to train MQENet separately and evaluate its performance.

### Implementation details

After converting structured meshes into graphs, we set the division ratio of the training data, validation data and test data to 60%,20%,20%, and shuffle the data to ensure the distribution. We set the number of input features, output features, network layers and hidden layer units to 6, 8, 4 and 12, respectively. We select AMSGrad [38] with an initial learning rate of 1e-2 as the optimizer, and dynamically decrease the learning rate according to the training situation. Furthermore, we use negative log likelihood loss as the loss function and add L2 regularization with 1e-4 weight decay. The batch size is set to 32. The pooling ratio for all pooling layers are set to 0.3. The experiments are carried out on an NVIDIA Tesla A100-40G.

We use the gradient clipping technique [39] to solve the gradient explosion problem that often occurs in neural networks. At the same time, the early stop method is adopted in the training process to find out the problems in the training process in time.

Figure 4: Examples of meshes in NACA-Market. Red represents high quality mesh cells. Blue represents low quality mesh cells. The green part in (c) represents that the mesh smoothness is poor.
### Network evaluation results

First, we evaluate the capabilities of MQENet on the test set of the NACA-Market dataset. The quality identification results of structured meshes with different characteristics are shown in Table 1. Among them, W represents the mesh without defects, N-O represents the mesh with poor orthogonality, N-S represents the mesh with poor smoothness, N-D represents the mesh with poor distribution, N-OS represents the mesh with poor orthogonality and smoothness and N-OSD represents the mesh with poor orthogonality, smoothness and distribution. It can be seen that MQENet achieve very good results. The accuracy is all above 81% on eight labels of structured meshes, and the highest can reach 83.31%. This illustrates the effectiveness of MQENet for structured mesh datasets.

Then, we can also see that when the mesh has multiple defects, MQENet has the potential to identify the result as a single defect. For example, in the N-OS results, MQENet identified 11.74% of the meshes as N-O. There are similar problems in other labels. We believe that this is a problem of labeling in the dataset. Previous studies have directly divided the NACA-Market dataset into eight categories. In doing so, the eight categories are set as completely independent labels, and the relationship between labels are not considered, which leads to the above problems.

Finally, to prove the superiority of our method, we choose to perform comparative experiments with GMeshNet. We use two metrics, recall and accuracy, to measure the precision of the neural network. As shown in Table 2, we can see that the accuracy of GMeshNet trained on NACA-Market datasets is not as good as that of MQENet. In terms of orthogonality and smoothness, the recall can reach 82.96% and 81.64%, which is higher than GMeshNet. In terms of test accuracy, it reaches 82.67%, which is also better than GMeshNet. More importantly, MQENet can process mesh data faster than GMeshNet.

In summary, compared to other methods, our proposed MQENet has better accuracy and recall. This demonstrates that MQENet can perform well on structured

\begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline Labels & W (\%) & N-O(\%) & N-S (\%) & N-D (\%) & N-OS(\%) & N-OD(\%) & N-SD(\%) & N-OSD(\%) \\ \hline W & **83.31** & 0.00 & 2.59 & 12.91 & 0.00 & 0.00 & 1.19 & 0.00 \\ N-O & 0.00 & **82.96** & 0.00 & 0.00 & 7.30 & 9.74 & 0.00 & 0.00 \\ N-S & 9.52 & 0.00 & **81.64** & 0.00 & 7.76 & 0.00 & 1.08 & 0.00 \\ N-D & 0.00 & 0.00 & 0.00 & **82.48** & 0.00 & 10.01 & 7.51 & 0.00 \\ N-OS & 0.00 & 10.74 & 7.05 & 0.00 & **82.21** & 0.00 & 0.00 & 0.00 \\ N-OD & 0.00 & 9.67 & 0.00 & 0.00 & 0.00 & **82.79** & 0.00 & 7.54 \\ N-SD & 0.00 & 0.00 & 10.42 & 3.03 & 0.00 & 0.00 & **81.38** & 5.17 \\ N-OSD & 0.00 & 2.93 & 0.00 & 0.00 & 0.00 & 9.05 & 5.11 & **82.91** \\ \hline \hline \end{tabular}
\end{table}
Table 1: Confusion matrix of the MQENet on NACA-Market. The diagonal elements represent the percentages for which the predicted label is equal to the true label for different structured meshes.

\begin{table}
\begin{tabular}{c c c} \hline \hline Mesh property & Network & MQENet(\%) & GMeshNet(\%) \\ \hline Orthogonality & 82.96 & 80.73 \\ Smoothing & 81.64 & 78.57 \\ Distribution & 82.48 & 82.69 \\ Accuracy & 82.67 & 80.93 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Recall and accuracy of MQENet and GMeshNet. For another network in comparison, the results are obtained by re-running the code on NACA-Market dataset using the same training-test partition as our method.
mesh quality evaluation tasks. The network structure we designed can well adapt to the dynamic topology in different structured meshes. By filtering important nodes, hidden features in structured meshes can be more accurately captured. So that MQENet can better classify structured meshes with different quality labels in the feature space.

### Ablation studies

In this section, to illustrate the effectiveness of MQENet, this paper performs ablation studies from three aspects: mesh preprocessing algorithms, hyper-parameters and network structure.

#### 4.4.1 Analysis of mesh preprocessing algorithms

Section 3.2 proposes two efficient structured mesh preprocessing algorithms. We conduct experiments on two preprocessing algorithms separately. However, we only adopt the element-based graph with sparse operation to evaluate MQENet in the experiments. Compared with the work of Wang et al., we introduce proximity distance in the point-based graph, which slightly improve accuracy, but the experimental results are still unsatisfactory. We find that using the point-based graph does not even achieve 70% accuracy in the mesh quality evaluation task.

The point-based graph with proximity distance is a point-level representation scheme, which cannot well represent the complex topology in structured meshes. And the mesh density at the bordering is usually high due to subsequent simulation requirements. This directly leads to numerous nodes being generated at corresponding space of point-based graphs. Training GNNs on a large number of graph nodes suffers from the neighbor explosion problem, where the dependencies of nodes grow exponentially with the number of message passing layers. But these mesh points at the bordering are often an important factor to determine the quality of structured meshes.

#### 4.4.2 Analysis of hyper-parameters

In this part, we analyze the impact of different hyper-parameters on MQENet. Choosing appropriate hyper-parameters can improve the efficiency and accuracy of neural networks. We discuss two factors, activation function and pooling ratio. The experimental results are shown in Table 3.

The pooling ratio is a parameter for each selection of nodes in the graph pooling layer. We can see that the good results in each activation function at the pooling ratio of 0.4, which means that when the pooling ratio is larger, more features will be retained. The result is relatively poor at the pooling ratio of 0.2, which shows that deleting too many nodes can reduce the size of the neural network, but the accuracy also decreases.

\begin{table}
\begin{tabular}{c c c c c} \hline \hline Pooling ratio & Activation function & ELU(\%) & ReLU(\%) & GeLU(\%) & LeakyReLU(\%) \\ \hline
0.2 & 80.72 & 80.87 & 80.55 & 81.22 \\
0.3 & 81.70 & 81.82 & 81.49 & 82.67 \\
0.4 & 81.95 & 82.36 & 82.15 & 82.78 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Accuracy for different hyper-parameters
The other important hyper-parameter is the activation function. It allows the neural network to learn a smooth curve to segment the plane, instead of using a complex linear combination to approximate the smooth curve. We selected four activation functions of ELU, ReLU, GeLU, and LeakyReLU for experiments. In the case of the same pooling ratio, the accuracy of using LeakyReLU as the activation function is the best. Compared to other activation functions, the LeakyReLU function allows negative values to pass, which makes the dynamic range wider and allows neurons to activate more easily. For MQENet, the LeakyReLU function can better activate the ability of neurons to capture the quality features of the structured mesh. And it is more suitable for dynamic graph attention in the model.

#### 4.4.3 Analysis of network structure

In addition to the influence of mesh preprocessing algorithms and hyper-parameters on the MQENet, the model selection of the network structure is also important. As the core part of the GNN, the graph convolutional layer is the factor most likely to have an impact on the accuracy. Here we choose several classic graph convolutional layers to compare with GATv2, namely GCN [22], GraphConv [40] and GAT [23]. Experimental results of different networks are shown in Table 4. From the results, we can see that GATv2 performs better than other graph convolutional layers on NACA-Market datasets.

GATv2 can enhance the representation of hidden features in structured meshes by computing the dynamic attention score of each node. Then features related to mesh quality are mined to enable the ability to classify structured meshes with different labels. Other graph convolutional layers are difficult to deal with dynamic topology in structured meshes due to no attention mechanism or only static attention mechanism.

## 5 Conclusions

The quality of the mesh is a critical factor in the accuracy of CFD simulations. However, traditional mesh quality metrics and learning-based mesh quality evaluation techniques have been unable to meet the industry's increasing demand for higher CFD simulation accuracy. Nodes and cells in structured meshes can naturally form a graph, so it is very appropriate to adopt graph neural networks in mesh evaluation task. Therefore, a structured mesh quality evaluation nerual network based on dynamic graph attention, MQENet, is proposed. We also design two novel structured mesh preprocessing algorithms, the point-based graph with proximity distance and the element-based graph with sparse operation, to convert meshes to graphs, which further enhance the conversion efficiency. We evaluate MQENet on the structured mesh datasets NACA-Market and demonstrate that MQENet outperforms other methods in the mesh quality evaluation task.

\begin{table}
\begin{tabular}{c c} \hline \hline Method & Accuracy(\%) \\ \hline GCN & 77.87 \\ GraphConv & 78.14 \\ GAT & 80.93 \\ GATv2 & **82.67** \\ \hline \hline \end{tabular}
\end{table}
Table 4: Accuracy for different networks
In future work, we will further explore neural networks suitable for point-based graphs. To address the problem of labels not being independent in NACA-Market datasets, we plan to change the eight-category problem to a multi-label problem (three labels), which may avoids the problem of mutual influence of defects.

## Availability of data and materials

The datasets during the current study are available in [https://github.com/cheminhal1234/NACA-Market](https://github.com/cheminhal1234/NACA-Market).

## Ethics approval and consent to participate

Not applicable.

## Competing interests

The authors declare that they have no competing interests.

## Consent for publication

Not applicable.

## Authors' contributions

Hasovan Zhang: Conceptualization, Methodology, Writing, Haisheng Li: Funding acquisition, Project administration, Data curation. Nan Li: Formal analysis, Writing, Supervision. Xiaochuan Wang: Investigation, Writing, Supervision.

## Funding

This work is supported by the National Natural Science Foundation of China (No. 62277001, No. 62272014, No. 62201017), and Scientific Research Program of Beijing Municipal Education Commission KZ202110011017.

## Acknowledgements

This work was carried out at National Supercomputer Center in Tianjin, and the calculations were performed on Tianhe new generation Supercomputer. We also thank the Beijing Technology and Business University 2023 Postgraduate Research Ability Improvement Program Project for funding.

## Authors' information

Hasovan Zhang, male, received his bachelor's degree from Beijing Technology and Business University, China in 2022. He is currently pursuing a Master of Engineering degree from Beijing Technology and Business University, China. His research interests include deep learning and mesh generation.

Haiheng Li (corresponding author), male, received his Ph.D. degree in computer graphics from Beihang University, China in 2002. He is a professor in school of Computer Science and Engineering, Beijing Technology and Business University, China. His current research interests include mesh generation, computer graphics and intelligent information processing etc.

Nan Li, male, received his bachelor's and Ph.D. degrees from Beijing Jiaotong University in 2004 and 2010, respectively. He is a professor of Beijing Technology and Business University. His main research interests are design methodology, computer graphics and intelligent engineering.

Xiaochuan Wang, male, received his master's and Ph.D. degrees from Beihang University in 2012 and 2019, respectively. He is an associate professor of Beijing Technology and Business University. His main research interests are virtual reality and computer graphics.

## Author details

\({}^{1}\)School of Computer Science and Engineering, Beijing Technology and Business University, Beijing 100048, China.

\({}^{2}\)Beijing Key Laboratory of Big Data Technology for Food Safety, Beijing 100048, China.

\({}^{3}\)National Engineering Laboratory For Agri-product Quality Traceability, Beijing 100048, China.
