A three-phase flash calculation method based on a machine learning phase recognition model

The machine learning-based phase recognition model stabilizes and accelerates three-phase flash calculations by identifying rich phases and adjusting equilibrium constants, addressing the inefficiencies and inaccuracies of traditional methods.

CN119849340BActive Publication Date: 2025-07-15CHINA UNIV OF PETROLEUM (EAST CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510330695.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-20
Publication Date
2025-07-15
Estimated Expiration
2045-03-20

AI Technical Summary

Technical Problem

The calculation of traditional three-phase flash evaporation is unstable and cumbersome in the numerical simulation of reservoirs. The initial value of the traditional phase stability test may be incorrect, resulting in the calculation not converging, making it difficult to efficiently solve the complexity and instability problems of three-phase flash evaporation calculation.

Method used

The three-phase flash calculation method based on the machine learning phase recognition model is adopted, and the phase recognition model is constructed through CNN, the enriched phases are identified and the phase equilibrium constant is adjusted, and the phase stability test is performed in combination with the Wilson equation to optimize the three-phase flash calculation process.

Benefits of technology

The accuracy and efficiency of three-phase flash calculations are improved, the convergence difficulties and misjudgment problems in traditional methods are solved, and the recognition ability of three-phase equilibrium is enhanced, especially the calculation stability of complex phase state boundaries and near-critical zones.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119849340B_ABST
    Figure CN119849340B_ABST
Patent Text Reader

Abstract

The present invention discloses a three-phase flash calculation method based on a machine learning phase recognition model, belonging to the field of reservoir phase behavior calculation. The method includes the following steps: initializing component data; constructing a phase recognition model based on CNN; adjusting the phase equilibrium constant based on the phase recognition model; performing a phase stability test. If the test result is single-phase equilibrium, the result is output. Otherwise, two-phase flash calculation is performed; through the CNN phase recognition model, it is judged whether there is an enriched phase in the two-phase flash calculation result. If there is an enriched phase, the Wilson equation is used as the initial value of the phase equilibrium constant for subsequent calculations. Otherwise, the initial method for the enriched phase is used as the initial value of the phase equilibrium constant for subsequent calculations; the phase stability test is performed again. If the test result is two-phase equilibrium, the result is output. Otherwise, three-phase flash calculation is performed and the result is output. The present invention realizes targeted phase stability tests for different target phases.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of hydrocarbon reservoir phase state calculation, and particularly relates to a three-phase flash calculation method based on a machine learning phase identification model. Background Art

[0002] With extensive exploration and development worldwide, reservoir compositional simulators play an increasingly important role in the efficient development of shale reservoirs. In a compositional simulator, flash calculations for the corresponding state of each reservoir grid are required at each time iteration step, which usually occupies most of the running time of the compositional simulation. Therefore, developing a robust and efficient two-phase flash calculation method has been a hot topic in past research. Since free water may exist in shale reservoirs, it is necessary to consider the phase equilibrium of oil, gas, and water, that is, three-phase flash calculation with water as the third phase state. At the same time, due to the feasibility of using CO2 injection to enhance oil recovery, the phase equilibrium of the oil-gas-CO2 system may also occur in shale reservoirs, that is, three-phase flash calculation with CO2 as the third phase state. Compared with two-phase flash, the instability and computational complexity of three-phase flash calculation are well-known problems. Developing an efficient and robust three-phase flash calculation algorithm can not only promote its application in numerical simulation but also effectively enhance the understanding of the mass transfer relationship between multiphase fluids in shale reservoirs.

[0003] Traditional three-phase flash calculation is carried out based on the calculation results of two-phase flash. After the two-phase flash calculation converges, a phase stability test is performed for each existing phase state. A series of starting schemes are used to calculate the Gibbs free energy of the two-phase system to determine whether a new phase state can be split so that the newly generated equilibrium system has a lower Gibbs free energy. The traditional starting scheme for phase stability test consists of the Wilson equation and its derivative forms: In the formula, K i ini represents the starting scheme used for the phase stability test, and K i Wilson represents the phase equilibrium constant calculated using the Wilson equation, and the specific expression is as follows: In the formula, P ci represents the critical pressure of component i; ω i represents the acentric factor of component i; T ciRepresents the critical temperature of component i. To ensure that all possible phases can be correctly identified, for the calculation results of two-phase flash, both of the two existing phases need to be subjected to phase stability tests through the startup scheme in Equation (1), that is, a total of ten phase stability tests are required. Finally, the scheme with the lowest Gibbs free energy is used as the initial value for three-phase flash calculation. This is a cumbersome and time-consuming process. On the other hand, the phase equilibrium equations for three-phase flash belong to a system of non-linear equations, and their correct solution requires reasonable initial values. The initial values obtained from traditional phase stability tests may have problems with incorrect reference phases, which will lead to non-convergence of the three-phase flash calculation. The three-phase flash calculation is cumbersome and time-consuming, and at the same time, the calculation stability is lacking. These two problems have caused inconvenience to the application of three-phase flash calculation in reservoir numerical simulation. Summary of the Invention

[0004] In view of the above technical problems existing in the prior art, the present invention proposes a three-phase flash calculation method based on a machine learning phase identification model, which is reasonably designed, overcomes the deficiencies of the prior art, and has good effects.

[0005] To achieve the above object, the present invention adopts the following technical solutions: A three-phase flash calculation method based on a machine learning phase identification model, comprising the following steps: Step 1: Initialize component data; Step 2: Build a phase identification model based on CNN (Convolutional Neural Network); Step 3: Adjust the phase equilibrium constant based on the phase identification model; Step 4: Conduct a phase stability test. If the test result is single-phase equilibrium, output the result; otherwise, execute Step 5; Step 5: Conduct a two-phase flash calculation; Step 6: Through the CNN phase identification model, determine whether there is an enriched phase in the two-phase flash calculation result. If there is an enriched phase, use the Wilson equation as the initial value of the phase equilibrium constant for subsequent calculations; otherwise, use the initial method for the enriched phase as the initial value of the phase equilibrium constant for subsequent calculations; Step 7: Conduct a phase stability test. If the test result is two-phase equilibrium, output the result; otherwise, execute Step 8; Step 8: Conduct a three-phase flash calculation and output the result.

[0006] Preferably, in Step 1, the third phase is defined as the enriched phase. If the component fraction that is separately enriched into a phase in the feed molar fraction is greater than 0.2, use the initial method for the enriched phase as the initial value of the phase equilibrium constant for subsequent calculations; otherwise, use the Wilson equation as the initial value of the phase equilibrium constant for subsequent calculations.

[0007] Preferably, in Step 2, the phase identification model uses the component molar fraction and component information of each phase as eigenvalue, takes whether the phase is an enriched phase as the training target parameter, and adds a phase label to each phase to be used to check the phase state during phase stability analysis.

[0008] Preferably, in step 2, the training process of the phase recognition model is as follows: Input the one-dimensional array into the input layer, then use two convolutional layers to extract features from the input data, and finally use two fully connected layers for data transfer operations. In the classification layer, calculate the loss of the model training process and perform classification.

[0009] Preferably, in step 3, when adjusting the phase equilibrium constant using the phase recognition model, it includes the cases where the enriched phase exists in the first phase, the second phase, and the third phase; specifically, it includes the following steps: Step 3.1: Determine whether the phase is an enriched phase through the phase recognition model; Step 3.2: According to the existence of the enriched phase, calculate the average molar mass using formula (5) to determine the oil phase or the gas phase: In the formula, MW represents the average molar mass of this phase; MW i represents the molar mass of the i-th component; represents the molar fraction of the i-th component of the phase to be determined; Take the phase with the larger average molar mass as the oil phase, and the phase with the smaller average molar mass as the gas phase to complete the identification of the phase state of the entire calculation system.

[0010] Preferably, in step 4, it specifically includes the following steps: Step 4.1: Assume that the system for flash calculation is a liquid phase or a gas phase, and calculate the fugacity f of each component in this system; Step 4.2: Given the gas-liquid equilibrium constant required for the calculation through formula (6);

[0011] In the formula, K i represents the gas-liquid equilibrium constant, defined as the ratio of the molar fraction of the gas-phase component to the molar fraction of the liquid-phase component; P ci represents the critical pressure of the i-th component, with the unit of MPa; P represents the pressure of the calculation system, with the unit of MPa; ω i represents the acentric factor of the i-th component; T ci represents the critical temperature of the i-th component; T represents the temperature of the calculation system; Step 4.3: Calculate the molar fraction of the other phase through formula (7); Y i V = z i K i or Y i L = z i / K i (7); where Y i V 、Y i L respectively represent the volume molar fractions of the gas phase and the liquid phase; z i represents the molar fraction of the feed component; Step 4.4: Normalize the molar fractions calculated by formula (3); In the formula, S Vand S L are the volume fractions of the gas phase and the liquid phase, respectively; nc represents the number of components in the calculation system; normalization process: In the formula, x i and y i are the normalized liquid-phase and gas-phase component mole fractions, respectively; Step 4.5: Calculate the fugacity of the second phase; Step 4.6: Calculate the successive substitution coefficient R of the equilibrium constant i : In the formula, f ci is the fugacity of the i-th component under the feed conditions; f i V and f i L are the fugacities of the i-th component in the gas phase and the liquid phase, respectively; Step 4.7: Check whether it converges, and the convergence error is shown in Equation (11): Step 4.8: If it does not converge, update the equilibrium constant according to the successive substitution coefficient: Step 4.9: Check whether it approaches a trivial solution through Equation (13). If so, change the initial phase state of the calculation system and return to Step 1;

[0012] Through the above process, the corresponding S V and S L can be calculated. If both S V and S L are less than 1, it proves that the phase is in a single-phase stable state. Otherwise, the phase is in an unstable state and will split into a new phase state.

[0013] Preferably, in Step 5, it is judged whether the system will split into two phases according to the phase stability test result, and the mole fractions of the gas phase and the liquid phase and the component mole fractions of the gas phase and the liquid phase after phase separation are solved through two-phase flash calculation, which specifically includes the following steps: Step 5.1: Take the phase stability test result as the initial value of the equilibrium constant and solve Equation (14).

[0014] In the formula, n V is the phase mole fraction of the gas phase.

[0015] Step 5.2: Based on the n V obtained by solving Equation (14), calculate x i , y i through Equations (13) and (14).

[0016]

[0017] Step 5.3: According to the calculated x i and y iSubstitute into the PR equation of state to calculate the fugacity coefficients of the liquid phase and the gas phase respectively. Step 5.4: Calculate the fugacities of the liquid and gas phases through the fugacity coefficients. In the formula, f i L , f i V are the fugacities of the i-th component in the oil phase and the gas phase respectively; Step 5.5: If the conditions of Equation (19) are satisfied, it is considered that the system reaches the gas-liquid two-phase equilibrium; if not, update the phase equilibrium constant according to the method of Equation (20) and return to Equation (1). In the formula, K i n is the phase equilibrium constant at the n-th calculation.

[0018] Preferably, in Step 8, for the converged results of the two phases, judge whether there is a third phase in the system based on the phase stability test results, and then perform three-phase flash calculation to solve the molar fractions of the gas phase, liquid phase, and enriched phase after phase separation and the component molar fractions of the gas phase, liquid phase, and enriched phase; specifically include the following steps: Step 8.1: Take the results of the second phase stability test and combine the results of the two-phase flash calculation, and use the total of two phase equilibrium constants as the initial values of the phase equilibrium equations to solve Equation (21) below; In the formula, a i is the component molar fraction of the enriched phase; n L , n A are the phase molar fractions of the oil phase and the enriched phase respectively; K i V-L and K i A-L are the gas-oil phase equilibrium constant and the enriched-oil phase equilibrium constant respectively; Step 8.2: Based on n V , n A obtained by solving Equation (21), calculate x i , y i , a i through Equation (22);

[0019] Step 8.3: Substitute the calculated x i , y i , a i into the PR equation of state to calculate the fugacity coefficients of the liquid phase, gas phase, and enriched phase respectively. Step 8.4: Calculate the fugacity of the enriched phase through the fugacity coefficient. In the formula, f i Ais the fugacity of the i-th component in the enriched phase; Step 8.5: If the condition of Equation (26) is satisfied, it is considered that the system reaches vapor-liquid two-phase equilibrium; if not, update the phase equilibrium constant according to the method of Equation (27) and return to Equation (1);

[0020] Preferably, perform three-phase flash calculations on different components using random temperatures and pressures, record the component data of each phase at equilibrium and add tags for the phase states, including the enriched phase and the non-enriched phase, as the dataset for the phase identification model.

[0021] Preferably, the initial value of the phase equilibrium constant adopts the initial method for the enriched phase: If the enriched phase and the component feed z i is regarded as an approximate liquid phase or oil phase, assuming a non-enriched phase, then there is no obvious grouping component aggregation rule, and Equation (3) is used instead of the Wilson equation as the starting method for the phase stability analysis for the enriched phase: In the formula,

[0022] is the initial value of the phase equilibrium constant of the enriched component, is the initial value of the phase equilibrium constant of the remaining components.

[0023] The beneficial technical effects brought by the present invention: In order to solve the disadvantages of unstable and cumbersome traditional three-phase flash calculations, the present invention constructs a three-phase flash calculation method based on a machine learning phase identification model. This method can effectively enhance the accuracy of complex phase state identification. For the phase state boundaries that are fuzzy in three-phase equilibrium (such as near the critical region and near the azeotropic point), this method can solve the problems of difficult convergence or misjudgment that are prone to occur in traditional thermodynamic models, and greatly improve the practicality of three-phase flash calculations in oil and gas reservoir analysis and chemical process analysis. Description of the Drawings

[0024] Figure 1 is the flow chart of the fast and robust three-phase flash calculation method based on the machine learning phase identification algorithm.

[0025] Figure 2 is the structure diagram of the phase identification model based on CNN.

[0026] Figure 3 is the schematic diagram of the training result of the phase identification model. Among them, (a) is the schematic diagram of the loss rate change curve, and (b) is the schematic diagram of the accuracy rate change curve.

[0027] Figure 4 is the flow chart of the phase equilibrium constant adjustment method based on the phase identification model.

[0028] Figure 5Schematic diagram for preparing the training set of the phase recognition model. Among them, (a) is the schematic diagram of H2O-enriched phase data, and (b) is the schematic diagram of CO2-enriched phase data.

[0029] Figure 6 Schematic diagram of the calculation result. Specific implementation manner

[0030] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners: The definitions of key terms are as follows: (1) Flash calculation: Given the total composition of the system, it is to find the ratio of the composition and quantity of the gas-liquid two phases at equilibrium under a certain temperature and pressure. It is one of the basic contents of gas-liquid equilibrium calculation.

[0031] (2) Calculation system: A closed multi-component fluid system existing in the reservoir of the oil reservoir with a determined total composition. This system is usually composed of various hydrocarbon components and non-hydrocarbon components.

[0032] (3) Enriched phase: A phase state formed by the large enrichment of a certain specific component and can be determined by flash calculation.

[0033] (4) Phase stability test: A pre-step of flash calculation, used to determine whether phase separation will occur in the calculation system under given conditions, that is, whether there are multiple phases (such as gas phase and liquid phase).

[0034] The three-phase flash calculation proposed by the present invention is carried out on the basis of the two-phase flash calculation. Therefore, there are two phase stability tests. The purpose of the first one is to judge whether the two-phase system is established, and the second one is to detect whether the third phase exists. Before each phase stability test, it is necessary to use the phase recognition model to judge whether the enriched phase (aqueous phase / CO2 phase) exists. The steps of the present invention are as follows: Step 1: Construction of the phase recognition model based on CNN; The prediction principle of the Wilson equation is the molar mass difference between two phases. Since the molar masses of the oil phase and the gas phase usually differ greatly, for pure hydrocarbon fluids, applying the Wilson equation for phase stability analysis can well judge whether the oil phase can precipitate the gas phase or whether the gas phase can condense into the oil phase. For enriched phases (aqueous phase, CO2 phase, etc.), no matter whether the Wilson equation or its derivatives are applied, the results of phase stability analysis are difficult to guarantee. Therefore, it is necessary to design an effective method for starting the phase equilibrium constant specifically according to the characteristics of the component mole fractions of the enriched phase.

[0035] Table 1 shows the component molar fraction information of the oil phase, gas phase, water phase, and CO2 phase after the convergence of multiphase flash calculation. It is not difficult to see from this table that the enriched phase is occupied by a certain specific component with the vast majority of the molar fraction in this phase, while there is no obvious component enrichment pattern in the non-enriched phase. Considering the component enrichment characteristics of the enriched phase, it can be assumed that there is a phase during the phase stability analysis, where 90% of the component molar fraction is occupied by a certain specific component, and the remaining 10% is evenly divided by the remaining components according to the feed ratio z i for equal division. Since the oil phase is a non-enriched phase and does not have the characteristics of component enrichment, the feed ratio of the components can be regarded as approximately the component of the oil phase. Dividing the assumed enriched phase by z i phase can obtain the phase equilibrium constant expression (3) with the oil phase as the reference phase. This equation will replace the Wilson equation and its derivatives and be used as the starting method for the phase stability analysis of the enriched phase.

[0036] Through this method, it is possible to effectively determine whether the newly emerging phase state may exist in the form of an enriched phase through phase stability analysis. However, the premise for the implementation of this method is that the enriched phase has not appeared. If the enriched phase has appeared in the previous flash calculation, then the Wilson equation and its derivatives should be used at this time to judge the existence of the oil phase / gas phase. Equation (3) essentially gives a directional judgment method for the enriched phase. Therefore, in multiphase flash calculation, for different substances to be tested for phase states, the goals of phase stability analysis are different. Therefore, it is necessary to develop a method to identify the phase states to be tested during phase stability analysis.

[0037] Table 1: Component Molar Fractions of Different Typical Phase States

[0038]

[0039] CNN-based Phase Identification Model.

[0040] Since the enriched phase is occupied by a certain specific component with the vast majority of the molar fraction in this phase, this characteristic can be utilized. The component molar fraction and component information of each phase are used as feature values, and whether this phase state is an enriched phase is used as the target parameter for training and a label is added to each phase. In this way, a CNN-based phase identification training model is constructed. The structure of the model is shown in Figure 2 . The model training process is as follows: The one-dimensional array is input into the input layer, and then two convolutional layers with a size of 3×3×16 are used to extract features from the input data. Since the training model only needs to judge whether it is an enriched phase, two consecutive fully connected layers are used for data transfer operations. In the classification layer, the loss during the model training process is calculated and classification is performed.

[0041] Perform three-phase flash calculations on different components using random temperature and pressure, record the component data of each phase at phase equilibrium, and add the tags of the phase states (the enriched phase is 1, and the non-enriched phase is 0), which is used as the dataset for the phase recognition training model. Import a total of 200 groups of datasets into the training model, shuffle the data, set the ratio of the training set to the test set to 8:2, set the number of training rounds to 100 rounds, and use the MSE (Mean Square Error) and coefficient of determination R in the regression evaluation index 2 to evaluate the training effect of the model. MSE characterizes the error generated by the model in prediction, and the smaller the value, the better the fitting effect; R 2 reflects the ratio of the regression sum of squares to the total sum of squares of deviations. The closer the value is to 1, the better the fitting effect. The calculation methods of MSE and R 2 are shown in Equation (4).

[0042] After the phase recognition model is trained, the curves of the loss rate and the correct rate changing with the number of training rounds are shown in Figure 3 in (a) and (b) respectively. By observing the change curve graph, it can be seen that after about 40 rounds of training, the loss rate and the correct rate no longer tend to be stable. At this time, the training loss rate approaches 0% and the accuracy approaches 100%. After 100 rounds of training are completed, the MSE and R 2 of the model are 0% and 1 respectively, proving that the training effect of the model is very ideal. Save the model, and import the mole fraction of the components of the phase into the model during the flash calculation to achieve the function of identifying the enriched phase.

[0043] Before the phase stability analysis, judge whether the phase to be analyzed is an enriched phase by the phase recognition model, and then combine Equation (3) to start the targeted phase stability analysis of the enriched phase. However, in the multi-phase flash calculation, the problem of incorrect reference phases for the phase equilibrium constant still exists. Therefore, it is necessary to develop a new process in combination with the phase recognition results to solve this problem.

[0044] Adjustment of the phase equilibrium constant based on the phase recognition model.

[0045] After judging whether the phase is an enriched phase by the phase recognition model, according to the presence of the enriched phase, judge the remaining phases as oil phase / gas phase, so as to fully control the phase state information of each phase, and based on this information, perform subsequent phase equilibrium constant adjustment operations. The implementation process of this process is shown in Figure 4 .

[0046] When the enriched phase has been determined, since heavier hydrocarbon components are more likely to be present in the oil phase and lighter components are mostly present in the gas phase, the judgment of the oil phase and the gas phase can be achieved by comparing the average molar mass. Equation (5) is used to calculate the average molar mass of the phase, and the phase with the larger molar mass is taken as the oil phase, while the other phase is taken as the gas phase, thus completing the identification of the phase state of the entire system.

[0047] In the formula, MW represents the average molar mass of the phase; MW i represents the molar mass of the i-th component; represents the mole fraction of the i-th component of the phase to be judged.

[0048] Since the working principle of the Wilson equation is to classify the light and heavy components in the system into two distinct phase states of light and heavy, in the calculation results of two-phase flash, the situation where the enriched phase may have appeared may exist. Therefore, the phase identification model is applied to find the enriched phase. After using the average molar mass to judge the oil / gas phase, the enriched phase may exist in Phase 1, Phase 2 or Phase 3. It is an ideal situation that the enriched phase exists in the third phase. Relying on the ability of the Wilson equation to distinguish between light and heavy phase states, in most cases, the first phase is the oil phase. Therefore, without adjusting the phase equilibrium constant, the correct equilibrium result can be obtained through flash calculation. If the Wilson equation misidentifies the enriched phase as the heavier phase (the first phase is the enriched phase), then the other lighter phase may be the gas phase or the oil phase, which is related to the feed component ratio of the system. At this time, the mole fraction of the component in Equation (5) should be replaced by the component feed ratio z i to compare the molar mass with this phase. If this phase is heavier, more heavy components exist in this phase, and this phase should be the oil phase; otherwise, it is the gas phase. When the second phase is the enriched phase, the treatment method is the same as when the first phase is the enriched phase. After all the phase states are identified, judge the original expression form of the phase equilibrium constant, and uniformly adjust all the phase equilibrium constants to the state where the reference phase is the oil phase. Thus, the adjustment of the phase equilibrium constant based on the phase identification model is realized.

[0049] Step 2: Phase stability test; Before the two-phase / three-phase flash calculation, it is necessary to conduct a phase stability test on the mixture. The purpose of this process is to judge whether the mixture will split into more phases under the given temperature and pressure conditions to reach a state with a smaller Gibbs free energy. The specific calculation process is as follows: (1) Assume that the system is in the liquid phase (gas phase), and use the PR equation of state to calculate the fugacity f of the system; (2) The gas-liquid equilibrium constant required for the calculation is given by Equation (6). In the formula, K i represents the gas-liquid equilibrium constant, which is defined as the ratio of the mole fraction of the gas-phase component to the mole fraction of the liquid-phase component; P cirepresents the critical pressure of the i-th component, MPa; P represents the pressure of the calculation system, MPa; ω i represents the acentric factor of the i-th component; T ci represents the critical temperature of the i-th component; T represents the temperature of the calculation system; (3) Calculate the component mole fraction of the other phase: Y i V = z i K i or Y i L = z i / K i (7); where Y i V 、Y i L represent the gas-phase and liquid-phase volume mole fractions respectively; z i represents the feed component mole fraction; (4) Normalize the mole fractions calculated in (3): In the formula, S V and S L are the volume fractions of the gas phase and the liquid phase respectively; nc represents the number of components in the calculation system; Normalization process: In the formula, x i 、y i are the normalized liquid-phase and gas-phase component mole fractions respectively; (5) Calculate the fugacity of the second phase through the PR equation of state; (6) Calculate the successive substitution coefficient R i : In the formula, f ci is the fugacity of the i-th component under the feed conditions; f i V and f i L are the fugacities of the i-th component in the gas phase and the liquid phase respectively; (7) Check whether it converges, and the convergence error is the same as before: (8) If it does not converge, update the equilibrium constant according to the successive substitution coefficient: (9) Check whether it approaches a trivial solution through the following formula. If so, change the initial phase state of the system and go back to the first step; Through the above process, the corresponding S V and S L can be calculated. If S V 、S L are both less than 1, it proves that this phase is in a single-phase stable state. Otherwise, this phase is in an unstable state and will split into a new phase state. Therefore, the flash calculation will be further carried out with the formula.

[0050] Step 3: Two-phase flash calculation; Determine whether the system will split into two phases based on the results of the phase stability test, and solve for the mole fractions of the gas phase and liquid phase after phase separation, as well as the component mole fractions of the gas phase and liquid phase through two-phase flash calculation.

[0051] (1) Use the results of the phase stability test as the initial value of the equilibrium constant and solve the following equation; (2) Based on the n V obtained by solving Equation (14), calculate x i , y i through Equations (13) and (14); (3) Substitute the calculated x i , y i into the PR equation of state to calculate the fugacity coefficients of the liquid phase and gas phase respectively (4) Calculate the fugacities of the liquid and gas phases through the fugacity coefficients; (5) If the conditions of Equation (19) are satisfied, the system can be considered to reach vapor-liquid two-phase equilibrium; if not, update the phase equilibrium constant according to the method of Equation (20) and return to Equation (1);

[0052] Step 4: Three-phase flash calculation; For the results where the two phases have converged, determine whether there is a third phase in the system based on the results of the phase stability test, and then perform three-phase flash calculation to solve for the mole fractions of the gas phase, liquid phase, and enriched phase after phase separation, as well as the component mole fractions of the gas phase, liquid phase, and enriched phase.

[0053] (1) Use the results of the second phase stability test and combine with the results of the two-phase flash calculation, with a total of two phase equilibrium constants as the initial values of the phase equilibrium equations, and solve the following equation;

[0054] (2) Based on the n V , n A obtained by solving Equation (21), calculate x i , y i , a i through Equation (22);

[0055]

[0056] (3) Substitute the calculated x i , y i , a i into the PR equation of state to calculate the fugacity coefficients of the liquid phase, gas phase, and enriched phase respectively

[0057] (4) Calculate the fugacity of the enriched phase through the fugacity coefficients;

[0058] (5) If the conditions of Equation (26) are met, the system can be considered to reach the gas-liquid two-phase equilibrium; if not, update the phase equilibrium constant according to the method of Equation (27) and return to (1);

[0059] Equation (21) belongs to a system of nonlinear equations. The selection of a reasonable solution method helps to efficiently perform the three-phase flash calculation, and the generalized Newton iteration method can quickly solve the system of nonlinear equations.

[0060] Step 5: Optimized multi-phase flash calculation method.

[0061] Add the optimized method developed above to the flash calculation to form an optimized flash calculation process. The specific process is shown in Figure 1 Before performing the overall flash calculation, it is necessary to define the enriched phase. This step is to judge the molar fraction of the components that may be enriched into a separate phase in the feed ratio z i before the two-phase flash calculation. If the enriched components are relatively many, even if the Wilson equation is used to start the phase stability analysis, it is very likely to identify the enriched phase as a new phase state, which will cause the reference phase of the phase equilibrium constant to be disordered from the root cause and also make the subsequent flash calculation inconvenient. Therefore, when the enriched components reach a certain amount (>0.2), the first phase stability analysis should be carried out using Equation (3). If the enriched components are relatively few, only use the Wilson equation to perform the phase stability analysis and perform the subsequent flash calculation based on the results.

[0062] At the end of the two-phase flash calculation, use the phase identification model to identify the existing two phase states, and select the start-up scheme for the second phase stability analysis according to whether the enriched phase appears. Then use the phase identification model to predict the phase state type of the third phase and adjust the phase equilibrium constant. After these steps are completed, the second stability analysis will be carried out. Since the occurrence states of the existing two phases are different, the phases that need to be analyzed for stability are also different. Since the enriched phase is formed by the large enrichment of a certain component, if the enriched phase has appeared, the stability analysis will be carried out on the other phase accordingly; if the enriched phase has not appeared, considering the molar mass and interaction force of the components, the stability analysis should be carried out on the oil phase. The result of the phase stability analysis will directly determine the calculation result. If the analysis result is stable and the third phase does not exist, directly output the result of the two-phase flash calculation; if the result is unstable, start the three-phase flash calculation and output the result after convergence.

[0063] Implementation example: Define the component ratios where three-phase coexistence may occur, and generate multiple groups of phase fractions and component information at three-phase equilibrium by means of random temperature and pressure calculations. Different marking methods (phase labels) are adopted for different phases, such asFigure 5 As shown in (a) and (b) in

[0064] , using the component information of each phase as the input value and the phase label as the training target value, a training dataset is jointly constructed. Figure 6 After the model training is completed, calculations are performed using the components in Table 2, and a multi-phase phase equilibrium result diagram as shown in

[0065] Table 2: Component Examples

[0066]

[0067] The Peng-Robinson (PR) equation of state belongs to the cubic equation of state, and the equation is divided into two terms: the repulsive term and the attractive term. The PR equation of state is a two-parameter equation, and its explicit pressure expression is: where P represents the system pressure; T represents the system temperature; V represents the system volume; and R is the ideal gas constant.

[0068] In Equation (A1), the first term on the right side is the repulsive term, and the second term is the attractive term and is temperature-dependent. For pure substances, the parameters a(T) and b are defined as: m = 0.37464 + 1.5422ω - 0.26992ω 2 (A4); where P c represents the critical pressure; T c represents the critical temperature; T r represents the reduced temperature, calculated by Equation (A6); ω is the acentric factor;

[0069] For mixtures, the van der Waals mixing rule is introduced: where A m is the parameter a(T) of the mixture; c i is the initial mole fraction of component i; k ij is the binary interaction parameter (BIP).

[0070] In the process of thermodynamic calculations, compared with the explicit pressure expression equation of state, the expression regarding the compressibility factor Z is more commonly used. The compressibility factor Z expression of the PR equation of state is: Equation (A10) is a cubic equation, so there may be three valid real roots [Z1, Z2, Z3]. For thermodynamic calculations, the one that can obtain the lowest Gibbs free energy among the three real roots is the valid solution. For the three different real roots, the one with the largest value is defined as Z max , the one with the smallest value is defined as Z min , and the intermediate value is discarded. For the two compressibility coefficients, the corresponding judgment formulas are given:

[0071]

[0072] If the calculation result of formula (A11) is greater than 0, select Z min , otherwise select Z max . After obtaining the correct compression factor Z, calculate the fugacity coefficient according to formula (A12).

[0073]

[0074] Certainly, the above description is not a limitation of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions or substitutions made by those skilled in the art within the essence of the present invention should also fall within the protection scope of the present invention.

Claims

1. A three-phase flash calculation method based on a machine learning phase recognition model, characterized in that, It includes the following steps: Step 1: Initialize the component data; Define the third phase as the enriched phase. If the component fraction that is separately enriched into a phase in the feed molar fraction is greater than 0.2, then use the initial method for the enriched phase as the initial value of the phase equilibrium constant for subsequent calculations. Otherwise, use the Wilson equation as the initial value of the phase equilibrium constant for subsequent calculations; Step 2: Construct a phase recognition model based on CNN; Step 3: Adjust the phase equilibrium constant based on the phase recognition model; When using the phase recognition model to adjust the phase equilibrium constant, it includes the cases where the enriched phase exists in the first phase, the second phase, and the third phase; specifically, it includes the following steps: Step 3.1: Judge whether the phase is an enriched phase through the phase recognition model; Step 3.2: According to the existence situation of the enriched phase, calculate the average molar mass using formula (5) to judge the oil phase or the gas phase: where MW represents the average molar mass of the phase; MW i represents the molar mass of the i-th component; represents the mole fraction of the i-th component of the phase to be determined; Take the phase with the larger average molar mass as the oil phase, and the phase with the smaller average molar mass as the gas phase to complete the identification of the phase state of the entire calculation system; Step 4: Conduct a phase stability test. If the test result is single-phase equilibrium, output the result. Otherwise, execute Step 5; Step 5: Conduct two-phase flash calculation; Step 6: Through the CNN phase recognition model, judge whether there is an enriched phase in the two-phase flash calculation result. If there is an enriched phase, use the Wilson equation as the initial value of the phase equilibrium constant for subsequent calculations. Otherwise, use the initial method for the enriched phase as the initial value of the phase equilibrium constant for subsequent calculations; Step 7: Conduct a phase stability test again. If the test result is two-phase equilibrium, output the result. Otherwise, execute Step 8; Step 8: Conduct three-phase flash calculation and output the result.

2. The three-phase flash calculation method based on the machine learning phase recognition model according to claim 1, wherein, In Step 2, the phase recognition model uses the component molar fraction and component information of each phase as eigenvalue, takes whether the phase is an enriched phase as the training target parameter, and adds a phase label to each phase for checking the phase state during phase stability analysis.

3. The three-phase flash calculation method based on the machine learning phase recognition model according to claim 1, wherein, In Step 2, the training process of the phase recognition model is as follows: Input the one-dimensional array into the input layer, then use two convolutional layers to extract features from the input data, and finally use two fully connected layers for data transfer operations. In the classification layer, calculate the loss of the model training process and conduct classification.

4. The three-phase flash calculation method based on the machine learning phase recognition model according to claim 1, wherein In Step 4, it specifically includes the following steps: Step 4.1: Assume that the system of the flash calculation is in the liquid phase or the gas phase, and calculate the fugacity f of each component in this system; Step 4.2: Given the gas-liquid equilibrium constant required for the calculation through formula (6); where K i represents the gas-liquid equilibrium constant, defined as the ratio of the mole fraction of the gas-phase component to the mole fraction of the liquid-phase component; P ci represents the critical pressure of the i-th component, with the unit of MPa; P represents the pressure of the calculation system, with the unit of MPa; ω i represents the acentric factor of the i-th component; T ci represents the critical temperature of the i-th component; T represents the temperature of the calculation system; Step 4.3: Calculate the component molar fraction of the other phase through formula (7); Y i V = z i K i or Y i L = z i / K i (7); Among them, Y i V and Y i L respectively represent the gas-phase and liquid-phase volume mole fractions; z i represents the molar fraction of the feed component; Step 4.4: Normalize the molar fraction calculated by formula (3); where S V and S L are the volume fractions of the gas phase and the liquid phase, respectively; nc represents the number of components in the calculation system; Normalization process: where x i and y i are the normalized mole fractions of the liquid and gas phases, respectively; Step 4.5: Calculate the fugacity of the second phase; Step 4.6: Calculate the successive substitution coefficient R of the equilibrium constant i : where f ci is the fugacity of the i-th component under the feed conditions; f i V and f i L are the fugacities of the i-th component in the gas phase and the liquid phase, respectively; Step 4.7: Check whether it converges, and the convergence error is shown in formula (11): Step 4.8: If it does not converge, update the equilibrium constant according to the successive substitution coefficient; Step 4.9: Check whether it approaches a trivial solution through formula (13). If so, change the initial phase state of the calculation system and return to Step 1; The corresponding S can be calculated through the above process V and S L , if both S V and S L are less than 1, it proves that this phase is in a single-phase stable state. Conversely, this phase is in an unstable state and will split into a new phase state.

5. The three-phase flash calculation method based on the machine learning phase recognition model according to claim 1, characterized in that, In Step 5, it is determined whether the system will split into two phases based on the phase stability test results, and the molar fractions of the gas phase and liquid phase and the component molar fractions of the gas phase and liquid phase after phase separation are solved through two-phase flash calculation. The specific steps are as follows: Step 5.1: Use the phase stability test results as the initial value of the equilibrium constant to solve Equation (14); where n V is the phase molar fraction of the gas phase; Step 5.2: Based on the obtained n from solving Equation (14) V , calculate x i , y i through Equations (13) and (14); Step 5.3: According to the calculated x i , y i Substitute into the PR equation of state to calculate the fugacity coefficients of the liquid phase and the gas phase respectively Step 5.4: Calculate the fugacities of the liquid and gas phases through the fugacity coefficient; where f i L and f i V are the fugacities of the i-th component in the oil phase and the gas phase, respectively; Step 5.5: If the conditions of Equation (19) are satisfied, it is considered that the system reaches gas-liquid two-phase equilibrium; if not, the phase equilibrium constant is updated according to the method of Equation (20), and return to Equation (1); where K i n is the phase equilibrium constant at the nth calculation.

6. The three-phase flash calculation method based on the machine learning phase recognition model according to claim 1, wherein In Step 8, for the converged results of the two phases, it is determined whether there is a third phase in the system based on the phase stability test results, and then the molar fractions of the gas phase, liquid phase, and enriched phase and the component molar fractions of the gas phase, liquid phase, and enriched phase after phase separation are solved through three-phase flash calculation; the specific steps are as follows: Step 8.1: Use the results of the second phase stability test and the results of the two-phase flash calculation, and the total of two phase equilibrium constants as the initial value of the phase equilibrium equations to solve Equation (21) below; where a i is the component mole fraction of the enriched phase; n L , n A are the phase mole fractions of the oil phase and the enriched phase, respectively; K i V-L and K i A-L are the gas-oil phase equilibrium constant and the enriched-oil phase equilibrium constant, respectively; Step 8.2: Based on n obtained by solving equation (21) V , n A , calculate x i , y i , a i ; Step 8.3: Substitute the calculated x i , y i , a i into the PR equation of state, and calculate the fugacity coefficients of the liquid phase, gas phase, and enriched phase respectively Step 8.4: Calculate the fugacity of the enriched phase through the fugacity coefficient; where f i A is the fugacity of the i-th component in the enriched phase; Step 8.5: If the conditions of Equation (26) are satisfied, it is considered that the system reaches gas-liquid two-phase equilibrium; if not, the phase equilibrium constant is updated according to the method of Equation (27), and return to Equation (1); 7. The three-phase flash calculation method based on the machine learning phase recognition model according to claim 1, characterized in that Perform three-phase flash calculation on different components using random temperatures and pressures, record the component data of each phase at equilibrium and add the labels of the phase states, including the enriched phase and the non-enriched phase, as the data set of the phase identification model.

8. The three-phase flash calculation method based on the machine learning phase recognition model according to claim 1, wherein, The initial value of the phase equilibrium constant adopts the initial method for the enriched phase: If the enriched phase and the component feed z i are regarded as an approximate liquid phase or oil phase, assuming a non-enriched phase, there is no obvious grouping component aggregation rule. Equation (3) is used instead of the Wilson equation as the starting method for phase stability analysis for the enriched phase: In the formula, is the initial value of the phase equilibrium constant of the enriched component, is the initial value of the phase equilibrium constant of the remaining components.

Citation Information

Patent Citations

  • Phase equilibrium model construction method and device, equipment and storage medium

    CN113241127A

  • Method for detecting and controlling hydrate dormation at any point of a pipe carrying multiphase petroleum fluids

    US20020166818A1