Physical information neural network-based heavy oil thermal recovery corrosion prediction method and system

By using a physical information neural network-based approach, combined with multi-physics field coupled control equations and multi-branch neural networks, the problem of strong coupling of multiple factors in the corrosion prediction model of heavy oil thermal recovery wells was solved. This approach enabled high-precision and interpretable corrosion rate prediction, guiding material selection and steam injection process design for heavy oil thermal recovery wells.

CN122389652APending Publication Date: 2026-07-14CNOOC ENERGY TECHNOLOGY & SERVICES LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CNOOC ENERGY TECHNOLOGY & SERVICES LTD
Filing Date
2026-06-04
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing corrosion prediction models are difficult to adapt to nonlinear conditions with strong coupling of multiple factors during heavy oil thermal recovery. They suffer from problems such as strong dependence on training samples, poor generalization ability, and insufficient interpretability. In particular, they lack sufficient measured data to support their predictions under extreme high-temperature conditions, resulting in low prediction accuracy and limited engineering applicability.

Method used

By employing a physical information neural network-based approach, combining multi-physics coupled control equations and a multi-branch neural network, and through gradient normalization adaptive training, the weight ratio of data-driven loss and physical-driven loss is dynamically adjusted to achieve accurate and interpretable prediction of corrosion rate.

Benefits of technology

It enables high-precision corrosion rate prediction in heavy oil thermal recovery wells, adapts to complex and variable working conditions, provides a scientific basis for corrosion protection, reduces the risk of corrosion failure, and improves the safety and economy of oilfield development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122389652A_ABST
    Figure CN122389652A_ABST
Patent Text Reader

Abstract

The application discloses a heavy oil thermal recovery corrosion prediction method and system based on a physical information neural network, and comprises the following steps: data acquisition and preprocessing, construction of a multi-physical field coupling control equation set, construction of a multi-branch physical information neural network, construction of a double-driving joint loss function, gradient normalization adaptive training, model training, corrosion prediction and engineering application. The application solves the problems of a traditional machine learning model, such as strong dependence on training samples, weak generalization ability and poor physical interpretability, and can provide a scientific basis for material selection of a heavy oil thermal recovery well, design of steam injection process parameters and selection of corrosion prevention agents, so that source corrosion prevention is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of corrosion prediction technology in oil and gas field development, and in particular relates to a corrosion prediction method and system for heavy oil thermal recovery based on physical information neural networks. Background Technology

[0002] During the thermal recovery of heavy oil, the injection of high-temperature steam can place the wellbore in a harsh environment of 370°C and 21 MPa, while the formation water contains a high concentration of Cl. - It reacts with various corrosive media, such as H2S (1000-18000 mg / L), H2S (1000-10000 ppm), and dissolved oxygen (0-1%), to form a typical H2S-O2-CO2-Cl group. - A corrosion system with multiple corrosive factors coexisting. In this environment, tubing materials are prone to various failure modes such as uniform corrosion, pitting corrosion, and stress corrosion cracking, which seriously affect wellbore integrity and safe production.

[0003] Existing corrosion prediction models mainly include empirical formula methods (such as the De Waard model), semi-empirical electrochemical models, and purely data-driven machine learning models. However, the former is difficult to adapt to nonlinear operating conditions with strong coupling of multiple factors, while the latter suffers from problems such as strong dependence on training samples, poor generalization ability, and insufficient interpretability. In particular, it lacks sufficient measured data to support its predictions under extreme high-temperature conditions, resulting in low prediction accuracy and limited engineering applicability.

[0004] Therefore, there is an urgent need for a new intelligent prediction method that integrates physical mechanisms and data characteristics to achieve high-precision and robust modeling of the complex corrosive environment of heavy oil thermal recovery wells, which can serve the selection of materials, optimization of processes and screening of anti-corrosion agents. Summary of the Invention

[0005] The problem this invention aims to solve is to provide a method and system for predicting corrosion in heavy oil thermal recovery based on physical information neural networks. This method combines physical information neural networks with H2S-O2-Cl... - The coupling corrosion mechanism of the ion system enables accurate and interpretable prediction of corrosion rate, providing a scientific basis for corrosion protection of heavy oil thermal recovery wells.

[0006] To solve the above-mentioned technical problems, the technical solution adopted by this invention is: a heavy oil thermal recovery corrosion prediction method based on physical information neural networks, comprising the following steps: S1: Data Acquisition and Preprocessing: Acquire material composition data, environmental parameter data, and corrosion test data under heavy oil thermal recovery well conditions, and perform normalization and standardization processing; S2: Constructing a multiphysics coupled control equation set: Establishing a system of H2S-CO2-Cl equations specifically for heavy oil thermal recovery wells. -The physical governing equations for the multi-factor coupled corrosion mechanism of ion systems include at least the improved Allen-Cahn phase field evolution equation and the mass transfer diffusion-reaction equation. S3: Construct a multi-branch physical information neural network, including a material composition encoding branch, an environmental parameter encoding branch, a feature fusion layer, and a multi-task output layer; S4: Construct a dual-driven joint loss function: Design a total loss function that includes data-driven loss and physical-driven loss; S5: Gradient Normalization Adaptive Training: Gradient normalization is used to balance the contributions of different loss terms, and gradient pruning and adaptive learning rate scheduling are implemented to complete model training. S6: Model Training: An adaptive weight adjustment strategy is adopted to dynamically adjust the weight ratio of data-driven loss and physics-driven loss during the training process to complete the training of the multi-branch physical information neural network. S7: Corrosion Prediction and Engineering Application: Input the operating parameters of the target heavy oil thermal recovery well into the trained multi-branch physical information neural network, and output the corrosion rate prediction results to guide the material selection and steam injection process parameter design of the heavy oil thermal recovery well.

[0007] Furthermore, S1 includes the following steps: S11: Collect the material composition data of the alloy to be tested, which includes 11 elements: Fe, Cr, Ni, Ti, O, C, Al, N, Cu, Mn, and Si. S12: Collect environmental parameter data representing the corrosive environment characteristics of heavy oil thermal recovery wells, including temperature, pressure, hydrogen sulfide partial pressure, chloride ion concentration, oxygen concentration, and carbon dioxide partial pressure. S13: Collect the corrosion experiment data, which includes corrosion rate and corrosion depth; S14: Normalize the material composition data by dividing the mass percentage by 100 to convert it to the [0,1] range; S15: Perform Z-score normalization on the environmental parameter data: x norm =(x-μ) / σ, where μ is the mean and σ is the standard deviation; S16: Divide the dataset into training and validation sets in an 8:2 ratio.

[0008] Furthermore, in S2, the improved Allen-Cahn phase-field evolution equation is: In the formula, φ is the phase field variable, φ=0 represents the metallic phase, and φ=1 represents the corrosion product phase; L(T) is the temperature-dependent interfacial mobility; f'(φ)=2φ(1-φ)(1-2φ) is the derivative of the double potential well function; κ is the gradient energy coefficient; φ is the spatial second derivative of the phase field variable; g(c,φ)=0.1×c×(1-φ) is the concentration-phase field coupling term.

[0009] Furthermore, in S2, the mass transfer diffusion-reaction equation is: In the formula, denoted as , where is the rate of change of concentration over time; D(T) is the temperature-dependent diffusion coefficient. R is the spatial second derivative of concentration; R(c,T) is the reaction rate term.

[0010] Furthermore, in S2, the physical control equation set also includes the Arrhenius temperature dependence equation, the general corrosion rate equation, the hydrogen sulfide corrosion kinetic equation, and the oxygen corrosion equation; the general corrosion rate equation introduces the protection coefficients of Cr and Ni and the promoting coefficient of Cl; the hydrogen sulfide corrosion kinetic equation introduces Cr content and Fe content as parameters; the oxygen corrosion equation introduces Cr content and Ni content as parameters.

[0011] Furthermore, in S3, both the material composition encoding branch and the environmental parameter encoding branch adopt a two-layer fully connected network containing layer normalization and hyperbolic tangent activation function, outputting a 64-dimensional feature vector; It also includes a random Fourier transform branch, which generates 256-dimensional high-frequency features by performing a random Fourier transform on the original 17-dimensional input data; The feature fusion layer stitches together material features, environmental features, and Fourier features, and then compresses them to 256 dimensions through a fully connected network. The multi-branch physical information neural network also includes a physical-guided attention mechanism, which calculates attention weights by generating query, key, and value vectors and outputs them through residual connections.

[0012] Furthermore, in S3, the multi-task output layer includes: The corrosion rate output head uses the Softplus activation function to ensure that the output is non-negative. The erosion depth output head uses the Softplus activation function. The phase field variable output header uses the Sigmoid activation function to restrict the output to the [0,1] interval; The concentration field output head uses the Softplus activation function.

[0013] Furthermore, in S4, the physical driving loss includes: Corrosion rate physical consistency loss: Calculate the difference between the total corrosion rate predicted by the neural network and the sum of the rates of each corrosion mechanism calculated from the physical equations; Phase field smoothness loss is calculated by determining the difference in phase field variables between adjacent samples within a batch. The expression is: L smooth =MSE(φ[i+1] - φ[i]); Where i = 1 to (N-1), and N is the number of samples in the batch. This represents the predicted value of the phase field variable for the i-th sample within the batch. Depth-rate consistency loss: There is a time integral relationship between corrosion depth and corrosion rate, expressed as: In the formula, d pred v is the predicted corrosion depth. pred t is the predicted corrosion rate. ref This is a preset reference time period; Loss on reasonableness of concentration: When the predicted concentration exceeds twice the maximum possible concentration in the environment, the mean square error of the excess portion is calculated.

[0014] Furthermore, in S4, a dynamic adjustment strategy for the weights of data loss and physical loss during training is designed. The training process of this adjustment strategy is divided into three stages: In the early stages, with training progress at 0-30%, the weight of data-driven loss is set to 0.9, and the weight of physics-driven loss is set to 0.1. In the mid-term, with training progress at 30-70%, the weight of data loss linearly decreases from 0.9 to 0.5, while the weight of physical loss linearly increases from 0.1 to 0.5. In the later stages, when the training progress is 70-100%, the weight of data loss is reduced from 0.5 to 0.4, and the weight of physical loss is increased from 0.5 to 0.6.

[0015] Furthermore, the present invention also provides a heavy oil thermal recovery corrosion prediction system based on physical information neural networks, which, when running the above-mentioned heavy oil thermal recovery corrosion prediction method based on physical information neural networks, includes: The data acquisition and preprocessing module is used to acquire and process material composition data, environmental parameter data, and corrosion test data. The physical control equations construction module is used to establish a multi-physics field coupled control equations system that includes the improved Allen-Cahn phase field evolution equations and mass transfer diffusion-reaction equations. The multi-branch physical information neural network module is used to receive preprocessed data and output predicted values ​​of corrosion rate, corrosion depth, phase field variables and concentration field. The dual-drive joint loss function construction module is used to design an adaptive weighted total loss function that includes data-driven loss and physics-driven loss; The model training module is used to train the neural network using an adaptive training strategy with gradient normalization. The corrosion prediction and engineering application module is used to output corrosion prediction results and guide engineering decisions.

[0016] The advantages and positive effects of this invention are: 1. This invention reveals for the first time the corrosion characteristics of different alloy materials under heavy oil thermal conditions, clarifies the influence of various environmental and material factors on corrosion, and provides solid theoretical support for corrosion rate prediction.

[0017] 2. The physical information neural network corrosion prediction model constructed in this invention integrates corrosion kinetic equations and physical laws into model constraints and loss functions, solving the three major problems of traditional machine learning models: "dependence on training samples, weak generalization ability, and poor interpretability". It can achieve high-precision prediction with only a small amount of high-temperature and high-pressure laboratory data, and is suitable for the complex and variable working conditions of heavy oil thermal recovery wells.

[0018] 3. This invention achieves effective adaptation between oilfield on-site production monitoring data and corrosion prediction models. The developed model algorithm is easy to operate and can quickly predict corrosion rates under different materials and working conditions. It provides direct technical guidance for material selection, steam injection process design, and anti-corrosion agent screening for heavy oil thermal recovery wells, reducing the risk of corrosion failure and improving the safety and economy of oilfield development.

[0019] 4. The prediction method of this invention adopts standardized experimental procedures and data processing methods, follows relevant national and industry standards, and the model training and prediction process is reproducible and verifiable. It has broad application value and can be applied to the prediction of corrosion rate of heavy oil thermal recovery wells in different oil fields and under different working conditions. Attached Figure Description

[0020] Figure 1 This is a schematic diagram of the overall process of an embodiment of the present invention. Detailed Implementation

[0021] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0022] The embodiments of the present invention will be further described below with reference to the accompanying drawings: like Figure 1As shown, the corrosion prediction method for heavy oil thermal recovery based on physical information neural networks includes the following steps.

[0023] S1: Data Acquisition and Preprocessing: Acquire material composition data, environmental parameter data, and corrosion test data under heavy oil thermal recovery well conditions, and perform normalization and standardization processing. Specifically, S1 includes the following steps.

[0024] S11: Collect material composition data of the alloy to be tested, including 11 elements such as Fe, Cr, Ni, Ti, O, C, Al, N, Cu, Mn, and Si. The content of these elements directly affects the corrosion resistance of the material.

[0025] S12: Collect environmental parameter data that can represent the corrosive environment characteristics of heavy oil thermal recovery wells, mainly including temperature (T, unit °C), pressure (P, unit MPa), hydrogen sulfide partial pressure (PH2S, unit ppm), chloride ion concentration (CCl, unit mg / L), oxygen concentration (CO2, unit mg / L), and carbon dioxide partial pressure (PCO2, unit MPa).

[0026] S13: Collect corrosion test data, including corrosion rate (vcorr, unit mm / year) and corrosion depth (dcorr, unit mm), which can reflect the situation of uniform corrosion and localized corrosion.

[0027] S14: Normalize the material composition data by dividing the mass percentage by 100 to convert it to the [0,1] range.

[0028] S15: Perform Z-score normalization on environmental parameter data: x norm =(x-μ) / σ, where μ is the mean and σ is the standard deviation; S16: Divide the dataset into training and validation sets in an 8:2 ratio.

[0029] S2: Constructing a multiphysics coupled control equation set: Establishing a system of H2S-CO2-Cl equations specifically for heavy oil thermal recovery wells. - The physical governing equations for the multi-factor coupled corrosion mechanism of ion systems. Specifically, S2 includes the following steps.

[0030] S21: First, establish the mathematical relationship between temperature (T, °C) and corrosion reaction rate (vcorr, dcorr). According to chemical kinetics theory, the corrosion reaction rate increases exponentially with increasing temperature, a relationship described by the Arrhenius equation.

[0031] S22: Establish a general corrosion rate equation.

[0032] A rate equation describing the basic electrochemical corrosion process in heavy oil thermal recovery wells was established. The coefficients in this equation, such as the protection coefficient for chromium (0.15), the protection coefficient for nickel (0.12), and the promoting coefficient for chloride ions (0.08), were all determined based on experimental data and empirical formulas in the field of corrosion and have clear physical meaning.

[0033] S23: Establish the H2S corrosion kinetic equation.

[0034] An equation was established to specifically describe the corrosion process caused by hydrogen sulfide. This equation describes the following rules: the corrosion rate is proportional to the square root of the partial pressure of hydrogen sulfide; increasing the chromium content can significantly reduce hydrogen sulfide corrosion; and the iron content directly affects the number of active sites that can undergo sulfidation reactions.

[0035] S24: Establish the oxygen corrosion equation.

[0036] An equation describing the depolarization corrosion process induced by dissolved oxygen was established. This equation shows that the corrosion rate is directly proportional to the dissolved oxygen concentration and normalized to the saturated oxygen concentration. Chromium and nickel can form a dense oxide passivation film on the metal surface, significantly reducing the oxygen diffusion rate and electrode reaction rate; therefore, the higher their content, the lower the oxygen corrosion rate.

[0037] S25: Establish the carbon dioxide corrosion equation.

[0038] A kinetic equation describing carbon dioxide corrosion was established using a modified de Waard-Milliams model. Carbon dioxide dissolves in water to form carbonic acid, lowering the solution pH and leading to acidic corrosion. Simultaneously, the formation and dissolution of the corrosion product ferrous carbonate also affect the corrosion rate.

[0039] S26: Establish the improved Allen-Cahn phase field evolution equation.

[0040] Phase-field theory is introduced to describe the spatiotemporal evolution of the corrosion interface. The phase-field variable φ is used as an order parameter to distinguish between the metallic phase and the corrosion product phase: when φ equals zero, it represents the complete metallic phase; when φ equals one, it represents the complete corrosion product phase; and when φ is between zero and one, it represents the diffusion interface region.

[0041] Specifically, the improved Allen-Cahn phase field evolution equation is as follows: In the formula, φ is the phase field variable (φ=0 represents the metallic phase, φ=1 represents the corrosion product phase), used to distinguish different material phases and characterize the position and thickness of the corrosion interface; L(T) is the temperature-dependent interface mobility, reflecting the difficulty of interface movement; f'(φ)=2φ(1-φ)(1-2φ) is the derivative of the double potential well function, ensuring that the phase field variable switches between stable values ​​and providing the thermodynamic driving force for phase transition; κ is used to suppress drastic changes in the phase field variable and make the interface transition smoothly. In this model, κ=0.01 is the gradient energy coefficient. φ is the spatial second derivative of the phase field variable, describing the geometric characteristics of the interface; g(c,φ)=0.1×c×(1-φ) is the concentration-phase field coupling term, describing the effect of the concentration of the corrosive medium on the phase transition.

[0042] S27: Establish the mass transfer diffusion-reaction equation.

[0043] An equation describing the transport and consumption of corrosive media in solution is established. This equation is a diffusion-reaction equation, where the left side represents the rate of change of concentration over time, the first term on the right side represents the diffusion process driven by the concentration gradient as described by Fick's diffusion law, and the second term represents the consumption of the media by the corrosion reaction.

[0044] Specifically, the mass transfer-diffusion-reaction equation is: Describes the transport of corrosive ions or dissolved oxygen. In the formula, denoted as , where is the rate of change of concentration over time; D(T) is the temperature-dependent diffusion coefficient. R is the spatial second derivative of the concentration, representing the spatial variation of the concentration gradient; R(c,T) is the reaction rate term, describing the consumption of reactants by the corrosion reaction.

[0045] S28: Establish physical consistency constraints for the total corrosion rate.

[0046] A constraint is established to establish the relationship between the total corrosion rate and the rates of each corrosion mechanism. This constraint equation ensures that the total corrosion rate predicted by the neural network is equal to the sum of the corrosion rates of each individual mechanism.

[0047] S3: Construct a multi-branch physical information neural network: This includes a material composition encoding branch, an environmental parameter encoding branch, a feature fusion layer, and a multi-task output layer. The multi-task output layer outputs at least the predicted corrosion rate, predicted corrosion depth, and predicted phase field variables. This step constructs a specially designed deep neural network architecture optimized for corrosion prediction, capable of effectively extracting material and environmental features and outputting multiple corrosion-related prediction results. Specifically, S3 includes the following steps: S31: Design the input layer.

[0048] The network's input layer receives two types of input data. The first type is material composition data, containing the content of 11 elements, forming an 11-dimensional vector. The second type is environmental parameter data, containing 6 operating condition parameters, forming a 6-dimensional vector. These two types of data are concatenated to form a 17-dimensional total input vector.

[0049] S32: Design feature encoding layer.

[0050] Design a branch coding structure to extract and encode features for material composition and environmental parameters respectively.

[0051] For the material composition encoding branch, a two-layer fully connected network is used to perform a nonlinear transformation on the material composition data. The first layer maps the eleven-dimensional input to a sixty-four-dimensional hidden space, and the second layer further extracts features in the 64-dimensional space. Each layer is followed by layer normalization and a hyperbolic tangent activation function. Layer normalization accelerates training convergence, while the hyperbolic tangent function introduces nonlinearity, enabling the network to learn complex feature relationships. The final output is a 64-dimensional material feature vector, which encodes the interactions between material components and their combined impact on corrosion.

[0052] For the environmental parameter encoding branch, the same network structure is used to map the 6-dimensional environmental input to a 64-dimensional environmental feature space through a two-layer fully connected network.

[0053] For the original 17-dimensional input data, additional features are generated through a random Fourier transform. Specifically, a random Gaussian matrix is ​​generated, the input vector is multiplied by this matrix, and then the cosine and sine function values ​​are calculated to map the input to a higher-dimensional feature space (256 dimensions), enabling the network to better learn the high-frequency nonlinear relationship between the input and output.

[0054] S33: Design Feature Fusion Layer.

[0055] The output vectors from the three branches—material features, environmental features, and Fourier features—are concatenated to form a 284-dimensional comprehensive feature vector. This vector is then compressed to 256 dimensions through a fully connected network layer, followed by layer normalization and activation function processing. This fusion process enables the interaction and integration between different types of features, allowing the network to learn the complex relationships between materials, environment, and physical processes.

[0056] S34: Design a physical attention-guided mechanism.

[0057] The fused features are transformed into three vectors—Query, Key, and Value—through three different linear transformations. Attention weights, representing the strength of association between different features, are obtained by calculating the similarity between the query and key. These weights are then used to weight and sum the value vectors to obtain the attention output. Finally, the attention output is added to the original features through a residual connection, preserving the original information while incorporating the associations between features. This allows the model to automatically identify which material components or environmental factors have the greatest impact on corrosion, thus achieving physics-guided feature learning.

[0058] S35: Design a deep feature extraction layer.

[0059] A 6-layer deep hidden network was designed, with each layer containing 256 neurons. Each layer is a fully connected structure, followed by normalization, hyperbolic tangent activation, and dropout regularization. Dropout randomly discards some neurons with a probability of 0.1 to prevent overfitting.

[0060] S36: Design a multi-task output layer.

[0061] Four independent output heads are designed to predict four different target variables, thereby achieving multi-task learning.

[0062] The corrosion rate output head predicts the corrosion rate of metals, in mm / a. The Softplus activation function is used to ensure that the output value is non-negative, consistent with the physical meaning of corrosion rate.

[0063] The corrosion depth output head predicts the cumulative corrosion depth of the metal, in mm. The network structure is the same as the corrosion rate head, and it also uses the Softplus activation function to ensure non-negative output.

[0064] The phase-field variable output header predicts the phase-field variables describing the corrosion interface, with values ​​ranging from zero to one. The Sigmoid activation function is used to restrict the output to the interval between zero and one, corresponding to the transition from the metallic phase to the corrosion product phase.

[0065] The concentration field output head predicts the concentration distribution of corrosive media near the metal surface. The network structure is similar to that of the corrosion rate head, and the Softplus activation function is used to ensure that the concentration predictions are non-negative.

[0066] S4: Constructing the Dual-Driven Joint Loss Function: Designing a total loss function that includes both data-driven and physics-driven losses. Specifically, S4 includes the following steps: S41: Design a data-driven loss function.

[0067] A loss function based on experimental data is designed to evaluate the deviation between model predictions and actual measurements. For each predicted target (corrosion rate, corrosion depth, phase field variable, concentration field), the error between the predicted value and the actual value is calculated.

[0068] Error calculation employs a weighted combination of mean squared error (MSE) and mean absolute error (MAE), with MSE accounting for 70% and MAE for 30%. The advantages of this combination are: MSE penalizes large errors more severely, quickly reducing major biases; and MAE is more robust to outliers, improving model stability.

[0069] Different weights were assigned to different prediction targets. Corrosion rate was the most important prediction target, with a weight of 1.0; corrosion depth had a weight of 0.8; and phase field variables and concentration field variables both had a weight of 0.3.

[0070] S42: Design the physics-driven loss function.

[0071] A loss function based on physical equations is designed to constrain the model's predictions to conform to physical laws. This loss function consists of four components: First, the physical consistency loss of corrosion rate. This involves calculating the difference between the total corrosion rate predicted by the neural network and the sum of the rates of each corrosion mechanism calculated based on the physical equations. Specifically, the material composition and environmental parameters predicted by the model are substituted into the physical equations established in S2 to calculate the theoretical rates of general corrosion, hydrogen sulfide corrosion, carbon dioxide corrosion, and oxygen corrosion, respectively. The sum of these rates is then compared with the corrosion rate predicted by the neural network. The mean square error between the two constitutes the physical consistency loss.

[0072] Second, the phase-field smoothness loss. This involves calculating the difference in phase-field variables between adjacent samples within a batch. Since phase-field variables describe spatially continuous physical quantities, the phase-field values ​​of adjacent samples should not change abruptly. Therefore, the mean square error of the difference in phase-field values ​​between adjacent samples is calculated as the smoothness loss. This loss term constrains the spatial continuity of the phase-field variables, which conforms to the basic requirements of phase-field theory.

[0073] Specifically, the expression for phase field smoothness loss is: L smooth = MSE(φ[i+1] - φ[i]); Where: i = 1 ~ (N-1).

[0074] In the formula, N is the number of samples in the batch. This is the predicted value of the phase field variable for the i-th sample in the batch, used to constrain the continuity of the phase field variable.

[0075] Third, the loss of depth-rate consistency. There is a time integral relationship between corrosion depth and corrosion rate, that is, depth is approximately equal to rate multiplied by time.

[0076] The expression for depth-rate consistency loss is: In the formula: d pred v is the predicted corrosion depth. pred t is the predicted corrosion rate. ref This is the preset reference time period.

[0077] Fourth, loss of concentration reasonableness. The concentration of the corrosive medium should not exceed the maximum possible concentration in the environment. Taking the maximum values ​​of chloride ion concentration, oxygen concentration, and hydrogen sulfide partial pressure as a reference, if the predicted concentration exceeds twice this reference value, the mean square error of the excess portion is calculated. This loss term constrains the physical reasonableness of the concentration prediction.

[0078] Different weights were assigned to the four physical loss components: physical consistency was weighted at 1.0 (most important); smoothness at 0.1; depth consistency at 0.5; and concentration rationality at 0.2. The four components were then weighted and summed to obtain the total physical driving loss.

[0079] S43: Design an adaptive weight adjustment strategy.

[0080] Design a dynamic adjustment strategy for the weights of data loss and physical loss during the training process.

[0081] The training process is divided into three phases. In the early phase (training progress 0-30%), the data-driven loss weight is set to 0.9, and the physics-driven loss weight is set to 0.1. The goal of this phase is to allow the model to quickly learn the basic patterns of the data and establish preliminary predictive capabilities. Applying strong physical constraints too early may lead to training difficulties in convergence.

[0082] In the mid-stage (training progress 30-70%), the weight ratios are gradually adjusted: the data loss weight is linearly reduced from 0.9 to 0.5, while the physics loss weight is linearly increased from 0.1 to 0.5. This stage gradually introduces physical constraints to guide the model in learning the underlying physical laws of the data, thereby improving the model's generalization ability.

[0083] In the later stages (training progress 70-100%), the weights are further adjusted: the weight for data loss is reduced from 0.5 to 0.4, and the weight for physical loss is increased from 0.5 to 0.6. This stage strengthens physical constraints to ensure that the final model's predictions strictly conform to physical laws, thereby improving the reliability of extrapolation predictions.

[0084] The total loss function is defined as a weighted sum of data loss and physical loss, with the weights adaptively adjusted as training progresses. This gradual weight adjustment strategy balances data fitting and physical constraints, and is key to achieving high-accuracy and high-reliability predictions.

[0085] S5: Gradient Normalization Adaptive Training. This step designs the model's training algorithm, employing various optimization techniques to ensure a stable and efficient training process. Specifically, S5 includes the following steps: S51: Optimizer configuration.

[0086] The Adam optimization algorithm is used, with an initial learning rate of 0.001. L2 regularization is also introduced with a regularization coefficient of 0.00001 to prevent overfitting by penalizing excessively large weight values.

[0087] S52: Gradient normalization weight balancing.

[0088] Gradient normalization is implemented to dynamically balance the contributions of different loss terms. In each training iteration, the gradients of each loss term (data loss, physical loss, etc.) with respect to the network parameters are calculated, and the L2 norm of each gradient is calculated. Then, based on the average gradient norm of all loss terms, the normalized weight that each loss term should have is calculated, which is the average gradient norm divided by the gradient norm of that loss term.

[0089] To avoid drastic fluctuations in weights, an exponential moving average method is used to smooth weight updates. The current weight is equal to the previous weight multiplied by 0.5, plus the currently calculated normalized weight multiplied by 0.5.

[0090] S53: Gradient clipping.

[0091] Gradient clipping is implemented to prevent gradient explosion. During backpropagation, the gradient of the total loss with respect to all network parameters is calculated, and then the L2 norm of the gradient is calculated. If the gradient norm exceeds a preset threshold (set to 1.0), the gradient is scaled proportionally so that its norm equals the threshold.

[0092] S54: Learning rate adaptive scheduling.

[0093] An adaptive learning rate adjustment strategy is adopted to monitor the change in loss value on the validation set. If the validation loss does not decrease within 20 consecutive training cycles, the learning rate is reduced to half of its original value.

[0094] S55: Early Stop Mechanism.

[0095] An early stopping mechanism is implemented to prevent overfitting. During training, the validation set loss is continuously monitored. Whenever the validation loss reaches its historical minimum, the current model parameters are saved. If the validation loss does not decrease for fifty consecutive training epochs, the model is considered overfitted, training is stopped, and the previously saved best model is loaded.

[0096] S6: Model Training: An adaptive weight adjustment strategy is adopted to dynamically adjust the weight ratio of data-driven loss and physics-driven loss during training to complete the training of the multi-branch physical information neural network. This step executes the actual training process of the model and verifies the performance of the trained model. Specifically, S6 includes the following steps: S61: Set up batch training.

[0097] The training data is divided into small batches for training, with each batch containing 32 samples.

[0098] S62: Forward Propagation and Loss Calculation.

[0099] For each batch of training data, perform the following steps: First, the material composition and environmental parameters within the batch are input into the neural network, and four predicted outputs are obtained through forward propagation: corrosion rate, corrosion depth, phase field variable, and concentration field.

[0100] Secondly, the predicted material composition and environmental parameters are substituted into the physical equation established by S2 to calculate the theoretical corrosion rate based on the physical model.

[0101] Finally, the weights are determined based on the current training progress, and the data loss and physical loss are weighted and summed to obtain the total loss.

[0102] S63: Backpropagation and parameter update.

[0103] Based on the calculated total loss, the backpropagation algorithm is executed to calculate the gradient of the loss with respect to all network parameters. Parameters are updated after each batch of training is completed. A training cycle is completed when all batches of the entire training set have been trained.

[0104] S64: Validation set evaluation.

[0105] After each training cycle, the model performance is evaluated on the validation set. The validation set data is input into the trained network, the predicted output is calculated, and then compared with the true values ​​to calculate four evaluation metrics: Mean Absolute Error (MAE) is the average of the absolute values ​​of the differences between the predicted and actual values. The unit is the same as the predicted value, and it intuitively reflects the magnitude of the average prediction error.

[0106] The root mean square error (RMSE) is the square root of the average of the squares of the differences between the predicted and actual values. Compared to the mean square error (MAE), it penalizes large errors more severely and can better reflect the prediction accuracy in the worst case.

[0107] Mean absolute percentage error (MAPE) is the average of the absolute values ​​of relative errors, expressed as a percentage. It reflects the relative accuracy of the prediction and is not affected by the dimensions of the data.

[0108] Coefficient of determination (R) 2 R(x) ranges from negative infinity to 1. The closer it is to 1, the better the model fit and the larger the proportion of variance it can explain. 2 A value greater than 0.9 is generally considered to indicate excellent model performance.

[0109] S65: Best model saving.

[0110] During training, the total loss on the validation set is monitored. Whenever the validation loss reaches its historical minimum, the current model parameters are saved to disk. After training, the model parameters with the minimum validation loss are loaded as the final model.

[0111] S7: Corrosion Prediction and Engineering Application: The operating parameters of the target heavy oil thermal recovery well are input into a trained multi-branch physical information neural network, which outputs corrosion rate prediction results to guide material selection and steam injection process parameter design for heavy oil thermal recovery wells. This step uses the trained model to predict corrosion under new operating conditions and applies the prediction results to engineering decisions. Specifically, S7 includes the following steps: S71: Model loading, loads the trained model parameters, and initializes the neural network.

[0112] S72: Input data preparation.

[0113] Collect the material composition and environmental parameters for the operating conditions to be predicted. Material composition includes the mass percentage of eleven elements; environmental parameters include temperature, pressure, hydrogen sulfide partial pressure, chloride ion concentration, oxygen concentration, and carbon dioxide partial pressure. Ensure the units and format of the data are consistent with the training data.

[0114] S73: Model prediction. The preprocessed data is input into the neural network to obtain four prediction outputs.

[0115] S74: Corrosion level determination.

[0116] Based on the predicted corrosion rate, the corrosion level of the operating condition is determined to provide a basis for engineering decisions. The determination criteria are as follows: If the corrosion rate is less than 0.5 mm per year, it is considered minor corrosion, and the material can be used for a long time with only routine maintenance.

[0117] If the corrosion rate is between 0.5 and 2.0 mm per year, it is considered moderate corrosion, and certain anti-corrosion measures need to be taken, and the condition of the pipes should be checked regularly.

[0118] If the corrosion rate is between 2.0 and 5.0 mm per year, it is considered severe corrosion, and effective anti-corrosion measures must be taken, such as using corrosion inhibitors, replacing with more corrosion-resistant materials, and shortening the maintenance cycle.

[0119] If the corrosion rate is greater than 5.0 mm per year, it is considered extremely severe corrosion. The material is not suitable for this condition and must be replaced with a high-performance corrosion-resistant alloy or protective measures such as lining must be adopted.

[0120] The present invention will now be described in detail with reference to specific embodiments: To verify the feasibility of this method in the design of steam injection processes and material selection for heavy oil thermal recovery production, the invention was applied to a specific operating condition of a heavy oil thermal recovery well. Taking a certain offshore heavy oil thermal recovery well as an example, on-site sampling and testing determined the well's operating conditions to be: temperature 200℃, pressure 15MPa, H2S concentration 5000ppm, O2 concentration 0.5%, and Cl... - The concentration was 10000 mg / L, and the CO2 concentration was 2%. This well experienced multiple corrosion failures of the 316L hydraulic control pipeline during several rounds of integrated steam injection and production operations, requiring corrosion prevention guidance for material selection and steam injection processes under these conditions. Using the traditional method of simulating corrosion conditions in heavy oil thermal recovery wells using a high-temperature, high-pressure corrosion reactor for material selection and steam injection process design is time-consuming, labor-intensive, and costly, posing challenges to corrosion prevention efforts.

[0121] Currently, the candidate alloy material grades for hydraulic control pipelines include Inconel 625, SAF2507, Incoly 825, TA2, and TA4. It is necessary to evaluate the differences in corrosion resistance and corrosion rate of these five materials under this operating condition. First, the environmental operating parameters and the chemical compositions of the four materials (comprising four sets of 11-dimensional data) were input into the model. The model results are shown in the table below, and the calculation results are consistent with the differences in corrosion resistance among the four materials.

[0122] According to the model results, TA2 has the lowest corrosion rate under this working condition, and is the optimal material in terms of corrosion resistance.

[0123] The advantages and positive effects of this invention are: 1. This invention reveals for the first time the corrosion characteristics of different alloy materials under heavy oil thermal conditions, clarifies the influence of various environmental and material factors on corrosion, and provides solid theoretical support for corrosion rate prediction.

[0124] 2. The physical information neural network corrosion prediction model constructed in this invention integrates corrosion kinetic equations and physical laws into model constraints and loss functions, solving the three major problems of traditional machine learning models: "dependence on training samples, weak generalization ability, and poor interpretability". It can achieve high-precision prediction with only a small amount of high-temperature and high-pressure laboratory data, and is suitable for the complex and variable working conditions of heavy oil thermal recovery wells.

[0125] 3. This invention achieves effective adaptation between oilfield on-site production monitoring data and corrosion prediction models. The developed model algorithm is easy to operate and can quickly predict corrosion rates under different materials and working conditions. It provides direct technical guidance for material selection, steam injection process design, and anti-corrosion agent screening for heavy oil thermal recovery wells, reducing the risk of corrosion failure and improving the safety and economy of oilfield development.

[0126] 4. The prediction method of this invention adopts standardized experimental procedures and data processing methods, follows relevant national and industry standards, and the model training and prediction process is reproducible and verifiable. It has broad application value and can be applied to the prediction of corrosion rate of heavy oil thermal recovery wells in different oil fields and under different working conditions.

[0127] The foregoing has provided a detailed description of one embodiment of the present invention, but this description is merely a preferred embodiment and should not be construed as limiting the scope of the invention. All equivalent variations and modifications made within the scope of the claims of this invention should still fall within the patent coverage of this invention.

Claims

1. A corrosion prediction method for heavy oil thermal recovery based on physical information neural networks, characterized in that: Includes the following steps, S1: Data Acquisition and Preprocessing: Acquire material composition data, environmental parameter data, and corrosion test data under heavy oil thermal recovery well conditions, and perform normalization and standardization processing; S2: Constructing a multiphysics coupled control equation set: Establishing a system of H2S-CO2-Cl equations specifically for heavy oil thermal recovery wells. - The physical governing equations for the multi-factor coupled corrosion mechanism of ion systems include at least the improved Allen-Cahn phase field evolution equation and the mass transfer diffusion-reaction equation. S3: Construct a multi-branch physical information neural network, including a material composition encoding branch, an environmental parameter encoding branch, a feature fusion layer, and a multi-task output layer; S4: Construct a dual-driven joint loss function: Design a total loss function that includes data-driven loss and physical-driven loss; S5: Gradient Normalization Adaptive Training: Gradient normalization is used to balance the contributions of different loss terms, and gradient pruning and adaptive learning rate scheduling are implemented to complete model training. S6: Model Training: An adaptive weight adjustment strategy is adopted to dynamically adjust the weight ratio of data-driven loss and physics-driven loss during the training process to complete the training of the multi-branch physical information neural network. S7: Corrosion Prediction and Engineering Application: Input the operating parameters of the target heavy oil thermal recovery well into the trained multi-branch physical information neural network, and output the corrosion rate prediction results to guide the material selection and steam injection process parameter design of the heavy oil thermal recovery well.

2. The method for predicting corrosion in heavy oil thermal recovery based on physical information neural networks according to claim 1, characterized in that: S1 includes the following steps: S11: Collect the material composition data of the alloy to be tested, which includes 11 elements: Fe, Cr, Ni, Ti, O, C, Al, N, Cu, Mn, and Si. S12: Collect environmental parameter data representing the corrosive environment characteristics of heavy oil thermal recovery wells, including temperature, pressure, hydrogen sulfide partial pressure, chloride ion concentration, oxygen concentration, and carbon dioxide partial pressure. S13: Collect the corrosion experiment data, which includes corrosion rate and corrosion depth; S14: Normalize the material composition data by dividing the mass percentage by 100 to convert it to the [0,1] range; S15: Perform Z-score normalization on the environmental parameter data: x norm =(x-μ) / σ, where μ is the mean and σ is the standard deviation; S16: Divide the dataset into training and validation sets in an 8:2 ratio.

3. The method for predicting corrosion in heavy oil thermal recovery based on physical information neural networks according to claim 1 or 2, characterized in that: In S2, the improved Allen-Cahn phase field evolution equation is: In the formula, φ is the phase field variable, φ=0 represents the metallic phase, and φ=1 represents the corrosion product phase; L(T) is the temperature-dependent interfacial mobility. f'(φ)=2φ(1-φ)(1-2φ) is the derivative of the double potential well function; κ is the gradient energy coefficient; φ is the spatial second derivative of the phase field variable; g(c,φ)=0.1×c×(1-φ) is the concentration-phase field coupling term.

4. The method for predicting corrosion in heavy oil thermal recovery based on physical information neural networks according to claim 3, characterized in that: In S2, the mass transfer diffusion-reaction equation is: In the formula, denoted as , where is the rate of change of concentration over time; D(T) is the temperature-dependent diffusion coefficient. R is the spatial second derivative of concentration; R(c,T) is the reaction rate term.

5. The method for predicting corrosion in heavy oil thermal recovery based on physical information neural networks according to claim 1 or 2, characterized in that: In S2, the physical control equation set also includes the Arrhenius temperature dependence equation, the general corrosion rate equation, the hydrogen sulfide corrosion kinetic equation, and the oxygen corrosion equation; the general corrosion rate equation introduces the protection coefficients of Cr and Ni and the promoting coefficient of Cl; the hydrogen sulfide corrosion kinetic equation introduces Cr content and Fe content as parameters; the oxygen corrosion equation introduces Cr content and Ni content as parameters.

6. The method for predicting corrosion in heavy oil thermal recovery based on physical information neural networks according to claim 1 or 2, characterized in that: In S3, both the material composition encoding branch and the environmental parameter encoding branch adopt a two-layer fully connected network containing layer normalization and hyperbolic tangent activation function, and output a 64-dimensional feature vector. It also includes a random Fourier transform branch, which generates 256-dimensional high-frequency features by performing a random Fourier transform on the original 17-dimensional input data; The feature fusion layer stitches together material features, environmental features, and Fourier features, and then compresses them to 256 dimensions through a fully connected network. The multi-branch physical information neural network also includes a physical-guided attention mechanism, which calculates attention weights by generating query, key, and value vectors and outputs them through residual connections.

7. The method for predicting corrosion in heavy oil thermal recovery based on physical information neural networks according to claim 1 or 2, characterized in that: In S3, the multi-task output layer includes: The corrosion rate output head uses the Softplus activation function to ensure that the output is non-negative. The erosion depth output head uses the Softplus activation function. The phase field variable output header uses the Sigmoid activation function to restrict the output to the [0,1] interval; The concentration field output head uses the Softplus activation function.

8. The method for predicting corrosion in heavy oil thermal recovery based on physical information neural networks according to claim 1 or 2, characterized in that: In S4, the physical driving loss includes: Corrosion rate physical consistency loss: Calculate the difference between the total corrosion rate predicted by the neural network and the sum of the rates of each corrosion mechanism calculated from the physical equations; Phase field smoothness loss is calculated by determining the difference in phase field variables between adjacent samples within a batch. The expression is: ; Where i = 1 to (N-1), and N is the number of samples in the batch. This represents the predicted value of the phase field variable for the i-th sample within the batch. Depth-rate consistency loss: There is a time integral relationship between corrosion depth and corrosion rate, expressed as: In the formula, d pred v is the predicted corrosion depth. pred t is the predicted corrosion rate. ref This is a preset reference time period; Loss on reasonableness of concentration: When the predicted concentration exceeds twice the maximum possible concentration in the environment, the mean square error of the excess portion is calculated.

9. The method for predicting corrosion in heavy oil thermal recovery based on physical information neural networks according to claim 1 or 2, characterized in that: In S4, a dynamic adjustment strategy for the weights of data loss and physical loss during training is designed. The training process of this adjustment strategy is divided into three stages: In the early stages, with training progress at 0-30%, the weight of data-driven loss is set to 0.9, and the weight of physics-driven loss is set to 0.

1. In the mid-term, with training progress at 30-70%, the weight of data loss linearly decreases from 0.9 to 0.5, while the weight of physical loss linearly increases from 0.1 to 0.

5. In the later stages, when the training progress is 70-100%, the weight of data loss is reduced from 0.5 to 0.4, and the weight of physical loss is increased from 0.5 to 0.

6.

10. A corrosion prediction system for heavy oil thermal recovery based on physical information neural networks, characterized in that: Running the heavy oil thermal recovery corrosion prediction method based on physical information neural networks as described in any one of claims 1 to 9 includes, The data acquisition and preprocessing module is used to acquire and process material composition data, environmental parameter data, and corrosion test data. The physical control equations construction module is used to establish a multi-physics field coupled control equations system that includes the improved Allen-Cahn phase field evolution equations and mass transfer diffusion-reaction equations. The multi-branch physical information neural network module is used to receive preprocessed data and output predicted values ​​of corrosion rate, corrosion depth, phase field variables and concentration field. The dual-drive joint loss function construction module is used to design an adaptive weighted total loss function that includes data-driven loss and physics-driven loss; The model training module is used to train the neural network using an adaptive training strategy with gradient normalization. The corrosion prediction and engineering application module is used to output corrosion prediction results and guide engineering decisions.