A flapping wing flow field reconstruction and performance prediction method, device, equipment and medium

By coupling GCN and Transformer models, the problem that traditional neural networks cannot adapt to flutter fluid dynamics analysis is solved, and efficient and accurate flow field reconstruction and performance prediction are achieved, and the limitations of traditional methods are overcome, and suitable for different lengths and Resolution flow field data.

CN118246366BActive Publication Date: 2024-12-10XI AN JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410477257.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-19
Publication Date
2024-12-10
Estimated Expiration
2044-04-19

Smart Images

  • Figure CN118246366B_ABST
    Figure CN118246366B_ABST
Patent Text Reader

Abstract

The present invention discloses a flapping-wing flow field reconstruction and performance prediction method, device, equipment and medium, which relates to the field of fluid dynamics analysis technology, and includes the following steps: obtaining flapping-wing flow field graph structure data; constructing a coupling model, including a flow field reconstruction network based on a graph convolutional network and a performance prediction network based on a Transformer; inputting a node feature matrix, design parameters and an adjacency matrix into the flow field reconstruction network to obtain an edge feature matrix, and reconstructing the flapping-wing flow field according to the edge feature matrix; inputting the edge feature matrix and the adjacency matrix into a performance prediction network to obtain performance data; and predicting the performance of the flapping-wing flow field according to the performance data. The present invention couples and complements GCN and Transformer so that the output of the flow field reconstruction network can be directly used as the input of the performance prediction network, thereby realizing end-to-end training and reasoning, and improving the efficiency and robustness of flapping-wing analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of fluid dynamics analysis, and in particular to a flapping wing flow field reconstruction and performance prediction method, device, equipment and medium. Background Art

[0002] The oscillating flapping wing proposed based on bionics can collect flow field energy under certain oscillation modes, realize the conversion from wind energy and water kinetic energy to electrical energy, and provide new ideas for human beings to utilize fluid kinetic energy. In the process of flapping wing energy collection, it will be affected by many factors such as flapping wing profile, oscillation mode, kinematic parameters and arrangement mode, and has highly nonlinear, unsteady and complex characteristics. The design, optimization and control of flapping wing energy harvesting devices require accurate and timely feedback on flow fields and performance, which brings huge challenges to the research methods of flapping wing fluid dynamics.

[0003] Traditional research methods for flapping wing fluid dynamics mainly include numerical simulation and experimental measurement. Numerical simulation methods can provide global information of the flow field, but they consume a lot of computing resources and time; experimental measurement methods can provide local information of the flow field, but they require complex experimental equipment and technology, and are limited by experimental conditions and measurement accuracy. Therefore, neither traditional numerical simulation nor experimental measurement methods can meet the needs of high-precision and rapid analysis of flapping wing fluid dynamics.

[0004] In order to achieve efficient reconstruction of flapping wing flow field and accurate performance prediction, existing technical solutions attempt to use reduced-order models and proxy models to simplify the processing and analysis of flow field data. Reduced-order models are based on the statistical characteristics of flow field data to reduce the dimension and complexity of flow field data, but the stability and accuracy are affected by the quality of flow field data and the number of samples; proxy models are based on the input and output of flow field data to construct the mapping relationship between flow field data and flapping wing performance, which lacks generalization and interpretability.

[0005] As a powerful data-driven method, deep learning can automatically learn features and laws from a large amount of computational fluid dynamics data, with the advantages of high efficiency, accuracy and universality. However, the flow field data of flapping wings has the characteristics of non-Euclidean space, complex topological structure, dynamic space-time relationship, etc. Traditional deep learning methods, such as convolutional neural network (CNN) and recurrent neural network (RNN), are mainly aimed at Euclidean space data, such as images and videos, and cannot adapt to the analysis of flapping wing fluid dynamics. Summary of the invention

[0006] The present invention provides a flapping wing flow field reconstruction and performance prediction method, device, equipment and medium, which solves the problem that traditional neural networks cannot adapt to the analysis of flapping wing fluid dynamics.

[0007] The present invention provides a flapping wing flow field reconstruction and performance prediction method, comprising the following steps:

[0008] Obtaining flapping wing flow field graph structure data, the data including node feature matrix, design parameters and adjacency matrix;

[0009] Construct a coupling model, which includes a flow field reconstruction network based on a graph convolutional network and a performance prediction network based on a Transformer;

[0010] The node feature matrix, design parameters and adjacency matrix are input into the flow field reconstruction network to obtain the edge feature matrix, and the flapping wing flow field is reconstructed according to the edge feature matrix;

[0011] Inputting the edge feature matrix and the adjacency matrix into the performance prediction network to obtain the performance data of the reconstructed flapping-wing flow field; predicting the performance of the reconstructed flapping-wing flow field according to the performance data;

[0012] The step of inputting the edge feature matrix and the adjacency matrix into the performance prediction network to obtain the performance data of the reconstructed flapping wing flow field comprises the following steps:

[0013] Transpose the reshaped edge feature matrix based on the transpose layer;

[0014] Flatten the transposed edge feature matrix based on the flattening layer;

[0015] Extract global spatiotemporal features from the flattened edge feature matrix based on the Transformer encoder layer;

[0016] Select the first row based on the output of the Transformer encoder layer of the selection layer;

[0017] The output of the selection layer is mapped to the dimension of the performance data based on the linear layer to obtain the performance data.

[0018] Preferably, a flapping wing flow analysis model based on profile parameters is established through computer-aided design software, a structured or unstructured grid is automatically generated, and a parametric numerical simulation of the flapping wing is performed in combination with a numerical simulation software script and a user-defined function to obtain flapping wing flow field simulation data, and the simulation data is converted into graph structure data.

[0019] Preferably, the node feature matrix, design parameters and adjacency matrix are input into the flow field reconstruction network to obtain the edge feature matrix, which includes the following steps:

[0020] Based on the fusion layer, the node feature matrix and the design parameters are concatenated to obtain a new node feature matrix;

[0021] Convert the adjacency matrix into edge index based on the representation layer;

[0022] Based on the L-layer graph convolution layer, the new node feature matrix and edge index are convolved to obtain the edge feature matrix;

[0023] The edge feature matrix is ​​reshaped into the same shape as the adjacency matrix based on the reshape layer.

[0024] Preferably, the node feature matrix is ​​X, and its shape is The new node feature matrix is ​​X', and its shape is Where S is the number of graphs, M is the number of nodes in each graph, 2 is the dimension of the grid node coordinates, and N is the dimension of the design parameters;

[0025] The adjacency matrix is ​​A, The edge index is E and the shape is (2, S×M×M);

[0026] The L-layer graph convolutional layer transforms the dimension of node features from the input dimension F in Mapped to the hidden layer dimension F hid , from the hidden layer dimension F hid Mapped to the output dimension F out , the output dimension is equal to the dimension of the flow field feature;

[0027] The edge feature matrix is ​​calculated by the following formula:

[0028]

[0029]

[0030] In the formula, represents the edge feature matrix of layer l, h (l-1) represents the node feature matrix of the l-1th layer, W (l) represents the weight matrix of the lth layer, b (l) represents the bias vector of the lth layer, h (l) represents the node feature matrix of the lth layer, σ represents the activation function, G represents the dimension of the flow field feature, represents the kth channel of the edge feature matrix of layer l, [E] represents the indexing operation according to edge index E; h (0) =X′, X′ represents the new node feature matrix;

[0031] The ReLU activation function is used after the L-1th convolution layer, and there is no activation function after the Lth graph convolution layer;

[0032] The output of the flow field reconstruction network is where Θ1 is the grid parameter.

[0033] Preferably, the shape of the transposed edge feature matrix is ​​(S×G×M×M);

[0034] The shape of the flattened edge feature matrix is ​​(S×G×M 2) ;

[0035] The Transformer encoder layer includes L encoder sublayers, each of which includes a multi-head self-attention mechanism, a feedforward neural network, a residual connection, and a layer normalization. The multi-head self-attention mechanism uses an adjacency matrix as a mask matrix to mask invalid edges. The multi-head self-attention mechanism adds centrality encoding and spatial encoding to characterize the importance and spatial relationship of nodes in the graph. The output shape of the Transformer encoder layer is (S×G×M 2 );

[0036] The output of the multi-head self-attention mechanism is as follows:

[0037]

[0038] in,

[0039]

[0040]

[0041]

[0042]

[0043]

[0044] In the formula, MultiHead(Q (l) ,K (l) ,V (l) ) represents the output of the multi-head self-attention mechanism at layer l, H represents the number of attention heads, Concat is the concatenation operation, and head i is the output of the ith attention head, represents the weight matrix of the output of layer l, Attention(Q,K,V) is the attention function, B φ Representation space code B φ , C represents edge coding, Q (l) , K (l) 、V (l) represents the query matrix, key matrix, and value matrix of the lth layer, represents the scale factor, Represents the weight matrix of the query matrix, key matrix, and value matrix of the lth layer, Z (l-1) represents the output of the l-1th layer, Softmax represents the normalization function;

[0045] The centrality encoding is calculated based on the degree of the node and is used to capture the influence and relevance of the node in the graph, as shown below:

[0046]

[0047] in, represents the initial embedding of the ith node, x i represents the feature of the i-th node, z deg- ,z deg+ The embedding matrix, v, represents the out-degree and in-degree i Represents the out-degree and in-degree of the i-th node;

[0048] The spatial encoding B φ =φ(v i ,v j ), where φ(v i ,v j ) represents the shortest path distance between the i-th node and the j-th node. If the two nodes are not connected, a special value of -1 is assigned to it;

[0049] Each of the encoder sublayers includes the following output process:

[0050] The output Z of the l-1 layer (l-1) The output of the multi-head self-attention mechanism of the lth layer is added, and then the layer is normalized to obtain the output of the first submodule of the lth layer, as shown in the following formula:

[0051]

[0052] In the formula, represents the output of the first submodule of layer l, LN (l) Representation layer normalization;

[0053] The output of the first submodule of layer l and the output of the feedforward neural network FFN(Z (l) ) are added, and then layer normalization LN is performed (l) , get the output of the second submodule of layer l That is, the final output Z of the lth layer (l) ; As shown below:

[0054]

[0055]

[0056] In the formula, represents the output of the second submodule of layer l, FFN(Z (l) ) represents the output of the feedforward neural network at layer l, Z(l) Represents the final output of layer l;

[0057] The output of the performance prediction network is Here, Θ2 is a performance parameter.

[0058] Preferably, the loss function of the flow field reconstruction network is a mean square error, and the loss function of the performance prediction network is a relative error. The mean square error and the relative error are used as a total loss function, and the parameters of the coupling model are updated according to the total loss function.

[0059] The mean square error is as follows:

[0060]

[0061] In the formula, S is the number of samples, is the true output of the ith sample, is the model prediction output of the i-th sample;

[0062] The relative error is as follows:

[0063]

[0064] In the formula, is the true output of the ith sample, is the model prediction output of the i-th sample;

[0065] The total loss function is as follows:

[0066]

[0067] In the formula, is the total loss function;

[0068] The parameters of the coupled model are updated using the gradient descent algorithm:

[0069]

[0070] In the formula, θ is the parameter of the model, α is the learning rate, is the gradient of the loss function with respect to the parameters, t is the number of iterations, and θ includes the grid parameter Θ1 of the flow field reconstruction network and the weight matrix of the performance prediction network The embedding matrix z of the centrality encoding deg -,z deg+ , the spatial encoding scalar matrix B φ , and the weight matrix of the linear layer.

[0071] Preferably, the parameters of the gradient descent algorithm are updated by the Adam algorithm, and the specific update formula is as follows:

[0072]

[0073]

[0074]

[0075]

[0076]

[0077] In the formula, m t+1 and v t+1 are estimates of the first and second moments of the gradient at step t+1, m t and v t are estimates of the first and second moments of the gradient at step t, β1 and β2 are the decay rates, and is the estimate of the moment after the bias correction at step t+1, and is the estimate of the moment after the t-step bias correction, θ t+1 are the model parameters at step t, α is the learning rate, and ∈ is a small number used to prevent division by zero.

[0078] A flapping wing flow field reconstruction and performance prediction device, comprising:

[0079] A data acquisition module is used to acquire flapping wing flow field graph structure data, which includes a node feature matrix, design parameters and an adjacency matrix;

[0080] The model building module is used to build a coupled model, which includes a flow field reconstruction network based on a graph convolutional network and a performance prediction network based on a Transformer;

[0081] A flow field reconstruction module is used to input the node feature matrix, design parameters and adjacency matrix into the flow field reconstruction network to obtain the edge feature matrix, and reconstruct the flapping wing flow field according to the edge feature matrix;

[0082] A performance prediction module is used to input the edge feature matrix and the adjacency matrix into the performance prediction network to obtain the performance data of the reconstructed flapping-wing flow field; and predict the performance of the reconstructed flapping-wing flow field according to the performance data;

[0083] The performance prediction module comprises:

[0084] A transposition module, used to transpose the reshaped edge feature matrix based on the transposition layer;

[0085] A flattening module, used to flatten the transposed edge feature matrix based on the flattening layer;

[0086] An extraction module is used to extract global spatiotemporal features from the flattened edge feature matrix based on the Transformer encoder layer;

[0087] A selection module is used to select the first row based on the output of the Transformer encoder layer of the selection layer;

[0088] The linear module is used to map the output of the selection layer to the dimension of the performance data based on the linear layer to obtain the performance data.

[0089] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the flapping wing flow field reconstruction and performance prediction method when executing the program.

[0090] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements the above-mentioned flapping wing flow field reconstruction and performance prediction method.

[0091] Compared with the prior art, the present invention has the following beneficial effects:

[0092] The present invention couples the graph convolution network GCN and the Transformer model, so that the output of the flow field reconstruction network can be directly used as the input of the performance prediction network, and the two networks learn interactively, thereby realizing end-to-end training and reasoning, solving the two key problems of accurate reconstruction and rapid prediction, and improving the efficiency of flapping wing fluid dynamics calculation and analysis. Based on the neural network of GCN, the edge feature matrix is ​​generated from the node feature matrix and the adjacency matrix of the flow field data, so as to reconstruct the physical quantity of the flow field, and can effectively process the data of non-Euclidean space, capture the local topological structure and hierarchical structure of the flow field data, thereby improving the accuracy of flow field reconstruction. Through the information transmission between nodes, the ability to understand local features is improved, and the global spatiotemporal relationship and dynamic attention of the flow field data are extracted by Transformer, and the attention is dynamically adjusted in a global range, and the relationship between different moments and spatial positions is captured to realize the comprehensive representation of the spatial-spectral domain features of the flow field data, thereby improving the quality of performance prediction. The present invention overcomes the limitations of traditional convolutional and recurrent networks and is suitable for flow field data of different lengths and resolutions. BRIEF DESCRIPTION OF THE DRAWINGS

[0093] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0094] Figure 1 A flowchart of a flapping wing flow field reconstruction and performance prediction method of the present invention;

[0095] Figure 2 It is a structural block diagram of the flow field reconstruction network and performance prediction network of the present invention. DETAILED DESCRIPTION

[0096] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0097] like Figure 1 As shown, the present invention provides a flapping wing flow field reconstruction and performance prediction method, specifically relates to a flapping wing flow field reconstruction and performance prediction method based on a GCN and Transformer coupling model, specifically comprising the following steps:

[0098] The first step is to obtain and process the flapping wing flow field simulation data, that is, to extract the flow field data from the numerical simulation and convert it into graph structure data, including node feature matrix, design parameters and adjacency matrix.

[0099] A flow analysis model based on profile parameters is established through computer-aided design software, and high-quality structured or unstructured grids are automatically generated. The parametric numerical simulation of flapping wings is carried out in combination with numerical simulation software scripts and user-defined functions, realizing a comprehensive and automated analysis of flapping wing flow characteristics and energy harvesting performance.

[0100] Generate several sampling points in the parameter space, S is the total number of samples, and there are N design parameters, which are denoted as ρ1, ρ2, …, ρ N , Extract the flow field data from the numerical simulation analysis of the flapping wing. For each calculation model, obtain the coordinates x of the grid nodes i,j , where i = 1, 2, 3..., M, where M is the total number of grid nodes in the computational model, and j = 1, 2, which represent the coordinates (x, y) of the computational model. i,j Stored as a node feature matrix of the graph Adjacency Matrix A i,j , i=1,2,3...,M, j=1,2,3...,M, used to indicate the connection relationship between each node and all other nodes, A i,j Indicates whether there is an edge connecting the i-th node and the j-th node. If yes, it is 1, otherwise it is 0. The topological structure of the grid unit is used as the definition of the edge, that is, the adjacency relationship A of the graphi,j Stored as a sparse matrix Physical field distribution data Hfi, where i = 1, 2, 3..., M, H f = {p,u,v}, representing the pressure at the grid node, and the velocity components in the x and y directions, respectively, stored as the characteristic matrix of the edge Performance index parameters Where i=1,2,3...,M,H ψ ={C l ,C d ,η,P}, respectively representing the lift coefficient, drag coefficient, energy collection efficiency and power of the flapping wing, stored as

[0101] The present invention constructs a node feature matrix containing design parameters and node coordinate information, describes the connection relationship between nodes, provides the model with graph topology information, helps to capture the local structure and mutual relationship of the flow field, embeds the physical field distribution data into the edge features, provides the neural network with information about the physical quantities of the flow field, helps the model learn the correlation between nodes, and lays the foundation for subsequent model training and evaluation.

[0102] Step 2: Reference Figure 2 , construct a coupling model, which includes a flow field reconstruction network based on graph convolutional network and a performance prediction network based on Transformer.

[0103] GCN is a graph convolutional network, which can effectively extract the spatial features of graph structured data, that is, the local relationship between nodes and edges, while ignoring the global structural information in the graph. Transformer is a neural network model based on the self-attention mechanism, which can effectively extract the temporal features of sequence data, that is, the long-distance dependencies in the sequence, while ignoring the position information in the sequence. These two models have advantages in different dimensions, but also have some limitations. The innovation of the present invention is to fuse GCN and Transformer so that the two models complement each other, dynamically simulate the spatial dependencies between nodes, and consider the centrality of nodes and the structural information of edges, thereby improving the accuracy and efficiency of flow field reconstruction and performance prediction.

[0104] The GCN and Transformer coupling model uses the output of the flow field reconstruction network directly as the input of the performance prediction network. The two networks learn interactively to achieve end-to-end training and reasoning. This innovative design effectively reduces the complexity of multi-stage processing in traditional methods and solves the two key problems of accurate reconstruction and fast prediction, thereby improving the efficiency of overall computational analysis.

[0105] Step 3: Input the node feature matrix, design parameters and adjacency matrix into the flow field reconstruction network to obtain the edge feature matrix, and reconstruct the flapping wing flow field according to the edge feature matrix.

[0106] The flow field reconstruction network is the first module of the nonlinear mapping neural network of the present invention. It adopts a GCN-based neural network to generate an edge feature matrix from the node feature matrix X and the adjacency matrix A of the flow field data, thereby reconstructing the physical quantities of the flow field. It can effectively process data in non-Euclidean space and capture the local topological structure and hierarchical structure of the flow field data, thereby improving the accuracy of flow field reconstruction.

[0107] (1) Design parameter fusion: The input node feature matrix X and the design parameter ρ are concatenated to form a new node feature matrix X′, which is Where S is the number of graphs, M is the number of nodes in each graph, 2 is the dimension of the grid node coordinates, and N is the dimension of the design parameters.

[0108] (2) Adjacency relationship representation: The input adjacency matrix A is converted into an edge index E to represent the adjacency relationship of the graph. The shape is (2, S × M × M), where E ij Represents the indices of the start and end points of the j-th edge of the ith graph.

[0109] (3) Graph convolution layer operation: Define L graph convolution layers, and transform the dimensions of node features from the input dimension F in Mapped to the hidden layer dimension F hid , and then from the hidden layer dimension F hid Mapped to the output dimension F out , the output dimension is equal to the dimension of the flow field feature, where W (l) represents the weight matrix of the lth layer, b (l) represents the bias vector of the lth layer, h (l) represents the node feature matrix of the lth layer, represents the edge feature matrix of layer l, h (0) =X′,

[0110]

[0111]

[0112] Wherein σ represents the activation function; G represents the dimension of the flow field feature. In the present invention, G=3; [E] represents the index operation according to the edge index E; Represents the kth channel of the edge feature matrix of the lth layer.

[0113] (4) Non-linear output: The ReLU activation function is used after the L-1 convolutional layer to increase non-linearity.

[0114] (5) Output processing: There is no activation function after the Lth graph convolution layer, and the edge feature matrix is ​​directly output.

[0115] (6) Reshape the output: Reshape the edge feature matrix Reshape into the same shape as the input adjacency matrix, i.e. (S×M×M×G), as the output of the flow field reconstruction network It is expressed as: Among them, Θ1 is the grid parameter to be learned during the training process of the flow field reconstruction model.

[0116] Step 4: Input the edge feature matrix and the adjacency matrix into the performance prediction network to obtain the performance data of the reconstructed flapping-wing flow field; predict the performance of the reconstructed flapping-wing flow field based on the performance data.

[0117] The performance prediction network is the second module of the nonlinear mapping neural network of the present invention. It uses a Transformer-based neural network, which can effectively capture the global spatiotemporal relationship and dynamic attention of flow field data, thereby improving the accuracy of performance prediction. The two networks are coupled to achieve end-to-end training and reasoning, in which the output of the flow field reconstruction network is directly used as the input of the performance prediction network, which improves efficiency and robustness.

[0118] The performance prediction network is used to extract global features from the edge feature matrix output by the flow field reconstruction network, so as to predict the performance indicators of the flow field. Specifically, it includes: input layer, transposition layer, flattening layer, Transformer encoder layer, selection layer, linear layer and output layer.

[0119] (1) Transpose layer: Transpose the edge feature matrix Transpose it so that its shape is (S×G×M×M), where S is the total number of samples in the graph, G is the dimension of edge features, and M is the number of nodes in each graph.

[0120] (2) Flattening layer: The transposed edge feature matrix Flatten it to make it into (S×G×M 2) .

[0121] (3) Transformer encoder layer: From the flattened edge feature matrix The global spatiotemporal features are extracted from the Transformer encoder layer. Each encoder sublayer includes a multi-head self-attention mechanism and a feedforward neural network, as well as residual connections and layer normalization. The multi-head self-attention mechanism uses the adjacency matrix A as a mask matrix to mask invalid edges. The multi-head self-attention mechanism also adds centrality encoding and spatial encoding to characterize the importance and spatial relationship of nodes in the graph. The output shape of the Transformer encoder layer is (S×G×M 2 );

[0122] Among them, the specific calculation formulas of multi-head self-attention mechanism, centrality encoding and spatial encoding are as follows:

[0123]

[0124]

[0125]

[0126] Among them, Q (l) , K (l) , V (l) represents the query, key and value matrix of the lth layer, Represents the weight matrix of the key and value in the query of layer l; Z (l-1) represents the output of the l-1th layer,

[0127]

[0128]

[0129] Among them, MultiHead(Q (l) ,K (l) ,V (l) ) represents the output of the multi-head self-attention mechanism at layer l, which is obtained by concatenating the results of H attention heads. Concat is the concatenation operation. head i is the output of the ith attention head, The weight matrix representing the output of layer l;

[0130]

[0131] Among them, Attention(Q,K,V) is the attention function, which is the dot product of the query matrix Q, the key matrix K and the value matrix V, plus the spatial encoding B φ and edge code C, then normalized and weighted summed to obtain, Represents the scale factor, which is the square root of the key dimension. Its function is to prevent the result of the dot product from being too large or too small, causing the gradient of Softmax to disappear or explode. Softmax is a normalization function that converts the attention weight into a probability distribution so that the sum of the weights of all keys corresponding to each query is 1. φ =φ(v i ,v j ),φ(v i ,v j ) represents the shortest path distance between the i-th node and the j-th node. If the two nodes are not connected, a special value of -1 is assigned to it. Specifically, in, is the characteristic of the nth edge, is the nth weight embedding, and E is the dimension of the edge feature. By adding spatial encoding to the attention mechanism, the model can more accurately allocate attention weights, allowing the Transformer model to better process graph structure data and improve the graph's expressiveness and prediction performance.

[0132] Centrality encoding is calculated based on the degree of the node, which is used to capture the influence and relevance of the node in the graph, thereby enhancing the model's understanding of the graph structure information, as shown below:

[0133]

[0134] in, represents the initial embedding of the ith node, x i represents the feature of the i-th node, z deg -,z deg+ The embedding matrix, v, represents the out-degree and in-degree i Represents the out-degree and in-degree of the i-th node.

[0135]

[0136]

[0137]

[0138] This formula is used to describe each encoder sublayer in the Transformer encoder layer, which contains two submodules: multi-head self-attention mechanism and feedforward neural network. (l) , which is both the output of the lth layer and the input of the l+1th layer. It needs to be calculated twice, corresponding to the output of the two submodules. The first calculation converts the output Z of the l-1th layer into (l-1) Add the output MultiHead of the multi-head self-attention mechanism of the lth layer, and then perform layer normalization LN (l), get the output of the first submodule of layer l The second calculation takes the output of the first submodule of layer l and the output of the feedforward neural network FFN(Z (l) ) are added, and then layer normalization LN is performed (l) , get the output of the second submodule of layer l That is, the final output Z of the lth layer (l) This calculation process implements residual connection, that is, adding the input to the output of each submodule, thus avoiding the problem of gradient disappearance and representation degradation.

[0139] (4) Selection layer: Select the first row from the output of the Transformer encoder layer, which corresponds to the encoding of the first edge feature. The output shape of the selection layer is (S×M 2 );

[0140] (5) Linear layer: maps the output of the selection layer to the dimension of performance data. The performance data represents the performance indicators of the flow field, such as lift coefficient, drag coefficient, energy collection efficiency and power. The output shape of the linear layer is (S×4), which is used as the output of the neural network.

[0141] (6) The output layer is defined as: Among them, Θ2 is the parameter to be learned during the training process of the performance parameter prediction model.

[0142] The GCN and Transformer coupling model achieves high-precision reconstruction of flapping wing flow field characteristics and accurate prediction of performance indicators based on the fusion of spatial-spectral domain features of data. GCN extracts the local topological structure and hierarchical structure of the flow field data, and improves the ability to understand local features through information transmission between nodes. Transformer extracts the global spatiotemporal relationship and dynamic attention of the flow field data, captures the relationship between different moments and spatial positions, thereby achieving a comprehensive representation of the spatial-spectral domain features of the flow field data and improving the quality of flow field reconstruction and performance prediction.

[0143] In this embodiment, the GCN and Transformer coupling model can realize multi-scale and multi-head feature extraction, and adapt to the flow field structure and changes of different scales and aspects by adjusting the kernel size and step size of GCN and the number of heads and dimensions of Transformer. Such a design realizes the fusion of multi-scale and multi-head features of flapping wing flow field data, and improves the diversity and robustness of flow field reconstruction and performance prediction.

[0144] The collected design parameters ρ i , node feature matrix Adjacency Edge feature matrix And flapping wing performance index data Divide into different subsets, including training set, validation set and test set, to provide an ordered data set for subsequent model training, tuning and evaluation. You can use methods such as stratified sampling or cross-validation to ensure that the data distribution and proportion in each subset are consistent with the original data set, increasing the utilization and representativeness of the data. Generally speaking, the training set accounts for 60% to 80% of the data set, the validation set accounts for 10% to 20% of the data set, and the test set accounts for 10% to 20% of the data set.

[0145] Define the loss function of the model, that is, how to calculate the prediction error of the model based on the output of the model and the real data, and evaluate the performance of the model. To indicate that the smaller the loss function, the better the performance of the model. The mean square error (MSE) is used as the loss function for flow field reconstruction based on the GCN neural network, and the relative error (RE) is used as the loss function for performance parameter prediction based on the Transformer neural network. The total loss function, that is, the sum of the loss functions of each subtask, is used as the optimization target of the model.

[0146] The flow field reconstruction based on graph convolutional neural network is expressed as: Among them, Θ1 is the grid parameter to be learned during the flow field reconstruction model training process. Calculate the mean square error (MSE) between the network's flow field prediction output and the actual flow field data:

[0147]

[0148] Where S is the sample size, is the true output of the ith sample, is the model prediction output for the ith sample.

[0149] The performance parameter prediction based on Transformer neural network is expressed as: Among them, Θ2 is the parameter to be learned during the training process of the performance parameter prediction model. The mean absolute error (MAE) between the performance prediction output of the network and the actual performance data is:

[0150]

[0151] Where S is the sample size, is the true output of the ith sample, is the model prediction output for the ith sample.

[0152] The total loss function is the sum of the loss functions of the two networks, namely:

[0153]

[0154] The present invention is implemented by the gradient descent algorithm, which updates the parameters according to the gradient of the loss function to the model parameters, so that the value of the loss function gradually decreases. The update formula of the gradient descent is:

[0155]

[0156] Among them, θ is the parameter of the model, α is the learning rate, is the gradient of the loss function with respect to the parameter, and t is the number of iterations. In the present invention, θ includes the grid parameter θ1 of the flow field reconstruction network and the weight matrix of the performance prediction network The embedding matrix z of the centrality encoding deg- ,z deg+ , the spatial encoding scalar matrix B φ , and the weight matrix of the linear layer.

[0157] On the basis of gradient descent, different strategies are introduced to adjust the learning rate, increase momentum, consider historical gradients, etc., to improve the efficiency and stability of optimization. We take the Adam algorithm as an example of the optimization algorithm of the model, and its update formula is:

[0158]

[0159]

[0160]

[0161]

[0162]

[0163] Among them, m t+1 and v t+1 are estimates of the first and second moments of the gradient at step t+1, m t and v t are estimates of the first and second moments of the gradient at step t, β1 and β2 are the decay rates, and is the estimate of the moment after the bias correction at step t+1, and is the estimate of the moment after the t-step bias correction, θ t+1 are the model parameters at step t, α is the learning rate, and ∈ is a small number used to prevent division by zero.

[0164] Traverse the data in the training set, use each data as the input of the model, get the output of the model, calculate the loss function of the model, update the parameters of the model, and repeat the process until the loss function of the model reaches the preset threshold or reaches the preset number of iterations, completing the model training.

[0165] The evaluation index of the model is a method used to measure the prediction performance and generalization ability of the model. In the present invention, PSNR and correlation coefficient r are used as the evaluation index of the model, which are used to evaluate the results of flow field reconstruction and performance prediction respectively.

[0166] PSNR is an indicator to measure image quality. It calculates the peak signal-to-noise ratio between the original image and the reconstructed image. Its value range is [0, infinity). The larger the value, the better the image quality. The calculation formula of PSNR is:

[0167]

[0168] Among them, MAX is the maximum pixel value of the image, is the mean square error, H f is the original image, is the reconstructed image.

[0169] The correlation coefficient r is an indicator that measures the degree of linear correlation between two variables. Its value range is [-1,1]. The closer it is to 1, the positive correlation is indicated; the closer it is to -1, the negative correlation is indicated; and the closer it is to 0, the no correlation is indicated. The calculation formula of the correlation coefficient is:

[0170]

[0171] Where S is the sample size, is the true output of the ith sample, is the model prediction output for the ith sample.

[0172] This paper realizes the visualization and analysis of flapping wing flow field reconstruction and performance prediction. Through the edge feature matrix of GCN and the attention weight matrix of Transformer, the importance, connection strength, attention and spatiotemporal relationship of edges and nodes of flow field data are quantified and visualized. This improves the interpretability and credibility of flow field reconstruction and performance prediction, and provides engineers and researchers with a deeper understanding and analysis tool.

[0173] The present invention has the ability to adapt to and process flow field data of different types and scales. The semantic information is enhanced through the structural information of the graph data, and the expression and generalization ability of the network is strengthened, making it suitable for non-Euclidean space, complex topological structures and dynamic space-time relationships. The adaptability and generalization of the coupling model enable it to handle oscillating flapping wing systems of different types and scales, providing an efficient and flexible solution for energy harvesting in different environments.

[0174] Based on the same concept, the present invention also provides a flapping wing flow field reconstruction and performance prediction device, including a data acquisition module, a model building module, a flow field reconstruction module and a performance prediction module.

[0175] The data acquisition module is used to obtain the flapping wing flow field graph structure data, which includes node feature matrix, design parameters and adjacency matrix.

[0176] The model building module is used to build a coupled model, which includes a flow field reconstruction network based on a graph convolutional network and a performance prediction network based on a Transformer.

[0177] The flow field reconstruction module is used to input the node feature matrix, design parameters and adjacency matrix into the flow field reconstruction network to obtain the edge feature matrix, and reconstruct the flapping wing flow field according to the edge feature matrix.

[0178] The performance prediction module is used to input the edge feature matrix and the adjacency matrix into the performance prediction network to obtain the performance data of the reconstructed flapping-wing flow field; and predict the performance of the reconstructed flapping-wing flow field according to the performance data.

[0179] Furthermore, the performance prediction module includes a transposition module, a flattening module, an extraction module, a selection module and a linear module.

[0180] The transpose module is used to transpose the reshaped edge feature matrix based on the transpose layer.

[0181] The flattening module is used to flatten the transposed edge feature matrix based on the flattening layer.

[0182] The extraction module is used to extract the global spatiotemporal features from the flattened edge feature matrix based on the Transformer encoder layer.

[0183] The selection module is used to select the first row based on the output of the Transformer encoder layer in the selection layer.

[0184] The linear module is used to map the output of the selection layer to the dimension of the performance data based on the linear layer to obtain the performance data.

[0185] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the above-mentioned flapping wing flow field reconstruction and performance prediction method is implemented.

[0186] The present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned flapping wing flow field reconstruction and performance prediction method is implemented.

[0187] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0188] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A flapping wing flow field reconstruction and performance prediction method, characterized in that: The following steps are involved: Obtaining flapping wing flow field graph structure data, the data including node feature matrix, design parameters and adjacency matrix; Construct a coupling model, which includes a flow field reconstruction network based on a graph convolutional network and a performance prediction network based on a Transformer; The node feature matrix, design parameters and adjacency matrix are input into the flow field reconstruction network to obtain the edge feature matrix, and the flapping wing flow field is reconstructed according to the edge feature matrix; Input the edge feature matrix and the adjacency matrix into the performance prediction network to obtain the performance data of the reconstructed flapping wing flow field; Predict the performance of the reconstructed flapping wing flow field based on the performance data; The step of inputting the edge feature matrix and the adjacency matrix into the performance prediction network to obtain the performance data of the reconstructed flapping wing flow field comprises the following steps: Transpose the reshaped edge feature matrix based on the transpose layer; Flatten the transposed edge feature matrix based on the flattening layer; Extract global spatiotemporal features from the flattened edge feature matrix based on the Transformer encoder layer; Select the first row based on the output of the Transformer encoder layer of the selection layer; Based on the linear layer, the output of the selection layer is mapped to the dimension of the performance data to obtain the performance data of the flapping wing flow field; The node feature matrix, design parameters and adjacency matrix are input into the flow field reconstruction network to obtain the edge feature matrix, which includes the following steps: Based on the fusion layer, the node feature matrix and the design parameters are concatenated to obtain a new node feature matrix; Convert the adjacency matrix into edge index based on the representation layer; Based on the L-layer graph convolution layer, the new node feature matrix and edge index are convolved to obtain the edge feature matrix; Reshape the edge feature matrix into the same shape as the adjacency matrix based on the reshape layer; The node feature matrix is ​​X, and its shape is The new node feature matrix is ​​X', and its shape is Where S is the number of graphs, M is the number of nodes in each graph, 2 is the dimension of the grid node coordinates, and N is the dimension of the design parameters; The adjacency matrix is ​​A, The edge index is E and the shape is (2, S×M×M); The L-layer graph convolutional layer transforms the dimension of node features from the input dimension F in Mapped to the hidden layer dimension F hid , from the hidden layer dimension F hid Mapped to the output dimension F out , the output dimension is equal to the dimension of the flow field feature; The edge feature matrix is ​​calculated by the following formula: In the formula, represents the edge feature matrix of layer l, h (l-1) represents the node feature matrix of the l-1th layer, W (l) represents the weight matrix of the lth layer, b (l) represents the bias vector of the lth layer, h (l) represents the node feature matrix of the lth layer, σ represents the activation function, G represents the dimension of the flow field feature, represents the kth channel of the edge feature matrix of layer l, [E] represents the indexing operation according to edge index E; h (0) =X′, Represents the new node feature matrix; The ReLU activation function is used after the L-1th convolution layer, and there is no activation function after the Lth graph convolution layer; The output of the flow field reconstruction network is Among them, Θ1 is the grid parameter, ρ is the design parameter; The shape of the transposed edge feature matrix is ​​(S×G×M×M); The shape of the flattened edge feature matrix is ​​(S×G×M 2) ; The Transformer encoder layer includes L encoder sublayers, each of which includes a multi-head self-attention mechanism, a feedforward neural network, a residual connection, and a layer normalization. The multi-head self-attention mechanism uses an adjacency matrix as a mask matrix to mask invalid edges. The multi-head self-attention mechanism adds centrality encoding and spatial encoding to characterize the importance and spatial relationship of nodes in the graph. The output shape of the Transformer encoder layer is (S×G×M 2 ); The output of the multi-head self-attention mechanism is as follows: in, In the formula, MultiHead(Q (l) ,K (l) ,V (l) ) represents the output of the multi-head self-attention mechanism at layer l, H represents the number of attention heads, Concat is the concatenation operation, and head i is the output of the ith attention head, represents the weight matrix of the output of layer l, Attention(Q,K,V) is the attention function, B φ Representation space code B φ , C represents edge coding, Q (l) , K (l) 、V (l) represents the query matrix, key matrix, and value matrix of the lth layer, represents the scale factor, Represents the weight matrix of the query matrix, key matrix, and value matrix of the lth layer, Z (l-1) represents the output of the l-1th layer, Softmax represents the normalization function; The centrality encoding is calculated based on the degree of the node and is used to capture the influence and relevance of the node in the graph, as shown below: in, represents the initial embedding of the ith node, x i represents the feature of the i-th node, z deg-, z deg+ The embedding matrix, v, represents the out-degree and in-degree i Represents the out-degree and in-degree of the i-th node; The spatial encoding B φ =φ(v i ,v j ), where φ(v i ,v j ) represents the shortest path distance between the i-th node and the j-th node. If the two nodes are not connected, a special value of -1 is assigned to it; Each of the encoder sublayers includes the following output process: The output Z of the l-1 layer (l-1) The output of the multi-head self-attention mechanism of the lth layer is added, and then the layer is normalized to obtain the output of the first submodule of the lth layer, as shown in the following formula: In the formula, represents the output of the first submodule of layer l, LN (l) Representation layer normalization; The output of the first submodule of layer l and the output of the feedforward neural network FFN(Z (l) ) are added, and then layer normalization LN is performed (l) , get the output of the second submodule of layer l That is, the final output Z of the lth layer (l) ; As shown below: In the formula, represents the output of the second submodule of layer l, FFN(Z (l) ) represents the output of the feedforward neural network at layer l, Z (l) Represents the final output of layer l; The output of the performance prediction network is Here, Θ2 is a performance parameter.

2. A flapping wing flow field reconstruction and performance prediction method as claimed in claim 1, characterized in that: A flapping wing flow analysis model based on profile parameters is established through computer-aided design software, and structured or unstructured grids are automatically generated. The parametric numerical simulation of flapping wings is performed by combining numerical simulation software scripts and user-defined functions, flapping wing flow field simulation data is obtained, and the simulation data is converted into graph structure data.

3. A flapping wing flow field reconstruction and performance prediction method as claimed in claim 1, characterized in that: The loss function of the flow field reconstruction network is the mean square error, the loss function of the performance prediction network is the relative error, the mean square error and the relative error are used as the total loss function, and the parameters of the coupling model are updated according to the total loss function; The mean square error is as follows: In the formula, S is the number of samples, is the true output of the ith sample, is the model prediction output of the i-th sample; The relative error is as follows: In the formula, is the true output of the ith sample, is the model prediction output of the i-th sample; The total loss function is as follows: In the formula, is the total loss function; The parameters of the coupled model are updated using the gradient descent algorithm: In the formula, θ is the parameter of the model, α is the learning rate, is the gradient of the loss function with respect to the parameters, t is the number of iterations, and θ includes the grid parameter Θ1 of the flow field reconstruction network and the weight matrix of the performance prediction network The embedding matrix z of the centrality encoding deg- ,z deg+ , the spatial encoding scalar matrix B φ , and the weight matrix of the linear layer.

4. A flapping wing flow field reconstruction and performance prediction method as claimed in claim 3, characterized in that: The parameters of the gradient descent algorithm are updated through the Adam algorithm. The specific update formula is as follows: In the formula, m t+1 and v t+1 are estimates of the first and second moments of the gradient at step t+1, m t and v t are estimates of the first and second moments of the gradient at step t, β1 and β2 are the decay rates, and is the estimate of the moment after the bias correction at step t+1, and is the estimate of the moment after the t-step bias correction, θ t+1 are the model parameters at step t, α is the learning rate, and ∈ is a small number used to prevent division by zero.

5. A flapping wing flow field reconstruction and performance prediction device, characterized in that: include: A data acquisition module is used to acquire flapping wing flow field graph structure data, which includes node feature matrix, design parameters and adjacency matrix; The model building module is used to build a coupled model, which includes a flow field reconstruction network based on a graph convolutional network and a performance prediction network based on a Transformer; A flow field reconstruction module is used to input the node feature matrix, design parameters and adjacency matrix into the flow field reconstruction network to obtain the edge feature matrix, and reconstruct the flapping wing flow field according to the edge feature matrix; A performance prediction module is used to input the edge feature matrix and the adjacency matrix into the performance prediction network to obtain the performance data of the reconstructed flapping wing flow field; Predict the performance of the reconstructed flapping wing flow field based on the performance data; The performance prediction module comprises: A transposition module, used to transpose the reshaped edge feature matrix based on the transposition layer; A flattening module, used to flatten the transposed edge feature matrix based on the flattening layer; An extraction module is used to extract global spatiotemporal features from the flattened edge feature matrix based on the Transformer encoder layer; A selection module is used to select the first row based on the output of the Transformer encoder layer of the selection layer; A linear module, used for mapping the output of the selection layer to the dimension of the performance data based on the linear layer to obtain the performance data; The node feature matrix, design parameters and adjacency matrix are input into the flow field reconstruction network to obtain the edge feature matrix, which includes the following steps: Based on the fusion layer, the node feature matrix and the design parameters are concatenated to obtain a new node feature matrix; Convert the adjacency matrix into edge index based on the representation layer; Based on the L-layer graph convolution layer, the new node feature matrix and edge index are convolved to obtain the edge feature matrix; Reshape the edge feature matrix into the same shape as the adjacency matrix based on the reshape layer; The node feature matrix is ​​X, and its shape is The new node feature matrix is ​​X', and its shape is Where S is the number of graphs, M is the number of nodes in each graph, 2 is the dimension of the grid node coordinates, and N is the dimension of the design parameters; The adjacency matrix is ​​A, The edge index is E and the shape is (2, S×M×M); The L-layer graph convolutional layer transforms the dimension of node features from the input dimension F in Mapped to the hidden layer dimension F hid , from the hidden layer dimension F hid Mapped to the output dimension F out , the output dimension is equal to the dimension of the flow field feature; The edge feature matrix is ​​calculated by the following formula: In the formula, represents the edge feature matrix of layer l, h (l-1) represents the node feature matrix of the l-1th layer, W (l) represents the weight matrix of the lth layer, b (l) represents the bias vector of the lth layer, h (l) represents the node feature matrix of the lth layer, σ represents the activation function, G represents the dimension of the flow field feature, represents the kth channel of the edge feature matrix of layer l, [E] represents the indexing operation according to edge index E; j (0) =X′, Represents the new node feature matrix; The ReLU activation function is used after the L-1th convolution layer, and there is no activation function after the Lth graph convolution layer; The output of the flow field reconstruction network is Among them, Θ1 is the grid parameter, ρ is the design parameter; The shape of the transposed edge feature matrix is ​​(S×G×M×M); The shape of the flattened edge feature matrix is ​​(S×G×M 2) ; The Transformer encoder layer includes L encoder sublayers, each of which includes a multi-head self-attention mechanism, a feedforward neural network, a residual connection, and a layer normalization. The multi-head self-attention mechanism uses an adjacency matrix as a mask matrix to mask invalid edges. The multi-head self-attention mechanism adds centrality encoding and spatial encoding to characterize the importance and spatial relationship of nodes in the graph. The output shape of the Transformer encoder layer is (S×G×M 2 ); The output of the multi-head self-attention mechanism is as follows: in, In the formula, MultiHead(Q (l) ,K (l) ,V (l) ) represents the output of the multi-head self-attention mechanism at layer l, H represents the number of attention heads, Concat is the concatenation operation, and head i is the output of the ith attention head, represents the weight matrix of the output of layer l, Attention(Q,K,V) is the attention function, B φ Representation space code B φ , C represents edge coding, Q (l) , K (l) 、V (l) represents the query matrix, key matrix, and value matrix of the lth layer, represents the scale factor, Represents the weight matrix of the query matrix, key matrix, and value matrix of the lth layer, Z (l-1) represents the output of the l-1th layer, Softmax represents the normalization function; The centrality encoding is calculated based on the degree of the node and is used to capture the influence and relevance of the node in the graph, as shown below: in, represents the initial embedding of the ith node, x i represents the feature of the i-th node, z deg-, z deg+ The embedding matrix, v, represents the out-degree and in-degree i Represents the out-degree and in-degree of the i-th node; The spatial encoding B φ =φ(v i ,v j ), where φ(v i ,v j ) represents the shortest path distance between the i-th node and the j-th node. If the two nodes are not connected, a special value of -1 is assigned to it; Each of the encoder sublayers includes the following output process: The output Z of the l-1 layer (l-1) The output of the multi-head self-attention mechanism of the lth layer is added, and then the layer is normalized to obtain the output of the first submodule of the lth layer, as shown in the following formula: In the formula, represents the output of the first submodule of layer l, LN (l) Representation layer normalization; The output of the first submodule of layer l and the output of the feedforward neural network FFN(Z (l) ) are added, and then layer normalization LN is performed (l) , get the output of the second submodule of layer l That is, the final output Z of the lth layer (l) ; As shown below: In the formula, represents the output of the second submodule of layer l, FFN(Z (l) ) represents the output of the feedforward neural network at layer l, Z (l) Represents the final output of layer l; The output of the performance prediction network is Here, Θ2 is a performance parameter.

6. A computer device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the flapping wing flow field reconstruction and performance prediction method described in any one of claims 1 to 4 is implemented.

7. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the flapping wing flow field reconstruction and performance prediction method described in any one of claims 1 to 4 is implemented.