Dimensionality reduction prediction method and system for gas pipeline leakage based on improved lattice Boltzmann
By improving the lattice Boltzmann method and the variational autoencoder + iTransformer model, real-time prediction of gas pipeline leakage is solved, and the problems of low computational efficiency and high-dimensional flow field complexity in the existing technology are achieved, and high efficiency is achieved. Accurate leak prediction.
Patent Information
- Application Number
- CN202411604916.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-11-12
AI Technical Summary
In the real-time deduction prediction of gas pipeline leakage accidents, the calculation efficiency is low, the data set generation time is long, and the high-dimensional three-dimensional flow field increases the computational complexity and difficulty in convergence of machine learning models.
The improved lattice Boltzmann method is used to simulate leakage of gas pipelines, generate flow field simulation data, and build a flow field prediction model through a variational autoencoder and iTransformer to train and predict to reduce computational complexity and improve Predictive efficiency.
It improves the computing efficiency, reduces the data set generation time, enhances the three-dimensional flow field data generation capability of gas pipeline leakage scenarios, and improves the efficiency and accuracy of leakage prediction.
Smart Images

Figure CN119129436B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of emergency treatment technology, and in particular to a dimensionality reduction prediction method and system for gas pipeline leakage based on improved lattice Boltzmann. Background Art
[0002] With the continuous advancement of urbanization, gas pipelines are widely used in various scenarios. However, since the gas medium they transport is flammable and explosive, once a gas pipeline leakage accident occurs, it often brings serious safety hazards. Therefore, real-time simulation and prediction of gas pipeline leakage accidents has become an important technical requirement to ensure urban public safety.
[0003] In the problem of flow field prediction, machine learning technology has gradually become one of the main research directions due to its powerful pattern recognition and data processing capabilities. However, the training of machine learning models usually requires a large amount of high-quality data. Traditional computational fluid dynamics methods such as the finite volume method and finite element method based on GPU have low computational efficiency and require a lot of time to generate data sets.
[0004] In addition, the high-dimensional characteristics of the three-dimensional flow field in practical applications not only increase the computational complexity of the machine learning model in the flow field prediction process, but also make it difficult for the machine learning model to converge during the training process, which greatly affects the prediction accuracy and stability of the machine learning model.
[0005] Therefore, there is an urgent need to provide a technical solution to the above-mentioned deficiencies in the prior art. Summary of the invention
[0006] The purpose of this application is to provide a gas pipeline leakage dimensionality reduction prediction method and system based on improved lattice Boltzmann to solve or alleviate the problems existing in the above-mentioned prior art.
[0007] In order to achieve the above objectives, this application provides the following technical solutions:
[0008] The present application provides a dimensionality reduction prediction method for gas pipeline leakage based on improved lattice Boltzmann, comprising: step S101, simulating the leakage of a gas pipeline based on the improved lattice Boltzmann method to obtain flow field simulation data of the gas pipeline leakage; step S102, constructing a flow field prediction model for the gas pipeline leakage for training, and predicting the methane concentration field when the gas pipeline leaks based on the trained flow field prediction model according to a uniformly discrete time series matrix of methane concentration when the gas pipeline leaks.
[0009] Preferably, the flow field simulation data includes: gas mixing velocity and methane concentration; step S101 includes: based on the pre-constructed velocity grid particle distribution function and scalar network particle distribution function, respectively, simulating the leakage of the gas pipeline, and adjusting the relaxation time of the velocity grid and the relaxation time of the scalar grid during the gas pipeline leakage simulation by a grid relaxation algorithm, respectively, to determine the gas mixing velocity and the methane concentration in the target area corresponding to the leakage hole when the gas pipeline leaks.
[0010] Preferably, in response to the velocity grid particle distribution function, the leakage simulation of the gas pipeline is performed according to the formula:
[0011]
[0012] Calculate the gas mixing velocity in the target area; where, for At the grid position in the target area at the moment Gas mixing velocity at for At the grid position in the target area at the moment Discrete direction Particle density on the velocity grid; for At the grid position in the target area at the moment The gas mixture density at ; for At the grid position in the target area at the moment Discrete direction Gas particle velocity on the velocity grid.
[0013] Preferably, based on a pre-built collision model:
[0014]
[0015] Particle density on the velocity grid Perform iterative updates;
[0016] In the formula, for At the grid position in the target area at the moment Discrete direction Particle density on the velocity grid; for At the grid position in the target area at the moment Discrete direction Gas particle velocity on the velocity grid; is the time step for simulating leakage of the gas pipeline; for At the grid position in the target area at the moment The gas mixture density at ;
[0017] for At the grid position in the target area at the moment Discrete direction Particle density on the velocity grid; is the velocity grid-based particle distribution function a relaxation time of a velocity network when performing a leakage simulation on the gas pipeline; is an intermediate variable; Gauss-Hermi orthogonal weights; is the lattice sound speed, which is a constant; for At the grid position in the target area at the moment Gas mixing velocity at is the intermediate variable, is the air density, is the methane concentration expansion coefficient, for At the grid position in the target area at the moment The methane concentration at is the methane background concentration in the target area, which is a constant; is the acceleration due to gravity.
[0018] Preferably, in response to the scalar grid particle distribution function, the gas pipeline is subjected to leakage simulation according to the formula:
[0019]
[0020] Calculate the methane concentration in the target area; where, for At the grid position in the target area at the moment methane concentration at for At the grid position in the target area at the moment Discrete direction Scalar mesh particle density on .
[0021] Preferably, the scalar transport model for leakage simulation of the gas pipeline constructed in advance is:
[0022]
[0023] The scalar grid particle density Perform iterative updates;
[0024] In the formula, for At the grid position in the target area at the moment Discrete direction Scalar grid particle density on ; for At the grid position in the target area at the moment Discrete direction Scalar grid gas particle velocity on ; is the time step for simulating leakage of the gas pipeline; is the relaxation time of the scalar grid when the leakage simulation of the gas pipeline is performed based on the scalar grid particle distribution function; is the intermediate variable, Discrete direction The Gauss-Hermi orthogonal weights, for At the grid position in the target area at the moment methane concentration at for At the grid position in the target area at the moment Gas mixing velocity at is the lattice sound speed, which is a constant.
[0025] Preferably, according to the formula:
[0026]
[0027] The relaxation time of the velocity network when simulating the leakage of the gas pipeline based on the velocity grid particle distribution function Correction is made, and the relaxation time of the scalar grid when the gas pipeline is simulated for leakage based on the scalar grid particle distribution function is corrected. make corrections;
[0028] In the formula, is the dimensionless kinematic viscosity of air, is a constant, is the grid width, are the grid positions in the target area respectively Any two tensor directions at ;
[0029] is the intermediate variable, for At the grid position in the target area at the moment The gas mixture density at is the preset initial value of relaxation time, is the lattice sound speed, which is a constant; is the grid position in the target area In discrete directions The unit vector on and in the tensor direction The unit vector on The product of is the grid position in the target area In discrete directions The unit vector on and in the tensor direction The unit vector on The product of for At the grid position in the target area at the moment Discrete direction Particle density on the velocity grid; is the intermediate variable, is the dimensionless diffusion coefficient of methane when the gas pipeline leaks, is the turbulent Schmidt number.
[0030] Preferably, in step S102, based on the flow field prediction model The encoder of the variational autoencoder is a time series matrix of methane concentration when the gas pipeline leaks Perform dimensionality reduction processing to generate the time series latent space vector of the methane concentration field when the gas pipeline leaks ; Wherein, the methane concentration time series matrix ; When the gas pipeline leaks The time series matrix of methane concentration that is uniformly discrete at each moment; , When the gas pipeline leaks The temporal latent space vector of the methane concentration field at the moment; , is a positive integer;
[0031] The temporal latent space vector of the methane concentration field when the gas pipeline leaks Input the iTransformer of the flow field prediction model and transform the temporal latent space vector Encoded as an embedding vector , in order to predict the future time when the gas pipeline leaks The temporal latent space vector of the methane concentration field Make predictions; among them, ;
[0032] Through the flow field prediction model The decoder of the variational autoencoder converts the future time when the gas pipeline leaks The temporal latent space vector of the methane concentration field Restore to the future time when the gas pipeline leaks The uniformly discrete methane concentration time series matrix .
[0033] The embodiment of the present application also provides a gas pipeline leakage dimensionality reduction prediction system based on improved lattice Boltzmann, including: a simulation unit, configured to simulate the gas pipeline leakage based on the improved lattice Boltzmann method to obtain flow field simulation data of the gas pipeline leakage; a flow field prediction unit, configured to construct a flow field prediction model of the gas pipeline leakage for training, and predict the methane concentration field of the gas pipeline leakage based on the trained flow field prediction model according to the uniformly discrete methane concentration time series matrix when the gas pipeline leaks.
[0034] Beneficial effects:
[0035] In the dimensionality reduction prediction method for gas pipeline leakage based on improved lattice Boltzmann provided in the embodiment of the present application, first, based on the improved lattice Boltzmann method, leakage simulation of gas pipeline leakage is performed to obtain flow field simulation data of gas pipeline leakage, so as to efficiently generate three-dimensional flow field data of gas pipeline leakage scene, and train the pre-constructed flow field prediction model of gas pipeline leakage; then, according to the uniformly discrete methane concentration time series matrix when the gas pipeline leaks, based on the trained flow field prediction model, the methane concentration field when the gas pipeline leaks is predicted. Thus, leakage simulation of gas pipeline leakage is performed by using the improved lattice Boltzmann method, so as to efficiently generate three-dimensional flow field data of gas pipeline leakage scene to train the flow field prediction model, improve the computational efficiency, and greatly reduce the time consumed in generating the model training data set; and the trained flow field prediction model is used to realize the real-time and forward prediction of gas pipeline leakage scene, greatly improve the efficiency and accuracy of leakage prediction in gas pipeline accident scene, and provide technical support for rapid response and management of sudden accidents such as gas pipeline leakage. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. Among them:
[0037] Figure 1 A schematic flow chart of a gas pipeline leakage dimensionality reduction prediction method based on improved lattice Boltzmann according to some embodiments of the present application;
[0038] Figure 2 A schematic diagram of the principle of a gas pipeline leakage dimensionality reduction prediction method based on an improved lattice Boltzmann method according to some embodiments of the present application;
[0039] Figure 3 A prediction logic diagram of a methane concentration field in a gas pipeline leakage scenario provided according to some embodiments of the present application;
[0040] Figure 4 According to some embodiments of the present application, Schematic diagram of the structure of the variational autoencoder;
[0041] Figure 5 A schematic diagram of the structure of iTransformer provided according to some embodiments of the present application;
[0042] Figure 6 A schematic diagram of the structure of a gas pipeline leakage dimensionality reduction prediction system based on improved lattice Boltzmann according to some embodiments of the present application. DETAILED DESCRIPTION
[0043] The present application will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments. Each example is provided by way of explanation of the present application and does not limit the present application. In fact, it will be clear to those skilled in the art that modifications and variations may be made in the present application without departing from the scope or spirit of the present application. For example, a feature shown or described as a part of an embodiment may be used in another embodiment to produce yet another embodiment. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the embodiments of the present invention should belong to the scope of protection of the embodiments of the present invention.
[0044] With the advancement of urbanization, gas pipelines are widely used in various scenarios. However, since the gas medium they transport is flammable and explosive, leakage accidents often bring serious safety hazards. Real-time situation prediction for gas pipeline leakage accidents has become an important technical requirement in on-site emergency response. However, in the existing flow field prediction, the data set required for machine learning is generated slowly, which hinders the training process of the machine learning model; and the model is insufficient in capturing the temporal relationship of the flow field, resulting in limited prediction accuracy.
[0045] Based on this, the embodiment of the present application proposes a gas pipeline leakage dimensionality reduction prediction method based on improved lattice Boltzmann, such as Figures 1 to 5 As shown, the method includes:
[0046] Step S101: Perform leakage simulation on the gas pipeline based on the improved lattice Boltzmann method to obtain flow field simulation data of the gas pipeline leakage.
[0047] In this application, when simulating the leakage of a gas pipeline, a lattice Boltzmann program based on GPU acceleration is used for fluid simulation, and the velocity grid and scalar grid of D3Q15 and D3Q9 are used for calculation. The flow field data is simulated by the Smagorinsky turbulence model and the density buoyancy model to improve the simulation accuracy and calculation efficiency of the concentration and velocity distribution in complex leakage scenarios.
[0048] By performing fluid simulation on the gas pipeline leakage scenario at the mesoscopic scale, the simulation process is realized by solving the velocity field and methane concentration field in the gas pipeline leakage area, and the gas mixing velocity and methane concentration in the leakage scenario are obtained. First, the gas pipeline leakage area is divided into multiple grid cells, and the fluid state of each grid cell is described by the pre-constructed velocity grid particle distribution function, and then the gas mixing velocity in the leakage area is calculated. Specifically, based on the pre-constructed velocity grid particle distribution function, the fluid state of each grid cell when simulating the leakage of the gas pipeline is described to simulate the gas pipeline leakage scenario. That is to say, when the grid cell for gas pipeline leakage simulation is described based on the velocity grid particle distribution function, according to the formula:
[0049]
[0050] Calculate the gas mixing velocity in the target area. for Grid position in the target area at all times Gas mixing velocity at for Grid position in the target area at all times Discrete direction Particle density on the velocity grid; for Grid position in the target area at all times The gas mixture density at ; for Grid position in the target area at all times Discrete direction Here, it should be noted that the velocity grid particle density Grid cells in the target area when simulating gas pipeline leakage (i.e. grid position ) Describe the state at the moment.
[0051] During the leakage simulation, the discrete velocity and gas mixture density at each grid cell are transferred and changed by a collision model including external forces to represent the velocity grid particle density at each grid cell. In time step Specifically, based on the pre-built collision model:
[0052]
[0053] Particle density for velocity grid Perform iterative update. In the formula, for Grid position in the target area at all times Discrete direction Particle density on the velocity grid; for Grid position in the target area at all times Discrete direction Gas particle velocity on the velocity grid; is the time step for leakage simulation of gas pipeline.
[0054] for Grid position in the target area at all times Discrete direction Particle density on the velocity grid; is the velocity grid-based particle distribution function Relaxation time of velocity network when simulating leakage in gas pipeline; is an intermediate variable; Discrete direction Gauss-Hermi orthogonal weights; is the lattice sound speed, which is a constant; for Grid position in the target area at all times The gas mixing velocity at .
[0055] It is an intermediate variable that represents the driving force in the leakage simulation process. In the gas pipeline leakage scenario, it is often manifested as the buoyancy generated by the concentration difference between different grid cells. is the air density, is the methane concentration expansion coefficient, for Grid position in the target area at all times The methane concentration at is the methane background concentration in the target area, which is taken as a constant; is the acceleration due to gravity.
[0056] In a specific example, based on the velocity grid particle distribution function, the fluid state of each grid unit is described when simulating the leakage of the gas pipeline. When simulating the gas pipeline leakage scene, the velocity grid particle distribution function is initialized at the beginning of the leakage simulation, that is, the velocity grid particle density of the grid unit is determined. The initial distribution of .in,
[0057]
[0058] in, The grid position in the target area Initial gas mixture density at ; The grid position in the target area The initial gas mixing velocity at . Then, the velocity grid particle density of the grid unit is determined at any time by cyclically iterating the velocity grid particle density of the grid unit.
[0059] The relaxation time determines the grid viscosity of the gas. A relaxation time far away from 0.5 can effectively improve the accuracy and stability of the simulation. For high Reynolds number problems, maintaining a suitable eating time often requires reducing the time step and grid size, resulting in reduced computational efficiency and stability. In this regard, in this application, the relaxation time of the velocity grid during the gas pipeline leakage simulation is adjusted through a grid relaxation algorithm.
[0060] Specifically, according to the formula:
[0061]
[0062] The relaxation time of the velocity network when simulating the leakage of the gas pipeline based on the velocity grid particle distribution function Make corrections.
[0063] In the formula, is the dimensionless kinematic viscosity of air, is a constant, is the grid width, are the grid positions in the target area respectively. Any two tensor directions at ; is the intermediate variable, for Grid position in the target area at all times The gas mixture density at is the preset initial value of relaxation time, is the lattice sound speed, which is a constant; The grid position in the target area In discrete directions The unit vector on and in the tensor direction The unit vector on The product of The grid position in the target area In discrete directions The unit vector on and in the tensor direction The unit vector on The product of for Grid position in the target area at all times Discrete direction Particle density on the velocity grid; is an intermediate variable.
[0064] Here, according to the formula:
[0065]
[0066] Determining the Dimensionless Kinematic Viscosity of Air ; In the formula, is the spatial step size for meshing the three-dimensional model of the gas pipeline. is the time step for leakage simulation of the three-dimensional model of the gas pipeline; is the kinematic viscosity of air, which is a constant.
[0067] In this application, when simulating gas pipeline leakage, the methane concentration in the leakage area is calculated based on the pre-constructed scalar grid particle distribution function, and the grid cells divided into the leakage area (target area) are scalarly calculated. After the gas pipeline leakage area is divided into multiple grid cells, the methane scalar concentration state of each grid cell is described by the scalar grid particle distribution function, and then the methane concentration in the leakage area is calculated.
[0068] Specifically, based on the pre-constructed velocity grid particle distribution function, the methane scalar concentration state of each grid unit during the gas pipeline leakage simulation is described to simulate the gas pipeline leakage scenario. That is, when the grid unit of the gas pipeline leakage simulation is described based on the scalar grid particle distribution function, according to the formula:
[0069]
[0070] Calculate the methane concentration in the target area. for Grid position in the target area at all times methane concentration at for Grid position in the target area at all times Discrete direction Scalar mesh particle density on .
[0071] During the leakage simulation, the concentration variation at each grid cell is described by a scalar transport model to represent the scalar grid particle density at each grid cell. In time step Specifically, the scalar transport model for leakage simulation based on gas pipeline is:
[0072]
[0073] The scalar grid particle density Perform iterative updates.
[0074] In the formula, for Grid position in the target area at all times Discrete direction Scalar grid particle density on ; for Grid position in the target area at all times Discrete direction Scalar grid gas particle velocity on ; is the time step for leakage simulation of gas pipeline.
[0075] is the relaxation time of the scalar grid when simulating the leakage of the gas pipeline based on the scalar grid particle distribution function; is the intermediate variable, Discrete direction The Gauss-Hermi orthogonal weights, for Grid position in the target area at all times methane concentration at for Grid position in the target area at all times Gas mixing velocity at is the lattice sound speed, which is a constant.
[0076] In a specific example, based on the scalar grid particle distribution function, the methane scalar concentration state of each grid unit during the gas pipeline leakage simulation is described to simulate the gas pipeline leakage scenario. When the leakage simulation starts, the scalar grid particle distribution function is initialized, that is, the scalar grid particle density of the grid unit is determined. The initial distribution of .in,
[0077]
[0078] In the formula, The grid position in the target area The initial methane concentration at The grid position in the target area The initial gas mixing velocity at . Then, the scalar grid particle density of the grid unit is determined at any time by cyclically iterating the scalar grid particle density of the grid unit.
[0079] For the relaxation time of the scalar grid, the grid relaxation algorithm is also used to adjust the relaxation time of the scalar grid during the gas pipeline leakage simulation. Specifically, according to the formula:
[0080]
[0081] Relaxation time of scalar grid when simulating gas pipeline leakage based on scalar grid particle distribution function Make corrections; where is the dimensionless diffusion coefficient of methane when the gas pipeline leaks; is the lattice sound speed, which is a constant; is the turbulent Schmidt number; is the relaxation time of the velocity network. According to the formula:
[0082]
[0083] Determining the dimensionless diffusion coefficient of methane in a gas pipeline leak ; In the formula, is the methane diffusion coefficient when the gas pipeline leaks, which is taken as a constant; is the spatial step size for meshing the three-dimensional model of the gas pipeline. is the time step for leakage simulation of the 3D model of the gas pipeline.
[0084] Therefore, the scalar concentration distribution of methane in the flow field is described by a scalar grid, the dynamic behavior of the flow field is described by a velocity network, and the relaxation time is dynamically adjusted by a grid relaxation algorithm through the mutual coupling of the velocity grid and the scalar grid during leakage simulation of the gas pipeline, thereby improving the stability and accuracy of the Reynolds number simulation; and each grid component of the velocity grid drives the flow and diffusion of methane on the scalar grid, so that the methane concentration difference buoyancy or temperature difference buoyancy in the scalar grid affects the dynamic state of the velocity grid, thereby achieving efficient and accurate capture of the flow characteristics and methane concentration distribution under turbulent conditions, and effectively reducing the computational cost.
[0085] Here, it should be noted that when simulating the leakage of the gas pipeline, the velocity grid uses D3Q15 and the scalar grid uses D3Q9. For different types of grids, the Gauss-Hermi orthogonal weights Different. Specifically, the Gauss-Hermi orthogonal weights For Grid position in the target area at all times Discrete direction ,as well as Grid position in the target area at all times Discrete direction Gas particle velocity on the velocity grid The relevant coefficients are shown in Table 1 below:
[0086] Table 1 Gauss-Hermi orthogonal weights
[0087]
[0088] In a specific application scenario, TaiChi language's improved lattice Boltzmann program for GPU parallel computing is used for calculation. TaiChi language's JIT compiler automatically converts Python functions into optimized machine code for parallel execution on GPU and CPU. In addition, TaiChilang supports mainstream GPU APIs such as CUDA and Vulkan to ensure wide compatibility and portability. The program's computational efficiency is greatly improved compared to traditional CPU-based finite volume method and finite element method, and can meet the needs of fast and high-precision generation of machine learning data sets.
[0089] In addition, in this application, a relational database management system based on PostgreSQL is used to store and manage large amounts of multimodal data. At the same time, the Python script interface can be used to interact with the database API. The data processing and storage module extracts data according to the appropriate time step, and stores the simulated gas mixing speed and methane concentration in a three-dimensional matrix according to the spatial relationship. Specifically, first, a The simulation data are then manipulated to map the gas mixing velocity and methane concentration in the uniform grid at fixed intervals.
[0090] Considering the large amount of data in model training, a relational database management system based on PostgreSQL is used to store and manage large amounts of multimodal data. Specifically, the three-dimensional matrix formed by the data processing and storage module is inserted into the database through the psycopg2 library. During the data insertion process, the execute_batch() function is used for batch insertion to improve efficiency. At the same time, a composite index is created for the time step and spatial coordinates (for example, through the CREATE INDEX statement), and the parallel query function of PostgreSQL is used to set the max_parallel_workers_per_gather parameter to achieve efficient retrieval of large-scale data, supporting rapid access and processing of massive data during model training. Therefore, this integrated approach ensures the efficiency and reliability of data management, and effectively improves the performance and accuracy of model training.
[0091] Step S102: construct a flow field prediction model for gas pipeline leakage for training, and predict the methane concentration field when the gas pipeline leaks based on the trained flow field prediction model according to the uniformly discrete methane concentration time series matrix when the gas pipeline leaks.
[0092] At present, flow field prediction is mainly divided into two forms. On the one hand, the use of reduced-order models, such as ROMs, DMD, etc., simplifies the complex characteristics of the flow field and captures the spatiotemporal characteristics and evolution laws of the data. However, its linear structure makes it difficult to handle the nonlinear and turbulent characteristics of the gas diffusion process, limiting the model's ability to capture complex dynamics. On the other hand, machine learning models are widely used in flow field time series prediction; first, convolutional neural networks (CNNs) and time series models such as recurrent neural networks (RNNs), long short-term memory networks (LSTMs), and Transformer models for spatial feature extraction. These models can maintain a balance between computational accuracy and efficiency and capture complex patterns, but their accuracy and generalization have certain defects. In addition, the dimensionality reduction technology of machine learning is also combined with time series models for flow field prediction, such as the coupling model of autoencoders and LSTM and Transformer models. However, for multivariate problems such as dimensionality reduction latent space prediction, such models are currently difficult to represent the complex interactions between fluid dynamics variables and ignore the influence of factors between variables, thus lacking in prediction accuracy.
[0093] In this regard, this application constructs a new dimensionality reduction time series flow field prediction model based on β variational autoencoder and iTransformer, which is specially optimized for the time series prediction problem of latent space multivariate, and has great advantages over traditional models in long time series prediction.
[0094] Specifically, the flow field prediction model is coupled Variational autoencoder and iTransformer time series prediction model. Among them, the β variational autoencoder adopts a convolutional structure. The encoder of the β variational autoencoder contains 5 three-dimensional convolutional layers with 16, 32, 64, 128 and 256 output channels respectively. Flattening is performed in the last layer, and the mean and variance distribution of the latent space are output through a linear layer. The structure of the decoder of the β variational autoencoder is symmetrical with that of the encoder. The β value is 0.04, which is used to balance the relationship between KL divergence and reconstruction accuracy. The dimension of the latent space is 20 dimensions.
[0095] For multivariate problems, iTransformer regards the entire time series of a single variable as a token and only uses the encoder module. It is implemented by superimposing an embedding layer, a self-attention layer, a normalization layer, and a feedforward layer. The encoder module superimposes two encoder layers and finally obtains the predicted latent space vector through a fully connected layer mapping. The future time step latent space vector sequence predicted by iTransformer is input into the decoder part of the β variational autoencoder. Through the fully connected layer and 5 three-dimensional convolutional layers, the latent space vector is restored to the concentration data of the three-dimensional flow field.
[0096] When training the constructed flow field prediction model for gas pipeline leakage, the model training module extracts the flow field simulation data of the corresponding scene from the database for training the β variational autoencoder and iTransformer time series prediction model. During the training process, a variety of machine learning training tools are integrated to optimize the model performance. Specifically, an early stop mechanism is adopted. By setting the patience value, when the performance of the validation set no longer improves, the training is automatically stopped to prevent overfitting.
[0097] In addition, automatic parameter adjustment technology is applied during the training process, using algorithms such as Bayesian optimization or grid search to automatically adjust the model's hyperparameters, including learning rate, model dimension, batch size, etc., to find the best parameter combination. The learning rate is adjusted using cosine annealing, piecewise exponential decay, and fixed learning rate table methods to ensure rapid convergence in the early stages of training and fine-tune weights in the later stages. In order to improve the generalization ability of the model, the model training module also applies data enhancement technology to expand the diversity of the training set and enhance the robustness and stability of the model by performing random rotation, translation, and noise addition on the input data.
[0098] In this application, based on the trained flow field prediction model, the methane concentration field of the gas pipeline leakage is predicted according to the uniformly discrete methane concentration time series matrix when the gas pipeline leaks. Specifically, first, based on the flow field prediction model The encoder of the variational autoencoder is the time series matrix of methane concentration when the gas pipeline leaks Perform dimensionality reduction processing to generate the time series latent space vector of the methane concentration field when the gas pipeline leaks Among them, the methane concentration time series matrix ; When the gas pipeline leaks The time series matrix of methane concentration that is uniformly discrete at each moment; , When the gas pipeline leaks The temporal latent space vector of the methane concentration field at the moment; , Is a positive integer.
[0099] Then, the temporal latent space vector of the methane concentration field when the gas pipeline leaks is Input the iTransformer of the flow field prediction model and transform the time series latent space vector Encoded as an embedding vector , in order to predict the future time when the gas pipeline leaks The temporal latent space vector of the methane concentration field Make predictions. .
[0100] Finally, through the flow field prediction model The decoder of the variational autoencoder converts the future time when the gas pipeline leaks The temporal latent space vector of the methane concentration field Restore to the future time when the gas pipeline leaks The uniformly discrete methane concentration time series matrix .
[0101] When a gas pipeline leaks, the methane concentration data at the monitoring points in the gas pipeline is collected through collection equipment (such as collection sensors, drones, etc.), and then the methane concentration time series matrix of the leakage area in the gas pipeline at each moment is constructed. , the time series matrix of methane concentration at each moment Composition of methane concentration time series matrix Then, by The encoder part of the variational autoencoder calculates the methane concentration time series matrix when the gas pipeline leaks Perform dimensionality reduction processing to extract the corresponding time series latent space vector of methane concentration field , generating the temporal latent space vector of methane concentration field .
[0102] Next, the temporal latent space vector of the methane concentration field is Input iTransformer, which transforms the temporal latent space vector The temporal latent space vector at each moment in Encoded as an embedding vector , generating the embedding vector , and through the embedding vector In the future, when the gas pipeline leaks The temporal latent space vector of the methane concentration field Make predictions.
[0103] Finally, through The decoder of the variational autoencoder converts the future time The temporal latent space vector of the methane concentration field Restore and get the future time when the gas pipeline leaks The uniformly discrete methane concentration time series matrix .
[0104] In this application, The encoder and decoder of the variational autoencoder each contain 5 three-dimensional convolutional layers, and the convolution kernel is selected , stride is 2, the convolution layer uses ReLU as the activation function, for the layer of convolutional layers, It is The input tensor of the layer convolution, for Layer convolution, the convolution operation expression of the encoder is as follows:
[0105]
[0106] in, is the activation function; is the convolution kernel; For the Layer weights; is the bias matrix.
[0107] The encoder consists of a single or multiple encoding layers, each of which contains: an attention mechanism layer, two one-dimensional convolutional layers, and two normalization layers. The attention layer uses a multi-head attention mechanism to map the query, key, and value of the input sequence to different subspaces, obtain the attention weights through inner product calculation, and then apply these weights to the value vector to aggregate important information. The generated attention output is residually connected with the original input and normalized. Specifically,
[0108] Mapping operation,
[0109]
[0110] Attention weight calculation,
[0111]
[0112] Multi-head attention computation,
[0113]
[0114] in, are the representations of queries, keys, and values, respectively; is a learnable projection matrix; each is the output of single-head attention; is the output projection matrix.
[0115] Next, the normalized data is passed to a one-dimensional convolutional layer (Conv1d), where nonlinear activation (such as ReLU or GELU) is performed, and then restored to the original dimension through a second one-dimensional convolutional layer. This output is again processed through residual connections and normalization to enhance the stability and training efficiency of the model. The entire process is repeated in multiple encoder layers, and the final output result is a processed high-dimensional vector that contains important features and timing information in the input sequence. Finally, the vector input mapping layer of the encoder module is passed. The mapping layer is mainly a fully connected layer, which reduces the vector processed by the encoder from dimension D to the prediction length to achieve input-to-output timing prediction.
[0116] Here, it should be noted that in this application, not only can the input sequence (methane concentration time series matrix ) to sequence (methane concentration time series matrix ) real-time prediction capability, and can also realize the ability to predict subsequent flow fields based on input working conditions. Specifically, the time series of each working condition is mainly determined by conditions such as leakage velocity, leakage location, and leakage diameter. A fully connected neural network, each network input is a specific working condition , the output is the flow field latent space vector after dimensionality reduction for the corresponding working condition, where the input length of the time series model is The corresponding expression is as follows:
[0117]
[0118] Through these working conditions, the The latent space vector is used as the initial input of the time series model for expansion prediction; then, the subsequent predictions are gradually advanced by using the prediction results of the first batch as input, forming an autoregressive process to achieve continuous prediction of the flow field. This ensures that under complex working conditions, the flow field prediction can effectively capture and continue the time series information and provide accurate subsequent flow field evolution prediction.
[0119] Through the method of the embodiment of the present application, based on fluid simulation, combined with flow field dimensionality reduction, time series prediction, etc., real-time flow field prediction is performed on the gas pipeline leakage accident scene, effectively solving the problems of low data set generation efficiency and low prediction accuracy in the prior art, and through real-time situation prediction of the scene, accurate and efficient emergency response can be achieved at the gas pipeline accident site.
[0120] like Figure 6 As shown, the embodiment of the present application also provides a gas pipeline leakage dimensionality reduction prediction system based on improved lattice Boltzmann, the system comprising:
[0121] The simulation unit 601 is configured to perform leakage simulation on the gas pipeline based on the improved lattice Boltzmann method to obtain flow field simulation data of the gas pipeline leakage;
[0122] The flow field prediction unit 602 is configured to construct a flow field prediction model for gas pipeline leakage for training, and predict the methane concentration field of the gas pipeline leakage based on the trained flow field prediction model according to the uniformly discrete methane concentration time series matrix when the gas pipeline leaks.
[0123] The present application implements the provided gas pipeline leakage dimensionality reduction prediction system based on improved lattice Boltzmann, which can realize the steps and processes of the gas pipeline leakage dimensionality reduction prediction method based on improved lattice Boltzmann of any of the above-mentioned embodiments and achieve the same technical effects, which will not be repeated here one by one.
[0124] In the description of the present invention, the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. mean that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0125] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A gas pipeline leakage dimensionality reduction prediction method based on improved lattice Boltzmann, characterized in that: include: Step S101, based on the improved lattice Boltzmann method, leakage simulation is performed on the gas pipeline to obtain flow field simulation data of the gas pipeline leakage; wherein the flow field simulation data includes: gas mixing velocity and methane concentration; based on the pre-constructed velocity grid particle distribution function and scalar network particle distribution function, leakage simulation is performed on the gas pipeline, and through the grid relaxation algorithm, the relaxation time of the velocity grid and the relaxation time of the scalar grid in the gas pipeline leakage simulation process are adjusted respectively to determine the gas mixing velocity and the methane concentration in the target area corresponding to the leakage hole when the gas pipeline leaks; Step S102: construct a flow field prediction model for gas pipeline leakage for training, and predict the methane concentration field when the gas pipeline leaks based on the trained flow field prediction model according to the uniformly discrete methane concentration time series matrix when the gas pipeline leaks; wherein, Based on the flow field prediction model The encoder of the variational autoencoder is a time series matrix of methane concentration when the gas pipeline leaks Perform dimensionality reduction processing to generate the time series latent space vector of the methane concentration field when the gas pipeline leaks ; Wherein, the methane concentration time series matrix ; When the gas pipeline leaks The time series matrix of methane concentration that is uniformly discrete at each moment; , When the gas pipeline leaks The temporal latent space vector of the methane concentration field at the moment; , is a positive integer; The temporal latent space vector of the methane concentration field when the gas pipeline leaks Input the iTransformer of the flow field prediction model and transform the temporal latent space vector Encoded as an embedding vector , in order to predict the future time when the gas pipeline leaks The temporal latent space vector of the methane concentration field Make predictions; among them, ; Through the flow field prediction model The decoder of the variational autoencoder converts the future time when the gas pipeline leaks The temporal latent space vector of the methane concentration field Restore to the future time when the gas pipeline leaks The uniformly discrete methane concentration time series matrix .
2. The gas pipeline leakage dimensionality reduction prediction method based on improved lattice Boltzmann according to claim 1 is characterized in that: In response to the velocity grid-based particle distribution function, a leakage simulation is performed on the gas pipeline leakage according to the formula: ; Calculate the gas mixing velocity in the target area; where, for At the grid position in the target area at the moment Gas mixing velocity at for At the grid position in the target area at the moment Discrete direction Particle density on the velocity grid; for At the grid position in the target area at the moment The gas mixture density at ; for At the grid position in the target area at the moment Discrete direction Gas particle velocity on the velocity grid.
3. The gas pipeline leakage dimensionality reduction prediction method based on improved lattice Boltzmann according to claim 2 is characterized in that: Based on pre-built collision models: ; Particle density on the velocity grid Perform iterative updates; In the formula, for At the grid position in the target area at the moment Discrete direction Particle density on the velocity grid; for At the grid position in the target area at the moment Discrete direction Gas particle velocity on the velocity grid; is the time step for simulating leakage of the gas pipeline; for At the grid position in the target area at the moment The gas mixture density at ; for At the grid position in the target area at the moment Discrete direction Particle density on the velocity grid; is the velocity grid-based particle distribution function relaxation time of a velocity network when performing leakage simulation on the gas pipeline; is an intermediate variable; Discrete direction Gauss-Hermi orthogonal weights; is the lattice sound speed, which is a constant; for At the grid position in the target area at the moment Gas mixing velocity at is the intermediate variable, is the air density, is the methane concentration expansion coefficient, for At the grid position in the target area at the moment The methane concentration at is the methane background concentration in the target area, which is a constant; is the acceleration due to gravity.
4. The method for predicting gas pipeline leakage by dimensionality reduction based on improved lattice Boltzmann according to claim 1, characterized in that: In response to the scalar grid particle distribution function, the gas pipeline is simulated for leakage according to the formula: ; Calculate the methane concentration in the target area; where, for At the grid position in the target area at the moment methane concentration at for At the grid position in the target area at the moment Discrete direction Scalar mesh particle density on .
5. The method for predicting gas pipeline leakage by dimensionality reduction based on improved lattice Boltzmann according to claim 4, characterized in that: A scalar transport model for leak simulation based on the pre-built gas pipeline: ; The scalar grid particle density Perform iterative updates; In the formula, for At the grid position in the target area at the moment Discrete direction Scalar grid particle density on ; for At the grid position in the target area at the moment Discrete direction Scalar grid gas particle velocity on ; is the time step for simulating leakage of the gas pipeline; is the relaxation time of the scalar grid when the leakage simulation of the gas pipeline is performed based on the scalar grid particle distribution function; is the intermediate variable, Discrete direction The Gauss-Hermi orthogonal weights, for At the grid position in the target area at the moment methane concentration at for At the grid position in the target area at the moment Gas mixing velocity at is the lattice sound speed, which is a constant.
6. The gas pipeline leakage dimensionality reduction prediction method based on improved lattice Boltzmann according to claim 1 is characterized in that: According to the formula: ; The relaxation time of the velocity network when simulating the leakage of the gas pipeline based on the velocity grid particle distribution function Correction is made, and the relaxation time of the scalar grid when the gas pipeline is simulated for leakage based on the scalar grid particle distribution function is corrected. make corrections; In the formula, is the dimensionless kinematic viscosity of air, is a constant, is the grid width, are the grid positions in the target area respectively. Any two tensor directions at ; is the intermediate variable, for At the grid position in the target area at the moment The gas mixture density at is the preset initial value of relaxation time, is the lattice sound speed, which is a constant; is the grid position in the target area In discrete directions The unit vector on and in the tensor direction The unit vector on The product of is the grid position in the target area In discrete directions The unit vector on and in the tensor direction The unit vector on The product of for At the grid position in the target area at the moment Discrete direction Particle density on the velocity grid; is the intermediate variable, is the dimensionless diffusion coefficient of methane when the gas pipeline leaks, is the turbulent Schmidt number.
7. A gas pipeline leakage dimensionality reduction prediction system based on improved lattice Boltzmann, characterized in that: include: A simulation unit is configured to simulate the leakage of a gas pipeline based on an improved lattice Boltzmann method to obtain flow field simulation data of the gas pipeline leakage; wherein the flow field simulation data includes: gas mixing velocity and methane concentration; based on a pre-constructed velocity grid particle distribution function and a scalar network particle distribution function, the gas pipeline leakage is simulated, and the relaxation time of the velocity grid and the relaxation time of the scalar grid in the gas pipeline leakage simulation process are adjusted respectively through a grid relaxation algorithm to determine the gas mixing velocity and the methane concentration in a target area corresponding to the leakage hole when the gas pipeline leaks; A flow field prediction unit is configured to construct a flow field prediction model for gas pipeline leakage for training, and predict the methane concentration field of the gas pipeline leakage based on the trained flow field prediction model according to the uniformly discrete methane concentration time series matrix when the gas pipeline leaks; wherein, Based on the flow field prediction model The encoder of the variational autoencoder is a time series matrix of methane concentration when the gas pipeline leaks Perform dimensionality reduction processing to generate the time series latent space vector of the methane concentration field when the gas pipeline leaks ; Wherein, the methane concentration time series matrix ; When the gas pipeline leaks The time series matrix of methane concentration that is uniformly discrete at every moment; , When the gas pipeline leaks The temporal latent space vector of the methane concentration field at the moment; , is a positive integer; The temporal latent space vector of the methane concentration field when the gas pipeline leaks Input the iTransformer of the flow field prediction model and transform the temporal latent space vector Encoded as an embedding vector , in order to predict the future time when the gas pipeline leaks The temporal latent space vector of the methane concentration field Make predictions; among them, ; Through the flow field prediction model The decoder of the variational autoencoder converts the future time when the gas pipeline leaks The temporal latent space vector of the methane concentration field Restore to the future time when the gas pipeline leaks The uniformly discrete methane concentration time series matrix .
Citation Information
Patent Citations
Hydrogen refueling station fire accident thermal radiation evaluation method and system
CN112989717A
Sampling layout method for determining positions of gas leakage points of pipeline
CN114943196A
Cited By
Method and system for predicting dynamic leakage of old oil and gas pipeline
CN120508894A
A dynamic leakage prediction method and system for old oil and gas pipelines
CN120508894B