# Learning Airfoil Flow Field Representation via Geometric Attention Neural Field
## 2 Methodology
### GeoAttention  
The mesh is discretized in Euclidean space; we show the point cloud input features in Section 2.2, these point cloud serve as input to the neural network.  
\[P=\{p_{1},p_{2},\ldots,p_{n}\},\quad p_{i}\in\mathbb{R}^{d_{p}},\quad i=1,2, \ldots,n \tag{3}\]  
\[P_{\text{geo}}=P\cap\Gamma=\{p_{1},p_{2},\ldots,p_{m}\},\quad p_{j}\in\Gamma \subset\mathbb{R}^{d_{p}},\quad j=1,2,\ldots,m \tag{4}\]  
where \(P\) is the features of the flow field point cloud, which have \(n\) points, the \(\Gamma\) represents a airfoil surface geometry space, and \(P_{geo}\) represents the point cloud features of the airfoil, which have \(m\) points. We project the feature spaces of \(P\) and \(P_{geo}\) into the NN's representation spaces, \(z\) and \(z_{geo}\), through a NN block.  
GeoAttention's processing mechanism involves a NN representation-based query, where the significance of the geometric information carried by each discrete point constituting the geometry varies according to the flow field characteristics at a given point.  
In our implementation, we utilized representations in the NN representation space \(\mathcal{H}\) and attention mechanism to compute similarity.  
\[GeoAttention:(z,z_{geo})\to g\in\mathbb{R}^{n}\times\mathbb{R}^{\mathcal{H}}= \{\sum_{j=1}^{m}\kappa(z_{i},z_{geoj})z_{geoj}\}\quad i=1,2,\ldots,n \tag{5}\]  
In Equation (4), and Figure 5c, we present the computation of GeoAttention. For a point representation \(z_{i}\), calculate attention weights with respect to each geometric representation \(z_{\text{geo}_{i}}\) of the airfoil boundary points, where \(\kappa\) represents the similarity between two neural network representation spaces. By applying these attention weights to \(z_{\text{geo}_{j}}\) and performing a weighted sum, we obtain \(g_{i}\). For \(n\) points, this process yields a geometric information representation of size \(n\times d_{h}\). This dynamic weight allocation mechanism enables the model to prioritize information most relevant to the query feature within the airfoil's point cloud geometry space when handling flow field conditions at each specific query location. By weighting and summing the airfoil point cloud based on the weights assigned by the query points, a latent code \(g_{i}(i=1,2,\ldots,n)\) representing geometric information can be generated for each query point.  
A schematic of GeoAttention is shown in Figure 5c. In this study, GeoAttention employs multi-head attention [24] to compute attention weights, a method that enhances the model's processing capability and flexibility. As illustrated in Figure 6, by decomposing the attention mechanism into multiple heads, each responsible for learning different subspace representations of the input data, the multi-head attention module allows the model to focus simultaneously on various aspects of the information.  
For the point cloud representation of the airfoil, each point cloud is separately encoded into the key and value through an NN block (Figure 5b) for the attention process. Similarly, the query points are encoded through an NN block for the attention process's query. The weights are obtained by querying and key, followed by weighting and summing with the value to obtain the geometric information representation.  
Essentially, the process depicted in Figure 7 reveals the mechanisms within GeoAttention. During training, when the query points are located on the geometric surface, the set of input query points and the input data are identical. In this case, the attention mechanism used is known as self-attention. Within the self-attention mechanism, the model focuses on the interrelations within the input dataset, calculating the influence of each point on all other points to capture the intricate geometric relationships and flow field characteristics specific to the geometric surface. Conversely, when the query points are not situated on the geometric surface, a conventional attention mechanism is employed. In this scenario, the query points and the input airfoil point cloud are distinct sets.