Flow field prediction method based on attention and convolutional neural network encoder-decoder

By introducing the attention mechanism and the convolutional neural network codec into the flow field prediction, combined with the angle of attack and Mach number, the problem of low flow field prediction accuracy and efficiency in the existing technology is solved, and a more efficient and accurate flow field prediction is achieved. Flow field prediction.

CN116227359BActive Publication Date: 2024-09-03CHONGQING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310242725.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2022-11-15
Filing Date
2023-03-14
Publication Date
2024-09-03
Estimated Expiration
2043-03-14

AI Technical Summary

Technical Problem

Existing technologies have problems with insufficient prediction accuracy and low efficiency in flow field prediction. In particular, convolutional neural networks have limitations in global information acquisition and cannot effectively improve the accuracy and efficiency of flow field prediction.

Method used

A flow field prediction method based on attention and convolutional neural network codec is adopted. Global information is extracted through the attention mechanism and the flow field characteristics around the prediction object are analyzed and predicted by the convolutional neural network. Advanced feature maps are generated by combining the angle of attack and Mach number. This further improves the accuracy and efficiency of flow field prediction.

Benefits of technology

It significantly improves the accuracy and efficiency of flow field prediction, enables faster estimation of velocity and pressure fields, and provides more accurate technical support for the optimal design of airfoils.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116227359B_ABST
    Figure CN116227359B_ABST
Patent Text Reader

Abstract

The present invention specifically relates to a flow field prediction method based on attention and convolutional neural network codec, including: inputting a signed distance function graph into a trained flow field prediction model, and outputting a corresponding flow field prediction image; when training the model: firstly inputting a training data set containing a signed distance function graph and a real flow field image into the flow field prediction model; then extracting the image features of the signed distance function graph through an encoder based on an attention mechanism and a convolutional neural network, and generating an attention feature graph; then fusing the attention feature graph with the attack angle and Mach number of the signed distance function graph through a fusion mapping module, and mapping to generate a high-level feature graph; then decoding the high-level feature graph through a decoder to generate a flow field prediction image; finally calculating the training loss based on the flow field prediction image and the real flow field image, and optimizing the parameters of the flow field prediction model through the training loss. The present invention can improve the prediction accuracy and prediction efficiency of flow field prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of flow field prediction, and in particular to a flow field prediction method based on attention and convolutional neural network codec. Background Art

[0002] The airfoil optimization design of a wing usually involves selecting the best airfoil from a series of airfoils derived from a reference airfoil. The airfoil optimization design method has evolved from early wind tunnel experiments to computational fluid dynamics (CFD), which effectively shortens the design cycle. However, there are a lot of flow field analysis and calculation problems in the airfoil optimization process based on CFD technology. In many practical engineering applications, flow field analysis is the most computationally intensive and time-consuming part.

[0003] Deep learning has a strong learning ability for high-order complex functions, and has unique advantages in feature extraction, which can make fast and accurate predictions. To this end, the Chinese patent with publication number CN112784508A discloses "A method for rapid prediction of airfoil flow field based on deep learning", which includes: generating a sample data set required for building a neural network; building and training a deep learning neural network model based on the sample data set; and using the built deep neural network for rapid prediction of airfoil flow field. This model applies deep learning to the prediction of airfoil flow field, which can reduce time cost and resource consumption, and is a feasible new idea with broad application prospects.

[0004] Convolutional neural networks (CNNs) belong to a class of DNNs and are often used for the analysis of visual images. Many works have shown that even if the data has strong spatial and channel correlations, convolutional neural networks have the potential to learn high-level features. Convolutional neural network models have received increasing attention in fluid mechanics due to their significant advantages in shape representation and scalability. However, convolutional neural networks have great limitations in the acquisition of global information and cannot effectively implement the global reference of the model, resulting in insufficient accuracy in model prediction. At the same time, other existing methods also have the problem of insufficient prediction efficiency. Therefore, how to design a method that can improve the accuracy and efficiency of flow field prediction is a technical problem that needs to be solved urgently. Summary of the invention

[0005] In view of the above-mentioned deficiencies in the prior art, the technical problem to be solved by the present invention is: how to provide a flow field prediction method based on attention and convolutional neural network codec, which can analyze the main influencing factors of the flow field around the prediction object through convolutional neural network, improve the prediction speed of the model through the codec structure, and extract important features from the global information through the attention mechanism, thereby improving the prediction accuracy and prediction efficiency of the flow field prediction, and further providing effective technical support for the airfoil optimization design of the wing.

[0006] In order to solve the above technical problems, the present invention adopts the following technical solutions:

[0007] Flow field prediction method based on attention and convolutional neural network encoder-decoder, including:

[0008] S1: Obtain the signed distance function graph of the object to be predicted;

[0009] S2: Input the signed distance function graph into the trained flow field prediction model and output the corresponding flow field prediction image;

[0010] When training the flow field prediction model: first, the training data set containing the signed distance function graph and the corresponding real flow field image is input into the flow field prediction model; then, the image features of the signed distance function graph are extracted through the encoder based on the attention mechanism and convolutional neural network to generate the corresponding attention feature graph; then, the attention feature graph is fused with the attack angle and Mach number of the corresponding signed distance function graph through the fusion mapping module, and the corresponding high-level feature graph is mapped and generated; then, the high-level feature graph is decoded through the decoder to generate the corresponding flow field prediction image; finally, the training loss is calculated based on the flow field prediction image and the corresponding real flow field image, and the parameters of the flow field prediction model are optimized through the training loss;

[0011] S3: Taking the predicted values ​​of the velocity field and the pressure field in the flow field prediction image as the flow field prediction result of the object to be predicted.

[0012] Preferably, the training data set is constructed by the following steps:

[0013] S201: parameterizing the target airfoil and adding disturbance to generate a new airfoil, taking various airfoils as prediction objects;

[0014] S202: For a single prediction object, generate a corresponding signed distance function graph by using a Cartesian grid method;

[0015] S203: Calculate the velocity field and pressure field of a single prediction object at different attack angles and different Mach numbers as flow field data by using the Reynolds averaged NS equation numerical simulation method;

[0016] S204: interpolating the flow field data of a single prediction object onto a Cartesian grid of a corresponding size by using a scattered data interpolation method of a triangular part, and generating a corresponding real image of the flow field;

[0017] S205: Repeat steps S202 to S204, and use the signed distance function graph corresponding to the predicted object and the real flow field image as a set of training data to generate a training data set including the signed distance function graph and the corresponding real flow field image.

[0018] Preferably, in step S202, a signed distance function graph is generated by the following steps:

[0019] S2021: gridding the corresponding prediction object by a Cartesian grid method to generate a corresponding wing grid;

[0020] S2022: Calculate the signed distance between a given Cartesian grid point and a boundary point of the predicted object in the wing grid;

[0021] S2023: Searching for boundary points of the predicted object, calculating the scalar product between the normal vector at the boundary point closest to the given Cartesian grid point and the vector from the given Cartesian grid point to the nearest boundary point, and determining the function sign by the scalar product value;

[0022] S2024: Generate a signed distance function graph corresponding to the predicted object according to the calculated signed distance and function sign.

[0023] Preferably, the encoder generates the attention feature map by the following steps:

[0024] S211: Inputting the signed distance function graph into the convolution layer for convolution filtering to generate a corresponding original feature graph;

[0025] S212: Input the original feature map into the channel attention module to extract the channel importance feature and generate the corresponding channel attention feature map;

[0026] S213: Input the channel attention feature map into the spatial attention module to extract spatial features and generate a corresponding spatial attention feature map;

[0027] S214: Input the spatial attention feature map into the convolution layer for convolution filtering to generate a corresponding attention feature map.

[0028] Preferably, in step S212, the channel attention module generates a channel attention feature map through the following steps:

[0029] S2121: Input the original feature map into the parallel maximum pooling layer and average pooling layer to generate the corresponding first feature map and second feature map;

[0030] S2122: compressing the number of channels of the first feature map and the second feature map to 1 / r times of the original number of channels respectively through a shared multi-layer perceptron, and then expanding them back to the original number of channels, to generate a corresponding first perceptual feature map and a second perceptual feature map;

[0031] S2123: Activate the first perceptual feature map and the second perceptual feature map through the ReLU activation function, and perform element-by-element addition and sigmoid activation function processing on the activated results to generate a corresponding channel attention mechanism map;

[0032] S2124: Multiply the channel attention mechanism map with the original feature map to generate the corresponding channel attention feature map.

[0033] Preferably, in step S213, the spatial attention module generates a spatial attention feature map through the following steps:

[0034] S2131: Input the channel attention feature map into the maximum pooling layer to generate the corresponding third feature map;

[0035] S2132: Input the third feature map into the convolution layer for convolution filtering to generate a corresponding one-channel feature map;

[0036] S2133: Perform sigmoid activation processing on a channel feature map to generate a corresponding spatial attention mechanism map;

[0037] S2134: Multiply the spatial attention mechanism map with the original feature map to generate the corresponding spatial attention feature map.

[0038] Preferably, the fusion mapping module first reorganizes the attention feature map to obtain the original feature vector of the corresponding dimension; then adds the corresponding angle of attack and Mach number as new vectors to the original feature vector to generate the corresponding fused feature vector; finally, the dimension of the fused feature vector is mapped to be consistent with the original feature vector through the fully connected layer and the fused feature vector is reorganized to generate the corresponding high-level feature map.

[0039] Preferably, the decoder decodes the high-level feature map through three convolution filters in sequence to generate a flow field prediction image containing predicted values ​​of the x-direction velocity field, y-direction velocity field and pressure field around the object to be predicted.

[0040] Preferably, the training loss is calculated by the following formula:

[0041] Cost = λ MSE ×MSE+λ GS ×GS+λ L2 ×L2 regularization ;

[0042] Where: Cost represents training loss; MSE represents mean square error; GS represents gradient sharpening; L2 regularization represents L2 regularization; λ MSE , GS , L2 Indicates the weight coefficient of the setting;

[0043]

[0044]

[0045]

[0046] Where: U and V represent the x-component and y-component of the velocity field respectively; m represents the batch size; n x represents the number of grid points along the x direction; n y represents the number of grid points along the y direction; P represents the scalar pressure field; represents the true value of the velocity field in the x direction at the grid point in the i-th row and j-th column in the l-th training data; L represents the number of layers with trainable weights; n l represents the number of trainable weights in layer L; θ represents the model parameters to be trained; Represents the predicted value of the x-direction velocity field at the i-th row and j-th column of the l-th training data; Represents the true value of the velocity field in the y direction of the grid point in the i-th row and j-th column in the l-th training data; Represents the predicted value of the velocity field in the y direction of the grid point in the i-th row and j-th column in the l-th training data; represents the true value of the pressure field at the grid point in the i-th row and j-th column in the l-th training data; represents the predicted value of the pressure field at the grid point in the i-th row and j-th column in the l-th training data; Represents the gradient of the true value of the pressure in the x direction at the grid point in the i-th row and j-th column; represents the gradient of the predicted value of pressure in the x direction at the grid point in the i-th row and the j-th column; Represents the gradient of the true value of the pressure in the y direction at the grid point in the i-th row and the j-th column; Represents the gradient of the predicted value of pressure in the y direction at the grid point in the i-th row and the j-th column; Represents the gradient of the true value of the velocity in the x direction at the grid point in the i-th row and j-th column; Represents the gradient of the predicted value of the velocity in the x direction at the grid point in the i-th row and j-th column; Represents the gradient of the true value of the velocity in the y direction at the grid point in the i-th row and j-th column; Represents the gradient of the predicted value of the velocity in the y direction at the grid point in the i-th row and j-th column; Represents the gradient of the true value of the velocity in the x direction at the grid point in the i-th row and j-th column; It represents the gradient of the predicted value of the velocity in the x direction at the grid point in the i-th row and j-th column; Represents the gradient of the true value of the velocity in the y direction at the grid point in the i-th row and j-th column; Represents the gradient of the predicted value of the velocity in the y direction at the grid point in the i-th row and j-th column.

[0047] Preferably, the flow field prediction model learns different weights in the training phase to predict the flow field: in each iteration, a batch of training data undergoes a feedforward process. When the output result does not match the expected value, a backpropagation process is performed to find the error between the result and the expected value, and then the error is returned layer by layer and the error of each layer is calculated. The training loss is calculated based on the error to update the network weights until the flow field prediction model converges.

[0048] Compared with the prior art, the flow field prediction method based on attention and convolutional neural network codec in the present invention has the following beneficial effects:

[0049] The present invention can automatically detect the basic characteristics of the predicted object under little human supervision through a neural network based on a codec. Compared with the existing Reynolds average NS method, the velocity field and pressure field around the object can be estimated more quickly, that is, the prediction speed of the model can be improved, thereby effectively improving the prediction efficiency of the model and providing effective technical support for the airfoil optimization design of the wing.

[0050] The codec structure based on the convolutional neural network of the present invention has better performance in image segmentation and reconstruction. The flow field prediction is based on the features extracted from the original object to reconstruct the real image of the flow field. Therefore, the codec structure based on the convolutional neural network can extract features from global information very well, thereby improving the global accuracy of the flow field prediction model. At the same time, through the advantages of convolutional neural networks in shape representation and scalability, high-level features can be learned from flow field data with strong spatial and channel correlations, and the main influencing factors of the flow field around the prediction object can be effectively analyzed, thereby improving the accuracy of flow field prediction.

[0051] The encoder-decoder structure based on the attention mechanism of the present invention can better focus on the part where the flow field changes dramatically, and the attention mechanism can extract more important features in the flow field prediction from the global information, which can effectively improve the prediction accuracy of the part where the flow field changes dramatically. At the same time, the encoder structure can obtain global information to realize the global reference of the model, so that more accurate model prediction accuracy and faster model convergence speed can be obtained, thereby further improving the prediction accuracy and prediction efficiency of the flow field prediction model.

[0052] The angle of attack and Mach number are important factors that affect the real image of the flow field to be predicted, but the features of the angle of attack and Mach number cannot be extracted by an encoder based on the attention mechanism and convolutional neural network. Therefore, the present invention fuses the attention feature map with the angle of attack and Mach number to generate a high-level feature map, so that more accurate flow field features can be extracted, thereby further improving the accuracy of flow field prediction.

[0053] The training data set generation method of the present invention effectively expands the training data set and can ensure the validity of the training data, thereby improving the training effect and prediction accuracy of the flow field prediction model.

[0054] Since the codec structure has great limitations in the prediction accuracy of local information, the present invention implements the global reference of the model from the two levels of spatial and channel importance through the spatial attention mechanism and the channel attention mechanism, thereby better increasing the accuracy of flow field prediction and accelerating the convergence speed of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to make the purpose, technical solution and advantages of the invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings, in which:

[0056] Figure 1 The logical block diagram of the flow field prediction method based on attention and convolutional neural network encoder-decoder;

[0057] Figure 2 This is the network structure diagram of the flow field prediction model;

[0058] Figure 3 To predict the corresponding wing mesh;

[0059] Figure 4 The signed distance function graph corresponding to the wing grid

[0060] Figure 5 Network structure diagram of the channel attention module and the spatial attention module. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but only represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work belong to the scope of protection of the present invention.

[0062] It should be noted that similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. In the description of the present invention, it should be noted that the orientation or position relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, or the orientation or position relationship in which the invention product is usually placed when used, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance. In addition, the terms "horizontal", "vertical", etc. do not mean that the components are absolutely horizontal or suspended, but can be slightly tilted. For example, "horizontal" only means that its direction is more horizontal than "vertical", and does not mean that the structure must be completely horizontal, but can be slightly tilted. In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0063] The following is a further detailed description through specific implementation methods:

[0064] Example:

[0065] Before explaining the embodiment of the present invention in detail, four concepts involved in the embodiment are explained first.

[0066] 1) Convolutional neural network is a type of feedforward neural network with deep structure that includes convolution calculation.

[0067] 2) Codec structure refers to the existence of a main encoder and decoder in the entire network. The encoder is mainly used to extract feature maps from the input, while the decoder uses trainable convolution kernels for convolution to generate dense feature maps, thereby better optimizing the features obtained from the input processed by the encoder and processing tasks.

[0068] 3) The attention mechanism is a special structure embedded in the machine learning model to automatically learn and calculate the contribution of input data to output data.

[0069] 4) Structured grid refers to the grid area divided by computational fluid dynamics, in which all internal points have the same adjacent units. It has the advantages of fast grid generation speed, good grid quality and simple data structure.

[0070] This embodiment discloses a flow field prediction method based on attention and convolutional neural network codec.

[0071] like Figure 1 As shown, the flow field prediction method based on attention and convolutional neural network encoder-decoder includes:

[0072] S1: Obtain the signed distance function graph of the object to be predicted;

[0073] S2: Input the signed distance function graph into the trained flow field prediction model and output the corresponding flow field prediction image;

[0074] Combination Figure 2 As shown, when training the flow field prediction model: first, a training data set including a signed distance function graph and a corresponding real flow field image is input into the flow field prediction model; then, the image features of the signed distance function graph are extracted through an encoder based on an attention mechanism and a convolutional neural network to generate a corresponding attention feature graph; then, the attention feature graph is fused with the attack angle and Mach number of the corresponding signed distance function graph through a fusion mapping module, and mapped to generate a corresponding high-level feature graph; then, the high-level feature graph is decoded through a decoder to generate a corresponding flow field prediction image; finally, the training loss is calculated based on the flow field prediction image and the corresponding real flow field image, and the parameters of the flow field prediction model are optimized through the training loss;

[0075] S3: Taking the predicted values ​​of the velocity field and the pressure field in the flow field prediction image as the flow field prediction result of the object to be predicted.

[0076] The present invention extracts image features of real flow field images and generates high-level feature maps through an encoder based on an attention mechanism and a convolutional neural network, and then decodes the high-level feature maps output by the encoder through a decoder, so that computational fluid dynamics can be organically combined with the codec structure, the convolutional neural network and the attention mechanism to obtain a flow field prediction model that realizes the prediction of aerodynamic forces and flow fields around the wing under different wing shapes and operating states.

[0077] The present invention can automatically detect the basic characteristics of the predicted object under little human supervision through a neural network based on a codec. Compared with the existing Reynolds average NS method, the velocity field and pressure field around the object can be estimated more quickly, that is, the prediction speed of the model can be improved, thereby effectively improving the prediction efficiency of the model and providing effective technical support for the airfoil optimization design of the wing.

[0078] The codec structure based on the convolutional neural network of the present invention has better performance in image segmentation and reconstruction. The flow field prediction is based on the features extracted from the original object to reconstruct the real image of the flow field. Therefore, the codec structure based on the convolutional neural network can extract features from global information very well, thereby improving the global accuracy of the flow field prediction model. At the same time, through the advantages of convolutional neural networks in shape representation and scalability, high-level features can be learned from flow field data with strong spatial and channel correlations, and the main influencing factors of the flow field around the prediction object can be effectively analyzed, thereby improving the accuracy of flow field prediction.

[0079] The encoder-decoder structure based on the attention mechanism of the present invention can better focus on the part where the flow field changes dramatically, and the attention mechanism can extract more important features in the flow field prediction from the global information, which can effectively improve the prediction accuracy of the part where the flow field changes dramatically. At the same time, the encoder structure can obtain global information to realize the global reference of the model, so that more accurate model prediction accuracy and faster model convergence speed can be obtained, thereby further improving the prediction accuracy and prediction efficiency of the flow field prediction model.

[0080] The angle of attack and Mach number are important factors that affect the real image of the flow field to be predicted, but the features of the angle of attack and Mach number cannot be extracted by an encoder based on the attention mechanism and convolutional neural network. Therefore, the present invention fuses the attention feature map with the angle of attack and Mach number to generate a high-level feature map, so that more accurate flow field features can be extracted, thereby further improving the accuracy of flow field prediction.

[0081] During the specific implementation process, the training data set is constructed through the following steps:

[0082] S201: parameterizing the target airfoil and adding disturbance to generate a new airfoil, taking various airfoils as prediction objects;

[0083] In this embodiment, the existing S805, S809, and S814 airfoils are selected as target airfoils.

[0084] S202: For a single prediction object, generate a corresponding signed distance function graph by using a Cartesian grid method;

[0085] Generate a signed distance function graph by following these steps:

[0086] S2021: Grid the corresponding prediction object using the Cartesian grid method to generate Figure 3 The wing mesh shown;

[0087] S2022: Calculate the signed distance between a given Cartesian grid point and a boundary point of the predicted object in the wing grid;

[0088] S2023: In order to determine whether a given Cartesian grid point is inside or outside the predicted object or only on the surface of the predicted object, searching for boundary points of the predicted object, calculating a scalar product between a normal vector at the boundary point closest to the given Cartesian grid point and a vector from the given Cartesian grid point to the nearest boundary point, and determining a function sign by the scalar product value;

[0089] S2024: Generates the calculated signed distance and function sign Figure 4 The signed distance function graph is shown.

[0090] The size of the signed distance function graph is 150*150.

[0091] S203: Calculate the velocity field and pressure field of a single prediction object at different attack angles and different Mach numbers as flow field data by using the Reynolds averaged NS equation numerical simulation method;

[0092] The Reynolds-averaged NS equation numerical simulation method is an existing mature technology.

[0093] Among them, the Reynolds-averaged NS equation is the control equation of the average variable of the flow field, and the related simulation theory is called the turbulence mode theory. The turbulence mode theory assumes that the flow field variables in turbulence are composed of a time-averaged quantity and a pulsating quantity. The Reynolds-averaged NS equation can be obtained by treating the NS equation from this point of view. After introducing the Boussinesq hypothesis, that is, after assuming that the turbulent Reynolds stress is proportional to the strain, the turbulence calculation is reduced to the calculation of the proportionality coefficient between the Reynolds stress and the strain (i.e., the turbulent viscosity coefficient). It is precisely because the control equation is statistically averaged that it does not need to calculate the turbulent pulsations of each scale, but only needs to calculate the average motion, thereby reducing the spatial and temporal resolution and reducing the computational workload. In the solver settings, the third-order conservation law monotone upwind scheme (MUSCL) with Koren limiter and Roe flux difference splitting is used to calculate the inviscid term. The viscosity term uses the second-order accurate central difference. The closure of the Reynolds-averaged NS equation is the Spalart-Allmaras turbulence model. The wing surface has no-slip boundary conditions.

[0094] Specifically, the flow field data of the calculated prediction object can be completed by existing mature software, including:

[0095] First, the corresponding prediction object is gridded to generate the corresponding wing grid;

[0096] It includes defining grid boundaries and nodes, defining the air inlet, air outlet, upper wall, lower wall, front and rear walls of the prediction object, and defining grid nodes and grid units.

[0097] Then the angle of attack and Reynolds number are randomly generated and used as the initial angle of attack and Mach number of the prediction object.

[0098] The wing mesh and its initial angle of attack and Mach number are then input into an existing fluid dynamics flow solver, and the number of iterations is defined; the discretization format is then set, including the interpolation format, etc.; and the parameters of the algorithms involved in solving the algebraic equations and velocity-pressure coupling are set.

[0099] Finally, the velocity field and pressure field of the predicted object are generated as flow field data through the existing fluid mechanics flow solver.

[0100] S204: interpolating the flow field data of a single prediction object onto a Cartesian grid of a corresponding size (the size here is consistent with the size of the signed distance function graph) by using a scattered data interpolation method of a triangular part, and generating a corresponding real image of the flow field;

[0101] The scattered data interpolation method through the triangular part is an existing mature technology, which specifically includes:

[0102] First, it is necessary to define a scattered point set, which is evenly distributed on the flow field calculation results to be interpolated.

[0103] The scattered point set is used as a vertex to form multiple triangles. For each point (x i ,y i ), compute the corresponding quadratic polynomial interpolant:

[0104]

[0105] By putting the point (x i ,y i ) itself and its 5 nearest neighboring points in the scattered point set are substituted into the equation to obtain 6 equations about parameter a. Among them, x and y represent the coordinates, and z represents the value of the point.

[0106] Through the six equations, we can calculate [a1, a2, a3, a4, a5, a6], and thus get the interpolation polynomial of the scattering point.

[0107] Next, calculate the interpolation value z of the interpolation point (x, y). First, find in which triangle the point is located after triangulation; then determine the value as the three interpolation polynomials corresponding to the three triangle vertices of the point (x, y):

[0108]

[0109] To ensure a continuous transition from one triangle to the next, we just need to make sure that each weight w i is also zero on the triangle edge opposite the i-th vertex. This can be done by making w i The distance d from the point (x,y) iIt is achieved in proportion to the kth power.

[0110] For some k, typically 3, then the weight w i is scaled to d at vertex i i =1.

[0111] therefore,

[0112] Confirmed w i After that, the value of the interpolation point (x, y) can be determined according to the three interpolation polynomials.

[0113] The flow field data is interpolated by the above interpolation method to generate the corresponding real image of the flow field.

[0114] S205: Repeat steps S202 to S204, and use the signed distance function graph corresponding to the predicted object and the real flow field image as a set of training data to generate a training data set including the signed distance function graph and the corresponding real flow field image.

[0115] The present invention effectively expands the training data set through the above-mentioned training data set generation method, and can ensure the validity of the training data, thereby improving the training effect and prediction accuracy of the flow field prediction model.

[0116] In the specific implementation process, the encoder generates the attention feature map through the following steps:

[0117] S211: Inputting the signed distance function graph into the convolution layer for convolution filtering to generate a corresponding original feature graph;

[0118] In this embodiment, the fluid image input to the attention-based encoder is a 150*150 signed distance function graph. The convolution layer consists of 300 5*5 convolution filters, each of which is wrapped by a nonlinear Swish activation function. The feature vector of the original feature map obtained after passing through the convolution filter becomes 30*30*300.

[0119] S212: Input the original feature map into the channel attention module to extract the channel importance feature and generate the corresponding channel attention feature map;

[0120] Combination Figure 5 As shown in Figure 2, the channel attention module generates a channel attention feature map through the following steps:

[0121] S2121: Input the original feature map into the parallel maximum pooling layer and average pooling layer to generate the corresponding first feature map and second feature map;

[0122] In this embodiment, the original feature map is changed from 30*30*300 to 1*1*300 through the maximum pooling layer and the average pooling layer.

[0123] S2122: compressing the number of channels of the first feature map and the second feature map to 1 / r times of the original number of channels respectively through a shared multi-layer perceptron, and then expanding them back to the original number of channels, to generate a corresponding first perceptual feature map and a second perceptual feature map;

[0124] S2123: Activate the first perceptual feature map and the second perceptual feature map through the ReLU activation function, and perform element-by-element addition and sigmoid activation function processing on the activated results to generate a corresponding channel attention mechanism map;

[0125] S2124: Multiply the channel attention mechanism map with the original feature map to generate the corresponding channel attention feature map.

[0126] S213: Input the channel attention feature map into the spatial attention module to extract spatial features and generate a corresponding spatial attention feature map;

[0127] Combination Figure 5 As shown in Figure 2, the spatial attention module generates a spatial attention feature map through the following steps:

[0128] S2131: Input the channel attention feature map into the maximum pooling layer to generate the corresponding third feature map;

[0129] In this embodiment, the channel attention feature map is input into the maximum pooling layer to obtain a 30*30*1 feature map.

[0130] S2132: Input the third feature map into the 7*7 convolution layer for convolution filtering to generate a corresponding one-channel feature map;

[0131] S2133: Perform sigmoid activation processing on a channel feature map to generate a corresponding spatial attention mechanism map;

[0132] S2134: Multiply the spatial attention mechanism map with the original feature map to generate the corresponding spatial attention feature map.

[0133] In this embodiment, the size of the spatial attention feature map is 30*30*300.

[0134] S214: Input the spatial attention feature map into the convolution layer for convolution filtering to generate a corresponding attention feature map.

[0135] In this embodiment, the spatial attention feature map is sequentially input into a convolutional layer consisting of 300 5*5 convolutional filters and a convolutional layer consisting of 300 3*3 convolutional filters. Each convolution is wrapped by a nonlinear Swish activation function to generate a 2*2*300 attention feature map.

[0136] The encoder of the present invention is based on the attention mechanism and convolutional neural network, which can learn high-level features from flow field data with strong spatial and channel correlation, and then effectively analyze and predict the main influencing factors of the flow field around the object, and can better pay attention to the part where the flow field changes dramatically, realize the global reference of the model, and then obtain more accurate model prediction accuracy and faster model convergence speed.

[0137] Since the codec structure has great limitations in the prediction accuracy of local information, the present invention implements the global reference of the model from the two levels of spatial and channel importance through the spatial attention mechanism and the channel attention mechanism, thereby better increasing the accuracy of flow field prediction and accelerating the convergence speed of the model.

[0138] During the specific implementation process, the fusion mapping module first reorganizes the 2*2*300 attention feature map to obtain a 1*1200 feature vector; then adds the corresponding angle of attack and Mach number to the original feature vector as new vectors to generate a 1202*1 fused feature vector; finally, through the fully connected layer, the dimension of the fused feature vector is mapped to the same as the original feature vector, that is, 1200*1, and the fused feature vector is reorganized to generate the corresponding high-level feature map.

[0139] During the specific implementation process, the decoder decodes the high-level feature map through a 3*3 convolution filter, a 5*5 convolution filter, and a 5*5 convolution filter in turn to generate a flow field prediction image containing the predicted values ​​of the x-direction velocity field, the y-direction velocity field, and the pressure field around the object to be predicted.

[0140] In the specific implementation process, the training loss function consists of mean square error, gradient sharpening and L2 regularization.

[0141] The training loss is calculated using the following formula:

[0142] Cost = λ MSE ×MSE+λ GS ×GS+λ L2 ×L2 regularization ;

[0143] Where: Cost represents training loss; MSE represents mean square error; GS represents gradient sharpening; L2 regularization represents L2 regularization; λ MSE , GS , L2 Indicates the weight coefficient of the setting;

[0144]

[0145]

[0146]

[0147] Where: U and V represent the x-component and y-component of the velocity field respectively; m represents the batch size; n x represents the number of grid points along the x direction; n y represents the number of grid points along the y direction; P represents the scalar pressure field; represents the true value of the velocity field in the x direction at the grid point in the i-th row and j-th column in the l-th training data; L represents the number of layers with trainable weights; n l represents the number of trainable weights in layer L; θ represents the model parameters to be trained; Represents the predicted value of the x-direction velocity field at the i-th row and j-th column of the l-th training data; Represents the true value of the velocity field in the y direction of the grid point in the i-th row and j-th column in the l-th training data; Represents the predicted value of the velocity field in the y direction of the grid point in the i-th row and j-th column in the l-th training data; represents the true value of the pressure field at the grid point in the i-th row and j-th column in the l-th training data; represents the predicted value of the pressure field at the grid point in the i-th row and j-th column in the l-th training data; Represents the gradient of the true value of the pressure in the x direction at the grid point in the i-th row and j-th column; represents the gradient of the predicted value of pressure in the x direction at the grid point in the i-th row and the j-th column; Represents the gradient of the true value of the pressure in the y direction at the grid point in the i-th row and the j-th column; Represents the gradient of the predicted value of pressure in the y direction at the grid point in the i-th row and the j-th column; Represents the gradient of the true value of the velocity in the x direction at the grid point in the i-th row and j-th column; Represents the gradient of the predicted value of the velocity in the x direction at the grid point in the i-th row and j-th column; Represents the gradient of the true value of the velocity in the y direction at the grid point in the i-th row and j-th column; Represents the gradient of the predicted value of the velocity in the y direction at the grid point in the i-th row and j-th column; Represents the gradient of the true value of the velocity in the x direction at the grid point in the i-th row and j-th column; It represents the gradient of the predicted value of the velocity in the x direction at the grid point in the i-th row and j-th column; Represents the gradient of the true value of the velocity in the y direction at the grid point in the i-th row and j-th column; Represents the gradient of the predicted value of the velocity in the y direction at the grid point in the i-th row and j-th column.

[0148] In this embodiment, the grids and grid points refer to the grids and grid points in the gridded flow field prediction image and the flow field real image after the flow field prediction image and the flow field real image are gridded by the Cartesian grid method or other existing methods.

[0149] The flow field prediction model learns different weights to predict the flow field during the training phase: in each iteration, a batch of training data undergoes a feedforward process. When the output result (flow field prediction image) does not match the expected value (real flow field image), back propagation is performed to find the error between the result and the expected value (training loss). The error is then returned layer by layer and the error of each layer is calculated. The training loss is calculated based on the error to update the network weights until the flow field prediction model converges.

[0150] The present invention adds the mean square error to make the flow field image more accurate at the end of training, because the gradient of the mean square error loss will be larger when the loss value is higher, and decreases as the loss approaches 0; the gradient sharpening is added to punish the difference in gradients in the loss function and solve the problem of lack of sharpness in flow field prediction; the L2 norm is added to prevent the problem that the error is very small during model training, but the error is very large during testing, and the flow field prediction model is complex enough to fit all training samples, but the model performance is poor when actually predicting new samples. Therefore, the present invention forms a training loss function through mean square error, gradient sharpening and L2 regularization, so as to improve the training effect and performance of the flow field prediction model.

[0151] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit the technical solution. Those skilled in the art should understand that those modifications or equivalent substitutions of the technical solution of the present invention that do not depart from the purpose and scope of the technical solution should be included in the scope of the claims of the present invention.

Claims

1. A flow field prediction method based on attention and convolutional neural network encoder-decoder, characterized in that: include: S1: Obtain the signed distance function graph of the object to be predicted; S2: Input the signed distance function graph into the trained flow field prediction model and output the corresponding flow field prediction image; When training the flow field prediction model: first, the training data set containing the signed distance function graph and the corresponding real flow field image is input into the flow field prediction model; then, the image features of the signed distance function graph are extracted through the encoder based on the attention mechanism and convolutional neural network to generate the corresponding attention feature graph; then, the attention feature graph is fused with the attack angle and Mach number of the corresponding signed distance function graph through the fusion mapping module, and the corresponding high-level feature graph is mapped and generated; then, the high-level feature graph is decoded through the decoder to generate the corresponding flow field prediction image; finally, the training loss is calculated based on the flow field prediction image and the corresponding real flow field image, and the parameters of the flow field prediction model are optimized through the training loss; The training dataset is constructed by the following steps: S201: parameterizing the target airfoil and adding disturbance to generate a new airfoil, taking various airfoils as prediction objects; S202: For a single prediction object, generate a corresponding signed distance function graph by using a Cartesian grid method; S203: Calculate the velocity field and pressure field of a single prediction object at different attack angles and different Mach numbers as flow field data by using the Reynolds averaged NS equation numerical simulation method; S204: interpolating the flow field data of a single prediction object onto a Cartesian grid of a corresponding size by using a scattered data interpolation method of a triangular part, and generating a corresponding real image of the flow field; S205: repeating steps S202 to S204, and taking the signed distance function graph corresponding to the predicted object and the real flow field image as a set of training data, so as to generate a training data set including the signed distance function graph and the corresponding real flow field image; The encoder generates the attention feature map through the following steps: S211: Inputting the signed distance function graph into the convolution layer for convolution filtering to generate a corresponding original feature graph; S212: Input the original feature map into the channel attention module to extract the channel importance feature and generate the corresponding channel attention feature map; S213: Input the channel attention feature map into the spatial attention module to extract spatial features and generate a corresponding spatial attention feature map; S214: Inputting the spatial attention feature map into the convolution layer for convolution filtering to generate a corresponding attention feature map; In step S212, the channel attention module generates a channel attention feature map through the following steps: S2121: Input the original feature map into the parallel maximum pooling layer and average pooling layer to generate the corresponding first feature map and second feature map; S2122: compressing the number of channels of the first feature map and the second feature map to 1 / r times of the original number of channels respectively through a shared multi-layer perceptron, and then expanding them back to the original number of channels, to generate a corresponding first perceptual feature map and a second perceptual feature map; S2123: Activate the first perceptual feature map and the second perceptual feature map through the ReLU activation function, and perform element-by-element addition and sigmoid activation function processing on the activated results to generate a corresponding channel attention mechanism map; S2124: Multiply the channel attention mechanism map by the original feature map to generate a corresponding channel attention feature map; In step S213, the spatial attention module generates a spatial attention feature map through the following steps: S2131: Input the channel attention feature map into the maximum pooling layer to generate the corresponding third feature map; S2132: Input the third feature map into the convolution layer for convolution filtering to generate a corresponding one-channel feature map; S2133: Perform sigmoid activation processing on a channel feature map to generate a corresponding spatial attention mechanism map; S2134: Multiply the spatial attention mechanism map with the original feature map to generate a corresponding spatial attention feature map; S3: Taking the predicted values ​​of the velocity field and the pressure field in the flow field prediction image as the flow field prediction result of the object to be predicted.

2. The flow field prediction method based on attention and convolutional neural network codec according to claim 1, characterized in that: In step S202, a signed distance function graph is generated by the following steps: S2021: gridding the corresponding prediction object by a Cartesian grid method to generate a corresponding wing grid; S2022: Calculate the signed distance between a given Cartesian grid point and a boundary point of the predicted object in the wing grid; S2023: Searching for boundary points of the predicted object, calculating the scalar product between the normal vector at the boundary point closest to the given Cartesian grid point and the vector from the given Cartesian grid point to the nearest boundary point, and determining the function sign by the scalar product value; S2024: Generate a signed distance function graph corresponding to the predicted object according to the calculated signed distance and function sign.

3. The flow field prediction method based on attention and convolutional neural network codec as claimed in claim 1, characterized in that: The fusion mapping module first reorganizes the attention feature map to obtain the original feature vector of the corresponding dimension; then adds the corresponding angle of attack and Mach number to the original feature vector as a new vector to generate the corresponding fused feature vector; finally, through the fully connected layer, the dimension of the fused feature vector is mapped to be consistent with the original feature vector and the fused feature vector is reorganized to generate the corresponding high-level feature map.

4. The flow field prediction method based on attention and convolutional neural network codec according to claim 1, characterized in that: The decoder decodes the high-level feature map through three convolution filters in turn to generate a flow field prediction image containing the predicted values ​​of the x-direction velocity field, y-direction velocity field and pressure field around the object to be predicted.

5. The flow field prediction method based on attention and convolutional neural network codec according to claim 1, characterized in that: The training loss is calculated using the following formula: Cost=λ MSE ×MSE+λ GS ×GS+λ L2 ×L2 regularization ; Where: Cost represents training loss; MSE represents mean square error; GS represents gradient sharpening; L2 regularization represents L2 regularization; λ MSE , GS , L2 Indicates the weight coefficient of the setting; Where: U and V represent the x-component and y-component of the velocity field respectively; m represents the batch size; n x represents the number of grid points along the x direction; n y represents the number of grid points along the y direction; P represents the scalar pressure field; represents the true value of the velocity field in the x direction at the grid point in the i-th row and j-th column in the l-th training data; L represents the number of layers with trainable weights; n l represents the number of trainable weights in layer L; θ represents the model parameters to be trained; Represents the predicted value of the x-direction velocity field at the i-th row and j-th column of the l-th training data; Represents the true value of the velocity field in the y direction of the grid point in the i-th row and j-th column in the l-th training data; Represents the predicted value of the velocity field in the y direction of the grid point in the i-th row and j-th column in the l-th training data; represents the true value of the pressure field at the grid point in the i-th row and j-th column in the l-th training data; represents the predicted value of the pressure field at the grid point in the i-th row and j-th column in the l-th training data; Represents the gradient of the true value of the pressure in the x direction at the grid point in the i-th row and j-th column; represents the gradient of the predicted value of pressure in the x direction at the grid point in the i-th row and the j-th column; Represents the gradient of the true value of the pressure in the y direction at the grid point in the i-th row and the j-th column; Represents the gradient of the predicted value of pressure in the y direction at the grid point in the i-th row and the j-th column; Represents the gradient of the true value of the velocity in the x direction at the grid point in the i-th row and j-th column; Represents the gradient of the predicted value of the velocity in the x direction at the grid point in the i-th row and j-th column; Represents the gradient of the true value of the velocity in the y direction at the grid point in the i-th row and j-th column; Represents the gradient of the predicted value of the velocity in the y direction at the grid point in the i-th row and j-th column; Represents the gradient of the true value of the velocity in the x direction at the grid point in the i-th row and j-th column; It represents the gradient of the predicted value of the velocity in the x direction at the grid point in the i-th row and j-th column; Represents the gradient of the true value of the velocity in the y direction at the grid point in the i-th row and j-th column; Represents the gradient of the predicted value of the velocity in the y direction at the grid point in the i-th row and j-th column.

6. The flow field prediction method based on attention and convolutional neural network codec as claimed in claim 5, characterized in that: The flow field prediction model learns different weights to predict the flow field during the training phase: in each iteration, a batch of training data undergoes a feedforward process. When the output result does not match the expected value, a backpropagation process is performed to find the error between the result and the expected value. The error is then returned layer by layer and the error of each layer is calculated. The training loss is calculated based on the error to update the network weights until the flow field prediction model converges.