Gas diffusion prediction method based on convolutional long short-term memory network with physical constraints
By introducing a physically constrained convolutional long short-term memory network (PhysCRNN) into gas diffusion prediction, the problems of insufficient accuracy and stability in existing technologies are solved, achieving high-precision, real-time gas diffusion prediction, which is suitable for rapid response in industrial scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- RES INST OF CHEM DEFENSE PLA ACAD OF MILITARY SCI
- Filing Date
- 2026-02-10
- Publication Date
- 2026-06-12
AI Technical Summary
Existing gas diffusion prediction methods struggle to balance accuracy, real-time performance, and stability. CFD simulations are too time-consuming, Gaussian models have limited applicability, and purely data-driven models lack physical constraints and are prone to distortion in multi-step predictions.
A Physically Constrained Convolutional Long Short-Term Memory Network (PhysCRNN) is employed, which introduces the convection-diffusion equation from fluid dynamics as an explicit physical constraint and combines it with a data-driven approach to construct a Convolutional Long Short-Term Memory Network (ConvLSTM) to achieve high-precision, long-term prediction of gas concentration fields.
It achieves high accuracy, physical consistency, and long-term stability in gas diffusion prediction, reduces computational costs, supports rapid real-time applications, and is suitable for predicting complex turbulence and local structures.
Smart Images

Figure CN122197540A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the technical field of the intersection of artificial intelligence and fluid mechanics, and specifically relates to a deep learning method for predicting gas leakage and diffusion. In particular, it relates to a gas concentration field prediction method that integrates a convolutional long short-term memory network with physical constraints, which can be applied to scenarios such as real-time early warning of industrial gas leaks, environmental monitoring, and emergency response decision support. Background Technology
[0002] With the acceleration of global industrialization, the large-scale use of hazardous chemicals has led to a continuous increase in the frequency of leaks of flammable gases, toxic gases, and corrosive substances during storage, production, and transportation. Recent port explosions, chemical plant leaks, and gas storage leaks demonstrate that gas leaks spread rapidly, cover large spatial areas, and exhibit complex temporal variations, necessitating real-time monitoring and high-precision prediction to assist in emergency response. Currently, gas diffusion prediction mainly relies on three types of methods, but all have significant drawbacks: 1. Computational Fluid Dynamics (CFD) Solution: It simulates concentration field changes by solving the Navier-Stokes equations and convection-diffusion equations. It has high spatial accuracy, but a single simulation takes several hours to several days and requires dozens to hundreds of CPU cores, making it difficult to use for real-time early warning of sudden accidents. 2. Statistical models and Gaussian models: They have low complexity, but they make strict assumptions, such as stable wind fields and turbulent similarity. They have poor accuracy under strong unsteady conditions and cannot simulate the effects of obstacles, vortex streets, and terrain on gas diffusion. 3. Purely data-driven deep learning models: such as CNN, GAN, Transformers, LSTM and other methods have obvious speed-up effects, but lack physical constraints. The prediction results are prone to deviating from the basic physical laws such as mass conservation and energy conservation. They cannot characterize complex turbulence and local structures. Moreover, the error accumulates over time when making predictions in multiple steps, and the results become distorted after several steps.
[0003] In summary, relying solely on CFD or purely data-driven methods makes it difficult to achieve a balance between accuracy, real-time performance, and stability, which has become a technical bottleneck for real-time prediction of gas leakage and diffusion. Summary of the Invention
[0004] (a) Technical problems to be solved This invention aims to solve the technical problems of existing gas diffusion prediction methods, such as excessively long CFD simulation time, limited applicability of Gaussian models, lack of physical constraints in pure data-driven models, and easy distortion in multi-step prediction. It provides a gas diffusion spatiotemporal prediction method with high prediction accuracy, good physical consistency, strong spatiotemporal dynamic capture capability, high long-term prediction stability, fast training and inference speed, and suitability for real-time applications.
[0005] (II) Technical Solution To achieve the above objectives, the core idea of this invention is to introduce the convection-diffusion equation from fluid mechanics as an explicit physical constraint into the training process of a convolutional long short-term memory network (LSM). By integrating data-driven approaches with physical laws, a physically constrained LSM network (PhysCRNN) is constructed. Through the collaborative work of multiple modules, high-precision, long-term prediction of gas concentration fields is achieved. A gas diffusion prediction model based on a physically constrained LSM network specifically includes the following modules: 1. Physics Field Data Processing Module This module receives raw velocity and concentration field data of gas diffusion and performs data preprocessing to adapt it for neural network training. Specific operations include: interpolating the velocity field (u, v) to a regular grid; generating the concentration distribution using scalar transport equations; adding random noise to the raw data to simulate measurement errors; constructing the input and label sequences for neural network training using a spatiotemporal sliding window; and dividing the training and test sets chronologically to avoid data leakage. This module encapsulates the flow and concentration fields as tensor data, which can be directly input into the neural network.
[0006] 2. Spatial Feature Coding Module This module employs a three-level convolutional network (Encoder), with each layer containing 3×3 convolutions and ReLU activations, generating 32 / 64 / 128 feature maps respectively. It performs multi-scale spatial compression on the input two-dimensional concentration field, progressively extracting local structures (such as vortices, gradient fronts, and diffusion plumes) to generate low-dimensional spatial feature representations for temporal modeling. This encoding method possesses multi-scale feature extraction capabilities, can learn spatial patterns of gas diffusion, and simultaneously reduces the dimensionality of subsequent convolutional long short-term memory networks, thus lowering computational cost.
[0007] 3. Temporal Evolution Modeling Module (ConvLSTM Network) This module is used to model the temporal evolution of gas diffusion and is one of the core components of this invention. Unlike traditional Long Short-Term Memory (LSTM) networks, the convolutional LSTM network structure used in this invention replaces ordinary fully connected operations with two-dimensional convolutions in all computational gates and internal state update operations, thereby preserving the spatial structure of the concentration field while modeling time dependence.
[0008] In this module, the historical concentration field sequence is input to the temporal unit after spatial feature encoding. At each time step, this temporal unit dynamically updates three control gates—the input gate, the forget gate, and the output gate—through multiple sets of convolutional operations. These three gates collectively determine, in each update, how new information is written into the internal state, how old information is retained or discarded, and ultimately, what content is output to the next stage.
[0009] When updating the internal state, the temporal unit considers not only the concentration field features of the current input but also the hidden state from the previous time step. Since the hidden state also stores spatial features in a convolutional form, the network can learn local spatial variation patterns of gas concentration, such as the migration of high-concentration plumes, periodic perturbations generated by alternating vortices, asymmetric diffusion in the wake region, and mixing phenomena caused by turbulent perturbations.
[0010] Another important advantage of using convolution instead of fully connected layers is its sensitivity to the spatial neighborhood of the input concentration field. Each gating update not only reflects the changes at the current pixel, but also incorporates features of the neighborhood region, thereby learning the expansion direction, boundary morphology, and local structure of the diffusion plume.
[0011] During long-term predictions, this module can continuously store the regular structures of gas diffusion, such as the persistent influence of the velocity field, concentration fluctuations caused by periodic flows, and disturbance trends under complex terrain conditions. Because the internal state is continuously propagated throughout the prediction sequence, the model can reasonably infer diffusion trends in the future without rapid distortion or numerical divergence. 4. Physical Constraint Calculation Module
[0012] This module explicitly incorporates the physical laws of gas diffusion into deep learning models, ensuring that the model's predictions not only fit the training data but also satisfy the fundamental physical equations of gas diffusion. The module's purpose is to guarantee that the model's output is consistent with the effects of convection, diffusion, and source terms, thereby improving the reliability of predictions and engineering applications.
[0013] In this module, the trend of the model output over time is first calculated based on the predicted concentration field at different times. This trend reflects the rate of concentration evolution over time and is used to measure whether the concentration field predicted by the model changes according to physical laws.
[0014] Secondly, this module uses a specially designed set of convolutional kernels to estimate the proportion of concentration variation in different spatial directions based on the concentration distribution in the spatial neighborhood. These proportions represent the magnitude of the concentration gradient, reflecting the trend of pollutants moving along the wind speed direction during convective transport. Simultaneously, another type of convolutional kernel is used to evaluate spatial diffusion. This type of kernel reflects the homogenization trend of pollutants in the surrounding area, providing a direct representation of the diffusion effect.
[0015] Furthermore, this module simultaneously inputs velocity field information and, combined with the spatial gradient direction, calculates the overall drift trend of pollutants driven by the wind field. When the wind speed is high, the convection term contributes significantly; when the diffusion coefficient is high or the concentration gradient is steep, the diffusion term contributes more significantly. This module ensures that these two influencing factors are balanced during model training.
[0016] The impact of pollution source terms is also calculated in this module, including releases from stationary point sources, area sources, or volume sources. By adding additional concentration contributions at the appropriate locations, this module can simulate the continuous emission process of pollution sources in real-world scenarios.
[0017] After completing the calculations for all the physical factors mentioned above, this module comprehensively compares the concentration-time variation trend, convection-driven trend, diffusion homogenization trend, and pollution source contribution. If the concentration change predicted by the model deviates from the physical laws, such as excessively rapid diffusion, incorrect convection direction, or abnormal concentration gradient changes, this module will output a large deviation value.
[0018] This deviation, known as the physical residual, indicates a greater discrepancy between the model's predictions and actual physical laws. By feeding this deviation value back to the training mechanism, the model parameters are continuously adjusted until the predictions simultaneously satisfy both the observed data and the physical laws.
[0019] The physical residuals are constructed using the following convection-diffusion equations:
[0020] Spatial gradients and Laplacian operators are calculated using convolution kernels to achieve physical consistency constraints.
[0021] 5. Concentration Field Reconstruction Module This module employs convolutional + bilinear upsampling to restore spatial resolution: upsampling avoids the checkerboard effect of pixel shuffling, ensuring the output size matches the original concentration field and generating a concentration prediction for the next time step. During model training, both data errors and physical errors are considered to ensure the prediction closely approximates the actual concentration field data while conforming to the physical laws of gas diffusion. During training, the model first generates a data error signal based on the difference between the actual and predicted concentration fields, guiding the model to learn the spatial distribution and temporal variation characteristics of gas diffusion. Simultaneously, the physical constraint calculation module outputs physical deviations reflecting whether the model predictions satisfy the effects of convection, diffusion, and source terms, measuring the degree of deviation from the physical equations. The physics-data joint optimization module fuses these two types of error signals into a comprehensive optimization objective, enabling the model to converge in both directions—"fitting observed data" and "satisfying physical laws"—during parameter updates. Through this joint optimization approach, the model maintains high stability even with sparse or noisy data and avoids divergence caused by error accumulation in long-term predictions, thus achieving more reliable concentration field predictions that better conform to physical mechanisms.
[0022] 6. Multi-step autoregressive prediction module This module recursively calls the network output, using the currently predicted concentration field as the input for the next time step, and continuously propagates the hidden state of the ConvLSTM across time steps, enabling continuous prediction over multiple future time steps. This approach mitigates prediction divergence caused by accumulated errors and supports gas diffusion predictions for dozens or even hundreds of future time steps.
[0023] The specific process of the gas diffusion prediction method of the prediction model of this invention is as follows: Training process: First, the velocity and concentration fields are organized into spatiotemporal sequence samples suitable for learning. Then, a convolutional network is used to extract spatial features from the two-dimensional concentration distribution at each time step, and these features are then fed into a convolutional LSTM to learn the evolution of these features over time. The features output by the model are decoded and upsampled to reconstruct the concentration field for the next time step. During training, the difference between the predicted and actual values is compared, and the deviation of the predicted results from the convection-diffusion equation is calculated. The weighted average of the two is used as the total loss to update the model parameters. This process is iterated until the loss converges, resulting in a fully trained model.
[0024] Prediction process: The current concentration field and corresponding velocity field are fed into a pre-trained model, which then calculates the concentration field for the next time step based on the spatiotemporal evolution learned during training. If a more distant future prediction is needed, the newly obtained prediction result is used as the input for the next step, and this process is repeated for multiple time steps. During the prediction process, real observations can be used to monitor and compare the predictions, while physical residuals are continuously used to check whether the predictions conform to the convection-diffusion laws, thus ensuring long-term prediction stability and preventing excessive deviation from the physical mechanisms.
[0025] During training, the total loss, including physical loss and data loss, is:
[0026] Among them λ 2>0 is used to explicitly enhance physical consistency. This method supports prediction of complex gas diffusion scenarios such as turbulence and wake vortex shelving, and the prediction error growth rate is reduced by at least 50% compared to traditional LSTM.
[0027] (III) Beneficial Effects This invention introduces explicit physical constraints into a deep learning network, significantly outperforming existing technologies in terms of accuracy, stability, and efficiency for gas diffusion prediction. By leveraging convolutional long short-term memory structures to jointly model spatial and temporal features, the model can accurately capture local variations and overall evolution trends of pollutant concentrations in complex flow fields. Simultaneously, the inclusion of physical constraints ensures that the prediction process strictly adheres to convection and diffusion laws, effectively suppressing numerical divergence, gradient distortion, or anomalous results that are prone to occur in traditional data-driven models. During training, physical information and data errors jointly participate in optimization, enabling the model to maintain high robustness even with insufficient data or high noise levels, and to maintain a stable error growth rate in long-term predictions. Furthermore, this invention employs a lightweight encoder-ConvLSTM-decoder structure, significantly reducing computational costs and improving training and inference speeds, providing feasibility for real-time early warning in industrial scenarios. In summary, this invention not only achieves significant improvements in prediction accuracy but also excels in physical consistency, computational efficiency, long-term stability, and engineering application feasibility, providing more reliable technical support for gas leak monitoring and emergency management. Attached Figure Description
[0028] Figure 1 This is a schematic diagram of the process of implementing the present invention. Detailed Implementation
[0029] The gas diffusion prediction method of this invention comprises two main parts: a training process and a prediction process, combined with the appendix. Figure 1 The flowchart is shown below, and the specific implementation method is as follows: I. Training Process 1. Data preprocessing: The raw velocity field and concentration field data of gas diffusion are received through the physical field data processing module. The velocity field is interpolated to a regular grid, and the concentration distribution is generated using the scalar transport equation. Random noise is added to simulate measurement error. Then, the input sequence and label sequence are constructed through a spatiotemporal sliding window, and the training set and test set are divided according to time order. 2. Spatial feature extraction: The concentration field data of the training set is input into the spatial feature encoding module. Multi-scale spatial features are extracted through a three-level convolutional network (3×3 convolution + ReLU activation) to generate 32 / 64 / 128 feature maps, thus obtaining a low-dimensional spatial feature representation. 3. Temporal Evolution Modeling: The extracted spatial features are input into a physically constrained convolutional long short-term memory network module. The spatiotemporal dependencies are modeled through convolutional gating mechanisms (input gate, forget gate, output gate, and unit state update structure) to predict the features of the next time step. 4. Concentration field reconstruction: The predicted features of the next time step are input into the concentration field reconstruction module, and the original resolution is restored through a convolutional decoder and bilinear upsampling to generate the predicted concentration field; 5. Loss Calculation and Parameter Optimization: Calculate physical loss using the physical information constraint module. The data loss is calculated by combining the difference between the actual concentration field and the predicted concentration field. According to the formula (λ2>0) Calculate the total loss; 6. Update network parameters using an optimizer based on the total loss: Repeat the above steps until the model converges to obtain the trained PhysCRNN model.
[0030] II. Forecasting Process 1. Data Input: Input the gas diffusion velocity field and concentration field data at the current moment into the physical field data processing module. After preprocessing, tensor data that meets the model input requirements is obtained. 2. Feature Encoding and Temporal Prediction: The preprocessed data is input into the spatial feature encoding module to extract multi-scale spatial features, and then input into the trained PhysCRNN module to establish a spatiotemporal dependency mapping to predict the features of the next time step. 3. Concentration field generation: The concentration field reconstruction module decodes the predicted features into the concentration field for the next time step; 4. Multi-step continuous prediction: Through a multi-step autoregressive prediction module, the currently predicted concentration field is used as the input for the next time step, maintaining the hidden state h of the ConvLSTM. t With c t By continuously transmitting and recursively executing the above prediction steps, continuous prediction of the gas concentration field can be achieved for multiple future time steps.
[0031] Through the above-described embodiments, this invention can quickly and accurately predict changes in the concentration field of gas diffusion in industrial gas leakage scenarios, providing reliable technical support for emergency response decisions.
[0032] Example Taking flow simulation data around a cylinder as an example (1) Scene and data settings The background velocity field is based on publicly available two-dimensional reference data of flow around a cylinder, with a Reynolds number Re=100; the computational domain is [ 15D,25D]×[ [8D, 8D], where D is the diameter of the cylinder. A point source pollutant is placed downstream at x / D = 2.0, y / D = 0.0, with a source strength Q = 0.1 (dimensionless); diffusion coefficient D = 2 × 10⁻⁶. 4 To facilitate network training, the original data was interpolated to a regular Cartesian grid with a spatial resolution of Δx=0.2D and Δy=0.16D, and Gaussian white noise of no more than 1% of the maximum concentration was superimposed on the concentration field to simulate measurement error.
[0033] (2) Construction of time series samples A sliding window method is used to construct spatiotemporal samples with a window size of 5. Each sample inputs 10 time steps and predicts the next 5 time steps. The data is divided into training and test sets in chronological order at a ratio of 8:2 to avoid data leakage.
[0034] (3) Model and training configuration This embodiment employs a physically constrained convolutional long short-term memory network (PhysCRNN). The network consists of an encoder, a ConvLSTM, and a decoder: the encoder has 3 layers of 3×3 convolutions + ReLU, the temporal module is a single-layer ConvLSTM, and the decoder uses convolution + bilinear upsampling to restore the original resolution. The loss function is... L=λ1L data +λ2L phys Where L phys The values represent the convection-diffusion equation residuals; the optimizer is Adam, the activation function is ReLU, and the upsampling method is bilinear interpolation. This combination performs best and converges stably on this dataset.
[0035] (4) Prediction process and results 1) Single-step prediction: Using the concentration fields of the past K time steps as input, predict the concentration distribution at time t+1. Test set results show a coefficient of determination R² = 0.919 and a root mean square error (RMSE) of 6.25 × 10⁻⁶. 3 In local regions such as the vortex boundary and the plume front, the prediction is highly consistent with the true value.
[0036] 2) Multi-step prediction: The autoregressive mechanism is used to continuously predict the next 20 time steps. At multiple spatial observation points, the predicted curves are consistent with the trends of the true values. The error increases slowly with the number of steps, with a growth rate of about 0.0028 / step, which is about 62% lower than that of the traditional LSTM, and the long-term stability is significantly improved.
[0037] (5) Comparison with existing methods Under the same data and training configuration, comparisons are made with PhyCRNet, PINN, and LSTM: — Accuracy: The R² of this method is 0.919, which is higher than PhyCRNet (0.903), PINN (0.877), and LSTM (0.804); — Error: RMSE of this method = 6.25 × 10 3 lowest; — Training time: approximately 2731 s, shorter than PhyCRNet (approximately 3795 s); — Prediction time: approximately 1.2 s / batch, an improvement of approximately 55% over PhyCRNet.
[0038] The results show that this method has comprehensive advantages in terms of accuracy, efficiency and stability, and is suitable for rapid diffusion prediction and verification based on simulated flow fields.
[0039] (6) Parameters and Implementation Suggestions To balance accuracy and efficiency, a 3-layer encoder, a window stride of 5, a channel configuration of [32, 64, 128], a ReLU activation function, an Adam optimizer, and bilinear interpolation for upsampling are recommended. Ablation experiments have verified that this configuration exhibits superior convergence and generalization performance.
[0040] (7) Application effect This example can achieve real-time inference in the range of 1–2 seconds on a GPU platform (RTX 4050 Laptop GPU with 6 GB of VRAM), meeting the requirement of less than 5 seconds for prediction latency in on-site leak early warning systems. The model has rapid adaptability; when wind direction, source strength, or terrain parameters change, it can be quickly updated through retraining with a small number of incremental samples.
Claims
1. A gas diffusion prediction model based on physically constrained convolutional long short-term memory networks, characterized in that, Includes the following functional modules: (1) The physical field data processing module is used to receive the original data of the velocity field and concentration field of gas diffusion, resample, normalize, simulate noise and construct a time-space sliding window to generate input sequence and label sequence for neural network training; (2) The spatial feature encoding module uses a multi-layer convolutional feature extractor to perform multi-scale spatial compression on the input two-dimensional concentration field, generating a low-dimensional spatial feature representation for the temporal evolution modeling module; (3) Physically constrained convolutional long short-term memory network module: Based on convolutional long short-term memory units, a temporal evolution modeling module is constructed. The spatiotemporal dependency relationship in the gas diffusion process is modeled through convolutional gating mechanism, and the cross-time step transmission of hidden state and unit state is maintained. (4) The physical information constraint module constructs physical residual terms based on the convection-diffusion equation, calculates the spatial derivative of the concentration field and the Laplace operator through the convolution operator to form an explicit physical loss function, which is used to constrain the model output to conform to physical laws. (5) The concentration field reconstruction module uses a convolutional decoder and bilinear upsampling to map the hidden state output by the convolutional long short-term memory network to the original resolution, generating the gas concentration field for the next time step. (6) The multi-step autoregressive prediction module recursively calls the network output, takes the current predicted concentration field as the input of the next time step, and maintains the hidden state to propagate across steps, so as to realize continuous prediction of multiple future time steps.
2. A gas diffusion prediction method based on physical constraints, characterized in that, The main steps of implementing the model as described in claim 1 include: Step 1: Construct a gas diffusion dataset containing velocity and concentration fields, and generate input and prediction sequences using the sliding window method; Step 2: Input the concentration field within the current window into the spatial feature encoding module to obtain multi-scale spatial features; Step 3: Input the spatial features into the convolutional long short-term memory network to establish a spatiotemporal dependency mapping and predict the features of the next time step; Step 4: The concentration field reconstruction module decodes the predicted features into the concentration field at the next time step; Step 5: Calculate the residual between the gas concentration change and the convection-diffusion equation using the physical information constraint module, and combine it with the data loss in a weighted manner to form the total loss; Step 6: Train the model parameters using an optimizer to ensure that the predicted concentrations meet physical consistency. Step 7: Use an autoregressive approach to recursively input the current prediction results into the model to achieve concentration field prediction for multiple time steps in the future.
3. The method according to claim 2, characterized in that, The physical residual is constructed using the following convection-diffusion equation: Spatial gradients and Laplacian operators are calculated using convolution kernels to achieve physical consistency constraints.
4. The method according to claim 2, characterized in that, The spatial derivative is calculated using a convolution kernel.
5. The method according to claim 2, characterized in that, The gating structures of the convolutional long short-term memory network all employ convolution operations, including: input gate, forget gate, output gate, and cell state update structure, to capture local concentration gradients, vorticity structures, and temporal dependencies.
6. The method according to claim 2, characterized in that, The concentration field decoding module adopts a bilinear upsampling method to avoid the checkerboard effect caused by pixel shuffling upsampling.
7. The method according to claim 2, characterized in that, In the multi-step prediction process, the hidden states ht and ct are continuously propagated between time steps to reduce the accumulation of multi-step prediction errors.
8. The method according to claim 2, characterized in that, The total loss, including physical and data losses, is: in λ 2>0 is used to explicitly enhance physical consistency.
9. The method according to claim 2, characterized in that, This method supports the prediction of complex gas diffusion scenarios such as turbulence and wake vortex shelving, and the prediction error growth rate is reduced by at least 50% compared with traditional LSTM.