Airfoil flow field prediction method based on improved generative adversarial network and model compression
By improving the methods of generative adversarial network and model compression, the complex characteristics of the airfoil flow field are extracted and the model parameters are reduced, which solves the accuracy and efficiency problems of airfoil flow field prediction in the existing technology and achieves more efficient airfoil flow. field forecast.
Patent Information
- Application Number
- CN202310455762.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-25
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2043-04-25
AI Technical Summary
Existing deep learning neural networks cannot effectively extract the complex features of the airfoil flow field, resulting in low accuracy of airfoil flow field prediction. There are also problems such as too many redundant parameters, too long solution time, and low efficiency.
Using methods of improved generative adversarial networks and model compression, the complex features of the airfoil flow field are extracted through deep convolutional generative adversarial networks, and high-dimensional data are converted into low-dimensional representations. The amount of parameters and calculations are reduced through model compression, and the airfoil flow field is improved. The accuracy and efficiency of flow field prediction.
It effectively extracts the complex features of the airfoil flow field, improves the accuracy and efficiency of airfoil flow field prediction, simplifies the structure of the flow field prediction model, reduces hardware computing power and solution time, and improves prediction accuracy and running speed.
Smart Images

Figure CN116227364B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of flow field prediction, and in particular to an airfoil flow field prediction method based on an improved generative adversarial network and model compression. 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. It can quickly and accurately predict airfoil flow fields. For example, the Chinese patent with publication number CN112784508A discloses "A method for rapid prediction of airfoil flow fields 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 fields. This model applies deep learning to airfoil flow field prediction, which can reduce time costs and resource consumption. It is a feasible new idea with broad application prospects.
[0004] However, the existing deep learning neural network cannot effectively extract the complex features of the airfoil flow field, resulting in low accuracy in airfoil flow field prediction. At the same time, the existing deep learning neural network model also has the problems of too many redundant parameters and too long solution time, resulting in low efficiency in airfoil flow field prediction. Therefore, how to design a method that can improve the accuracy and efficiency of airfoil 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 an airfoil flow field prediction method based on an improved generative adversarial network and model compression, extract the complex features of the airfoil flow field through a deep convolutional generative adversarial network, and be able to convert high-dimensional data into potential low-dimensional representations to better realize the airfoil flow field prediction, while being able to reduce the number of model parameters and the amount of calculation through model compression, thereby improving the accuracy and efficiency of the airfoil flow field prediction, and providing a basis 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] The airfoil flow field prediction method based on improved generative adversarial network and model compression includes:
[0008] S1: Obtain the boundary conditions of the object to be predicted;
[0009] S2: Input the boundary conditions into the trained flow field prediction model and output the corresponding predicted flow field image;
[0010] The flow field prediction model is built based on a deep convolutional generative adversarial network;
[0011] When training the flow field prediction model: input the training data set containing boundary conditions and corresponding real flow field images into the flow field prediction model; in each round of iteration, first use the boundary conditions as the input of the generator, output the predicted flow field image under the corresponding boundary conditions, then use the predicted flow field image and the corresponding real flow field image as the input of the discriminator, the discriminator judges the predicted flow field image based on the real flow field image, and updates its own parameters in combination with the loss function, and finally feeds the parameter update results of the discriminator back to the generator for the generator to update its own parameters; repeat the iteration and continuously update the parameters of the generator and the discriminator; finally, compress the trained flow field prediction model, and use the compressed flow field prediction model for airfoil flow field prediction;
[0012] S3: Using the predicted flow field parameters in the corresponding predicted flow field image as the flow field prediction result of the object to be predicted.
[0013] Preferably, the generator includes a convolutional neural network layer, a convolutional long short-term memory network layer and a deconvolution layer: first, the flow field image features of the boundary conditions are extracted through the convolutional neural network layer, and then the corresponding flow field spatial features and flow field time features are extracted based on the flow field image features through the convolutional long short-term memory network layer, and finally, the flow field spatial features and flow field time features are mapped in high dimensions through the deconvolution layer to generate a predicted flow field image corresponding to the boundary conditions.
[0014] Preferably, the training data set is constructed by the following steps:
[0015] S201: parameterizing the target airfoil and adding disturbance to generate a new airfoil, taking various airfoils as object samples;
[0016] S202: Calculate the flow field data of a single object sample under different attack angles, different Mach numbers and different atmospheric environments by using a Reynolds-averaged NS equation numerical simulation method, and use the object sample containing the flow field data as a real flow field image;
[0017] S203: Recording boundary conditions of the real flow field image;
[0018] S204: taking the real flow field image and the corresponding boundary conditions as a set of training data;
[0019] S205: Repeat steps S201 to S204 to construct a training data set including m groups of training data.
[0020] Preferably, the real flow field data φ and boundary condition μ of the real flow field image are normalized by the following formula:
[0021]
[0022]
[0023] Where: Represents boundary conditions and flow field data Normalized value; represents the time step t j Boundary conditions and real flow field data at μ min , μ max represents the minimum and maximum values of the boundary conditions; φ min ,φ max Indicates the minimum and maximum values of the real flow field data.
[0024] Preferably, the flow field prediction model is trained by the following steps:
[0025] S211: construct the loss function of the flow field prediction model;
[0026] S212: inputting m groups of boundary conditions and real flow field images into the flow field prediction model;
[0027] S213: In each round of iteration, the generator parameters are first fixed, the generator generates a predicted flow field image based on the boundary conditions, the discriminator judges the real flow field image and the predicted flow field image, and updates the parameters of the discriminator in combination with the loss function until the discriminator can distinguish the real flow field image from the predicted flow field image;
[0028] S214: fix the discriminator parameters again, feed back the parameter update result of the discriminator to the generator, and update the parameters of the generator in combination with the loss function until the predicted flow field image generated by the generator can pass the judgment of the discriminator;
[0029] S215: Repeat steps S213 to S214 for continuous iteration until the flow field prediction model converges to obtain a trained generator and discriminator.
[0030] Preferably, the loss function of the flow field prediction model is represented by the following steps:
[0031]
[0032] Where: E represents expectation; μ represents boundary condition; G represents generator; G(μ) represents the predicted flow field image corresponding to the boundary condition output by the generator; D represents discriminator; μ represents boundary condition; φ d represents the real flow field image; p μ (μ) represents the prior distribution of the random data set μ; p data (φ d ) represents the real flow field image φ d The corresponding probability data distribution.
[0033] Preferably, by maximizing the discriminator function Update the parameters of the discriminator, θ (D) Represents the parameters in the discriminator loss function;
[0034]
[0035] Preferably, by minimizing the generator function Update the parameters of the generator, θ (G) Represents the parameters in the generator loss function;
[0036]
[0037] Preferably, during back propagation, let θ (D) =(w (D) ,b (D) ), θ (G) =(w (G) ,b (G) ) represent the weights and biases of the discriminator and generator respectively;
[0038] Parameter θ (G) and θ (D) During back-propagation it is updated by the following proxy loss;
[0039] The formula is described as:
[0040]
[0041]
[0042] Where: η represents the learning rate; P represents the iteration step. When P→∞, θ (D) To reach the local optimum,
[0043] Preferably, the flow field prediction model is compressed by the following steps:
[0044] S221: normalizing the original weight of the flow field prediction model to the interval [-1, 1], and then setting a threshold to quantize the original weight of the interval [-1, 1] to three intermediate values {-1, 0, 1};
[0045] S222: Randomly initialize W n , W p Value: W n Indicates that the flow field prediction model before compression is less than -Δ l The original weight, W p Indicates that the flow field prediction model before compression is greater than Δ l The original weight of
[0046] S223: Based on the loss function, two gradient back propagation methods are used to calculate W n , W p Training: Back-propagate the gradient G1 to the full-resolution weights to learn the distribution of ternary weights; Back-propagate the gradient G2 to W n , W p , learn the size of the ternary weights;
[0047] The positive and negative weights in each layer l introduce two quantized weights to be trained respectively and Represents that the Lth layer is greater than Δ l The weight of Represents that the Lth layer is less than -Δ l The weight of each layer and They are composed of W p and W n ;
[0048] During the forward propagation process, the quantized ternary weights The calculation is as follows:
[0049]
[0050] During the back propagation process, according to the gradient descent rule, the weight gradient is updated as:
[0051]
[0052] S224: Repeat step S223 until the flow field prediction model meets the requirements and obtains the ternary weight W n , 0, W p , and through the ternary weight W n , 0, W p Replace the original weights of the flow field prediction model before compression.
[0053] Compared with the prior art, the airfoil flow field prediction method based on improved generative adversarial network and model compression in the present invention has the following beneficial effects:
[0054] The flow field prediction model of the present invention is constructed based on a deep convolutional generative adversarial network, and can produce a fairly good output through the mutual game learning of the generator and the discriminator. On the one hand, the flow field prediction model of the present invention can effectively extract the complex features of the airfoil flow field by utilizing the excellent feature extraction capability of the deep convolution structure, and convert the high-dimensional data into a potential low-dimensional representation, so as to better realize the airfoil flow field prediction, thereby being able to effectively adapt to the airfoil flow field prediction and improve the accuracy of the airfoil flow field prediction; on the other hand, the flow field prediction model constructed based on deep convolution of the present invention has higher data performance and faster running speed than the traditional generative adversarial network, thereby being able to ensure the accuracy and efficiency of the airfoil flow field prediction, and providing a basis for the airfoil optimization design of the wing.
[0055] The present invention compresses the trained flow field prediction model, and then uses the compressed flow field prediction model for airfoil flow field prediction, so that the structure of the flow field prediction model can be simplified through model compression, and the parameters of the flow field prediction model can be reduced, and the hardware computing power and solution time of the flow field prediction model training deployment can be reduced, that is, the parameter amount and calculation amount of the flow field prediction model can be reduced through model compression, the prediction accuracy and running speed of the flow field prediction model are improved, and the efficiency of airfoil flow field prediction can be further improved.
[0056] In the present invention, the generator and discriminator of the flow field prediction model are both hybrid networks that combine convolutional neural networks, convolutional long short-term memory networks and deconvolutional networks. Compared with the existing generators and discriminators of separate convolutional neural networks, the flow field prediction model can better obtain the global information of the object, and can simultaneously extract the spatial dimension characteristics and time dimension characteristics of the flow field, thereby effectively improving the prediction accuracy of the flow field prediction model and the accuracy of the airfoil flow field prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] 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:
[0058] Figure 1 This is a principle flow chart of the airfoil flow field prediction method based on improved generative adversarial network and model compression;
[0059] Figure 2 This is the network diagram of the flow field prediction model;
[0060] Figure 3 The network structure diagram of the generator and the discriminator;
[0061] Figure 4 A flowchart for model compression;
[0062] Figure 5Comparison between the result graphs of different threshold factors t and the result graph of the original model: (a) is the result of the original model, (b) is the result of threshold factor t=0.02, (c) is the result of threshold factor t=0.05, and (d) is the result of threshold factor t=0.1. DETAILED DESCRIPTION
[0063] 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.
[0064] 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 required to be 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.
[0065] The following is a further detailed description through specific implementation methods:
[0066] Example:
[0067] This embodiment discloses an airfoil flow field prediction method based on an improved generative adversarial network and model compression.
[0068] like Figure 1 As shown, the airfoil flow field prediction method based on improved generative adversarial network and model compression includes:
[0069] S1: Obtain the boundary conditions of the object to be predicted;
[0070] S2: Input the boundary conditions into the trained flow field prediction model and output the corresponding predicted flow field image;
[0071] Combination Figure 2 As shown, the flow field prediction model is built based on a deep convolutional generative adversarial network;
[0072] When training the flow field prediction model: input the training data set containing boundary conditions and corresponding real flow field images into the flow field prediction model; in each round of iteration, first use the boundary conditions as the input of the generator, output the predicted flow field image under the corresponding boundary conditions, then use the predicted flow field image and the corresponding real flow field image as the input of the discriminator, the discriminator judges the predicted flow field image based on the real flow field image, and updates its own parameters in combination with the loss function, and finally feeds the parameter update results of the discriminator back to the generator for the generator to update its own parameters; repeat the iteration and continuously update the parameters of the generator and the discriminator until the predicted flow field image output by the generator can pass the judgment of the discriminator; finally, compress the trained flow field prediction model, and use the compressed flow field prediction model for airfoil flow field prediction;
[0073] In this embodiment, the flow field prediction model is built based on Generative Adversarial Networks (GAN). Generative Adversarial Networks (GAN) is a deep learning model and one of the most promising methods for unsupervised learning on complex distributions in recent years. The model produces a fairly good output through the mutual game learning of (at least) two modules in the framework: the generator (Generative Model) and the discriminator (Discriminative Model).
[0074] Among them, the compression of the flow field prediction model can be achieved by adopting existing mature model compression methods such as network pruning, parameter sharing, quantization, network decomposition, network distillation, and compact network design.
[0075] S3: Using the predicted flow field parameters in the corresponding predicted flow field image as the flow field prediction result of the object to be predicted.
[0076] In this embodiment, the predicted flow field parameters include velocity field and pressure field data in the predicted flow field image.
[0077] The flow field prediction model of the present invention is constructed based on a deep convolutional generative adversarial network, and can produce a fairly good output through the mutual game learning of the generator and the discriminator. On the one hand, the flow field prediction model of the present invention can effectively extract the complex features of the airfoil flow field by utilizing the excellent feature extraction capability of the deep convolution structure, and convert the high-dimensional data into a potential low-dimensional representation, so as to better realize the airfoil flow field prediction, thereby being able to effectively adapt to the airfoil flow field prediction and improve the accuracy of the airfoil flow field prediction; on the other hand, the flow field prediction model constructed based on deep convolution of the present invention has higher data performance and faster running speed than the traditional generative adversarial network, thereby being able to ensure the accuracy and efficiency of the airfoil flow field prediction, and providing a basis for the airfoil optimization design of the wing.
[0078] The present invention compresses the trained flow field prediction model, and then uses the compressed flow field prediction model for airfoil flow field prediction, so that the structure of the flow field prediction model can be simplified by model compression, and the parameters of the flow field prediction model can be reduced, and the hardware computing power and solution time of the flow field prediction model training deployment can be reduced, that is, the number of parameters and the amount of calculation of the flow field prediction model can be reduced by model compression, and the prediction accuracy and running speed of the flow field prediction model can be improved, so as to further improve the efficiency of airfoil flow field prediction. Experiments show that the flow field prediction model compressed by the method of the present invention reduces the memory required for parameters, and can simultaneously improve accuracy and solution speed.
[0079] Combination Figure 3 As shown, both the generator and the discriminator include a convolutional neural network layer, a convolutional long short-term memory network layer, and a deconvolution layer;
[0080] In the generator, the convolutional neural network layer is used to extract the flow field image features of the boundary conditions. Then, the convolutional long short-term memory network layer is used to extract the corresponding flow field spatial features and flow field temporal features based on the flow field image features. Finally, the deconvolution layer is used to perform high-dimensional mapping on the flow field spatial features and flow field temporal features to generate the predicted flow field image corresponding to the boundary conditions.
[0081] In the discriminator, the spatial features of the real flow field image and the predicted flow field image are first extracted through the convolutional neural network layer, and then the corresponding flow field spatial features and flow field time features are extracted based on the spatial features through the convolutional long short-term memory network layer. Finally, the flow field spatial features and flow field time features are mapped to high dimensions through the deconvolution layer, and the binary classification probability of the true or false category to which the predicted flow field image belongs is output through the fully connected layer.
[0082] In this embodiment, the traditional Gaussian distribution noise is replaced by the boundary conditions. The traditional generative adversarial network inputs the Gaussian distribution noise into the generator to generate the corresponding image, and then extracts the image features through CNN. The flow field prediction model of the present invention uses the boundary conditions (a set of vectors, similar to numerical values) as the input of the generator, and the generator generates the predicted flow field image corresponding to the boundary conditions.
[0083] During training, the processed boundary conditions are first input into the flow field prediction model in the form of an input vector, and the shape of the input vector is changed so that the input size conforms to the input of the internal network model of the generator. At the same time, the real flow field data of the real flow field image will also be input into the discriminator after size processing. In order for the discriminator to run effectively, the real flow field image needs to be labeled (Label: 1), and the predicted flow field image of the generator needs to be scaled so that the discriminator can distinguish between true and false. It is worth noting that when the generator generates the predicted flow field image, the predicted flow field image will also be labeled (Label: 0) and scaled, and finally the processed predicted flow field image will be input into the discriminator so that the discriminator can better learn the features of the real flow field image and the predicted flow field image, and better learn the features to distinguish between true and false.
[0084] The flow field data within a certain time series will be synchronously input into multiple convolutional layers. The input inside the generator is the input vector composed of boundary conditions, while the input inside the discriminator is the real flow field images of different time series.
[0085] The generator and discriminator convert the convolutional neural network layer of "batch size" into the long short-term memory network layer (ConvLSTM layer) of "fixed time step". Specifically, the flow field image features extracted by the convolutional neural network layer are transposed and input into the long short-term memory network layer. The long short-term memory network layer can simultaneously extract the spatial and temporal features of the flow field, and predict and generate the predicted flow field image under the future time series. The deconvolution layer is the structure after the convolution layer is reversed. It is mainly used to represent the low-dimensional feature mapping of the prediction to the high-dimensional output, which has the same dimension as the input.
[0086] In the present invention, the generator and discriminator of the flow field prediction model are both hybrid networks that combine convolutional neural networks, convolutional long short-term memory networks and deconvolutional networks. Compared with the existing generators and discriminators of separate convolutional neural networks, the flow field prediction model can better obtain the global information of the object, and can simultaneously extract the spatial dimension characteristics and time dimension characteristics of the flow field, thereby effectively improving the prediction accuracy of the flow field prediction model and the accuracy of the airfoil flow field prediction.
[0087] During the specific implementation process, the training data set is constructed through the following steps:
[0088] S201: parameterizing the target airfoil and adding disturbance to generate a new airfoil, taking various airfoils as object samples;
[0089] In this embodiment, the existing S806, S810, S815, and S817 airfoils are selected as target airfoils. In addition to adding disturbances to the airfoils, three different cross-sections of circle, triangle, and rectangle can be scaled and rotated to generate a series of object samples.
[0090] S202: Calculate the flow field data of a single object sample under different attack angles, different Mach numbers and different atmospheric environments by using a Reynolds-averaged NS equation numerical simulation method, and use the object sample containing the flow field data as a real flow field image;
[0091] In this embodiment, the Reynolds-averaged NS equation numerical simulation method is an existing mature technology.
[0092] 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.
[0093] Specifically, the flow field data of the object sample can be calculated using existing mature software, including:
[0094] First, the corresponding object samples are meshed to generate the corresponding wing meshes;
[0095] It includes defining grid boundaries and nodes, defining the air inlet, air outlet, upper wall, lower wall, front and rear walls of the object sample, and defining grid nodes and grid units.
[0096] Then, the angle of attack and Reynolds number are randomly generated and used as the initial angle of attack and Mach number of the object sample.
[0097] 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.
[0098] Finally, the velocity field and pressure field of the object sample are generated as flow field data through the existing fluid mechanics flow solver.
[0099] Among them, structured grid means that all internal points in the grid area divided by computational fluid dynamics have the same adjacent units. Structured grid has the advantages of fast grid generation speed, good grid quality and simple data structure.
[0100] S203: Recording boundary conditions of the real flow field image;
[0101] In this embodiment, the boundary conditions are parameters that conform to physical laws, such as a specific Mach number, atmospheric environment (Reynolds number, airflow density, airflow velocity, viscosity), and angle of attack.
[0102] S204: taking the real flow field image and the corresponding boundary conditions as a set of training data;
[0103] S205: Repeat steps S201 to S204 to construct a training data set including m groups of training data, and normalize the real flow field data and boundary conditions corresponding to the real flow field images in the training data set.
[0104] The present invention, through the above-mentioned training set construction method, can construct enough training data for training the neural network model, thereby improving the performance of the flow field prediction model.
[0105] In this embodiment, the flow field data and boundary conditions are scaled to a range between 0 and 1 through normalization processing.
[0106] In the specific implementation process, the real flow field data φ and boundary conditions μ of the training data set are expressed as:
[0107]
[0108]
[0109]
[0110] Where: N t Indicates the number of time steps; N x represents the number of points in the scalar grid of the computational domain Ω;
[0111] Reconstruct the real flow field data φ in tensor form:
[0112]
[0113] The real flow field data φ and boundary conditions μ of the real flow field image are normalized by the following formula:
[0114]
[0115]
[0116] Where: Represents boundary conditions and flow field data Normalized value; represents the time step t j Boundary conditions and real flow field data at μ min , μ max represents the minimum and maximum values of the boundary conditions; φ min ,φ max Indicates the minimum and maximum values of the real flow field data.
[0117] When the features of a data set have different value ranges, data normalization is very necessary. The purpose of data normalization is to make the features have the same measurement scale. The purpose of normalization is to limit the preprocessed data to a certain range (such as [0,1] or [-1,1]), thereby reducing the adverse effects caused by singular sample data. The significance of doing so can speed up model training, accelerate convergence, and even improve accuracy.
[0118] During the specific implementation process, the flow field prediction model is trained through the following steps:
[0119] S211: construct the loss function of the flow field prediction model;
[0120] S212: inputting m groups of boundary conditions and real flow field images into the flow field prediction model;
[0121] S213: In each round of iteration, the generator parameters are first fixed, the generator generates a predicted flow field image based on the boundary conditions, the discriminator judges the real flow field image and the predicted flow field image, and updates the discriminator parameters in combination with the loss function until the discriminator can distinguish the real flow field image from the predicted flow field image; specifically, the discriminator judges the predicted flow field image based on the real flow field image, and then performs back propagation according to the judgment result, and updates its own parameters in combination with the loss function;
[0122] S214: Fix the discriminator parameters again, feed back the parameter update results of the discriminator to the generator, and update the parameters of the generator in combination with the loss function until the predicted flow field image generated by the generator can pass the judgment of the discriminator; the purpose of training the generator is to make the discriminator unable to distinguish between the real flow field image and the predicted flow field image, that is, the generator can generate a predicted flow field image that is very close to the real flow field. Specifically, feed back the parameter update results of the discriminator to the generator for back propagation, and update the parameters of the generator in combination with the loss function;
[0123] S215: Repeat steps S213 to S214 for continuous iteration until the flow field prediction model converges to obtain a trained generator and discriminator.
[0124] The flow field prediction model of the present invention only uses back propagation, and does not require a Markov chain. The model is simple and easy to understand, the training process is simple, and the training speed is accelerated. Finally, the model can obtain a generator that iterates multiple times, which can perform image prediction very well. In theory, any differentiable function can be used to construct D and G, because it can be combined with a deep neural network to make a deep generative model. The parameter update of G does not come directly from the data sample, but uses the back propagation from D. The main advantage of GAN is that it surpasses the functions of traditional neural network classification and feature extraction, and can generate new data according to the characteristics of real data.
[0125] In this embodiment, the training of the flow field prediction model includes a feedforward process and a feedback process.
[0126] Feedforward process: Simply put, the output of the previous layer is used as the input of the next layer, and the output of the next layer is calculated until the operation reaches the output layer. For the generator, the input is the boundary condition, which passes through several convolutional layers, convolutional long short-term memory network layers, and deconvolutional layers, and the output is the predicted flow field image. For the discriminator, the input is a set of corresponding real flow field images and predicted flow field images, which pass through several convolutional layers, convolutional long short-term memory network layers, deconvolution layers, and fully connected layers, and the output is the image discrimination result (true or false).
[0127] Feedback process: This is the process of updating the model parameters in each round of iteration using the Adam optimization algorithm.
[0128] The loss function of the flow field prediction model is expressed by the following steps:
[0129]
[0130] Where: E represents expectation, the first E represents the expectation that x is real data, and the second E represents the expectation that x is generated data; μ represents boundary conditions; G represents the generator; G(μ) represents the predicted flow field image corresponding to the boundary conditions output by the generator; D represents the discriminator; μ represents boundary conditions; φ d represents the real flow field image; p μ (μ) represents the prior distribution of the random data set μ; p data (φ d ) represents the real flow field image φ d The corresponding probability data distribution.
[0131] In this embodiment, the function of the generator G is to map the input vector composed of boundary conditions to the predicted flow field dataset. The discriminator D is used to distinguish the real dataset φ d and the predicted flow field dataset output by the generator. In the discriminator, if the target output is accepted, D(φ d )=1, if the target output is rejected, D(G(μ))=0. The training process in the generative adversarial network (flow field prediction model) can be considered as a minimization-maximization problem based on the cross entropy loss function J(D,G).
[0132] By maximizing the discriminator function Update the parameters of the discriminator, θ (D) Represents the parameters in the discriminator loss function, function J (D) is differentiable;
[0133]
[0134] This formula is the loss function of the discriminator. It is a formula used by the network to update the discriminator, which can update and optimize the discriminator.
[0135] In this embodiment, updating the parameters of the discriminator includes two parts. First, the loss is calculated using the above formula, and then the parameters are updated using the gradient descent algorithm (ie, the Adam optimization algorithm).
[0136] By minimizing the generator function Update the parameters of the generator, θ (G) Represents the parameters in the generator loss function, function J (G) is differentiable;
[0137]
[0138] This formula is the loss function of the generator, which is used by the network to update the generator and can update and optimize the generator.
[0139] In this embodiment, updating the parameters of the generator includes two parts. First, the loss is calculated using the above formula, and then the parameters are updated using the gradient descent algorithm (ie, the Adam optimization algorithm).
[0140] After successfully distinguishing the real flow field data from the generated flow field data, the discriminator will update the internal parameters of the discriminator and the generator respectively to generate more realistic flow field data.
[0141] The specific parameter update process is:
[0142] First, after receiving two types of labeled flow field data, the discriminator will continuously perform iterative updates and update its own model parameters. After successfully distinguishing the two types of data, it means that the parameters of the discriminator in this round of cycles have been updated, and the updated results are fed back to the generator. The generator starts the parameter update again until all the flow field data generated by it can pass the judgment of this round of discriminator.
[0143] Through alternating updates and continuous iterations, the model of the generator will become more and more generalized, and the generated data will become closer and closer to the real flow field data, thus achieving the purpose of predicting the flow field.
[0144] In the back propagation, let θ (D) =(w (D) ,b (D) ), θ (G) =(w (G) ,b (G) ) represent the weights and biases of the discriminator and generator respectively;
[0145] In order to minimize the loss function J(D,G), the parameter θ (G) and θ (D) During back-propagation it is updated by the following proxy loss;
[0146] The formula is described as:
[0147]
[0148]
[0149] Where: η represents the learning rate; P represents the iteration step. When P→∞, θ (D) To reach the local optimum,
[0150] This formula is specifically an update formula for updating the parameters of the generator and the discriminator, and can update the generator and the discriminator.
[0151] In this embodiment, the purpose of training the flow field prediction model is to update the parameter θ (G) and θ (D)The flow field prediction model uses the adaptive moment estimation (Adam) optimizer to optimize the parameters of the discriminator and the generator θ (G) and θ (D) Optimization is performed with a hyperparameter learning rate of 0.0001.
[0152] Through the above steps, the present invention can effectively train a generator and a discriminator that combines a convolutional neural network, a convolutional long short-term memory network, and a deconvolutional network, so that the flow field prediction model can better extract the complex characteristics of the airfoil flow field and convert high-dimensional data into potential low-dimensional representations. At the same time, it can more effectively obtain global information of boundary conditions and realize the simultaneous extraction of spatial dimensional characteristics and temporal dimensional characteristics of the flow field, thereby further improving the prediction accuracy of the flow field prediction model and the accuracy of the airfoil flow field prediction.
[0153] Combination Figure 4 As shown, the flow field prediction model is compressed through the following steps:
[0154] S221: normalizing the weight of the flow field prediction model to the interval [-1, 1], and then setting a threshold to quantize the weight of the interval [-1, 1] to three intermediate values {-1, 0, 1};
[0155] In this embodiment, by setting the threshold value Δ l = t×max(|w|) quantizes the weights in the interval [-1,1] into three intermediate values {-1,0,1}. Use the maximum absolute value of the full-precision weight as the reference for the layer threshold, and keep a constant threshold factor t for all layers:
[0156] Δ l =t×max(|w|);
[0157] Where: The threshold factor t is a hyperparameter. When t is larger, the more weights are mapped to 0 after quantization, the faster the neural network operation speed is, but at the same time its error will also be higher.
[0158] S222: Randomly initialize W n , W p The value of
[0159] W n Indicates that the weight in the original model before compression is less than -Δ l If the weight is less than -Δ l , then set it to W n ; W p Indicates that the weight in the original model before compression is greater than Δ l If the weight is greater than Δ l , then set it to W p .
[0160] S223: Based on the loss function, two gradient back propagation methods are used to calculate W n , W p Training: Back-propagate the gradient G1 to the full-resolution weights to learn the distribution of ternary weights; Back-propagate the gradient G2 to W n , W p , learn the size of the ternary weights;
[0161] During the gradient descent training process, the values of the ternary weights (codebook) and how to assign appropriate ternary weights to all full-precision weights (select appropriate codebooks) are learned simultaneously.
[0162] In order to train the ternary weights, two quantized weights to be trained are introduced into the positive and negative weights in each layer l respectively. and Represents that the Lth layer is greater than Δ l The weight should be set to Represents that the Lth layer is less than -Δ l The weight should be set to
[0163] Among them, each layer and They are composed of W p and W n .
[0164] During the forward propagation process, the quantized ternary weights The calculation is as follows:
[0165]
[0166] This formula is to requantize the original weights of each layer in the neural network model into 0. Three values, if the weight is greater than Δ l , then quantized as If in -Δ l to Δ l If it is between , it is quantized to 0. If it is less than -Δ l , then quantized as
[0167] The traditional weights that require 32 bits to represent can now be represented by only 2 bits, reducing the size of the model. Moreover, the number of zero values in the quantized model increases, which speeds up the prediction of the model.
[0168] During the back-propagation process, according to the gradient descent rule, the full-precision weight gradient is updated as:
[0169]
[0170] This step is to calculate the gradient of the quantized weight. The quantized weight cannot be calculated using traditional methods. Instead, the scaled gradients are used for the 32-bit weights, which are multiplied by the quantized values respectively.
[0171] The gradients calculated in this step are back-propagated for retraining The value of .
[0172] Learn how to choose appropriate triplet weights by updating the full-precision weights during gradient descent training;
[0173] S224: Repeat step S223 until the flow field prediction model meets the accuracy requirements and obtains the ternary weight W n , 0, W p .
[0174] In this embodiment, the final "ternary weight W n , 0, W p The 32-bit weights before the replacement model compression are used as the weights of the flow field prediction model, thereby reducing the model size and speeding up the prediction.
[0175] Specific:
[0176] 1) The full resolution weights (original weights) are the parameters of the neural network model before compression.
[0177] Gradient backpropagation G1 to full-resolution weights: This is the same as the traditional one, that is, the gradient of the neural network weights is calculated through the Loss loss function, and the network is traversed from the output layer to the input layer in reverse order through the chain rule, and the gradient of each intermediate variable and parameter is calculated in turn, thereby updating the parameters of the entire neural network model.
[0178] Gradient G2 is back-propagated to W n , W p :This process is achieved through the above formula To calculate the gradient of the quantized weights, we use the chain rule to traverse the network in reverse order from the output layer to the input layer, and calculate the gradient of each intermediate variable and parameter in turn, thereby updating each layer. The value of .
[0179] 2) Traditionally, weights that require full precision can now be represented with only 2 bits, reducing the size of the model. Moreover, after quantization, the number of zero values in the model increases, speeding up the prediction speed of the model.
[0180] 3)W n , W p Represents a 1*L matrix, where L represents the number of layers of the neural network model. ln Together they form W n , similarly, each layer of W l p Together they form W p .
[0181] Considering that the flow field prediction model needs to be deployed on embedded devices with limited computing resources, and the traditional deep network model has many unimportant parameters that increase the computing burden. In order to achieve the purpose of real-time operation and fast solution, the present invention proposes a model compression method based on quantization.
[0182] The present invention compresses the trained flow field prediction model through a quantization-based model compression method, and uses the compressed flow field prediction model for airfoil flow field prediction. The structure of the flow field prediction model can be simplified through model compression, the parameters of the flow field prediction model can be reduced, and the hardware computing power and solution time of the flow field prediction model training deployment can be reduced. That is, the number of parameters and the amount of calculation of the flow field prediction model can be reduced through model compression, and the prediction accuracy and running speed of the flow field prediction model can be improved, thereby further improving the efficiency of airfoil flow field prediction.
[0183] The final experimental results show that compared with the original network model, the error loss of the compressed neural network model is not only reduced by about 1%, but also the neural network solution time is shortened by about 12%. The experiment shows that the flow field prediction model compressed by the method of the present invention reduces the memory required for parameters and can improve both accuracy and solution speed.
[0184] In order to better illustrate the advantages of the technical solution of the present invention, the following experiments are disclosed in this embodiment.
[0185] This experiment uses the training set for model training and the test set for rapid prediction of airfoil flow field for the compressed flow field prediction model. The flow field prediction results of the original model and the compressed model with different threshold factors t are shown in the figure. Figure 5 As shown. Each set of prediction results contains three columns of images, from left to right, the pressure field, the x and y components of the velocity field. The first row represents the true label, the second row is the result of the neural network model output, and the black and white picture in the last row represents the difference between the model output and the true label. The whiter the area, the greater the difference. From the comparison of simulation results, it can be clearly seen that the compressed deep network model has significantly less white parts than the original model, that is, the accuracy of the model output result is higher than the original model, especially the x component of the velocity field.
[0186] Table 1 Comparison of the error and solution time of different threshold factors t and the original model
[0187]
[0188] In addition, this experiment also compared the error and solution time of the original model and the compressed model, and the comparison results are shown in Table 1. The experimental data based on Table 1 can be summarized as follows: The quantization-based model compression method proposed in the present invention has greatly improved the most concerned solution time, model accuracy, and deployment space. In terms of solution time, this method shortens the operation time by nearly 12%. In terms of model accuracy, since the network model is quantized, the overfitting of the original model is reduced, and the error is reduced by more than 1% compared to the original model. In terms of deployment space, the present invention focuses on embedded devices with limited deployment space such as aircraft, and quantizes the parameters, reducing them from the original 32 bits to 2 bits, which greatly saves the space required for the deployment of neural network models.
[0189] 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. An airfoil flow field prediction method based on improved generative adversarial network and model compression, characterized in that: include: S1: Obtain the boundary conditions of the object to be predicted; S2: Input the boundary conditions into the trained flow field prediction model and output the corresponding predicted flow field image; The flow field prediction model is built based on a deep convolutional generative adversarial network; When training the flow field prediction model: input the training data set containing boundary conditions and corresponding real flow field images into the flow field prediction model; in each round of iteration, first use the boundary conditions as the input of the generator, output the predicted flow field image under the corresponding boundary conditions, then use the predicted flow field image and the corresponding real flow field image as the input of the discriminator, the discriminator judges the predicted flow field image based on the real flow field image, and updates its own parameters in combination with the loss function, and finally feeds the parameter update results of the discriminator back to the generator for the generator to update its own parameters; repeat the iteration and continuously update the parameters of the generator and the discriminator; finally, compress the trained flow field prediction model, and use the compressed flow field prediction model for airfoil flow field prediction; In step S2, the flow field prediction model is trained through the following steps: S211: construct the loss function of the flow field prediction model; S212: inputting m groups of boundary conditions and real flow field images into the flow field prediction model; S213: In each round of iteration, the generator parameters are first fixed, the generator generates a predicted flow field image based on the boundary conditions, the discriminator judges the real flow field image and the predicted flow field image, and updates the parameters of the discriminator in combination with the loss function until the discriminator can distinguish the real flow field image from the predicted flow field image; S214: fix the discriminator parameters again, feed back the parameter update result of the discriminator to the generator, and update the parameters of the generator in combination with the loss function until the predicted flow field image generated by the generator can pass the judgment of the discriminator; S215: Repeat steps S213 to S214 for continuous iteration until the flow field prediction model converges to obtain a trained generator and discriminator; In step S211, the loss function of the flow field prediction model is represented by the following steps: Where: E represents expectation; μ represents boundary condition; G represents generator; G(μ) represents the predicted flow field image corresponding to the boundary condition output by the generator; D represents discriminator; μ represents boundary condition; φ d represents the real flow field image; p μ (μ) represents the prior distribution of random data sets generated by boundary condition μ; p data (φ d ) represents the real flow field image φ d The corresponding probability data distribution; In step S212, by maximizing the discriminator function Update the parameters of the discriminator, θ (D) Represents the parameters in the discriminator loss function; In step S213, by minimizing the generator function Update the parameters of the generator, θ (G) Represents the parameters in the generator loss function; In the back propagation, let θ (D) =(w (D) ,b (D) ), θ (G) =(w (G) ,b (G) );w (D) , b (D) and w (G) , b (G) Represent the weights and biases of the discriminator and generator respectively; Parameter θ (G) and θ (D) During back-propagation it is updated by the following proxy loss; The formula is described as: Where: η represents the learning rate; P represents the iteration step. When P→∞, θ (D) To reach the local optimum, The flow field prediction model is compressed through the following steps: S221: normalizing the original weight of the flow field prediction model to the interval [-1, 1], and then setting a threshold to quantize the original weight of the interval [-1, 1] to three intermediate values {-1, 0, 1}; S222: Randomly initialize W n , W p Value: W n Indicates that the flow field prediction model before compression is less than -Δ l The original weight, W p Indicates that the flow field prediction model before compression is greater than Δ l The original weight of S223: Based on the loss function, two gradient back propagation methods are used to calculate W n , W p Training: Back-propagate the gradient G1 to the full-resolution weights to learn the distribution of ternary weights; Back-propagate the gradient G2 to W n , W p , learn the size of the ternary weights; The positive and negative weights in each layer l introduce two quantized weights to be trained respectively and Represents that the Lth layer is greater than Δ l The weight of Represents that the Lth layer is less than -Δ l The weight of each layer and They are composed of W p and W n ; During the forward propagation process, the quantized ternary weights The calculation is as follows: During the back propagation process, according to the gradient descent rule, the weight gradient is updated as: S224: Repeat step S223 until the flow field prediction model meets the requirements and obtains the ternary weight W n , 0, W p , and through the ternary weight W n , 0, W p Replace the original weights of the flow field prediction model before compression; S3: Using the predicted flow field parameters in the corresponding predicted flow field image as the flow field prediction result of the object to be predicted.
2. The airfoil flow field prediction method based on improved generative adversarial network and model compression according to claim 1 is characterized in that: The generator includes a convolutional neural network layer, a convolutional long short-term memory network layer, and a deconvolution layer: first, the flow field image features of the boundary conditions are extracted through the convolutional neural network layer, and then the corresponding flow field spatial features and flow field time features are extracted based on the flow field image features through the convolutional long short-term memory network layer. Finally, the deconvolution layer performs high-dimensional mapping on the flow field spatial features and flow field time features to generate a predicted flow field image corresponding to the boundary conditions.
3. The airfoil flow field prediction method based on improved generative adversarial network and model compression according to claim 1 is characterized in that: In step S2, the training data set is constructed by the following steps: S201: parameterizing the target airfoil and adding disturbance to generate a new airfoil, taking various airfoils as object samples; S202: Calculate the flow field data of a single object sample under different attack angles, different Mach numbers and different atmospheric environments by using a Reynolds-averaged NS equation numerical simulation method, and use the object sample containing the flow field data as a real flow field image; S203: Recording boundary conditions of the real flow field image; S204: taking the real flow field image and the corresponding boundary conditions as a set of training data; S205: Repeat steps S201 to S204 to construct a training data set including m groups of training data.
4. The airfoil flow field prediction method based on improved generative adversarial network and model compression according to claim 3 is characterized in that: In step S205, the real flow field data φ and boundary conditions μ of the real flow field image are normalized by the following formula: Where: Represents boundary conditions and real flow field data Normalized value; represents the time step t j Boundary conditions and real flow field data at μ min , μ max represents the minimum and maximum values of the boundary conditions; φ min ,φ max Indicates the minimum and maximum values of the real flow field data.
Citation Information
Patent Citations
Airfoil flow field rapid prediction method based on deep learning
CN112784508A
Image compression optimization method based on convolutional neural network
CN110796251A
Inverse synthetic aperture radar imaging method based on generative adversarial network
CN111077523A
Airfoil optimization method fusing CNN (Convolutional Neural Network) and Swin Transform network
CN115795683A
Flow field prediction method based on attention and convolutional neural network codec
CN115859781A
