US 20060184329 A1 Abstract A new adjoint method for calculating and using adjoint gradients in a Reservoir Simulator comprises: calculating adjoint gradients of an objective function with respect to changes in valve settings taking into account the modeling of pressure drop and fluid flow along a wellbore, and using the adjoint gradients to calculate sensitivities of a reservoir to changes in parameterization of downhole devices and using of these sensitivities in optimal control of the wells to optimize some objective function subject to production constraints.
Claims(21) 1. A method for calculating and using adjoint gradients in a reservoir simulator, comprising:
(a) calculating adjoint gradients of an objective function with respect to changes in valve settings while taking into account a modeling of pressure drop and fluid flow along a wellbore; (b) in response to the calculated adjoint gradients, calculating sensitivities of a reservoir responsive to changes in parameterization of downhole devices; and (c) in response to the calculated sensitivities, using said sensitivities to optimize control of wells in a reservoir by optimizing an objective function. 2. The method of 3. The method of 4. The method of 5. The method of 6. The method of 7. A method for optimizing production of a reservoir having one or more wells having valves, comprising:
(a) running a reservoir simulator in a forward simulation to simulate the life of the reservoir; (b) processing outputs from the forward simulation to generate intermediate partial derivatives of flow equations for the well and for the reservoir; (c) combining the intermediate partial derivatives of the well flow equations and the reservoir flow equations in the reservoir simulator; (d) solving an adjoint system of linear equations at regular time intervals to calculate a set if adjoint gradients of an objective function with respect to the control parameters; (e) determining from the adjoint gradients a search direction; (f) using the search direction to solve an optimization algorithm that maximizes an objective function using line-search methods; (g) locating a local maximum along the search direction and updating control parameters; (h) using the new updated control parameters in the reservoir simulator; (i) repeating steps (a)-(i) until an optimal value of the objective function has been reached. 8. A program storage device readable by a machine tangibly embodying a set of instructions executable by the machine to perform method steps for calculating and using adjoint gradients in a reservoir simulator, said method steps comprising:
calculating adjoint gradients of an objective function with respect to changes in valve settings while taking into account a modeling of pressure drop and fluid flow along a wellbore; in response to the calculated adjoint gradients, calculating sensitivities of a reservoir responsive to changes in parameterization of downhole devices; and in response to the calculated sensitivities, using said sensitivities to optimize control of wells in a reservoir by optimizing an objective function. 9. The program storage device of 10. The program storage device of 11. The program storage device of 12. The program storage device of 13. The program storage device of 14. A program storage device readable by a machine tangibly embodying a set of instructions executable by the machine to perform method steps for optimizing production of a reservoir having one or more wells having valves, said method steps comprising:
(a) running a reservoir simulator in a forward simulation to simulate the life of the reservoir; (b) processing outputs from the forward simulation to generate intermediate partial derivatives of flow equations for the well and for the reservoir; (c) combining the intermediate partial derivatives of the well flow equations and the reservoir flow equations in the reservoir simulator; (d) solving an adjoint system of linear equations at regular time intervals to calculate a set of adjoint gradients of an objective function with respect to the control parameters; (e) determining from the adjoint gradients a search direction; (f) using the search direction to solve an optimization algorithm that maximizes the objective function using line-search methods; (g) locating a local maximum along the search direction and updating control parameters; (h) using the new updated control parameters in the reservoir simulator; (i) repeating steps (a)-(i) until an optimal value of the objective function has been reached. 15. A system adapted for calculating and using adjoint gradients in a reservoir simulator, comprising:
first apparatus adapted for calculating adjoint gradients of an objective function with respect to changes in valve settings while taking into account a modeling of pressure drop and fluid flow along a wellbore; second apparatus, responsive to the calculated adjoint gradients, adapted for calculating sensitivities of a reservoir responsive to changes in parameterization of downhole devices; and third apparatus, responsive to the calculated sensitivities, adapted for using said sensitivities to optimize control of wells in a reservoir by optimizing an objective function. 16. The system of 17. The system of 18. The system of 19. The system of 20. The system of 21. A system adapted for optimizing production of a reservoir having one or more wells having valves, comprising:
apparatus adapted for: running a reservoir simulator in a forward simulation to simulate the life of the reservoir; processing outputs from the forward simulation to generate intermediate partial derivatives of flow equations for the well and for the reservoir; combining the intermediate partial derivatives of the well flow equations and the reservoir flow equations in the reservoir simulator; solving an adjoint system of linear equations at regular time intervals to calculate a set of adjoint gradients of an objective function with respect to the control parameters; determining from the adjoint gradients a search direction; using the search direction to solve an optimization algorithm that maximizes the objective function using line-search methods; locating a local maximum along the search direction and updating control parameters; further using the new updated control parameters in the reservoir simulator; and repeating the processing, combining, solving, determining, using, locating, and further using functions performed by the apparatus until an optimal value of the objective function has been reached. Description This specification is a Utility Application of prior pending Provisional Application Ser. No. 60/636,202, filed Dec. 15, 2004, and entitled ‘Method Apparatus and System for Optimization of Valve Settings in Instrumented Wells Using Adjoint Gradient Technology and Reservoir Simulation’. The subject matter of this specification relates to a new Adjoint Method (and associated System and Program Storage Device) for Calculating Gradients, and, in particular, to an Adjoint Method for Calculating Gradients of an objective function with respect to changes in valve settings, while taking into account the modeling of pressure drop and fluid flow along a wellbore, for more effectively and efficiently optimizing settings of control valves for reservoir production. Controllable down-hole devices have made feasible the implementation of advanced well control strategies for achieving an objective, such as maximizing hydrocarbon recovery or net present value. However, the development of algorithms for determining the best strategy for controlling these devices, subject to production and injection constraints, is still an area of active research, and generally involves implementation of some form of control logic within a reservoir simulation workflow. Some ‘control strategies’ for controlling these devices are reactive, meaning that interventions are made when local conditions are met at particular wells or valves, without taking into account the future effect of the intervention on the entire reservoir. Moreover, with this approach, it may already be too late to intervene to prevent unwanted breakthrough. These production rule methods tend to be heuristic, but are very efficient in reservoir simulation. Alternative proactive control strategies apply to the lifetime of the field, and thus provide a mechanism to control fluid flow early enough to delay breakthrough. These ‘alternative proactive control strategies’ for controlling these devices can be divided into at least two methods: (1) ‘stochastic’ methods, such as Monte Carlo which investigate the effect of a large number of possible strategies, and (2) ‘deterministic’ methods which set the behavior of each well and valve based on its effect on the objective. This specification includes a ‘proactive deterministic constrained optimization method’ associated with the aforementioned ‘alternative proactive control strategies’ adapted for controlling the aforementioned ‘controllable downhole devices’. In particular, this specification includes a first application of adjoint gradients to control and optimize settings in a multi-segmented well model. One aspect of the ‘Adjoint Method of Calculating Gradients’ as described in this specification involves a method for calculating and using adjoint gradients in a reservoir simulator, comprising: calculating adjoint gradients of an objective function with respect to changes in valve settings while taking into account a modeling of pressure drop and fluid flow along a wellbore; in response to the calculated adjoint gradients, calculating sensitivities of a reservoir responsive to changes in parameterization of downhole devices; and in response to the calculated sensitivities, using said sensitivities to optimize control of wells in a reservoir by optimizing an objective function. Another aspect of the ‘Adjoint Method of Calculating Gradients’ as described in this specification involves a method for optimizing production of a reservoir having one or more wells having valves, comprising: (a) running a reservoir simulator in a forward simulation to simulate the life of the reservoir; (b) processing outputs from the forward simulation to generate intermediate partial derivatives of flow equations for the well and for the reservoir; (c) combining the intermediate partial derivatives of the well flow equations and the reservoir flow equations in the reservoir simulator; (d) solving a large adjoint system of linear equations at regular time intervals to calculate the adjoint gradients of an objective function with respect to the control parameters; (e) determining from the adjoint gradients a search direction; (f) using the search direction to solve an optimization algorithm that maximizes the objective function using line-search methods; (g) locating a local maximum along the search direction and updating control parameters; (h) using the new updated control parameters in the reservoir simulator; and (i) repeating steps (a)-(i) until an optimal value of the objective function has been reached. Another aspect of the ‘Adjoint Method of Calculating Gradients’ as described in this specification involves a program storage device readable by a machine tangibly embodying a set of instructions executable by the machine to perform method steps for calculating and using adjoint gradients in a reservoir simulator, said method steps comprising: calculating adjoint gradients of an objective function with respect to changes in valve settings while taking into account a modeling of pressure drop and fluid flow along a wellbore; in response to the calculated adjoint gradients, calculating sensitivities of a reservoir responsive to changes in parameterization of downhole devices; and in response to the calculated sensitivities, using said sensitivities to optimize control of wells in a reservoir by optimizing an objective function. Another aspect of the ‘Adjoint Method of Calculating Gradients’ as described in this specification involves a program storage device readable by a machine tangibly embodying a set of instructions executable by the machine to perform method steps for optimizing production of a reservoir having one or more wells having valves, said method steps comprising: (a) running a reservoir simulator in a forward simulation to simulate the life of the reservoir; (b) processing outputs from the forward simulation to generate intermediate partial derivatives of flow equations for the well and for the reservoir; (c) combining the intermediate partial derivatives of the well flow equations and the reservoir flow equations in the reservoir simulator; (d) solving a large adjoint system of linear equations at regular time intervals to calculate the adjoint gradients of an objective function with respect to the control parameters; (e) determining from the adjoint gradients a search direction; (f) using the search direction to solve an optimization algorithm that maximizes the objective function using line-search methods; (g) locating a local maximum along the search direction and updating control parameters; (h) using the new updated control parameters in the reservoir simulator; and (i) repeating steps (a)-(i) until an optimal value of the objective function has been reached. Another aspect of the ‘Adjoint Method of Calculating Gradients’ as described in this specification involves a system adapted for calculating and using adjoint gradients in a reservoir simulator, comprising: first apparatus adapted for calculating adjoint gradients of an objective function with respect to changes in valve settings while taking into account a modeling of pressure drop and fluid flow along a wellbore; second apparatus, responsive to the calculated adjoint gradients, adapted for calculating sensitivities of a reservoir responsive to changes in parameterization of downhole devices; and third apparatus, responsive to the calculated sensitivities, adapted for using the sensitivities to optimize control of wells in a reservoir by optimizing an objective function. Another aspect of the ‘Adjoint Method of Calculating Gradients’ as described in this specification involves a system adapted for optimizing production of a reservoir having one or more wells having valves, comprising: apparatus adapted for: running a reservoir simulator in a forward simulation to simulate the life of the reservoir; processing outputs from the forward simulation to generate intermediate partial derivatives of flow equations for the well and for the reservoir; combining the intermediate partial derivatives of the well flow equations and the reservoir flow equations in the reservoir simulator; solving an adjoint system of linear equations at regular time intervals to calculate a set of adjoint gradients of an objective function with respect to the control parameters; determining from the adjoint gradients a search direction; using the search direction to solve an optimization algorithm that maximizes the objective function using line-search methods; locating a local maximum along the search direction and updating control parameters; further using the new updated control parameters in the reservoir simulator; and repeating the processing, combining, solving, determining, using, locating, and further using functions performed by the apparatus until an optimal value of the objective function has been reached. Further scope of applicability will become apparent from the detailed description presented hereinafter. It should be understood, however, that the detailed description and the specific examples set forth below are given by way of illustration only, since various changes and modifications within the spirit and scope of the ‘Adjoint Method of Calculating Gradients’, as described and claimed in this specification, will become obvious to one skilled in the art from a reading of the following detailed description. A full understanding will be obtained from the detailed description presented herein below, and the accompanying drawings which are given by way of illustration only and are not intended to be limitative to any extent, and wherein: Oil and gas is produced from underground rock formations. These rocks are porous, just like a sponge, and they are filled with fluid, usually water. This porous characteristic of rocks is known as porosity. These rocks in addition to being porous have the ability to allow fluids to flow through the pores, a characteristic measured by a property called permeability. When oil (or gas) is trapped in such formations, it may be possible to extract it by drilling wells that tap into the formation. As long as the pressure in the well is lower than that in the rock formation, the fluids contained in the pores will flow into the well. These fluids may then flow naturally up the well to the surface, or the flow up the well may have to be assisted by pumps. The relative amounts of oil, gas and water that are produced at the surface will depend on the fraction of the rock pore space that is occupied by each type of fluid. Water is always present in the pores, but it will not flow unless its volume fraction exceeds a threshold value that varies from one type of rock to another. Similarly, oil and gas will only flow as long as their volume fractions exceed their own thresholds. The characteristics of the rock (including porosity and permeability) in an oil reservoir vary greatly from one location to another. As a result, the relative amounts of oil, gas and water that can be produced will also vary from reservoir to reservoir. These variations make it difficult to simply predict the amount of fluids and gases a reservoir will produce and the amount of resources it will require to produce from a particular reservoir. However, the parties interested in producing from a reservoir need to project the production of the reservoir with some accuracy in order to determine the feasibility of producing from that reservoir. Therefore, in order to accurately forecast production rates from all of the wells in a reservoir, it is necessary to build a detailed mathematical model of the reservoir's geology and geometry. A large amount of research has been focused on the development of reservoir simulation tools. These tools include mathematical and computer models that describe and which are used to predict, the multiphase flow of oil and gas within a three dimensional underground formation (a “field”). Reservoir tools use empirically acquired data to describe a field. These data are combined with and manipulated by mathematical models whose output describes specified characteristics of the field at a future time and in terms of measurable quantities such as the production or injection rates of individual wells and groups of wells, the bottom hole or tubing head pressure at each well, and the distribution of pressure and fluid phases within the reservoir. The mathematical model of a reservoir is typically done by dividing the reservoir volume into a large number of interconnected cells and estimating the average permeability, porosity and other rock properties for each cell. This process makes use of seismic data, well logs, and rock cores recovered when wells are drilled. Production from the reservoir can then be mathematically modeled by numerically solving a system of three or more nonlinear, partial differential equations describing fluid flow in the reservoir. Computer analysis of production from an oil reservoir is usually divided into two phases, history matching and prediction. In the history matching phase, the past production behavior of the reservoir and its wells is repeatedly modeled, beginning with initial production and continuing up to the present time. The first computer run is based on a geological model as described above. After each run, the computer results are compared in detail with data gathered in the oil field during the entire period of production. Geoscientists modify the geological model of the reservoir on the basis of the differences between computed and actual production performance and rerun the computer model. This process continues until the mathematical reservoir model behaves like the real oil reservoir. Once a suitable history match has been obtained, production from the oil reservoir can be predicted far into the future (sometimes for as long as 50 years). Oil recovery can be maximized and production costs minimized by comparing many alternative operating plans, each requiring a new run of the computer model. After a field development plan is put into action, the reservoir model may be periodically rerun and further tuned to improve its ability to match newly gathered production data. When sufficient data is obtained about the reservoir, characteristics of a reservoir can be mathematically modeled to predict production rates from wells in that reservoir. The gross characteristics of the field include the porosity and permeability of the reservoir rocks, the thickness of the geological zones, the location and characteristics of geological faults, relative permeability and capillary pressure functions and such characteristics of the reservoir fluids as density, viscosity and phase equilibrium relationships. From this data, a set of continuous partial differential equations (PDEs) are generated that describe the behavior of the field as a function of time and production parameters. These production parameters include the locations of wells, the characteristics of the well's completions, and the operating constraints applied to the wells. Operating constraints may include such as the production rate of a particular fluid phase, the bottom hole pressure, the tubing head pressure, or the combined flow rates of a group of wells. These constraints may be applied directly by data or by means of another simulator that models the flow of fluids in the surface equipment used to transport the fluids produced from or injected into the wells. However, because only the simplest system of PDEs can be solved using classic or closed-form techniques (e.g., a homogeneous field having circular boundaries), a model's PDEs are converted into a set of non-linear approximations which are then solved numerically. One approximation technique is the finite difference method. In the finite difference method, reservoir PDEs are converted into a series of difference quotients which divide a reservoir into a collection of discrete three dimensional cells, which are then solved for at discrete times to determine (or predict) the value of reservoir characteristics such as pressure, permeability, fluid fractions, and at a later time. Within the computerized ‘reservoir simulator’, reservoir performance is modeled in discrete increments of time. Each so-called timestep advances the solution from a previous point in time, where all variables are known, to a future point in time, where all variables are unknown. This process is repeated until the entire time period of interest has been modeled. Within each timestep, it is necessary to solve a huge system of nonlinear equations that models fluid flow from cell to cell and through the wells. (With current technology it is possible to include several million cells in the reservoir model.) Solutions to the system of nonlinear equations are obtained by Newton iteration. In each such iteration, the system of nonlinear equations is approximated by a system of linear equations, which must be solved by yet another iterative procedure. One such ‘reservoir simulator’ is the “Eclipse” reservoir simulator that is owned and operated by Schlumberger Technology Corporation of Houston, Tex. The “Eclipse” simulator software receives output data from the “Flogrid” simulation gridding software and, responsive thereto, the “Eclipse” simulator software generates a set of simulation results which are displayed on a 3D viewer. The “Flogrid” simulation gridding software is described in U.S. Pat. No. 6,106,561 to Farmer, the disclosure of which is incorporated by reference into this specification. As illustrated in This specification includes: (1) a Background discussion with reference to Referring to Referring to Referring to Referring to Referring to In Referring to The following paragraphs will present the Eclipse Simulator Software Referring to Refer now to In In (Step 1) ‘Calculating adjoint gradients of an objective function with respect to changes in valve settings taking into account the modeling of pressure drop and fluid flow along a wellbore’, step (Step 2) ‘Using the adjoint gradients to calculate sensitivities of a reservoir to changes in parameterization of downhole devices and the use of these sensitivities in optimal control of the wells to optimize some objective function subject to production constraints’, step Each of the above referenced two steps In Another ‘adjoint method’ has previously been applied to optimization within reservoir simulation by ‘several authors’. However, the studies produced by the aforesaid ‘several authors’ include smart wells as a series of independent injectors or producers, and, as such, do not take into account the accurate modelling of the pressure drop along the wellbore. In addition, the ‘several authors’ have published the ‘use of the adjoint method to calculate gradients in reservoir simulation’, such as: (1) Fifth European Conference on Mathematics of Oil Recovery (Zakirov, Zakirov, Aanonsen, Palatnik), (2) SPE 78278 (Brouwer, Jansen), and (3) SPE 92864 (Sarma, Aziz, Durlofsky). In addition, the use of a multi-segmented well model in reservoir simulation to accurately model flow in a wellbore is disclosed in prior pending U.S. application Ser. No. 10/900,176 to David A. Edwards et al, entitled “Near Wellbore Modeling method and apparatus” published as US patent application number 20050015231 published Jan. 20, 2005. However, the ‘adjoint method for calculating and using adjoint gradients’ disclosed in The accurate modeling of the physics of fluid flow within smart wells is of paramount importance when developing control strategies for this type of well. The control of downhole devices is modeled by using a reservoir simulator adapted for accurately modeling the physics of fluid flow in smart wells, such as the previously referenced ‘Eclipse’ reservoir simulator owned and operated by Schlumberger Technology Corporation. As a result, a ‘gradient-based field optimization method’ is disclosed in this specification, the aforementioned ‘gradient-based field optimization method’ being known as the ‘Adjoint method for calculating and using adjoint gradients’ illustrated in Consequently, the ‘Adjoint method for calculating and using adjoint gradients’ disclosed in this specification and shown in Referring to In Referring to In In Referring to In A single bore wellbore has a single pipeline or branch, and that single branch could also be divided up into a plurality of segments, where each segment is characterized or represented by a set of solution variables (Q, Fw, Fg, P)i. Referring to In In In response to the targets/limits from the group/field control model The reservoir model In In The step of sub-dividing each pipeline or branch of the wellbore into a plurality of segments (block In In A functional description of the operation of the ‘Adjoint Method for Calculating and Using Adjoint Gradients’ The ‘Adjoint method for calculating and using adjoint gradients’ step When the ‘multi-segmented well model’ A functional specification associated with the ‘Adjoint Method for Calculating and Using Adjoint Gradients’ Introduction This specification includes software (namely, the ‘Resopt’ software that is embodied within the ‘Eclipse’ Simulator software The Necessary Mathematics Lagrange Formulation of the Objective Function with Constraints In the objective function, we are trying to change the production control parameters, P, so that we maximize a quantity (e.g. FOPT) subject to the constraints that the simulator fluid flow residual equations, R=0, are satisfied, and also that additional production constraints, C≦0, are satisfied. Generally, production constraints are inequalities. For convenience, we will divide these into active (i.e. those for which currently C=0) and inactive constraints. For clarity, we will denote the active constraints by C Lagrange multipliers are used to combine the equality constraints with the objective function into the merit function, L,
where J is the objective function, X is the vector of solution variables (e.g. pressure, saturations, molar densities), and Backward Solve: Free Parameter Gradients In order to determine a search direction for maximizing this objective function, we are interested in forming its total derivatives with respect to the production control parameters. This is
In order to calculate this, we need the solution derivatives, ∂X/∂P, and also the following partial derivatives of the Lagrangian.
Since R=0 and C Hence, from (3),
If there are N We want to solve (5) and (6) simultaneously for the adjoint vectors. Re-arranging (6) gives,
Substituting (7) in (5) and re-arranging gives,
Equation (8) involves the solution of a system of equations in which the matrix, ∂R/∂X, is very large. R is the vector of residual equations at all time intervals, and X is the vector of solution variables at all time intervals. In practice, it is possible take advantage of structure in the total Jacobian matrix, ∂R/∂X, to reduce the size of the system that needs to be solved. Since R(t The diagonal matrices are the Jacobian matrices from each time interval, Jac(t Since the simulator residual equations can be written as
So the total Jacobian matrix can be written as
If we specify the parameters, P Hence, for a particular cell, the product of this matrix with a vector multiplying from the left, such as
In RESOPT, the sequence of calculations is as follows: Working backwards through the time intervals . . . -
- Set up the required derivative matrices
- Solve (9) for the
__Ψ___{R}(t_{j}) - Solve the time-interval equivalent of (7) for
__Ψ___{C}(t_{j}) - Use the time-interval equivalent of (4) to compute the Lagrangian derivatives for the current time interval free production control parameters, ∂L/∂P(t
_{j}). (There is no need to calculate for the first N_{A }production control parameters as we have already set these to zero.)
This process requires 1 solve of the transpose simulation Jacobian matrices, followed by 1 solve of a small matrix system (order of number of active constraints). Total: 1 transpose Jacobian matrix solve. Alternative Formulation In the case where the active constraints are not sensitive to the dependent parameters, i.e. ∂C Re-arranging (5) gives,
As before, if we specify the parameters, P We keep the ∂C When solving (11), we are solving a transpose system involving the simulator Jacobian matrices so, as in the normal formulation, we solve this system backwards in time. In order to use the same “backwards in time” philosophy when solving (12), we re-write it as
We can solve the n In a similar way, we can solve the n In RESOPT, the sequence of calculations should be as follows: Working backwards through the time intervals . . . -
- Set up the required derivative matrices (this is already done)
- Solve (14) for the each of the
__Φ___{k}(t_{j}) - Solve (13) for
__Ψ___{C}(t_{j}) - Solve (11) for
__Ψ___{R}(t_{j}) - Use the time-interval equivalent of (4) to compute the Lagrangian derivatives for the current time interval free production control parameters, ∂L/∂P(t
_{j}). (There is no need to calculate for the first N_{A }production control parameters as we have already set these to zero.)
This process requires 1+N Selection of the Free and Dependent Parameter Sets In the code, there are N Pre-2006a, only a very simple partitioning of the parameters was used: make the first N At 2006a, some logic was added so that the ones with the largest ∂C Free Parameter Search Direction Once we have successfully stepped backwards over all the time intervals, we have the complete vector of Lagrangian derivatives, ∂L/∂P, for the free production control parameters. We use these to determine the free production control parameter search step, ΔP Forward Integration: Dependent Parameter Search Direction For any ΔP Hence the N Original Formulation Re-arranging (16) gives
Substituting (17) into (15) gives
We split this system into smaller ones, each covering a time interval. We denote the Jacobian for the reservoir equations
In RESOPT, following on from the previous calculations, the sequence of these additional calculations is: Working forwards through the time intervals . . . -
- Solve (18) for ΔX(t
_{j}) - Solve the equivalent of (17) for P
_{d}(t_{j})
- Solve (18) for ΔX(t
This process requires 1 solve of the simulation Jacobian matrices, followed by 1 solve of a small matrix system (order of number of active constraints). Total: 1 Jacobian matrix solve. Alternative Formulation If the active constraints are not sensitive to the dependent parameters, then we cannot use (17) to eliminate the dependent parameters and then solve for ΔX and P As before, if we specify the parameters, P Then (21) becomes
Note that if N In RESOPT, following on from the previous calculations, the sequence of these additional calculations is: Working forwards through the time intervals . . . -
- Solve (22) for {tilde over (
__Φ__)}_{ƒ}(t_{j}) and each of the {tilde over (__Φ__)}_{k}(t_{j}) - Solve (23) for P
_{d}(t_{j}) - Solve (20) for X(t
_{j})—which is needed later
- Solve (22) for {tilde over (
This process requires 1+N Calculating the Step Length Ensuring that we do not Violate the Constraint Functions Given that we have a search direction for the production control parameters, P, we next need to know the step length. From (18), we know if we step a distance α along ΔX then we should also step a distance α along ΔP. The active constraint equations will be satisfied inherently, but we must not violate any of the currently inactive ones, so we are interested in how far we can step before we would violate the inactive constraints. In order to hit an inactive constraint at this step,
Expanding this to first order and re-arranging gives
The closest constraint (i.e. the one that would be first violated if an unrestricted amount of the search direction were used) is the one with the minimum value of □.
In RESOPT, following on from the previous calculations, the sequence of additional calculations is as follows: -
- Solve (24) for the minimum value of α
Ensuring that the Simple Parameter Bounds are not Violated
- Solve (24) for the minimum value of α
In RESOPT, the user can impose simple bounds on the production control parameter values such as
When taking a step in the optimizer, we need to restrict the production control parameter step length by a factor β to ensure that do not violate any of these simple bounds. By default, β is one. If a production control parameters new value is greater than its upper bound, then
If a production control parameters new value is less than its lower bound, then
In RESOPT, following on from the previous calculations, the sequence of additional calculations is as follows: Loop over all production control parameters, if necessary, solving (25) for β and then modifying the control parameter step length. Finally in RESOPT, we conduct a line-search along the search direction to complete this step of the optimizer. Once we have exited the line-search, we look for the next production control parameter step direction. Sub-Functions in the Adjoint Optimizer Code The objective function in the adjoint optimizer, J, can take the following general form:
This is a summation over sub-functions, J The user can specify multiple sub-functions in the OPTFUNC keyword. For example, optimize field oil production while penalizing water production from well ‘PROD’ between timesteps 2 and 7:
This keyword defines the following define the sub-functions:
Constraints Handled as Sub-Functions Each constraint is included in the objective function as a pair of additional sub-functions, ƒ This sub-function approach has the advantage that the gradients of the sub-functions can be accumulated to give the gradient of the function. Simple Constraints These are limits on the simulation quantities themselves. For example, the production rate must not exceed 2000 in well PROD. The constraint is re-written as follows:
This is handled as the following pairs of sub-functions (one pair for each report index at which the constraint is active):
If a “greater than” constraint is specified, the constraint is re-written as follows:
This is handled as the following pairs of sub-functions (one pair for each report index at which the constraint is active):
Complex Constraints 1 (GOR) These are limits on derived simulation quantities. For example, the gas-oil ratio must not exceed 1.5 in well PROD. The constraint is re-written as follows:
This is handled as the following pairs of sub-functions (one pair for each report index at which the constraint is active):
Complex Constraints 2 (WCT) As another example, the water cut must not exceed 0.2 in well PROD. The constraint is re-written as follows:
Normalization of Constraints When comparing constraint functions to see which is the most binding, we need to normalize them so that we can make a far comparison between constraints on data type with vastly different units. Simple Constraints For simple constraints, the constraint value is the obvious choice. For example, to normalize
For a GOR constraint, the constraint has been transformed from . . .
So the normalizing factor that needs to be applied to the pair of sub-functions in order to get the same result as normalizing the original constraint equation is 1.5 times OPR. Hence the normalizing factor is the constraint times the oil production rate in the domain of the constraint. Complex WCT Constraint For a WCT constraint, the constraint has been transformed from . . .
If we were to normalize the original constraint equation, we would divide by the constraint value (as we did in the case of simple constraints). This would give . . .
So the normalizing factor that needs to be applied to the pair of sub-functions in order to get the same result as normalizing the original constraint equation is 0.2 times the sum of OPR and WPR. Hence the normalizing factor is the constraint times the sum of the oil and water production rates in the domain of the constraint. Handling of RESTARTS In a non-restarted deck, the scope of the functions, sub-functions, parameters and constraints in RESOPT is the same as that of the simulation (i.e. 1 to NTOTRS is the same as 1 to NOPTIM) so we can use the same indexing in both areas of the code and we can compare optimizer step index with the simulation report index. In a restarted deck, the scope of the simulation is IRESTZ+1 to NTOTRS, while the scope of the storage in the RESOPT code is 1 to NOPTIM(=NTOTRS−IRESTZ). We use the RESOPT scope internally because it is efficient for storage. Hence the SOPT array (which holds to double precision optimizer run time information such as the current time value and the size of time steps) is indexed from 1 to NOPTIM. Many of the arrays holding information and results for parameters are indirectly indexed using this optimizer scope also. These two scoping methods are shown in the table below:
In the RESOPT code, we only use the simulation report indices in the following situations: -
- 1. When defaulting and validating the range of functions, parameters and constraints
- 2. When storing the scope for functions, sub-functions, parameters and constraints
- 3. When comparing the scope for functions, sub-functions, parameters and constraints
- 4. When outputting a report index for the user
To convert from optimizer step index (ISTEP) to simulation report index (JSTEP), just add IRESTZ. The standard mechanism in the code is to just do this locally when required, e.g. JSTEP=ISTEP+IRESTZ Array Naming Convention for Adjoint Optimizer Code Typical arrays in the adjoint optimizer code are IOPP, SOPP, ZOPP, IOPF, SOPF, IOPS, SOPS, ZOPS and SOPG. The naming convention for these arrays is as follows:
Debug Flags These flags all apply to DEBUG3 120 -
- Optimizer output (generally OP* routines)
121 -
- Adjoint gradient calculation output level (generally GA* routines)
124 -
- Whether to do a full solution when solving the well tree
- (“voidage replacement bodge”)
125 -
- To change the “-exponent” in numerical perturbations
126 -
- To change which derivatives are calculated numerically
143 -
- Use central differences in numerical gradient calculation
The above description of the ‘Adjoint Method of Calculating Gradients’ being thus described, it will be obvious that the same may be varied in many ways. Such variations are not to be regarded as a departure from the spirit and scope of the claimed method or apparatus or program storage device, and all such modifications as would be obvious to one skilled in the art are intended to be included within the scope of the following claims. Referenced by
Classifications
Legal Events
Rotate |