A crude oil phase diagram fitting method and system based on trust region method
By using the trusted domain method in the calculation of the P-T phase diagram of the oil and gas collection, the combination method of the alternating iteration method and the Newton iterative method of the oil and gas collection method solves the problem of calculation errors in the phase diagram in the existing technology, and improves the accuracy and mining economy.
Patent Information
- Application Number
- CN202110108230.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-27
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2041-01-27
AI Technical Summary
The prior art has errors in calculating the P-T phase diagram of oil and gas reservoirs, especially in component merging or splitting operations, which leads to changes in the phase state characteristics of the fluid, affecting the economy and accuracy of reservoir mining.
The crude oil phase drawing method based on the trust domain method is used to combine the alternate iteration method and the Newton iteration method to fit the phase diagram using the global convergence of the trust domain algorithm to ensure the stability and accuracy of the calculation.
The accuracy of the analysis of crude oil fluids is improved, the error in the calculation of the phase diagram is reduced, and the consistency and accuracy of the subsequent phase analysis results are ensured, thereby improving the economic benefits of the mining of oil collection.
Smart Images

Figure CN114818520B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of oil and gas reservoir engineering, and in particular relates to a crude oil phase diagram fitting method and system based on a trust region method. Background Art
[0002] Reservoir fluids are complex mixtures containing many hydrocarbon components. At a given temperature and pressure, these components can be distributed between liquid and gas phases. Phases can be defined as uniform parts of a system with exactly the same physical and chemical properties, and there are obvious differences in properties between different phases. The PT phase diagram of oil and gas reservoirs represents the temperature and pressure range and the range of phase coexistence of complex fluids in oil and gas reservoirs at different gas or liquid content. It has a large number of applications in reservoir engineering, including: research on phase characteristics of oil and gas reservoir fluids, identification of oil and gas reservoir types, high oil recovery (EOR), and separator design. Therefore, the calculation and fitting of the PT phase diagram of oil and gas reservoirs is crucial in the calculation and analysis of reservoir fluids.
[0003] The PT phase diagram (or phase envelope) of an oil and gas reservoir is composed of a series of equal liquid volume lines. The equal liquid volume line is a phase characteristic line composed of a series of (P, T) state points when the liquid phase mole fraction is a constant. The calculation of the PT phase diagram of an oil and gas reservoir is the calculation of equal liquid volume lines under different liquid (or gas) contents of a specific component system of the reservoir. g Within the range of ≤1, given a series of gas (liquid) phase mole fractions, a series of (P, T) state points will be calculated. By plotting these state points, the isofluid lines at the corresponding liquid phase mole fractions can be obtained, and the phase diagram can be obtained.
[0004] At present, the main calculation methods for the PT phase diagram (or equal liquid volume line) of oil and gas reservoirs can be roughly divided into two categories. One is the single variable iteration method solved by the successive alternating iteration method. This method is simple to program, has low requirements on initial values, and has good algorithm stability, but the convergence speed is poor. The other is the multivariable iteration method that solves the nonlinear equation group through Newton-Raphson iteration. Although this method has a fast convergence speed, it has strict requirements on initial values, and it will diverge near the critical point due to the singularity of the Jacobi matrix.
[0005] In the component analysis process, in the component operations such as component merging or splitting, the empirical formula is generally used to calculate the component properties to obtain new component characteristic parameters. In this process, the PT phase diagram of the oil and gas reservoir will generally produce certain errors, causing changes in the phase characteristics of the fluid. However, in the current mainstream PVT analysis software, whether it is Schlumberger's PVTi software, CMG's WinProp software or the special PVT analysis software PVTsim, none of them considers the errors caused by these operations to the PT phase diagram of the oil and gas reservoir, and cannot guarantee the consistency and accuracy of the subsequent phase analysis results, which will bring huge economic losses to the exploitation of the oil reservoir to a certain extent.
[0006] In summary, there is an urgent need for a technical solution that can overcome the shortcomings of the existing technology and can efficiently and stably calculate the complex phase diagram of crude oil and fit the phase diagram. Summary of the invention
[0007] In order to solve the problems existing in the prior art, the present invention proposes a crude oil phase diagram fitting method and system based on the trust region method. The present invention adopts a combination of an alternating iteration method and a Newton iteration method to efficiently and stably calculate the complex phase diagram of crude oil, and adopts a globally convergent trust region algorithm to fit the phase diagram, which can ensure global convergence and rapid convergence, and effectively improve the accuracy of crude oil fluid analysis.
[0008] In a first aspect of an embodiment of the present invention, a crude oil phase diagram fitting method based on a trust region method is proposed, the method comprising:
[0009] Obtaining the original state equation parameters of crude oil and the state equation parameters that need to be fitted;
[0010] According to the original state equation parameters of crude oil and the state equation parameters to be fitted, a fitting parameter combination is selected and the fitting parameter limits are set;
[0011] According to the combination of fitting parameters, the trust region algorithm is used to fit the original phase diagram of crude oil;
[0012] Output the fitted state equation parameters and compare the original phase diagram with the fitted phase diagram results;
[0013] Check the fitting comparison results. If they do not meet the fitting requirements, adjust the fitting parameters and refit.
[0014] In a second aspect of an embodiment of the present invention, a crude oil phase diagram fitting system based on a trust region method is proposed, the system comprising:
[0015] Parameter acquisition module, used to obtain the original state equation parameters of crude oil and the state equation parameters that need to be fitted;
[0016] A selection module is used to select a fitting parameter combination and set fitting parameter limits according to the original state equation parameters of the crude oil and the state equation parameters to be fitted;
[0017] A fitting calculation module is used to perform fitting calculation on the original phase diagram of crude oil using a trust region algorithm according to a combination of fitting parameters;
[0018] The comparison module is used to output the parameters of the state equation after fitting and compare the results of the original phase diagram with the fitted phase diagram;
[0019] The checking module is used to check the fitting comparison results. If they do not meet the fitting requirements, the fitting parameters are adjusted and refitted.
[0020] In a third aspect of an embodiment of the present invention, a computer device is proposed, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a crude oil phase diagram fitting method based on a trust region method when executing the computer program.
[0021] In a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, a crude oil phase diagram fitting method based on a trust region method is implemented.
[0022] The crude oil phase diagram fitting method and system based on the trust region method proposed by the present invention obtain the original state equation parameters of the crude oil and the state equation parameters that need to be fitted; select the fitting parameter combination according to the original state equation parameters of the crude oil and the state equation parameters that need to be fitted, and set the fitting parameter limit; according to the fitting parameter combination, the trust region algorithm is used to fit and calculate the original phase diagram of the crude oil; the state equation parameters after fitting are output, and the results are compared according to the original phase diagram and the fitting phase diagram; the fitting comparison result is checked, and if it does not meet the fitting requirements, the fitting parameters are adjusted and re-fitted. The present invention has strong feasibility, good calculation stability, fast convergence speed, good fitting effect, and can greatly improve the accuracy of crude oil component analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0024] Figure 1 The figure is a schematic flow chart of a crude oil phase diagram fitting method based on the trust region method according to an embodiment of the present invention.
[0025] Figure 2Schematic diagram of logarithmic transformation of fitting parameters.
[0026] Figure 3 Flow chart for calculation of isofluvial phase diagram.
[0027] Figure 4 Calculate the initial point K for the combined Wilson formula and RR equation i And T initial value flow chart.
[0028] Figure 5 This is the flowchart for solving the problem using the alternating iteration method.
[0029] Figure 6 Flowchart for accelerating the solution of Newton-Raphson iteration method.
[0030] Figure 7 Schematic diagram of the isofluidic phase diagram and the original phase diagram results after the original components are merged.
[0031] Figure 8 This is a schematic diagram of the fitting results after phase diagram fitting.
[0032] Fig. 9 Schematic diagram of the crude oil phase diagram fitting system architecture based on the trust region method according to an embodiment of the present invention.
[0033] Fig.10 The figure is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The principles and spirit of the present invention will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present invention, and are not intended to limit the scope of the present invention in any way. On the contrary, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0035] Those skilled in the art will appreciate that the embodiments of the present invention may be implemented as a system, device, apparatus, method or computer program product. Therefore, the present disclosure may be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0036] According to an embodiment of the present invention, a crude oil phase diagram fitting method and system based on the trust region method are proposed.
[0037] In the process of crude oil component analysis, operations such as component merging or splitting are required. Generally, the phase diagram of the newly formed component will be different from the phase diagram of the original component, thereby changing the properties of the original crude oil component. To this end, the present invention proposes a complex isofluidic line phase diagram calculation method combining an alternating direct solution algorithm and a Newton accelerated iteration algorithm. The method overcomes the problems of poor convergence speed of the alternating direct solution algorithm and stringent initial value requirements of the Newton accelerated iteration, and has the characteristics of fast convergence speed and good calculation stability. At the same time, a trust region algorithm with global convergence is used to fit the phase diagram. The phase diagram fitting first determines the isofluidic line phase diagram with the critical point of the phase diagram as the characteristic point. The specified variable set of the fitting point is then accurately calculated during the iteration process of the isofluidic line phase diagram, and then the error set between the fitted phase diagram and the isofluidic line curve on the original phase diagram is calculated. The Jacobian matrix of the fitting parameters is calculated using the numerical derivation method, thereby converting the isofluidic line phase diagram fitting problem into the Levenberg-Marquardt nonlinear minimum optimization problem. Finally, the phase diagram fitting is realized based on the trust region algorithm. The implementation example shows that this method has the characteristics of strong feasibility, good calculation stability, fast convergence speed, good fitting effect, etc. The use of this method greatly improves the accuracy of crude oil component analysis.
[0038] The principle and spirit of the present invention are explained in detail below with reference to several representative embodiments of the present invention.
[0039] Figure 1 FIG. 1 is a flow chart of a crude oil phase diagram fitting method based on a trust region method according to an embodiment of the present invention. Figure 1 As shown, the method includes:
[0040] Step S1, obtaining the original state equation parameters of crude oil and the state equation parameters to be fitted;
[0041] Step S2, selecting a fitting parameter combination according to the original state equation parameters of the crude oil and the state equation parameters to be fitted, and setting the fitting parameter limits;
[0042] Step S3, using a trust region algorithm to perform fitting calculation on the original phase diagram of crude oil according to the fitting parameter combination;
[0043] Step S4, outputting the fitted state equation parameters, and comparing the original phase diagram with the fitted phase diagram results;
[0044] Step S5, check the fitting comparison result, if it does not meet the fitting requirements, adjust the fitting parameters and re-fit.
[0045] In order to explain the crude oil phase diagram fitting method based on the trust region method more clearly, each step is described in detail below.
[0046] Step S1:
[0047] Obtain the original state equation parameters of crude oil and the state equation parameters that need to be fitted. The state equation parameters mainly include: critical parameters (P c ,T c ,V c ,Z c );State equation coefficient (Ω a ,Ω b ); physical characteristic parameters (eccentricity factor ω c , volume correction coefficient Sshift); binary interaction coefficient kij; mole fraction (zi), select a suitable state equation including three-parameter PR or SRK state equation.
[0048] Step S2:
[0049] Select appropriate fitting parameter combinations and set fitting parameter limits. The fitting parameters mainly select the state equation parameters of the heavy components and the merged components (components with different properties from the original components). The basic principles for selecting the fitting state equation parameters are:
[0050] 1. Mainly select critical parameters, state equation coefficients or physical characteristic parameters;
[0051] 2. Try not to choose the binary correlation coefficient;
[0052] 3. It is forbidden to select mole fraction as the fitting parameter. The principle of fitting limit is that the larger the fitting limit range, the greater the change of the fitting parameter. The fitting parameter limit range of the heavy component can be set larger, and the fitting parameter limit range of the light component can be relatively small.
[0053] Step S3:
[0054] The trust region algorithm is used to fit the original phase diagram of crude oil. The specific process includes:
[0055] Step S21, according to the combination of fitting parameters, using the logarithmic transformation method to process the constrained fitting parameters using the first variable equivalent;
[0056] refer to Figure 2 , is a schematic diagram of the logarithmic transformation of the fitting parameters. Figure 2 As shown, for each fitting parameter x, the variable S can be used i To be equivalent, they can achieve one-to-one correspondence through the following formula;
[0057]
[0058] After logarithmic transformation, the constraint boundary is removed and the fitting independent variable becomes S i , through S iIterate to reduce the objective function until convergence, and finally use S i Inverse the relationship between and x to find x.
[0059] Step S22, using an alternating iteration method combined with a Newton-Raphson iteration method to calculate an isofluidic phase diagram to obtain a phase diagram of original component parameters;
[0060] Step S23, using a curve fitting method for calculating characteristic point distances to calculate a phase diagram of the fitted component parameters, and calculating a fitting error of the distances from the characteristic points corresponding to the original component parameters;
[0061] Specifically, S is calculated by back-calculating the constraint function i The fitting parameter x is substituted into the fitting state equation parameter to calculate the phase diagram of the isofluid line, and the fitting error with the original phase diagram is calculated.
[0062] Step S24, using a numerical derivation method to calculate the Jacobian matrix of the fitting error with respect to the first variable;
[0063] That is, the numerical derivation method is used to calculate the fitting error with respect to S i The Jacobian matrix of the collection.
[0064] Step S25, according to the Jacobian matrix, using a trust region algorithm, and performing fitting calculation of the phase diagram by iteratively updating the first variable.
[0065] Among them, the trust region algorithm is used to iteratively update S i , and perform fitting calculation of the phase diagram.
[0066] Specifically, the detailed process of step S22 is as follows:
[0067] Step S221, using the simultaneous RR equation and Wilson formula method to calculate the starting point value of the isofluidic line phase diagram;
[0068] Step S222, according to the starting point value of the isofluidic phase diagram, an alternating iteration method accelerated by the main eigenvalue is used to control the error within a certain range;
[0069] Step S223, according to the starting point value after the error is controlled, the Newton-Raphson iteration method is used to converge the starting point value;
[0070] Step S224, performing interpolation calculation on the next point to obtain the initial value of the next point;
[0071] Step S225, obtaining a phase diagram of the original component parameters according to the initial value of each point.
[0072] More specifically, step S221 is described in detail:
[0073] refer to Figure 3 and Figure 4 , respectively, are the flow chart for calculating the isofluidic phase diagram and the calculation of the initial point K by combining the Wilson formula and the RR equation i And the T initial value flow chart, such as Figure 3 and Figure 4 As shown in the figure, the detailed process of calculating the starting point value of the isofluidic phase diagram using the simultaneous RR equation and Wilson formula method is as follows:
[0074] Step A, setting liquid content, pressure and initial temperature;
[0075] Step B: Combine Wilson's formula and RR equation to calculate equilibrium constant K i , intermediate variables Q, dQ / dT; where,
[0076] Step B1, calculate the equilibrium constant K using Wilson's formula i :
[0077]
[0078] Where p is pressure; T is temperature; p ci 、T ci ,ω i are the critical pressure, critical temperature and eccentricity factor of the i-th component respectively;
[0079] Step B2, combine Wilson formula and RR equation to calculate intermediate variables Q and dQ / dT:
[0080]
[0081]
[0082] Where Nc is the total number of components; z i is the mole fraction of the i-th component; F is the liquid content;
[0083] Step C, if Q or dQ / dT is not within the valid range, use binary search method to find the temperature between T1 where Q>0 and T2 where Q<0, so that Q and dQ / dT are within the valid range;
[0084] Step D, calculate the temperature T using Newton's iteration algorithm:
[0085]
[0086] More specifically, step S222 is described in detail:
[0087] refer to Figure 5 , is the flow chart of the alternating iterative method solution; Figure 5As shown in the figure, the detailed process of using the alternating iteration method accelerated by the main eigenvalue to control the error within a certain range is as follows:
[0088] Step A, setting liquid content, pressure and initial temperature;
[0089] Step B, calculating the compressibility factor by using the PR or SRK three-parameter state equation, and obtaining the fugacity and corresponding derivative of the component according to the compressibility factor;
[0090] Step C, calculate the equilibrium constant K using the DEM principal eigenvalue acceleration method i :
[0091]
[0092]
[0093]
[0094]
[0095]
[0096] in, are the fugacity coefficients of the i-th component in the liquid phase and the gas phase, respectively; f i L 、f i V are the fugacity of the i-th component in the liquid phase and the gas phase respectively; the superscript n is the iteration step;
[0097] Step D, calculate the temperature using Newton iteration algorithm
[0098]
[0099]
[0100]
[0101] in, is the temperature of the n+1th iteration step when the liquid content is F.
[0102] More specifically, step S223 is described in detail:
[0103] refer to Figure 6 , which is the Newton-Raphson Newton iteration method accelerated solution flow chart; Figure 6 As shown in the figure, the detailed process of using the Newton-Raphson iteration method to converge the starting point value is:
[0104] Step A, setting liquid content, pressure and initial temperature;
[0105] Step B, calculating the state equation compression factor by using the PR or SRK three-parameter state equation, and obtaining the fugacity and corresponding derivative of the component according to the compression factor;
[0106] Step C, establish the Jacobian matrix; where,
[0107] Step C1, let the iterative unknown quantity X = (ln K1, ln K2, ..., ln K Nc ,ln T,ln p);
[0108] Among them, K i (1≤i≤Nc) is the equilibrium constant of the i-th component;
[0109] Step C2, iterate the equations:
[0110]
[0111] Among them, 1≤i≤Nc; x i and i are the mole fractions of the i-th component in the liquid and gas phases respectively; S = lnp0 or lnT0; when S = lnp0, k = Nc+2, then X k This means taking the Nc+2th component of variable X; when S=lnT0, k=Nc+1;
[0112] Step C3, Jacobi matrix expression:
[0113]
[0114]
[0115]
[0116]
[0117]
[0118]
[0119]
[0120] Where, 1≤i, j≤Nc;
[0121] Step D, Newton iteration of nonlinear equation components:
[0122] X n+1 =X n -Jac -1 g(X n );
[0123] Where n is the iteration step and Jac is the Jacobi matrix generated in step C.
[0124] More specifically, step S224 uses linear interpolation or polynomial interpolation to perform interpolation calculation on the next point; wherein,
[0125] When linear interpolation is used, and The linear interpolation estimation formula is obtained:
[0126]
[0127] Among them, X is the iterative unknown quantity, X i is the i-th quantity; Δp is the pressure increment; the above formula also holds true for temperature T;
[0128] When using polynomial interpolation, use the previous two or three points for polynomial interpolation, and the calculation formula is:
[0129]
[0130] Among them, a im is the interpolation coefficient.
[0131] More specifically, in step S3, the trust region algorithm is used to perform fitting calculation on the original phase diagram of crude oil, including:
[0132] Step A, based on the fitting error, uses the trust region algorithm to transform the nonlinear fitting problem into:
[0133]
[0134] Among them, F(x) is a function composed of the sum of the squares of the error function f(x);
[0135] The second-order Taylor expansion of F(x) is written as:
[0136]
[0137] in,
[0138]
[0139]
[0140] Ignoring the second-order derivative in the formula, we can write
[0141] Where J(x) is the Jacobian matrix
[0142] Step B, use Levenberg-Marquardt iteration to calculate the step size:
[0143]
[0144] Among them, h lm is the step size; μ is the trust region radius; J k is the abbreviated matrix of the Jacobian matrix of f(x) at the kth iteration step; I is the identity matrix;
[0145] Step C, obtain the change of μ according to the evaluation function ρ:
[0146]
[0147] Among them, the denominator is the predicted value of the gain, and the formula for solving the predicted value of the gain is as follows:
[0148]
[0149] Where g is the gradient vector; J is the abbreviated form of the Jacobian matrix; and -g is positive, L(0)-L(h lm ) is a positive value;
[0150] If the value of the evaluation function ρ is greater than the first preset value, the corresponding L(h) iteration effect reaches the expected effect, and the next LM algorithm is made close to the Gauss-Newton process by reducing μ;
[0151] If the control variable ρ is less than the second preset value, the corresponding L(0) iteration effect does not achieve the expected effect, and the iteration step is made closer to the maximum gradient descent direction by increasing the value of μ;
[0152] Step D, by comparing the evaluation function ρ with the preset values ε1, ε2 to determine μ k+1
[0153]
[0154] Among them, μ k+1 and μ k μ is the trust region radius of the k+1th and kth iterations respectively; τ1 and τ2 are the trust region radius reduction coefficient and radius increase coefficient respectively, satisfying 0<τ1<1, τ2>1.
[0155] It should be noted that, although the operations of the method of the present invention are described in a specific order in the above embodiments and the accompanying drawings, this does not require or imply that the operations must be performed in the specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0156] In order to explain the crude oil phase diagram fitting method based on the trust region method more clearly, a specific embodiment is used for illustration below. However, it should be noted that the embodiment is only for better illustrating the present invention and does not constitute an improper limitation to the present invention.
[0157] In the process of fitting the complex phase diagram of crude oil, the calculation of the phase diagram is complex and requires iterative solution. The fitting parameters (state equation parameters) cannot be directly derived and numerical methods are used. Each iteration requires n+1 (n is the number of fitting parameters) phase diagram calculations. Therefore, more phase diagram calculations are involved in phase diagram fitting, and phase diagrams need to be calculated efficiently.
[0158] Secondly, phase diagram fitting also involves arbitrary changes in fitting parameters, so the phase diagram calculation under any combination of fitting parameters must be able to be stably calculated and accurately solved. At the same time, the calculation of crude oil complex phase diagram is complex, and a small change in fitting parameters may cause huge changes in results. Therefore, a method that can ensure global convergence and converge quickly is needed.
[0159] The crude oil phase diagram fitting method based on the trust region method of the present invention mainly includes two aspects: first, a combination of the alternating iteration method and the Newton iteration method is used to efficiently and stably calculate the complex phase diagram of crude oil; second, a globally convergent trust region algorithm is used to fit the phase diagram; the specific scheme is as follows:
[0160] S01, select initialization parameters: initialize fitting parameters x0, initial trust region radius μ0 = τmax{a ii}, judgment threshold 0<ε1<ε2<1, radius expansion ratio 0<τ1<1<τ2, convergence accuracy
[0161] S02, calculate the fitted phase diagram and the original phase diagram respectively, and find the error of the fitting point, as follows:
[0162] S021, critical point calculation. As a major special point on the phase diagram, the critical point plays a key role in the fitting of the isofluidic phase diagram. The Heidemann method is mainly used for direct solution.
[0163] S022, selection of fitting points on the isofluid line. Since the state point (P, T) on the isofluid line is obtained by iterative solution based on the previous state point, we use the single variable iteration method with pressure as the specified variable and temperature as the iteration variable during fitting. The fitting point set on the isofluid line is calculated by calculating the incomplete phase diagram. The specified pressure is P. di =i(P c -P sc ) / N.
[0164] S023, the calculation of the isofluid lines of the phase diagram mainly adopts the method combining the alternating iteration method and the Newton-Raphson iteration method.
[0165] S0231, initialize the starting point pressure P0, the initial iteration step dp and the initial temperature guess T0;
[0166] S0232, calculation of the starting point of the isofluid line:
[0167] a) Calculate the temperature T0 of the starting point P0 and the initial value of the phase equilibrium constant Ki0 by using the RR equation and Wilson formula simultaneously;
[0168] b), based on the initial value calculated in a), the error is reduced to a certain range by using the alternating iteration method accelerated by the main eigenvalue;
[0169] c) Based on the initial value calculated in b), the Newton-Raphson iteration method is used to accelerate the calculation of the starting point (P) 0 Temperature at (T) 0 and phase equilibrium constant (K i ) 0 Values and their relative pressure to the starting point (P) 0 The first derivative of ;
[0170] d), according to the iteration step size (dp) 1 and the specified pressure P di Calculate the pressure at the first point (P) 1 , according to (T) 0 ,(K i ) 0 The derivative and (P) 1 Interpolation calculation (T) 1 ,(K i ) 1 The initial value of .
[0171] S0233, perform Newton-Raphson iterative calculation on the kth point according to the initial value calculated at the previous point. If the iteration fails, go to S0234, otherwise go to S0235:
[0172] S0234: If the iteration fails, recalculate using the alternating iteration method and accelerate convergence through Newton-Raphson. If the iteration continues to fail, go to S0235; otherwise, go to S0236.
[0173] S0235, reduce the step length (dp) k , recalculate the specified pressure (P) k , and interpolate to estimate (T) k ,(K i )k The initial value of , go to S0233 to iterate the calculation again for the kth point.
[0174] S0236, Judgment (dp) k Is it less than the set limit value, or (P) k When reaching the critical point, if one of the conditions is met, the calculation of the equal liquid volume line is jumped out, otherwise it enters S0237.
[0175] S0237, determine the iteration step length (dp) of point k+1 according to the number of iterations of point k k+1 , calculate the specified pressure (P) at k+1 points k+1 , interpolation estimates the next iteration (T) k+1 ,(K i ) k+1 The initial value of , go to S0233 to continue the calculation. S024, according to the calculation results of the original phase diagram and the fitted phase diagram, calculate the error of each fitting point
[0176] S03, using the numerical derivation method, calculate the Jacobi matrix of the fitting point error with respect to the fitting parameter x according to step S02 in Then the first-order gradient descent direction if Exit, otherwise continue.
[0177] S04, calculate the second-order approximate Hessian matrix about the fitting parameter x
[0178] S05, according to the formula Calculate the iteration step size h using Gaussian solver lm .
[0179] S06, calculate x new =x k +h lm , using the formula Calculate the evaluation function ρ, if ρ>0, go to S07, otherwise go to S08.
[0180] S07, by comparing the evaluation function ρ with the preset values ε1, ε2, the following judgment is made and the trust region radius is determined And update the parameter x k+1 =x k +h lm , return to step S02 to perform the next iterative calculation.
[0181] S08, ρ≤0 indicates that the function value is changing in an upward rather than downward trend (contrary to the optimization goal). At this time, we should not move to the next point, but should "stay where we are", that is, keep the original parameter xk+1 =x k , and reduce the radius of the convergence region μ k+1 =τ1μ k , return to step S02 and iterate the calculation again.
[0182] Take an oil field as an example. The crude oil in this oil field contains 41 components. The calculation adopts the PR3 state equation. Since the number of components cannot meet the requirements of crude oil analysis and simulation calculation, it is necessary to merge the components. The example uses the molar average method to merge the original 41 components into 8 components. The isofluidic phase diagram after merging is different from the original phase diagram as shown in the following figure. Figure 7 As shown. From the comparison between the merged phase diagram and the original phase diagram, it can be seen that there is a big difference between the merged phase diagram and the original phase diagram, and the phase diagram fitting must be performed on the merged state equation parameters.
[0183] 1) The original state equation parameters of the crude oil of the original 41 components are selected, and the state equation parameters of the merged 8 components are used as the fitting component data.
[0184] 2) Select a suitable combination of fitting parameters. As shown in Table 1, select 7 combined components and added components, and fit their critical temperatures Tc and critical pressures Pc, with a total of 14 fitting parameters.
[0185] 3) The trust region algorithm is used to fit the original phase diagram of crude oil.
[0186] 4), the fitting results are as follows Figure 8 The fitting parameters are shown in Table 1.
[0187] Table 1 Changes in fitting parameters
[0188] Fitting components State equation parameters Pre-fitting value After fitting Change N2-C1 Pc 666.6859 669.166 1.00372 C2-C3 Pc 669.2124 671.916 1.00404 IC4-C6 Pc 489.4524 487.659 0.996336 C7-C10 Pc 400.4859 397.415 0.992332 C11-C20 Pc 269.5295 262.181 0.972736 C21-C35 Pc 174.657 171.437 0.981564 C36+ Pc 53.46961 52.9732 0.990716 N2-C1 Tc 342.3557 341.039 0.996154 C2-C3 Tc 598.7472 587.932 0.981937 IC4-C6 Tc 837.0256 839.838 1.00336 C7-C10 Tc 1047.36 1040.33 0.993288 C11-C20 Tc 1275.265 1276.17 1.00071 C21-C35 Tc 1527.03 1559.54 1.02129 C36+ Tc 1874.806 1874.9 1.00005
[0189] After introducing the method of the exemplary embodiment of the present invention, next, refer to Fig. 9 A crude oil phase diagram fitting system based on the trust region method according to an exemplary embodiment of the present invention is introduced.
[0190] The implementation of the crude oil phase diagram fitting system based on the trust region method can refer to the implementation of the above method, and the repetition will not be repeated. The term "module" or "unit" used below can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware, or the implementation of a combination of software and hardware is also possible and conceived.
[0191] Based on the same inventive concept, the present invention also proposes a crude oil phase diagram fitting system based on the trust region method, such as Fig. 9 As shown, the system includes:
[0192] The parameter acquisition module 910 is used to acquire the original state equation parameters of the crude oil and the state equation parameters that need to be fitted;
[0193] A selection module 920 is used to select a fitting parameter combination and set a fitting parameter limit according to the original state equation parameters of the crude oil and the state equation parameters to be fitted;
[0194] A fitting calculation module 930 is used to perform fitting calculation on the original phase diagram of crude oil using a trust region algorithm according to a combination of fitting parameters;
[0195] A comparison module 940 is used to output the fitted state equation parameters and compare the original phase diagram with the fitted phase diagram results;
[0196] The checking module 950 is used to check the fitting comparison result. If the fitting result does not meet the fitting requirements, the fitting parameters are adjusted and the fitting is repeated.
[0197] It should be noted that, although several modules of the crude oil phase diagram fitting system based on the trust region method are mentioned in the above detailed description, this division is only exemplary and non-mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules described above can be concretized in one module. On the contrary, the features and functions of one module described above can be further divided into being concretized by multiple modules.
[0198] Based on the above invention concept, Fig.10 As shown, the present invention also proposes a computer device 1000, including a memory 1010, a processor 1020, and a computer program 1030 stored in the memory 1010 and executable on the processor 1020, wherein the processor 1020 implements the aforementioned crude oil phase diagram fitting method based on the trust region method when executing the computer program 1030.
[0199] Based on the aforementioned inventive concept, the present invention proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the crude oil phase diagram fitting method based on the trust region method is implemented.
[0200] The crude oil phase diagram fitting method and system based on the trust region method proposed by the present invention obtain the original state equation parameters of the crude oil and the state equation parameters that need to be fitted; select the fitting parameter combination according to the original state equation parameters of the crude oil and the state equation parameters that need to be fitted, and set the fitting parameter limit; according to the fitting parameter combination, the trust region algorithm is used to fit and calculate the original phase diagram of the crude oil; the state equation parameters after fitting are output, and the results are compared according to the original phase diagram and the fitting phase diagram; the fitting comparison result is checked, and if it does not meet the fitting requirements, the fitting parameters are adjusted and re-fitted. The present invention has strong feasibility, good calculation stability, fast convergence speed, good fitting effect, and can greatly improve the accuracy of crude oil component analysis.
[0201] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0202] The present invention is described with reference to flowcharts and / or block diagrams of methods and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0203] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0204] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0205] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A crude oil phase diagram fitting method based on the trust region method, characterized in that: The method includes: Obtaining the original state equation parameters of crude oil and the state equation parameters that need to be fitted; According to the original state equation parameters of crude oil and the state equation parameters to be fitted, a fitting parameter combination is selected and the fitting parameter limits are set; According to the combination of fitting parameters, the trust region algorithm is used to fit the original phase diagram of crude oil; Output the fitted state equation parameters and compare the original phase diagram with the fitted phase diagram results; Check the fitting comparison results. If they do not meet the fitting requirements, adjust the fitting parameters and refit; Among them, according to the combination of fitting parameters, the trust region algorithm is used to fit the original phase diagram of crude oil, including: According to the combination of fitting parameters, the logarithmic transformation method is used to process the constrained fitting parameters using the first variable equivalent; The phase diagram of isofluidic lines is calculated by combining the alternating iteration method with the Newton-Raphson iteration method to obtain the phase diagram of the original component parameters. The phase diagram of the fitted component parameters is calculated by using a curve fitting method for calculating characteristic point distances, and the fitting error of the distances corresponding to the characteristic points of the original component parameters is calculated; The Jacobian matrix of the fitting error with respect to the first variable is calculated using the numerical derivation method; According to the Jacobian matrix, a trust region algorithm is adopted to perform fitting calculation of the phase diagram by iteratively updating the first variable.
2. The method according to claim 1, characterized in that The alternating iteration method is combined with the Newton-Raphson iteration method to calculate the isofluidic phase diagram and obtain the phase diagram of the original component parameters, including: The starting point of the isofluidic phase diagram is calculated by using the simultaneous RR equation and Wilson formula method. According to the starting point value of the isofluidic phase diagram, the error is controlled within a certain range by using the alternating iteration method accelerated by the main eigenvalue; According to the starting point value after the control error, the Newton-Raphson iteration method is used to converge the starting point value; Perform interpolation calculation on the next point to obtain the initial value of the next point; According to the initial value of each point, the phase diagram of the original component parameters is obtained.
3. The method according to claim 2, characterized in that The starting point value of the isofluidic phase diagram is calculated by using the simultaneous RR equation and Wilson formula method, including: Step A, setting liquid content, pressure and initial temperature; Step B: Combine Wilson's formula and RR equation to calculate equilibrium constant K i , intermediate variables Q, dQ / dT; where, Step B1, calculate the equilibrium constant K using Wilson's formula i : Where p is pressure; T is temperature; p ci 、T ci ,ω i are the critical pressure, critical temperature and eccentricity factor of the i-th component respectively; Step B2, combine Wilson formula and RR equation to calculate intermediate variables Q and dQ / dT: Where Nc is the total number of components; z i is the mole fraction of the i-th component; F is the liquid content; Step C, if Q or dQ / dT is not within the valid range, use binary search method to find the temperature between T1 where Q>0 and T2 where Q<0, so that Q and dQ / dT are within the valid range; Step D, calculate the temperature T using Newton's iteration algorithm:
4. The method according to claim 3, characterized in that According to the starting point value of the isofluidic phase diagram, the error is controlled within a certain range by using the alternating iteration method accelerated by the main eigenvalue, including: Step A, setting liquid content, pressure and initial temperature; Step B, calculating the state equation compression factor by using the PR or SRK three-parameter state equation, and obtaining the fugacity and corresponding derivative of the component according to the compression factor; Step C, calculate the equilibrium constant K using the DEM principal eigenvalue acceleration method i : in, are the fugacity coefficients of the i-th component in the liquid phase and the gas phase, respectively; f i L 、f i V are the fugacity of the i-th component in the liquid phase and the gas phase respectively; the superscript n is the iteration step; Step D, calculate the temperature using Newton iteration algorithm in, is the temperature of the n+1th iteration step when the liquid content is F.
5. The method according to claim 3, characterized in that: The Newton-Raphson iteration method is used to converge the starting point value, including: Step A, setting liquid content, pressure and initial temperature; Step B, calculating the state equation compression factor by using the PR or SRK three-parameter state equation, and obtaining the fugacity and corresponding derivative of the component according to the compression factor; Step C, establish the Jacobian matrix; where, Step C1, let the iterative unknown quantity X = (lnK1, lnK2, ..., lnK Nc ,lnT,lnp); Among them, K i (1≤i≤Nc) is the equilibrium constant of the i-th component; Step C2, construct the iterative equation system: Among them, 1≤i≤Nc; x i and i are the mole fractions of the i-th component in the liquid and gas phases respectively; S = lnp0 or lnT0; when S = lnp0, k = Nc+2, then X k This means taking the Nc+2th component of variable X; when S=lnT0, k=Nc+1; Step C3, establish the Jacobi matrix: Where, 1≤i, j≤Nc; Step D, solve the nonlinear equations by Newton iteration: X n+1 =X n -Jac -1 g(X n ); Where n is the iteration step and Jac is the Jacobi matrix generated in step C.
6. The method according to claim 5, characterized in that Perform interpolation calculation on the next point to obtain the initial value of the next point, including: Use linear interpolation or polynomial interpolation to interpolate the next point; where, When linear interpolation is used, and The linear interpolation estimation formula is obtained: Among them, X is the iterative unknown quantity, X i is the i-th quantity; Δp is the pressure increment; the above formula also holds true for temperature T; When using polynomial interpolation, use the previous two or three points for polynomial interpolation, and the calculation formula is: Among them, a im are the polynomial interpolation coefficients.
7. The method according to claim 1, characterized in that The trust region algorithm is used to fit the original phase diagram of crude oil, including: Step A, based on the fitting error, the error function is denoted as f(x), and the trust region algorithm is used to transform the nonlinear fitting problem into: Among them, F(x) is a function composed of the sum of the squares of the error function f(x); The second-order Taylor expansion of F(x) is written as: in, Ignoring the second-order derivative in the formula, we can write Where J(x) is the Jacobian matrix Step B, use Levenberg-Marquardt iteration to calculate the step size: Among them, h lm is the step size; μ is the trust region radius; J k is the abbreviated matrix of the Jacobian matrix of f(x) at the kth iteration step; I is the identity matrix; Step C, obtain the change of μ according to the evaluation function ρ: Among them, the denominator is the predicted value of the gain, and the formula for solving the predicted value of the gain is as follows: Where g is the gradient vector; J is the abbreviated form of the Jacobian matrix; and -g is positive, L(0)-L(h lm ) is a positive value; If the value of the evaluation function ρ is greater than the first preset value, the corresponding L(h) iteration effect reaches the expected effect, and the next LM algorithm is made close to the Gauss-Newton process by reducing μ; If the control variable ρ is less than the second preset value, the corresponding L(0) iteration effect does not achieve the expected effect, and the iteration step is made closer to the maximum gradient descent direction by increasing the value of μ; Step D, by comparing the evaluation function ρ with the preset values ε1, ε2 to determine μ k+1 Among them, μ k+1 and μ k μ is the trust region radius of the k+1th and kth iterations respectively; τ1 and τ2 are the trust region radius reduction coefficient and radius increase coefficient respectively, satisfying 0<τ1<1, τ2>1.
8. A crude oil phase diagram fitting system based on the trust region method, characterized in that: The system includes: Parameter acquisition module, used to obtain the original state equation parameters of crude oil and the state equation parameters that need to be fitted; A selection module is used to select a fitting parameter combination and set fitting parameter limits according to the original state equation parameters of the crude oil and the state equation parameters to be fitted; A fitting calculation module is used to perform fitting calculation on the original phase diagram of crude oil using a trust region algorithm according to a combination of fitting parameters; The comparison module is used to output the parameters of the state equation after fitting and compare the results of the original phase diagram with the fitted phase diagram; Checking module is used to check the fitting comparison results. If the fitting requirements are not met, the fitting parameters are adjusted and refitted. Among them, the fitting calculation module is specifically used for: According to the combination of fitting parameters, the logarithmic transformation method is used to process the constrained fitting parameters using the first variable equivalent; The phase diagram of isofluidic lines is calculated by combining the alternating iteration method with the Newton-Raphson iteration method to obtain the phase diagram of the original component parameters. The phase diagram of the fitted component parameters is calculated by using a curve fitting method for calculating characteristic point distances, and the fitting error of the distances corresponding to the characteristic points of the original component parameters is calculated; The Jacobian matrix of the fitting error with respect to the first variable is calculated using the numerical derivation method; According to the Jacobian matrix, a trust region algorithm is adopted to perform fitting calculation of the phase diagram by iteratively updating the first variable.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Quick modeling method based on point algorithm in dimensionality reduction affine trust region
CN104537163A
Optical fiber type surface plasmon resonance signal peak positioning detection method based on Gaussian fitting
CN105044041A