Efficient three-phase flash evaporation calculation method based on machine learning phase recognition model

By applying a phase recognition model based on machine learning in three-phase flash calculation, the unstable and cumbersome problems of three-phase flash calculation in traditional methods are solved, and more efficient and accurate phase state recognition and equilibrium are achieved, and the practicality of oil and gas reservoir analysis is improved.

CN119849340AActive Publication Date: 2025-04-18CHINA UNIV OF PETROLEUM (EAST CHINA)

Patent Information

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

AI Technical Summary

Technical Problem

Traditional three-phase flash evaporation calculations are unstable and cumbersome, making it difficult to effectively apply in numerical simulation of reservoirs.

Method used

Using a phase recognition model based on machine learning, a phase recognition model is constructed through a convolutional neural network (CNN), phase equilibrium constant adjustment and phase stability testing are carried out to improve the efficiency and accuracy of three-phase flash calculations.

Benefits of technology

It significantly improves the stability and efficiency of three-phase flash evaporation calculation, solves the problems of blurred phase state boundaries and convergence difficulties in traditional methods, and enhances the practicality of oil and gas reservoir analysis and chemical process analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119849340A_ABST
    Figure CN119849340A_ABST
Patent Text Reader

Abstract

The invention discloses an efficient three-phase flash evaporation calculation method based on a machine learning phase recognition model, and belongs to the field of oil and gas reservoir phase state calculation. Comprising the following steps: initializing component data; constructing a phase recognition model based on CNN; performing phase equilibrium constant adjustment based on the phase recognition model; performing a phase stability test, if the test result is single-phase equilibrium, outputting the result, otherwise, performing two-phase flash evaporation calculation; judging whether an enriched phase exists in a two-phase flash evaporation calculation result or not through a CNN phase recognition model, if the enriched phase exists, adopting a Wilson equation as a phase equilibrium constant initial value to carry out subsequent calculation, and otherwise, adopting an initial method for the enriched phase as the phase equilibrium constant initial value to carry out subsequent calculation; and carrying out the phase stability test again, if the test result is two-phase equilibrium, outputting the result, otherwise, carrying out three-phase flash evaporation calculation and outputting the result. According to the invention, targeted phase stability testing of different target phases is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the extensive exploration and development around the world, reservoir component simulators play an increasingly important role in the efficient development of shale reservoirs. In component simulators, each time iteration step requires flash calculation of the corresponding state for each reservoir grid, which usually takes up most of the running time of component simulation. Therefore, developing a robust and efficient two-phase flash calculation method has been a hot topic in the past. Due to the possible presence of free water in shale reservoirs, it is necessary to consider the phase equilibrium of oil, gas and water, that is, the three-phase flash calculation with water as the third phase. At the same time, due to the feasibility of using CO2 injection to improve oil recovery, the phase equilibrium of the oil-gas-CO2 system may also appear in the shale reservoir, that is, the three-phase flash calculation with CO2 as the third phase. Compared with two-phase flash, the instability and computational complexity of three-phase flash calculation are well-known problems. The development of 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] The traditional three-phase flash calculation is performed on the calculation results of the two-phase flash. After the two-phase flash calculation converges, a phase stability test is performed for each existing phase. A series of startup schemes are used to calculate the Gibbs free energy of the two-phase system to determine whether a new phase can be split so that the newly generated equilibrium system has a lower Gibbs free energy. The traditional phase stability test startup scheme consists of the Wilson equation and its derivatives: (1); where K i ini represents the starting scheme used for the phase stability test, K i Wilson Represents the phase equilibrium constant calculated using the Wilson equation. The specific expression is as follows: (2); where P ci represents the critical pressure of component i; ω i represents the eccentricity factor of component i; T ciRepresents the critical temperature of component i. In order to ensure that all possible phases can be correctly judged, for the calculation results of two-phase flash evaporation, both existing phases need to be tested for phase stability through the startup scheme in formula (1), that is, a total of ten phase stability tests are required, and finally the scheme with the lowest Gibbs free energy is used as the initial value for three-phase flash evaporation calculation, which is a cumbersome and time-consuming process. On the other hand, the phase equilibrium equation of three-phase flash evaporation belongs to a nonlinear equation group, and its correct solution requires reasonable initial values. The initial values ​​obtained by the traditional phase stability test may have reference phase confusion problems, which will lead to non-convergence of three-phase flash evaporation calculation. The three-phase flash evaporation calculation is cumbersome and time-consuming, and the calculation lacks stability. These two problems have caused instability in the application of three-phase flash evaporation calculation in reservoir numerical simulation. Summary of the invention

[0004] In view of the above-mentioned technical problems existing in the prior art, the present invention proposes an efficient three-phase flash evaporation calculation method based on a machine learning phase recognition model, which has a reasonable design, overcomes the shortcomings of the prior art, and has good effects.

[0005] In order to achieve the above object, the present invention adopts the following technical scheme: an efficient three-phase flash calculation method based on a machine learning phase recognition model, comprising the following steps: step 1: initializing component data; step 2: building a phase recognition model based on CNN (Convolutional Neural Network); step 3: adjusting the phase equilibrium constant based on the phase recognition model; step 4: performing a phase stability test, if the test result is a single-phase equilibrium, outputting the result, otherwise, executing step 5;

[0006] Step 5: Perform two-phase flash calculation; Step 6: Use the CNN phase recognition model to determine whether there is an enriched phase in the two-phase flash calculation results. 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: Perform a phase stability test. If the test result is a two-phase equilibrium, output the result. Otherwise, execute step 8; Step 8: Perform a three-phase flash calculation and output the result.

[0007] Preferably, in step 1, the third phase is defined as the enriched phase. If the component fraction of the enriched phase alone in the feed mole fraction is greater than 0.2, the initial method for the enriched phase is used as the initial value of the phase equilibrium constant for subsequent calculations. Otherwise, the Wilson equation is used as the initial value of the phase equilibrium constant for subsequent calculations.

[0008] Preferably, in step 2, the phase recognition model uses the component mole fraction and component information of each phase as characteristic values, takes whether the phase is an enriched phase as the target parameter for training, and adds a phase label to each phase to determine the phase state to be tested during phase stability analysis.

[0009] Preferably, in step 2, the phase recognition model training process is as follows: a one-dimensional array is input into the input layer, and then two convolutional layers are used to extract features of the input data, and finally two fully connected layers are used to perform data transfer operations. In the classification layer, the loss of the model training process is calculated and classified.

[0010] Preferably, in step 3, when the phase equilibrium constant is adjusted using the phase recognition model, the enriched phase is included in the first phase, the second phase and the third phase; specifically, the following steps are included: step 3.1: judging whether the phase is an enriched phase by the phase recognition model; step 3.2: according to the existence of the enriched phase, the average molar mass is calculated using formula (5) to judge whether it is an oil phase or a gas phase: (5); where represents the average molar mass of the phase; represents the molar mass of the i-th component; Represents the molar fraction of the i-th component of the phase that needs to be judged; the phase with a larger average molar mass is taken as the oil phase, and the phase with a smaller average molar mass is taken as the gas phase, thus completing the identification of the phase state of the entire calculation system.

[0011] Preferably, step 4 specifically includes the following steps: Step 4.1: Assuming that the system for flash evaporation calculation is liquid or gas phase, calculate the fugacity of each component of the system ; Step 4.2: The gas-liquid equilibrium constant required for calculation is given by formula (6); (6); where 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; represents the critical pressure of the ith component, in MPa; Represents the calculation system pressure, in MPa; represents the eccentricity factor of the i-th component; represents the critical temperature of the i-th component; T represents the temperature of the calculation system; Step 4.3: Calculate the mole fraction of the component of the other phase by formula (7); (7); among them , denote the mole fractions of gas and liquid phase respectively; represents the mole fraction of the feed component; Step 4.4: normalize the mole fraction calculated by equation (3); (8); where S V and S Lare the volume fractions of the gas and liquid phases, respectively; Represents the number of components in the calculation system; normalized: (9); where x i ,y i are the normalized mole fractions of liquid and gas components respectively; Step 4.5: Calculate the fugacity of the second phase; Step 4.6: Calculate the successive substitution coefficient of the equilibrium constant : (10); where f ci is the fugacity of the i-th component under feed conditions; f i V and f i L are the fugacity of the i-th component in the gas phase and liquid phase respectively; Step 4.7: Check whether it converges. The convergence error is shown in formula (11): (11); Step 4.8: If it does not converge, update the equilibrium constant by replacing the coefficients successively: (12); Step 4.9: Check whether it approaches a trivial solution through equation (13). If so, change the initial phase of the calculation system and return to step 1; (13).

[0012] Through the above process, the corresponding and ,if , are all less than 1, which proves that the phase is in a single-phase stable state. Otherwise, the phase is unstable and will split into a new phase.

[0013] Preferably, in step 5, the phase stability test result is used to determine whether the system will split into two phases, and the mole fractions of the gas phase and liquid phase and the mole fractions of the components of the gas phase and liquid phase after phase separation are calculated by two-phase flash evaporation, which specifically includes the following steps: Step 5.1: Using the phase stability test result as the initial value of the equilibrium constant, solve equation (14). (14); where is the mole fraction of the gas phase.

[0014] Step 5.2: Based on solving equation (14), , calculated by formula (13) and formula (14) , . (15); (16).

[0015] Step 5.3: Based on the calculated , Substitute into the PR state equation and calculate the fugacity coefficients of the liquid phase and gas phase respectively. , ; Step 5.4: Calculate the fugacity of liquid and gas phases through the fugacity coefficient; (17); (18); where f i L 、f i V are the fugacity of the i-th component in the oil phase and the gas phase, respectively; Step 5.5: If the condition of formula (19) is satisfied, the system is considered to have reached gas-liquid two-phase equilibrium; if not, the phase equilibrium constant is updated according to formula (20) and returns to formula (1); (19); (20); where K i n is the phase equilibrium constant in the nth calculation.

[0016] Preferably, in step 8, for the result that the two phases have converged, the phase stability test result is used to determine whether the system has a third phase, and then the three-phase flash calculation is used to solve the mole fractions of the gas phase, liquid phase, and enriched phase after phase separation and the mole fractions of the components of the gas phase, liquid phase, and enriched phase; specifically, the following steps are included: step 8.1: using the second phase stability test result and the result of the two-phase flash calculation, the total of two phase equilibrium constants are used as the initial value of the phase equilibrium equation group to solve the following equation (21); (21); where a i is the mole fraction of the component in the enriched phase; n L 、n A are the phase mole fractions of oil phase and enriched phase, respectively; K i V-L and K i A-L are the gas-oil phase equilibrium constant and the enrichment-oil phase equilibrium constant respectively; Step 8.2: Based on the solution of equation (21), n V 、n A , calculate x by formula (22) i ,y i 、a i ;

[0017] (22); Step 8.3: Substitute the calculated x i ,y i 、a i Substitute into the PR state equation 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 by the fugacity coefficient; (25); where f i Ais the fugacity of the i-th component in the enriched phase; Step 8.5: If the condition of formula (26) is satisfied, the system is considered to have reached gas-liquid two-phase equilibrium; if not, the phase equilibrium constant is updated according to formula (27) and returns to formula (1); (26); (27).

[0018] Preferably, three-phase flash calculations are performed on different components using random temperature and pressure, and the component data of each phase at equilibrium is recorded and phase labels are added, including enriched phases and non-enriched phases, to serve as a data set for the phase recognition model.

[0019] 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 Assuming that the phase is a non-enriched phase, there is no obvious grouping and aggregation rule. Formula (3) is used instead of the Wilson equation as the starting method for phase stability analysis of the enriched phase: (3); where 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.

[0020] Beneficial technical effects brought by the present invention: In order to solve the shortcomings of traditional three-phase flash calculation, such as instability and cumbersomeness, the present invention constructs an efficient three-phase flash calculation method based on machine learning phase identification model. This method can effectively enhance the accuracy of complex phase identification. For the fuzzy phase boundary in three-phase equilibrium (such as near critical region, near azeotropic point), this method can solve the problems of convergence difficulties or misjudgment that are prone to occur in traditional thermodynamic models, and greatly improve the practicality of three-phase flash calculation in oil and gas reservoir analysis and chemical process analysis. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 Flowchart of a fast and robust three-phase flash calculation method based on a machine learning phase identification algorithm.

[0022] Figure 2 This is the structural diagram of the phase recognition model based on CNN.

[0023] Figure 3 Schematic diagram of the training results of the phase recognition model, where (a) is a schematic diagram of the loss rate change curve, and (b) is a schematic diagram of the accuracy rate change curve.

[0024] Figure 4 Flow chart of the phase equilibrium constant adjustment method based on the phase identification model.

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

[0026] Figure 6 This is a schematic diagram of the calculation results. DETAILED DESCRIPTION

[0027] The present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods: The key terms are defined as follows: (1) Flash calculation: When the total composition of the system is known, the ratio of the gas-liquid two-phase composition and quantity that reaches equilibrium under a certain temperature and pressure is calculated. It is one of the basic contents of gas-liquid equilibrium calculation.

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

[0029] (3) Enriched phase: A phase formed by the large-scale enrichment of a specific component and can be determined by flash evaporation calculation.

[0030] (4) Phase stability test: A prerequisite for flash calculations, used to determine whether the calculation system will undergo phase separation under given conditions, that is, whether there are multiple phases (such as gas phase and liquid phase).

[0031] The three-phase flash calculation proposed in the present invention is performed on the basis of the two-phase flash calculation. Therefore, there are two phase stability tests. The first one is to determine whether the two-phase system is established, and the second one is to detect whether the third phase exists. Before each phase stability test, the phase recognition model must be applied to determine whether the enriched phase (water phase / CO2 phase) exists. The steps of the present invention are as follows:

[0032] Step 1: Construct a phase recognition model based on CNN; The prediction principle of the Wilson equation is the difference in molar mass between the two phases. Since the molar mass of the oil phase and the gas phase is usually quite different, for pure hydrocarbon fluids, the application of the Wilson equation for phase stability analysis can well determine whether the oil phase can precipitate into the gas phase, or whether the gas phase can condense into the oil phase. For the enriched phase (water phase, CO2 phase, etc.), whether the Wilson equation or its derivative is applied, the results of the phase stability analysis are difficult to guarantee, so it is necessary to design an effective phase equilibrium constant startup method based on the molar fraction characteristics of the components of the enriched phase.

[0033] Table 1 shows the mole fraction information of the components of the oil phase, gas phase, water phase, and CO2 phase after the multiphase flash calculation converges. It is not difficult to see from the table that the enriched phase is dominated by a certain component occupying the vast majority of the mole fraction in the phase, while the non-enriched phase does not have an obvious component enrichment pattern. Considering the component enrichment characteristics of the enriched phase, it can be assumed in the phase stability analysis that there is a phase whose component mole fraction is occupied by a certain component at 90%, and the remaining 10% is occupied by the remaining components according to the feed ratio z. i Since the oil phase is a non-enriched phase and does not have component enrichment characteristics, the feed ratio of the visible component is the approximate oil phase component. The assumed enriched phase is similar to z i Phase division can obtain the phase equilibrium constant expression (3) with the oil phase as the reference phase, which will replace the Wilson equation and its derivatives and serve as a starting method for phase stability analysis of the enriched phase.

[0034] (3); Through this method, phase stability analysis can be used to effectively determine whether the newly emerged phase state is likely to exist in the form of an enriched phase. However, the premise for the implementation of this method is that the enriched phase has not appeared. If the enriched phase has already appeared in the previous flash calculation, the Wilson equation and its derivatives should be used to determine the existence of the oil phase / gas phase. Equation (3) essentially gives a directional judgment method for the enriched phase. Therefore, in multiphase flash calculations, the objectives of phase stability analysis are different for different substances that test the phase state. Therefore, it is necessary to develop a method to identify the phase state to be tested during phase stability analysis.

[0035] Table 1: Mole fractions of components in different typical phases

[0036] .

[0037] CNN-based phase recognition model.

[0038] Since the enriched phase is dominated by a certain component, this feature can be used to construct a CNN-based phase recognition training model by using the component mole fraction and component information of each phase as the characteristic value, taking whether the phase is an enriched phase as the target parameter for training and adding a label to each phase. 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 of size 3 × 3 × 16 are used to extract features from the input data. Since the training model only needs to determine whether it is an enrichment phase, two consecutive fully connected layers are used for data transfer operations. In the classification layer, the loss of the model training process is calculated and classified.

[0039] Use random temperature and pressure to perform three-phase flash calculations on different components, record the component data of each phase at phase equilibrium and add phase labels (enriched phase is 1, non-enriched phase is 0) to serve as the data set for the phase recognition training model. A total of 200 data sets were imported into the training model, the data was shuffled, the ratio of training set to test set was set to 8:2, the number of training rounds was set to 100, and the MSE (Mean Square Error) and determination coefficient R were used in the regression evaluation indicators. 2 Evaluate the training effect of the model. MSE represents the error generated by the model in prediction. The smaller the value, the better the fitting effect. 2 It reflects the ratio of the regression sum of squares to the total deviation sum of squares. The closer the value is to 1, the better the fitting effect. 2 The calculation method of is shown in formula (4).

[0040] After the phase recognition model is trained, the curves of its loss rate and accuracy with the training rounds are shown in Figure 3 From the curves (a) and (b), we can see that after about 40 rounds of training, the loss rate and accuracy are no longer stable. At this time, the training loss rate is close to 0% and the accuracy is close to 100%. After 100 rounds of training, the MSE and R 2 The model is saved and the component mole fraction of the phase is imported into the model during flash calculation to realize the recognition function of the enriched phase.

[0041] (4); Before the phase stability analysis, the phase to be analyzed is judged by the phase identification model whether it is an enriched phase, and then combined with formula (3) to start the targeted phase stability analysis of the enriched phase. However, in the multiphase flash calculation, the problem of phase equilibrium constant reference phase disorder still exists. Therefore, it is necessary to develop a new process based on the phase identification results to solve this problem.

[0042] Phase equilibrium constant adjustment based on phase recognition model.

[0043] After the phase identification model determines whether the phase is an enriched phase, the remaining phase state is determined as oil phase / gas phase according to the existence of the enriched phase, thereby fully controlling the phase state information of each phase and performing subsequent phase equilibrium constant adjustment operations based on this information. The implementation flow of this process is shown in Figure 4 .

[0044] When the enriched phase has been determined, since heavier hydrocarbon components are more likely to be found in the oil phase, and lighter components are more likely to be found in the gas phase, the oil phase and the gas phase can be identified by comparing the average molar mass. Formula (5) is used to calculate the estimated 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, thereby completing the identification of the phase state of the entire system.

[0045] (5); where represents the average molar mass of the phase; represents the molar mass of the i-th component; Represents the mole fraction of the i-th component of the phase to be judged.

[0046] Since the working principle of the Wilson equation is to classify the light components and heavy components in the system into two distinct phases, the enriched phase may appear in the two-phase flash calculation results. Therefore, the phase identification model is used to find the enriched phase, and then the average molar mass is used to determine the oil / gas phase. The enriched phase may exist in phase 1, phase 2 or phase 3. It is ideal for the enriched phase to exist in the third phase. Relying on the Wilson equation's ability to distinguish between light and heavy phases, in most cases the first phase is the oil phase. Therefore, there is no need to adjust the phase equilibrium constant, and the correct equilibrium result can be obtained through flash calculation. If the Wilson equation mistakenly regards the enriched phase as the heavier phase (the first phase is the enriched phase), the other lighter phase may be the gas phase or the oil phase. This is related to the feed component ratio of the system. At this time, the component mole fraction in equation (5) should be replaced with the component feed ratio z i To compare the molar mass with the phase, if the phase is heavier, there are more heavy components in the phase, and the 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 the case where the first phase is the enriched phase. After all phase states are identified, the expression form of the original phase equilibrium constant is determined, and all phase equilibrium constants are uniformly adjusted to the state where the reference phase is the oil phase. Thus, the phase equilibrium constant adjustment based on the phase identification model is realized.

[0047] Step 2: Phase stability test: Before calculating two-phase / three-phase flash evaporation, the mixture needs to be tested for phase stability. The purpose of this process is to determine whether the mixture will split into more phases under given temperature and pressure conditions to achieve a state with a smaller Gibbs free energy. The specific calculation process is as follows: (1) Assuming the system is in liquid phase (gas phase), use the PR state equation to calculate the fugacity of the system ; (2) The gas-liquid equilibrium constant required for calculation is given by formula (6); (6); where 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; represents the critical pressure of the i-th component, MPa; Represents the calculation system pressure, MPa; represents the eccentricity factor of the i-th component; represents the critical temperature of the i-th component; T represents the temperature of the calculation system; (3) Calculate the molar fraction of the component of the other phase: (7); among them , denote the mole fractions of gas and liquid phase respectively; represents the mole fraction of the feed component; (4) normalize the mole fraction calculated in (3): (8); where S V and S L are the volume fractions of the gas and liquid phases, respectively; Represents the number of components in the calculation system; normalized: (9); where x i ,y i are the normalized mole fractions of the liquid and gas phase components, respectively; (5) the fugacity of the second phase is calculated using the PR equation of state; (6) the successive substitution coefficients of the equilibrium constant are calculated : (10); where f ci is the fugacity of the i-th component under feed conditions; f i V and f i L are the fugacity of the i-th component in the gas phase and the liquid phase respectively; (7) Check whether it converges. The convergence error is the same as before: (11); (8) If it does not converge, update the equilibrium constant by replacing the coefficients successively: (12); (9) Check whether it approaches a trivial solution by the following formula. If so, replace the initial phase of the system and return to the first step; (13); Through the above process, the corresponding and ,if , are all less than 1, which proves that the phase is in a single-phase stable state. Otherwise, the phase is unstable and will split into a new phase. Therefore, the flash calculation will be further performed using the formula.

[0048] Step 3: Two-phase flash calculation: determine whether the system will split into two phases based on the phase stability test results, and calculate the mole fractions of the gas phase and liquid phase after phase separation and the mole fractions of the components of the gas phase and liquid phase through two-phase flash calculation.

[0049] (1) Using the phase stability test results as the initial value of the equilibrium constant, solve the following equation: (14); (2) Based on solving equation (14) , calculated by formula (13) and formula (14) , ; (15); (16); (3) The calculated , Substitute into the PR state equation and calculate the fugacity coefficients of the liquid phase and gas phase respectively. , ; (4) Calculate the fugacity of liquid and gas phases through the fugacity coefficient; (17); (18); (5) If the conditions of formula (19) are met, the system can be considered to have reached gas-liquid two-phase equilibrium; if not, the phase equilibrium constant is updated according to formula (20) and returns to formula (1); (19); (20).

[0050] Step 4: Three-phase flash calculation; for the results of two-phase convergence, determine whether there is a third phase in the system based on the phase stability test results, and then use the three-phase flash calculation to solve the mole fractions of the gas phase, liquid phase, and enriched phase after phase separation, as well as the mole fractions of the components of the gas phase, liquid phase, and enriched phase.

[0051] (1) Using the results of the second phase stability test and the results of the two-phase flash calculation, the two phase equilibrium constants are taken as the initial values ​​of the phase equilibrium equations to solve the following equation: (twenty one).

[0052] (2) Based on the solution of formula (21), n V 、n A , calculate x by formula (22) i ,y i 、a i ; (twenty two).

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

[0054] (4) Calculate the fugacity of the enriched phase using the fugacity coefficient; (25).

[0055] (5) If the conditions of equation (26) are met, the system can be considered to have reached gas-liquid two-phase equilibrium; if not, the phase equilibrium constant is updated according to equation (27) and returns to (1); (26); (27).

[0056] Equation (21) belongs to a nonlinear system of equations. The selection of a reasonable solution method is conducive to the efficient calculation of three-phase flash evaporation. The generalized Newton iteration method can quickly solve the nonlinear system of equations.

[0057] Step 5: Optimized multiphase flash calculation method.

[0058] The optimization method developed in the previous article is added to the flash calculation to form an optimized flash calculation process. The specific process is shown in Figure 1 Before the overall flash calculation, the enrichment phase needs to be defined. This step is to determine the feed ratio before the second phase flash calculation. Whether the mole fraction of the component that may be enriched into a phase alone exceeds a certain value. If there are many enriched components, even if the Wilson equation is used to start the phase stability analysis, it is very likely that the enriched phase will be identified as a new phase, which will fundamentally lead to the confusion of the reference phase of the phase equilibrium constant and will also make the subsequent flash calculation inconvenient. Therefore, when the enriched component reaches a certain amount (>0.2), the first phase stability analysis should be performed using formula (3). If there are few enriched components, only the Wilson equation is used for phase stability analysis, and subsequent flash calculations are performed based on the results.

[0059] At the end of the two-phase flash calculation, the phase identification model is used to identify the two existing phases, and the start-up plan for the second phase stability analysis is selected based on whether the enriched phase appears. The phase identification model is then used to predict the phase type of the third phase and adjust the phase equilibrium constant. After these steps are completed, the second stability analysis will be performed. Due to the different occurrence states of the two existing phases, the phases that need to be analyzed for stability are also different. Since the enriched phase is composed of a large amount of a component, if the enriched phase has appeared, the stability analysis of the other phase will be performed accordingly; if the enriched phase does not appear, the stability analysis of the oil phase should be performed considering the molar mass and interaction force of the components. The results of the phase stability analysis will directly determine the calculation results. If the analysis result is stable and the third phase does not exist, the results of the two-phase flash calculation are directly output; if the result is unstable, the three-phase flash calculation will be started and the results will be output after convergence.

[0060] Implementation example: Define the group ratios where three phases may coexist, use random temperature and pressure calculations to generate multiple groups of three-phase equilibrium phase fractions and component information, and use different marking methods (phase labels) for different phases, such as Figure 5 As shown in (a) and (b) in the figure, the component information of each phase is used as the input value, and the phase label is used as the training target value, which together constitute the training data set.

[0061] After the model training is completed, the components in Table 2 are used for calculation, and the following is obtained: Figure 6 The multiphase phase equilibrium result diagram is shown.

[0062] Table 2: Examples of components

[0063] .

[0064] The PR state equation belongs to the cubic state equation, which is divided into two terms: repulsive term and attractive term. The PR state equation is a two-parameter equation, and its apparent pressure expression is: (A1); Indicates system pressure; Indicates system pressure; represents the volume of the system; is the ideal gas constant.

[0065] In formula (A1), the first term on the right is the repulsive term, and the second term is the attractive term and is temperature-dependent. For pure substances, the parameters and Defined as: (A2); (A3); (A4); (A5); Indicates critical pressure; Indicates critical pressure; represents the relative temperature, calculated by formula (A6); is the eccentricity factor; (A6).

[0066] For mixtures, the van der Waals mixing rule is introduced: (A7); (A8);

[0067] (A9); The parameters of the mixture ; is the initial mole fraction of component i; is the binary interaction coefficient (BIP).

[0068] In the process of thermodynamic calculation, compared with the explicit pressure expression state equation, the more commonly used expression is the compression factor 𝑍. The compression factor 𝑍 expression of the PR state equation is: (A10); Formula (A10) is a cubic equation, so there may be three valid real roots For thermodynamic calculations, the solution that can obtain the lowest Gibbs free energy among the three real roots is a valid solution. For three different real roots, the largest value is defined as , the minimum value is defined as , discard the middle value, and give the corresponding judgment formula for the two compression coefficients: (A11);

[0069] If the result of formula (A11) is greater than 0, select , otherwise select After obtaining the correct compression factor 𝑍, the fugacity coefficient is calculated according to formula (A12).

[0070] (A12).

[0071] Of course, 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 technicians in this technical field within the essential scope of the present invention should also fall within the protection scope of the present invention.

Claims

1. An efficient three-phase flash calculation method based on a machine learning phase identification model, characterized in that: The following steps are involved: Step 1: Initialize component data; Step 2: Build a phase recognition model based on CNN; Step 3: Adjust the phase equilibrium constant based on the phase identification model; Step 4: Perform phase stability test. If the test result is single-phase balance, output the result. Otherwise, execute step 5. Step 5: Perform two-phase flash calculation; Step 6: Use the CNN phase recognition model to determine whether there is an enriched phase in the two-phase flash calculation results. 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: Perform phase stability test again. If the test result is two-phase equilibrium, output the result. Otherwise, execute step 8. Step 8: Perform three-phase flash calculation and output the results.

2. The efficient three-phase flash calculation method based on machine learning phase identification model according to claim 1 is characterized in that: In step 1, the third phase is defined as the enriched phase. If the component fraction of the enriched phase alone in the feed mole fraction is greater than 0.2, the initial method for the enriched phase is used as the initial value of the phase equilibrium constant for subsequent calculations. Otherwise, the Wilson equation is used as the initial value of the phase equilibrium constant for subsequent calculations.

3. The efficient three-phase flash calculation method based on machine learning phase identification model according to claim 1 is characterized in that: In step 2, the phase recognition model uses the component mole fraction and component information of each phase as feature values, takes whether the phase is an enriched phase as the target parameter for training, and adds a phase label to each phase to determine the phase state to be tested during phase stability analysis.

4. The efficient three-phase flash calculation method based on machine learning phase identification model according to claim 1 is characterized in that: In step 2, the phase recognition model training process is as follows: The one-dimensional array is input into the input layer, and then two convolutional layers are used to extract features of the input data. Finally, two fully connected layers are used to perform data transmission operations. In the classification layer, the loss of the model training process is calculated and classified.

5. The efficient three-phase flash calculation method based on machine learning phase identification model according to claim 1 is characterized in that: In step 3, when the phase equilibrium constant is adjusted using the phase recognition model, the enriched phase is included in the first phase, the second phase and the third phase; specifically, the following steps are included: Step 3.1: Determine whether the phase is an enriched phase through the phase identification model; Step 3.2: According to the existence of the enriched phase, use formula (5) to calculate the average molar mass to determine whether it is an oil phase or a gas phase: (5); In the formula, represents the average molar mass of the phase; represents the molar mass of the i-th component; Represents the mole fraction of the i-th component of the phase to be judged; The phase with a larger average molar mass is taken as the oil phase, and the phase with a smaller average molar mass is taken as the gas phase, thus completing the identification of the phase state of the entire calculation system.

6. The efficient three-phase flash calculation method based on machine learning phase identification model according to claim 1 is characterized in that: Step 4 specifically includes the following steps: Step 4.1: Assuming the system for flash calculation is liquid or gas phase, calculate the fugacity of each component in the system ; Step 4.2: The gas-liquid equilibrium constant required for calculation is given by equation (6); (6); In the formula, 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; represents the critical pressure of the ith component, in MPa; Represents the calculation system pressure, in MPa; represents the eccentricity factor of the i-th component; represents the critical temperature of the i-th component; T represents the temperature of the calculation system; Step 4.3: Calculate the mole fraction of the component of the other phase by equation (7); (7); in, , denote the mole fractions of gas and liquid phase respectively; represents the mole fraction of feed component; Step 4.4: normalize the mole fraction calculated by equation (3); (8); In the formula, S V and S L are the volume fractions of the gas and liquid phases, respectively; Represents the number of components in the calculation system; Normalization: (9); In the formula, x i ,y i are the normalized mole fractions of liquid and gas phase components, respectively; Step 4.5: Calculate the fugacity of the second phase; Step 4.6: Calculate the successive substitution coefficient of the equilibrium constant : (10); In the formula, f ci is the fugacity of the i-th component under feed conditions; f i V and f i L are the fugacity of the i-th component in the gas phase and liquid phase, respectively; Step 4.7: Check whether it converges. The convergence error is shown in formula (11): (11); Step 4.8: If it does not converge, update the equilibrium constant by replacing the coefficients successively: (12); Step 4.9: Check whether it approaches a trivial solution through equation (13). If so, change the initial phase of the calculation system and return to step 1; (13); Through the above process, the corresponding and ,if , are all less than 1, which proves that the phase is in a single-phase stable state. Otherwise, the phase is unstable and will split into a new phase.

7. The efficient three-phase flash calculation method based on machine learning phase identification model according to claim 1 is characterized in that: In step 5, whether the system will split into two phases is determined by the phase stability test results, and the mole fractions of the gas phase and the liquid phase after phase separation and the mole fractions of the components of the gas phase and the liquid phase are calculated by two-phase flash evaporation, which specifically includes the following steps: Step 5.1: Using the phase stability test results as the initial value of the equilibrium constant, solve equation (14); (14); In the formula, is the phase mole fraction of the gas phase; Step 5.2: Based on solving equation (14), we get , calculated by formula (13) and formula (14) , ; (15); (16); Step 5.3: Based on the calculated , Substitute into the PR state equation and calculate the fugacity coefficients of the liquid phase and gas phase respectively. , ; Step 5.4: Calculate the fugacity of the liquid and gas phases using the fugacity coefficient; (17); (18); In the formula, f i L 、f i V are the fugacity of the i-th component in the oil phase and gas phase, respectively; Step 5.5: If the condition of formula (19) is satisfied, the system is considered to have reached gas-liquid two-phase equilibrium; if not, the phase equilibrium constant is updated according to formula (20) and the equation (1) is returned. (19); (20); In the formula, K i n is the phase equilibrium constant in the nth calculation.

8. The efficient three-phase flash calculation method based on machine learning phase identification model according to claim 1 is characterized in that: In step 8, for the result that the two phases have converged, the phase stability test result is used to determine whether the system has a third phase, and then the three-phase flash calculation is performed to solve the mole fractions of the gas phase, liquid phase, and enriched phase after phase separation and the mole fractions of the components of the gas phase, liquid phase, and enriched phase; specifically, the steps include: Step 8.1: Using the results of the second phase stability test and the results of the two-phase flash calculation, the total of the two phase equilibrium constants are used as the initial values ​​of the phase equilibrium equations to solve the following equation (21); (21); In the formula, a i is the mole fraction of the component in the enriched phase; n L 、n A are the phase mole fractions of oil phase and enriched phase, respectively; K i V-L and K i A-L are the gas-oil phase equilibrium constant and the enrichment-oil phase equilibrium constant, respectively; Step 8.2: Based on the solution of equation (21), n V 、n A , calculate x by formula (22) i ,y i 、a i ; (22); Step 8.3: Substitute the calculated x i ,y i 、a i Substitute into the PR state equation 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 using the fugacity coefficient; (25); Where, f i A is the fugacity of the i-th component in the enriched phase; Step 8.5: If the condition of formula (26) is satisfied, the system is considered to have reached gas-liquid two-phase equilibrium; if not, the phase equilibrium constant is updated according to formula (27) and the equation (1) is returned; (26); (27)。 9. The efficient three-phase flash calculation method based on machine learning phase identification model according to claim 1 is characterized in that: Three-phase flash calculations are performed for different components using random temperature and pressure. The component data of each phase at equilibrium is recorded and phase labels are added, including enriched phase and non-enriched phase, which is used as the data set for the phase recognition model.

10. The efficient three-phase flash calculation method based on machine learning phase identification model according to claim 1 is characterized in that: The initial value of the phase equilibrium constant uses the initial method for the enriched phase: If the enriched phase and component feed z i Assuming that the phase is a non-enriched phase, there is no obvious grouping and aggregation rule. Formula (3) is used instead of the Wilson equation as the starting method for phase stability analysis of the enriched phase: (3); 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

  • Method for cost effective thermo-dynamic fluid property predictions using machine-learning based models

    CN111344710A

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

    CN113241127A

  • Fracture-vug type oil reservoir phase equilibrium calculation method and device, electronic equipment and storage medium

    CN113496069A

  • Fractured reservoir CO2 drive flow simulation method using neural network technology

    CN114139432A

  • Method for calculating viscosity of CO2 and crude oil system based on two-phase flash evaporation theory

    CN114818527A

Cited By

  • Deep learning assisted multiphase multicomponent numerical simulation method and device

    CN122088320A

  • Deep learning assisted multiphase multicomponent numerical simulation method and apparatus

    CN122088320B