Vision Transformer-based flow field prediction model training method and device, computer device, and storage medium
By using a flow field prediction model based on Vision Transformer, the problem of high computational resource and time costs of RANS models is solved, and the efficiency and accuracy of flow field simulation are improved, especially the prediction of flow field on blade surfaces.
Patent Information
- Application Number
- CN202510411648.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2045-04-02
AI Technical Summary
Existing technologies, when simulating the flow field of compressor blades in aero-engines, suffer from high computational resource and time costs for RANS models, and low accuracy of convolutional networks in predicting the flow field in the shock wave region and the blade boundary layer.
A flow field prediction model based on Vision Transformer is adopted. By constructing a feature encoding layer, a linear projection layer, an encoding layer, and a decoding layer, the grid nodes are encoded using the positional relationship between the grid nodes and the blades, which enhances the model's perception of the blade surface and improves the model's performance in predicting the flow field on the blade surface.
It improves the efficiency of flow field simulation, enhances the model's prediction accuracy of the flow field on the blade surface, and reduces computational costs.
Smart Images

Figure CN120430343B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of aero-engines, and in particular to a method, apparatus, computer equipment, and storage medium for training a flow field prediction model based on Vision Transformer. Background Technology
[0002] Compressor blades are a critical component in modern aero-engine design, significantly impacting engine aerodynamic performance, including compression efficiency, total pressure loss, and stall behavior. To optimize the aerodynamic characteristics of compressor blades, the engineering design process typically involves multiple numerical simulations of the designed blades.
[0003] In related technologies, solving the Reynolds-Averaged Navier-Stokes (RANS) equations is the primary method for simulating complex airflow behavior. However, applying RANS models requires significant computational resources and time, especially when dealing with hypersonic flow fields such as those of supercritical airfoils, resulting in extremely high simulation costs and severely impacting design cycles. To improve the simulation efficiency of RANS models, neural networks can be used to predict the flow field. However, if only convolutional network architectures are used for flow field prediction, the neural networks will struggle to accurately predict the characteristics of special regions such as the shock wave region, the blade boundary layer flow field, and the wake region, resulting in low prediction accuracy. Therefore, a flow field simulation method that can improve simulation efficiency while maintaining accuracy is needed. Summary of the Invention
[0004] Therefore, it is necessary to provide a method, apparatus, computer equipment, and storage medium for training a flow field prediction model based on Vision Transformer to address the aforementioned technical problems.
[0005] Firstly, this application provides a method for training a flow field prediction model based on Vision Transformer. The flow field prediction model is built based on Vision Transformer and includes a feature encoding layer, a linear projection layer, an encoding layer, and a decoding layer. The method includes:
[0006] Construct the mesh data of the target blade cascade, and generate the simulation flow field data corresponding to the target blade cascade based on the mesh data and operating conditions;
[0007] Based on the positional relationship between each grid node in the grid data and the blade in the target cascade, the coordinates of each grid node are encoded to obtain coordinate codes;
[0008] The coordinate codes of each grid node and the operating conditions are input into the flow field prediction model. The coordinate codes and operating conditions are segmented by the feature encoding layer to obtain multiple feature data blocks. The feature data blocks are then adjusted in dimension by the linear projection layer to obtain one-dimensional features corresponding to each feature data block. The one-dimensional features and the position codes of each feature data block are concatenated to obtain a one-dimensional feature sequence.
[0009] The one-dimensional feature sequence is processed sequentially by the encoding layer and the decoding layer to obtain the predicted flow field data. The flow field prediction model is then adjusted based on the difference between the predicted flow field data and the simulated flow field data to obtain a trained flow field prediction model.
[0010] In one embodiment, the process of encoding the coordinates of each grid node based on the positional relationship between each grid node in the grid data and the blades in the target cascade channel to obtain coordinate encoding includes:
[0011] For any of the aforementioned grid nodes, the positional relationship parameters corresponding to the grid node are determined based on the positional relationship between the grid node and the blades in the target cascade channel, and the coordinate code of the grid node is determined based on the positional relationship parameters and the coordinates of the grid node.
[0012] The value of the positional relationship parameter exhibits an exponential decay relationship with the value of the sign distance function in the range of 0 to 1. When the grid node is located inside the blade in the target cascade, the sign distance function is negative, and when the grid node is located outside the blade in the target cascade channel, the sign distance function is positive.
[0013] In one embodiment, determining the coordinate code of the grid node based on the positional relationship parameter and the coordinates of the grid node includes:
[0014] Determine the wall distance between each of the grid nodes and the surface of the blade in the target cascade;
[0015] The encoding function is applied to the wall distance to obtain the encoding function value, and the product of the encoding function value and the coordinates of the grid node is used as the coordinate encoding.
[0016] In one embodiment, the mesh data is structured mesh data, and the step of generating simulated flow field data corresponding to the target cascade based on the mesh data and operating conditions includes:
[0017] Construct unstructured mesh data of the target cascade, and simulate the original simulated flow field data corresponding to the target cascade based on the operating conditions and the unstructured mesh data;
[0018] Based on the coordinates of each grid node in the unstructured grid data, the coordinates of each grid node in the structured grid data, and the original simulated flow field data corresponding to each grid node in the unstructured grid, interpolation is performed to obtain the interpolated flow field data corresponding to each grid node in the structured grid data.
[0019] The interpolated flow field data corresponding to each grid node of the structured grid data is used as the simulation flow field data corresponding to the target cascade.
[0020] In one embodiment, adjusting the flow field prediction model based on the difference between the predicted flow field data and the simulated flow field data to obtain a trained flow field prediction model includes:
[0021] A first loss value is determined based on the average absolute error between the predicted flow field data and the simulated flow field data, and a second loss value is determined based on the gradient difference between the predicted flow field data and the simulated flow field data.
[0022] The predicted flow field data and the simulated flow field data are converted into discrete wavelets respectively, and a third loss value is determined based on the difference between the discrete wavelets of the predicted flow field data and the discrete wavelets of the predicted flow field data.
[0023] A fourth loss value is determined based on the difference between the predicted flow field data and the simulated flow field data of the surface regions of each blade in the target blade cascade. A fifth loss value is determined based on the difference between the predicted flow field data and the simulated flow field data of the bottom boundary region and the top boundary region of the target blade cascade. The fifth loss value is used to characterize the periodic constraint loss.
[0024] A target loss value is determined based on the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value. The flow field prediction model is then adjusted based on the target loss value to obtain a trained flow field prediction model.
[0025] Secondly, this application also provides a flow field prediction method based on Vision Transformer. The method includes:
[0026] Construct the mesh data of the target blade cascade and obtain the operating conditions of the target blade cascade;
[0027] Based on the positional relationship between each grid node in the grid data and the blade in the target cascade channel, the coordinates of each grid node are encoded to obtain coordinate codes;
[0028] The coordinate codes of each grid node and the operating conditions are input into the flow field prediction model to obtain the predicted flow field data.
[0029] The flow field prediction model is obtained by training the method described in any of the foregoing embodiments.
[0030] Thirdly, this application also provides a training device for a flow field prediction model based on Vision Transformer. The flow field prediction model is built based on Vision Transformer and includes a feature encoding layer, a linear projection layer, an encoding layer, and a decoding layer. The device includes:
[0031] The construction module is used to construct the mesh data of the target blade cascade and generate the simulation flow field data corresponding to the target blade cascade based on the mesh data and operating conditions.
[0032] The encoding module is used to encode the coordinates of each grid node based on the positional relationship between each grid node in the grid data and each blade in the target cascade, to obtain coordinate codes;
[0033] The input module is used to input the coordinate codes of each grid node and the operating conditions into the flow field prediction model. The coordinate codes and operating conditions are segmented by the feature encoding layer to obtain multiple feature data blocks. The feature data blocks are then adjusted in dimension by the linear projection layer to obtain one-dimensional features corresponding to each feature data block. The one-dimensional features and the position codes of each feature data block are concatenated to obtain a one-dimensional feature sequence.
[0034] The training module is used to sequentially extract features from the one-dimensional feature sequence through the encoding layer and the decoding layer to obtain predicted flow field data, and to adjust the data according to the difference between the predicted flow field data and the simulated flow field data to obtain a trained flow field prediction model.
[0035] In one embodiment, the encoding module is further configured to:
[0036] For any of the aforementioned grid nodes, the positional relationship parameters corresponding to the grid node are determined based on the positional relationship between the grid node and the blades in the target cascade channel, and the coordinate code of the grid node is determined based on the positional relationship parameters and the coordinates of the grid node.
[0037] The value of the positional relationship parameter exhibits an exponential decay relationship with the value of the sign distance function in the range of 0 to 1. When the grid node is located inside the blade in the target cascade, the sign distance function is negative, and when the grid node is located outside the blade in the target cascade channel, the sign distance function is positive.
[0038] In one embodiment, the encoding module is further configured to:
[0039] Determine the wall distance between each of the grid nodes and the surface of the blade in the target cascade;
[0040] The encoding function is applied to the wall distance to obtain the encoding function value, and the product of the encoding function value and the coordinates of the grid node is used as the coordinate encoding.
[0041] In one embodiment, the grid data is structured grid data, and the construction module is further configured to:
[0042] Construct unstructured mesh data of the target cascade, and simulate the original simulated flow field data corresponding to the target cascade based on the operating conditions and the unstructured mesh data;
[0043] Based on the coordinates of each grid node in the unstructured grid data, the coordinates of each grid node in the structured grid data, and the original simulated flow field data corresponding to each grid node in the unstructured grid, interpolation is performed to obtain the interpolated flow field data corresponding to each grid node in the structured grid data.
[0044] The interpolated flow field data corresponding to each grid node of the structured grid data is used as the simulation flow field data corresponding to the target cascade.
[0045] In one embodiment, the training module is further configured to:
[0046] A first loss value is determined based on the average absolute error between the predicted flow field data and the simulated flow field data, and a second loss value is determined based on the gradient difference between the predicted flow field data and the simulated flow field data.
[0047] The predicted flow field data and the simulated flow field data are converted into discrete wavelets respectively, and a third loss value is determined based on the difference between the discrete wavelets of the predicted flow field data and the discrete wavelets of the predicted flow field data.
[0048] A fourth loss value is determined based on the difference between the predicted flow field data and the simulated flow field data of the surface regions of each blade in the target blade cascade. A fifth loss value is determined based on the difference between the predicted flow field data and the simulated flow field data of the bottom boundary region and the top boundary region of the target blade cascade. The fifth loss value is used to characterize the periodic constraint loss.
[0049] A target loss value is determined based on the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value. The model is then adjusted based on the target loss value to obtain a trained flow field prediction model.
[0050] Fourthly, this application also provides a flow field prediction device based on Vision Transformer, the device comprising:
[0051] The construction module is used to construct the mesh data of the target blade cascade and obtain the operating conditions of the target blade cascade.
[0052] The encoding module is used to encode the coordinates of each grid node based on the positional relationship between each grid node in the grid data and each blade in the target cascade, to obtain coordinate codes;
[0053] The input module is used to input the coordinate codes of each grid node and the operating conditions into the flow field prediction model to obtain the predicted flow field data.
[0054] The flow field prediction model is obtained by training the method described in any of the foregoing embodiments.
[0055] Fifthly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement any of the methods described above.
[0056] Sixthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements any of the above methods.
[0057] Seventhly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements any of the methods described above.
[0058] The aforementioned method, apparatus, computer equipment, and storage medium for training flow field prediction models based on Vision Transformer apply the Vision Transformer architecture to flow field prediction. Since Vision Transformer is suitable for processing data with long-range dependencies, and there are numerous dependencies between different parts of the flow field, and the model capacity of the Transformer-based model architecture can be designed to be large, using Vision Transformer to build flow field prediction models results in better model performance. Furthermore, it significantly improves flow field simulation efficiency compared to using RANS models to solve the flow field. To apply Vision Transformer to flow field prediction tasks, this embodiment adds a decoding layer to the original Vision Transformer. Moreover, to enhance the model's perception of the blade surface, this embodiment encodes the coordinates of the grid nodes using the positional relationship between the grid nodes and the blades. This coordinate encoding is then used as input data for the flow field prediction model, further enhancing the model's performance in predicting the flow field on the blade surface and improving the model's prediction accuracy. Attached Figure Description
[0059] Figure 1 This is a flowchart illustrating a flow field prediction model training method based on Vision Transformer in one embodiment.
[0060] Figure 2 This is a schematic diagram of a flow field prediction model based on Vision Transformer in one embodiment;
[0061] Figure 3 This is a flowchart illustrating step 104 in one embodiment;
[0062] Figure 4 This is a flowchart illustrating step 102 in one embodiment;
[0063] Figure 5 This is a flowchart illustrating step 108 in one embodiment;
[0064] Figure 6 This is a flowchart illustrating a flow field prediction method based on Vision Transformer in one embodiment.
[0065] Figure 7 This is a structural block diagram of a flow field prediction model training device based on Vision Transformer in one embodiment.
[0066] Figure 8This is a structural block diagram of a flow field prediction device based on Vision Transformer in one embodiment;
[0067] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0068] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0069] In one embodiment, such as Figure 1 As shown, a method for training a flow field prediction model based on Vision Transformer is provided. This embodiment illustrates the method by applying it to a server. It is understood that this method can also be applied to a terminal, or to a system including both a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0070] Step 102: Construct the mesh data of the target blade cascade, and generate the simulation flow field data corresponding to the target blade cascade based on the mesh data and operating conditions.
[0071] In this embodiment, the target cascade is the cascade used to generate model training samples. To ensure that the trained model is applicable to flow field prediction for different airfoils, as many airfoils as possible can be used as target cascades. Operating conditions are the relevant parameters that determine the steady-state flow field within the target cascade, and may include the velocity and angle at the inlet boundary of the target cascade, etc.
[0072] After acquiring the target blade cascade, its mesh data can be generated to represent the distribution and morphology of the blades within the cascade. The mesh data and operating conditions can then be input into flow field simulation software. The software calculates the final steady-state flow field, where the flow field parameters at each grid node converge to a constant value under given operating conditions. This application does not specifically limit the flow field simulation software used; any flow field simulation software is applicable to these embodiments.
[0073] Step 104: Based on the positional relationship between each grid node in the grid data and each blade in the target cascade, the coordinates of each grid node are encoded to obtain coordinate codes.
[0074] In this embodiment of the application, to enhance the neural network's perception of the blade surface and improve the accuracy of flow field prediction in the vicinity of the blade surface, the coordinates of the grid nodes can be encoded based on the positional relationship between the grid nodes and the blade. The positional relationship may include whether the grid node is located inside or outside the blade, the distance between the grid node and the blade surface, etc.
[0075] In one example, positional relationship parameters can be generated based on the relative positions of the grid nodes and the blade. Multiplying these parameters by the coordinates of the grid nodes yields the coordinate encoding. The signed distance function can simultaneously characterize whether a grid node is located inside or outside the blade, as well as the distance between the grid node and the blade surface. For example, the sign of the signed distance function can represent whether the grid node is inside or outside the blade, and the absolute value of the signed distance function can represent the distance between the grid node and the blade surface. That is, if the grid node is located outside the blade and the distance between it and the blade surface (defined here as the straight-line distance between the grid node and the nearest blade surface) is 'a', the positional relationship parameter can be set to +a; if the grid node is located inside the blade and the distance between it and the blade surface is 'b', the positional relationship parameter can be set to -b.
[0076] The encoding function can be applied to the wall distance to obtain the encoding function value, i.e., the positional relationship parameter. This parameter's value is set to be in the range of 0 to 1, exhibiting an exponential decay relationship with the magnitude of the signed distance function. Therefore, as a grid node approaches the wall, the positional relationship parameter value gradually approaches 1. This change effectively characterizes the spatial features near the wall and allows for scale adjustment of wall information, thereby improving the spatial resolution of the wall region. After obtaining the positional relationship parameter, it can be concatenated with the grid node's coordinates to obtain the coordinate encoding. For example, the positional relationship parameter can be generated based on the positional relationship between the grid node and the blade. Multiplying the positional relationship parameter by the grid node's coordinates yields the coordinate encoding. That is, when the positional relationship parameter is 'a', the grid node is a two-dimensional grid node with coordinates (x, y), the resulting coordinate encoding can be (ax, ay).
[0077] Step 106: Input the coordinate codes and operating conditions of each grid node into the flow field prediction model. The coordinate codes and operating conditions are segmented through the feature coding layer to obtain multiple feature data blocks. The feature data blocks are then dimensionally adjusted through the linear projection layer to obtain one-dimensional features corresponding to each feature data block. The one-dimensional features are then concatenated with the position codes of each feature data block to obtain a one-dimensional feature sequence.
[0078] In this embodiment, coordinate encoding and operating conditions are used as inputs to the flow field prediction model. The flow field prediction model is built based on Vision Transformer and includes a feature encoding layer, a linear projection layer, an encoding layer, and a decoding layer. Vision Transformer is a model that applies the Transformer architecture from natural language processing to image processing tasks. Because Vision Transformer can use a self-attention mechanism to integrate a large amount of global information and establish long-range relationships, it has advantages in handling long-range dependencies. Since there are many dependencies between different parts of the flow field, using Vision Transformer to build a flow field prediction model can make the trained model perform better. Since the original Vision Transformer is used for classification tasks and cannot be directly applied to the regression task of flow field prediction, this embodiment replaces the classifier (multilayer perceptron) in the original Vision Transformer with a decoding layer. The decoding layer processes the information output by the encoding layer to obtain the predicted flow field data.
[0079] Since the Transformer receives one-dimensional feature input, the original Vision Transformer flattens the image data blocks and converts them into a one-dimensional feature embedding sequence through linear projection after receiving the input image. In this embodiment, because the data input to the flow field prediction model has a high dimension, this embodiment requires an additional step of shaping the coordinate encoding and operating conditions to two dimensions, and then further projecting the obtained feature data blocks to one dimension through linear projection.
[0080] The dimension of the data input to the Vision Transformer is the sum of the dimension of the coordinate encoding of the grid nodes and the dimension of the operating conditions. A feature encoding layer can be set in the Vision Transformer to reduce the dimensionality of the coordinate encoding and operating conditions. This feature encoding layer can use any dimensionality reduction algorithm to reduce the dimensionality of the coordinate encoding and operating conditions, or it can be set as a trainable convolutional network to reduce the dimensionality of the coordinate encoding and operating conditions. Then, by using the method of segmenting two-dimensional data into small blocks in the Vision Transformer, the dimensionality-reduced data can be divided into multiple small blocks, resulting in multiple feature data blocks. These feature data blocks can then be flattened to one dimension using a linear projection layer, and a one-dimensional feature sequence is obtained by concatenating the positional encoding of each feature data block and the one-dimensional features of each feature data block.
[0081] Step 108: The one-dimensional feature sequence is processed by sequentially through the encoding and decoding layers to obtain the predicted flow field data. The flow field prediction model is then adjusted based on the difference between the predicted flow field data and the simulated flow field data to obtain the trained flow field prediction model.
[0082] In this embodiment, a one-dimensional feature sequence can be input into an encoding layer built on a Transformer architecture, where the encoding layer extracts the effective features from the one-dimensional feature sequence. These effective features are then input into a decoder, which generates predicted flow field data for each grid node of the grid data based on these effective features.
[0083] For details on the construction of the flow field prediction model, please refer to Figure 2 As shown, both the encoder and decoder incorporate a Transformer mechanism consisting of an attention mechanism and a feedforward neural network. Each Transformer alternates between multi-head self-attention blocks and multi-layer perceptron blocks, with layer normalization and residual connections applied before and after each block, respectively. The decoder's output is further fed into a predictor, which generates an output sequence of the same size as the two-dimensional flattened feature sequence. The flattened feature sequence is then reconstructed into predicted flow field data through the inverse operation of the flattening operation. The resolution of the predicted flow field data should be the same as that of the grid data.
[0084] After obtaining the predicted flow field data, the model loss can be calculated based on the difference between the predicted flow field data and the simulated flow field data. For each grid node, both the simulated and predicted flow field data can be obtained, and the loss for each grid node can be calculated. Then, the losses for each grid node are summed to obtain the model loss. This application does not specifically limit the method of loss calculation; any loss function is applicable to this application.
[0085] The flow field prediction model training method based on Vision Transformer provided in this application applies the Vision Transformer architecture to flow field prediction. Since Vision Transformer is suitable for processing data with long-range dependencies, and there are numerous dependencies between different parts of the flow field, using Vision Transformer to build the flow field prediction model results in a better-performing model. Furthermore, it significantly improves flow field prediction efficiency compared to using RANS models to solve the flow field. To apply Vision Transformer to flow field prediction tasks, this application adds a decoding layer to the original Vision Transformer. Moreover, to enhance the model's perception of the blade surface, this application encodes the coordinates of the grid nodes using the positional relationship between the grid nodes and the blades. This coordinate encoding is then used as input data for the flow field prediction model, further enhancing the model's performance in predicting the flow field on the blade surface and improving the model's prediction accuracy.
[0086] In one embodiment, in step 104, based on the positional relationship between each grid node in the grid data and each blade in the target cascade, the coordinates of each grid node are encoded to obtain coordinate codes, including:
[0087] For any given grid node, determine the positional relationship parameters of the grid node based on its positional relationship with the blades in the target cascade channel, and determine the coordinate code of the grid node based on the positional relationship parameters and the coordinates of the grid node.
[0088] Among them, the value of the positional relationship parameter has an exponential decay relationship with the value of the sign distance function in the interval of 0 to 1. When the grid node is located inside the blade in the target blade cascade, the sign distance function is negative, and when the grid node is located outside the blade in the target blade cascade channel, the sign distance function is positive.
[0089] In this embodiment, a signed distance function can be used to characterize whether a grid node is located inside or outside the blade. When a grid node is inside the blade, the signed distance function can be negative. When a grid node is outside the blade, the signed distance function can be positive. Furthermore, an encoding function can be applied to the wall distance to obtain the encoding function value, i.e., the positional relationship parameter, so that the value of the positional relationship parameter is in the range of 0 to 1, exhibiting an exponential decay relationship with the value of the signed distance function. As a grid node approaches the wall, the value of the positional relationship parameter gradually approaches 1. This change can effectively characterize the spatial features near the wall and achieve scale adjustment of wall information, thereby improving the spatial resolution of the wall region.
[0090] Furthermore, the coordinate encoding of the grid nodes can be obtained by multiplying the positional relationship parameters with the coordinates of the grid nodes. Encoding the coordinates in this way ensures that the coordinates of grid nodes located near the blade surface differ significantly from the coordinates of other grid nodes, thus enhancing the model's perception of the blade surface.
[0091] In one embodiment, such as Figure 3 As shown, in step 104, the coordinate encoding of the grid node is determined based on the positional relationship parameters and the coordinates of the grid node, including:
[0092] Step 302: Determine the wall distance between each grid node and the surface of the blade in the target blade cascade;
[0093] Step 304: Apply the encoding function to the wall distance to obtain the encoding function value, and use the product of the encoding function value and the coordinates of the grid node as the coordinate encoding.
[0094] In this embodiment of the application, the coordinate code is obtained based on the wall distance, so that the coordinate code can also include information on the wall distance between the grid node and the blade surface (that is, the straight-line distance between the grid node and the nearest blade surface).
[0095] After processing the wall distance using the encoding function, the encoding function value can be obtained. Multiplying this value by the coordinates of the grid nodes yields the coordinate encoding. Using the grid node coordinates as two-dimensional coordinates, the encoding function is e. -x For example, the final coordinate code is (e -σ x, e -σ y). Where σ is the value of the symbolic distance function.
[0096] In one embodiment, the grid data is structured grid data, such as... Figure 4 As shown, in step 102, based on the grid data and operating conditions, the simulated flow field data corresponding to the target cascade is generated, including:
[0097] Step 402: Construct unstructured mesh data of the target blade cascade, and simulate the flow field data corresponding to the target blade cascade based on the operating conditions and unstructured mesh data;
[0098] Step 404: Based on the coordinates of each grid node in the unstructured grid data, the coordinates of each grid node in the grid data, and the original simulated flow field data corresponding to each grid node in the unstructured grid, interpolate to obtain the simulated flow field data corresponding to each grid node in the grid data.
[0099] Step 406: Use the simulated flow field data corresponding to each grid node of the grid data as the simulated flow field data corresponding to the target cascade.
[0100] In this embodiment, to improve the prediction speed of the model and facilitate the model's reference to the positional relationships between each grid node and other grid nodes during prediction, and considering that the model is more suitable for structured grid data, the grid data of the target cascade can be constructed using a structured grid. However, since unstructured grids can better simulate complex structures compared to structured grids, the flow field simulation effect on structured grids is not as good as that on unstructured grids. To solve the problem of insufficient flow field simulation accuracy, unstructured grid data and structured grid data can be constructed separately for the target cascade. Then, flow field simulation is first performed on the unstructured grid data, and then the simulated flow field data on each grid node of the structured grid data is obtained by interpolation.
[0101] This application does not specifically limit the interpolation method; any interpolation algorithm is applicable to this application. For example, the relationship between the coordinates and the simulated flow field data can be fitted based on the coordinates of each grid node in the unstructured grid data and the simulated flow field data. Then, the simulated flow field data corresponding to each grid node can be calculated based on the coordinates of each grid node in the structured grid data. Alternatively, for each grid node in the structured grid data, one or more grid nodes in the unstructured grid data that are closest to that grid node can be obtained. Based on the simulated flow field data corresponding to these grid nodes, the simulated flow field data of that grid node can be obtained using linear interpolation, spline interpolation, or other methods.
[0102] In one embodiment, such as Figure 5 As shown, in step 108, the flow field prediction model is adjusted based on the difference between the predicted flow field data and the simulated flow field data to obtain a trained flow field prediction model, including:
[0103] Step 502: Determine the first loss value based on the average absolute error between the predicted flow field data and the simulated flow field data, and determine the second loss value based on the gradient difference between the predicted flow field data and the simulated flow field data.
[0104] Step 504: Convert the predicted flow field data and the simulated flow field data into discrete wavelets respectively, and determine the third loss value based on the difference between the discrete wavelets of the predicted flow field data and the discrete wavelets of the simulated flow field data.
[0105] Step 506: Determine the fourth loss value based on the difference between the predicted flow field data and the simulated flow field data of the surface areas of each blade in the target blade cascade; determine the fifth loss value based on the difference between the predicted flow field data and the simulated flow field data of the bottom and top areas of the target blade cascade; the fifth loss value is used to characterize the periodic constraint loss.
[0106] Step 508: Determine the target loss value based on the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value; adjust the flow field prediction model based on the target loss value to obtain the trained flow field prediction model.
[0107] In this embodiment, to improve the prediction accuracy of the flow field prediction model for the shock wave region, it is necessary to enhance the flow field prediction model's perception of the difference between the gradient of the predicted flow field data and the gradient of the simulated flow field data. Therefore, in addition to calculating the first loss value based on the mean absolute error of the predicted and simulated flow field data, a second loss value can also be calculated based on the gradient difference between the predicted and simulated flow field data. Simultaneously, to enhance the flow field prediction model's perception of high-frequency components in the flow field, the predicted and simulated flow field data can be converted into discrete wavelets of different frequencies using multi-level wavelet transform. The difference between the frequencies of the predicted and simulated flow field data in the frequency domain is then calculated to obtain a third loss value.
[0108] Furthermore, due to the unique morphology of the flow field on the blade surface, it is necessary to enhance the flow field prediction model's perception of the flow field in the blade surface region. This can be achieved by obtaining individual grid nodes located in the blade surface region from the grid data (located in the blade surface region can be defined as the distance between the grid node and its wall being less than a preset threshold), and determining a fourth loss value based on the difference between the predicted flow field data and the simulated flow field data corresponding to these grid nodes.
[0109] Since the compressor blade cascade is obtained by truncating a cylindrical surface into a cylindrical section, then cutting off and flattening this section at a certain point, the top and bottom boundaries of the cascade essentially represent the same location within the compressor. To enhance the flow field prediction model's perception of this specific region, grid nodes located in the top and bottom boundary regions can be further extracted from the grid data. A fifth loss value is determined based on the difference between the predicted and simulated flow field data for the target cascade's bottom and top boundary regions. This fifth loss value, also known as the periodic constraint loss, is used to constrain the periodic characteristics of the nodes at the aforementioned top and bottom boundaries.
[0110] Each loss value is assigned a weight, and the target loss value is obtained by weighted summation of the loss values. This is illustrated in Formula (I).
[0111] Formula (1)
[0112] in, For the target loss value, The weights for the first loss value, The first loss value is calculated using the Mean Absolute Error (MAE). The specific formula for calculating the first loss value is given in Formula (II):
[0113] Formula (II)
[0114] Where N is the total number of training samples in this batch. To predict flow field data, This is for simulating flow field data.
[0115] The weights for the second loss value, The second loss value is calculated using formula (III).
[0116] Formula (3)
[0117] in, This represents the predicted number of channels (including pressure, velocity components, and degree), where H and W are the resolutions of the grid data in the height and width directions, respectively, i.e., the number of grid nodes in the height and width directions. This represents the simulated flow field data for the i-th grid node in the height direction and the j-th grid node in the width direction within channel n. Similarly... For the nth channel, the predicted flow field data corresponds to the i-th grid node in the height direction and the j-th grid node in the width direction.
[0118] The weight of the third loss value, The third loss value, where The total number of wavelet transforms. This represents the loss corresponding to the k-th level wavelet transform. The weights are the weights corresponding to the k-th level wavelet transform. The specific calculation method is shown in Formula (IV):
[0119] Formula (IV)
[0120] in, This indicates that a discrete wavelet transform operation is being performed. These are the high-frequency components after discrete wavelet transform. It represents the low-frequency component after k-1 level discrete wavelet transform.
[0121] The weight of the fourth loss value, This is the fourth loss value. The weight of the fifth loss value, This is the fifth loss value. Both the fourth and fifth loss values can be calculated using the mean absolute error of the predicted and simulated flow field data for the corresponding region.
[0122] In one embodiment, such as Figure 6 As shown, a flow field prediction method based on Vision Transformer is provided, including:
[0123] Step 602: Construct the mesh data of the target blade cascade and obtain the operating conditions of the target blade cascade;
[0124] Step 604: Based on the positional relationship between each grid node in the grid data and the blades in the target cascade channel, the coordinates of each grid node are encoded to obtain coordinate codes;
[0125] Step 606: Input the coordinate codes and operating conditions of each grid node into the flow field prediction model to obtain the predicted flow field data;
[0126] The flow field prediction model is trained using the method described in any of the aforementioned embodiments.
[0127] In this embodiment, during practical application, grid data of the target cascade for which flow field data needs to be predicted can be constructed, and the operating conditions that generate the flow field in the target cascade can be obtained. Then, the coordinates of the grid nodes are encoded in the manner described in the aforementioned embodiment. The encoded coordinates and operating conditions are input into the trained flow field prediction model to obtain the predicted flow field data of the target cascade.
[0128] The flow field prediction method based on Vision Transformer provided in this application uses a flow field prediction model based on the Vision Transformer architecture for flow field prediction. Since Vision Transformer is suitable for processing data with long-range dependencies, and there are numerous dependencies between different parts of the flow field, using Vision Transformer to build the flow field prediction model results in a better-performing model. Furthermore, compared to using a RANS model to solve the flow field, it significantly improves the efficiency of flow field simulation. To enhance the model's perception of the blade surface, this application encodes the coordinates of the grid nodes using the positional relationship between the grid nodes and the blade. These coordinate codes are then used as input data for the flow field prediction model, further enhancing the model's performance in predicting the flow field on the blade surface and improving the model's prediction accuracy.
[0129] In one embodiment, a method for training a flow field prediction model based on Vision Transformer is provided, including:
[0130] S1 uses a leaf shape geometry generation program to sample the leaf shape through a Latin hypercube in order to parameterize the leaf shape and generate a primitive leaf shape database.
[0131] S2, use mesh generation software to generate unstructured mesh data for the target leaf cascade.
[0132] S3. Use a simulation program to perform steady turbulence simulation. Based on the geometric parameters of the target cascade, such as inlet geometry angle and consistency, design flow field conditions that conform to the target cascade airfoil. Combine the unstructured mesh data of the target cascade with computational fluid dynamics simulation to obtain the cascade flow field database.
[0133] S4. Structured mesh data for the target cascade is generated using mesh generation software. Flow field data simulated based on unstructured mesh data is interpolated onto the structured mesh data. The signed distance function for each mesh node is calculated, and the original coordinates of the mesh nodes are encoded using this function. The encoded coordinates are then concatenated with the inlet airflow angle and inlet velocity data as input data for the neural network. The final neural network input data is: Where speed represents the speed of the inlet airflow, and angle represents the angle of the inlet airflow.
[0134] S5 performs max-min normalization on the input data and simulated flow field data: .in This represents the normalized data. This represents the data on a specific channel, along with the minimum and maximum values for that channel. The final input data is... ,in Represents the resolution of the grid data. This represents the number of input channels, or the dimension of the input data.
[0135] S6. Input the input data into the flow field prediction model to train the model. See [link to flow field prediction model architecture] for details. Figure 2 The loss function is described in the aforementioned embodiment. After the input data is fed into the flow field prediction model, the input data is first flattened in two dimensions to shape it into a two-dimensional flattened feature sequence. ,in This refers to the number of blocks after flattening. The resolution of each block is Then, a trainable linear projection is used to reconstruct the two-dimensional flattened feature sequence, so that the size of the latent vector obtained after linear projection is constant at D, and the position embedding of each feature in the two-dimensional flattened feature sequence is linearly added to the two-dimensional flattened feature sequence to preserve the feature position information.
[0136] Subsequently, the one-dimensional feature sequence obtained by linear projection is input into the encoder to extract effective latent features. The decoder converts these latent features into flow field quantities, and then performs an inverse flattening operation (i.e., the inverse operation of flattening) on the decoder output to generate a flow field quantity of size . The final output. In this embodiment of the application, This includes fundamental quantities such as pressure, velocity, and density.
[0137] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0138] Based on the same inventive concept, this application also provides a Vision Transformer-based flow field prediction model training device for implementing the aforementioned Vision Transformer-based flow field prediction model training method. The solution provided by this device is similar to the implementation described in the above method. Therefore, the specific limitations of one or more Vision Transformer-based flow field prediction model training device embodiments provided below can be found in the limitations of the Vision Transformer-based flow field prediction model training method described above, and will not be repeated here.
[0139] In one embodiment, such as Figure 7 As shown, a flow field prediction model training device 700 based on Vision Transformer is provided. The flow field prediction model is constructed based on Vision Transformer and includes a feature encoding layer, a linear projection layer, an encoding layer, and a decoding layer. The device includes: a construction module 702, an encoding module 704, an input module 706, and a training module 708, wherein:
[0140] The construction module 702 is used to construct the mesh data of the target blade cascade and generate the simulation flow field data corresponding to the target blade cascade based on the mesh data and operating conditions.
[0141] The encoding module 704 is used to encode the coordinates of each grid node based on the positional relationship between each grid node in the grid data and each blade in the target cascade, to obtain coordinate codes;
[0142] The input module 706 is used to input the coordinate codes of each grid node and the operating conditions into the flow field prediction model, segment the coordinate codes and operating conditions through the feature encoding layer to obtain multiple feature data blocks, and perform dimensional adjustment processing on the feature data blocks through the linear projection layer to obtain one-dimensional features corresponding to each feature data block. The one-dimensional features and the position codes of each feature data block are concatenated to obtain a one-dimensional feature sequence.
[0143] The training module 708 is used to perform feature extraction processing on the one-dimensional feature sequence through the encoding layer and the decoding layer in sequence to obtain predicted flow field data, and to adjust the flow field prediction model according to the difference between the predicted flow field data and the simulated flow field data to obtain a trained flow field prediction model.
[0144] The flow field prediction model training device based on Vision Transformer provided in this application applies the Vision Transformer architecture to flow field prediction. Since Vision Transformer is suitable for processing data with long-range dependencies, and there are numerous dependencies between different parts of the flow field, using Vision Transformer results in a better-performing trained model. Furthermore, it significantly improves flow field simulation efficiency compared to using RANS models to solve the flow field. To apply Vision Transformer to flow field prediction tasks, this application adds a decoding layer to the original Vision Transformer. Moreover, to enhance the model's perception of the blade surface, this application encodes the coordinates of the grid nodes using the positional relationship between the grid nodes and the blades. This coordinate encoding is then used as input data for the flow field prediction model, further enhancing the model's performance in predicting the flow field on the blade surface and improving the model's prediction accuracy.
[0145] In one embodiment, the encoding module 704 is further configured to:
[0146] For any of the aforementioned grid nodes, the positional relationship parameters corresponding to the grid node are determined based on the positional relationship between the grid node and the blades in the target cascade channel, and the coordinate code of the grid node is determined based on the positional relationship parameters and the coordinates of the grid node.
[0147] The value of the positional relationship parameter exhibits an exponential decay relationship with the value of the sign distance function in the range of 0 to 1. When the grid node is located inside the blade in the target cascade, the sign distance function is negative, and when the grid node is located outside the blade in the target cascade channel, the sign distance function is positive.
[0148] In one embodiment, the encoding module 704 is further configured to:
[0149] Determine the wall distance between each of the grid nodes and the surface of the blade in the target cascade;
[0150] The encoding function is applied to the wall distance to obtain the encoding function value, and the product of the encoding function value and the coordinates of the grid node is used as the coordinate encoding.
[0151] In one embodiment, the grid data is structured grid data, and the construction module 702 is further configured to:
[0152] Construct unstructured mesh data of the target cascade, and simulate the original simulated flow field data corresponding to the target cascade based on the operating conditions and the unstructured mesh data;
[0153] Based on the coordinates of each grid node in the unstructured grid data, the coordinates of each grid node in the structured grid data, and the original simulated flow field data corresponding to each grid node in the unstructured grid, interpolation is performed to obtain the interpolated flow field data corresponding to each grid node in the structured grid data.
[0154] The interpolated flow field data corresponding to each grid node of the structured grid data is used as the simulation flow field data corresponding to the target cascade.
[0155] In one embodiment, the training module 708 is further configured to:
[0156] A first loss value is determined based on the average absolute error between the predicted flow field data and the simulated flow field data, and a second loss value is determined based on the gradient difference between the predicted flow field data and the simulated flow field data.
[0157] The predicted flow field data and the simulated flow field data are converted into discrete wavelets respectively, and a third loss value is determined based on the difference between the discrete wavelets of the predicted flow field data and the discrete wavelets of the predicted flow field data.
[0158] A fourth loss value is determined based on the difference between the predicted flow field data and the simulated flow field data of the surface regions of each blade in the target blade cascade. A fifth loss value is determined based on the difference between the predicted flow field data and the simulated flow field data of the bottom boundary region and the top boundary region of the target blade cascade. The fifth loss value is used to characterize the periodic constraint loss.
[0159] A target loss value is determined based on the first loss value, the second loss value, the third loss value, the fourth loss value, and the fifth loss value. The flow field prediction model is then adjusted based on the target loss value to obtain a trained flow field prediction model.
[0160] In one embodiment, such as Figure 8 As shown, a flow field prediction model training device 800 based on Vision Transformer is provided, including: a construction module 802, an encoding module 804, and an input module 806, wherein:
[0161] Module 802 is used to construct the mesh data of the target blade cascade and obtain the operating conditions of the target blade cascade.
[0162] The encoding module 804 is used to encode the coordinates of each grid node based on the positional relationship between each grid node in the grid data and each blade in the target cascade, to obtain coordinate codes;
[0163] The input module 806 is used to input the coordinate codes of each grid node and the operating conditions into the flow field prediction model to obtain the predicted flow field data.
[0164] The flow field prediction model is obtained by training the method described in any of the foregoing embodiments.
[0165] Each module in the above-mentioned device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0166] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a Vision Transformer-based flow field prediction model training method.
[0167] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0168] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0169] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0170] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0171] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0172] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0173] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0174] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for training a flow field prediction model based on a Vision Transformer, characterized in that, The flow field prediction model is constructed based on a Vision Transformer and includes a feature encoding layer, a linear projection layer, an encoding layer, and a decoding layer, and the method includes: constructing grid data of a target cascade, and generating simulation flow field data corresponding to the target cascade according to the grid data and working condition conditions; for any grid node in the grid data, determining a position relationship parameter corresponding to the grid node according to a position relationship between the grid node and a blade in a channel of the target cascade, and determining a coordinate code of the grid node according to the position relationship parameter and a coordinate of the grid node; wherein the value of the position relationship parameter is in an exponential decay relationship with the value of a signed distance function in the interval [0, 1], and in the case that the grid node is located inside the blade in the target cascade, the signed distance function is negative, and in the case that the grid node is located outside the blade in the channel of the target cascade, the signed distance function is positive; inputting the coordinate code of each grid node and the working condition condition into the flow field prediction model, performing segmentation processing on the coordinate code and the working condition condition through the feature encoding layer to obtain a plurality of feature data blocks, and performing dimension adjustment processing on the feature data blocks through the linear projection layer to obtain a one-dimensional feature corresponding to each feature data block, and performing splicing processing on each one-dimensional feature and the position code of each feature data block to obtain a one-dimensional feature sequence; performing feature extraction processing on the one-dimensional feature sequence through the encoding layer and the decoding layer in sequence to obtain predicted flow field data, and adjusting the flow field prediction model according to the difference between the predicted flow field data and the simulation flow field data to obtain a trained flow field prediction model.
2. The method of claim 1, wherein, The determination of the coordinate code of the grid node according to the position relationship parameter and the coordinate of the grid node includes: determining the wall distance between each grid node and the surface of the blade in the target cascade, respectively; applying an encoding function to the wall distance to obtain an encoding function value, and taking the product of the encoding function value and the coordinate of the grid node as the coordinate code.
3. The method of claim 1, wherein, The grid data is structured grid data, and the generation of the simulation flow field data corresponding to the target cascade according to the grid data and the working condition conditions includes: constructing unstructured grid data of a target cascade, and simulating to obtain original simulation flow field data corresponding to the target cascade according to the working condition conditions and the unstructured grid data; interpolating to obtain interpolation flow field data corresponding to each grid node of the structured grid data according to the coordinate of each grid node of the unstructured grid data, the coordinate of each grid node of the structured grid data, and the original simulation flow field data corresponding to each grid node of the unstructured grid; taking the interpolation flow field data corresponding to each grid node of the structured grid data as the simulation flow field data corresponding to the target cascade.
4. The method of claim 1, wherein, The adjusting the flow field prediction model according to the difference between the predicted flow field data and the simulation flow field data comprises: determining a first loss value according to the mean absolute error of the predicted flow field data and the simulation flow field data, and determining a second loss value according to the gradient difference of the predicted flow field data and the simulation flow field data; converting the predicted flow field data and the simulation flow field data into discrete wavelets respectively, and determining a third loss value according to the difference between the discrete wavelet of the predicted flow field data and the discrete wavelet of the predicted flow field data; determining a fourth loss value according to the difference between the predicted flow field data of the surface area of each blade in the target cascade and the simulation flow field data, and determining a fifth loss value according to the difference between the predicted flow field data of the bottom boundary area and the top boundary area of the target cascade and the simulation flow field data, the fifth loss value being used to represent a periodic constraint loss; determining a target loss value according to the first loss value, the second loss value, the third loss value, the fourth loss value and the fifth loss value, and adjusting the flow field prediction model according to the target loss value to obtain the trained flow field prediction model.
5. A method for flow field prediction based on a Vision Transformer, characterized in that, The method comprises: constructing grid data of a target cascade and obtaining working condition conditions of the target cascade; for any grid node in the grid data, determining a position relationship parameter corresponding to the grid node according to the position relationship between the grid node and the blades in the target cascade channel, and determining a coordinate code of the grid node according to the position relationship parameter and the coordinates of the grid node; wherein the value of the position relationship parameter exponentially decays with the value of a signed distance function in the interval [0, 1], and in the case that the grid node is located inside the blades in the target cascade, the signed distance function is negative, and in the case that the grid node is located outside the blades in the target cascade channel, the signed distance function is positive; inputting the coordinate code of each grid node and the working condition conditions into a flow field prediction model to obtain predicted flow field data; wherein the flow field prediction model is trained by the method of any one of claims 1-4.
6. A Vision Transformer-based flow field prediction model training apparatus, characterized in that, The flow field prediction model is constructed based on a Vision Transformer and comprises a feature encoding layer, a linear projection layer, an encoding layer and a decoding layer, and the device comprises: a construction module configured to construct grid data of a target cascade and generate simulation flow field data corresponding to the target cascade according to the grid data and working condition conditions; The encoding module is further configured to: determine wall surface distances between each grid node and surfaces of the blades in the target cascade; and apply an encoding function to the wall surface distances to obtain encoding function values, and use the encoding function values and the coordinates of the grid nodes as the coordinate encodings.
7. The apparatus of claim 6, wherein, The apparatus comprises: a construction module configured to construct grid data of a target cascade and obtain working condition conditions of the target cascade; an encoding module configured to, for any grid node in the grid data, determine a position relationship parameter corresponding to the grid node according to a position relationship between the grid node and a blade in the target cascade, and determine a coordinate encoding of the grid node according to the position relationship parameter and a coordinate of the grid node; wherein a value of the position relationship parameter exponentially attenuates with a value of a signed distance function in an interval of 0-1, and the signed distance function is negative when the grid node is inside the blade and positive when the grid node is outside the blade; 8. A flow field prediction device based on a Vision Transformer, characterized by, an input module configured to input the coordinate encodings of the grid nodes and the working condition conditions into the flow field prediction model, perform segmentation processing on the coordinate encodings and the working condition conditions through the feature encoding layer to obtain a plurality of feature data blocks, and perform dimension adjustment processing on the feature data blocks through the linear projection layer to obtain one-dimensional features corresponding to each feature data block, and perform splicing processing on each one-dimensional feature and a position encoding of each feature data block to obtain a one-dimensional feature sequence; a training module configured to sequentially perform feature extraction processing on the one-dimensional feature sequence through the encoding layer and the decoding layer to obtain predicted flow field data, and adjust the flow field prediction model according to a difference between the predicted flow field data and the simulation flow field data to obtain a trained flow field prediction model. The encoding module is further configured to: determine wall surface distances between each grid node and surfaces of the blades in the target cascade; and apply an encoding function to the wall surface distances to obtain encoding function values, and use the encoding function values and the coordinates of the grid nodes as the coordinate encodings. 9.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-8 when the computer program is executed by the processor. The apparatus comprises:
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, a construction module configured to construct grid data of a target cascade and obtain working condition conditions of the target cascade; an encoding module configured to, for any grid node in the grid data, determine a position relationship parameter corresponding to the grid node according to a position relationship between the grid node and a blade in the target cascade, and determine a coordinate encoding of the grid node according to the position relationship parameter and a coordinate of the grid node; wherein a value of the position relationship parameter exponentially attenuates with a value of a signed distance function in an interval of 0-1, and the signed distance function is negative when the grid node is inside the blade and positive when the grid node is outside the blade; an input module configured to input the coordinate encodings of the grid nodes and the working condition conditions into the flow field prediction model to obtain predicted flow field data; The flow field prediction model is trained by the method in any one of claims 1-4. The processor executes the computer program to implement the steps of the method in any one of claims 1-5. The computer program is executed by the processor to implement the steps of the method in any one of claims 1-5.