A shale gas well production prediction method based on a causal flow model

CN123013688APending Publication Date: 2026-10-30SOUTHWEST PETROLEUM UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611280161.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-22
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

该方法形式简洁、计算便捷,但仅依赖产量自身的时间序列特征,未纳入压力等操作变量的影响,操作制度调整后原有递减规律即失效,不适用于制度优化场景

Benefits of technology

本发明以显式因果DAG约束预测的物理方向,弥补了LSTM的因果缺失;此外,利用CNF的可逆性,从观测数据中反推反事实推理所需的外生噪声,克服了现有技术中数值模拟与纯统计方法的缺陷,提供了一种基于因果流模型的页岩气井产量预测方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123013688A_ABST
    Figure CN123013688A_ABST
Patent Text Reader

Abstract

The application discloses a shale gas well production prediction method based on a causal flow model, relates to the technical field of petroleum and natural gas engineering and machine learning, and in particular relates to a shale gas well production prediction method based on a causal flow model. The method comprises the following steps: S1, constructing a field causal diagram for gas well production according to a shale gas well borehole multiphase flow and a node analysis theory; S2, constructing a time sequence sample based on a multi-well sliding window according to an original data set of a monitoring variable; S3, constructing a corresponding RNN encoder and CNF generator for each monitoring variable; S4, performing model training and convergence monitoring to determine optimal fitting parameters; and S5, performing observation prediction, intervention prediction and counterfactual inference to optimize shale gas well production. The application predicts the physical direction by embedding constraints of a causal DAG, can make correct direction production prediction under a pressure system that does not occur during training, and can inversely deduce exogenous noise required by counterfactual reasoning from observation data by using the reversibility of the CNF.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of petroleum and natural gas engineering and machine learning technology, and in particular to a method for predicting shale gas well production based on a causal flow model. Background Technology

[0002] Shale gas well production dynamics are influenced by both subsurface static conditions and surface operating procedures. The former includes uncontrollable geological parameters such as porosity, permeability, and gas saturation, while the latter manifests as daily controllable variables such as wellhead oil pressure and casing pressure. Field decision-making typically faces three levels of challenges: the first is observational prediction, i.e., estimating short-term production under the current operating procedure; the second is intervention prediction, i.e., the production response after adjusting wellhead oil pressure; and the third is counterfactual inference, i.e., tracing back past production history to extrapolate cumulative production differences under different pressure strategies. The latter two levels essentially fall under the category of causal inference and cannot be answered through pure data fitting.

[0003] Currently, the methods used in the field can be divided into three categories. The first category is Arps decline analysis, which fits historical production data into an exponential, hyperbolic, or harmonic decline pattern and then extrapolates it. This method is simple in form and convenient in calculation, but it only relies on the time series characteristics of the production itself and does not take into account the influence of operational variables such as pressure. After the adjustment of the operating regime, the original decline pattern becomes invalid, making it unsuitable for regime optimization scenarios. The second category is reservoir numerical simulation, which constructs and solves geological models based on seepage mechanics equations. It has a relatively complete physical foundation and can perform intervention scenario analysis, but the modeling and parameter calibration cycle for single wells is long, making it difficult to meet the batch evaluation needs of large-scale well groups. The third category is deep learning prediction methods represented by LSTM, which have strong fitting capabilities, but its essence is a statistical correlation model. It learns the conditional distribution P(Y|X) rather than the intervention distribution P(Y|do(X)), and its ability to extrapolate pressure regimes not present in the training data is insufficient, and it does not have counterfactual inference capabilities.

[0004] The existing technology has three shortcomings: the Arps method lacks the input dimension of operational variables, and the model becomes invalid after the system is adjusted; the computational cost of numerical simulation is too high, and the parameter calibration of a single well takes several days, which is difficult to meet the batch deployment needs of hundreds of wells; the LSTM lacks a causal structure and cannot bridge the essential difference between the conditional distribution P(Y|X) and the intervention distribution P(Y|do(X)), so it cannot perform intervention extrapolation or counterfactual inference. Summary of the Invention

[0005] The purpose of this invention is to overcome the shortcomings of existing technologies and provide a shale gas well production prediction method based on a causal flow model, comprising the following steps: S1. Based on the theory of multiphase flow and node analysis in shale gas wellbore, construct a domain causal graph for gas well production; S2. Based on the original dataset of the monitored variables, construct time series samples based on a multi-well sliding window. S3. For each monitored variable, construct the corresponding RNN encoder and CNF generator; S4. Perform model training and convergence monitoring to determine the best fitting parameters; S5. Execute observation and prediction, intervention and prediction and counterfactual inference to optimize shale gas well production.

[0006] Preferably, step S1 includes: S11. Select monitoring variables to determine the direction of causal nodes and edges; S12. Determine the intervention variables.

[0007] Preferably, in step S11: The selected monitoring variables include wellhead oil pressure, wellhead casing pressure, bottom hole flowing pressure, and daily gas production.

[0008] Preferably, in step S11: The wellhead oil pressure is determined as node 0, the wellhead casing pressure as node 1, the bottom hole flowing pressure as node 2, and the daily gas production as node 3. During prediction, the nodes are executed in the topological order [0,1,2,3] or [1,0,2,3].

[0009] Preferably, step S2 includes: S21. Obtain the original dataset of the actual measured monitoring variables, perform standardization processing, and slide the data of each well in the time dimension with a preset step size to generate a sliding window sample. S22. Perform an inverse transformation on the sliding window sample data of the monitored variables to restore them to the physical units of the original monitoring data.

[0010] Preferably, step S3 includes: Preferably, step S3 includes: S31, Update the hidden state of the RNN; S32. Construct a causal condition vector by splicing together the vectors. S33 and CNF forward encoding and reverse decoding; S34, Flow Matching Training Objective.

[0011] Preferably, updating the RNN hidden state in step S31 includes: for node i, updating its hidden state at time step t by updating the top-level hidden state from the previous time step. Compared with current observations The data is fed into an LSTM and processed through three layers of gated recurrent units before a new top-level hidden state is output. and the state of the entire cell layer; As a preferred option, in step S32, a causal condition vector is constructed by splicing together the following: the LSTM top-level hidden state of node i at the previous time step, the original observation sequence of the preset time steps in the past, the values ​​of all parent nodes at the current time step, and the LSTM top-level hidden states of all parent nodes. Preferably, the forward encoding and reverse decoding of CNF in S33 include: the forward encoding process is performed by a function This means that, given a velocity field The forward process summarizes the hidden states of facts in the past observed factual data. Under these conditions, the observed factual results Push to potential embeds : in, For the latent embedding, Φ_θ is the invertible mapping function defined by CNF. For observed factual results, To conceal the truth For the velocity field, The current state is represented by s, where s is the normalized flow time. The reverse decoding process is defined by the function: in, For potential representation, The hidden state is updated from the model's predicted values; Preferably, the Flow Matching training objective in step S34 includes: at the beginning of the prediction window, From context sequence Initialization; for subsequent steps During training, in a hidden state Using observations Autoregressive updates; training loss is calculated over the entire prediction window.

[0012] Preferably, step S4 includes: the RNN receiving the actual observations instead of the predicted values ​​from the previous step as input within the prediction window to accelerate convergence.

[0013] Compared with the prior art, the present invention has the following beneficial technical effects: This invention compensates for the lack of causality in LSTM by using explicit causal DAG constraints to predict the physical direction. In addition, by utilizing the reversibility of CNF, it infers the exogenous noise required for counterfactual reasoning from the observation data, overcoming the shortcomings of numerical simulation and pure statistical methods in the prior art, and providing a shale gas well production prediction method based on a causal flow model.

[0014] Other advantages, objectives and features of the present invention will become apparent in part from the following description, and in part from those skilled in the art through study and practice of the invention. Attached Figure Description

[0015] Figure 1 This refers to the change in prediction quality during the underfitting stage in Epoch 5 of this invention. Figure 2 This refers to the change in prediction quality of the Epoch 10-optimal model in this embodiment of the invention. Figure 3 This refers to the change in prediction quality at Epoch 20 in this embodiment of the invention, indicating slight overfitting. Figure 4 This refers to the change in prediction quality during the Epoch 50 overfitting stage in this embodiment of the invention. Figure 5 This refers to the observation and prediction results of test well sample 1 in this embodiment of the invention; Figure 6 This refers to the observation and prediction results of test well sample 2 in this embodiment of the invention; Figure 7 This refers to the observation and prediction results of test well sample 3 in this embodiment of the invention; Figure 8 This is the intervention prediction (blood pressure reduction of 20%) result for Sample 1 in this embodiment of the invention; Figure 9 This is the intervention prediction (blood pressure reduction of 20%) result for sample 2 in this embodiment of the invention; Figure 10 This is the intervention prediction (blood pressure reduction of 20%) result for sample 3 in the embodiments of the present invention; Figure 11 This is the intervention prediction (20% increase in blood pressure) result for Sample 1 in this embodiment of the invention; Figure 12 This is the intervention prediction (20% increase in blood pressure) result for sample 2 in this embodiment of the invention; Figure 13 This is the intervention prediction (20% increase in blood pressure) result for sample 3 in this embodiment of the invention; Figure 14 This is the inference result of sample 1, which is a counterfactual (20% blood pressure reduction) example in the embodiments of the present invention; Figure 15 This is the inference result of counterfactual (20% blood pressure reduction) sample 2 in the embodiments of the present invention; Figure 16 This is the inference result of sample 3, which is a counterfactual (20% blood pressure reduction) example in the embodiments of the present invention; Figure 17 This is the inference result of counterfactual (20% pressure increase) sample 1 in the embodiments of the present invention; Figure 18 This is the inference result of counterfactual (20% pressure increase) sample 2 in the embodiments of the present invention; Figure 19 This is the inference result of sample 3, which is a counterfactual (20% pressure increase) example in this invention. Detailed Implementation

[0016] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.

[0017] The prediction method provided by this invention includes the following steps: S1. Based on the theory of multiphase flow and node analysis in shale gas wellbore, construct a domain causal graph for gas well production; The purpose of step S1 is to formalize the physical transmission relationships between variables in the gas well production system into a causal directed acyclic graph, providing causal direction constraints for subsequent predictions. Further, the specific method of step S1 includes the following sub-steps: S11. Select monitoring variables to determine the direction of causal nodes and edges; Based on the theory of multiphase flow and node analysis in wellbore, this invention selects four monitoring variables to analyze their causal transmission relationships. The upstream variables are wellhead oil pressure and wellhead casing pressure, which are directly controllable and represent the root node (without a parent node) in the causal diagram. Oil pressure and casing pressure are transmitted to the bottom of the well through the gas-liquid two-phase flow within the wellbore, forming the bottom-hole flowing pressure. While there is a certain lag in pressure transmission, it is negligible relative to the data sampling interval (10 days / step). Therefore, a causal edge is established from oil pressure and casing pressure to the bottom-hole flowing pressure. After the bottomhole flowing pressure is formed, the reservoir gas seeps into the wellbore through the pores under the drive of the production pressure differential, forming the daily gas production. The lower the flowing pressure, the greater the pressure differential, and the higher the gas production. Therefore, this invention establishes a causal edge from the bottomhole flowing pressure to the daily gas production. The causal relationship is: oil pressure and casing pressure point to flowing pressure, and flowing pressure points to gas production. The final four-node causal chain is: node 0 (wellhead oil pressure) and node 1 (wellhead casing pressure) → node 2 (bottomhole flowing pressure) → node 3 (daily gas production). The prediction is strictly performed according to the topological order [0,1,2,3] or [1,0,2,3].

[0018] S12. Identify intervention variables; In this invention, based on practical considerations, wellhead oil pressure, rather than bottomhole flowing pressure, is selected as the intervention variable. Operators can directly change the wellhead oil pressure by changing the nozzle size, while the bottomhole flowing pressure passively responds and cannot be directly controlled. By setting intervention nodes on operable variables, the changes in production output from the model, whether pressure reduction or increase, can directly guide adjustments to on-site measures; if several pre-nodes are selected as uncontrollable variables, the intervention prediction results will lose their practical engineering value.

[0019] S2. Based on the original dataset of the monitored variables, construct time series samples based on a multi-well sliding window. The purpose of step S2 is to transform a limited number of wells into sufficient training samples using an in-well sliding window strategy, and to complete data preprocessing by employing feature-wise dynamic standardization. Step S2 specifically includes: S21. Obtain the original dataset of the actual measured monitoring variables, perform standardization processing, and generate a sliding window sample for each well by sliding the dataset along the time dimension at a preset step size. In one specific embodiment of the present invention, the original dataset contains 142 wells, and each well records 46 time steps (460 days in total) at equal intervals (10 days / step), totaling 6532 records. A sample table is shown below: ; To obtain sufficient training samples with a limited number of wells, an in-well sliding window strategy is adopted: each well slides along the time dimension with a step size of 1. Each window consists of the context of the previous 15 steps (150 days) and the prediction target of the next 8 steps (80 days), resulting in 46-15-8+1=24 windows per well. In the embodiment, the training set and test set are randomly divided by well in an 8:2 ratio, resulting in 113 training wells (2712 windows) and 29 test wells (696 windows). Data is split by well to ensure that all time steps of the test wells are completely invisible during the training phase, thereby accurately evaluating the model's generalization ability to unseen wells.

[0020] S22. Perform an inverse transformation on the sliding window sample data of the monitored variables to restore them to the physical units of the original monitoring data; Before inputting the data into the model, feature-wise standardization is performed: for each variable of each well, the mean and standard deviation are calculated independently in its context window (first 15 steps). The original value is subtracted from the mean and then divided by the standard deviation to transform it into a state of zero mean and unit variance before being sent into the model. The formula is: Standardized value = (original value - mean) / standard deviation.

[0021] The predicted results are then restored to their original physical units of MPa and 10,000 cubic meters per day through inverse transformation (multiplying by the standard deviation and adding the mean). Dynamic standardization is used instead of pre-calculating global statistics on all 142 wells because the test wells are not visible during the training phase—using global statistics would be equivalent to prematurely leaking the data distribution information of the test set into the training process, making subsequent generalization ability assessments unreliable.

[0022] S3. For each monitored variable, construct the corresponding RNN encoder and CNF generator; In step S3, an independent encoder-generator pair is assigned to each node i (4 nodes in total) in the causal graph, consisting of a 3-layer LSTM temporal encoder and a conditional CNF generator, specifically including: S31, Update the hidden state of the RNN; The recursive update mechanism of LSTM naturally matches the causal characteristics of time-series systems: the current state depends only on the state of the previous time step and the current input. For node i, its hidden state update at time step t is as follows: update the top-level hidden state from the previous time step. Compared with current observations The data is fed into an LSTM and processed through three layers of gated recurrent units before a new top-level hidden state is output. and the state of the entire cell layer. The initial hidden state of the model is obtained by forward propagation of the 15 historical steps of node i up to time t (dimension = 15), and is subsequently used as conditional information in CNF.

[0023] S32. Construct a causal condition vector by splicing together the vectors. When generating the next value in the CNF of each node, various relevant information needs to be concatenated into a condition vector. As a vector field Additional input. This conditional vector is composed of the following four parts concatenated along the feature dimension: (a) The hidden state of the LSTM top layer of node i at the previous time step (15 dimensions): It encodes all the historical dynamic information of the variable up to the current time step, including its overall trend of change.

[0024] (b) The original observation sequence of the past K=10 time steps (10-dimensional): provides CNF with a short-term window to observe recent fluctuations, enabling it to perceive sudden changes in values ​​or trend inflection points.

[0025] (c) The values ​​of all parent nodes at the current moment (|Pa(i)| dimension): The current state of the parent node is directly passed to the child node to ensure that there is no time delay in causal transmission. (Where |Pa(i)| represents the size of the set of parent nodes of node i.) (d) The top-level hidden states of all parent nodes in the LSTM (15×|Pa(i)| dimension): Unlike (c), which only transmits the value of the parent node at the current moment, (d) transmits the complete historical trajectory information of the parent node over the past dozens of steps. The total dimension after concatenation of the four paths is 15+10+|Pa(i)|+15×|Pa(i)|. For the daily gas production node (|Pa|=1), the conditional dimension is 15+10+1+15=41; for the bottom hole pressure node (|Pa|=2), the conditional dimension is 15+10+2+30=57; for the root node (|Pa|=0), only paths (a) and (b) are needed, with a dimension of 25. Experiments show that after adding the hidden state of the parent node in path (d), the prediction RMSE of the gas production node is reduced by about 5%~8%, verifying the effectiveness of the parent node's historical trajectory information in the generation of child nodes.

[0026] S33 and CNF forward encoding and reverse decoding; The core of CNF is a vector field parameterized by a 3-layer MLP (hidden layer dimension = 64). ,in The current state is given, and s∈[0,1] represents the normalized flow time. The conditional vector constructed for S3-2. This vector field defines two ODE integration paths. For ease of formula expression, Φ_θ is used below to denote the invertible mapping function defined by this CNF, and its parameter θ is the total weights and biases of the MLP vector field.

[0027] Forward process, which treats the forward process as a coding operation, is a function This means that, given a velocity field The forward process summarizes the hidden states of facts in the past observed factual data. Under these conditions, the observed factual results (At s=0) Pushed to the latent embedding (At s=1). Formally, Through this process Observation of facts The information is encoded.

[0028] The reverse process, viewed as a decoding operation, differs in its initialization methods for intervention prediction and counterfactual prediction. To predict the value of node i at time t, given a latent representation... It can be obtained by sampling from N(0,1) or by encoding fact samples. The reverse process is defined as: in (For observation or intervention prediction) or (Used for counterfactual prediction) represents the hidden state updated from the model's predicted values. Because or The values ​​generated or intervened from the model are updated autoregressively, carrying information about any past interventions applied to node i or its parent node. The ODE numerical integration uniformly adopts the RK4 method: 50 steps in the generation phase and 100 steps in the abductive phase—the latter, with its finer integration, aims to reduce noise extraction error, as this error is further amplified in subsequent decoding.

[0029] S34, Flow Matching Training Objective; Training loss: At the beginning of the prediction window, From context sequence Initialization. For subsequent steps... During training, in a hidden state Using observations Autoregressive update. The training loss is calculated over the entire prediction window. For each We will refer to the path Defined as training samples and Gorsky samples Linear interpolation between: in ; in, Represents the reference velocity field and the velocity field learned by the model. The aim is to approximate it. Therefore, training minimizes... and The square between Distance. Therefore, the training loss for the flow using conditional flow matching becomes: in Including velocity field The parameters of the RNN and the parameters of the RNN.

[0030] S4. Perform model training and convergence monitoring to determine the best fitting parameters; Training configuration: Adam optimizer (beta1=0.9, beta2=0.999), initial learning rate The system used a StepLR scheduler (decreasing by half every 10 epochs), a gradient pruning threshold of 1.0, a batch size of 128, and a total of 50 epochs for training. Teacher forcing was employed during training—the RNN receives real observations within the prediction window instead of the previous step's predictions as input, accelerating convergence. Standardized RMSE was calculated on the test set after each epoch, and model weights were saved every 5 epochs.

[0031] The evolution of the test set RMSE during 50 training rounds is shown in Table 1. The model converged to RMSE=1.4459 in the 10th epoch, and then oscillated between 1.4459 and 1.6433, exhibiting typical plateau characteristics in the later stages of training. Epoch 5 (RMSE=1.6433) was in the underfitting stage, while epoch 20 (RMSE=1.5626) showed slight overfitting. All subsequent experimental analyses were based on the model weights in epoch 10. ; Figure 1-4 The diagram illustrates the changes in prediction quality of the same test well (sample 0) across four training phases, visually reflecting the complete process of the model progressing from underfitting to optimality and then to overfitting. Note that the confidence intervals (green shading) for epochs 20 and 50 are significantly wider than those for epoch 10; this visual feature can serve as an auxiliary criterion for overfitting.

[0032] S5. Optimize shale gas well production by implementing observation and forecasting, intervention and forecasting, and counterfactual inference. After the model training converges, three different causal level prediction tasks can be performed. All three share the commonality of being generated node-by-node autoregressively along the topological order [0,1→2→3], with each step using the predicted value from the previous step to update the RNN hidden state and condition window. The differences lie in the noise sources of the CNF backward process and the way the node values ​​are set.

[0033] S51. Observation and prediction; Without any intervention, the system is allowed to evolve naturally according to its learned patterns. For each non-root node i, CNF starts from random noise z∼N(0,1), and... The predicted values ​​are obtained by reverse decoding under the given conditions. For the root nodes (wellhead oil pressure, casing pressure), they are also generated from random noise. The mean of 30 independent noise samples is used as the point prediction, and the 5% and 95% quantiles are used to construct the 90% confidence interval. Figure 5-8The observation and prediction results of three test wells are shown (blue line = historical context, orange line = actual future, green dashed line = predicted mean, green shading = 90% confidence interval). The predicted trajectory is consistent with the actual value in terms of trend. The accuracy is high in the short term (first two steps), but the long-term prediction deviates more due to the accumulation of autoregressive errors—this is a common characteristic of time series generation models.

[0034] S52, Intervention Prediction; Simulate a scenario of "changing the operating strategy from now on". The intervention node (the wellhead oil pressure of node 0 in the prediction window) is set to a fixed strategy value at each time step in the prediction window: 80% of the original value for a decrease in wellhead oil pressure, and 120% of the original value for a pressure increase. In topology prediction, when this node is encountered, CNF generation is not performed; instead, the intervention value is directly used to replace it, and its RNN state is updated with this value. Other non-intervention nodes are still generated via CNF according to the original causal conditions. Gray dashed line = natural evolution without intervention, red dashed line = predicted trajectory after intervention, red shading = 90% confidence interval. Figure 8-13 (3 wells each for depressurization and boosting) It can be seen that the daily gas production system under depressurization operation is higher than the observed trajectory, resulting in a large error. The reasons are as follows: the causal effect of depressurization / boosting in intervention prediction is not significant or the direction is unstable in some samples.

[0035] It can be seen that the daily gas production system under the pressure boosting operation is higher than the observed trajectory - the causal effect direction is consistent with the physical mechanism, and the model has learned the nonlinear response relationship between pressure and production (such as the narrowing of the production increase in the later stage of pressure boosting, reflecting the accelerated depletion effect of reservoir energy after the pressure difference is amplified).

[0036] S53, Counterfactual inference; Counterfactual inference employs a three-stage framework of abduction-action-prediction. Its essential difference from intervention-prediction lies in the fact that intervention-prediction only changes future operational strategies, while counterfactual inference requires re-analyzing historical trajectories and demands that the model extract unobservable exogenous noise from observed factual trajectories. The specific execution process is as follows.

[0037] The abductive phase involves feeding the observed trajectories into the forward process of CNF step by step, using the actual observed values ​​at each time step. As the starting point for positive integration, under the condition Integrate along the lower edge s:0→1 direction (RK4, 100 steps), the endpoint of the integration is the exogenous noise. The estimated value. This noise encapsulates "the random factors that cause this particular observation under given causal conditions". Action phase: Replace the values ​​of the intervention node (node ​​0) at each time step with counterfactual policy values ​​(depressurization by 20% or inflation by 20%). Prediction phase: For non-intervention nodes, use the noise extracted in the abductive phase. As the starting point for CNF inverse decoding, counterfactual trajectory values ​​are generated by inverse integration along the s:0→1 direction with the conditional vector incorporating the action modification. Preserving the exogenous noise z invariant is the core design principle—ensuring that the factual and counterfactual trajectories share the same set of unobservable stochastic driving factors, so that the difference between the two trajectories is attributed to the intervention itself, rather than the difference in random sampling.

[0038] Figure 14-19 The results of two counterfactual scenarios—depressurization and pressurization—are presented on three test wells. The gray dashed line represents the observed trajectory (factual), and the purple dashed line represents the counterfactual predicted trajectory (hypothetical result). Theoretically, the daily gas production of the counterfactual trajectory should be systematically lower than the actual production under the depressurization scenario and systematically higher than the actual production under the pressurization scenario.

[0039] The effectiveness of counterfactual inference is constrained by the following factors. Daily gas production is at the very end of the causal chain. A ±20% change in oil pressure requires transmission through two layers: the bottomhole flowing pressure CNF and the daily gas CNF. Prediction deviations at each upstream step are propagated downwards and amplified layer by layer. Counterfactual inference adds an extra abductive stage (100 steps of ODE positive integration) compared to intervention prediction. This stage itself also has extraction errors. When the three errors are superimposed and reach the gas production node, the intervention signal has been severely diluted by noise. Furthermore, the standardized RMSE of daily gas production is 2.32, approximately twice that of the pressure variable (0.99~1.38). Insufficient single-step prediction accuracy directly limits the identifiability of the intervention effect. A regular phenomenon can be observed in the charts: there is still a certain distance between the gray and purple lines in the bottomhole flowing pressure sub-chart, indicating that the flowing pressure did indeed respond after the oil pressure change, and the causal transmission is still effective at this layer; while in the daily gas production and wellhead casing pressure sub-charts, the two lines basically overlap. The overlap of daily gas production is due to the aforementioned error accumulation effect, while the overlap of wellhead casing pressure is a normal phenomenon—the casing pressure is not a downstream node of the oil pressure in the causal diagram, and there is no causal relationship between oil pressure changes and casing pressure. Therefore, regardless of intervention, the casing pressure trajectory should not change, and this overlap precisely confirms the correctness of the causal DAG direction.

[0040] To address the above issues, the optimization direction is as follows: incorporate more static geological and engineering parameters that affect production into the causal graph, enabling the model to distinguish the essential differences between different wells. Currently, the information content of the four dynamic variables is approaching saturation, and the RMSE is stagnating around 1.45. Static parameters are the key way to break through this information bottleneck.

[0041] Ablation verification of window parameters To verify the rationality of the window parameter selection in step S2, a comparison was made between the control configuration (30 context steps, 16 prediction steps, only one window per well, approximately 113 training samples) and the current configuration (15 context steps, 8 prediction steps, 24 windows per well, 2712 training samples). Experimental results show that the current configuration improves the RMSE (1.4459) at the optimal epoch by 49.1% compared to the control configuration (2.8421). The control configuration, with only approximately 113 training samples, is far from sufficient to support the effective training of a deep network containing 8 LSTMs and 4 CNFs, leading to severe underfitting. The current configuration, through the combined design of "short context + sliding window," expands the effective sample size by 24 times, which is the core technical means for the model to be successfully trained in industrial-grade small-sample scenarios. ; ; Table 3 compares this approach with three commonly used methods in the field from a functional perspective. Compared to Arps diminishing returns analysis, this approach additionally provides the ability to incorporate operational variables, intervention prediction, and counterfactual inference. Compared to numerical simulation, this approach improves computational speed by 3-4 orders of magnitude. Compared to pure LSTM predictors, this invention, through the embedding of a causal DAG, allows the model to make directionally correct yield predictions even under stress conditions not encountered during training, since the generation process follows the physical causal direction, unlike pure correlation models which fail with out-of-distribution inputs.

[0042] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.

Claims

1. A method for predicting shale gas well production based on a causal flow model, characterized in that, Includes the following steps: S1. Based on the theory of multiphase flow and node analysis in shale gas wellbore, construct a domain causal graph for gas well production; S2. Based on the original dataset of the monitored variables, construct time series samples based on a multi-well sliding window. S3. For each monitored variable, construct the corresponding RNN encoder and CNF generator; S4. Perform model training and convergence monitoring to determine the best fitting parameters; S5. Execute observation and prediction, intervention and prediction and counterfactual inference to optimize shale gas well production.

2. The shale gas well production prediction method according to claim 1, characterized in that, Step S1 includes: S11. Select monitoring variables to determine the direction of causal nodes and edges; S12. Determine the intervention variables.

3. The shale gas well production prediction method according to claim 2, characterized in that, In step S11: The selected monitoring variables include wellhead oil pressure, wellhead casing pressure, bottom hole flowing pressure, and daily gas production.

4. The shale gas well production prediction method according to claim 3, characterized in that, In step S11: The wellhead oil pressure is determined as node 0, the wellhead casing pressure as node 1, the bottom hole flowing pressure as node 2, and the daily gas production as node 3. During prediction, the nodes are executed in the topological order [0,1,2,3] or [1,0,2,3].

5. The shale gas well production prediction method according to claim 1, characterized in that, Step S2 includes: S21. Obtain the original dataset of the actual measured monitoring variables, perform standardization processing, and slide the data of each well in the time dimension with a preset step size to generate a sliding window sample. S22. Perform an inverse transformation on the sliding window sample data of the monitored variables to restore them to the physical units of the original monitoring data.

6. The shale gas well production prediction method according to claim 1, characterized in that, Step S3 includes: S31, Update the hidden state of the RNN; S32. Construct a causal condition vector by splicing together the vectors. S33 and CNF forward encoding and reverse decoding; S34, Flow Matching Training Objective.

7. The shale gas well production prediction method according to claim 1, characterized in that, Step S31 updates the RNN hidden state, including: for node i, the hidden state update method at time step t is: update the top-level hidden state of the previous time step. Compared with current observations The data is fed into an LSTM and processed through three layers of gated recurrent units before a new top-level hidden state is output. and the state of the entire cell layer; In step S32, a causal condition vector is constructed by splicing together the following: the hidden state of the LSTM top layer of node i at the previous time step, the original observation sequence of the preset time steps in the past, the values ​​of all parent nodes at the current time step, and the hidden state of the LSTM top layer of all parent nodes. The forward encoding and reverse decoding of CNF in S33 include: the forward encoding process is performed by a function This means that, given a velocity field The forward process summarizes the hidden states of facts in the past observed factual data. Under these conditions, the observed factual results Push to potential embeds : ; in, For the latent embedding, Φ_θ is the invertible mapping function defined by CNF. For observed factual results, To conceal the truth For the velocity field, The current state is represented by s, where s is the normalized flow time. The reverse decoding process is defined by the function: ; in, For potential representation, The hidden state is updated from the model's predicted values; Preferably, the Flow Matching training objective in step S34 includes: at the beginning of the prediction window, From context sequence Initialization; for subsequent steps During training, in a hidden state Using observations Autoregressive updates; training loss is calculated over the entire prediction window.

8. The shale gas well production prediction method according to claim 1, characterized in that, Step S4 includes: the RNN receives the actual observations instead of the predicted values ​​from the previous step as input within the prediction window to accelerate convergence.

9. An electronic device, characterized in that, It includes: At least one processor; Memory; At least one application, wherein the at least one application is stored in the memory and configured to be executed by the at least one processor, the at least one application being used to execute the shale gas well production prediction method according to any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed in the computer, the computer is instructed to perform the shale gas well production prediction method according to any one of claims 1 to 8.