[go: up one dir, main page]

CN118395886A - Flow field prediction method based on token selection transducer - Google Patents

Flow field prediction method based on token selection transducer Download PDF

Info

Publication number
CN118395886A
CN118395886A CN202410350715.3A CN202410350715A CN118395886A CN 118395886 A CN118395886 A CN 118395886A CN 202410350715 A CN202410350715 A CN 202410350715A CN 118395886 A CN118395886 A CN 118395886A
Authority
CN
China
Prior art keywords
airfoil
flow field
token
network
follows
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202410350715.3A
Other languages
Chinese (zh)
Other versions
CN118395886B (en
Inventor
彭德中
刘�东
于洋
刘铠铭
庞志鑫
孙元
秦阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan University
Nuclear Power Institute of China
Original Assignee
Sichuan University
Nuclear Power Institute of China
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan University, Nuclear Power Institute of China filed Critical Sichuan University
Priority to CN202410350715.3A priority Critical patent/CN118395886B/en
Publication of CN118395886A publication Critical patent/CN118395886A/en
Application granted granted Critical
Publication of CN118395886B publication Critical patent/CN118395886B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • G06F30/28Design optimisation, verification or simulation using fluid dynamics, e.g. using Navier-Stokes equations or computational fluid dynamics [CFD]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • G06F30/27Design optimisation, verification or simulation using machine learning, e.g. artificial intelligence, neural networks, support vector machines [SVM] or training a model
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/774Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/80Fusion, i.e. combining data from various sources at the sensor level, preprocessing level, feature extraction level or classification level
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2113/00Details relating to the application field
    • G06F2113/08Fluids
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2119/00Details relating to the type or aim of the analysis or the optimisation
    • G06F2119/14Force analysis or force optimisation, e.g. static or dynamic forces

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Computing Systems (AREA)
  • Medical Informatics (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Databases & Information Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • Computer Hardware Design (AREA)
  • Geometry (AREA)
  • General Engineering & Computer Science (AREA)
  • Algebra (AREA)
  • Fluid Mechanics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Physics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Aerodynamic Tests, Hydrodynamic Tests, Wind Tunnels, And Water Tanks (AREA)

Abstract

The invention discloses a flow field prediction method based on token selection transform, which comprises the following steps: acquiring an airfoil shape dataset and a real flow field dataset; extracting airfoil geometric parameters through a token selection transducer network; constructing a parameter fusion network to fuse physical information characteristics; training a flow field prediction network based on a multi-layer perceptron; and predicting the pressure field and the speed field on different airfoil data by using a trained flow field prediction model. The invention solves the problems of inaccurate focus and coarser feature extraction granularity when extracting the geometrical parameters of the wing profile by introducing a self-attention mechanism and a token selection mechanism; by introducing a physical information fusion network, the expression capacity and generalization capacity of the model are enhanced; the method has good prediction precision and prediction efficiency under different wing section and flow field conditions, and can provide rapid guidance for the tasks of aerodynamic shape design, aerodynamic performance analysis and the like of the aircraft.

Description

一种基于令牌选择Transformer的流场预测方法A flow field prediction method based on token selection Transformer

技术领域Technical Field

本发明属于计算流体力学领域和人工智能技术领域,具体涉及一种基于令牌选择Transformer的流场预测方法。The present invention belongs to the fields of computational fluid dynamics and artificial intelligence technology, and specifically relates to a flow field prediction method based on token selection Transformer.

背景技术Background technique

流场预测是对流体的运动状态进行预测和模拟的过程,在化工、气候和空气动力学等领域有着广泛的应用,以空气动力学领域为例,获得飞行器翼型附近的流场数据是飞行器设计和优化过程中至关重要的环节。最初,获取翼型流场数据的主要手段是借助风洞试验,这种方法虽然结果较为准确,但实验设计需要依靠大量的先验知识,且实验周期较长,搭建风洞设备所需要的资源开销较大,因此多用于飞行器设计的后期;随着高性能计算和数值模拟方法的兴起,计算流体力学(CFD)方法逐渐成为模拟翼型附近流场的主要手段。CFD方法主要通过离散化连续的流体方程,如纳维-斯托克斯(Navier-Stokes)方程,通过数值方式近似求解这些方程从而得到流场数据。然而在复杂条件下的CFD求解需要大量的迭代过程,对CPU和内存的要求也很高。Flow field prediction is the process of predicting and simulating the motion state of a fluid. It has a wide range of applications in chemical engineering, climate, and aerodynamics. Taking aerodynamics as an example, obtaining flow field data near an aircraft airfoil is a crucial step in the design and optimization of an aircraft. Initially, the main means of obtaining airfoil flow field data was through wind tunnel testing. Although this method has relatively accurate results, the experimental design requires a lot of prior knowledge, and the experimental cycle is long. The resource overhead required to build wind tunnel equipment is large, so it is mostly used in the later stages of aircraft design. With the rise of high-performance computing and numerical simulation methods, computational fluid dynamics (CFD) methods have gradually become the main means of simulating flow fields near airfoils. CFD methods mainly discretize continuous fluid equations, such as the Navier-Stokes equations, and numerically approximate these equations to obtain flow field data. However, CFD solutions under complex conditions require a large number of iterative processes, and the requirements for CPU and memory are also high.

近年来,随着人工智能和神经网络的广泛应用,基于深度学习和数据驱动的方法成为获取流场数据的新手段。这种方法只需要在前期花费一定的时间训练网络模型,之后便可以使用训练好的模型在几秒内完成不同翼型的流场预测。但是目前现有的深度学习流场预测方法也存在一些局限性:许多基于CNN的流场预测方法将流场数据投影至均匀分布的笛卡尔网格中,这种像素化的方法会造成大量的流场细节缺失,特别是在靠近翼型表面的位置;并且现有的翼型几何参数的获取方法也无法准确地捕捉到翼型中最有效的几何特征。因此,如何更准确地提取翼型特征和预测流场细节是基于深度学习的流场预测方法需要优化的方向。In recent years, with the widespread application of artificial intelligence and neural networks, methods based on deep learning and data-driven have become a new means of obtaining flow field data. This method only requires a certain amount of time to train the network model in the early stage, and then the trained model can be used to complete the flow field prediction of different airfoils within a few seconds. However, the existing deep learning flow field prediction methods also have some limitations: many CNN-based flow field prediction methods project the flow field data into a uniformly distributed Cartesian grid. This pixelation method will cause a large amount of flow field details to be missing, especially near the airfoil surface; and the existing airfoil geometric parameter acquisition method cannot accurately capture the most effective geometric features of the airfoil. Therefore, how to more accurately extract airfoil features and predict flow field details is the direction that the flow field prediction method based on deep learning needs to be optimized.

发明内容Summary of the invention

针对现有技术存在的不足,本发明提出了一种基于令牌选择Transformer的流场预测方法,能够提取到更加准确和有效的翼型特征,并且能够提升流场预测精度,特别是在靠近翼型表面的位置。In view of the shortcomings of the prior art, the present invention proposes a flow field prediction method based on token selection Transformer, which can extract more accurate and effective airfoil features and improve the flow field prediction accuracy, especially near the airfoil surface.

为了解决上述技术问题,本发明通过以下方式来实现:In order to solve the above technical problems, the present invention is implemented in the following ways:

一种基于令牌选择Transformer的流场预测方法,包括以下步骤:A flow field prediction method based on token selection Transformer includes the following steps:

S1、获取翼型形状数据集和真实流场数据集;S1, obtaining an airfoil shape data set and a real flow field data set;

S2、通过令牌选择Transformer网络提取翼型几何参数;S2, extracting airfoil geometric parameters through token selection Transformer network;

S3、构建参数融合网络融合物理信息特征;S3, construct parameter fusion network to fuse physical information features;

S4、训练基于多层感知机的流场预测网络;S4, training a flow field prediction network based on a multi-layer perceptron;

S5、利用训练好的流场预测模型在不同翼型数据上预测压力场和速度场。S5. Use the trained flow field prediction model to predict the pressure field and velocity field on different airfoil data.

进一步地,所述步骤S1具体包括以下步骤:Furthermore, the step S1 specifically includes the following steps:

S11、从UIUC翼型数据库中选取基准翼型,通过非均匀有理B样条插值方法进行翼型拟合,并在翼型拟合曲线上选取控制点作为当前翼型新的x坐标和y坐标;S11, selecting a reference airfoil from the UIUC airfoil database, performing airfoil fitting by using a non-uniform rational B-spline interpolation method, and selecting a control point on the airfoil fitting curve as a new x-coordinate and y-coordinate of the current airfoil;

S12、对步骤S11中所有翼型新坐标进行最大最小归一化处理,其表达式如下:S12, performing maximum and minimum normalization processing on all new airfoil coordinates in step S11, and the expression is as follows:

其中,xi、yi表示当前翼型的坐标,xmin、ymin为全局最小值,xmax、ymax为全局最大值,xj、yi为归一化后的坐标;Among them, x i , y i represent the coordinates of the current airfoil, x min , y min are the global minimum values, x max , y max are the global maximum values, and x j , y i are the normalized coordinates;

S13、根据归一化后的坐标生成翼型形状灰度图,处于翼型几何曲线上的像素点值为1,不处于翼型几何曲线上的像素值为0,其他位置的像素值介于范围[0,1],得到翼型形状数据集;S13, generating an airfoil shape grayscale image according to the normalized coordinates, wherein the pixel value on the airfoil geometry curve is 1, the pixel value not on the airfoil geometry curve is 0, and the pixel values at other positions are in the range [0,1], thereby obtaining an airfoil shape data set;

S14、划分计算网格,对翼型数据集中的翼型样本进行CFD求解,得到不同翼型样本在不同流动条件下的真实数据,形成真实流场数据集。S14, dividing the computational grid, performing CFD solution on the airfoil samples in the airfoil data set, obtaining real data of different airfoil samples under different flow conditions, and forming a real flow field data set.

进一步地,所述步骤S2具体包含以下步骤:Furthermore, the step S2 specifically comprises the following steps:

S21、将步骤S1中获取的翼型形状数据集中的翼型图像进行序列化,对每张翼型图像pici进行块划分和展平,将其转换为一系列的二维令牌(token)pi,pici和pi的表达式如下:S21, serialize the airfoil images in the airfoil shape data set obtained in step S1, divide and flatten each airfoil image pic i into blocks, and convert it into a series of two-dimensional tokens pic i , where the expressions of pic i and pi are as follows:

其中,表示实数集,H、W和C分别表示翼型图像的宽、高和通道数目,P表示选取划分块的宽和高,N=H*W/P2表示划分出的二维令牌数量;in, represents a real number set, H, W and C represent the width, height and number of channels of the airfoil image respectively, P represents the width and height of the selected partition block, and N = H*W/P 2 represents the number of two-dimensional tokens divided;

S22、在获取的token序列中增加一个可学习的嵌入CLStoken,维度和其他token维度保持一致,进而得到每一张翼型图像的完整token序列表示I,其具体表达式如下:S22. Add a learnable embedding CLStoken to the acquired token sequence, with the dimension consistent with other token dimensions, and then obtain the complete token sequence representation I of each airfoil image, the specific expression of which is as follows:

其中,pcls表示CLStoken,p0,p1,...pn-1表示上述中获取的N个token,D=P2*C表示token的维度;Wherein, p cls represents CLStoken, p 0 , p 1 , ... p n-1 represent the N tokens obtained in the above, and D = P 2 *C represents the dimension of the token;

S23、将I通过多层感知机网络进行降维,使每一个token的维度从D降至得到I′,其具体表达式如下:S23, reduce the dimension of I through a multi-layer perceptron network, so that the dimension of each token is reduced from D to I' is obtained, and its specific expression is as follows:

S24、步骤S23中的p′cls作为全局特征,p′0,p′1,....p′n-1作为局部特征,将全局特征p′cls与每一个局部特征p′i进行拼接,进而得到拼接特征其表达式如下:S24, p′ cls in step S23 is used as the global feature, p′ 0 , p′ 1 , .... p′ n-1 are used as local features, and the global feature p′ cls is concatenated with each local feature p′ i to obtain the concatenated feature Its expression is as follows:

S25、将步骤S24中得到的N+1个拼接特征记为再将其输入到另一个后接归一化层的多层感知机网络,计算特征的重要性分数向量S,其表达式如下:S25. Record the N+1 splicing features obtained in step S24 as Then input it into another multi-layer perceptron network followed by a normalization layer to calculate the importance score vector S of the feature, which is expressed as follows:

其中,MLP()表示多层感知机网络的函数,Softmax()表示归一化指数函数,将MLP的输出转化为[0,1]间的概率值;Among them, MLP() represents the function of the multi-layer perceptron network, and Softmax() represents the normalized exponential function, which converts the output of MLP into a probability value between [0,1];

S26、使用重要性分数向量S筛选出所有N+1个token中重要性排在前K位的token索引M,其表达式如下:S26. Use the importance score vector S to filter out the token index M with the top K importance among all N+1 tokens. The expression is as follows:

M∈{0,1}(N+1)*K M∈{0,1} (N+1)*K

其中,M中的每个元素都是一个one-hot指示器,取值从集合{0,1}中选取;Each element in M is a one-hot indicator, and its value is selected from the set {0, 1};

S27、使用步骤S26中矩阵M的转置与I进行矩阵乘法,得到给定翼型的最重要的K个翼型参数特征 S27, use the transpose of the matrix M in step S26 and I to perform matrix multiplication to obtain the most important K airfoil parameter features of the given airfoil

进一步地,所述步骤S3具体包含以下步骤:Furthermore, the step S3 specifically comprises the following steps:

S31、对于每个网格点坐标,计算其到翼型几何曲线的最短距离d,其表达式如下:S31. For each grid point coordinate, calculate the shortest distance d to the airfoil geometry curve, which is expressed as follows:

其中,(x,y)表示网格点的X轴坐标和Y轴坐标,表示翼型几何曲线上点的X轴坐标和Y轴坐标;Where (x, y) represents the X-axis coordinate and Y-axis coordinate of the grid point. Indicates the X-axis and Y-axis coordinates of a point on the airfoil geometry curve;

S32、构建参数融合网络,将每个网格点的横纵坐标、坐标到翼型几何边界的最短距离及归一化后的雷诺系数与攻角输入到一个多层感知机网络进行特征融合与升维,最终得到物理信息特征pphy,其表达式如下:S32. Construct a parameter fusion network, input the horizontal and vertical coordinates of each grid point, the shortest distance from the coordinate to the airfoil geometric boundary, and the normalized Reynolds coefficient and angle of attack into a multi-layer perceptron network for feature fusion and dimension upgrading, and finally obtain the physical information feature p phy , which is expressed as follows:

其中,分别表示归一化后的雷诺系数和攻角,D表示融合得到的物理信息特征的维度,与步骤S2中提取的每一个翼型特征维度保持一致。in, and They represent the normalized Reynolds coefficient and angle of attack respectively, and D represents the dimension of the fused physical information feature, which is consistent with the dimension of each airfoil feature extracted in step S2.

进一步地,所述步骤S4具体包含以下步骤:Furthermore, the step S4 specifically comprises the following steps:

S41、将重要性排名前K的翼型参数特征与物理信息特征pphy作为基于多层感知机的流场预测网络的输入,流场预测网络的输出为对应网格点坐标的流场数据,其表达式如下:S41. Rank the top K airfoil parameter features by importance The physical information feature p phy is used as the input of the flow field prediction network based on the multi-layer perceptron. The output of the flow field prediction network is the flow field data corresponding to the grid point coordinates, and its expression is as follows:

其中,fpredict()表示流场预测网络的函数,分别表示x方向速度分量、y方向速度分量和压力的预测值;Among them, f predict () represents the function of the flow field prediction network, and They represent the predicted values of the velocity component in the x direction, the velocity component in the y direction, and the pressure, respectively;

S42、对于流场预测网络,设计损失函数LossMLP表达式如下:S42. For the flow field prediction network, the loss function Loss MLP is designed as follows:

其中,N表示样本总数,ui,vi,pi表示x方向速度分量,y方向速度分量和压力的真实值;Where N represents the total number of samples, ui , vi , pi represent the true values of the x-direction velocity component, the y-direction velocity component and the pressure;

S43、在GPU服务器上训练模型,设置不同的模型参数和迭代步数进行多轮训练,选择在测试数据上预测误差最小的模型作为最终的流场预测模型。S43. Train the model on the GPU server, set different model parameters and iteration steps for multiple rounds of training, and select the model with the smallest prediction error on the test data as the final flow field prediction model.

进一步地,所述步骤S5具体方法如下:Furthermore, the specific method of step S5 is as follows:

使用训练好的上述流场预测模型,输入不同翼型特征与雷诺数、攻角信息,输出对应翼型和流动条件下翼型附近的压力场和速度场;使用处理软件进行流场数据可视化处理,以便进行翼型优化、气动性能分析、气动噪声预测等后续工作。Using the trained flow field prediction model, different airfoil characteristics, Reynolds number, and angle of attack information are input, and the pressure field and velocity field near the airfoil under the corresponding airfoil and flow conditions are output; the flow field data is visualized using processing software to facilitate subsequent work such as airfoil optimization, aerodynamic performance analysis, and aerodynamic noise prediction.

与现有技术相比,本发明具有的有益效果:Compared with the prior art, the present invention has the following beneficial effects:

借助Transformer的自注意力机制,并通过令牌(token)选择模块,更加准确地筛选翼型特征,同时在一定程度上避免了参数冗余;为不同翼型形状提取归一化的坐标值并生成标准化图像,便于后续神经网络进行处理,将流场网格位置信息和流场参数物理信息使用神经网络进行特征融合,并与翼型参数特征保持对齐,能够在一定程度上增强模型的表达能力和泛化能力;相比现有的深度学习流场预测方法,本发明提高了流场预测的精度,特别是靠近翼型结构表面的位置。With the help of Transformer's self-attention mechanism and through the token selection module, the airfoil features can be screened more accurately, while parameter redundancy can be avoided to a certain extent; normalized coordinate values are extracted for different airfoil shapes and standardized images are generated to facilitate subsequent neural network processing; the flow field grid position information and the flow field parameter physical information are feature fused using a neural network and aligned with the airfoil parameter features, which can enhance the expression and generalization capabilities of the model to a certain extent; compared with the existing deep learning flow field prediction methods, the present invention improves the accuracy of flow field prediction, especially near the surface of the airfoil structure.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1为本发明流场预测方法的流程示意图。FIG1 is a schematic flow chart of the flow field prediction method of the present invention.

具体实施方式Detailed ways

下面结合附图和具体实施例对本发明的具体实施方式作进一步详细的说明。The specific implementation of the present invention is further described in detail below with reference to the accompanying drawings and specific examples.

如图1所示,一种基于令牌选择Transformer的流场预测方法,包括以下步骤:As shown in FIG1 , a flow field prediction method based on token selection Transformer includes the following steps:

S1、获取翼型形状数据集和真实流场数据集;S1, obtaining an airfoil shape data set and a real flow field data set;

S2、通过令牌选择Transformer网络提取翼型几何参数;S2, extracting airfoil geometric parameters through token selection Transformer network;

S3、构建参数融合网络融合物理信息特征;S3, construct parameter fusion network to fuse physical information features;

S4、训练基于多层感知机的流场预测网络;S4, training a flow field prediction network based on a multi-layer perceptron;

S5、利用训练好的流场预测模型在不同翼型数据上预测压力场和速度场。S5. Use the trained flow field prediction model to predict the pressure field and velocity field on different airfoil data.

进一步地,所述步骤S1具体包括以下步骤:Furthermore, the step S1 specifically includes the following steps:

S11、从UIUC翼型数据库中选取基准翼型,通过非均匀有理B样条插值方法进行翼型拟合,并在翼型拟合曲线上选取控制点作为当前翼型新的x坐标和y坐标;S11, selecting a reference airfoil from the UIUC airfoil database, performing airfoil fitting by using a non-uniform rational B-spline interpolation method, and selecting a control point on the airfoil fitting curve as a new x-coordinate and y-coordinate of the current airfoil;

S12、对步骤S11中所有翼型新坐标进行最大最小归一化处理,其表达式如下:S12, performing maximum and minimum normalization processing on all new airfoil coordinates in step S11, and the expression is as follows:

其中,xi、yi表示当前翼型的坐标,xmin、ymin为全局最小值,xmax、ymax为全局最大值,xj、yj为归一化后的坐标;Among them, x i , y i represent the coordinates of the current airfoil, x min , y min are the global minimum values, x max , y max are the global maximum values, and x j , y j are the normalized coordinates;

S13、根据归一化后的坐标生成翼型形状灰度图,处于翼型坐标点构成光滑曲线(翼型几何曲线)上的像素点值为1,不处于翼型几何曲线上的像素值为0,其他位置的像素值介于范围[0,1],得到翼型形状数据集;S13, generating an airfoil shape grayscale image according to the normalized coordinates, wherein the pixel value on the smooth curve (airfoil geometry curve) formed by the airfoil coordinate points is 1, the pixel value not on the airfoil geometry curve is 0, and the pixel values at other positions are in the range [0,1], thereby obtaining an airfoil shape data set;

S14、划分计算网格,对翼型数据集中的翼型样本进行CFD求解,得到不同翼型样本在不同流动条件下的流场真实数据,形成真实流场数据集。S14, dividing the calculation grid, performing CFD solution on the airfoil samples in the airfoil data set, obtaining the real flow field data of different airfoil samples under different flow conditions, and forming a real flow field data set.

进一步地,所述步骤S2具体包含以下步骤:Furthermore, the step S2 specifically comprises the following steps:

S21、将步骤S1中获取的翼型形状数据集中的翼型图像进行序列化,对每张翼型图像pici进行块划分和展平,将其转换为一系列的二维令牌(token)pi,pici和pi的表达式如下:S21, serialize the airfoil images in the airfoil shape data set obtained in step S1, divide and flatten each airfoil image pic i into blocks, and convert it into a series of two-dimensional tokens pic i , where the expressions of pic i and pi are as follows:

其中,表示实数集,H、W和C分别表示翼型图像的宽、高和通道数目,P表示选取划分块的宽和高,N=H*W/P2表示划分出的二维令牌数量;in, represents a real number set, H, W and C represent the width, height and number of channels of the airfoil image respectively, P represents the width and height of the selected partition block, and N = H*W/P 2 represents the number of two-dimensional tokens divided;

S22、在步骤S21中获取的token序列中增加一个可学习的嵌入CLStoken,维度和其他token维度保持一致,进而得到每一张翼型图像的完整token序列表示I,其具体表达式如下:S22, adding a learnable embedding CLStoken to the token sequence obtained in step S21, with the dimension consistent with other token dimensions, and then obtaining a complete token sequence representation I of each airfoil image, the specific expression of which is as follows:

其中,pcls表示CLStoken,p0,p1,...pn-1表示上述中获取的N个token,D=P2*C表示token的维度;Wherein, p cls represents CLStoken, p 0 , p 1 , ... p n-1 represent the N tokens obtained in the above, and D = P 2 *C represents the dimension of the token;

S23、将I通过多层感知机网络进行降维,使每一个token的维度从D降至得到I′,其具体表达式如下:S23, reduce the dimension of I through a multi-layer perceptron network, so that the dimension of each token is reduced from D to I' is obtained, and its specific expression is as follows:

其中,p′cls,p′0,p′1,...,p′n-1为包含CLStoken在内共N+1个token降维后的表示;Among them, p′ cls , p′ 0 , p′ 1 , ..., p′ n-1 are the representations of N+1 tokens including CLStoken after dimensionality reduction;

S24、步骤S23中的p′cls作为全局特征,p′0,p′1,....p′n-1作为局部特征,将全局特征p′cls与每一个局部特征p′i进行拼接,进而得到拼接特征其表达式如下:S24, p′ cls in step S23 is used as the global feature, p′ 0 , p′ 1 , .... p′ n-1 are used as local features, and the global feature p′ cls is concatenated with each local feature p′ i to obtain the concatenated feature Its expression is as follows:

其中,i为每个局部特征的下标,取值范围为[0,N-1],全局特征p′cls与其自身拼接,共得到N+1个拼接特征;Among them, i is the subscript of each local feature, and its value range is [0, N-1]. The global feature p′ cls is concatenated with itself to obtain N+1 concatenated features in total;

S25、将步骤S24中得到的N+1个拼接特征记为再将其输入到另一个后接归一化层的多层感知机网络,计算特征的重要性分数向量S,其表达式如下:S25. Record the N+1 splicing features obtained in step S24 as Then input it into another multi-layer perceptron network followed by a normalization layer to calculate the importance score vector S of the feature, which is expressed as follows:

其中,MLP()表示多层感知机网络的函数,Softmax()表示归一化指数函数,将MLP的输出转化为[0,1]间的概率值;Among them, MLP() represents the function of the multi-layer perceptron network, and Softmax() represents the normalized exponential function, which converts the output of MLP into a probability value between [0,1];

S26、使用重要性分数向量S筛选出所有N+1个token中重要性排在前K位的token索引M,其表达式如下:S26. Use the importance score vector S to filter out the token index M with the top K importance among all N+1 tokens. The expression is as follows:

M∈{0,1}(N+1)*K M∈{0,1} (N+1)*K

其中,M中的每个元素都是一个one-hot指示器,取值从集合{0,1}中选取;Each element in M is a one-hot indicator, and its value is selected from the set {0, 1};

S27、使用步骤S26中矩阵M的转置与步骤S22中得到的token表示I进行矩阵乘法,得到给定翼型的最重要的K个翼型参数特征 S27, use the transpose of the matrix M in step S26 and the token representation I obtained in step S22 to perform matrix multiplication to obtain the most important K airfoil parameter features of the given airfoil

进一步地,所述步骤S3具体包含以下步骤:Furthermore, the step S3 specifically comprises the following steps:

S31、对于每个网格点坐标,计算其到翼型几何曲线的最短距离d,其表达式如下:S31. For each grid point coordinate, calculate the shortest distance d to the airfoil geometry curve, which is expressed as follows:

其中,(x,y)表示网格点的X轴坐标和Y轴坐标,表示翼型几何曲线上点的X轴坐标和Y轴坐标;Where (x, y) represents the X-axis coordinate and Y-axis coordinate of the grid point. Indicates the X-axis and Y-axis coordinates of a point on the airfoil geometry curve;

S32、构建参数融合网络,将每个网格点的横纵坐标、坐标到翼型几何边界的最短距离及归一化后的雷诺系数与攻角输入到一个多层感知机网络进行特征融合与升维,最终得到物理信息特征pphy,其表达式如下:S32. Construct a parameter fusion network, input the horizontal and vertical coordinates of each grid point, the shortest distance from the coordinate to the airfoil geometric boundary, and the normalized Reynolds coefficient and angle of attack into a multi-layer perceptron network for feature fusion and dimension upgrading, and finally obtain the physical information feature p phy , which is expressed as follows:

其中,分别表示归一化后的雷诺系数和攻角,D表示融合得到的物理信息特征的维度,与步骤S2中提取的每一个翼型特征维度保持一致。in, and They represent the normalized Reynolds coefficient and angle of attack respectively, and D represents the dimension of the fused physical information feature, which is consistent with the dimension of each airfoil feature extracted in step S2.

进一步地,所述步骤S4具体包含以下步骤:Furthermore, the step S4 specifically comprises the following steps:

S41、将重要性排名前K的翼型参数特征与物理信息特征pphy作为基于多层感知机的流场预测网络的输入,流场预测网络的输出为对应网格点坐标的流场数据,其表达式如下:S41. Rank the top K airfoil parameter features by importance The physical information feature p phy is used as the input of the flow field prediction network based on the multi-layer perceptron. The output of the flow field prediction network is the flow field data corresponding to the grid point coordinates, and its expression is as follows:

其中,fpredict()表示流场预测网络的函数,分别表示x方向速度分量、y方向速度分量和压力的预测值;Among them, f predict () represents the function of the flow field prediction network, and They represent the predicted values of the velocity component in the x direction, the velocity component in the y direction, and the pressure, respectively;

S42、对于流场预测网络,设计损失函数LossMLP表达式如下:S42. For the flow field prediction network, the loss function Loss MLP is designed as follows:

其中,N表示样本总数,ui,vi,pi表示x方向速度分量,y方向速度分量和压力的真实值;Where N represents the total number of samples, ui , vi , pi represent the true values of the x-direction velocity component, the y-direction velocity component and the pressure;

S43、在GPU服务器上训练模型,设置不同的模型参数和迭代步数进行多轮训练,选择在测试数据上预测误差最小的模型作为最终的流场预测模型。S43. Train the model on the GPU server, set different model parameters and iteration steps for multiple rounds of training, and select the model with the smallest prediction error on the test data as the final flow field prediction model.

进一步地,所述步骤S5具体方法如下:Furthermore, the specific method of step S5 is as follows:

使用训练好的上述流场预测模型,输入不同翼型特征与雷诺数、攻角信息,输出对应翼型和流动条件下翼型附近的压力场和速度场;使用处理软件进行流场数据可视化处理,以便进行翼型优化、气动性能分析、气动噪声预测等后续工作。Using the trained flow field prediction model, different airfoil characteristics, Reynolds number, and angle of attack information are input, and the pressure field and velocity field near the airfoil under the corresponding airfoil and flow conditions are output; the flow field data is visualized using processing software to facilitate subsequent work such as airfoil optimization, aerodynamic performance analysis, and aerodynamic noise prediction.

以上所述仅是本发明的实施方式,再次声明,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干改进,这些改进也列入本发明权利要求的保护范围内。The above description is only an implementation mode of the present invention. It is stated again that for ordinary technicians in this technical field, several improvements can be made to the present invention without departing from the principle of the present invention. These improvements are also included in the protection scope of the claims of the present invention.

Claims (6)

1. A flow field prediction method for selecting a transducer based on a token is characterized by comprising the following steps of: the method comprises the following steps:
S1, acquiring an airfoil shape dataset and a real flow field dataset;
S2, extracting geometrical parameters of the airfoil through a token selection transducer network;
s3, constructing a parameter fusion network fusion physical information characteristic;
s4, training a flow field prediction network based on a multi-layer perceptron;
S5, predicting a pressure field and a speed field on different wing profile data by using the trained flow field prediction model.
2. The token-based transform flow field prediction method of claim 1, wherein:
The step S1 specifically comprises the following steps:
s11, selecting a reference airfoil from a UIUC airfoil database, performing airfoil fitting by a non-uniform rational B-spline interpolation method, and selecting control points on an airfoil fitting curve as new x coordinates and y coordinates of the current airfoil;
S12, carrying out maximum and minimum normalization processing on all new airfoil coordinates in the step S11, wherein the expression is as follows:
Wherein x i、yi represents the coordinates of the current airfoil, x min、ymin is the global minimum, x max、ymax is the global maximum, and x j、yj is the normalized coordinates;
s13, generating an airfoil shape gray scale map according to the normalized coordinates, wherein the pixel point value on the airfoil geometric curve is 1, the pixel value not on the airfoil geometric curve is 0, and the pixel values at other positions are in the range of [0,1], so as to obtain an airfoil shape data set;
S14, dividing a calculation grid, and carrying out CFD solving on airfoil samples in the airfoil data set to obtain real data of different airfoil samples under different flow conditions, so as to form a real flow field data set.
3. The token-based transform flow field prediction method of claim 1, wherein:
the step S2 specifically includes the following steps:
s21, serializing the wing-shaped images in the obtained wing-shaped shape data set, dividing and flattening each wing-shaped image pic i in a block mode, and converting the wing-shaped images into a series of two-dimensional tokens p i,pici and p i as follows:
Wherein, Representing a real number set, H, W and C respectively representing the width, the height and the channel number of an original image, P representing the width and the height of a selected dividing block, and N=H×W/P 2 representing the number of divided two-dimensional tokens;
S22, adding a leachable embedding CLStoken in the acquired token sequence, keeping the dimension consistent with other token dimensions, and further obtaining a complete token sequence representation I of each airfoil image, wherein the specific expression is as follows:
wherein P cls represents CLS token, P 0,p1,...pn-1 represents N tokens obtained in the above, and d=p 2 ×c represents the token dimension;
S23, reducing the dimension of each token from D to I through a multi-layer perceptron network Obtaining I', wherein the specific expression is as follows:
S24, p 'cls in the step S23 is used as a global feature, p' 0,p′1,....p′n-1 is used as a local feature, and the global feature p 'cls and each local feature p' i are spliced to obtain a spliced feature The expression is as follows:
S25, marking the N+1 splicing characteristics obtained in the step S24 as And then inputting the importance score vector S to a multi-layer perceptron network of another subsequent normalization layer, and calculating the importance score vector S of the feature, wherein the expression is as follows:
Wherein, MLP () represents the function of the multi-layer perceptron network, softmax () represents the normalized exponential function, converting the output of MLP into a probability value between [0,1 ];
S26, screening out a token index M with the importance arranged in the front K bits in all N+1 tokens by using an importance score vector S, wherein the expression is as follows:
M∈{0,1}(N+1)*K
wherein each element in M is a one-hot indicator, and the value is selected from the set {0,1 };
S27, performing matrix multiplication on the transpose of the matrix M in the step S26 and the I to obtain the most important K airfoil parameter characteristics of the given airfoil
4. The token-based transform flow field prediction method of claim 1, wherein:
The step S3 specifically includes the following steps:
s31, calculating the shortest distance d between each grid point coordinate and the wing profile geometric curve, wherein the shortest distance d is expressed as follows:
Where (X, Y) denotes the X-axis coordinates and Y-axis coordinates of the grid points, X-axis coordinates and Y-axis coordinates representing points on the airfoil geometry;
S32, constructing a parameter fusion network, inputting the shortest distance from the abscissa and ordinate of each grid point to the geometrical boundary of the wing profile, the normalized Reynolds coefficient and attack angle into a multi-layer perceptron network for feature fusion and dimension ascending, and finally obtaining a physical information feature p phy, wherein the expression is as follows:
Wherein, AndAnd D represents the feature dimension of the physical information obtained by fusion and is consistent with each airfoil feature dimension extracted in the step S2.
5. The token-based transform flow field prediction method of claim 1, wherein:
the step S4 specifically includes the following steps:
S41, ranking the importance K airfoil parameter features The physical information characteristic p phy is used as the input of a flow field prediction network based on a multi-layer perceptron, the output of the flow field prediction network is flow field data corresponding to grid point coordinates, and the expression is as follows:
Where f predict () represents a function of the flow field prediction network, AndPredictive values respectively representing an x-direction velocity component, a y-direction velocity component, and a pressure;
S42, for a flow field prediction network, designing a Loss function Loss MLP expression as follows:
Where N represents the total number of samples, u i,vi,pi represents the x-direction velocity component, the y-direction velocity component and the true value of pressure;
S43, training a model on the GPU server, setting different model parameters and iteration steps to perform multi-round training, and selecting a model with the minimum prediction error on test data as a final flow field prediction model.
6. The token-based transform flow field prediction method of claim 1, wherein:
the specific method of the step S5 is as follows:
Using the trained flow field prediction model, inputting different airfoil characteristics, reynolds number and attack angle information, and outputting a pressure field and a velocity field near the airfoil under the corresponding airfoil and flow conditions; and using processing software to perform flow field data visualization processing.
CN202410350715.3A 2024-03-26 2024-03-26 A flow field prediction method based on token selection Transformer Active CN118395886B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410350715.3A CN118395886B (en) 2024-03-26 2024-03-26 A flow field prediction method based on token selection Transformer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410350715.3A CN118395886B (en) 2024-03-26 2024-03-26 A flow field prediction method based on token selection Transformer

Publications (2)

Publication Number Publication Date
CN118395886A true CN118395886A (en) 2024-07-26
CN118395886B CN118395886B (en) 2025-02-25

Family

ID=91993283

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410350715.3A Active CN118395886B (en) 2024-03-26 2024-03-26 A flow field prediction method based on token selection Transformer

Country Status (1)

Country Link
CN (1) CN118395886B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119150747A (en) * 2024-11-14 2024-12-17 齐鲁理工学院 Semi-supervised learning flow field prediction method based on Gaussian mixture model

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113887610A (en) * 2021-09-29 2022-01-04 内蒙古工业大学 Pollen Image Classification Method Based on Cross-Attention Distillation Transformer
CN115795683A (en) * 2022-12-08 2023-03-14 四川大学 An airfoil optimization method combining CNN and Swin Transformer network
CN116680988A (en) * 2023-06-21 2023-09-01 南京大学 A Prediction Method of Porous Media Permeability Based on Transformer Network
CN117540489A (en) * 2023-11-13 2024-02-09 重庆大学 An airfoil aerodynamic data calculation method and system based on multi-task learning

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113887610A (en) * 2021-09-29 2022-01-04 内蒙古工业大学 Pollen Image Classification Method Based on Cross-Attention Distillation Transformer
CN115795683A (en) * 2022-12-08 2023-03-14 四川大学 An airfoil optimization method combining CNN and Swin Transformer network
CN116680988A (en) * 2023-06-21 2023-09-01 南京大学 A Prediction Method of Porous Media Permeability Based on Transformer Network
CN117540489A (en) * 2023-11-13 2024-02-09 重庆大学 An airfoil aerodynamic data calculation method and system based on multi-task learning

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
占哲琦;陈鹏;桑永胜;彭德中;: "融合双注意力的深度神经网络在无人机目标检测中的应用", 现代计算机, no. 11, 15 April 2020 (2020-04-15) *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119150747A (en) * 2024-11-14 2024-12-17 齐鲁理工学院 Semi-supervised learning flow field prediction method based on Gaussian mixture model

Also Published As

Publication number Publication date
CN118395886B (en) 2025-02-25

Similar Documents

Publication Publication Date Title
CN113378736B (en) Semi-supervised semantic segmentation of remote sensing images based on transformation consistency regularization
CN113627093B (en) Underwater mechanism trans-scale flow field characteristic prediction method based on improved Unet network
CN115438584B (en) A method for predicting airfoil aerodynamic force based on deep learning
CN114638048A (en) Three-dimensional spray pipe flow field rapid prediction and sensitivity parameter analysis method and device
Chen et al. MVE-Net: An automatic 3-D structured mesh validity evaluation framework using deep neural networks
CN118350292B (en) Airfoil flow field prediction network training method, network, prediction method and medium
CN112418235A (en) Point cloud semantic segmentation method based on expansion nearest neighbor feature enhancement
CN119066937A (en) Method and system for calculating mold structure strength based on digital design
CN118395886B (en) A flow field prediction method based on token selection Transformer
CN116628854A (en) Wing section aerodynamic characteristic prediction method, system, electronic equipment and storage medium
CN118886360A (en) A method for constructing aerodynamic shape characteristics of three-dimensional aircraft and predicting aerodynamic forces based on cross-sectional area
Zhu et al. Fast and high-precision compressible flowfield inference method of transonic airfoils based on attention UNet
CN118097162A (en) Optimization of cloth simulation filtering algorithm based on PointNet++ network model
Ma et al. Efficient aerodynamic shape optimization by using unsupervised manifold learning to filter geometric features
CN114693932A (en) Large aircraft large component point cloud semantic segmentation method
CN117634365B (en) Airplane aerodynamic force prediction method, electronic equipment and storage medium
Zhao et al. Visual explainable convolutional neural network for aerodynamic coefficient prediction
CN117809038A (en) 3D point cloud semantic segmentation method based on boundary perception and multi-scale feature fusion
CN116958553A (en) Lightweight plant point cloud segmentation method based on parameter-free attention and point-level convolution
CN113627073A (en) Underwater vehicle flow field result prediction method based on improved Unet + + network
CN118332684B (en) Flow field prediction method based on dense convolution network
CN119337510B (en) Intelligent reconstruction method for aerodynamic characteristics of aircraft based on multi-source data fusion
CN113761813B (en) Dynamic Capacity Prediction Method of Transmission Lines Based on Fluid Mechanics and Meteorological Data
CN119830797A (en) Method for predicting store release separation track based on small sample size
CN118133707A (en) A neural network multi-precision flow field modeling method integrating boundary and physical constraints

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant