用于天然气管网动态仿真的图形处理器并行计算方法
By organizing the natural gas pipeline transmission model into a state-space format and utilizing a graphics processor for parallel computation, the problem of slow solution speed in dynamic simulation of natural gas pipeline networks is solved, achieving efficient simulation computation.
Patent Information
- Application Number
- CN202410132382.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-31
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2044-01-31
AI Technical Summary
Existing dynamic simulations of natural gas pipeline networks are slow to solve in large-scale systems, making it difficult to balance simulation accuracy and solution speed.
The MacCormack-exponential integration method is used to organize the natural gas pipeline transmission model into a state-space format, and parallel computation is performed using a graphics processor to improve simulation efficiency.
While ensuring computational accuracy, it significantly improves the solution speed of dynamic simulation of natural gas pipeline networks, making it suitable for rapid dynamic simulation of large-scale natural gas pipeline networks.
Smart Images

Figure CN117951430B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of energy transmission technology and relates to a dynamic simulation method for natural gas pipeline networks, particularly a parallel computing method using a graphics processor for dynamic simulation of natural gas pipeline networks. Background Technology
[0002] In recent years, with the widespread application of clean energy, the transmission of renewable energy sources, represented by natural gas, has received global attention, and research on gas networks in the integrated energy field has deepened. Gas pipeline networks can transport clean energy sources such as natural gas and hydrogen, which have high calorific value and are safe and reliable. With the accelerated adjustment of my country's energy structure, the demand for clean energy gases is growing rapidly. Due to the increasing scale, complexity, and multiple gas source supply of gas transmission networks, a series of issues such as gas supply reliability, pipeline inspection and analysis, and optimized scheduling have posed new challenges to the design, operation, and status analysis of the system. To gain a deeper understanding of the operational characteristics and dynamic processes of pipeline networks, digital dynamic simulation calculations for modeling and analyzing transmission networks have become a widely used method.
[0003] Traditional gas dynamic simulation is slow in solving large-scale systems, and simplified simulation models are often used to improve speed. Designing a gas pipeline network solver that balances simulation accuracy and solution speed is one of the key research directions in China. Existing solutions mainly focus on improving simulation algorithms and utilizing parallel hardware. However, with the increasing complexity of pipeline network topologies and the gradual improvement of algorithms, more and more researchers are focusing on parallel computing.
[0004] Graphics Processing Units (GPUs) have become an indispensable part of modern computing systems. Modern GPUs are not only graphics engines but also highly parallel programmable processors. GPUs contain a large number of arithmetic units, suitable for handling numerous simple calculations, while a small number of control and cache units are primarily used for merging and forwarding data, enabling data interaction with the central processing unit (CPU). Compared to the CPU, GPUs possess a more consistent array of computing resources, making them suitable for parallel computation of large amounts of data. In recent years, they have achieved breakthroughs in floating-point and parallel computing and possess enormous potential for further improvement.
[0005] In summary, the solution efficiency is low due to numerical problems such as the irregularity of the large-scale coefficient matrix of the gas pipeline model. Therefore, improving the computational efficiency of pipeline dynamic simulation is an urgent problem to be solved. Summary of the Invention
[0006] The purpose of this invention is to overcome the shortcomings of the prior art and provide a graphics processor parallel computing method for dynamic simulation of natural gas pipeline networks. This method organizes the natural gas pipeline transmission model into a state-space format using the MacCormack-exponential integration method, and then applies graphics processor parallel computing to improve the computational efficiency of pipeline network dynamic simulation.
[0007] The present invention solves the existing technical problems by adopting the following technical solution:
[0008] A parallel computing method using a graphics processor for dynamic simulation of natural gas pipeline networks includes the following steps:
[0009] Step 1: Determine the structure and parameters of the natural gas pipeline network to be simulated;
[0010] Step 2: Based on the first-order partial differential equations for gas transmission in the pipeline, establish a unified form of equations for each infinitesimal pipeline segment.
[0011] Step 3: Use the MacCormack method to spatially discretize the unified form equations to generate the expressions for the prediction layer and the correction layer;
[0012] Step 4: Based on the spatially discretized expressions of the prediction layer and the correction layer, establish the corresponding state-space equations respectively;
[0013] Step 5: Set the initial time of the simulation calculation t0 = 0, set the initial simulation value X0, and set the simulation time step Δt, which in the graphics processor are A0, A1, B0, B1, and... Matrix allocation of memory space, obtaining the state-space linear parameter matrices A0 and A1 of the prediction layer and the calibration layer, as well as the state-space nonlinear matrices B0 and B1 of the prediction layer and the calibration layer, and solving for the matrix. Matrix, start simulation calculation;
[0014] Step 6: Based on the current time t n Time state variable X n Calculate t n nonlinear variable Y at time step n By combining the MacCormack method and the explicit exponential Euler algorithm, t is obtained. n+1 State variables of the prediction and correction layers at specific times Among them, t n For the nth solution, t satisfies n =n·Δt;
[0015] Step 7: Based on the natural gas pipeline network parameters, combined with t n+1 Time prediction layer and correction layer state variables Get t n+1 State variables at time:
[0016]
[0017] Step 8: End the simulation calculation for this time step and update t. n+1 =t n +Δt, the simulation advances by one step, if t n+1 Less than the simulation end time T end Proceed to the next step; otherwise, the simulation ends.
[0018] Step 9: Determine whether the pipeline system's network structure has changed due to a fault or valve disconnection. If so, update A0, A1, B0, B1, and... If the matrix is empty, then skip to step 6; otherwise, skip directly to step 6.
[0019] Furthermore, the structure and parameters of the natural gas pipeline network to be simulated include the number of micro-pipes, the number of nodes, and the starting node, ending node, length, pipe sound velocity, pipe diameter, and pipe friction coefficient of each micro-pipe.
[0020] Furthermore, the unified equation established in step 2 for each infinitesimal pipe element is as follows:
[0021]
[0022] in,
[0023]
[0024]
[0025]
[0026] In the formula, p is the pressure at a node in the infinitesimal pipe element, m is the flow rate in the infinitesimal pipe element, S is the cross-sectional area of the pipe, c is the velocity of sound inside the pipe, λ is the coefficient of friction of the pipe, and D is the diameter of the pipe. This is the average flow rate of the current micro-element pipe segment and the flow rate of the next micro-element pipe segment. Let U be the average pressure of the node in this segment of the infinitesimal pipeline and the node in the previous segment of the pipeline. Let U be the vector to be solved, V be the pipeline coefficient matrix, H be the pipeline coefficient vector, t be time, and x be the spatial length.
[0027] Furthermore, in step 3, the pressure difference of the prediction layer adopts backward differential and the flow difference adopts forward differential; the pressure difference of the correction layer adopts forward differential and the flow difference adopts backward differential.
[0028] Furthermore, the state-space equation established in step 4 is as follows:
[0029]
[0030]
[0031] In the formula, X is the state variable. To predict the state variables of the layer, To predict the nonlinear variables of the layer, To predict the time derivative of the layer state variables, To correct the state variables of the correction layer, To correct the nonlinear variables of the correction layer, For the time-dependent differential terms of the state variables of the correction layer, matrices A0 and B0 are the linear and nonlinear parameter matrices of the state equation of the prediction layer, respectively, and matrices A1 and B1 are the linear and nonlinear parameter matrices of the state equation of the correction layer, respectively.
[0032] Furthermore, the specific calculation method for step 6 is as follows:
[0033]
[0034]
[0035]
[0036]
[0037] In the formula, Indicates the prediction layer and the correction layer Family functions For t n+1 Nonlinear variables in the prediction layer at time intervals, For node i, t n The nodal pressure at time _____. and Pipe No. j and t respectively n Input port traffic and output port traffic at any given time. and Pipe No. j and t respectively n The input port node pressure and the output port node pressure at time t. Family functions The calculation form is:
[0038]
[0039] In the formula, E is the identity matrix.
[0040] The advantages and positive effects of this invention are:
[0041] This invention combines the MacCormack algorithm and the exponential integral algorithm to achieve pipeline network solution based on state-space equations. Furthermore, it utilizes a graphics processing unit (GPU) for parallel solution of large-scale matrix operations, effectively ensuring both solution speed and computational accuracy in dynamic simulation. This invention demonstrates good feasibility and applicability, improving the solution speed of dynamic simulation of natural gas pipeline networks and providing a valuable solution for achieving rapid dynamic simulation of large-scale natural gas pipeline networks. Attached Figure Description
[0042] Figure 1 This is a flowchart of the calculation process of this invention;
[0043] Figure 2 This is a connection topology diagram of the natural gas pipeline network in the embodiment;
[0044] Figure 3 This is the differential pipeline model of the prediction layer and correction layer of the present invention;
[0045] Figure 4 This is the relative error of the steady-state flow rate at the end of the pipeline under the present invention and the method of characteristics;
[0046] Figure 5 This is the relative error of the steady-state pipe node pressure results of the present invention and the method of characteristics;
[0047] Figure 6 This is a schematic diagram of pipeline flow rate changes under natural gas load disturbances, based on the present invention and the method of characteristics.
[0048] Figure 7 This is a schematic diagram of the nodal pressure change under natural gas load disturbance using the present invention and the method of characteristics;
[0049] Figure 8 This is a schematic diagram of pipeline flow rate changes under natural gas source pressure disturbances according to the present invention and the method of characteristics;
[0050] Figure 9 This is a schematic diagram of the nodal pressure change under the pressure disturbance of natural gas source according to the present invention and the method of characteristics. Detailed Implementation
[0051] The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0052] This embodiment uses a 76-pipeline, 73-node natural gas pipeline network system as an example to illustrate the parallel computing method of the graphics processor for dynamic simulation of natural gas pipeline networks of the present invention. Figure 1 As shown, it includes the following steps:
[0053] Step 1: Based on the example input file, determine the structure and parameters of the natural gas pipeline network to be simulated.
[0054] In this embodiment, the connection topology of the natural gas pipeline network is as follows: Figure 2 As shown, its simulation parameters are shown in Table 1:
[0055] Table 1 Gas Network Branch Parameters
[0056]
[0057]
[0058] Step 2: Based on the first-order partial differential equations for gas transport in the pipeline, establish a unified form of equations for each infinitesimal pipeline segment:
[0059]
[0060] in,
[0061]
[0062]
[0063]
[0064] In the formula, p is the pressure at a node in the infinitesimal pipe element, m is the flow rate in the infinitesimal pipe element, S is the cross-sectional area of the pipe, v is the velocity of sound inside the pipe, λ is the coefficient of friction of the pipe, and D is the diameter of the pipe. This is the average flow rate of the current micro-element pipe segment and the flow rate of the next micro-element pipe segment. Let U be the average pressure of the node in this segment of the infinitesimal pipeline and the node in the previous segment of the pipeline. Let U be the vector to be solved, V be the pipeline coefficient matrix, H be the pipeline coefficient vector, t be time, and x be the spatial length.
[0065] Step 3: Use the MacCormack method to spatially discretize the unified form equations to generate the expressions for the prediction layer and the correction layer. Figure 3 Differential pipeline models for the prediction layer and the correction layer are presented. The pressure difference in the prediction layer uses backward differential, and the flow difference uses forward differential.
[0066]
[0067]
[0068]
[0069]
[0070]
[0071] The prediction layer expression can be obtained by considering the input and output port flow rates of pipe j and the node pressure drop of node i+1:
[0072]
[0073]
[0074]
[0075] In the formula, For the (i+1)th node, t n+1 The differential term of pressure with respect to time is estimated at all times. and For the j-th pipe and t respectively n+1 The time-dependent derivative of the estimated flow rate at the input and output terminals.
[0076] The pressure differential of the correction layer uses forward differential, and the flow differential uses backward differential.
[0077]
[0078]
[0079]
[0080]
[0081]
[0082] The prediction layer expression can be obtained by considering the input and output port flow rates of pipe j+1 and the node voltage drop of node i+1:
[0083]
[0084]
[0085]
[0086] In the formula, For the (i+1)th node, t n+1 The differential term of pressure with respect to time is constantly corrected. and For the (j+1)th pipe, t n+1 The time-dependent derivative of the estimated flow rate at the input and output terminals.
[0087] Step 4: Based on the spatially discretized expressions for the prediction and correction layers, establish the corresponding state-space equations:
[0088]
[0089]
[0090] In the formula, X is the state variable. To predict the state variables of the layer, To predict the nonlinear variables of the layer, To predict the time derivative of the layer state variables, To correct the state variables of the correction layer, To correct the nonlinear variables of the correction layer, For the time-dependent differential terms of the state variables of the correction layer, matrices A0 and B0 are the linear and nonlinear parameter matrices of the state equation of the prediction layer, respectively, and matrices A1 and B1 are the linear and nonlinear parameter matrices of the state equation of the correction layer, respectively.
[0091] Step 5: Set the initial time of the simulation calculation t0 = 0, set the initial simulation value X0, and set the simulation time step Δt, which in the GPU (graphics processing unit) are A0, A1, B0, B1, and... Matrix allocation of memory space, obtaining the state-space linear parameter matrices A0 and A1 of the prediction layer and the calibration layer, as well as the state-space nonlinear matrices B0 and B1 of the prediction layer and the calibration layer, and solving for the matrix. Matrix, start simulation calculation. For this embodiment, other system parameters are shown in Table 2, and the initial simulation values are shown in Table 3.
[0092] Table 2 Other parameters
[0093] Spatial step 50 meters Time step 0.12 seconds Gas source node pressure 0.4 MPa Natural gas density 0.717 kg / m³
[0094] Table 3 Initial Simulation Values
[0095]
[0096]
[0097]
[0098] Step 6: Based on the current time t n Time state variable X n Calculate t n nonlinear variable Y at time step n By combining the MacCormack method and the explicit exponential Euler algorithm, t is obtained. n+1 State variables of the prediction and correction layers at specific times Among them, t n For the nth solution, t satisfies n =n·Δt, state variable The specific definition is as follows:
[0099]
[0100]
[0101]
[0102]
[0103] In the formula, Indicates the prediction layer and the correction layer Family functions For t n+1 Nonlinear variables in the prediction layer at time intervals, For node i, t n The nodal pressure at time _____. and Pipe No. j and t respectively n Input port traffic and output port traffic at any given time. and Pipe No. j and t respectively n The input port node pressure and the output port node pressure at time t. Family functions The calculation form is:
[0104]
[0105] In the formula, E is the identity matrix.
[0106] Step 7: Based on the natural gas pipeline network parameters, combined with t n+1 Time prediction layer and correction layer state variables Get t n+1 State variables at time:
[0107]
[0108] Step 8: End the simulation calculation for this time step and update t. n+1 =t n +Δt, the simulation advances by one step, if t n+1 Less than the simulation end time T end Proceed to the next step; otherwise, the simulation ends.
[0109] Step 9: Determine whether the pipeline system's network structure has changed due to a fault or valve disconnection. If so, update A0, A1, B0, B1, and... If the matrix is empty, then skip to step 6; otherwise, skip directly to step 6.
[0110] This invention was performed under the following simulation environment: the computer hardware environment for the simulation calculation was a 12th Gen Intel(R) Core(TM) i7-12700H CPU@2.30GHz, and the graphics processor used was an NVIDIA GeForce RTX3060 Laptop GPU; the software environment was the Windows 10 operating system.
[0111] The simulation results (E) obtained by the above method are compared with the simulation results (C) obtained by the characteristic line dynamic simulation method, and the solution speed is compared with that of the traditional serial implicit solution method, the characteristic line method and the divide-and-conquer parallel algorithm.
[0112] Table 4 compares the computational speed of different solution methods for different scale examples. The smaller the spatial step size, the more infinitesimal pipelines, and the larger the example size, the larger the matrix to be solved. As can be seen from the table, the solution speed of the method proposed in this invention is faster than both serial solving and the characteristic line method in large-scale examples. The acceleration effect of the proposed method becomes more significant as the solution scale increases, demonstrating the significant advantage of applying parallel algorithms to large-scale natural gas pipeline network examples.
[0113] Table 4 Comparison of computation speeds for different solution methods
[0114]
[0115]
[0116] Figure 4 , 5 The steady-state flow rate and pressure results were compared (the simulation curves obtained by this invention are represented by the E curve, and the simulation curves obtained by the characteristic line method are represented by the C curve). As can be seen from the figures, compared with the characteristic line dynamic simulation method, the graphics processor parallel computing method proposed in this invention improves computational efficiency while ensuring solution accuracy; the steady-state curves of pipeline flow rate and node pressure are in excellent agreement.
[0117] Figure 6 , 7 The changes in pipeline flow rate and node pressure under dynamic load disturbances were compared (the simulation curves obtained by this invention are represented by the E curve, and the simulation curves obtained by the method of characteristics are represented by the C curve). As can be seen from the figure, when the load at node 22 of the gas network decreases from 0.161 kg / s to 0.06 kg / s, the consistency of the changes in pipeline state variables is good, verifying the simulation accuracy of the method described in this invention under dynamic load disturbances.
[0118] Figure 8 , 9The changes in pipeline flow rate and node pressure under dynamic conditions of gas source disturbance were compared (the simulation curves obtained by this invention are represented by the E curve, and the simulation curves obtained by the method of characteristics are represented by the C curve). As can be seen from the figure, when the pressure of gas source 1 decreases from 0.4 MPa to 0.39 MPa, the waveform errors of the output flow rates of pipeline 1 and 27, as well as the pressures of nodes 2 and 24, are very small, verifying the simulation accuracy of the method described in this invention under dynamic conditions of gas source disturbance.
[0119] The above-mentioned numerical test results demonstrate that the graphical processor parallel computing method for dynamic simulation of natural gas pipeline networks proposed in this invention has good feasibility and applicability, improves the solution speed of dynamic simulation of natural gas pipeline networks, and provides a good solution for realizing rapid dynamic simulation of large-scale natural gas pipeline networks.
[0120] It should be emphasized that the embodiments described in this invention are illustrative rather than limiting. Therefore, this invention includes, but is not limited to, the embodiments described in the specific implementation. Any other implementations derived by those skilled in the art based on the technical solutions of this invention are also within the scope of protection of this invention.
Claims
1. A parallel computing method using a graphics processor for dynamic simulation of natural gas pipeline networks, characterized in that: Includes the following steps: Step 1: Determine the structure and parameters of the natural gas pipeline network to be simulated; Step 2: Based on the first-order partial differential equations for gas transmission in the pipeline, establish a unified form of equations for each infinitesimal pipeline segment. Step 3: Use the MacCormack method to spatially discretize the unified form equations to generate the expressions for the prediction layer and the correction layer; Step 4: Based on the spatially discretized expressions of the prediction layer and the correction layer, establish the corresponding state-space equations respectively; Step 5: Set the initial time for simulation calculation Set initial simulation values Set the simulation time step In graphics processors , , , and Matrix allocation of video memory space, obtaining the state-space linear parameter matrices of the prediction and correction layers. , and the state-space nonlinear matrices of the prediction and correction layers. , Calculation and solution Matrix, start simulation calculation; Step 6: Based on the current time Time state variables ,calculate Nonlinear variables at time By combining the MacCormack method and the explicit exponential Euler algorithm, we obtain... State variables of the prediction and correction layers at different times , ,in, For the first At the time of the solution, it satisfies ; Step 7: Based on the natural gas pipeline network parameters, combined with... Time prediction layer and correction layer state variables , ,get State variables at time: Step 8: End the simulation calculation for this time step and update. The simulation advances by one step, if Less than the simulation end time Proceed to the next step; otherwise, the simulation ends. Step 9: Determine whether the pipeline system structure has changed due to faults or valve interruptions. If so, update the system. , , , and If the matrix is correct, then skip to step 6; otherwise, skip directly to step 6. The unified equation established in step 2 for each infinitesimal pipe segment is as follows: in, In the formula, The pressure at the node of the micro-element pipeline. For the flow rate of the micro-element pipe, The cross-sectional area of the pipe. The velocity of sound inside the pipe. The coefficient of friction of the pipeline. For pipe diameter, This is the average flow rate of the current micro-element pipe segment and the flow rate of the next micro-element pipe segment. This is the average pressure of the node pressure in this micro-element pipeline segment and the node pressure in the previous pipeline segment. Let be the vector to be solved. This is the pipeline coefficient matrix. For pipeline coefficient vectors, For time, For spatial length; In step 3, the pressure difference of the prediction layer is calculated using backward differential, and the flow rate difference is calculated using forward differential; the pressure difference of the correction layer is calculated using forward differential, and the flow rate difference is calculated using backward differential. The specific calculation method for step 6 is as follows: In the formula, Indicates the prediction layer and the correction layer Family functions for Nonlinear variables in the prediction layer at time intervals, for Node No. The nodal pressure at time _____. They are respectively Pipeline No. Input port traffic and output port traffic at any given time. and They are respectively Pipeline No. The input port node pressure and the output port node pressure at time t. Family functions The calculation form is: In the formula, It is an identity matrix.
2. The parallel computing method for graphics processors for dynamic simulation of natural gas pipeline networks according to claim 1, characterized in that: The structure and parameters of the natural gas pipeline network to be simulated include the number of micro-pipes, the number of nodes, and the starting node, ending node, length, pipe sound velocity, pipe diameter, and pipe friction coefficient of each micro-pipe.
3. The parallel computing method for graphics processors for dynamic simulation of natural gas pipeline networks according to claim 1, characterized in that: The state-space equation established in step 4 is as follows: In the formula, For state variables, To predict the state variables of the layer, To predict the nonlinear variables of the layer, To predict the time derivative of the layer state variables, To correct the state variables of the correction layer, To correct the nonlinear variables of the correction layer, To correct the time derivative of the state variables at the correction layer, the matrix... and These are the linear and nonlinear parameter matrices of the predicted layer state equations, respectively. and These are the linear and nonlinear parameter matrices of the state equation of the correction layer, respectively.
Citation Information
Patent Citations
Natural gas pipeline network hydraulic parameter simulation method based on GPU acceleration
CN110826188A
Semiconductor thermal simulation method based on efficiently solving phonon Boltzmann transport equation
CN114297895A
