Rapid hydraulic calculation method for large water supply pipe network model
By optimizing the number of sub-models and topological structure decomposition, combining deep decomposition and parallel computing frameworks, the problem of slow hydraulic calculation speed for large-scale water supply pipeline models is solved, efficient hydraulic calculation is achieved, and the requirements of real-time models are met.
Patent Information
- Application Number
- CN202510255837.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-05
- Publication Date
- 2025-06-27
AI Technical Summary
The prior art cannot ensure the accuracy of hydraulic calculation while taking into account the hydraulic calculation speed of large water supply pipeline models, resulting in too long response time and cannot meet the needs of real-time models.
By optimizing the number of sub-models and topological structure decomposition, a deep decomposition and parallel computing framework is adopted, combined with a reordering algorithm and an efficient coefficient matrix solution algorithm, to achieve fast hydraulic calculation.
The calculation speed of hydraulic model of large-scale water supply pipeline networks has been significantly accelerated, the calculation time of single-time hydraulic power is reduced, and the real-time performance and application efficiency of the model are improved.
Smart Images

Figure CN120217931A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of water supply network model construction and hydraulic calculation, and in particular to a fast hydraulic calculation method for a large-scale water supply network model. Background Art
[0002] The growth of urban population, the demand for more refined water supply services and the gradual improvement of geographic information systems have led to the continuous expansion of the scale of hydraulic models of water supply networks, which has also made the development and application of real-time models to simulate the hydraulic behavior of large water supply networks more challenging. In large-scale pipe network models, the long response time generated by the application of traditional hydraulic calculation theory methods such as the classic Global Gradient Algorithm (GGA) to perform multiple hydraulic simulations can no longer meet the current requirements for efficient analysis and real-time application of water supply hydraulic models.
[0003] Therefore, many scholars have studied the acceleration of the hydraulic calculation process of the pipe network model. Some studies have accelerated GGA by reducing the number of unknowns and accelerating the calculation convergence speed. Another part combines the modern computer parallel computing framework with the mainstream water supply pipe network modeling and calculation software EPANET developed based on GGA to try to speed up the hydraulic calculation speed of the model. Newer studies focus on proposing innovative model structures and cooperating with the rapidly developing modern parallel computing theory to accelerate the hydraulic calculation process, such as the literature "A deep-level decomposed model to accelerate hydraulic simulations in large water distribution networks" (Guo, S., Xin, K., Tao, T. and Yan, H., 2024. Water Research. 122318, 266). This study proposed a feasible theoretical framework, but there is still a lack of in-depth research on key steps such as coefficient matrix inversion in the hydraulic calculation process. There is also room for optimization and improvement in the model structure design and hydraulic calculation process, which limits its wide application in actual large-scale pipe networks.
[0004] Breaking through the bottleneck of hydraulic calculation speed of large-scale water supply network is crucial to the simulation performance and application efficiency of real-time model of water supply network. Existing technology cannot ensure the hydraulic calculation accuracy while taking into account the hydraulic calculation speed of large-scale pipe network model. Summary of the invention
[0005] The purpose of the present invention is to provide a fast hydraulic calculation method for a large water supply network model in order to ensure the hydraulic calculation accuracy while taking into account the hydraulic calculation speed of the large network model.
[0006] A fast hydraulic calculation method for a large water supply network model, the method comprising the following steps:
[0007] S1: Using a search algorithm to optimize and obtain the optimal number of sub-models suitable for the fast hydraulic calculation method. Subsequently, according to the optimal number of sub-models, applying a graph partitioning algorithm to decompose the topological structure of the overall hydraulic model of the large water supply network, forming a model structure in which multiple sub-models are coupled with the boundary model;
[0008] S2: Based on the coupling relationship between the sub-model and the boundary model, deeply decompose the model hydraulic calculation equations to obtain independent sub-model calculation equations and boundary model calculation equations, and reorder the internal elements of the sub-model calculation equation matrix;
[0009] S3: Initialize the node head and pipe segment flow rate in the model, and iteratively execute the following steps: Calculate the node head and pipe segment flow rate in the boundary model in the main thread; Calculate the node head and pipe segment flow rate in the sub-model in parallel sub-threads, and check whether the node head and pipe segment flow rate in this iteration meet the pre-set iteration termination condition. If so, stop the iteration; otherwise, continue the iterative calculation.
[0010] Further, the specific steps of S1 are:
[0011] S11: Using a search algorithm to optimize the number of sub-models and determine the optimal number of sub-models suitable for the fast hydraulic calculation method;
[0012] S12: Construct the overall hydraulic model of the large water supply network, where the model includes the node information of nodes, reservoirs, and water tanks and the connection information of pipe segments, pumps, and valves;
[0013] S13: According to the determined number of sub-models and the overall hydraulic model, use the k-way graph partitioning algorithm to decompose the model topological structure, obtain multiple internally connected sub-graphs and connection edges, and transform them into a model structure in which multiple sub-models are coupled with the boundary model.
[0014] Further, the specific steps of S11 are:
[0015] Determine the range of the number of sub-models [N min , N max , generate multiple partitioning schemes and calculate the objective function values of each partitioning scheme, and solve for the number of sub-models N with the smallest objective function value. The objective function is:
[0016]
[0017] where N * is the number of sub-models in the partitioning scheme, is the number of non-zero element fillings in the inverse matrix of the coefficient matrix of sub-model i in, is the mean square deviation of the number of nodes in the sub-model, where n i is the number of nodes in sub-model i, α and β are coefficients used to define the number of non-zero element padding and the priority of node number balance.
[0018] Furthermore, the calculation equations of the sub-model and the boundary model are as follows:
[0019]
[0020] where k is the number of iterations, and the on the left side of the equation is the calculation matrix of sub-model i; is the calculation matrix of boundary model B; is the correlation matrix between sub-model i and boundary model B; is the change value of the pipe segment flow and node head in sub-model i at the k-th iteration; is the change value of the pipe segment flow and node head in boundary model B at the k-th iteration; the on the right side of the equation is the pipe segment balance residual and node balance residual of sub-model i, is the pipe segment balance residual and node balance residual of boundary model B, Q represents the pipe segment flow, H represents the node head, dE represents the pipe segment balance residual, and dq represents the node balance residual.
[0021] Furthermore, the elements in the calculation matrix of sub-model i are:
[0022]
[0023] n il represents the head loss exponent of pipe segment il in sub-model i; R il is the resistance coefficient of pipe segment il, is the flow of pipe segment il at the k-th iteration; nil is the total number of pipe segments in sub-model i;
[0024] A 12(i) is the correlation matrix between the nodes with unknown heads and the pipe segments in sub-model i, A 21(i) = A 12(i) T A 12(i) is:
[0025]
[0026] A 22(i) is a matrix of all zeros;
[0027] The meaning and calculation method of the elements in The same The calculation method of the elements in is the same as that of A 12(i) The same
[0028] In the sub-model i And in the boundary model B Are as follows
[0029]
[0030] Where A 10(i) Is the incidence matrix between the nodes with known nodal heads and the pipe segments in the sub-model i, and the calculation method is the same as that of A 12(i) The same; H 0(i) Is the known nodal head in the sub-model i; q i , q B Are respectively the known nodal water consumptions in the sub-model i and in the boundary model B
[0031] Furthermore, the specific steps of S3 are as follows
[0032] S31: Initialize the nodal head and pipe segment flow values in the model
[0033] S32: Based on the sub-model calculation equations and the boundary model calculation equations, calculate the nodal head and pipe segment flow in the boundary model in the main thread. When the current iteration number is k + 1, the pipe segment flow and nodal head in the boundary model B are as follows
[0034]
[0035] In the formula
[0036] S33: Construct multiple parallel sub-threads, and each sub-thread is responsible for the calculation process of a sub-model. The i-th sub-thread calculates the nodal head and pipe segment flow in the sub-model i when the current iteration number is k + 1
[0037]
[0038] In the formula I (i) Is the identity matrix of size nil×nil Represents the head loss exponent matrix of the sub-model i. At the same time, it prepares for the boundary model calculation in the next iteration step And the sub-model coefficient matrix
[0039] S34: In the main thread, check whether the pipe segment flow and nodal head in the boundary model B meet the pre-set boundary model iteration termination condition. If so, enter step S35; if not, return to step S32
[0040] S35: In the main thread, summarize the node water heads and pipe segment flows in each sub-model of the sub-threads, and check whether the node water heads and pipe segment flows in each sub-model meet the pre-set sub-model iteration termination conditions. If so, enter step S37; otherwise, execute S36;
[0041] S36: Construct multiple parallel sub-threads, each sub-thread responsible for the calculation process of a sub-model. The i-th sub-thread calculates the node water head and pipe segment flow in sub-model i when the current iteration number is k + 1:
[0042]
[0043] where, I (i) is the unit matrix of size nil×nil, represents the head loss index matrix of sub-model i. After the calculation is completed, return to execute step S35;
[0044] S37: Exit the iteration process.
[0045] Furthermore, the elements in the pipe segment flow and node water head in the boundary model B and are respectively:
[0046]
[0047] Furthermore, the node water head of the i-th sub-model in the (k + 1)-th iteration in S33 is solved by the coefficient matrix method based on matrix element reordering. When calculating the inverse matrix of the sub-model coefficient matrix a triangular matrix solver and a sparse matrix calculation library are used.
[0048] Furthermore, in step S34, the boundary model iteration termination condition is: satisfying
[0049]
[0050] where nBl is the number of pipe segments in the boundary model, and δ B is the minimum value set by the user; ABS(·) represents taking the absolute value.
[0051] Furthermore, in step S35, the sub-model iteration termination condition is: satisfying
[0052]
[0053] where δ is the minimum value set by the user; ABS(·) represents taking the absolute value.
[0054] The object of the present invention can be achieved by the following technical solutions:
[0055] Compared with the prior art, the present invention has the following beneficial effects:
[0056] The optimization algorithm used in the present invention effectively balances the sub-model size and calculation efficiency by optimizing the number of sub-models during topological structure decomposition, making the model structure more adaptable to the fast hydraulic calculation method; the depth decomposition method provided by the present invention not only makes the sub-model calculation equation sets independent of each other, facilitating parallel calculation, but also enables it to combine with the reordering algorithm, making the arrangement of non-zero elements in the sub-model calculation matrix more compact; the high-efficiency coefficient matrix solution algorithm and fast triangular matrix solver combined by the present invention further improve the hydraulic calculation speed inside the sub-model; the asynchronous termination iteration method provided by the present invention respectively checks whether the boundary model, the node head and pipe segment flow rate of the sub-model in this iteration meet the pre-set iteration termination conditions. If so, the iteration is stopped, and the boundary model can terminate the iteration in advance; otherwise, continue the iterative calculation, saving the calculation time for the inverse of the boundary model and the sub-model coefficient matrix to the greatest extent, and further accelerating the hydraulic calculation process in the large-scale pipe network. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 is a flow block diagram of a fast hydraulic calculation method for a large-scale water supply pipe network model of the present invention;
[0058] Figure 2 is a schematic diagram of the topology and topology structure decomposition results of the water supply pipe network in Embodiment 1;
[0059] Figure 3 is a schematic diagram of the iterative convergence process of the fast hydraulic calculation of the water supply pipe network in Embodiment 1;
[0060] Figure 4 is a schematic diagram of the topology and topology structure decomposition results of the water supply pipe network in Embodiment 2;
[0061] Figure 5 is a schematic diagram comparing the calculation time of the fast hydraulic calculation method and EPANET in Embodiment 2. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0062] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. This embodiment is implemented on the premise of the technical solution of the present invention, and the detailed implementation manners and specific operation processes are given, but the protection scope of the present invention is not limited to the following embodiments.
[0063] Embodiment 1:
[0064] In this embodiment, the Figure 2 shown model structure diagram is adopted.
[0065] This embodiment proposes a fast hydraulic calculation method for a large - scale water supply network model. The flow chart is as Figure 1 shown, and it includes the following steps:
[0066] S1: Use a search algorithm to optimize and obtain the optimal number of sub - models suitable for the fast hydraulic calculation method. Subsequently, according to the optimal number of sub - models, apply the graph partitioning algorithm to decompose the topological structure of the overall hydraulic model of the large - scale water supply network, forming a model structure in which multiple smaller - scale sub - models are coupled with boundary models;
[0067] S2: Based on the correlation between the boundary models and sub - models obtained from the topological structure decomposition, deeply decompose the model hydraulic calculation equations to obtain independent sub - model calculation equations and boundary - model calculation equations; facilitate the combination with a parallel computing framework; re - order the internal elements of the sub - model calculation equation matrix to make its structure compact and facilitate the combination with a fast solution algorithm;
[0068] S3: Initialize the node head and pipe segment flow rate in the model, and start the iterative process of fast hydraulic calculation; calculate the node head and pipe segment flow rate in the boundary model in the main thread; subsequently, in parallel sub - threads, combine fast solution of sparse matrices such as the coefficient matrix method, triangular matrix solver, and sparse matrix calculation library to calculate the node head, pipe segment flow rate, and the inverse matrix of the sub - model coefficient matrix in the sub - models, etc.; check whether the calculation results of the boundary model and sub - models in this iteration meet the pre - set iteration termination conditions. According to whether the calculation results of the boundary model meet the termination conditions, enter different calculation processes. If the iteration of the boundary model terminates prematurely, only the sub - models can be calculated in parallel to further save calculation time. When the calculation results of both the boundary model and sub - models meet the iteration termination conditions, the iteration is exited, and the fast hydraulic calculation is completed.
[0069] Furthermore, step S1 includes the following steps:
[0070] S11: Use a search algorithm to optimize the number of sub - models, and comprehensively consider the balance of sub - model sizes and the inverse efficiency of the sub - model coefficient matrix to determine the optimal number of sub - models;
[0071] S12: Prepare the hydraulic model file of the large - scale water supply network, including node information such as water - using nodes, reservoirs, and water tanks, as well as connection information such as pipe segments, pumps, and valves, etc.;
[0072] S13: According to the determined number of sub - models and the prepared hydraulic model file, use the k - way graph partitioning algorithm in the graph partitioning tool METIS to decompose the model topological structure, obtain multiple internally connected sub - graphs and as few connecting edges as possible, and then convert them into sub - models and boundary models.
[0073] Further, the steps of the search algorithm in step S11 are as follows: Determine the range of the number of sub-models [N min , N max according to factors such as the hydraulic calculation completion time required by the user, the actual pipe network zoning situation, and the zonal energy consumption; within this range, use the k-way graph partitioning algorithm to decompose the model topology structure to generate multiple partitioning schemes; calculate the objective function value of each partitioning scheme; the number of sub-models N with the minimum objective function value not only reduces the number of non-zero elements generated during the inverse process of the coefficient matrix but also balances the number of nodes in the sub-models and can be determined as the final number of sub-models.
[0074] Preferably, in this embodiment, the initial range of the number of sub-models determined in step S11 is [1, 4], and the number of sub-models N optimized by the search algorithm is N = 2.
[0075] Preferably, the water head of the reservoir node in step S12 is 40 mH2O. The schematic diagrams of the model structure prepared in step S12 and the model structure obtained by topological decomposition in step S13 are as Figure 2 , a model with a total of 8 nodes and 8 main pipe segments is decomposed into two sub-models and a boundary model, and the boundary model consists of a pipe segment and its two end nodes.
[0076] Further, step S2 includes the following steps:
[0077] S21: Deeply decompose the hydraulic calculation equations of the large-scale pipe network according to the data of the sub-models and the boundary model obtained by topological decomposition. If the model is decomposed into N sub-models, the hydraulic calculation equations can be deeply decomposed into:
[0078]
[0079] In the formula, k is the number of iterations, and the on the left side of the equation is the calculation matrix of sub-model i; is the calculation matrix of the boundary model B; is the correlation matrix between sub-model i and the boundary model B; is the change value of the pipe segment flow and node water head in sub-model i at the k-th iteration; is the change value of the pipe segment flow and node water head in the boundary model B at the k-th iteration; the on the right side of the equation is the pipe segment balance residual and node balance residual of sub-model i, is the pipe segment balance residual and node balance residual of the boundary model B;
[0080] S22: After the in-depth decomposition of the hydraulic calculation equations, the rearrangement algorithm is used to adjust the arrangement order of the internal elements of the sub-model calculation equations, forming a more compact arrangement of non-zero elements, which is convenient for combination with the fast solution algorithm.
[0081] In step S21 of this embodiment, the model is decomposed into 2 sub-models, and the hydraulic calculation equations can be in-depth decomposed into:
[0082]
[0083] In the said step S21:
[0084] The elements in can be calculated as:
[0085]
[0086] In the formula, n il represents the head loss exponent of the pipe segment il in the sub-model i; R il is the resistance coefficient of the pipe segment il, and this coefficient can be calculated by the Hazen-Williams formula; is the flow rate of the pipe segment il at the k-th iteration; nil is the total number of pipe segments in the sub-model i;
[0087] A 12(i) is the incidence matrix between the nodes with unknown heads and the pipe segments in the sub-model i, A 21(i) = A 12(i) T A 12(i) can be calculated by the following formula:
[0088]
[0089] A 22(i) is a matrix of all zeros because the calculation of node water demand driven by pressure is not considered in the present invention;
[0090] The meaning and calculation method of the elements in are the same as those in The calculation method of the elements in is the same as that of A 12(i) 12(i) The calculation method of the elements in is the same as that of A
[0091] In the sub-model i and in the boundary model B can be calculated by the following formula:
[0092]
[0093] In the formula, A 10(i) is the incidence matrix between the nodes with known head in the sub-model i and the pipe segments, and the calculation method is the same as that of A 12(i) is the same; H0(i) is the known node head in sub-model i; q i , q B are respectively the known node water usages in sub-model i corresponding to those in boundary model B.
[0094] The decomposed hydraulic calculation equations after reordering in step S22 can be expressed as:
[0095]
[0096] Furthermore, step S3 includes the following steps:
[0097] S31: On the C language platform, initialize the node heads and pipe segment flow values in the model, and start the iterative process of fast hydraulic calculation;
[0098] S32: Calculate the node heads and pipe segment flows in the boundary model in the main thread. According to the result of the in-depth decomposition of the hydraulic calculation equations, when the number of iterations is k + 1, the pipe segment flows and node heads in boundary model B can be calculated by the following formula:
[0099]
[0100] In the formula,
[0101] S33: Invoke multiple parallel sub-threads using the Open multi-processing (OpenMP) framework. The i-th sub-thread calculates the node heads and pipe segment flows in sub-model i when the current number of iterations is k + 1:
[0102]
[0103] In the formula, I (i) is the unit matrix of size nil×nil;
[0104] In the parallel sub-threads, preparations also need to be made for the calculation of the boundary model in the next iteration step and the coefficient matrix of the sub-model
[0105] S34: In the main thread, check whether the calculation result of the boundary model meets the pre-set iteration termination condition of the boundary model. If so, enter step S35; if not, return to step S32;
[0106] S35: In the main thread, aggregate the calculation results of each sub-thread, and check whether the calculation result of the sub-model meets the pre-set iteration termination condition of the sub-model. If so, proceed to step S37; otherwise, execute step S36;
[0107] S36: The OpenMP framework starts multiple parallel sub-threads. The i-th sub-thread calculates the node head and pipe segment flow rate in sub-model i when the current iteration number is k + 1:
[0108]
[0109] In the formula, I (i) is an identity matrix of size nil×nil. After the calculation is completed, return to execute step S35;
[0110] S37: Exit the iterative process.
[0111] Preferably, δ in the iteration termination condition of the boundary model in step S34 B is 0.001, and δ in the iteration termination condition of the sub-model in step S35 is 0.001.
[0112] In step S33 The coefficient matrix method based on matrix element reordering can be used for rapid solution. When calculating the inverse matrix and other parts of the sub-model coefficient matrix use an efficient triangular matrix solver (TriangularSolver, TS) to solve the inverse matrix of the sparse coefficient matrix, and use the Suitesparse sparse matrix calculation library for basic matrix operations.
[0113] In step S34, the iteration termination condition of the boundary model is:
[0114]
[0115] In the formula, nBl is the number of pipe segments in the boundary model, and δ B is a minimum value set by the user; ABS(·) represents taking the absolute value.
[0116] In step S35, the iteration termination condition of the sub-model is:
[0117]
[0118] In the formula, δ is a minimum value set by the user; ABS(·) represents taking the absolute value.
[0119] In step S36 The coefficient matrix method based on matrix element reordering can be used for rapid solution.
[0120] In this embodiment, the iterative convergence process of steps S31 - S37 is as Figure 3 shown. The same unit system as the mainstream computational software EPANET is used in the iteration, and it is converted to the International System of Units (SI) when comparing errors. After 2 iterations, the boundary model has met the iteration termination condition, and the iteration is terminated in advance; after a total of 3 iterations, the method converges rapidly. Compared with the calculation results of EPANET, the maximum absolute errors of the pipe flow rate and the node head calculated by the method are both small, which are 7.10×10 -9 m 3 / s and 7.50×10 -6 mH2O respectively. This embodiment shows that the method provided by the present invention can converge effectively and has a high calculation accuracy, and can complete accurate hydraulic calculations in the water supply network.
[0121] Embodiment 2:
[0122] In this embodiment, the model structure schematic diagram shown in Figure 4 is adopted.
[0123] A fast hydraulic calculation method for a large-scale water supply network model provided in this embodiment includes the following steps:
[0124] S1: Use a search algorithm to optimize and obtain the optimal number of sub-models suitable for the fast hydraulic calculation method. Subsequently, according to the optimal number of sub-models, apply a graph partitioning algorithm to decompose the topological structure of the overall hydraulic model of the large-scale water supply network, forming a model structure in which multiple smaller-scale sub-models are coupled with a boundary model;
[0125] S2: Based on the correlation relationship between the boundary model and the sub-models obtained from the topological structure decomposition, deeply decompose the model hydraulic calculation equations to obtain independent sub-model calculation equations and boundary model calculation equations; facilitate the combination with a parallel computing framework; reorder the internal elements of the sub-model calculation equation matrix to make its structure compact, which is convenient for combination with a fast solution algorithm;
[0126] S3: Initialize the node head and pipe flow rate in the model, and start the iterative process of fast hydraulic calculation; calculate the node head and pipe flow rate in the boundary model in the main thread; subsequently, in parallel sub-threads, combine a coefficient matrix method, a triangular matrix solver, a sparse matrix calculation library, etc. to quickly solve sparse matrices, and calculate the node head, pipe flow rate, and the inverse matrix of the sub-model coefficient matrix in the sub-models, etc.; check whether the calculation results of the boundary model and the sub-models in this iteration meet the pre-set iteration termination conditions, and enter different calculation processes according to whether the calculation results of the boundary model meet the termination conditions. If the iteration of the boundary model is terminated in advance, only the sub-models can be calculated in parallel to further save calculation time. When the calculation results of both the boundary model and the sub-models meet the iteration termination conditions, the iteration is exited to complete the fast hydraulic calculation.
[0127] Further, step S1 includes the following steps:
[0128] S11: Optimize the number of sub-models using a search algorithm, comprehensively consider the balance of sub-model sizes and the efficiency of inverting the coefficient matrix of the sub-models, and determine the optimal number of sub-models;
[0129] S12: Prepare the hydraulic model file of the large-scale pipe network, including node information such as water consumption nodes, reservoirs, and water tanks, and connection information such as pipe segments, pumps, and valves;
[0130] S13: According to the determined number of sub-models and the prepared hydraulic model file, use the k-way graph partitioning algorithm in the graph partitioning tool METIS to decompose the model topology structure, obtain multiple internally connected sub-graphs and as few connection edges as possible, and then convert them into sub-models and boundary models.
[0131] Further, the steps of the search algorithm in step S11 are as follows: Determine the range of the number of sub-models [N min , N max according to factors such as the hydraulic calculation completion time required by the user, the actual pipe network zoning situation, and the zoning energy consumption; within this range, use the k-way graph partitioning algorithm to decompose the model topology structure to generate multiple partitioning schemes; calculate the objective function values of each partitioning scheme; the number of sub-models N with the smallest objective function value not only reduces the number of non-zero elements generated during the process of inverting the coefficient matrix, but also balances the number of nodes in the sub-models, and can be determined as the final number of sub-models.
[0132] Preferably, in this embodiment, the initial range of the number of sub-models determined in step S11 is [1, 96], and the number of sub-models N = 64 optimized by the search algorithm.
[0133] The schematic diagrams of the model structure prepared in step S12 and the model structure obtained by topological decomposition in step S13 of this embodiment are as Figure 4 shown. A large-scale model with a total number of nodes of 198576 and a total number of pipe segments of 206283 is decomposed into 64 sub-models and a boundary model. The boundary model has a total of 1533 nodes and 770 pipe segments.
[0134] Further, step S2 includes the following steps:
[0135] S21: Deeply decompose the hydraulic calculation equations of the large-scale pipe network according to the data of the sub-models and the boundary model obtained by topological decomposition. If the model is decomposed into N sub-models, the hydraulic calculation equations can be deeply decomposed into:
[0136]
[0137] where k is the number of iterations, and the left side of the equation is the calculation matrix of sub-model i; is the calculation matrix of boundary model B; is the correlation matrix between sub-model i and boundary model B; is the change value of the pipe segment flow rate and node head in sub-model i at the k-th iteration ; is the change value of the pipe segment flow rate and node head in boundary model B at the k-th iteration ; the right side of the equation is the pipe segment balance residual and node balance residual of sub-model i, is the pipe segment balance residual and node balance residual of boundary model B;
[0138] S22: After the in-depth decomposition of the hydraulic calculation equations, the reordering algorithm is used to adjust the arrangement order of the internal elements of the sub-model calculation equations to form a more compact arrangement of non-zero elements, which is convenient for combination with the fast solution algorithm.
[0139] In this embodiment, due to the large scale of the hydraulic calculation equation matrix, the pipe network hydraulic calculation equations after the in-depth decomposition of hydraulic calculation in step S21 and the decomposed pipe network hydraulic calculation equations after reordering in step S22 are not shown in the text for the time being.
[0140] Further, step S3 includes the following steps:
[0141] S31: On the C language platform, initialize the node head and pipe segment flow rate values in the model, and start the iterative process of fast hydraulic calculation;
[0142] S32: Calculate the node head and pipe segment flow rate in the boundary model in the main thread. According to the result of the in-depth decomposition of the hydraulic calculation equations, when the number of iterations is k + 1, the pipe segment flow rate and node head in boundary model B can be calculated by the following formula:
[0143]
[0144] where
[0145] S33: The Open Multi-Processing (OpenMP) framework is invoked to start multiple parallel sub-threads. The i-th sub-thread calculates the node head and pipe segment flow rate in sub-model i when the current number of iterations is k + 1:
[0146]
[0147] where I(i) is an identity matrix of size nil×nil;
[0148] In parallel sub-threads, it is also necessary to prepare for the calculation of the boundary model for the next iteration step and the sub-model coefficient matrix
[0149] S34: In the main thread, check whether the calculation result of the boundary model meets the pre-set boundary model iteration termination condition. If so, go to step S35; otherwise, return to step S32;
[0150] S35: In the main thread, summarize the node heads and pipe segment flows in each sub-model of the sub-threads, and check whether the node heads and pipe segment flows in each sub-model meet the pre-set sub-model iteration termination condition. If so, go to step S37; otherwise, execute S36;
[0151] S36: The OpenMP framework starts multiple parallel sub-threads. The i-th sub-thread calculates the node head and pipe segment flow in sub-model i when the current iteration number is k + 1:
[0152]
[0153] where I (i) is an identity matrix of size nil×nil, represents the head loss exponent matrix of sub-model i. After the calculation is completed, return to execute step S35;
[0154] S37: Exit the iteration process.
[0155] Preferably, δ of the boundary model iteration termination condition in step S34 B is 0.001, and δ of the sub-model iteration termination condition in step S35 is 0.001.
[0156] In this embodiment, the method converges after 6 iterations. Compared with the EPANET calculation results, the maximum absolute error of the node head is only 8.83×10 -3 mH2O, and the maximum absolute error of the pipe segment flow is only 3.68×10 -4 m 3 / s, which shows the calculation accuracy of the method. To remove the influence of system load fluctuations, etc., both the proposed method and EPANET are tested 10 times and the average value is taken. The test results are as Figure 5As shown. Finally, the single - moment hydraulic calculation time of the method proposed by the present invention is 0.2522 s. Compared with 0.4097 s of EPANET, the calculation time is reduced by 38.44%. This embodiment shows that the method provided by the present invention can effectively reduce the hydraulic calculation time of large - scale water supply network models, helps to meet the requirements of users for short - time response of real - time models, and improves the real - time performance and practicability of large - scale hydraulic models.
[0157] The electronic device of the present invention includes a central processing unit (CPU), which can perform various appropriate actions and processes according to computer program instructions stored in a read - only memory (ROM) or computer program instructions loaded from a storage unit into a random - access memory (RAM). In the RAM, various programs and data required for device operation can also be stored. The CPU, ROM, and RAM are connected to each other through a bus, and an input / output (I / O) interface is also connected to the bus. The program code for implementing the method of the present invention can be provided to a processor or controller of a general - purpose computer, a special - purpose computer, or other programmable data - processing devices with multiple CPUs, so that when the program code is executed by the processor or controller, the functions / operations specified by the flowchart are implemented. The program code can be executed entirely on the machine, partially on the machine, executed partially on the machine and partially on a remote machine as an independent software package, or executed entirely on a remote machine or server.
[0158] The machine - readable medium of the present invention can be a tangible medium that can contain or store a program for use by or in connection with an instruction - execution system, apparatus, or device. The machine - readable medium can be a machine - readable signal medium or a machine - readable storage medium. The machine - readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the above.
[0159] Compared with the prior art, the present invention has the following beneficial effects:
[0160] 1. The method provided by the present invention utilizes the fast iterative process of topological - structure - hydraulic - calculation decomposition and combined parallel calculation. Without sacrificing calculation accuracy, it can effectively accelerate the calculation speed of large - scale water supply network hydraulic models. The single - moment hydraulic calculation time of the method provided by the present invention can be reduced by nearly 40% compared with the mainstream modeling calculation software EPANET, which helps to build a real - time hydraulic model of a large - scale water supply network, reduce its response time, and improve the efficiency of the combined application of the real - time model and various intelligent algorithms, thus supporting the water supply industry to achieve digital and intelligent management of large - scale water supply networks.
[0161] 2. The optimization algorithm used in the present invention effectively balances the size of sub-models and computational efficiency by optimizing the number of sub-models during topological structure decomposition, making the model structure more adaptable to the fast hydraulic calculation method. The depth decomposition method provided by the present invention not only makes the computational equations of sub-models independent of each other, facilitating parallel computing, but also enables it to combine with the reordering algorithm, making the arrangement of non-zero elements in the sub-model computational matrix more compact. The high-efficiency coefficient matrix solution algorithm and fast triangular matrix solver combined by the present invention further improve the hydraulic calculation speed within the sub-model. The asynchronous termination iteration method provided by the present invention saves the computational time for inverting the coefficient matrices of the boundary model and sub-models to the greatest extent, further accelerating the hydraulic calculation process in large pipe networks.
[0162] 3. The modern parallel computing framework OpenMP used in the present invention has the following advantages: First, OpenMP uses the central processing unit (CPU) and threads for parallelization, without relying on special hardware devices. The required software and hardware devices are easily obtained, and it has strong versatility. OpenMP provides a high-level abstract description of parallel algorithms, with little interference to the original serial code during the compilation process, making program writing convenient. OpenMP has strong portability, supports multiple systems and programming languages, and is conducive to popularization.
[0163] 4. The method provided by the present invention has great application potential. First, the method can balance the hydraulic calculation accuracy, speed, and available computing resources. For example, using a single thread to calculate multiple sub-models to save computing resources. The depth decomposition of the hydraulic calculation equations provides a basis for exploring the hydraulic relationships between individual sub-models and helps to determine the key hydraulic regions in large pipe networks, which can improve the computational efficiency of large hydraulic models and the result quality of intelligent algorithms in intelligent applications such as model calibration, leakage detection, and optimal scheduling.
[0164] The preferred specific embodiments of the present invention have been described in detail above. It should be understood that those of ordinary skill in the art can make many modifications and variations based on the concept of the present invention without creative work. Therefore, all technical solutions that can be obtained by those skilled in the art in the technical field based on the concept of the present invention through logical analysis, reasoning, or limited experiments on the basis of the existing technology shall fall within the protection scope determined by the claims.
Claims
1. A fast hydraulic calculation method for a large water supply network model, characterized in that: The method comprises the following steps: S1: The optimal number of sub-models that are suitable for the fast hydraulic calculation method is obtained by optimizing the search algorithm. Then, according to the optimal number of sub-models, the graph partitioning algorithm is used to perform topological structure decomposition on the overall hydraulic model of the large pipe network to form a model structure in which multiple sub-models are coupled with the boundary model. S2: Based on the coupling relationship between the sub-model and the boundary model, the hydraulic calculation equations of the model are deeply decomposed to obtain the mutually independent sub-model calculation equations and boundary model calculation equations, and the internal elements of the matrix of the sub-model calculation equations are reordered; S3: Initialize the node heads and pipe flow rates in the model, and iteratively perform the following steps: calculate the node heads and pipe flow rates in the boundary model in the main thread; calculate the node heads and pipe flow rates in the sub-model in parallel sub-threads, and check whether the node heads and pipe flow rates of this iteration meet the pre-set iteration termination conditions. If so, stop the iteration, otherwise continue the iterative calculation.
2. The rapid hydraulic calculation method for a large water supply network model according to claim 1 is characterized in that: The specific steps of S1 are: S11: Optimize the number of sub-models using a search algorithm to determine the optimal number of sub-models that is suitable for the fast hydraulic calculation method; S12: constructing an overall hydraulic model of a large-scale pipe network, wherein the model includes node information of nodes, reservoirs, and pools and connection information of pipe sections, water pumps, and valves; S13: According to the determined number of sub-models and the overall hydraulic model, the model topology structure is decomposed using the k-way graph partitioning algorithm to obtain multiple internally connected sub-graphs and connecting edges, which are converted into a model structure in which multiple sub-models are coupled with a boundary model.
3. The rapid hydraulic calculation method for a large water supply network model according to claim 2 is characterized in that: The specific steps of S11 are: Determine the range of sub-model numbers [N min ,N max ], generate multiple partitioning schemes and calculate the objective function value of each partitioning scheme, and solve the number N of sub-models with the minimum objective function value. The objective function is: Among them, N * is the number of sub-models in the partitioning scheme, is the inverse matrix of the coefficient matrix of submodel i The number of non-zero elements in , is the mean square error of the number of nodes in the sub-model, where n i is the number of nodes of sub-model i, α and β are coefficients used to define the priority of the balance of the number of non-zero elements filled and the number of nodes.
4. The rapid hydraulic calculation method for a large water supply network model according to claim 1 is characterized in that: The sub-model calculation equation group and the boundary model calculation equation group are: Where k is the number of iterations, and the left side of the equation is the calculation matrix of sub-model i; is the calculation matrix of boundary model B; is the correlation matrix between sub-model i and boundary model B; is the flow rate and node head of the pipe segment in sub-model i at the kth iteration The change value of is the flow rate and node head of the pipe segment in boundary model B at the kth iteration The change value of are the segment balance residual and node balance residual of sub-model i, are the segment balance residual and node balance residual of boundary model B, Q represents segment flow, H represents node head, dE represents segment balance residual, and dq represents node balance residual.
5. The rapid hydraulic calculation method for a large water supply network model according to claim 4 is characterized in that: The elements in the calculation matrix of sub-model i are: n il represents the head loss index of pipe segment il in sub-model i; R il is the resistance coefficient of the pipe section il, is the flow rate of pipe segment il at the kth iteration; nil is the total number of pipe segments in sub-model i; A 12(i) is the association matrix between nodes and pipe sections with unknown water heads in sub-model i, A 21(i) =A 12(i) T , A 12(i) for: A 22(i) is an all-zero matrix; The meaning and calculation method of the elements in same, The calculation method of the elements in is the same as that of A 12(i) same; In submodel i and boundary model B for: Among them, A 10(i) is the correlation matrix between nodes and pipe sections with known node heads in sub-model i, and the calculation method is the same as A 12(i) Same; H 0(i) is the known node head in submodel i; q i ,q B are the known node water consumption in sub-model i and boundary model B respectively.
6. The rapid hydraulic calculation method for a large water supply network model according to claim 5 is characterized in that: The specific steps of S3 are: S31: Initialize the node head and pipe flow value in the model; S32: Based on the sub-model calculation equation group and the boundary model calculation equation group, the node head and pipe flow in the boundary model are calculated in the main thread. When the current iteration number is k+1, the pipe flow and node head in the boundary model B are: In the formula, S33: Construct multiple parallel sub-threads, each of which is responsible for the calculation process of a sub-model. The i-th sub-thread calculates the node head and pipe flow in sub-model i when the current iteration number is k+1: In the formula, I (i) is the identity matrix of size nil×nil, Represents the head loss index matrix of sub-model i, and at the same time, prepares the boundary model calculation for the next iteration step And the sub-model coefficient matrix S34: In the main thread, check whether the pipe flow and node head in the boundary model B meet the preset boundary model iteration termination condition. If yes, go to step S35, otherwise return to step S32; S35: In the main thread, the node heads and pipe flow rates in each sub-model of the sub-thread are summarized, and it is checked whether the node heads and pipe flow rates in each sub-model meet the pre-set sub-model iteration termination condition. If so, the process proceeds to step S37, otherwise, it proceeds to step S36; S36: Construct multiple parallel sub-threads, each of which is responsible for the calculation process of a sub-model. The i-th sub-thread calculates the node head and pipe flow in the sub-model i when the current iteration number is k+1: In the formula, I (i) is the identity matrix of size nil×nil, represents the head loss index matrix of sub-model i, and after the calculation is completed, returns to execute step S35; S37: Exit the iteration process.
7. A fast hydraulic calculation method for a large water supply network model according to claim 6, characterized in that: Elements in link flow and node head in boundary model B and They are:
8. The rapid hydraulic calculation method for a large water supply network model according to claim 7 is characterized in that: Node head of the ith submodel at the k+1th iteration in S33 Solve by using the coefficient matrix method based on reordering of matrix elements, and calculate the sub-model coefficient matrix When solving the inverse matrix of , a triangular matrix solver and a sparse matrix computation library are used.
9. The rapid hydraulic calculation method for a large water supply network model according to claim 6, characterized in that: In step S34, the boundary model iteration termination condition is: Where nBl is the number of pipe segments in the boundary model, δ B It is the minimum value set by the user; ABS(·) means taking the absolute value.
10. The rapid hydraulic calculation method for a large water supply network model according to claim 6, characterized in that: In step S35, the sub-model iteration termination condition is: Among them, δ is the minimum value set by the user; ABS(·) means taking the absolute value.
Citation Information
Cited By
Building water supply pipeline water age calculation method
CN122594626A