Outlet flow calculation method and system

Through CPU-GPU collaborative calculation, the calculation method of the grid Xin'anjiang model is optimized, which solves the problem of low computing efficiency in flood simulation in large watersheds, and realizes efficient and accurate flood forecasting and management.

CN120509152APending Publication Date: 2025-08-19HOHAI UNIV +1
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510449059.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

The existing grid Xin'anjiang model has low computational efficiency in the process of simulated flooding, making it difficult to meet the needs of rapid flood forecasting and flood control management in large river basins.

Method used

The CPU-GPU collaborative computing method is adopted to calculate the bus time matrix in parallel through CPU-side preprocessing and GPU-side parallel, and combine atomic operation and delay mechanisms to optimize heterogeneous computing resource scheduling to improve computing accuracy and efficiency.

Benefits of technology

The calculation efficiency and accuracy of hydrological simulation are improved, and are suitable for rapid flood forecasting and flood control management in large-scale watersheds, and support real-time flood warning and large-scale watershed management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120509152A_ABST
    Figure CN120509152A_ABST
Patent Text Reader

Abstract

The invention discloses an outlet flow calculation method and system, and belongs to the technical field of hydrological calculation, and the method comprises the steps: determining a calculation region, and obtaining the data, related to the outlet flow calculation, of the calculation region; according to the acquired data, a grid Xinanjiang model pre-processing unit pre-constructed at a CPU end is adopted to calculate a convergence time matrix formed by convergence time of each grid; according to the obtained data and the calculated confluence time matrix, outlet flow calculation of the grid Xinanjiang model is carried out at the GPU end; and after a preset time delay, returning a calculation result to the CPU end, and outputting a final outlet flow calculation result by the CPU end. According to the method, CPU-GPU heterogeneous parallel computing is utilized, the computing precision and the computing efficiency of the grid Xinanjiang model are improved, and rapid flood forecasting, flood control management and decision making on a drainage basin are facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of hydrological calculation, and in particular relates to an outlet flow calculation method and system. Background Art

[0002] Floods, one of the most common and widespread natural disasters, frequently negatively impact the socioeconomic and natural environment worldwide. Global flood research has largely focused on river basins with available data. By analyzing existing data, these studies establish correlations or models, then perform simulations or predictive analyses for different events. However, large-scale river basins, due to their vast size, present significant challenges for flood analysis.

[0003] The Grid Xin'an River Model is a distributed hydrological model developed from the traditional Xin'an River hydrological model. It uses grid cells (e.g., 90 m × 90 m) as computational units and is suitable for simulating watershed hydrology under complex underlying surface conditions. By dividing the grid into individual cells, the model calculates runoff generation and confluence, and couples hydrological elements such as soil moisture, evapotranspiration, and precipitation infiltration to achieve highly accurate runoff simulation.

[0004] Computational accuracy and efficiency are key indicators for evaluating models and methods. However, existing grid-based Xin'anjiang models often use time-series and grid-series computational methods to simulate flood events. This computational efficiency cannot be guaranteed in simulations of large watersheds with multiple grids and long simulation times, making it difficult to meet the requirements for precise and rapid flood simulations.

[0005] Improving the computational accuracy and efficiency of the grid-based Xin'anjiang model is of great significance for rapid flood forecasting, flood control management, and decision-making in the basin. Summary of the Invention

[0006] The purpose of the present invention is to overcome the deficiencies in the prior art and provide an outlet flow calculation method and system for improving the calculation accuracy and efficiency of the grid Xin'an River model, which is conducive to rapid flood forecasting, flood control management and decision-making in the basin.

[0007] To achieve the above object, the present invention is implemented by adopting the following technical solutions:

[0008] In a first aspect, the present invention provides an outlet flow calculation method, comprising:

[0009] S1: Determine the calculation area and obtain data related to the calculation area and outlet flow calculation;

[0010] S2: Based on the data obtained in step S1, the grid Xin'an River model pre-processing unit pre-built on the CPU side is used to calculate the confluence time matrix composed of the confluence time of each grid;

[0011] S3: Based on the data obtained in step S1 and the confluence time matrix calculated in step S2, the outlet flow of the grid Xin'an River model is calculated on the GPU side;

[0012] S4: After a preset delay, the calculation result of step S3 is returned to the CPU, and the CPU outputs the final export flow calculation result.

[0013] In the aforementioned method for calculating the outlet flow rate, step S2 includes:

[0014] S21: Based on the data obtained in step S1, a grid Xin'an River model pre-processing unit pre-built on the CPU is used to calculate a grid flow path length matrix composed of the flow path lengths of each grid, a grid convergence velocity matrix composed of the convergence velocities of each grid, and a grid calculation order matrix composed of the upstream and downstream dependencies between grids;

[0015] S22: Based on the principle of calculating time based on length and speed and the principle of accumulating the time of flowing through the grid based on upstream and downstream dependencies, a confluence time matrix composed of the confluence time of each grid to the outlet grid is calculated.

[0016] In the aforementioned method for calculating the outlet flow rate, step S21 includes:

[0017] S211: Calculating a grid slope matrix composed of grid slopes and a grid flow direction matrix composed of grid flow directions based on the DEM data of the grid terrain data in the grid Xin'an River model; the flow directions include horizontal flow direction, vertical flow direction, and diagonal flow direction;

[0018] S212: Calculating a grid flow path length matrix composed of the flow path lengths of each grid based on the grid flow direction matrix calculated in step S211, and counting the number of flow paths flowing into each grid as matrix elements to form a cumulative catchment area matrix;

[0019] S213: Based on the cumulative catchment area matrix obtained in step S212, a grid operation order matrix composed of upstream and downstream dependencies between grids is calculated, and element values within a preset water system division value range are marked as 1, and element values outside the preset water system division value range are marked as 0, thereby obtaining a water system matrix;

[0020] S214: Calculate the grid convergence velocity matrix composed of the grid convergence velocities according to the water system matrix obtained in step S213.

[0021] In the aforementioned method for calculating the outlet flow rate, the calculation of the grid flow path length matrix composed of the grid flow path lengths in step S212 includes:

[0022] Assign the grid value of the calculation area to 0, calculate the grid length of each grid along the flow direction according to the flow direction of each grid, and form a grid flow path length matrix. The grid length passing through grid i is The calculation formula is:

[0023]

[0024] Where, is the length of the grid unit in the x direction; is the length of the grid unit in the y direction; The elevation difference between the two grid cells is calculated by subtracting the elevation of the flow direction grid from the elevation of the current grid in the DEM. The flow direction is obtained according to the grid flow direction matrix in step S211.

[0025] In the aforementioned method for calculating the outlet flow, the grid calculation order matrix composed of the upstream and downstream dependencies between grids in step S213 is calculated as follows:

[0026] Initialize the order value n of each grid to 0, and mark the order value of the grid with a cumulative catchment area of 1 in step S212 as n=1;

[0027] Obtain the upstream and downstream dependencies between the grids according to the grid flow matrix in step S211, iteratively check the upstream dependencies of the grid with an order value of 0 and assign them incrementally;

[0028] The iteration is terminated when the export grid is assigned a value, and the grid calculation order matrix composed of the upstream and downstream dependencies between grids is obtained.

[0029] In the aforementioned method for calculating the outlet flow rate, the calculation of the grid convergence velocity matrix composed of the grid convergence velocities in step S214 includes:

[0030] Calculate the flow velocity of water in each grid based on the water system matrix obtained in step S213 to form a grid flow velocity matrix;

[0031] When the element of the water system matrix is 0, it is slope confluence, and the slope confluence velocity of a single grid is The calculation formula is:

[0032] ,

[0033] Where, A preset coefficient to reflect the roughness of the slope; is the slope of the flow direction, obtained from the grid slope matrix and the grid flow direction matrix in step S211;

[0034] When the water system matrix is not 0, it is the river confluence, and the single grid river confluence velocity The calculation formula is: ,

[0035] Where, A preset coefficient to reflect the roughness of the river channel; is the catchment area of a single grid, which is calculated by multiplying the amount of runoff collected by the single grid by the area of the single grid in step S212; is the preset empirical coefficient; is the slope of the river along the flow direction, obtained from the grid slope matrix in step S211.

[0036] In the aforementioned method for calculating the outlet flow, the confluence time matrix includes: the surface runoff confluence time matrix, the river runoff confluence time matrix, the subsoil flow confluence time matrix, and the underground runoff confluence time matrix;

[0037] Step S22 includes:

[0038] S221: Calculate the surface runoff confluence time matrix and the river runoff confluence time matrix:

[0039] The transmission time from each grid to the downstream grid is calculated by element-by-element division of the grid flow path length matrix and the confluence velocity matrix. The topological order of the calculation order matrix is used to traverse and accumulate the transmission time from the outlet grid in the reverse topological order of the runoff to generate the surface runoff confluence time matrix from each grid to the outlet grid. The river runoff confluence time matrix and the surface runoff confluence time matrix are the same.

[0040] S222: Calculate the subsurface runoff time matrix and the groundwater runoff time matrix:

[0041] Taking the surface runoff confluence time matrix as a benchmark, the subsurface runoff confluence time matrix and the underground runoff confluence time matrix are obtained respectively according to preset multiplication coefficients, wherein the preset multiplication coefficients are determined according to the hydrogeological parameters of the calculation area.

[0042] In the aforementioned method for calculating the outlet flow rate, step S3 includes:

[0043] S31: The CPU transmits the data obtained in step S1 and the confluence time matrix calculated in step S2 to the GPU, and the GPU allocates computing resources to each grid.

[0044] S32: Based on the evapotranspiration data obtained in step S1, the CPU calls the GPU kernel function to execute the grid Xin'anjiang model evapotranspiration algorithm in parallel to calculate the evapotranspiration of each grid;

[0045] S33: Based on the rainfall data obtained in step S1, the CPU calls the GPU kernel function and executes the grid Xin'an River model runoff generation algorithm in parallel. For grids where the water system matrix is not zero, the water source type is divided and the runoff generation of each water source type in each grid is calculated by deducting the evapotranspiration in step S32. For grids where the water system matrix is not zero, the runoff generation of the river channel in each grid is calculated by deducting the evapotranspiration in step S32. The water source types include: surface runoff, subsurface runoff, and ground runoff.

[0046] S34: Based on the confluence time matrix calculated in step S2, the CPU calls the GPU kernel function to execute the grid Xin'anjiang model confluence algorithm in parallel, calculates the flow transmission of each grid, uses atomic operations to update the instantaneous flow of the outlet grid at each moment, and integrates the instantaneous flow of the outlet grid at each moment to the current moment through atomic addition. The GPU obtains the cumulative flow of the outlet grid at the current moment.

[0047] In the aforementioned method for calculating the outlet flow, step S4 includes: detecting at the CPU end whether the current moment of step S3 reaches a preset delay;

[0048] If the preset delay is not reached, the calculation of step S3 is executed in a loop;

[0049] If the preset delay is reached, the current outlet grid accumulated flow rate of step S3 is returned to the CPU end, and the CPU end outputs the outlet grid accumulated flow rate as the final outlet flow calculation result.

[0050] In a second aspect, the present invention provides an outlet flow calculation system, comprising: a data acquisition module, a time calculation module, an outlet flow calculation module, and a result output module;

[0051] The data acquisition module is used to: determine the calculation area and obtain data related to the calculation area and the outlet flow calculation;

[0052] The time calculation module is used to calculate the confluence time matrix composed of the confluence time of each grid using the grid Xin'an River model pre-processing unit pre-built on the CPU side according to the data obtained by the data acquisition module;

[0053] The outlet flow calculation module is used to calculate the outlet flow of the grid Xin'an River model on the GPU side based on the data obtained by the data acquisition module and the confluence time matrix calculated by the time calculation module;

[0054] The result output module is used to return the calculation result of the outlet flow calculation module to the CPU end after a preset delay, and the CPU end outputs the final outlet flow calculation result.

[0055] Compared with the prior art, the present invention has the following beneficial effects:

[0056] The present invention improves the computational accuracy and efficiency of the grid Xin'an River model and the efficiency of hydrological simulation through CPU-GPU collaborative computing: the GPU accelerates the export flow calculation in parallel, the CPU is responsible for data preprocessing and result verification, and the preset delay mechanism optimizes the scheduling of heterogeneous computing resources, taking into account both computational efficiency and accuracy, and ultimately retains the CPU side for result verification and output, which not only gives play to the parallel advantages of the GPU, but also ensures the reliability and scalability of the system, and is suitable for real-time flood forecasting and large-scale watershed scenario simulation.

[0057] This paper leverages the computational speed advantages of CPU-GPU heterogeneous parallel computing technology to propose a flow calculation method that improves the computational efficiency of the grid-based Xin'an River model. This method can meet the requirements for calculating flood events with large basin areas, a large number of grids, and long simulation times. By calculating the flow time matrix, this paper improves the outlet flow calculation method, avoiding the need for grid serialization during GPU kernel execution, which increases computation time. This significantly improves memory access efficiency and thread utilization during parallel computing.

[0058] This invention avoids performance bottlenecks in traditional serial computing through dynamic memory allocation and data transfer optimization (e.g., matrix preprocessing on the CPU and core computation on the GPU), improving thread utilization and memory access efficiency. It also optimizes heterogeneous computing resource scheduling through a preset delay mechanism and integrates atomic operations to synchronize outlet flow timing in a multi-threaded environment, ensuring both computational efficiency and the accuracy of the results. Furthermore, the dynamic partitioning of the water system matrix (e.g., differential modeling of confluence velocities between slopes and river channels) and the adaptive adjustment of hydrogeological parameters (e.g., the multiplication factor between subsurface flow and subsurface runoff) enable flexible response to outlet flow simulation requirements in areas with complex underlying surface conditions and data scarcity.

[0059] This method is suitable for flood simulation in large-scale watersheds and over long time series, supporting refined and rapid forecasting. In multiple flood events demonstrated in this example, the simulation results closely matched measured data, providing highly reliable support for flood prevention decision-making and risk assessment. Furthermore, through CPU-side result verification and output mechanisms, the system's reliability and scalability are guaranteed, making it widely applicable to real-time flood warning systems and large-scale watershed management scenarios.

[0060] By synergizing CPU-side preprocessing with GPU-side core computing, this invention overcomes the computational bottlenecks of traditional hydrological models. In particular, through topological optimization of the grid calculation order matrix and the flow integration mechanism of atomic operations, it resolves dependency conflicts in parallel computing, providing an innovative solution for heterogeneous parallelization of distributed hydrological models. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 Flow chart of the method for calculating the outlet flow rate according to embodiment 1 of the present invention;

[0062] Figure 2 Schematic diagram of grid numbering in Example 1 of the present invention;

[0063] Figure 3 Schematic diagram of the flow direction of a single grid in Example 1 of the present invention;

[0064] Figure 4 The embodiment of the present invention 1 Figure 2 Schematic diagram of the transformed cumulative catchment area matrix;

[0065] Figure 5 The embodiment of the present invention 1 Figure 4 Schematic diagram of the transformed water matrix;

[0066] Figure 6 Schematic diagram of surface runoff convergence velocity in the Tunxi River Basin according to Example 1 of the present invention;

[0067] Figure 7 The embodiment of the present invention 1 Figure 4 Schematic diagram of the transformed grid calculation order matrix;

[0068] Figure 8 1 is a schematic diagram of the surface runoff confluence time in the Tunxi River Basin according to Example 1 of the present invention;

[0069] Figure 9 1 is a schematic diagram comparing the calculation results of the confluence calculation method of the present invention and the traditional Muskingum method in the outlet flow calculation of the Tunxi River Basin flood event 1 in Example 1 of the present invention;

[0070] Figure 10 1 is a schematic diagram comparing the calculation results of the confluence calculation method of the present invention and the traditional Muskingum method in the outlet flow calculation of the Tunxi River Basin flood event 2 in Example 1 of the present invention;

[0071] Figure 11 3 is a schematic diagram comparing the calculation results of the confluence calculation method of the present invention and the traditional Muskingum method in the calculation of the outlet flow of the Tunxi River Basin flood event 3 in Example 1 of the present invention;

[0072] Figure 12 1 is a schematic diagram comparing the calculation results of the confluence calculation method of the present invention and the traditional Muskingum method in the calculation of outlet flow of the Tunxi River Basin flood event 4 in Example 1 of the present invention;

[0073] Figure 13 3. It is a schematic diagram comparing the calculation results of the confluence calculation method of the present invention and the traditional Muskingum method in the calculation of the outlet flow of the Tunxi River Basin flood event 5 in Example 1 of the present invention. DETAILED DESCRIPTION

[0074] The technical solution of the present invention is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present application and the specific features in the embodiments are detailed descriptions of the technical solution of the present application, rather than limitations on the technical solution of the present application. Unless there is a conflict, the embodiments of the present application and the technical features in the embodiments can be combined with each other.

[0075] The term "and / or" in this document simply describes a relationship between related objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone. Additionally, the character " / " in this document generally indicates an "or" relationship between the related objects.

[0076] Example 1:

[0077] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings and examples.

[0078] In one embodiment, the present invention provides a method for calculating the outlet flow rate, such as Figure 1 As shown, the method includes the following steps:

[0079] S1: Determine the calculation area and obtain data related to the calculation area and outlet flow calculation;

[0080] S2: Based on the data obtained in step S1, the grid Xin'an River model pre-processing unit pre-built on the CPU side is used to calculate the confluence time matrix composed of the confluence time of each grid;

[0081] S3: Based on the data obtained in step S1 and the confluence time matrix calculated in step S2, the outlet flow of the grid Xin'an River model is calculated on the GPU side;

[0082] S5: After a preset delay, the calculation result of step S4 is returned to the CPU end, and the CPU end outputs the final export flow calculation result.

[0083] In step S1, the data related to the calculation of the outlet flow in the calculation area include: rainfall data, evapotranspiration data and underlying surface data;

[0084] Step S1 includes pre-processing the acquired data to the input form required for constructing the grid Xin'an River model. According to the watershed to be calculated, its DEM terrain and land use data are obtained, and each grid is regarded as a sub-basin of the watershed according to the resolution of the DEM. Figure 2 As shown, the calculation areas are numbered from left to right and then from top to bottom, starting from 0. It is worth noting that the matrix Figure 2 This is just an example. In actual use, the numbering should be based on the actual shape of the calculation area. In this example, taking the Tunxi area as an example, the DEM resolution is 90m and the number of grid cells is 770,000.

[0085] Step S2 includes:

[0086] S21: Based on the data obtained in step S1, a grid Xin'an River model pre-processing unit pre-built on the CPU is used to calculate a grid flow path length matrix composed of the flow path lengths of each grid, a grid convergence velocity matrix composed of the convergence velocities of each grid, and a grid calculation order matrix composed of the upstream and downstream dependencies between grids;

[0087] S22: Based on the principle of calculating time based on length and speed and the principle of accumulating the time of flowing through the grid based on upstream and downstream dependencies, a confluence time matrix composed of the confluence time of each grid to the outlet grid is calculated.

[0088] Step S21 includes:

[0089] S211: Calculating a grid slope matrix composed of grid slopes and a grid flow direction matrix composed of grid flow directions based on the DEM data of the grid terrain data in the grid Xin'an River model; the flow directions include horizontal flow direction, vertical flow direction, and diagonal flow direction;

[0090] Calculating the grid slope matrix composed of each grid slope and the grid flow matrix composed of each grid flow direction includes:

[0091] Taking each grid as the center, calculate the slope between the current grid and the adjacent 8 grids respectively. The maximum slope is the slope of the current grid. The direction with the maximum slope is the flow direction of the current grid. The outflow grid of the flow direction is the upstream, and the inflow grid of the flow direction is the downstream. The flow direction includes horizontal flow direction, vertical flow direction and diagonal flow direction. Figure 2 In the figure, if grid No. 6 flows to grid No. 5 or No. 7, the flow direction of grid No. 6 is horizontal; if grid No. 6 flows to grid No. 1 or No. 11, the flow direction of grid No. 6 is vertical; if grid No. 6 flows to grid No. 0 / No. 2 / No. 10 / No. 12, the flow direction of grid No. 6 is diagonal.

[0092] like Figure 3 As shown, this is a schematic diagram of the flow direction of a single grid. Figure 3 The numbers 0-8 in the grid indicate the elevation order of the grids where the numbers are located. The current grid No. 8 has the highest elevation and the No. 0 grid has the lowest elevation. The flow direction of the current grid No. 8 is diagonal flow to the adjacent No. 0 grid. The downstream grid of the current grid No. 8 is No. 0 grid. The slope of the adjacent grid The calculation formula is as follows:

[0093]

[0094] Where, is the elevation of the current grid i; is the elevation of an adjacent grid, each Corresponding to 8 ; When calculating the slope between the current grid and the diagonal grid for the preset distance weight, Pick , when calculating the slope with other grids, Take 1; is the side length of the current grid. In this embodiment, D is 90.

[0095] S212: Based on the grid flow direction matrix calculated in step S211, a grid flow path length matrix composed of the flow path lengths of each grid is calculated, and the number of flow paths flowing into each grid is counted as matrix elements to form a cumulative catchment area matrix; Figure 4 As shown, Figure 2 Schematic diagram of the transformed cumulative catchment area matrix;

[0096] S213: Based on the cumulative catchment area matrix obtained in step S212, a grid calculation order matrix composed of upstream and downstream dependencies between grids is calculated, and element values within the preset water system division value range are marked as 1, and element values outside the preset water system division value range are marked as 0, to obtain a water system matrix; in this embodiment, the preset water system division value range is set to the element value in the cumulative catchment area matrix being greater than or equal to 4. When the element value in the cumulative catchment area matrix is greater than or equal to 4, the grid is marked as 1, and when the element value in the cumulative catchment area matrix is less than 4, the grid is marked as 0. Figure 5 As shown, Figure 4 Schematic diagram of the transformed water matrix.

[0097] S214: Calculate a grid flow path length matrix composed of the flow path lengths of each grid, a grid convergence velocity matrix composed of the convergence velocities of each grid, and a grid calculation order matrix composed of the upstream and downstream dependencies between grids.

[0098] In step S212, calculating the grid flow path length matrix composed of the grid flow path lengths includes:

[0099] Assign the grid value of the calculation area to 0, calculate the grid length of each grid along the flow direction according to the flow direction of each grid, and form a grid flow path length matrix. The grid length passing through grid i is The calculation formula is:

[0100]

[0101] Where, is the length of the grid unit in the x direction; is the length of the grid unit in the y direction; The elevation difference between two grid cells is obtained by subtracting the elevation of the flow direction grid from the elevation of the current grid in the DEM. The flow direction is obtained based on the grid flow direction matrix in step S211. In this embodiment, the grid is square, and the length of the grid in the x-direction is the same as the length in the y-direction. .

[0102] In step S213, the grid operation order matrix composed of the upstream and downstream dependencies between grids is calculated, including:

[0103] Initialize the order value n of each grid to 0, and mark the order value of the grid with a cumulative catchment area of 1 in step S212 as n=1;

[0104] Obtain the upstream and downstream dependencies between the grids according to the grid flow matrix in step S211, iteratively check the upstream dependencies of the grid with an order value of 0 and assign them incrementally;

[0105] When the export grid is assigned a value, the iteration is terminated and the grid calculation order matrix composed of the upstream and downstream dependencies between grids is obtained. Figure 6 The following is a schematic diagram of the local grid calculation order matrix intercepted in the Tunxi River Basin. The grid marked 1 is the most upstream grid, and the grid marked 6 is Figure 5 The most downstream grid in the .

[0106] In step S214, calculating the grid convergence velocity matrix composed of the grid convergence velocities includes:

[0107] Calculate the flow velocity of water in each grid based on the water system matrix obtained in step S213 to form a grid flow velocity matrix;

[0108] When the element of the water system matrix is 0, it is slope confluence, and the slope confluence velocity of a single grid is The calculation formula is:

[0109] ,

[0110] Where, A preset coefficient to reflect the roughness of the slope; is the slope of the flow direction, obtained from the grid slope matrix and the grid flow direction matrix in step S211;

[0111] When the water system matrix is not 0, it is the river confluence, and the single grid river confluence velocity The calculation formula is: ,

[0112] Where, A preset coefficient to reflect the roughness of the river channel; is the catchment area of a single grid, which is calculated by multiplying the amount of runoff collected by the single grid by the area of the single grid in step S212; To preset the empirical coefficient, this embodiment Take 0.3; is the slope of the river along the flow direction, obtained from the grid slope matrix in step S211.

[0113] like Figure 7 As shown, it is a surface runoff convergence velocity diagram of the Tunxi River Basin in one embodiment. The redder the color, the faster the velocity, and the bluer the color, the slower the velocity.

[0114] The confluence time matrix includes: surface runoff confluence time matrix, river runoff confluence time matrix, subsoil flow confluence time matrix and underground runoff confluence time matrix;

[0115] Step S22 includes:

[0116] S221: Calculate the surface runoff confluence time matrix and the river runoff confluence time matrix:

[0117] The transmission time from each grid to the downstream grid is calculated by element-by-element division of the grid flow path length matrix and the confluence velocity matrix. The topological order of the calculation order matrix is used to traverse and accumulate the transmission time from the outlet grid in the reverse topological order of the runoff to generate the surface runoff confluence time matrix from each grid to the outlet grid. The river runoff confluence time matrix and the surface runoff confluence time matrix are the same.

[0118] S222: Calculate the subsurface runoff time matrix and the groundwater runoff time matrix:

[0119] Using the surface runoff confluence time matrix as a benchmark, the subsurface flow and groundwater flow confluence time matrices are derived using preset multiplication coefficients, which are determined based on the hydrogeological parameters of the calculation area. In this example, the subsurface flow velocity is set to 1 / 2.5 of the surface runoff velocity, and the groundwater velocity is set to 1 / 3 of the surface runoff velocity.

[0120] like Figure 8 As shown, it is a gridded schematic diagram of the surface runoff confluence time in the Tunxi Basin. The redder the color, the longer the time, and the bluer the color, the shorter the time. The red dot is the exit point where the exit grid is located. The exit flow calculated by the method of this embodiment is the flow at the red dot.

[0121] Step S3 includes:

[0122] S31: The CPU transmits the data obtained in step S1 and the confluence time matrix calculated in step S2 to the GPU, and the GPU allocates computing resources to each grid.

[0123] S32: Based on the evapotranspiration data obtained in step S1, the CPU calls the GPU kernel function to execute the grid Xin'anjiang model evapotranspiration algorithm in parallel to calculate the evapotranspiration of each grid;

[0124] S33: Based on the rainfall data obtained in step S1, the CPU calls the GPU kernel function and executes the grid Xin'an River model runoff generation algorithm in parallel. For grids where the water system matrix is not zero, the water source type is divided and the runoff generation of each water source type in each grid is calculated by deducting the evapotranspiration in step S32. For grids where the water system matrix is not zero, the runoff generation of the river channel in each grid is calculated by deducting the evapotranspiration in step S32. The water source types include: surface runoff, subsurface runoff, and ground runoff.

[0125] S34: Based on the confluence time matrix calculated in step S2, the CPU calls the GPU kernel function to execute the grid Xin'anjiang model confluence algorithm in parallel, calculates the flow transmission of each grid, uses atomic operations to update the instantaneous flow of the outlet grid at each moment, and integrates the instantaneous flow of the outlet grid at each moment to the current moment through atomic addition. The GPU obtains the cumulative flow of the outlet grid at the current moment.

[0126] Step S4 includes:

[0127] On the CPU side, detect whether the current moment of step S3 has reached the preset delay;

[0128] If the preset delay is not reached, the calculation of step S3 is executed in a loop;

[0129] If the preset delay is reached, the current outlet grid accumulated flow rate of step S3 is returned to the CPU end, and the CPU end outputs the outlet grid accumulated flow rate as the final outlet flow calculation result.

[0130] Specifically include:

[0131] The CPU calls the confluence unit kernel function on the GPU to perform parallel computation of the confluence unit. That is, the flow of each grid is superimposed by calling atomic operations, and finally the flow process of each grid in the time series is obtained:

[0132]

[0133] Where, It is an atomic operation function used for array superposition calculation in GPU kernel function; 、 、 They are one-dimensional arrays storing the flow of surface runoff, subsoil flow, and underground runoff on a single grid; 、 、 、 They are the surface runoff confluence time, subsurface runoff confluence time, underground runoff confluence time, and river confluence time of a single grid; is the current time step; 、 、 、 They are the surface runoff, soil runoff, underground runoff and river runoff of a single grid at the current time.

[0134] By integrating (accumulating) time at the outlet grid, the cumulative flow at the outlet grid can be obtained. :

[0135]

[0136] Where, is the total simulation time, is the instantaneous flow rate of the outlet grid.

[0137] In a specific embodiment, the method of this embodiment is applied to the calculation of the flow of the Tunxi River Basin, such as Figures 9 to 13 Schematic diagrams comparing the results of outlet flow calculation using the method of this embodiment and the traditional Muskingum method for flood events 1 to 5 in the Tunxi River Basin. Figures 9 to 13 In the figure, the red line is the method of the present invention, the black line is the traditional Muskingum method, the blue bar graph is the rainfall, and the gray bar graph is the station measurement value.

[0138] Table 1 Comparison of calculation accuracy between the method of the present invention and the Muskingum method

[0139]

[0140] Combined with the comparative data in Table 1, compared with the traditional Muskingum method, the method of the present invention is Figure 10 Flood event 2 shown, Figure 11 Flood events 3 and 4 are shown. Figure 13In flood event 5, the absolute value of the peak error is significantly smaller, particularly in flood event 5 (8.77% vs. 27.21%), demonstrating a significant advantage. Across all flood events, the proposed method exhibits smaller absolute values of front time errors (e.g., flood event 2: -1 hour vs. 5 hours; flood event 4: 1 hour vs. 10 hours), demonstrating a more accurate prediction of flood peak times. The proposed method also exhibits higher Nash coefficients (0.79-0.97 vs. 0.48-0.87) across all events, with particularly significant improvements in accuracy for flood events 3 (0.97 vs. 0.77) and 5 (0.79 vs. 0.48). This demonstrates that the proposed method for calculating outlet flow rates exhibits superior overall goodness of fit and higher accuracy. The Nash coefficient (Nash-Sutcliffe Efficiency Coefficient) is a model efficiency metric used to assess the fit between model simulation results and observed data, verifying model accuracy.

[0141] Table 2 Comparison of the computational efficiency of the method of the present invention and the traditional CPU serial computation method

[0142]

[0143] The speedup ratio in Table 2 is the ratio of the computation time of the traditional CPU serial calculation method to the computation time of the method of the present invention. Compared with the pure CPU calculation model, the speedup ratio for short-term simulation (1 week) reaches a maximum of 76.38. The method of the present invention only requires 2.569 seconds for calculation, while the traditional CPU serial calculation method requires 196.23 seconds. This method of the present invention has excellent efficiency improvements and is suitable for time-sensitive scenarios such as real-time flood warnings. It can support minute-level flood dynamic forecasting and enhance emergency response capabilities. For long-term simulation (1 year), the speedup ratio drops to 53.37, but still significantly saves computation time. It is still of great value for long-term flood forecasting in complex river basins, and can assist in the refined management of large river basins and climate change research.

[0144] This paper uses a CPU-GPU parallel computing method to significantly increase the model's computational speed. This method avoids the bottleneck of traditional grid serial computing and, combined with parallel optimization, provides a more accurate and efficient solution for flood risk assessment in data-deficient areas.

[0145] Example 2:

[0146] Based on the same inventive concept as the first embodiment, this embodiment introduces an outlet flow calculation system, including a data acquisition module, a time calculation module, an outlet flow calculation module, and a result output module;

[0147] The data acquisition module is used to: determine the calculation area and obtain data related to the calculation area and the outlet flow calculation;

[0148] The time calculation module is used to calculate the confluence time matrix composed of the confluence time of each grid using the grid Xin'an River model pre-processing unit pre-built on the CPU side according to the data obtained by the data acquisition module;

[0149] The outlet flow calculation module is used to calculate the outlet flow of the grid Xin'an River model on the GPU side based on the data obtained by the data acquisition module and the confluence time matrix calculated by the time calculation module;

[0150] The result output module is used to return the calculation result of the outlet flow calculation module to the CPU end after a preset delay, and the CPU end outputs the final confluence calculation result.

[0151] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0152] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0153] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0154] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0155] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for calculating outlet flow, characterized in that: include: S1: Determine the calculation area and obtain data related to the calculation area and outlet flow calculation; S2: Based on the data obtained in step S1, the grid Xin'an River model pre-processing unit pre-built on the CPU side is used to calculate the confluence time matrix composed of the confluence time of each grid; S3: Based on the data obtained in step S1 and the confluence time matrix calculated in step S2, the outlet flow of the grid Xin'an River model is calculated on the GPU side; S4: After a preset delay, the calculation result of step S3 is returned to the CPU, and the CPU outputs the final export flow calculation result.

2. The method for calculating the outlet flow rate according to claim 1, characterized in that: Step S2 includes: S21: Based on the data obtained in step S1, a grid Xin'an River model pre-processing unit pre-built on the CPU is used to calculate a grid flow path length matrix composed of the flow path lengths of each grid, a grid convergence velocity matrix composed of the convergence velocities of each grid, and a grid calculation order matrix composed of the upstream and downstream dependencies between grids; S22: Based on the principle of calculating time based on length and speed and the principle of accumulating the time of flowing through the grid based on upstream and downstream dependencies, a confluence time matrix composed of the confluence time of each grid to the outlet grid is calculated.

3. The method for calculating the outlet flow rate according to claim 2, characterized in that: Step S21 includes: S211: Calculating a grid slope matrix composed of grid slopes and a grid flow direction matrix composed of grid flow directions based on the DEM data of the grid terrain data in the grid Xin'an River model; the flow directions include horizontal flow direction, vertical flow direction, and diagonal flow direction; S212: Calculating a grid flow path length matrix composed of the flow path lengths of each grid according to the grid flow direction matrix of step S211, and counting the number of flow paths flowing into each grid as matrix elements to form a cumulative catchment area matrix; S213: Based on the cumulative catchment area matrix obtained in step S212, a grid operation order matrix composed of upstream and downstream dependencies between grids is calculated, and element values within a preset water system division value range are marked as 1, and element values outside the preset water system division value range are marked as 0, thereby obtaining a water system matrix; S214: Calculate the grid convergence velocity matrix composed of the grid convergence velocities according to the water system matrix obtained in step S213.

4. The method for calculating the outlet flow rate according to claim 3, characterized in that: The calculation of the grid flow path length matrix composed of the grid flow path lengths in step S212 includes: Assign the grid value of the calculation area to 0, calculate the grid length of each grid along the flow direction according to the flow direction of each grid, and form a grid flow path length matrix. The grid length passing through grid i is The calculation formula is: Where, is the length of the grid unit in the x direction; is the length of the grid unit in the y direction; The elevation difference between the two grid cells is calculated by subtracting the elevation of the flow direction grid from the elevation of the current grid in the DEM. The flow direction is obtained according to the grid flow direction matrix in step S211.

5. The method for calculating the outlet flow rate according to claim 3, characterized in that: The grid operation order matrix composed of the upstream and downstream dependencies between grids calculated in step S213 includes: Initialize the order value n of each grid to 0, and mark the order value of the grid with a cumulative catchment area of 1 in step S212 as n=1; Obtain the upstream and downstream dependencies between the grids according to the grid flow matrix in step S211, iteratively check the upstream dependencies of the grid with an order value of 0 and assign them incrementally; The iteration is terminated when the export grid is assigned a value, and the grid calculation order matrix composed of the upstream and downstream dependencies between grids is obtained.

6. The method for calculating the outlet flow rate according to claim 3, characterized in that: The calculation of the grid convergence velocity matrix composed of the grid convergence velocities in step S214 includes: Calculate the flow velocity of water in each grid based on the water system matrix obtained in step S213 to form a grid flow velocity matrix; When the element of the water system matrix is 0, it is slope confluence, and the slope confluence velocity of a single grid is The calculation formula is: , Where, A preset coefficient to reflect the slope roughness; is the slope of the flow direction, obtained from the grid slope matrix and the grid flow direction matrix in step S211; When the water system matrix is not 0, it is the river confluence, and the single grid river confluence velocity The calculation formula is: , Where, A preset coefficient to reflect the roughness of the river channel; is the catchment area of a single grid, which is calculated by multiplying the amount of runoff collected by the single grid by the area of the single grid in step S212; is the preset empirical coefficient; is the slope of the river along the flow direction, obtained from the grid slope matrix in step S211.

7. The method for calculating the outlet flow rate according to claim 2, characterized in that: The confluence time matrix includes: surface runoff confluence time matrix, river runoff confluence time matrix, subsoil flow confluence time matrix and underground runoff confluence time matrix; Step S22 includes: S221: Calculate the surface runoff confluence time matrix and the river runoff confluence time matrix: The transmission time from each grid to the downstream grid is calculated by element-by-element division of the grid flow path length matrix and the confluence velocity matrix. The topological order of the calculation order matrix is used to traverse and accumulate the transmission time from the outlet grid in the reverse topological order of the runoff to generate the surface runoff confluence time matrix from each grid to the outlet grid. The river runoff confluence time matrix and the surface runoff confluence time matrix are the same. S222: Calculate the subsurface runoff time matrix and the groundwater runoff time matrix: Taking the surface runoff confluence time matrix as a benchmark, the subsurface runoff confluence time matrix and the underground runoff confluence time matrix are obtained respectively according to preset multiplication coefficients, wherein the preset multiplication coefficients are determined according to the hydrogeological parameters of the calculation area.

8. The method for calculating the outlet flow rate according to claim 2, characterized in that: Step S3 includes: S31: The CPU transmits the data obtained in step S1 and the confluence time matrix calculated in step S2 to the GPU, and the GPU allocates computing resources to each grid. S32: Based on the evapotranspiration data obtained in step S1, the CPU calls the GPU kernel function to execute the grid Xin'anjiang model evapotranspiration algorithm in parallel to calculate the evapotranspiration of each grid; S33: Based on the rainfall data obtained in step S1, the CPU calls the GPU kernel function and executes the grid Xin'an River model runoff generation algorithm in parallel. For grids where the water system matrix is not zero, the water source type is divided and the runoff generation of each water source type in each grid is calculated by deducting the evapotranspiration in step S32. For grids where the water system matrix is not zero, the runoff generation of the river channel in each grid is calculated by deducting the evapotranspiration in step S32. The water source types include: surface runoff, subsurface runoff, and ground runoff. S34: Based on the confluence time matrix calculated in step S2, the CPU calls the GPU kernel function to execute the grid Xin'anjiang model confluence algorithm in parallel, calculates the flow transmission of each grid, uses atomic operations to update the instantaneous flow of the outlet grid at each moment, and integrates the instantaneous flow of the outlet grid at each moment to the current moment through atomic addition. The GPU obtains the cumulative flow of the outlet grid at the current moment.

9. The method for calculating the outlet flow rate according to claim 8, characterized in that: Step S4 includes: detecting at the CPU whether the current moment of step S3 reaches a preset delay; If the preset delay is not reached, the calculation of step S3 is executed in a loop; If the preset delay is reached, the current outlet grid accumulated flow rate of step S3 is returned to the CPU end, and the CPU end outputs the outlet grid accumulated flow rate as the final outlet flow calculation result.

10. An outlet flow calculation system, characterized in that: It includes data acquisition module, time calculation module, export flow calculation module and result output module; The data acquisition module is used to: determine the calculation area and obtain data related to the calculation area and the outlet flow calculation; The time calculation module is used to calculate the confluence time matrix composed of the confluence time of each grid using the grid Xin'an River model pre-processing unit pre-built on the CPU side according to the data obtained by the data acquisition module; The outlet flow calculation module is used to calculate the outlet flow of the grid Xin'an River model on the GPU side based on the data obtained by the data acquisition module and the confluence time matrix calculated by the time calculation module; The result output module is used to return the calculation result of the outlet flow calculation module to the CPU end after a preset delay, and the CPU end outputs the final outlet flow calculation result.

Citation Information

Patent Citations

  • Parallel analysis method for water area flow direction and cumulative convergence amount of CUDA architecture D8 algorithm

    CN114035966A

  • Hydrological and hydrodynamic process simulation method based on multiple GPUs

    CN114385358A

  • Grid Xinanjiang model parallel computing method based on CUDA

    CN118193207A

  • Urban inland inundation simulation method based on CPU-GPU heterogeneous parallel computing

    CN119397862A

  • System for and method of calculating hydrological conditions using machine learning

    US20240126954A1