Hydrogen-doped natural gas pipeline component tracking simulation calculation method based on fno
Patent Information
- Application Number
- CN202311068272.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-23
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2043-08-23
AI Technical Summary
另外,由于采用通过大量离散点的变化来近似系统的变化过程,还存在以下缺点:一方面对于大型管道系统,计算量巨大;另一方面在仿真动态过程时,其采用迭代方式来一次次的仿真所有离散点随时间的变化过程,计算耗时,所以需要基于FNO的掺氢天然气管道组分追踪仿真计算方法来解决以上问题
[0035]1、本发明可直接通过神经网络的前向传播,一次性计算所有管道任意位置、任意时刻的值,大大提高了计算效率。
Smart Images

Figure CN117313515B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of pipeline gas component tracking technology, and in particular to a simulation calculation method for tracking hydrogen-blended natural gas pipeline components based on FNO. Background Technology
[0002] Accurately monitoring fluctuations in the calorific value and other quality parameters of natural gas in pipelines is crucial for natural gas transportation and trade. When hydrogen is added to natural gas during transportation, its calorific value changes significantly. Calorific value measurement methods are divided into direct and indirect methods. Direct measurement uses gas chromatography to measure the calorific value of the gas inside the pipeline. However, gas chromatography equipment is relatively expensive and not every station is equipped with it. Indirect measurement, on the other hand, involves tracking the composition of the natural gas and then calculating the calorific value using appropriate formulas. Therefore, changes in calorific value can be tracked by monitoring the composition of the gas inside the natural gas pipeline.
[0003] Early research by Maciej Chaczykowski et al. proposed two different methods for tracking gas components in pipelines: one was to solve the component transport equations in Eulerian coordinates, and the other was a batch tracking method based on Lagrange coordinates. Compared to the first method, more researchers have adopted the method of solving the transport equations for component tracking. The gas component transport equations inside pipelines are generally described by convection-diffusion equations, and in actual pipelines, the diffusion term is often simplified. The complex boundary conditions and initial conditions that may exist mean that the convection-diffusion equations have almost no analytical solutions except for a few specific scenarios. Maciej Chaczykowski et al. used an implicit method to discretize the component transport equations, and then solved the discretized nonlinear equations using the Jacobian matrix iterative method. Di Fan et al. used an implicit method to discretize the component transport equations. Alfredo Bermúdez et al. used the method of characteristics to solve the component transport equations. Sleiman Mhanna et al. solved the component transport equations using a fully implicit difference method. Maciej Chaczykowski et al. used an implicit difference method to discretize the component transport equations, and then solved them using the Newton-Raphson method. The above method of solving the component equations time-by-time to advance the calculation of component concentrations at different time layers is relatively slow.
[0004] In recent years, machine learning has been widely used in the natural gas field, such as using neural networks to predict natural gas parameters like composition, compressibility factor, and sound velocity. Deep learning has also recently been used to solve partial differential equations (PDEs). PINN, in particular, incorporates PDEs representing physical laws into loss calculations, which has led to its widespread adoption. However, PINN models are generally trained for physical problems with specific boundaries and initial values. Once the boundary conditions and initial values of the problem change, the previously trained model becomes unusable. Natural gas pipeline composition tracking problems have complex and diverse initial conditions and boundary values, resulting in poor generalization of PINN composition tracking models built on specific boundaries and initial values.
[0005] A new neural network architecture with an operator learning paradigm has recently been proposed, capable of learning mappings between infinite-dimensional function spaces from finite datasets. Among these, the Fourier Neural Operator (FNO) stands out as a high-performing operator for solving partial differential equations. By learning parameters in both the frequency and time domains, it can better learn the solution operators for partial differential equations, and it is grid-independent, meaning that different grid resolutions can be used without significantly affecting its performance. The Fourier Neural Operator architecture has been successfully applied to research in various fields, such as seismic wave modeling, fiber optic channel modeling, and carbon dioxide formation storage.
[0006] However, existing technical solutions rely on traditional fundamental differential equations for solving. The solution process first requires partitioning the computational region, using non-intersecting line segments of appropriate length to completely cover the original pipeline or pipe network, thus obtaining a discrete mesh. Secondly, different discretization methods are used to discretize the differential equations on the partitioned mesh. Thirdly, different solution algorithms are employed to solve the discrete equations obtained in the previous step. Only through these steps can the changes in gas composition within the pipeline be obtained. Furthermore, approximating the system's changes through the changes of a large number of discrete points has the following drawbacks: firstly, the computational load is enormous for large pipeline systems; secondly, in simulating dynamic processes, iterative methods are used to simulate the changes of all discrete points over time, resulting in time-consuming calculations. Therefore, a simulation method based on FNO for tracking the composition of hydrogen-blended natural gas pipelines is needed to address these issues. Summary of the Invention
[0007] The purpose of this invention is to propose a simulation calculation method for component tracking in hydrogen-blended natural gas pipelines based on FNO, comprising the following steps:
[0008] Step 1: Analyze the factors affecting component changes and determine the boundary conditions based on the mathematical model for tracking the components of hydrogen-blended natural gas pipelines;
[0009] Step 2: Construct a Fourier neural network for component tracking, consisting of an input layer a, a lifting layer P, n Fourier layers, a projection layer Q, and an output layer v.
[0010] Step 3: Select the activation function and trainer;
[0011] Step 4: Prepare training data;
[0012] Step 5: Select a loss function to train the established Fourier neural network model.
[0013] The mathematical model for tracking the components of hydrogen-blended natural gas pipelines in step 1 is as follows:
[0014]
[0015] In the formula c i ,i=1,2,…,n represents the concentration vector of the component to be tracked, n represents the total number; u represents the flow rate of natural gas; D represents the diffusion coefficient of the component; x represents the location coordinate; t represents time.
[0016] Step 2 specifically includes the following sub-steps:
[0017] Step 21: Set u, D, c for input layer a i0 B i There are a total of 6 neurons in x and t, B i Given the change in component concentration at the starting position over time, and setting the sampling numbers for x and t to m and n respectively, the output data will be in the form of (m, n, 6).
[0018] Step 22: Generalize the output data through an enhancement layer P, set the dimension for tracking hydrogen-blended natural gas components, and fully connect it to the output layer;
[0019] Step 23: In the Fourier layer, the data output from the lifting layer P is processed differently through two paths, and finally merged at the output.
[0020] Step 24: Process the data output from the Fourier layer through the projection layer Q, and set the neurons to be fully connected to the Fourier layer;
[0021] Step 25: Set the output layer to a single neuron to represent the concentration gradation at the next n time steps.
[0022] The activation function in step 3 is as follows:
[0023]
[0024] Here, z represents any input variable, i.e., the independent variable of the activation function.
[0025] The trainer in step 3 is the Adam trainer.
[0026] Step 4 specifically includes the following sub-steps:
[0027] Step 41: Generate initial values c for the different component concentrations of hydrogen-doped natural gas using a Gaussian random field. i0 ;
[0028] Step 42: Generate boundary variation B for different component concentrations using a random function. i ;
[0029] Step 43: Generate fluid velocity u at different times and locations using Gaussian random field, and interpolate the velocity at the boundary in the time direction using cubic spline interpolation method;
[0030] Step 44: Simulate the component concentration values at all times and locations using simulation software, and organize the data according to step 21.
[0031] The loss function in step 5 is as follows:
[0032]
[0033] In the formula: x i G represents the input of the neural network; G represents the neural network; G(x) i ) represents the output of the neural network, i.e., the predicted value; y i Represents the actual value.
[0034] The beneficial effects of this invention are as follows:
[0035] 1. This invention can directly calculate the values of all pipes at any position and at any time through the forward propagation of a neural network, which greatly improves the calculation efficiency.
[0036] 2. This invention utilizes the "black box" characteristic of neural networks, eliminating the need for differential equations, discrete schemes, and solution algorithms. It directly performs calculations based on data, greatly simplifying the simulation complexity.
[0037] 3. This invention can be used not only for component tracking in natural gas pipelines, but also for simulation of transportation processes with arbitrary variables. Attached Figure Description
[0038] Figure 1 This is a flowchart of the simulation calculation method for hydrogen-blended natural gas pipeline components based on FNO, as described in this invention.
[0039] Figure 2 This is a diagram of the neural network architecture of the Fourier operator;
[0040] Figure 3 A diagram of the neural network model designed for this invention;
[0041] Figure 4 The initial value curves for the two analytical solutions are shown.
[0042] Figure 5 Both (a) and (b) are comparison graphs of the values of the two types of analytical solutions with the model and numerical solutions at time T = 1s;
[0043] Figure 6 (a) and (b) are both comparison graphs of the values of the two types of analytical solutions with the model and numerical solutions at time T = 5s;
[0044] Figure 7 Both (a) and (b) are comparison graphs of the values of the two types of analytical solutions with the model and numerical solutions at time T = 9s. Detailed Implementation
[0045] This invention proposes a simulation calculation method for tracking the components of hydrogen-blended natural gas pipelines based on FNO. The invention will be further described below with reference to the accompanying drawings and specific embodiments.
[0046] Figure 1 This is a flowchart of the simulation calculation method for hydrogen-blended natural gas pipeline component tracking based on FNO according to the present invention; the specific scheme is as follows:
[0047] Step 1: Analyze the factors affecting component changes and determine the boundary conditions based on the component tracking differential equation. The following equation gives the mathematical model, i.e., the differential equation, for component tracking in hydrogen-blended natural gas pipelines.
[0048]
[0049] In the formula c i Let i = 1, 2, ..., n represent the component concentration vectors to be tracked, and n represent the total number of components; u represent the natural gas flow rate; D represent the diffusion coefficient of the component; x represent the location coordinates; and t represent time. According to the above formula, when the initial time t0 is determined, the component concentration c at all locations... i0 The fluid velocity u(x,t) at all times and locations, the diffusion coefficient D, and the change of component concentration at the initial location over time also need to be determined. i Only then can the distribution of component concentrations at all times and locations be obtained.
[0050] Step 2: Establish a Fourier Neural Network (FNO) for component tracking, see... Figure 2 As shown, the neural network consists of an input layer a, a lifting layer P, and n Fourier layers FL. (i) The i = 1, 2, ..., n layer consists of a projection layer Q and an output layer v.
[0051] 1) First, the input layer a consists of u, D, c i0 Bi The x and t groups consist of a total of 6 neurons, see [link / reference]. Figure 3 As shown, assuming that the number of samples for x and t are m and n respectively, the output data can be divided into data in the form of (m, n, 6).
[0052] 2) Next, the output data is generalized through an enhancement layer P. For tracking hydrogen-blended natural gas components, its dimension is set to 36 and fully connected to the output layer. At this time, the data dimension becomes (m,n,36).
[0053] 3) Next is the Fourier layer. In the Fourier layer, the data output from the lifting layer undergoes different processing through two paths, and is finally merged at the output, such as... Figure 1 As shown, the specific processing procedure is as follows:
[0054] I) For the first path, first perform a two-dimensional Fourier transform on the first two dimensions, as shown in the following equation.
[0055]
[0056] After the above transformation, we can obtain data with dimensions (m, n / 2 + 1, 36), which is u, D, c i0 B i The variation patterns of variables x, t, and t are represented by the amplitude values when using a sine function. To enhance generalization ability, the obtained amplitude values need to be filtered, retaining the first modes components. For natural gas component tracking, 30 is selected in the x-dimensional and 10 in the t-dimensional. The selected components are then multiplied by a weighting coefficient W1, which is a variable used to obtain the optimal value through model training. In the above Fourier transform, the transformed values are symmetrical in the x-dimensional, but only half is retained in the t-dimensional, thus requiring further processing of the x-dimensional data. This invention proposes multiplying the first modes components and the last modes components by different weighting coefficients, namely W1f and W1b, to reflect differentiation. Finally, the components multiplied by the weighting coefficients are subjected to an inverse Fourier transform, as shown in the following equation.
[0057]
[0058] After the above transformation, the data dimension becomes (m,n,36) again.
[0059] II) For the second path, the original data is directly multiplied by the weight coefficient W2 and then merged with the data from the first path.
[0060] After tracing the two paths above, the data dimension becomes (m, n, 36). For tracking hydrogen-blended natural gas components, the number of Fourier layers is typically set to 4, such as... Figure 1 As shown, four Fourier layers are stacked.
[0061] 4) The data output from the Fourier layer also needs to be processed through the projection layer Q. For natural gas component tracking, it is usually set to 128 neurons and fully connected to the Fourier layer. At this time, the output data dimension is (m,n,128).
[0062] 5) Finally, there is the output layer, which is a single neuron, representing the concentration gradation at the next n time steps. The output data dimension is (m, n, 1).
[0063] Step 3: Selection of activation function and trainer.
[0064] Different activation functions affect the accuracy of the final result. In existing technologies, the ReLU activation function is commonly used, but it is not suitable for tracking hydrogen-doped natural gas components. Therefore, the GELU activation function is selected, as shown in the following equation.
[0065]
[0066] For the trainer, this invention selects the Adam trainer with a decay factor of 0.0001. The learning rate is a variable that changes over the training process, with an initial learning rate of 0.01. Every 15 rounds, the learning rate decreases by 0.05, meaning it becomes 95% of its previous value.
[0067] Step 4: Prepare training data.
[0068] First, Gaussian random fields are used to generate initial values c for the different component concentrations of the hydrogen-doped natural gas. i0 ;
[0069] Secondly, the boundary variation of different component concentrations (B) is generated using a random function. i ;
[0070] Next, Gaussian random fields are used to generate fluid velocities u at different times and locations, and cubic spline interpolation is used to interpolate the velocities at the boundary in the time direction to obtain a smooth boundary change.
[0071] Finally, using the above conditions, the component concentration values at all times and locations are obtained by simulation software, and the data is organized according to step 2, 1).
[0072] Step 5: Select a loss function.
[0073] The general loss function is the error, i.e., equation (5). However, this loss function is not applicable to the tracking of hydrogen-blended natural gas components. Equation (6) is selected, called RRMSE, as the loss function to train the established model.
[0074]
[0075]
[0076] In the formula: x i G represents the input of the neural network; G represents the neural network; G(x) i ) represents the output of the neural network, i.e., the predicted value; y i Represents the actual value.
[0077] Taking a 10m long pipeline as an example, assume the pipeline initially contains only methane gas and operates stably. At a certain moment, hydrogen gas is added to the inlet, resulting in two possible changes, the process of which is as follows: Figure 4 As shown.
[0078] Figure 5 (a)(b) Figure 6 (a)(b) Figure 7 (a) and (b) are comparison graphs of the values of the two types of analytical solutions with the model and numerical solutions at times T=1s, T=5s, and T=9s, respectively; it can be seen from the graphs that the present invention can track pipeline components.
[0079] This invention proposes a novel simulation calculation method that abandons the fundamental logic of existing technical solutions and adopts a "black box" model to simplify the calculation process of existing technical solutions. While ensuring calculation accuracy, it simplifies computational complexity and improves computational efficiency.
Claims
1. A simulation calculation method for component tracking in hydrogen-blended natural gas pipelines based on FNO, characterized in that, Includes the following steps: Step 1: Analyze the factors affecting component changes and determine the boundary conditions based on the mathematical model for tracking the components of hydrogen-blended natural gas pipelines; The mathematical model for tracking the components of hydrogen-blended natural gas pipelines in step 1 is as follows: ; In the formula Represents the vector of component concentrations to be tracked. where n represents the total number; Indicates the flow rate of natural gas; Indicates the diffusion coefficient of the component; Indicates position coordinates; Indicates time; Step 2: Construct a Fourier neural network for component tracking, consisting of an input layer a, a lifting layer P, n Fourier layers, a projection layer Q, and an output layer v. Step 2 specifically includes the following sub-steps: Step 21: Setting up input layer a A total of 6 neurons, This describes the change in component concentration over time at the starting position, and sets... , If the number of samples are m and n respectively, then the output data is Data in the form of; Step 22: Process the output data through an uplift layer P, set the dimension for tracking hydrogen-blended natural gas components, and fully connect it to the output layer; Step 23: In the Fourier layer, the data output from the lifting layer P is processed differently through two paths, and finally merged at the output. Step 24: Process the data output from the Fourier layer through the projection layer Q, and set the neurons to be fully connected to the Fourier layer; Step 25: Set the output layer to a single neuron to represent the concentration gradation at the next n time steps; Step 3: Select the activation function and trainer; Step 4: Prepare training data; Step 4 specifically includes the following sub-steps: Step 41: Generate initial values for the concentrations of different components in hydrogen-doped natural gas using a Gaussian random field. ; Step 42: Generate boundary variations for different component concentrations using a random function. ; Step 43: Generate fluid velocities at different times and locations using a Gaussian random field. Furthermore, the velocity at the boundary is interpolated in the time direction using cubic spline interpolation. Step 44: Simulate the component concentration values at all times and locations using simulation software, and organize the data according to Step 21; Step 5: Select a loss function to train the established Fourier neural network model.
2. The simulation calculation method for hydrogen-blended natural gas pipeline component tracking based on FNO according to claim 1, characterized in that, The activation function in step 3 is as follows: ; Here, z represents any input variable, i.e., the independent variable of the activation function.
3. The simulation calculation method for hydrogen-blended natural gas pipeline composition tracking based on FNO according to claim 1 or 2, characterized in that, The trainer in step 3 is the Adam trainer.
4. The simulation calculation method for hydrogen-blended natural gas pipeline component tracking based on FNO according to claim 1, characterized in that, The loss function in step 5 is as follows: , In the formula: x i G represents the input to the neural network; G represents the neural network; G(x) i ) represents the output of the neural network, i.e., the predicted value; y i Represents the actual value.