Two-dimensional hydrodynamic equation solving method based on physical information neural network and finite volume
By combining physical information neural networks and the finite volume method, the problems of difficult mesh generation and high computational resource consumption in solving two-dimensional hydrodynamic equations are solved, achieving efficient and accurate hydrodynamic simulation, which is applicable to hydrodynamic analysis in complex environments such as rivers, estuaries, and floodplains.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NORTHWESTERN POLYTECHNICAL UNIV
- Filing Date
- 2026-02-26
- Publication Date
- 2026-06-19
AI Technical Summary
Existing methods for solving two-dimensional hydrodynamic equations are difficult to generate grids in complex river topography and consume a lot of computational resources. Furthermore, the PINN method suffers from error accumulation and sensitivity to higher-order derivatives, making it difficult to efficiently handle flow equations.
By combining physical information neural networks and the finite volume method, and through a custom multilayer perceptron structure and the concept of finite volume, the residuals are calculated and the total loss function is minimized, thereby reducing the number of derivatives and lowering the computational cost.
While ensuring conservation, it avoids the curse of dimensionality, reduces computational costs, and improves the solution speed and accuracy of two-dimensional hydrodynamic equations, making it suitable for hydrodynamic simulation in complex environments.
Smart Images

Figure CN122240976A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this application relate to the field of hydrodynamic calculation technology, and in particular to a method for solving two-dimensional hydrodynamic equations based on physical information neural networks and finite volumes. Background Technology
[0002] Two-dimensional hydrodynamic equations are the classic governing equations for free surface flow on a two-dimensional scale. These equations use water depth and depth-average velocity as the fundamental unknowns, corresponding to the conservation of mass and momentum, respectively. They can effectively simulate unsteady shallow water flow processes in rivers, estuaries, floodplains, and other areas, as well as rapidly changing hydrodynamic phenomena such as dam breaks and flood wave propagation. Because they can accurately reflect the spatiotemporal evolution of the flow field while balancing computational efficiency and physical plausibility, two-dimensional hydrodynamic models have become an important theoretical and technical foundation for river regulation and evolution analysis, flood risk assessment and disaster reduction decision-making, water conservancy project planning and scheduling, and waterway management. They also have significant engineering implications for ensuring watershed water security and improving the level of refined water resource management.
[0003] However, two-dimensional hydrodynamic equations exhibit typical nonlinear characteristics, making it difficult to obtain analytical solutions. Current solutions to hydrodynamic equations primarily rely on traditional numerical methods, such as the Finite Difference Method (FDM), Finite Element Method (FEM), and Finite Volume Method (FVM). These numerical methods have significant limitations in practical calculations, mainly manifested in the difficulty of mesh generation under complex river topography and the high computational resource consumption required for long-term simulations.
[0004] In recent years, with the development of deep learning technology, researchers have proposed a method for solving partial differential equations based on Physics Informed Neural Networks (PINN). The main idea of PINN is to embed the physical equations as residual constraints into the loss function of the neural network, while adding initial and boundary loss terms, ensuring that the prediction results satisfy physical laws. Compared with traditional numerical methods, PINN does not require mesh partitioning, avoiding the "curse of dimensionality" in high-dimensional computation, and is simple, effective, and has significant advantages.
[0005] Despite this, the current PINN method still has certain shortcomings in solving two-dimensional hydrodynamic equations. On the one hand, calculating the loss requires repeated automatic differentiation of the network output to calculate partial derivatives, and each differentiation may introduce numerical errors, leading to error accumulation. On the other hand, higher-order derivatives are sensitive to changes in network parameters, easily causing gradient explosion or vanishing, and the computational cost increases significantly with the order of the derivative, making it difficult to handle flow equations. The traditional FVM method is based on integral conservation forms, directly satisfying conservation laws on the control volume, which has a clearer physical meaning. It can also convert volume integrals into surface integrals, reducing dependence on higher-order derivatives. However, it requires a large amount of resources and storage space for high-dimensional problems and long-term simulations, resulting in high computational costs.
[0006] Therefore, a novel PINN model that combines the advantages of both approaches—ensuring conservation properties while reducing computational costs—is proposed. This is of great significance for simplifying the solution process of two-dimensional hydrodynamic equations and improving the solution speed of two-dimensional hydrodynamic equations. Summary of the Invention
[0007] In view of this, embodiments of this application propose a method for solving two-dimensional hydrodynamic equations based on physical information neural networks and finite volumes. This method can ensure conservation while avoiding the curse of dimensionality caused by difference schemes, reducing the number of derivatives, reducing error accumulation, lowering computational costs, simplifying the solution process of two-dimensional hydrodynamic equations, and improving the solution speed of two-dimensional hydrodynamic equations.
[0008] To achieve the above objectives, embodiments of this application propose a method for solving two-dimensional hydrodynamic equations based on a physical information neural network and finite volume. The method includes: sequentially determining the two-dimensional hydrodynamic control equations, boundary conditions, initial conditions, and observation data satisfied by the computational domain; selecting training points within the computational domain for model training, including equation residual points, boundary constraint points, initial constraint points, and observation data points; constructing a neural network based on a custom multilayer perceptron structure, inputting the spatiotemporal coordinates and corresponding parameters of the training points, and outputting corresponding depth and velocity prediction values through the neural network to establish a preliminary hydrodynamic model; calculating the residuals of the two-dimensional hydrodynamic control equations using the finite volume concept and automatic differentiation technology; calculating the two-dimensional hydrodynamic control equation loss, boundary condition loss, initial condition loss, and observation data loss based on the residuals of the two-dimensional hydrodynamic control equations, and obtaining the total loss function using a weighted sum; minimizing the total loss function using a preset optimization algorithm to obtain the optimal weights and neural network parameters, resulting in the optimal hydrodynamic model; inputting the spatiotemporal coordinates and corresponding parameters of the test points into the optimal hydrodynamic model to obtain the corresponding depth and velocity prediction values output by the optimal hydrodynamic model, and performing error evaluation based on preset evaluation indicators.
[0009] To achieve the above objectives, embodiments of this application also propose an electronic device, including a processor and a memory, wherein the memory stores instructions executable by the processor, and the processor is configured to execute the instructions such that the electronic device can implement the above-described method for solving two-dimensional hydrodynamic equations based on a physical information neural network and finite volume.
[0010] To achieve the above objectives, embodiments of this application also propose a computer-readable storage medium storing a computer program that, when executed by a processor, enables a method for solving two-dimensional hydrodynamic equations based on a physical information neural network and finite volume as described above.
[0011] Optionally, the two-dimensional hydrodynamic governing equations are used to simulate the problem of free surface flow in a horizontal plane. This is a nonlinear hyperbolic PDE system, defined as follows: ; ; ; , ; ; ; in, Represents spatial coordinates, Indicates time, Indicates water depth, that is , and They represent direction and The component of the average flow velocity in the direction, i.e. and , and They represent direction and The slope of the bedbed in a certain direction drives the water flow from higher to lower elevations. The elevation of the subgrade is indicated by its height relative to a reference plane. , and They are respectively direction and The friction slope term in the direction represents the frictional resistance of the subgrade. Manning's roughness coefficient This is the acceleration due to gravity.
[0012] Optionally, training points for model training are selected within the computational domain, including: Training points are selected within the computational domain using uniform sampling, random sampling, or Latin hypercube sampling methods. in, Represents the residual points of the equation. This represents the total number of residual points in the equation. Represents boundary constraint points. This represents the total number of boundary constraint points. Indicates the initial constraint point. This represents the total number of initial constraint points. Indicates the observed data points. This represents the total number of observed data points.
[0013] Optionally, let the neural network built based on a custom multilayer perceptron structure be denoted as . , for Input, For spatial coordinates, Using time as the coordinate, For network parameters, The output is , That is, the output water depth, Components of the average flow velocity in the direction, The component of the average flow velocity in the direction; The structure is defined as follows: ; ; ; ; ; in, Indicates the first The linear transformation result of the hidden layer and They represent the first The weight matrix and bias vector of each hidden layer Indicates the first The output of each hidden layer after the activation function For activation function, Indicates the first Operations on a hidden layer Indicates the operations of the output layer. The total number of hidden layers. .
[0014] Optionally, using the concept of finite volume and automatic differentiation techniques, the residuals of the two-dimensional hydrodynamic governing equations are calculated, including: For a continuity equation, it can be written in the following form: ; ; Regarding its control body We perform a volume integral on the surface, then apply the Gaussian integral to convert the volume integral into a surface integral, which can be written in the following form: ; The surface integral can be expressed in the following form using Gaussian integration: ; in, Represents the residuals of the continuity equation. Gaussian weights, and All are unit outward normal vectors; The processing of the time term borrows from the idea of finite difference, using a second-order precision central difference, to obtain: ; in, Center time, It is a quantity that changes over time; for The momentum equation for the direction can be written in the following form: ; ; ; Similarly, regarding its control body We perform a volume integral on the surface, then apply the Gaussian integral to convert the volume integral into a surface integral, which can be written in the following form: ; The surface integral can be expressed in the following form using Gaussian integration: ; in, express The residual of the momentum equation in the direction; Processing of time items and The same, written in the following form: ; for The momentum equation for the direction can be written in the following form: ; ; ; Similarly, regarding its control body We perform a volume integral on the surface, then apply the Gaussian integral to convert the volume integral into a surface integral, which can be written in the following form: ; The surface integral can be expressed in the following form using Gaussian integration: ; in, express The residual of the momentum equation in the direction; Processing of time items and The same, written in the following form: .
[0015] Optionally, based on the residuals of the two-dimensional hydrodynamic governing equations, the losses of the two-dimensional hydrodynamic governing equations, boundary conditions, initial conditions, and observation data are calculated, and the total loss function is obtained by weighted summation, as shown in the following formula: ; ; ; ; ; in, For the total loss function, To control the loss of the equation, For boundary condition loss, Loss due to initial conditions Due to the loss of observation data, , , , They are respectively , , , The corresponding weighting coefficients for the loss term, , , They are respectively For the The boundary constraint point, the first The initial constraint point, the first Predicted values for each observation data point , , The first The boundary constraint point, the first The initial constraint point, the first The true value of each observed data point.
[0016] Optionally, by minimizing the total loss function using a pre-defined optimization algorithm, the optimal weights and neural network parameters are obtained, leading to the optimal hydrodynamic model, including: By using the stochastic gradient descent algorithm or its variants, the total loss function is minimized until the preset maximum number of iterations is reached, thereby obtaining the optimal weights and neural network parameters and the optimal hydrodynamic model. No. The iteration process is represented as follows: ; in, express In the Network parameters before the next iteration In the Network parameters updated after the next iteration For the first The step size of the next iteration. The gradient of the total loss function with respect to the network parameters is calculated using backpropagation.
[0017] Optionally, the preset evaluation indicators include RMSE, NSE, and L2 relative error. The formulas for calculating RMSE, NSE, and L2 relative error are as follows: ; ; ; in, The number of samples, i.e., the total number of test points. For the first The true value of each test point For the first Predicted values for each test point The mean of the true values. This is the L2 relative error.
[0018] This application proposes a two-dimensional hydrodynamic equation solution method based on physical information neural networks and finite volume. Compared with traditional numerical methods, this method maintains conservation while avoiding the curse of dimensionality caused by difference schemes, thus reducing computational costs. It provides a more flexible, efficient, and physically consistent solution for hydrodynamic simulation in complex environments. This application utilizes the concept of finite volume and Gauss's theorem to simplify residuals. Compared with PINN's repeated use of automatic differentiation to calculate partial derivatives, this method reduces the number of differentiations, decreases error accumulation, and avoids gradient explosion and gradient vanishing. This is significant for improving the solution speed and simplifying the solution process of two-dimensional hydrodynamic equations, exhibiting high accuracy and computational efficiency, and has broad application prospects in the field of hydrodynamics. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies of this application will be briefly introduced below. Obviously, the following drawings are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. The drawings described herein are only used to explain this application and are not intended to limit this application.
[0020] Figure 1 This is a flowchart of a method for solving two-dimensional hydrodynamic equations based on physical information neural networks and finite volume, provided in one embodiment of this application; Figure 2 This is a schematic diagram of the structure of a physical information neural network provided in one embodiment of this application; Figure 3 This is a schematic diagram of the structure of an electronic device provided in another embodiment of this application. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the various embodiments of this application will be described in detail below with reference to the accompanying drawings. Those skilled in the art will understand that many technical details have been provided in the embodiments of this application to facilitate better understanding. However, the technical solutions claimed in this application can be implemented even without these technical details and various variations and modifications based on the following embodiments. The division of the following embodiments is for ease of description and should not constitute any limitation on the specific implementation of this application. The following embodiments can be combined with and referenced by each other without contradiction.
[0022] One embodiment of this application proposes a method for solving two-dimensional hydrodynamic equations based on physical information neural networks and finite volumes. The implementation details of the method for solving two-dimensional hydrodynamic equations based on physical information neural networks and finite volumes proposed in this embodiment are described in detail below. The following implementation details are provided for ease of understanding and are not necessary for implementing this solution.
[0023] The specific process of the two-dimensional hydrodynamic equation solution method based on physical information neural network and finite volume proposed in this embodiment can be described as follows: Figure 1 As shown, it includes: Step 11: Sequentially determine the two-dimensional hydrodynamic control equations, boundary conditions, initial conditions, and observation data that the computational domain satisfies, and select training points for model training within the computational domain. The selected training points include equation residual points, boundary constraint points, initial constraint points, and observation data points.
[0024] In practice, to solve the two-dimensional hydrodynamic equations, it is first necessary to determine the two-dimensional hydrodynamic governing equations, boundary conditions, initial conditions, and observation data that the computational domain satisfies. Then, training points for model training are selected within the computational domain. The selected training points include four types: equation residual points, boundary constraint points, initial constraint points, and observation data points.
[0025] In one example, we consider an irregular river channel with a total length of 16.1 km, located at the confluence of the Chippo River and the Mississippi River. This channel contains an island in the middle, and the riverbanks may be submerged during floods. A bridge is constructed across this channel to test its ability to handle complex conditions.
[0026] The two-dimensional hydrodynamic governing equations are used to simulate free surface flow in a horizontal plane. They are a nonlinear hyperbolic PDE system that describes the conservation of water mass and depth-average momentum, and are defined as follows: ; ; ; , ; ; ; in, Represents spatial coordinates, in meters. Indicates time, in seconds. Indicates water depth, that is The unit is meters. and They represent direction and The component of the average flow velocity in the direction, i.e. and The unit is meters per second. and They represent direction and The slope of the bedbed in a certain direction drives the water flow from higher to lower elevations. The elevation of the subgrade is indicated by its height relative to a reference plane. , and They are respectively direction and The friction slope term in the direction represents the frictional resistance of the subgrade. Manning's roughness coefficient Let be the acceleration due to gravity, and take . , The terrain data was obtained from HEC-RAS.
[0027] In one example, we select training points within the computational domain using uniform sampling, random sampling, or Latin hypercube sampling. Among the selected training points, Represents the residual points of the equation. This represents the total number of residual points in the equation. Represents boundary constraint points. This represents the total number of boundary constraint points. Indicates the initial constraint point. This represents the total number of initial constraint points. Indicates the observed data points. This represents the total number of observed data points.
[0028] In one example , .
[0029] Step 12: Construct a neural network based on a custom multilayer perceptron structure, input the spatiotemporal coordinates of the training points and their corresponding parameters, and output the corresponding depth and velocity prediction values through the neural network to establish a preliminary hydrodynamic model.
[0030] In practice, after selecting the training points, a neural network can be built based on a custom multilayer perceptron structure. The spatiotemporal coordinates and corresponding parameters of the training points are input into the neural network, and the corresponding depth and velocity prediction values are output through the neural network to establish a preliminary hydrodynamic model.
[0031] In one example, refer to Figure 2 The neural network takes the spatiotemporal coordinates of each sampling point as input and the physical field as output. Let the neural network built based on a custom multilayer perceptron structure be denoted as... , for Input, For spatial coordinates, Using time as the coordinate, For network parameters, The output is , That is, the output water depth, Components of the average flow velocity in the direction, The component of the average flow velocity in the direction.
[0032] The structure is defined as follows: ; ; ; ; ; in, Indicates the first The linear transformation result of the hidden layer and They represent the first The weight matrix and bias vector of each hidden layer Indicates the first The output of each hidden layer after the activation function For activation function, Indicates the first Operations on a hidden layer Indicates the operations of the output layer. The total number of hidden layers. .
[0033] In one example, there are 7 hidden layers ( Each hidden layer contains 64 neurons.
[0034] In one example, the activation function could be the tanh function, the ReLU function, or the sigmoid function.
[0035] In one example, the equation residual points, boundary constraint points, initial constraint points, and observation data points are input to... The output for the residual point of the equation is The output for the boundary constraint points is The output for the initial constraint point is The output for the observed data points is .
[0036] Step 13: Using the concept of finite volume and automatic differentiation techniques, calculate the residuals of the two-dimensional hydrodynamic governing equations.
[0037] In practical implementation, after establishing a preliminary hydrodynamic model, it is necessary to use the concept of finite volume and automatic differentiation techniques to calculate the residuals of the two-dimensional hydrodynamic governing equations.
[0038] In one example, this embodiment uses PyTorch's `torch.autograd.grad` function to calculate the output of the equation's residual points. Relative to input First-order partial derivatives , , Substitute the output of the residual points of the equation and the calculation results of the partial derivatives into the equation to calculate the residuals of the governing equation.
[0039] For a continuity equation, it can be written in the following form: ; .
[0040] Regarding its control body We perform a volume integral on the surface, then apply the Gaussian integral to convert the volume integral into a surface integral, which can be written in the following form: .
[0041] The surface integral can be expressed in the following form using Gaussian integration: ; in, Represents the residuals of the continuity equation. Gaussian weights, and All are unit external normal vectors.
[0042] The processing of the time term borrows from the idea of finite difference, using a second-order precision central difference, to obtain: ; in, Center time, This represents the change over time.
[0043] for The momentum equation for the direction can be written in the following form: ; ; .
[0044] Similarly, regarding its control body We perform a volume integral on the surface, then apply the Gaussian integral to convert the volume integral into a surface integral, which can be written in the following form: .
[0045] The surface integral can be expressed in the following form using Gaussian integration: ; in, express The residual of the momentum equation in the direction.
[0046] Processing of time items and The same, written in the following form: .
[0047] for The momentum equation for the direction can be written in the following form: ; ; .
[0048] Similarly, regarding its control body We perform a volume integral on the surface, then apply the Gaussian integral to convert the volume integral into a surface integral, which can be written in the following form: .
[0049] The surface integral can be expressed in the following form using Gaussian integration: ; in, express The residual of the momentum equation in the direction.
[0050] Processing of time items and The same, written in the following form: .
[0051] Step 14: Based on the residuals of the two-dimensional hydrodynamic control equations, calculate the two-dimensional hydrodynamic control equation loss, boundary condition loss, initial condition loss, and observation data loss, and obtain the total loss function using a weighted sum form.
[0052] In practical implementation, after calculating the residuals of the two-dimensional hydrodynamic governing equations, the losses of the two-dimensional hydrodynamic governing equations, boundary conditions, initial conditions, and observation data can be calculated based on the residuals of the two-dimensional hydrodynamic governing equations, and the total loss function can be obtained by weighted summation.
[0053] In one example, the total loss function is expressed by the formula: ; ; ; ; ; in, For the total loss function, To control the loss of the equation, For boundary condition loss, Loss due to initial conditions Due to the loss of observation data, , , , They are respectively , , , The corresponding weighting coefficients for the loss term, , , They are respectively For the The boundary constraint point, the first The initial constraint point, the first Predicted values for each observation data point , , The first The boundary constraint point, the first The initial constraint point, the first The true value of each observed data point.
[0054] In one example , .
[0055] Step 15: Minimize the total loss function using a preset optimization algorithm to obtain the optimal weights and neural network parameters, thus obtaining the optimal hydrodynamic model.
[0056] In practical implementation, after obtaining the total loss function, the total loss function can be minimized using a preset optimization algorithm to obtain the optimal weights and neural network parameters, thereby obtaining the optimal hydrodynamic model.
[0057] In one example, this embodiment uses the stochastic gradient descent algorithm or its variants to minimize the total loss function until a preset maximum number of iterations is reached, thereby obtaining the optimal weights and neural network parameters and the optimal hydrodynamic model.
[0058] No. The iteration process is represented as follows: ; in, express In the Network parameters before the next iteration In the Network parameters updated after the next iteration For the first The step size of the next iteration. The gradient of the total loss function with respect to the network parameters is calculated using backpropagation.
[0059] In one example, this embodiment uses a learning rate warmup algorithm, with the initial learning rate set to 0.0003 and the number of warmup steps set to 5000.
[0060] Step 16: Input the spatiotemporal coordinates and corresponding parameters of the test point into the optimal hydrodynamic model to obtain the corresponding depth and velocity prediction values output by the optimal hydrodynamic model, and perform error evaluation based on the preset evaluation index.
[0061] In practice, after obtaining the optimal hydrodynamic model, it is necessary to input the spatiotemporal coordinates of the test points and the corresponding parameters into the optimal hydrodynamic model to obtain the corresponding depth and velocity prediction values output by the optimal hydrodynamic model, and to conduct error evaluation based on the preset evaluation index.
[0062] In one example, the preset evaluation metrics include RMSE, NSE, and L2 relative error. RMSE can intuitively reflect the range of the model's prediction error. The numerator of NSE is the model's prediction error, and the denominator is the fluctuation of the data itself compared to the mean. The closer the NSE is to 1, the better the model's performance. The closer the L2 relative error value is to 0, the higher the prediction accuracy.
[0063] The formulas for calculating RMSE, NSE, and L2 relative error are as follows: ; ; ; in, The number of samples, i.e., the total number of test points. For the first The true value of each test point For the first Predicted values for each test point The mean of the true values. This is the L2 relative error.
[0064] In one example, the proposed solution method combining physical information neural networks and finite volume yields relative errors of 0.98, 0.03, and 0.06 for water depth in a river channel containing an island, and 0.98, 0.03, and 0.06 for velocity. With the addition of a bridge across the river in the same channel, the relative errors of 0.96, 0.05, and 0.12 for water depth, and 0.95, 0.05, and 0.11 for velocity.
[0065] This embodiment proposes a two-dimensional hydrodynamic equation solution method based on physical information neural networks and finite volume. Compared with traditional numerical methods, it avoids the curse of dimensionality caused by difference schemes while ensuring conservation, thus reducing computational costs. It provides a more flexible, efficient, and physically consistent solution for hydrodynamic simulation in complex environments. This embodiment simplifies residuals using the finite volume concept and Gauss's theorem. Compared with PINN's repeated use of automatic differentiation to calculate partial derivatives, it reduces the number of differentiations, decreases error accumulation, and avoids gradient explosion and gradient vanishing. This is significant for improving the solution speed and simplifying the solution process of two-dimensional hydrodynamic equations, exhibiting high accuracy and computational efficiency, and has broad application prospects in the field of hydrodynamics.
[0066] The steps described above are merely for clarity in describing the technical solution. In actual implementation, they can be combined into one step, or certain steps can be broken down into multiple steps, as long as they involve the same logical relationship, they are all within the scope of protection of this application. Any insignificant modifications or designs added to the algorithm or process, as long as they do not change the core of the algorithm or process, are also within the scope of protection of this application.
[0067] Another embodiment of this application provides an electronic device, such as Figure 3 As shown, it includes a processor 21 and a memory 22. The memory 22 stores instructions that the processor 21 can execute. When the processor 21 is configured to execute the instructions, the electronic device can implement a two-dimensional hydrodynamic equation solution method based on physical information neural network and finite volume as described in the above method embodiment.
[0068] The memory and processor are connected via a bus, which includes any number of interconnecting buses and bridges. The bus can connect various circuits of one or more processors and memories, as well as other circuits such as peripherals, voltage regulators, and power management circuits—all well-known in the art and therefore not described further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver can be a single component or multiple components, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by the processor is transmitted over the wireless medium via an antenna, which also receives and transmits data to the processor.
[0069] The processor manages the bus and handles general processing, providing various functions, including but not limited to timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory, on the other hand, is used to store data used by the processor during operation.
[0070] Another embodiment of this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, can implement a method for solving two-dimensional hydrodynamic equations based on a physical information neural network and finite volume as described in the above method embodiments.
[0071] That is, those skilled in the art will understand that all or part of the steps in the above method embodiments can be implemented by a program instructing related hardware. The program is stored in a storage medium and includes several instructions to cause a device (such as a microcontroller, chip, etc.) or processor to execute all or part of the steps of the method described in the method embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.
[0072] It will be understood by those skilled in the art that the above embodiments are specific implementations of this application, and various changes in form and detail can be made in practical applications without departing from the spirit and scope of this application. For those skilled in the art, several improvements and modifications can be made without departing from the principles of this application, and these improvements and modifications are also considered to be within the scope of protection of this application.
Claims
1. A method for solving two-dimensional hydrodynamic equations based on physical information neural networks and finite volume, characterized in that, The method includes: The two-dimensional hydrodynamic control equations, boundary conditions, initial conditions, and observation data satisfied by the computational domain are determined in sequence. Training points for model training are selected within the computational domain, including equation residual points, boundary constraint points, initial constraint points, and observation data points. A neural network is constructed based on a custom multilayer perceptron structure. The spatiotemporal coordinates of the training points and their corresponding parameters are input, and the neural network outputs the corresponding depth and velocity prediction values to establish a preliminary hydrodynamic model. Using the concept of finite volume and automatic differentiation techniques, the residuals of the two-dimensional hydrodynamic governing equations are calculated; Based on the residuals of the two-dimensional hydrodynamic governing equations, the losses of the two-dimensional hydrodynamic governing equations, boundary conditions, initial conditions, and observation data are calculated, and the total loss function is obtained by weighted summation. By minimizing the total loss function using a pre-defined optimization algorithm, the optimal weights and neural network parameters are obtained, leading to the optimal hydrodynamic model. Input the spatiotemporal coordinates and corresponding parameters of the test points into the optimal hydrodynamic model, obtain the corresponding depth and velocity prediction values output by the optimal hydrodynamic model, and perform error evaluation based on the preset evaluation index.
2. The method for solving two-dimensional hydrodynamic equations based on physical information neural networks and finite volume as described in claim 1, characterized in that, The two-dimensional hydrodynamic governing equations are used to simulate the flow on a free surface in a horizontal plane. This is a nonlinear hyperbolic PDE system, defined as follows: ; ; ; , ; ; ; in, Represents spatial coordinates, Indicates time, Indicates water depth, that is , and They represent direction and The component of the average flow velocity in the direction, i.e. and , and They represent direction and The slope of the bedbed in a certain direction drives the water flow from higher to lower elevations. The elevation of the subgrade is indicated by its height relative to a reference plane. , and They are respectively direction and The friction slope term in the direction represents the frictional resistance of the subgrade. Manning's roughness coefficient This is the acceleration due to gravity.
3. The method for solving two-dimensional hydrodynamic equations based on physical information neural networks and finite volume as described in claim 2, characterized in that, Training points for model training are selected within the computational domain, including: Training points are selected within the computational domain using uniform sampling, random sampling, or Latin hypercube sampling methods. in, Represents the residual points of the equation. This represents the total number of residual points in the equation. Represents boundary constraint points. This represents the total number of boundary constraint points. Indicates the initial constraint point. This represents the total number of initial constraint points. Indicates the observed data points. This represents the total number of observed data points.
4. The method for solving two-dimensional hydrodynamic equations based on physical information neural networks and finite volume as described in claim 3, characterized in that, Let the neural network built based on a custom multilayer perceptron structure be denoted as . , for Input, For spatial coordinates, Using time as the coordinate, For network parameters, The output is , That is, the output water depth, Components of the average flow velocity in the direction, The component of the average flow velocity in the direction; The structure is defined as follows: ; ; ; ; ; in, Indicates the first The linear transformation result of the hidden layer and They represent the first The weight matrix and bias vector of each hidden layer Indicates the first The output of each hidden layer after the activation function For activation function, Indicates the first Operations on a hidden layer Indicates the operations of the output layer. The total number of hidden layers. .
5. The method for solving two-dimensional hydrodynamic equations based on physical information neural networks and finite volume as described in claim 4, characterized in that, Using the concept of finite volume and automatic differentiation techniques, the residuals of the two-dimensional hydrodynamic governing equations are calculated, including: For a continuity equation, it can be written in the following form: ; ; Regarding its control body We perform a volume integral on the surface, then apply the Gaussian integral to convert the volume integral into a surface integral, which can be written in the following form: ; The surface integral can be expressed in the following form using Gaussian integration: ; in, Represents the residuals of the continuity equation. Gaussian weights, and All are unit outward normal vectors; The processing of the time term borrows from the idea of finite difference, using a second-order precision central difference, to obtain: ; in, Center time, It is a quantity that changes over time; for The momentum equation for the direction can be written in the following form: ; ; ; Similarly, regarding its control body We perform a volume integral on the surface, then apply the Gaussian integral to convert the volume integral into a surface integral, which can be written in the following form: ; The surface integral can be expressed in the following form using Gaussian integration: ; in, express The residual of the momentum equation in the direction; Processing of time items and The same, written in the following form: ; for The momentum equation for the direction can be written in the following form: ; ; ; Similarly, regarding its control body We perform a volume integral on the surface, then apply the Gaussian integral to convert the volume integral into a surface integral, which can be written in the following form: ; The surface integral can be expressed in the following form using Gaussian integration: ; in, express The residual of the momentum equation in the direction; Processing of time items and The same, written in the following form: 。 6. The method for solving two-dimensional hydrodynamic equations based on physical information neural networks and finite volume as described in claim 5, characterized in that, Based on the residuals of the two-dimensional hydrodynamic governing equations, the losses of the two-dimensional hydrodynamic governing equations, boundary conditions, initial conditions, and observation data are calculated, and the total loss function is obtained by weighted summation, which is achieved through the following formula: ; ; ; ; ; in, For the total loss function, To control the loss of the equation, For boundary condition loss, Loss due to initial conditions Due to the loss of observation data, , , , They are respectively , , , The corresponding weighting coefficients for the loss term, , , They are respectively For the The boundary constraint point, the first The initial constraint point, the first Predicted values for each observation data point , , The first The boundary constraint point, the first The initial constraint point, the first The true value of each observed data point.
7. The method for solving two-dimensional hydrodynamic equations based on physical information neural networks and finite volume as described in claim 6, characterized in that, By minimizing the total loss function using a pre-defined optimization algorithm, the optimal weights and neural network parameters are obtained, leading to the optimal hydrodynamic model, including: By using the stochastic gradient descent algorithm or its variants, the total loss function is minimized until the preset maximum number of iterations is reached, thereby obtaining the optimal weights and neural network parameters and the optimal hydrodynamic model. No. The iteration process is represented as follows: ; in, express In the Network parameters before the next iteration In the Network parameters updated after the next iteration For the first The step size of the next iteration. The gradient of the total loss function with respect to the network parameters is calculated using backpropagation.
8. A method for solving two-dimensional hydrodynamic equations based on physical information neural networks and finite volumes, as described in any one of claims 1 to 7, characterized in that... The preset evaluation metrics include RMSE, NSE, and L2 relative error. The formulas for calculating RMSE, NSE, and L2 relative error are as follows: ; ; ; in, The number of samples, i.e., the total number of test points. For the first The true value of each test point For the first Predicted values for each test point The mean of the true values. This is the L2 relative error.
9. An electronic device, characterized in that, include: The processor and memory, wherein the memory stores instructions that the processor can execute, and the processor is configured to, when executing the instructions, enable the electronic device to implement a method for solving two-dimensional hydrodynamic equations based on a physical information neural network and finite volume as described in any one of claims 1 to 8.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it can implement a method for solving two-dimensional hydrodynamic equations based on physical information neural networks and finite volume, as described in any one of claims 1 to 8.