Graph neural network ship flow field forecasting method based on high-order statistical aggregation
Through the graph neural network method based on high-order statistical aggregation, combined with the graph self-attention neural network and LSTM decoder, the problem of insufficient accuracy and generalization performance in complex ship flow field forecasting is solved, and high-precision and physical consistency flow field forecasting is achieved.
Patent Information
- Application Number
- CN202510460674.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-14
- Publication Date
- 2025-07-25
AI Technical Summary
The existing graph neural network has low forecast accuracy and generalization performance in ship complex flow field forecasting, making it difficult to accurately capture the spatial distribution characteristics and temporal evolution laws of the flow field.
The graph neural network method based on high-order statistical aggregation is adopted, combined with the graph self-attention neural network encoder, multi-layer LSTM decoder and MLP decoder, by introducing the residual term of the N-S equation and the higher-order statistical function, the node characteristics are updated and the flow field prediction model is constructed to ensure that the forecast results comply with physical laws.
The forecast accuracy and generalization performance of the ship's complex flow field are improved, and the forecast results have high physical consistency and can accurately capture the distribution characteristics of node neighborhoods.
Smart Images

Figure CN120372815A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the interdisciplinary field of computational fluid dynamics and deep learning, and particularly to a method for predicting ship flow fields based on graph neural networks with high-order statistical aggregation. Background Art
[0002] The study of the characteristics of the ship's flow field around the hull is of great significance for hull design optimization, propulsion efficiency, and safety performance. Traditional ship flow data is obtained through physical experiments or numerical simulations using Computational Fluid Dynamics (CFD) software. However, physical experiments have difficulties such as high costs, long cycles, and limited measurement environments. Numerical simulations using CFD software require tens of millions or even hundreds of millions of grids to handle large-scale and highly complex flow field calculation scenarios, resulting in huge computational amounts and extremely high requirements for computing power resources.
[0003] In recent years, with the rapid development of artificial intelligence technology, deep neural networks represented by Multilayer Perceptron (MLP), Long Short-Term Memory (LSTM), Convolutional Neural Network (CNN), Physical Informed Neural Network (PINN), etc. have become a new method for solving complex engineering fluid dynamics problems and have achieved remarkable progress and results. However, ship flow field data is usually distributed in a non-Euclidean space, containing complex spatial distribution relationships and time evolution laws. The above neural networks assume that the data has a Euclidean structure and have limitations in dealing with complex flow field data scenarios, resulting in low prediction accuracy and generalization performance.
[0004] A Graph Neural Network (GNN) is a deep neural network for graph-structured data (nodes, edges), capable of processing the flow field data structure in non-Euclidean space and effectively capturing the local structural features and global relationships of the flow field data space. Currently, the main methods for using GNN to process flow field data are as follows: Tobias Pfaff et al. proposed a grid-based graph neural network (MeshGraphNet) to predict the unsteady flow fields of flow around a cylinder and flow around a NACA airfoil. Subsequently, a series of studies improved MeshGraphNet. For example, Yang Zhishuang introduced an algebraic multigrid algorithm based on MeshGraphNet, established a multi-scale graph neural network model, and conducted prediction research on the flow field of flow around a cylinder. Li Tianyu, Zou Yiye et al. encoded partial differential equations in MeshGraphNet to construct a finite volume graph neural network model and conducted prediction research on the flow fields of flow around a cylinder and flow around an airfoil. Li Zhilong et al. used a graph convolutional recurrent neural network and MeshGraphNet to carry out the prediction of the flow field around a two-dimensional blunt body. The patent with the publication number CN117421519A proposed a partial differential equation solving algorithm based on a physics-informed graph neural network and finite difference, and its network core architecture relies on MeshGraphNet. In addition, Peng Jiangzhou et al. proposed a physics-informed graph convolutional neural network and conducted prediction research on the flow field around a cylinder. The patent with the publication number CN118350292A discloses a method for training an airfoil flow field prediction network, which extracts flow field features based on Transformer and uses a graph neural network to predict the flow field. The patent CN118332898A discloses a method for predicting the airfoil flow field based on a hybrid neural network, which constructs a hybrid neural network using a graph neural network and a recurrent neural network to predict the flow around an airfoil. However, existing research mainly applies GNN in simple application scenarios such as flow around a cylinder, flow around a square column, and flow around an airfoil. If the above methods are applied to the complex ship flow field prediction scenario, the accuracy and generalization performance of the flow field prediction will be low due to the insufficient ability of the model to extract the spatial features of the flow field. Summary of the Invention
[0005] In view of the above problems and technical requirements, the present application proposes a method for predicting the ship flow field based on a graph neural network with high-order statistical aggregation. The technical solution of the present application is as follows:
[0006] A method for predicting the ship flow field based on a graph neural network with high-order statistical aggregation, the method for predicting the ship flow field based on a graph neural network includes:
[0007] Obtain the flow field data of the flow field where the ship is located at the initial consecutive moments from the 1st to the Mth, and construct the graph structure data at the current moment according to the flow field data at each moment. The graph structure data includes the node features of all nodes and the edge features of all edges. The node features at each node in the graph structure data include the spatial coordinates of the node and the flow field physical quantities at the corresponding moment. The integer parameter M ≥ 2;
[0008] Starting from T = M, input the graph structure data at the Tth moment and the previous M - 1 nearest moments in chronological order into the 1st to the Mth graph self-attention neural network encoders in the trained flow field prediction model respectively. The 1st to the Mth graph self-attention neural network encoders in the flow field prediction model are respectively connected to the M LSTM layers stacked in sequence in the multi-layer LSTM decoder, and the last LSTM layer is connected to the MLP decoder; in any mth graph self-attention neural network encoder, initialize the first message passing layer according to the graph structure data at the mth moment, and use the multi-head self-attention mechanism combined with the N-S equation residual to update the edge features of the connection edges between any node j and other nodes connected to it according to the node features at each node in any lth message passing layer. Aggregate multiple feature statistics including high-order statistics of the updated edge features of all connection edges of node j onto node j to obtain the node features of node j in the (l + 1)th message passing layer And use the node features of each node in the last message passing layer as the updated graph structure data at the mth moment and input it into the corresponding LSTM layer, where the integer parameter 1 ≤ l ≤ L - 1, the total number of message passing layers L ≥ 2, and the integer parameter T - M + 1 ≤ m ≤ T;
[0009] Use the output of the MLP decoder of the flow field prediction model as the prediction result of the flow field data at the (T + 1)th moment and perform autoregressive prediction.
[0010] A further technical solution thereof is to obtain the node features of node j in the (l + 1)th message passing layer including:
[0011] Construct a high-order aggregation function using multiple feature statistics and obtain an aggregation result, and splice the aggregation result with the node features of node j in the lth message passing layer to obtain a spliced feature After that, perform a non-linear transformation on the spliced feature through the MLP and obtain the node features of node j in the (l + 1)th message passing layer
[0012] A further technical solution thereof is that the feature statistics of the edge features of each connection edge of node j include the first-order statistic, the second-order statistic, the third-order statistic, and the fourth-order statistic; constructing a high-order aggregation function using multiple feature statistics and obtaining an aggregation result includes:
[0013] After concatenating the first-order statistic, second-order statistic, third-order statistic, and fourth-order statistic, perform a non-linear transformation through an MLP, and then obtain the weight coefficients of each characteristic statistic through a softmax mapping. Weight each characteristic statistic according to the weight coefficients of each characteristic statistic to obtain an aggregation result.
[0014] A further technical solution thereof is that updating the edge features of the connection edge between any node j and any connected node i includes:
[0015] Using the multi-head self-attention mechanism, according to the node features of node i in the l-th message passing layer Calculate the attention weight of node i Among them, W Q 、W K 、W V are learnable weight matrices respectively, and d k is the subspace dimension;
[0016] Use the N-S equation residual to correct the attention weight α of node i ij To update and obtain the edge features of the connection edge between node j and node i in the (l + 1)-th message passing layer
[0017] A further technical solution thereof is that obtaining the edge features of the connection edge between node j and node i in the (l + 1)-th message passing layer is:
[0018]
[0019] Among them, is the residual of the N-S equation, u n is the velocity at any node n, p n is the pressure at node n, N f is the total number of nodes, is the gradient operator, t represents time, Re is the Reynolds number, and γ is the correction coefficient.
[0020] A further technical solution thereof is that the graph neural network ship flow field prediction method further includes:
[0021] After completing the discrete grid division of the flow field calculation domain where the ship model is located, perform a CFD simulation of the flow around the ship to obtain the physical quantity simulation results at each grid unit at each simulation moment, and construct the simulation graph structure data at the current simulation moment according to the physical quantity simulation results at any simulation moment. The node features at each node in the simulation graph structure data include the spatial coordinates of the node and the physical quantity simulation results at the node at the current simulation moment;
[0022] Taking the sequence composed of the simulation diagram structure data at any simulation time P and the M-1 nearest simulation times before it as the sample input, and the simulation result of the physical quantity at simulation time P+1 as the sample output, the training sample corresponding to simulation time P is constructed, and the training samples corresponding to different simulation times are constructed to form a training sample set;
[0023] Build the model structure of the flow field prediction model, input the M simulation diagram structure data in the training sample corresponding to any simulation time P into the 1st to Mth graph self-attention neural network encoders in the flow field prediction model in chronological order, obtain the flow field prediction result at simulation time P+1 output by the MLP decoder of the flow field prediction model, and use the training sample set to train the flow field prediction model in combination with the sample output of the training sample corresponding to simulation time P.
[0024] A further technical solution thereof is that training the flow field prediction model using the training sample set includes:
[0025] Applying constraint conditions matching the boundary conditions at the physical boundary where the nodes in the simulation diagram structure data located on the physical boundary of the flow field calculation domain are located, and training the flow field prediction model using the training sample set under the constraint of the constraint conditions.
[0026] A further technical solution thereof is that training the flow field prediction model using the training sample set under the constraint of the constraint conditions includes:
[0027] For the node b in the simulation diagram structure data located on the physical boundary of the flow field calculation domain, according to the boundary conditions at the physical boundary where the node b is located, project the node feature of the node b in the (l+1)th message passing layer obtained by the graph self-attention neural network encoder into the feasible region to obtain the projection result and then pass it to the next message passing layer for processing, where Proj Β () is the projection operator;
[0028] Calculate the data error L between the flow field prediction result and the sample output of the training sample corresponding to each simulation time data as the loss function L, and update the model parameters of the flow field prediction model by minimizing the loss function L for model training.
[0029] A further technical solution thereof is that training the flow field prediction model using the training sample set under the constraint of the constraint conditions includes:
[0030] Calculate the data error L between the flow field prediction result and the sample output of the training sample corresponding to each simulation time data ;
[0031] Calculate the flow field prediction result at node b located on the physical boundary of the flow field calculation domain in the computational simulation diagram structure data and the boundary conditions at the physical boundary where it is located to obtain the boundary condition regularization term based on the deviation between them where N b is the total number of nodes located on the physical boundary of the flow field calculation domain in the simulation diagram structure data;
[0032] Calculate the loss function L = L data + λL b , and update the model parameters of the flow field prediction model by minimizing the loss function L for model training, where λ is the weight coefficient.
[0033] Its further technical solution is that the flow field calculation domain is a cuboid structure, and the physical boundaries of the flow field calculation domain include the left boundary, right boundary, upper boundary, lower boundary, front boundary, rear boundary, and the hull surface boundary of the ship model. The boundary conditions set for the flow field during the CFD simulation of the flow around the body include: setting the left boundary as the velocity inlet boundary condition, setting the right boundary as the pressure outlet boundary condition, and setting the other boundaries as the no-slip wall boundary;
[0034] Project the node features into the feasible domain according to the boundary conditions at the physical boundary where node b is located to obtain the projection result including: obtaining the projection result when node b is located on the left boundary of the flow field calculation domain obtaining the projection result when node b is located on the right boundary of the flow field calculation domain obtaining the projection result when node b is located on the upper boundary, lower boundary, front boundary, rear boundary, and the hull surface boundary of the ship model
[0035] Or, calculate the flow field prediction result at node b and the boundary conditions at the physical boundary where it is located The deviation between them includes: when node b is located on the left boundary of the flow field calculation domain, calculate the difference between the velocity prediction result in the flow field prediction result and u inlet as the flow field prediction result and the boundary condition of the deviation When node b is located on the right boundary of the flow field calculation domain, calculate the difference between the pressure prediction result in the flow field prediction result and p outlet as the flow field prediction result and the boundary condition of the deviation When node b is located on the upper boundary, lower boundary, front boundary, rear boundary of the flow field calculation domain and the hull surface boundary of the ship model, calculate the flow field prediction result The difference between the velocity prediction result in and 0 is used as the flow field prediction result Deviation from the boundary condition
[0036] Among them, u inlet is the inlet velocity vector at the left boundary, p outlet is the outlet static pressure at the right boundary, (x, y, z) are the node characteristics of node b The spatial coordinates included in u is the velocity included in the node characteristics of node b p is the pressure included in the node characteristics of node b
[0037] The beneficial technical effects of this application are:
[0038] This application discloses a ship flow field prediction method based on high-order statistical aggregation using a graph neural network. This method uses an autoregressive flow field prediction model built and trained by a graph self-attention neural network encoder, a multi-layer LSTM decoder, and an MLP decoder. When using the graph self-attention neural network encoder to update node characteristics, this flow field prediction model not only introduces the N-S equation residual term but also constructs a high-order statistical function to aggregate neighbor node characteristics, enabling the flow field prediction model to more accurately capture the distribution characteristics of the node neighborhood in the complex ship wake flow field and ensuring that the model satisfies physical laws in flow field prediction. This can improve the prediction accuracy and generalization performance of the complex ship wake flow field, and the prediction results have high physical consistency.
[0039] When training the flow field prediction model using the wake flow field CFD simulation data, this method also applies constraint conditions in the form of hard constraints or soft constraints according to the boundary conditions of the flow field calculation domain, which can ensure that the flow field prediction model accurately captures the node characteristics of the boundary conditions and the prediction results conform to the actual physical boundary conditions, thereby further improving the accuracy and physical consistency of the prediction results. Description of the Drawings
[0040] Figure 1 is the method flow chart of the graph neural network ship flow field prediction method in an embodiment of this application
[0041] Figure 2 is the network structure diagram of the flow field prediction model in this application
[0042] Figure 3 is the method flow chart for each message passing layer in the graph self-attention neural network encoder to update node characteristics in an embodiment
[0043] Figure 4 It is a schematic diagram of the training process of the flow field prediction model in an embodiment of the present application.
[0044] Figure 5 It is a schematic diagram of the fluid computational domain established and the boundary conditions set during the training process of the flow field prediction model using the CFD simulation data of the flow-around field in an example. Specific embodiments
[0045] The following further describes the specific embodiments of the present application with reference to the accompanying drawings.
[0046] The present application discloses a ship flow field prediction method based on a graph neural network with high-order statistical aggregation. The ship flow field prediction method based on the graph neural network includes the following steps. Please refer to Figure 1 the flowchart of
[0047] Step S1: Obtain the flow field data of the flow field where the ship is located at the initial 1st to Mth consecutive moments, and construct the graph structure data of the current moment according to the flow field data at each moment. The method of constructing the graph structure data according to the flow field data can refer to the existing practices, which will not be elaborated in the present application. The integer parameter M≥2.
[0048] The graph structure data constructed at each moment includes multiple nodes with connection relationships. Each node has its own node features. The graph structure data includes the node features of all nodes and the edge features of all edges. The node features at each node include the spatial coordinates of the node and the flow field physical quantities at the corresponding moment. In the present application, the flow field physical quantities at each node include the velocity and pressure of the fluid. The edge features of each edge include the index information and length of the connecting edge. The nodes at both ends of the connecting edge can be determined through the index information of the connecting edge.
[0049] Step S2: Starting from T = M, input the graph structure data of the Tth moment and the M - 1 nearest moments before it into the trained flow field prediction model in chronological order.
[0050] For the model structure of the flow field prediction model used in the present application, please refer to Figure 2 , the flow field prediction model includes M graph self-attention neural network encoders, a multi-layer LSTM decoder, and an MLP decoder. The multi-layer LSTM decoder includes M LSTM layers stacked in sequence according to the information transmission direction ( Figure 2 denoted as LSTM layer 1 to LSTM layer M respectively), and the 1st to Mth graph self-attention neural network encoders ( Figure 2They are respectively denoted as GNN-1 to GNN-M), and are respectively connected to M LSTM layers stacked in sequence in the multi-layer LSTM decoder. The last LSTM layer is connected to the MLP decoder. In one embodiment, the number of LSTM layers is set to 2, the number of neurons in each layer is set to 128, and the ReLU activation function is used. The output dimension of the MLP decoder is set to 2, corresponding to the pressure and velocity of the fluid respectively.
[0051] When inputting the M graph structure data at time T and the previous M-1 nearest times into the flow field prediction model, these M graph structure data are respectively input into the 1st to Mth graph self-attention neural network encoders in chronological order. As Figure 2 shown, the graph structure data at time T is input into the Mth graph self-attention neural network encoder, the graph structure data at time T-1 is input into the (M-1)th graph self-attention neural network encoder, and so on. The graph structure data at time T-M+1 is input into the 1st graph self-attention neural network encoder.
[0052] For any integer parameter T-M+1 ≤ m ≤ T, the graph structure data at time m is input into the mth graph self-attention neural network encoder. The structures of all graph self-attention neural network encoders are the same. Any mth graph self-attention neural network encoder includes L message passing layers.
[0053] In any mth graph self-attention neural network encoder, first, the first message passing layer is initialized according to the input graph structure data at time m, and then message passing is performed layer by layer using L message passing layers to update the input graph structure data. For any integer parameter 1 ≤ l ≤ L-1, within any lth message passing layer:
[0054] 1. Using the multi-head self-attention mechanism combined with the N-S equation residual, according to the node features at each node within the lth message passing layer, update to obtain the edge features of the connection edges between any node j and its connected other nodes. Here, what is updated is the length of the connection edge in the edge features, and the index information of the connection edge remains unchanged. The edge features of the connection edge between node j and any connected node i can be denoted as Obtaining the edge feature includes:
[0055] (1). Using the multi-head self-attention mechanism, according to the node feature of node i within the lth message passing layer, calculate the attention weight α ij of node i, and the calculation formula is:
[0056]
[0057] where Q i 、K i, V i is the node feature of node i in the l-th message passing layer which is the result of a linear transformation, and W Q 、W K 、W V are learnable weight matrices respectively. d k is the subspace dimension. Softmax() represents the Softmax function.
[0058] (2) Use the residual of the N - S equation to correct the attention weight α of node i ij to obtain the edge feature of the connection edge between node j and node i in the (l + 1)-th message passing layer The calculation formula is:
[0059]
[0060] where is the residual of the N - S equation. u n is the velocity at any node n, p n is the pressure at node n, N f is the total number of nodes, is the gradient operator, t represents time, Re is the Reynolds number, and γ is the correction coefficient.
[0061] In the traditional method, calculating and updating edge features in a purely data - driven manner will cause the edge features to surge or decay without physical meaning. In this application, introducing the residual of the N - S equation to correct the update process of edge features can ensure that the update process satisfies physical laws, and using the regularization constraints and guidance of relevant physical laws for correction can improve the physical consistency of the prediction results.
[0062] 2. Aggregate multiple feature statistics including high - order statistics of the edge features of all connection edges of node j to node j to obtain the node feature of node j in the (l + 1)-th message passing layer including the following process, please refer to Figure 3 :
[0063] (1) First, calculate multiple feature statistics of the edge feature of the connection edge between node j and any connected node i. These multiple feature statistics include not only low - order statistics but also high - order statistics, which is beneficial to enhancing the ability to mine and represent spatial feature relationships.
[0064] In one embodiment, the feature statistics of the edge feature of each connection edge of node j include first - order statistics, second - order statistics, third - order statistics, and fourth - order statistics.
[0065] (2) Construct a high-order aggregation function using multiple feature statistics and obtain the aggregation result, and splice the aggregation result with the node feature of node j in the l-th message passing layer to obtain the spliced feature
[0066] In one embodiment, the calculated first-order statistic includes the mean μ mean , and the calculated second-order statistic includes the variance μ std , the calculated third-order statistic includes the skewness μ ske , and the calculated fourth-order statistic includes the kurtosis μ kur . Among them, the mean μ mean reflects the central tendency of the edge features of the connected edges, which is equivalent to the traditional mean aggregation and can retain the basic information. The variance μ std reflects the degree of dispersion of the edge features of the connected edges and can distinguish stable and fluctuating connected edges. The skewness μ ske reflects the distribution asymmetry (left-skewed or right-skewed) of the edge features of the connected edges and can well capture the asymmetric pattern. The kurtosis μ kur reflects the sharpness of the distribution of the edge features of the connected edges and can be used to detect outliers. Using the mean μ mean , variance μ std , skewness μ ske , kurtosis μ kur to construct a high-order aggregation function and the obtained aggregation result can capture the edge features of each connected edge of node j from multiple aspects.
[0067] One way to construct a high-order aggregation function using multiple feature statistics to obtain the aggregation result is: directly splice multiple feature statistics to obtain the aggregation result. However, to improve the aggregation effect, another way is: after splicing the first-order statistic, second-order statistic, third-order statistic and fourth-order statistic, perform a non-linear transformation through an MLP, and then perform a softmax mapping to obtain the weight coefficients of each feature statistic, and weight each feature statistic according to the weight coefficients of each feature statistic to obtain the aggregation result. When the feature statistics include the mean μ mean , variance μ std , skewness μ ske , kurtosis μ kur , first, splice the mean μ mean , variance μ std , skewness μ ske , kurtosis μ kur and input them into the MLP for non-linear transformation, and then perform a softmax function mapping to obtain four weight coefficients, and weight each feature statistic according to the weight coefficients of each feature statistic to obtain the aggregation result. Then the aggregation result can be expressed as:
[0068] h stats = α1μmean +α2μ std +α3μ ske +α4μ kur
[0069] Among them, the weight coefficients α1, α2, α3, α4 are obtained through softmax(MLP(μ mean ||μ std ||μ ske ||μ kur ))
[0070] Thus, the concatenated features are obtained by concatenation
[0071] (3) Non-linearly transform the concatenated features through MLP and obtain the node features of node j in the (l + 1)-th message passing layer
[0072] After message passing through all message passing layers in this way, the node features of each node in the last message passing layer are used as the updated graph structure data at time m and input into the corresponding LSTM layer
[0073] Step S3: The multi-layer LSTM decoder receives the updated temporal node features from the graph self-attention neural network encoder and learns the temporal evolution feature law of the flow field. Finally, it is decoded into the flow field physical quantities to be predicted, namely velocity and pressure, through a layer of MLP decoder. Then, the output of the MLP decoder of the flow field prediction model is used as the prediction result of the flow field data at time T + 1, and autoregressive prediction is continued, that is, the graph structure data at time T + 1 is constructed according to the prediction result of the flow field data at time T + 1, and then let T = T + 1 and execute step S2 again to obtain the prediction result of the flow field data at the next moment. In this way, autoregressive prediction is realized through circulation
[0074] The graph neural network ship flow field prediction method of the present application depends on the flow field prediction model, and this flow field prediction model needs to be pre-trained. Therefore, before using the flow field prediction model to predict the flow field, the present application also includes the training process of the flow field prediction model. In one embodiment, the flow field CFD simulation data is used to train the flow field prediction model, including the following training process. Please refer to Figure 4 the flowchart of
[0075] Step 410: After completing the discrete grid division of the flow field calculation domain where the ship model is located, perform the CFD simulation of the flow around the ship to obtain the physical quantity simulation results at each grid unit at each simulation moment
[0076] In one embodiment, the constructed flow field calculation domain adopts a cuboid structure such as Figure 5As shown in (a) therein, an enlarged schematic diagram of the ship model within the flow field calculation domain is as Figure 5 As shown in (b) therein, when performing discrete grid division, the grid division methods for the ship model and its external flow field region are often different. Figure 5 It shows the grid division methods for the ship model and its external flow field region. Regular grids are generally used for the external flow field region, and irregular grids are generally used for the ship model and generally grid encryption processing is performed, etc. The specific grid division method can be set according to actual needs.
[0077] After completing the grid division, the spatial structure characteristics of the grid cells can be determined, including: the cell vertices and edges contained in each grid cell and the position information of each grid cell. From this, the spatial coordinates of each cell vertex of each grid cell and the cell vertices at both ends of each edge can be determined, and the index of each edge of each grid cell can be established and the length of the edge can be calculated.
[0078] Based on the grid cells obtained by division, CFD simulation of the flow around the field can be carried out to obtain the simulation results of physical quantities at each grid cell. The simulation results of physical quantities here also include the simulation results of velocity and pressure.
[0079] In one embodiment, the Star CCM+ software is used to calculate the flow field grid data of the DTMB5415 standard ship model at 1000 simulation time instants. The Python program is used to call the ParaView API interface to parse the flow field grid data, and then the spatial structure characteristics of the grid cells and the simulation results of physical quantities at each grid cell at each simulation time instant can be obtained.
[0080] Step 420, construct the simulation graph structure data at the current simulation time instant according to the simulation results of physical quantities at any simulation time instant. The obtained graph structure data at the current simulation time instant includes multiple nodes with connection relationships. Each node has its own node characteristics, and the node characteristics at each node include the node spatial coordinates and the simulation results of physical quantities at the node at the current simulation time instant. For example, in Figure 5 the example of Figure 5 the local simulation graph structure data constructed from the local area within the red rectangular frame in (b) of Figure 5 is as shown in (c) of
[0081] Step 430, use the sequence composed of the simulation graph structure data at any simulation time instant P and the M-1 nearest simulation time instants before it as the sample input, and the simulation results of physical quantities at the simulation time instant P+1 as the sample output to construct the training sample corresponding to the simulation time instant P. Construct the training samples corresponding to different simulation time instants to form a training sample set.
[0082] Step 440, construct the model structure of the flow field prediction model as shown in Figure 2 . Input the M simulation graph structure data in the training sample corresponding to any simulation time P into the 1st to Mth graph self-attention neural network encoders in the flow field prediction model in chronological order, and obtain the flow field prediction result at simulation time P + 1 output by the MLP decoder of the flow field prediction model.
[0083] Combining the flow field prediction result and the sample output of the training sample corresponding to any simulation time P, the flow field prediction model can be trained using the training sample set. In one embodiment, to ensure that the trained flow field prediction model satisfies physical laws, during the model training process, constraint conditions matching the boundary conditions at the physical boundaries of the flow field calculation domain are imposed on the nodes in the simulation graph structure data located at the physical boundaries of the flow field calculation domain, and the flow field prediction model is trained using the training sample set under the constraints of the constraint conditions. There are the following two methods for imposing constraint conditions:
[0084] 1. Impose constraint conditions through the hard constraint method
[0085] This method imposes constraint conditions during the process of the flow field prediction model processing the simulation graph structure data. Specifically, constraint conditions are imposed during the process of each graph self-attention neural network encoder updating the node features of the input simulation graph structure data.
[0086] In the graph self-attention neural network encoder, when aggregating multiple feature statistics including high-order statistics of the edge features of all connection edges of node j in the lth message passing layer to node j to obtain the node feature of node j in the (l + 1)th message passing layer , it does not directly enter the processing of the next message passing layer, but first adds constraint conditions according to the boundary conditions of the flow field calculation domain and then enters the processing of the next message passing layer, including:
[0087] For any node b in the simulation graph structure data located at the physical boundary of the flow field calculation domain, according to the boundary conditions at the physical boundary where node b is located, project the node feature of node b in the (l + 1)th message passing layer obtained by the graph self-attention neural network encoder into the feasible domain to obtain the projection result and then pass it to the next message passing layer for processing. Among them, Proj Β () is the projection operator, and this projection operator matches the boundary conditions of the physical boundary where node b is located.
[0088] This method imposes hard constraints during the process of the flow field prediction model processing the simulation diagram structure data, which can ensure that the output result of the flow field prediction model conforms to the actual physical boundary conditions. Then, during model training, directly calculate the data error L between the flow field prediction result of the training sample corresponding to each simulation moment and the sample output. data Take it as the loss function L, and update the model parameters of the flow field prediction model by minimizing the loss function L for model training.
[0089] When the flow field calculation domain adopts a cuboid structure as shown in (a) of Figure 5 , the physical boundaries of the flow field calculation domain include the left boundary, right boundary, upper boundary, lower boundary, front boundary, rear boundary, and the hull surface boundary of the ship model. The boundary conditions set for the flow field calculation domain during the CFD simulation of the flow around the body include: setting the left boundary as the velocity inlet boundary condition and specifying the inlet velocity vector u inlet , setting the right boundary as the pressure outlet boundary condition and specifying the outlet static pressure p outlet , setting the other boundaries as non-slip wall boundaries and specifying the velocity as 0, as shown in (d) of Figure 5 .
[0090] The node feature of node b in the (l + 1)-th message passing layer can be expressed as
[0091] (x, y, z) are the spatial coordinates included in the node feature of node b, u is the velocity included in the node feature of node b , and p is the pressure included in the node feature of node b . Project the node feature of node b into the feasible domain to obtain the projection result which includes the following several situations:
[0092] When node b is located on the left boundary of the flow field calculation domain, project the node feature of node b into the feasible domain to obtain the projection result , that is, project the velocity u into the inlet velocity vector u inlet , and the rest remains unchanged.
[0093] When node b is located on the right boundary of the flow field calculation domain, project the node feature of node b into the feasible domain to obtain the projection result , that is, project the pressure p into the outlet static pressure p outlet , and the rest remains unchanged.
[0094] When node b is located on the upper boundary, lower boundary, front boundary, rear boundary of the flow field calculation domain, and the hull surface boundary of the ship model, project the node feature Project it into the feasible region to obtain the projection result That is, project the velocity u to 0 and keep the rest unchanged.
[0095] 2. Apply the constraint conditions through the soft constraint method
[0096] Different from the hard constraint method, this method does not adjust the processing process of the flow field prediction model. In the graph self-attention neural network encoder, when aggregating multiple feature statistics including high-order statistics of the edge features of all connected edges of node j in the l-th message passing layer to node j, the node feature of node j in the (l + 1)-th message passing layer is obtained After that, it directly enters the processing of the next message passing layer.
[0097] This may lead to the flow field prediction result of the flow field prediction model not conforming to the actual physical conditions. On this basis, the soft constraint is applied by optimizing the loss function L, including: in addition to calculating the data error L between the flow field prediction result and the sample output of the training sample corresponding to each simulation time data In addition, the deviation between the flow field prediction result at node b on the physical boundary of the flow field calculation domain in the simulation graph structure data and the boundary condition at its physical boundary is calculated to obtain the boundary condition regularization term L b , and the calculation formula is:[[]]
[0098]
[0099] where N b is the total number of nodes on the physical boundary of the flow field calculation domain in the simulation graph structure data, is the flow field prediction result at any node b on the physical boundary of the flow field calculation domain in the simulation graph structure data, is the boundary condition at the physical boundary where node b is located;
[0100] Then calculate the loss function L = L data + λL b , and update the model parameters of the flow field prediction model through minimizing the loss function L for model training. Among them, the weight coefficient λ ∈ (0, 1]. Thus, in the process of minimizing the loss function L for model training, the flow field prediction model can be continuously approximated to the real boundary conditions and satisfy the mechanical physical laws. For example Figure 4 Take the method of adding soft constraints as an example.
[0101] In the flow field calculation domain, a cuboid structure is adopted, and the left boundary is set as the velocity inlet boundary condition and the inlet velocity vector u is specified inlet , the right boundary is set as the pressure outlet boundary condition and the outlet static pressure p is specified outlet, when other boundaries are set as no-slip wall boundaries and the velocity is specified as 0, the regularization term L of the above boundary conditions b The calculation method is:
[0102] When node b is located at the left boundary, calculate the flow field prediction result at node b The velocity prediction results and inlet velocity vector u in inlet The deviation between them is used as the boundary condition regularization term L b In
[0103] When node b is located at the right boundary, calculate the flow field prediction result at node b The pressure prediction results and outlet static pressure p outlet The deviation between them is used as the boundary condition regularization term L b In
[0104] When node b is located at the no-slip wall boundary, the flow field prediction result at node b is calculated. The deviation between the velocity prediction result in and 0 is used as the boundary condition regularization term L b In
[0105] The above is only a preferred embodiment of the present application, and the present application is not limited to the above embodiments. It is understood that other improvements and changes directly derived or associated by those skilled in the art without departing from the spirit and concept of the present application should be considered to be included in the protection scope of the present application.
Claims
1. A method for predicting the ship flow field of a graph neural network based on high-order statistical aggregation, characterized in that The above-mentioned graph neural network ship flow field prediction method includes: Obtain the flow field data of the flow field where the ship is located at the initial consecutive moments from the 1st to the Mth, and construct the graph structure data of the current moment according to the flow field data of each moment. The graph structure data includes the node features of all nodes and the edge features of all edges. The node features at each node in the graph structure data include the spatial coordinates of the node and the flow field physical quantities at the corresponding moment, and the integer parameter M≥2; Starting from T = M, the graph structure data at time T and the previous M - 1 nearest times are sequentially input into the first to Mth graph self-attention neural network encoders in the trained flow field prediction model according to the time sequence. The first to Mth graph self-attention neural network encoders in the flow field prediction model are respectively connected to M stacked LSTM layers in the multi-layer LSTM decoder in sequence, and the last LSTM layer is connected to the MLP decoder; in any mth graph self-attention neural network encoder, the first message passing layer is initialized according to the graph structure data at time m. Using the multi-head self-attention mechanism and combining with the N-S equation residual, according to the node features at each node in any lth message passing layer, the edge features of the connection edges between any node j and its connected other nodes are updated. Multiple feature statistics including high-order statistics of the updated edge features of all the connection edges of node j are aggregated onto node j to obtain the node feature of node j in the (l + 1)th message passing layer. And the node features of each node in the last message passing layer are used as the updated graph structure data at time m and input into the corresponding LSTM layer, where the integer parameter 1 ≤ l ≤ L - 1, the total number of message passing layers L ≥ 2, and the integer parameter T - M + 1 ≤ m ≤ T. Take the output of the MLP decoder of the flow field prediction model as the prediction result of the flow field data at the (T + 1)th moment and perform autoregressive prediction.
2. The graph neural network ship flow field prediction method according to claim 1, wherein Obtain the node features of node j in the (l + 1)-th message passing layer including: Construct a high-order aggregation function using multiple feature statistics and obtain an aggregation result, and splice the aggregation result with the node feature of node j in the l-th message passing layer to obtain a spliced feature After that, perform a non-linear transformation on the spliced feature through an MLP to obtain the node feature of node j in the (l + 1)-th message passing layer 3. The method for predicting the ship flow field by the graph neural network according to claim 2, wherein The feature statistics of the edge features of each connecting edge of node j include the first-order statistic, the second-order statistic, the third-order statistic, and the fourth-order statistic; constructing a high-order aggregation function using multiple feature statistics and obtaining the aggregation result includes: After concatenating the first-order statistic, the second-order statistic, the third-order statistic, and the fourth-order statistic, perform a non-linear transformation through an MLP, and then obtain the weight coefficients of each feature statistic through a softmax mapping. Weight each feature statistic according to the weight coefficients of each feature statistic to obtain the aggregation result.
4. The method for predicting the ship flow field by using a graph neural network according to claim 1, characterized in that Updating the edge features of the connecting edge between any node j and any connected node i includes: Using the multi-head self-attention mechanism, according to the node features of node i in the l-th message passing layer Calculate the attention weight of node i Among them, W Q 、W K 、W V are learnable weight matrices respectively, and d k is the subspace dimension; Using the N - S equation residuals to correct the attention weight α of node i ij to update and obtain the edge feature of the connection edge between node j and node i within the (l + 1)-th message passing layer 5. The method for predicting the ship flow field by the graph neural network according to claim 4, wherein Obtain the edge feature of the connection edge between node j and node i within the (l + 1)-th message passing layer which is wherein, is the residual of the N-S equation, u n is the velocity at any node n, p n is the pressure at node n, N f is the total number of nodes, is the gradient operator, t represents time, Re is the Reynolds number, and γ is the correction coefficient.
6. The graph neural network ship flow field prediction method according to claim 1, characterized in that The above-mentioned graph neural network ship flow field prediction method further includes: After completing the discrete grid division of the flow field calculation domain of the ship model, perform a CFD simulation of the flow around the ship to obtain the physical quantity simulation results at each grid cell at each simulation moment, and construct the simulation graph structure data of the current simulation moment according to the physical quantity simulation results at any simulation moment. The node features at each node in the simulation graph structure data include the spatial coordinates of the node and the physical quantity simulation results of the node at the current simulation moment; Use the sequence composed of the simulation graph structure data at any simulation moment P and the previous M - 1 nearest simulation moments as the sample input, and the physical quantity simulation result at the (P + 1)th simulation moment as the sample output to construct the training sample corresponding to the simulation moment P. Construct the training samples corresponding to different simulation moments to form a training sample set; Build the model structure of the flow field prediction model. Input the M simulation graph structure data in the training sample corresponding to any simulation moment P into the 1st to the Mth graph self-attention neural network encoders in the flow field prediction model in chronological order, obtain the flow field prediction result at the (P + 1)th simulation moment output by the MLP decoder of the flow field prediction model, and use the training sample set to train the flow field prediction model in combination with the sample output of the training sample corresponding to the simulation moment P.
7. The graph neural network ship flow field prediction method according to claim 6, wherein Training the flow field prediction model using the training sample set includes: Apply constraint conditions that match the boundary conditions at the physical boundary to the nodes located on the physical boundary of the flow field calculation domain in the simulation graph structure data, and train the flow field prediction model using the training sample set under the constraints of the constraint conditions.
8. The graph neural network ship flow field prediction method according to claim 7, wherein Training the flow field prediction model using the training sample set under the constraints of the constraint conditions includes: For node b located on the physical boundary of the flow field calculation domain in the simulation diagram structure data, project the node feature of node b in the (l + 1)-th message passing layer obtained by the graph self-attention neural network encoder according to the boundary condition at the physical boundary where node b is located into the feasible domain to obtain a projection result and then pass it to the next message passing layer for processing. Proj Β () is the projection operator; Calculate the data error L between the flow field prediction result of the training sample corresponding to each simulation moment and the sample output data Take it as the loss function L, and update the model parameters of the flow field prediction model by minimizing the loss function L to conduct model training.
9. The graph neural network ship flow field prediction method according to claim 7, wherein, Training the flow field prediction model using the training sample set under the constraints of the constraint conditions includes: Calculate the data error L between the flow field prediction result of the training sample corresponding to each simulation moment and the sample output data ; Calculate the flow field prediction result at node b located on the physical boundary of the flow field calculation domain in the computational simulation diagram structure data And the boundary conditions at the physical boundary where it is located The deviation between them gives the boundary condition regularization term Where N b Is the total number of nodes located on the physical boundary of the flow field calculation domain in the simulation diagram structure data; Calculate the loss function \(L = L data +\lambda L b , and update the model parameters of the flow field prediction model by minimizing the loss function \(L\) for model training, where \(\lambda\) is the weight coefficient.
10. The graph neural network ship flow field prediction method according to claim 8 or 9, characterized in that, The flow field calculation domain is of a cuboid structure. The physical boundaries of the flow field calculation domain include the left boundary, right boundary, upper boundary, lower boundary, front boundary, rear boundary, and the hull surface boundary of the ship model. The boundary conditions set for the flow field during CFD simulation of the flow around the object include: setting the left boundary as a velocity inlet boundary condition, setting the right boundary as a pressure outlet boundary condition, and setting the other boundaries as non-slip wall boundaries; Project the node features according to the boundary conditions at the physical boundary where node b is located into the feasible region to obtain the projection result including: obtaining the projection result when node b is located on the left boundary of the flow field calculation domain obtaining the projection result when node b is located on the right boundary of the flow field calculation domain obtaining the projection result when node b is located on the upper boundary, lower boundary, front boundary, rear boundary of the flow field calculation domain, and the hull surface boundary of the ship model Alternatively, calculate the flow field prediction result at computational node b and the boundary conditions at its physical boundary The deviation between them includes: when node b is located on the left boundary of the flow field computational domain, the velocity prediction result in the calculated flow field prediction result and u inlet The difference between them is used as the flow field prediction result and the boundary conditions deviation When node b is located on the right boundary of the flow field computational domain, the pressure prediction result in the calculated flow field prediction result and p outlet The difference between them is used as the flow field prediction result and the boundary conditions deviation When node b is located on the upper boundary, lower boundary, front boundary, rear boundary of the flow field computational domain and the hull surface boundary of the ship model, the velocity prediction result in the calculated flow field prediction result and the difference between 0 is used as the flow field prediction result and the boundary conditions deviation where u inlet is the inlet velocity vector at the left boundary, p outlet is the outlet static pressure at the right boundary, and (x, y, z) are the spatial coordinates included in the node characteristics of node b where u is the velocity included in the node characteristics of node b and p is the pressure included in the node characteristics of node b .
Citation Information
Patent Citations
Partial differential equation solving algorithm based on physical information graph neural network and finite difference
CN117421519A
Airfoil flow field prediction method based on hybrid neural network
CN118332898A
Airfoil profile flow field prediction network training method, airfoil profile flow field prediction network, airfoil profile flow field prediction method and medium
CN118350292A