A method for parallel computation of surface shallow water dynamics based on multiple graphic processors
By performing parallel computation of shallow water dynamics on multiple graphics processors and using the finite volume method and modified term formulas to process the full energy data of water flow, the problems of low accuracy and low efficiency in multi-GPU computing are solved, and a high-efficiency improvement in computational accuracy is achieved.
Patent Information
- Application Number
- CN202511385897.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-26
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2045-09-26
AI Technical Summary
Multi-GPU parallel computing suffers from low computational accuracy and inefficiency in shallow water dynamic processes, especially after reducing communication frequency, which makes it impossible to guarantee computational accuracy and flow field integrity.
A parallel computational method for shallow water dynamics based on multiple GPUs is adopted. The method discretizes the data on triangular cells using the finite volume method, and uses multiple GPUs to process the regional partitions separately. The total energy data of the water flow and the initial boundary water level value are corrected by the correction term, which reduces the communication frequency between GPUs and improves the computational accuracy and efficiency.
It significantly improves the accuracy and efficiency of shallow water dynamics calculations, with the calculation accuracy improved by approximately 5.3 times that of single-GPU calculations and the communication efficiency improved by approximately 3 times that of calculations using 4 GPUs per communication.
Smart Images

Figure CN120874483B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present specification relates to the technical field of surface water dynamics analysis, in particular to a surface shallow water dynamics parallel computing method based on multiple graphic processors. BACKGROUND
[0002] GPU parallel computing is known for its massive parallel computing cores and efficient concurrency, which greatly improves the efficiency of surface shallow water dynamics calculation. A single GPU often cannot handle the calculation of complex regional surface shallow water dynamics process, so the global calculation area needs to be partitioned, and each GPU operates on a partition, thereby performing multi-GPU parallel computing. When multi-GPU parallel computing is performed, in each time iteration step, the existing computing method needs to communicate between multiple GPU hardware, that is, real-time exchange of variable data between each calculation region partition to ensure calculation accuracy and ensure the integrity of the flow field. However, communication between multiple GPU hardware will significantly reduce the calculation speed. If the communication frequency between multiple GPUs is reduced, that is, communication between GPUs once every n time iteration steps, this will result in uncontrollable calculation errors, because the calculation region partitions on each GPU cannot communicate in real time, and thus the integrity of the simulated flow field cannot be guaranteed, thereby the calculation error cannot be controlled, resulting in loss of calculation accuracy, and even failure of the calculation process. SUMMARY
[0003] In view of the above problems in the prior art, the surface shallow water dynamics parallel computing method based on multiple graphic processors provided by the present application solves the problems of low water dynamics calculation accuracy and low efficiency.
[0004] In order to achieve the above-mentioned purpose of the application, the technical scheme adopted by the present application is as follows: a surface shallow water dynamics parallel computing method based on multiple graphic processors, comprising:
[0005] S1: obtaining surface shallow water region data;
[0006] S2: based on the surface shallow water region data and the surface shallow water equation, using the finite volume method to discretize on the triangular element, obtaining the region partition and the initial boundary water level value;
[0007] S3: using multiple graphic processors to correspond to the region partition, each partition is respectively run on a graphic processor, obtaining the water flow total energy data between the elements;
[0008] S4: analyzing the water flow total energy data between all elements, calculating based on adjacent triangular elements, obtaining the region partition flow direction data;
[0009] S5: Based on the regional partition flow data, the water flow total energy data and the initial boundary water level value are corrected to obtain the surface shallow water power parallel calculation result, and the parallel calculation of the surface shallow water power is completed.
[0010] Further, the expression of the surface shallow water equation is:
[0011] ;
[0012] ;
[0013] ;
[0014] wherein, H represents the surface water depth, t represents time, u represents the flow velocity along the x coordinate direction, and and represent the x coordinate direction, u represents the flow velocity along the x coordinate direction, q represents the unit width flow along the x coordinate direction, g represents the gravitational acceleration, h represents the surface water level, n represents the roughness coefficient, v represents the velocity vector containing two components of u and w, and q represents the unit width flow along the x coordinate direction. Further, the expression of the momentum conservation equation of the regional partition is: ;
[0015]
[0016] ;
[0017] ;
[0018] ; wherein,
[0019] , , , , , and all represent the triangular cell coefficient, hi+1 represents the water depth of the triangular cell i at the n+1 time step, hi represents the water depth of the triangular cell i at the n time step, Δt / A represents the ratio of the time step to the cell area, denotes the water depth of the first triangular cell adjacent to triangular cell i at time step n+1, denotes the water depth of the second triangular cell adjacent to triangular cell i at time step n+1, denotes the water depth of the third triangular cell adjacent to triangular cell i at time step n+1, denotes the unit width discharge in x-direction in triangular cell i at time step n+1, denotes the unit width discharge in x-direction in triangular cell i at time step n, denotes the unit width discharge in x-direction in the first triangular cell adjacent to triangular cell i at time step n+1, denotes the unit width discharge in x-direction in the second triangular cell adjacent to triangular cell i at time step n+1, denotes the unit width discharge in x-direction in the third triangular cell adjacent to triangular cell i at time step n+1, denotes the gravitational acceleration, which is taken as 9.8 m / s2, denotes the water level value on the first edge of triangular cell i at time step n+1, denotes the first component of the outward unit normal vector on the first edge of triangular cell i, denotes the length of the first edge of triangular cell i, denotes the water level value on the second edge of triangular cell i at time step n+1, denotes the first component of the outward unit normal vector on the second edge of triangular cell i, denotes the length of the second edge of triangular cell i, denotes the water level value on the third edge of triangular cell i at time step n+1, denotes the first component of the outward unit normal vector on the third edge of triangular cell i, denotes the length of the third edge of triangular cell i, denotes the time step length, denotes the velocity vector at the centroid of triangular cell i at time step n+1, denotes the water depth at the centroid of triangular cell i at time step n+1, denotes the unit width discharge in y-direction in triangular cell i at time step n+1, denotes the unit width discharge in y-direction in triangular cell i at time step n, denotes the unit width discharge in y-direction in the first triangular cell adjacent to triangular cell i at time step n+1, Qy, i, n+1 represents the unit-width flow rate in the y-coordinate direction in the second triangular cell adjacent to triangular cell i at the n+1 time step, Qy, i, n+1 represents the unit-width flow rate in the y-coordinate direction in the third triangular cell adjacent to triangular cell i at the n+1 time step, Qy, i, n+1 represents the unit-width flow rate in the y-coordinate direction in the third triangular cell adjacent to triangular cell i at the n+1 time step, Qy, i, n+1 represents the unit-width flow rate in the y-coordinate direction in the third triangular cell adjacent to triangular cell i at the n+1 time step, Qy, i, n+1 represents the unit-width flow rate in the y-coordinate direction in the third triangular cell adjacent to triangular cell i at the n+1 time step.
[0020] Further, the expression of the initial boundary water level value is:
[0021] ;
[0022] wherein, Qj, i, n represents the water level value on the jth edge of triangular cell i at the n time step, Q, i, n represents the water level value of triangular cell i at the n time step, Qj, i, n represents the water level value of the cell j adjacent to triangular cell i at the n time step, Q, i, n represents the terrain value of the triangular cell adjacent to triangular cell i, Qj, i, n represents the water level value on the jth edge of triangular cell i at the n time step,
[0023] Further, the expression of the cell coefficient is:
[0024] ;
[0025] ;
[0026] ;
[0027] ;
[0028] ;
[0029] ;
[0030] wherein, Qx, i represents the flow rate in the x direction at the centroid of triangular cell i, Qx, i represents the flow rate in the x direction at the centroid of triangular cell i, Qx, i represents the flow rate in the x direction at the centroid of triangular cell i, Qx, i represents the flow rate in the x direction at the centroid of triangular cell i, second component of the outward unit normal vector on the first edge of the triangular cell, flow velocity along the y-direction at the boundary between the triangular cell i and the first neighboring triangular cell, length of the first edge of the triangular cell, first component of the outward unit normal vector on the second edge of the triangular cell, flow velocity along the x-direction at the boundary between the triangular cell i and the second neighboring triangular cell, second component of the outward unit normal vector on the second edge of the triangular cell, flow velocity along the y-direction at the boundary between the triangular cell i and the second neighboring triangular cell, length of the second edge of the triangular cell, first component of the outward unit normal vector on the third edge of the triangular cell, flow velocity along the x-direction at the boundary between the triangular cell i and the third neighboring triangular cell, second component of the outward unit normal vector on the third edge of the triangular cell, flow velocity along the y-direction at the boundary between the triangular cell i and the third neighboring triangular cell, length of the third edge of the triangular cell.
[0031] Further, the expression of the total energy of water flow between the cells is:
[0032] ;
[0033] ;
[0034] wherein, total energy on the left side of the shared boundary between the triangular cell i and the first neighboring triangular cell, water depth of the triangular cell i, flow velocity along the x-direction at the centroid of the triangular cell i, first component of the outward unit normal vector on the first edge of the triangular cell, second component of the outward unit normal vector on the first edge of the triangular cell, flow velocity along the y-direction at the centroid of the triangular cell i, gravitational acceleration, taking the value of 9.8 m / s2, water depth at the boundary between the triangular cell i and the first neighboring triangular cell, water level at the centroid of the triangular cell i, denotes the total energy of the first neighboring triangle cell of triangle cell i, denotes the water depth of the first neighboring triangle cell of triangle cell i, denotes the water level at the centroid of triangle cell i, denotes the flow rate in the x direction of the first neighboring triangle cell of triangle cell i, denotes the flow rate in the y direction of the first neighboring triangle cell of triangle cell i, denotes the water level of the first neighboring triangle cell of triangle cell i.
[0035] Further, the S5 comprises:
[0036] The flow rate correction equation in the momentum conservation discrete equation on both sides of the demarcation line is obtained by correcting the momentum conservation equation with the constructed correction term;
[0037] Based on the regional partition flow direction data, the flow rate correction equation in the momentum conservation discrete equation on both sides of the demarcation line is used to correct the water flow total energy data and the initial boundary water level value of the inflow cell, so as to obtain the boundary water level calculation result;
[0038] The boundary water level calculation result is analyzed to obtain the surface shallow water dynamic parallel calculation result, and the parallel calculation of the surface shallow water dynamic is completed.
[0039] Further, the expression of the correction term is:
[0040] ;
[0041] wherein, denotes the single-width flow rate difference in the x direction of the first neighboring triangle cell of triangle cell i, denotes the single-width flow rate in the x direction of the first neighboring triangle cell of triangle cell i after iteration for N time steps, denotes the single-width flow rate in the x direction of the first neighboring triangle cell of triangle cell i at the time of the n+1 time step, denotes the number of iteration time steps, denotes the single-width flow rate difference in the y direction of the first neighboring triangle cell of triangle cell i, denotes the single-width flow rate in the y direction of the first neighboring triangle cell of triangle cell i after iteration for N time steps, denotes the single-width flow rate in the y direction of the first neighboring triangle cell of triangle cell i at the time of the n+1 time step.
[0042] Further, the expression of the flow correction equation in the momentum conservation discrete form on both sides of the dividing line is:
[0043] ;
[0044] ;
[0045] wherein, , , , , and represent the triangular cell coefficient, represents the water depth of the triangular cell i at the n+1 time step, represents the water depth of the triangular cell i at the n time step, represents the ratio of the time step to the cell area, represents the water depth of the first triangular cell adjacent to the triangular cell i at the n+1 time step, represents the water depth of the second triangular cell adjacent to the triangular cell i at the n+1 time step, represents the water depth of the third triangular cell adjacent to the triangular cell i at the n+1 time step, represents the unit width flow in the x coordinate direction in the triangular cell i at the n+1 time step, represents the unit width flow in the x coordinate direction in the triangular cell i at the n time step, represents the unit width flow in the x coordinate direction in the first triangular cell adjacent to the triangular cell i at the n+1 time step, represents the unit width flow in the x coordinate direction in the second triangular cell adjacent to the triangular cell i at the n+1 time step, represents the unit width flow in the x coordinate direction in the third triangular cell adjacent to the triangular cell i at the n+1 time step, represents the gravitational acceleration, which is 9.8 m / s2, represents the water level value on the first edge of the triangular cell i at the n+1 time step, represents the first component of the outward unit normal vector on the first edge of the triangular cell, represents the length of the first edge of the triangular cell, represents the water level value on the second edge of the triangular cell i at the n+1 time step, represents the first component of the outward unit normal vector on the second edge of the triangular cell, represents the length of the second edge of the triangular cell, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step,
[0046] Further, the expression of the boundary water level calculation result of the inflow cell is:
[0047] ;
[0048] wherein, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step, hni+1, i, 3 represents the water level value on the third edge of the triangular cell i at the n+1 time step,
[0049] The beneficial effects of the present application are: the present application provides a surface shallow water dynamic parallel computing method based on multiple graphic processors, based on surface shallow water region data and surface shallow water equation, using finite volume method to discretize on triangular cells, obtaining region partition and initial boundary water level value, using multiple graphic processors to correspond with the region partition, each partition running on a graphic processor to obtain surface shallow water dynamic parallel computing result, completing parallel computing of surface shallow water dynamic. In this way, the surface shallow water dynamic calculation accuracy and calculation efficiency are greatly improved. BRIEF DESCRIPTION OF DRAWINGS
[0050] The present specification will be further illustrated in the form of exemplary embodiments, which will be described in detail with reference to the drawings. These embodiments are not restrictive, and in these embodiments, the same numbers represent the same structures, wherein:
[0051] Figure 1 is an exemplary flow chart of a surface shallow water dynamic parallel computing method based on multiple graphic processors according to some embodiments of the present specification;
[0052] Figure 2 is an exemplary schematic diagram of triangular cell subdivision and topological relationship according to some embodiments of the present specification;
[0053] Figure 3 is an exemplary schematic diagram of computing region partition when four GPUs are parallel computing according to some embodiments of the present specification;
[0054] Figure 4 is an exemplary schematic diagram of triangular cell topological relationship and water flow direction according to some embodiments of the present specification;
[0055] Figure 5 is an exemplary schematic diagram of water flow movement direction between adjacent triangular cells through interface according to some embodiments of the present specification;
[0056] Figure 6 is an exemplary schematic diagram of irrigation district water network partition when four GPUs are parallel computing according to some embodiments of the present specification;
[0057] Figure 7 is an exemplary schematic diagram of irrigation district water network 7 flow monitoring section distribution according to some embodiments of the present specification;
[0058] Figure 8 is an exemplary schematic diagram of flow simulation process of water network 7 flow monitoring sections according to some embodiments of the present specification;
[0059] Figure 9is an exemplary schematic diagram of simulated and measured flow comparison of three flow monitoring sections of a water network according to some embodiments of the present specification. DETAILED DESCRIPTION
[0060] The specific embodiments of the present application are described below to enable a person skilled in the art to understand the present application, but it should be clear that the present application is not limited to the scope of the specific embodiments, and for those of ordinary skill in the art, it is obvious that various changes are within the spirit and scope of the present application defined and determined by the appended claims, and all the inventions utilizing the concept of the present application are within the scope of protection.
[0061] EMBODIMENT
[0062] Figure 1 is an exemplary flow chart of a multi-GPU based surface shallow water dynamic parallel computing method according to some embodiments of the present specification. As shown in Figure 1 , the flow includes the following steps. In some embodiments, the flow can be executed by a graphics processor.
[0063] S1: Obtain surface shallow water region data.
[0064] The surface shallow water region data is the flow-related data of the surface flow region. The surface shallow water region can include the flow-related data of the regions of river water, lake water, and glaciers existing in solid form.
[0065] S2: Based on the surface shallow water region data and the surface shallow water equation, discretize on a triangular cell using the finite volume method to obtain region partitioning and initial boundary water level values.
[0066] The surface shallow water equation is a control equation for describing the physical law of surface shallow water.
[0067] In some embodiments, the expression of the surface shallow water equation can be:
[0068] ;
[0069] ;
[0070] ;
[0071] wherein, denotes the surface water depth, denotes time, denotes the flow velocity along the coordinate direction, and denote the coordinate direction, denotes the flow velocity along the coordinate direction, Qx represents the unit width flow along the x coordinate direction, Qx represents the unit width flow along the x coordinate direction, g represents the gravity acceleration, h represents the ground water level, C represents the roughness coefficient, Qx represents the unit width flow along the x coordinate direction, and Qx represents the unit width flow along the x coordinate direction, Qx represents the unit width flow along the x coordinate direction. Qx represents the unit width flow along the x coordinate direction.
[0072] The area partition is discretized into triangular cells.
[0073] In some embodiments, the graphics processor can discretize the calculation area into triangular cells, and discretize the triangular cells by using the finite volume method to obtain an area partition with a momentum conservation equation; wherein the label symbols of the triangular cells and the surrounding cells are as shown in Figure 2 .
[0074] In some embodiments, the momentum conservation equation expression of the area partition is:
[0075] ;
[0076] ;
[0077] ;
[0078] wherein, , , , , and all represent triangular cell coefficients, hni+1 represents the water depth of the triangular cell i at the n+1 time step, hni represents the water depth of the triangular cell i at the n time step, Δt represents the time step length and the cell area ratio, hni+1 represents the water depth of the first triangular cell adjacent to the triangular cell i at the n+1 time step, hni+1 represents the water depth of the second triangular cell adjacent to the triangular cell i at the n+1 time step, hni+1 represents the water depth of the third triangular cell adjacent to the triangular cell i at the n+1 time step, Qxi+1 represents the unit width flow along the x coordinate direction in the triangular cell i at the n+1 time step, Qxi represents the unit width flow along the x coordinate direction in the triangular cell i at the n time step, Qx, i, n+1 denotes the unit-width discharge in the x-direction in the first triangle adjacent to triangle i at time step n+1, Qx, i, n+1 denotes the unit-width discharge in the x-direction in the second triangle adjacent to triangle i at time step n+1, Qx, i, n+1 denotes the unit-width discharge in the x-direction in the third triangle adjacent to triangle i at time step n+1, g denotes the gravitational acceleration, which is taken to be 9.8 m / s2, h, i, n+1 denotes the water level on the first side of triangle i at time step n+1, n, i, n+1 denotes the first component of the outward unit normal vector on the first side of triangle i, l, i, n+1 denotes the length of the first side of triangle i, h, i, n+1 denotes the water level on the second side of triangle i at time step n+1, n, i, n+1 denotes the first component of the outward unit normal vector on the second side of triangle i, l, i, n+1 denotes the length of the second side of triangle i, h, i, n+1 denotes the water level on the third side of triangle i at time step n+1, n, i, n+1 denotes the first component of the outward unit normal vector on the third side of triangle i, l, i, n+1 denotes the length of the third side of triangle i, Δt denotes the time step, u, i, n+1 denotes the velocity vector at the centroid of triangle i at time step n+1, h, i, n+1 denotes the water depth at the centroid of triangle i at time step n+1, Qy, i, n+1 denotes the unit-width discharge in the y-direction in triangle i at time step n+1, Qy, i, n denotes the unit-width discharge in the y-direction in triangle i at time step n, Qy, i, n+1 denotes the unit-width discharge in the y-direction in the first triangle adjacent to triangle i at time step n+1, Qy, i, n+1 denotes the unit-width discharge in the y-direction in the second triangle adjacent to triangle i at time step n+1, Qy, i, n+1 denotes the unit-width discharge in the y-direction in the third triangle adjacent to triangle i at time step n+1, n, i, n+1 denotes the second component of the outward unit normal vector on the first side of triangle i, n, i, n+1 denotes the second component of the outward unit normal vector on the second side of triangle i, n, i, n+1 denotes the second component of the outward unit normal vector on the third side of triangle i.
[0079] In some embodiments, the cell coefficient is expressed as:
[0080] ;
[0081] ;
[0082] ;
[0083] ;
[0084] ;
[0085] ;
[0086] wherein, represents the flow rate along the x-direction at the centroid of the triangular cell i, represents the first component of the outward unit normal vector on the first edge of the triangular cell, represents the flow rate along the x-direction at the boundary of the triangular cell i with the first neighboring triangular cell, represents the flow rate along the y-direction at the centroid of the triangular cell i, represents the second component of the outward unit normal vector on the first edge of the triangular cell, represents the flow rate along the y-direction at the boundary of the triangular cell i with the first neighboring triangular cell, represents the length of the first edge of the triangular cell, represents the first component of the outward unit normal vector on the second edge of the triangular cell, represents the flow rate along the x-direction at the boundary of the triangular cell i with the second neighboring triangular cell, represents the second component of the outward unit normal vector on the second edge of the triangular cell, represents the flow rate along the y-direction at the boundary of the triangular cell i with the second neighboring triangular cell, represents the length of the second edge of the triangular cell, represents the first component of the outward unit normal vector on the third edge of the triangular cell, represents the flow rate along the x-direction at the boundary of the triangular cell i with the third neighboring triangular cell, represents the second component of the outward unit normal vector on the third edge of the triangular cell, represents the flow rate along the y-direction at the boundary of the triangular cell i with the third neighboring triangular cell, represents the length of the third edge of the triangular cell.
[0087] The initial boundary water level is the water level at the dry and wet boundary of the connection point of each triangular cell area, taking into account the water flow process.
[0088] In some embodiments, the expression for the initial boundary water level value can be:
[0089] ;
[0090] in, This represents the water level value on the j-th side of triangle cell i at time step n. This represents the water level value of triangle cell i at time step n. This represents the water level value of cell j adjacent to triangle cell i at time step n. This represents the terrain value of the triangle cell adjacent to triangle cell i. Let i represent the j-th side of triangle cell i.
[0091] S3: Using multiple graphics processors to correspond with the area partitions, each partition runs on a separate graphics processor to obtain the full energy data of water flow between cells.
[0092] The total energy data of water flow between cells reflects the total energy on the left and right sides of the triangular cell interface.
[0093] In some embodiments, such as Figure 4 As shown, the graphics processor can determine the direction of water flow between triangular cells by judging the magnitude of the total energy of the water flow between adjacent triangular cells sharing a boundary across partitions. Figure 5 As shown, the shared interface of triangle cell i and its adjacent triangle cell (i,1) is... Then, by using the expressions for the total energy data of the water flow on the left and right sides of the triangular cell interface, the total energy data of the water flow on the left and right sides of the triangular cell interface can be obtained.
[0094] In some embodiments, the expression for the total energy data of water flow between cells is:
[0095] ;
[0096] ;
[0097] in, This indicates that triangle cell i shares the total energy on the left side of the boundary with its first adjacent triangle cell. This represents the water depth in triangle cell i. This represents the flow velocity along the x-direction at the centroid of triangular cell i. a first component of an outward unit normal vector on a first edge of the triangular cell, a second component of the outward unit normal vector on the first edge of the triangular cell, a flow velocity along the y direction at the centroid of the triangular cell i, a gravity acceleration, which is 9.8 m / s2, a water depth at the boundary between the triangular cell i and the first neighboring triangular cell, a water level at the centroid of the triangular cell i, a total energy on the right side of the shared boundary between the triangular cell i and the first neighboring triangular cell, a water depth of the first neighboring triangular cell of the triangular cell i, a water level at the centroid of the triangular cell i, a flow velocity along the x direction in the first neighboring triangular cell of the triangular cell i, a flow velocity along the y direction in the first neighboring triangular cell of the triangular cell i, a water level of the first neighboring triangular cell of the triangular cell i.
[0098] In some embodiments, the graphics processor can divide the calculation region into 4 sub-regions, each of which is run on a GPU, as shown in Figure 3 . The GPUs communicate once every n (e.g., n = 1000) time iteration steps.
[0099] S4: Analyze the total energy data of water flow between all cells, calculate the regional sub-region flow direction data based on the neighboring triangular cells.
[0100] The regional sub-region flow direction data is the direction data of water flow between the triangular cells.
[0101] In some embodiments, the graphics processor can compare the total energy ϕ between the triangular cell i and its neighboring cell (i, 1) to determine the direction of water flow. For example, as shown in Figure 5 , the graphics processor can determine the direction of water flow based on the total energy data of the current triangular cell i. If , the water flow is from the triangular cell to the triangular cell , if , the water flow is from the triangular cell to the triangular cell , if , there is no water flow between the two triangular cells.
[0102] S5: correcting the water flow total energy data between the cells based on the regional partition flow direction data, obtaining the surface shallow water dynamic parallel calculation result, and completing the parallel calculation of the surface shallow water dynamic.
[0103] The surface shallow water dynamic parallel calculation result is an analysis result reflecting the actual flow direction and speed of the water flow in the surface shallow water region.
[0104] In some embodiments, the graphics processor can correct the momentum conservation equation by using the constructed correction term formula, obtain the flow correction equation in the momentum conservation discrete formula on both sides of the demarcation line, correct the water flow total energy data and the initial boundary water level value of the inflow cell based on the regional partition flow direction data and using the flow correction equation in the momentum conservation discrete formula on both sides of the demarcation line, obtain the boundary water level calculation result, analyze the boundary water level calculation result, obtain the surface shallow water dynamic parallel calculation result, and complete the parallel calculation of the surface shallow water dynamic.
[0105] The correction term formula is a variable used to correct the water level value across the partition triangular cell boundary.
[0106] In some embodiments, the expression of the correction term formula can be:
[0107] ;
[0108] wherein, represents the single-width flow difference in the x direction in the first triangular cell adjacent to the triangular cell i, represents the single-width flow in the x direction in the first triangular cell adjacent to the triangular cell i after iteration for N time steps, represents the single-width flow in the x direction in the first triangular cell adjacent to the triangular cell i at the time of the n+1 time step, represents the number of iteration time steps, represents the single-width flow difference in the y direction in the first triangular cell adjacent to the triangular cell i, represents the single-width flow in the y direction in the first triangular cell adjacent to the triangular cell i after iteration for N time steps, represents the single-width flow in the y direction in the first triangular cell adjacent to the triangular cell i at the time of the n+1 time step.
[0109] The flow correction equation in the momentum conservation discrete formula on both sides of the demarcation line is a flow correction equation corrected based on the direction of the water flow between the triangular cells.
[0110] In some embodiments, the expression of the flow correction equation in the momentum conservation discrete formula on both sides of the demarcation line can be:
[0111] ;
[0112] ;
[0113] wherein, , , , , and denote the triangular cell coefficients, denotes the water depth of the triangular cell i at the n+1 time step, denotes the water depth of the triangular cell i at the n time step, denotes the ratio of the time step to the cell area, denotes the water depth of the first triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the water depth of the second triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the water depth of the third triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the unit width discharge in the x coordinate direction in the triangular cell i at the n+1 time step, denotes the unit width discharge in the x coordinate direction in the triangular cell i at the n time step, denotes the unit width discharge in the x coordinate direction in the first triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the unit width discharge in the x coordinate direction in the second triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the unit width discharge in the x coordinate direction in the third triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the gravitational acceleration, which takes the value 9.8 m / s2, denotes the water level value on the first edge of the triangular cell i at the n+1 time step, denotes the first component of the outward unit normal vector on the first edge of the triangular cell, denotes the length of the first edge of the triangular cell, denotes the water level value on the second edge of the triangular cell i at the n+1 time step, denotes the first component of the outward unit normal vector on the second edge of the triangular cell, denotes the length of the second edge of the triangular cell, denotes the water level value on the third edge of the triangular cell i at the n+1 time step, a first component of an outward unit normal vector on a third edge of the triangular cell, a length of the third edge of the triangular cell, a time step, a velocity vector, a, a unit-width flow in the y-coordinate direction in the triangular cell i at the n+1 time step, a unit-width flow in the y-coordinate direction in the triangular cell i at the n time step, a unit-width flow in the y-coordinate direction in the first triangular cell adjacent to the triangular cell i at the n+1 time step, a unit-width flow in the y-coordinate direction in the second triangular cell adjacent to the triangular cell i at the n+1 time step, a unit-width flow in the y-coordinate direction in the third triangular cell adjacent to the triangular cell i at the n+1 time step, a second component of an outward unit normal vector on a first edge of the triangular cell, a second component of an outward unit normal vector on a second edge of the triangular cell, a second component of an outward unit normal vector on a third edge of the triangular cell.
[0114] The boundary water level calculation result is a water level calculation result of a boundary of an adjacent triangular cell. For example, the boundary water level calculation result can include a boundary water level calculation result of an inflow cell and a boundary water level calculation result of an outflow cell.
[0115] In some embodiments, the graphics processor can take an initial boundary water level value as the boundary water level calculation result of the outflow cell; and correct the water flow total energy data of the inflow cell and the initial boundary water level value by using a flow correction equation in the momentum conservation discrete equation on both sides of the dividing line, to obtain the boundary water level calculation result of the inflow cell.
[0116] In some embodiments, the expression of the boundary water level calculation result of the inflow cell can be:
[0117] ;
[0118] wherein, a water level value on the jth edge of the triangular cell i at the n time step, a water level value of the triangular cell i, a water level value of the jth cell adjacent to the triangular cell i at the n time step, a terrain elevation value of the jth cell adjacent to the triangular cell i, represents the jth edge of the triangular cell.
[0119] In some embodiments, as shown in Figure 8 Figure 7 and Figure 6 The cross-sectional flow of the upper two river branches is almost coincident, and the cross-sectional flow of the three sections after the two river branches converge is the sum of the flow of the two branches, with an error of less than 0.46%, which indicates that the 4 GPU parallel calculation has excellent water balance error. Figure 9 The simulation and measured results of the flow of the three sections are given, and it can be seen that the fitting degree of the simulation and measured results is very good, with an average relative error of less than 4.36%, indicating that the calculation process maintains good accuracy.
[0120] In some embodiments, the graphics processor calculates n (n=1000 in this test) time iteration steps, and the GPU communicates once. The 4 GPU simulates the above process, and the calculation time is 9.6 minutes. When the 4 GPU simulates the above process, if the GPU communicates once in each time iteration step, the calculation time is 29 minutes. When the above process is calculated on a single GPU, the time consumption is 51 minutes. When the communication is performed at intervals of n time iteration steps, the calculation efficiency of the 4 GPUs is about 5.3 times that of the single GPU calculation efficiency, and about 3 times that of the 4 GPU calculation efficiency under each communication. In other words, compared with the single GPU and the 4 GPU calculation with communication in each time step, the calculation speed of the 4 GPU with communication at intervals of n (n=1000 in this test) time iteration steps is about 2 times and 4.3 times, respectively.
[0121] In some embodiments of the present specification, a multi-graphics processor-based parallel calculation method for surface shallow water dynamics is provided. Based on surface shallow water region data and surface shallow water equations, the finite volume method is used for discretization on triangular cells to obtain region partitions and initial boundary water level values. A multi-graphics processor is used to correspond to the region partitions, each partition is run on a graphics processor to obtain a surface shallow water dynamics parallel calculation result, and parallel calculation of surface shallow water dynamics is completed. In this way, the calculation accuracy and efficiency of surface shallow water dynamics are greatly improved.
Claims
1. A method for parallel computation of surface shallow water dynamics based on multi-GPUs, characterized in that, The method comprises the following steps: S1: obtaining surface shallow water region data; S2: based on the surface shallow water region data and a surface shallow water equation, using a finite volume method to discretize on a triangular cell to obtain region partition and initial boundary water level value; S3: using a multi-GPU to correspond to the region partition, each partition is respectively run on a GPU to obtain water flow total energy data between cells; The expression of the water flow total energy data between cells is: ; ; wherein, denotes the total energy of the triangle cell i shared with the left side of the first adjacent triangle cell, denotes the water depth of the triangle cell i, denotes the flow velocity along the x-direction at the centroid of the triangle cell i, denotes the first component of the outward unit normal vector on the first edge of the triangle cell i, denotes the second component of the outward unit normal vector on the first edge of the triangle cell i, denotes the flow velocity along the y-direction at the centroid of the triangle cell i, denotes the gravitational acceleration with a value of 9.8 m / s2, denotes the water depth of the triangle cell i at the boundary with the first adjacent triangle cell, denotes the water level at the centroid of the triangle cell i, denotes the total energy of the triangle cell i shared with the right side of the first adjacent triangle cell, denotes the water depth of the first adjacent triangle cell to the triangle cell i, denotes the water level at the centroid of the triangle cell i, denotes the flow velocity along the x-direction in the first adjacent triangle cell to the triangle cell i, denotes the flow velocity along the y-direction in the first adjacent triangle cell to the triangle cell i, denotes the water level of the first adjacent triangle cell to the triangle cell i; S4: analyzing all water flow total energy data between cells, calculating based on adjacent triangular cells to obtain region partition flow direction data; S5: based on the region partition flow direction data, correcting the water flow total energy data between cells and the initial boundary water level value to obtain surface shallow water dynamic parallel calculation result, completing parallel calculation of surface shallow water dynamics.
2. The multi-GPGPU-based parallel computation method for surface shallow water dynamics according to claim 1, wherein, The expression of the surface shallow water equation is: ; ; ; wherein denotes the surface water depth, denotes time, denotes the flow velocity along the coordinate direction, and denotes the coordinate direction, denotes the flow velocity along the coordinate direction, denotes the unit width discharge along the coordinate direction, denotes the gravitational acceleration, denotes the surface water level, denotes the roughness coefficient, denotes the velocity vector comprising and two components, denotes the unit width discharge along the coordinate direction.
3. The multi-GPGPU-based parallel computation method for surface shallow water dynamics according to claim 1, wherein, The expression of the momentum conservation equation of the region partition is: ; ; ; wherein, , , , , and denote the triangular cell coefficients, denotes the water depth of the triangular cell i at the n+1 time step, denotes the water depth of the triangular cell i at the n time step, denotes the ratio of the time step to the cell area, denotes the water depth of the first triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the water depth of the second triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the water depth of the third triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the unit width discharge in the x coordinate direction in the triangular cell i at the n+1 time step, denotes the unit width discharge in the x coordinate direction in the triangular cell i at the n time step, denotes the unit width discharge in the x coordinate direction in the first triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the unit width discharge in the x coordinate direction in the second triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the unit width discharge in the x coordinate direction in the third triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the gravity acceleration, which takes the value 9.8 m / s2, denotes the water level value on the first edge of the triangular cell i at the n+1 time step, denotes the first component of the outward unit normal vector on the first edge of the triangular cell i, denotes the length of the first edge of the triangular cell i, denotes the water level value on the second edge of the triangular cell i at the n+1 time step, denotes the first component of the outward unit normal vector on the second edge of the triangular cell i, denotes the length of the second edge of the triangular cell i, denotes the water level value on the third edge of the triangular cell i at the n+1 time step, denotes the first component of the outward unit normal vector on the third edge of the triangular cell, denotes the length of the third edge of the triangular cell i, denotes the time step, Vn+i i represents the velocity vector at the centroid of triangle cell i at the (n+1)th time step, Hn+i i represents the water depth at the centroid of triangle cell i at the (n+1)th time step, Qn+i y i represents the unit-width discharge along the y-coordinate direction in triangle cell i at the (n+1)th time step, Qn y i represents the unit-width discharge along the y-coordinate direction in triangle cell i at the nth time step, Qn+i y i+1 represents the unit-width discharge along the y-coordinate direction in the first triangle cell adjacent to triangle cell i at the (n+1)th time step, Qn+i y i+2 represents the unit-width discharge along the y-coordinate direction in the second triangle cell adjacent to triangle cell i at the (n+1)th time step, Qn+i y i+3 represents the unit-width discharge along the y-coordinate direction in the third triangle cell adjacent to triangle cell i at the (n+1)th time step, n+i i represents the second component of the outward unit normal vector on the first edge of triangle cell i, n+i i represents the second component of the outward unit normal vector on the second edge of triangle cell i, n+i i represents the second component of the outward unit normal vector on the third edge of triangle cell i.
4. The multi-GPGPU-based parallel computation method for near-surface hydrodynamics according to claim 1, wherein, The expression of the initial boundary water level value is: ; wherein, denotes the water level value on the jth edge of the triangular cell i at the nth time step, denotes the water level value of the triangular cell i at the nth time step, denotes the water level value of the adjacent cell j to the triangular cell i at the nth time step, denotes the terrain value of the triangular cell adjacent to the triangular cell i, denotes the jth edge of the triangular cell i.
5. The multi-GPGPU-based parallel computation method for surface shallow water dynamics according to claim 3, wherein, The expression of the cell coefficient is: ; ; ; ; ; ; wherein represents the flow velocity along the x-direction at the centroid of the triangular cell i, represents the first component of the outward unit normal vector on the first edge of the triangular cell, represents the flow velocity along the x-direction at the boundary between the triangular cell i and the first neighboring triangular cell, represents the flow velocity along the y-direction at the centroid of the triangular cell i, represents the second component of the outward unit normal vector on the first edge of the triangular cell, represents the flow velocity along the y-direction at the boundary between the triangular cell i and the first neighboring triangular cell, represents the length of the first edge of the triangular cell, represents the first component of the outward unit normal vector on the second edge of the triangular cell, represents the flow velocity along the x-direction at the boundary between the triangular cell i and the second neighboring triangular cell, represents the second component of the outward unit normal vector on the second edge of the triangular cell, represents the flow velocity along the y-direction at the boundary between the triangular cell i and the second neighboring triangular cell, represents the length of the second edge of the triangular cell, represents the first component of the outward unit normal vector on the third edge of the triangular cell, represents the flow velocity along the x-direction at the boundary between the triangular cell i and the third neighboring triangular cell, represents the second component of the outward unit normal vector on the third edge of the triangular cell, represents the flow velocity along the y-direction at the boundary between the triangular cell i and the third neighboring triangular cell, represents the length of the third edge of the triangular cell.
6. The multi-GPGPU-based parallel computation method for near-surface hydrodynamics according to claim 1, wherein, The S5 comprises: using the constructed correction formula to correct the momentum conservation equation to obtain flow correction equation in the momentum conservation discrete formula on both sides of the boundary line; based on the region partition flow direction data, using the flow correction equation in the momentum conservation discrete formula on both sides of the boundary line to correct the water flow total energy data and the initial boundary water level value of the inflow cell to obtain boundary water level calculation result; analyzing the boundary water level calculation result to obtain surface shallow water dynamic parallel calculation result, completing parallel calculation of surface shallow water dynamics.
7. The multi-GPGPU-based parallel computation method for surface shallow water dynamics according to claim 6, wherein, The expression of the correction formula is: ; wherein, Qx, i represents the single-width flow rate difference in the x direction in the first triangular cell adjacent to the triangular cell i, Qx, i represents the single-width flow rate in the x direction in the first triangular cell adjacent to the triangular cell i after iteration of N time steps, Qx, i represents the single-width flow rate in the x direction in the first triangular cell adjacent to the triangular cell i at the time of the n+1 time step, N represents the number of time steps of iteration, Qy, i represents the single-width flow rate difference in the y direction in the first triangular cell adjacent to the triangular cell i, Qy, i represents the single-width flow rate in the y direction in the first triangular cell adjacent to the triangular cell i after iteration of N time steps, Qy, i represents the single-width flow rate in the y direction in the first triangular cell adjacent to the triangular cell i at the time of the n+1 time step.
8. The multi-GPGPU-based parallel computation method for surface shallow water dynamics according to claim 7, wherein, The expression of the flow correction equation in the momentum conservation discrete formula on both sides of the boundary line is: ; ; wherein, , , , , and denote the triangular cell coefficients, denotes the water depth of the triangular cell i at the n+1 time step, denotes the water depth of the triangular cell i at the n time step, denotes the ratio of the time step to the cell area, denotes the water depth of the first triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the water depth of the second triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the water depth of the third triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the unit width discharge in the x coordinate direction in the triangular cell i at the n+1 time step, denotes the unit width discharge in the x coordinate direction in the triangular cell i at the n time step, denotes the unit width discharge in the x coordinate direction in the first triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the unit width discharge in the x coordinate direction in the second triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the unit width discharge in the x coordinate direction in the third triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the gravitational acceleration, which takes the value 9.8 m / s2, denotes the water level value on the first edge of the triangular cell i at the n+1 time step, denotes the first component of the outward unit normal vector on the first edge of the triangular cell, denotes the length of the first edge of the triangular cell, denotes the water level value on the second edge of the triangular cell i at the n+1 time step, denotes the first component of the outward unit normal vector on the second edge of the triangular cell, denotes the length of the second edge of the triangular cell, denotes the water level value on the third edge of the triangular cell i at the n+1 time step, denotes the first component of the outward unit normal vector on the third edge of the triangular cell, denotes the length of the third edge of the triangular cell, denotes the time step, denotes the velocity vector, denotes, denotes the single-width flow along the y-coordinate direction in the triangular cell i at the n+1 time step, denotes the single-width flow along the y-coordinate direction in the triangular cell i at the n time step, denotes the single-width flow along the y-coordinate direction in the first triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the single-width flow along the y-coordinate direction in the second triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the single-width flow along the y-coordinate direction in the third triangular cell adjacent to the triangular cell i at the n+1 time step, denotes the second component of the outward unit normal vector on the first edge of the triangular cell, denotes the second component of the outward unit normal vector on the second edge of the triangular cell, denotes the second component of the outward unit normal vector on the third edge of the triangular cell.
9. The multi-GPGPU-based parallel computation method for near-surface hydrodynamics according to claim 6, wherein, The expression of the boundary water level calculation result of the inflow cell is: ; wherein, represents the water level value on the jth edge of the triangular cell i at the nth time step, represents the water level value of the triangular cell i, represents the water level value of the adjacent cell j to the triangular cell i at the nth time step, represents the terrain elevation value of the adjacent cell j to the triangular cell i, represents the jth edge of the triangular cell.
Citation Information
Patent Citations
Groundwater flow calculation method
CN105160088A
Two-dimensional flood simulation method based on high-precision terrain generalization
CN110929443A