SOLUTION OF ONE OPTIMUM CONTROL PROBLEM REGARDING THE DEPLETION OF GAS RESERVOIR

K a m i l M a m t i y e v PhD, Associate Professor* T a r a n a A l i y e v a PhD, Associate Professor* U l v i y y e R z a y e v a Corresponding author PhD, Assistant Professor* E-mail: ulviyya.rzayeva@unec.edu.az *Department of Digital Technologies and Applied Informatics Azerbaijan State Economic University (UNEC) Istiglaliyyet str., 6, Baku, Azerbaijan, AZ 1001 Using the methods of the optimal control theory, the problem of determining the optimal technological mode of gas deposits’ exploitation under the condition of their depletion by a given point in time is solved. This task is of particular interest for the exploitation of offshore fields, the activity of which is limited by the service life of the field equipment. The considered problem is also of certain mathematical interest as an objective of opti­ mal control of nonlinear systems with distributed parameters. The usefulness and importance of solving such problems are determined by the richness of the class of major tasks that have a practical result. As an optimality criterion, a quadratic func­ tional characterizing the conditions of reservoir depletion is considered. By introducing an auxiliary boundary value prob­ lem, and taking into account the stationarity conditions for the Lagrange functions at the optimal point, a formula for the gra­ dient of the minimized functional is obtained. To obtain a solution to this specific optimization problem, which control function is sought in the class of a piecewise con­ tinuous and bounded function with discontinuities of the first kind, the Pontryagin’s maximum principle is subjected. The cal­ culation of the gradient of the functional for the original and adjoint problems with partial differential equations is carried out by the method of straight lines. The numerical solution of the problem was carried out by two methods – the method of gradient projection with a special choice of step and the method of successive approximations. Despite the incorrectness of optimal control problems with a quadratic functional, the gradient projection method did not show a tendency to «dispersion» and gave a convergent sequence of controls


Introduction
Every year the share of hard-to-recover reserves of oil and gas raw materials increases, and the development of hydrocarbon materials requires the involvement of the latest technologies. The search for the best option for the development of an oil or gas field is usually carried out based on many variants. It is problematic that, as a result of such enumeration, a truly optimal development option will be found [1]. The foregoing is determined by the fact that there are no effective algorithms for optimizing the process of developing gas fields based on mathematical models, suitable for all types of natural hydrocarbon deposits and considering as much as possible the features of the processes occurring in gas-bearing formations. At the same time, that is the kind of solution, which is important for the practice of developing natural hydrocarbon deposits.
These problems are included in the sphere of optimal control of processes described by nonlinear boundary value problems of parabolic type, and Pontryagin's maximum principle is the powerful mathematical apparatus for their study and solution. From the point of view of specific applications, the value of the maximum principle is determined by the wealth of problems for which it is suitable. The maximum principle has found numerous practical and theoretical applications. Note that thanks to this theory, it became possible to obtain a solution to a number of practically important problems, including the inverse problem of the theory of heat conduction, the problem of optimal control of a nuclear reactor, and many others. From year to year, more and more papers are published on the study of various sections of the theory on optimal control. And yet, despite the abundance of scientific publications on the theory of control systems with distributed parameters, many issues of the foundations of this theory remain unresolved or insufficiently studied. These include, first of all, various problems in the theory of control of nonlinear systems with distributed parameters, finding the approximate solution of certain linear-quadratic optimal control problems. In applications, there also arise a large number of problems on optimal control of processes described by nonlinear differential equations in ordinary and partial derivatives, which initial equations' nonlinearity necessitates the use of approximate optimization methods. For such problems, the issues of existence and uniqueness of the optimal control have not been practically studied, the necessary optimality conditions have not been found, and methods for their solution have not been developed.
At present, there are still no sufficiently convincing formulations of the problems of optimal control for oil and gas fields, although in their content the solutions of such kinds of problems should be based on the methods of optimal control theory. Despite the successes, optimization methods have not yet found proper application when considering the prospects for the development of the gas production industry. Therefore, the theory of optimal control plays a significant role, and there is no doubt that this direction is one of the relevant and developing sections of modern science.

Literature review and problem statement
Methods of the theory of optimal control are currently widely used in the practice of developing oil and gas fields. In connection with the transformation of the oil and gas industry into a key sector of the economy of many world countries, the gas industry is in dire need of improving existing methods of influencing gas fields and searching for new technologies to increase gas recovery from reservoirs. In this case, it is often necessary to consider the problems of various technological processes' optimum control, for example, the problem of optimal placement of oil reservoir wells and operating their flow rates, the problem of determining the technological modes of well management that ensure compliance with the rules of subsoil protection and trouble-free exploitation of boreholes, and many others.
In [2], the problem of determining the technological modes of well operation, ensuring compliance with the rules for the protection of subsoil, and trouble-free operation of wells, is numerically solved. By introducing an additional variable, the problem is reduced to the problem of controlling processes described by a set of equations in partial and ordinary derivatives. In [3], one class of problems on processes' optimal control, described by a set of nonlinear equations in ordinary and partial derivatives, is studied by the method of straight lines. Convergence in functional is proved and a constructive scheme for constructing a minimizing sequence of controls is proposed. The results of the numerical solution of one variational problem related to thermal processes are presented. However, due to the nonlinearity of boundary value problems in [2] and [3], it was not possible to prove the maximum principle, which gives the necessary optimality conditions.
In [4], the urgent problem associated with the development of oil and gas fields to increase the gas recovery of reservoir systems is considered. To conduct a comprehensive study of the process under consideration, a mathematical model has been developed based on the major laws of hydromechanics. A numerical method is proposed for the analysis and development of multi-layer gas fields in the presence of a dynamic connection between the layers and making managerial decisions. Based on the proposed mathematical tool, computational experiments are carried out, the results of which are presented in the form of graphic objects, and their analysis is given. In [5], for optimal control and forecasting of production processes in gas fields, mathematical and computer models are studied, and computational algorithms are created. However, the convergence issues related to the solution of the grid analog of the considered optimal control problem have not been studied; the structure of the optimal control software is given, however the calculation results are not presented.
In [6], the problem of optimal control of thermodynamic processes for an ideal gas based on the geometric formulation of thermodynamics is solved. The thermodynamic state is given as a Legendre manifold in the contact space. With the help of Pontryagin's maximum principle, on this manifold, an optimal trajectory is found that maximizes the work done by the gas. It is shown that in the case of an ideal gas, the corresponding Hamiltonian system is completely integrable, and its solution is given in quadratures. However, this work is of theoretical interest, unfortunately, it does not present any practical applications of the considered optimal control. In [7], the problem of two-phase filtration (oil and water) in a horizontal reservoir of an oil deposit is considered. An asymptotic method for calculating both the filtration process and related optimal control problems is proposed, namely, the problems of choosing optimal control actions to achieve maximum oil production at a given level of water resource consumption or minimum water resource consumption that provides the required oil production level according to the plan. The theoretical results obtained in this case, which can also be applied to the problems of optimal control of thermal and physicochemical effects on the oil reservoir, are formulated in the form of a theorem, and the numerical solution of the optimal control problem is not given.
The aim of research [8] is to develop a method for a twostage search for the optimal control trajectory in periodic production processes. This technique refers to such operational processes in which the use of a dynamic programming method is impossible due to the incompatibility of the results of each stage of the operation. The study presents the results of numerous calculations in the form of tables and graphs.
The work [9] proposes a method for determining the optimal speed and final state control of technological processes based on the analysis of the solution to a system of stochastic differential equations, which is a mathematical model of the controlled process. Based on the results of numerical simulation, it is shown that the proposed method allows obtaining solutions that are fully consistent with the results obtained using Pontryagin's maximum principle for the velocity problem. Two options for implementing control are proposed and justified, which differ in the principle of choosing the moments of control switching.
The presented paper discusses the issues of a numerical solution for determining the optimal technological regime of gas extraction for the exploitation of deposits under the condition of their depletion by a given point in time. This task is of particular interest for the exploitation of offshore fields, the life of which is limited by the service period of the foundations, that is, it is predetermined. In this case, it is often necessary to consider the problem both in the case of fields with a single reservoir, and in the case of fields where there are multilayer deposits, and the upper reservoir is further developed by returning the well operating in the lower reservoir. For such deposits, it is necessary to choose during and before the development of gas deposits the optimal rates of extraction for a given period of operation.

The aim and objectives of the study
The aim of the study is to solve the problem of determining the optimal technological regime for the operation of gas deposits under the condition of their depletion by a given point in time. The study of the problems of optimal forecasting and management of hydrocarbon resource assessment processes and their development on the basis of economic and mathematical modeling plays a crucial role in both strategic planning and operational management processes in various fields of science and technology.
To achieve the aim, the following objectives are accomplished: -by introducing an auxiliary boundary value problem, called the adjoint one and corresponding to the original optimal problem, obtain a formula for calculating the gradient; -by applying the two proposed methods to the optimization problem, compare the results obtained to identify the better approach for solving the considered optimal control problem; -to present a numerical solution of the problem under consideration for confirmation or refutation of the convergence of the found solution to the optimal control, taking the Pontryagin's maximum principle as a basis.

Materials and methods
The need to solve applied problems in real-time causes interest in the development of optimization methods with guaranteed estimates of the computational complexity, as well as in the search for ways to improve the efficiency of known methods by modifying them. The practice has shown that to successfully resolute variational problems, as a rule, it is necessary to resort to the use of additional artificial methods for accelerating convergence.
A common way to evaluate the effectiveness of methods for finding the extremum of the function under study is computational experiments and comparative analysis of methods founded on the results of experiments. However, the result of the computational experiment based on software implementation allowed us to conclude that such an analysis not in all cases may lead to unambiguous conclusions about the advantages of one method over another. The methods used (the gradient projection method with a special choice of step and the method of constructing successive approximations in calculating the optimal control), as a result, behaved differently at various stages of the minimization process. Theoretically, there is no satisfactory way to overcome such difficulties. In the presented work, we tried to fetch data on the results of calculations in an expanded form, which makes it possible to compare methods according to various criteria. The software implementation was carried out in the Visual Basic environment, the results of the numerical experiment are given.
In this research, Pontryagin's maximum principle was extended to the general case of minimizing a functional of integral type. This paper also contains some new results, the main of which are the formula for the increment of the functional and the necessary optimality conditions that follow from it. Necessary conditions for the considered optimal control were also presented along with the optimal state trajectory for solving the so-called Hamiltonian system, which is an auxiliary boundary value problem, plus a maximum for the Hamiltonian condition. Achieving the above aim and objectives involves the use of two methods -the gradient projection method and the method of successive approximations.

Results of research of optimal control problems
considering the depletion of gas reservoir

1. Statement of the problem and derivation of the formula for calculating the gradient
We consider the problem of determining the optimal technological regime of gas extraction under the condition of reservoir depletion by a given time point concerning dimensionless variables and parameters.
This task can be summarized as determining a piecewise continuous with discontinuities of the first order and not exceeding unity in absolute value in the time interval 0 ≤ t ≤ T function of the flow rate q(t) from the minimum condition of the functional: Here p 0 (x) is a technologically defined function, p(x, t) describes the distribution of gas pressure in the reservoir 0 ≤ x ≤ 1, which is in the area Q = {0 < t ≤ T, 0 < x < 1} satisfies the Leibenson equation: and on the boundary of the domain Q satisfies the initial and boundary conditions: A control that satisfies the above conditions is called admissible. (2) is a nonlinear differential equation of parabolic type and describes the process of unsteady filtration of an ideal gas in a homogeneous porous medium.
Condition (3) means that at the initial time the reservoir was in an undisturbed state with an initial constant pressure. The first condition in (4) shows that the well located at the «point» x = 0 is operated with a flow rate q(t), and it is required to choose this point so that at the end of the process the deviation of the pressure distribution p(x, T) from the predetermined pressure p 0 (x) would be minimal. The second condition in (4) indicates the impermeability of the boundary x = 1 of the formation.
Following the well-known procedure for studying problems with a conditional extremum [10], we compose the Lagrange function of problem (1)-(4): where ψ(x, t) is a Lagrange multiplier.
Let us give variations of the functions p(x, t), q(t) satisfying conditions (3), (4). Then: The variation of function (5), which is the main linear part of the increment of this function, has the form: Taking into account conditions (6), (7), we transform the double integral by integration by parts. We will get: Assuming that: from the last equality we have: where H = -ψ(0, t)q(t) is a Hamiltonian function. Expressions (9), (10) determine the boundary conditions for the adjoint equation (8). From (11) it can be seen that the gradient has the form F′(q) = -ψ(0, t).

2. Application of iterative methods to the optimization problem (1)-(4)
Finding the optimal control for systems with distributed parameters using the maximum principle reduces to a boundary value problem for partial differential equations. Solving boundary value problems for complex nonlinear systems often encounters significant computational difficulties and requires a lot of computer time. Therefore, of interest are methods for solving optimal control problems that could be used to circumvent these difficulties.
From the expression of the Hamiltonian functions for the considered problem (1)-(4) it can be seen that, without solving the optimal control problems (1)-(4), it is possible to estimate the structure of the optimal control. Such an estimate often turns out to be useful in the numerical solution of problems. For example, in linear optimal control problems, i.e., in problems in which equation or boundary conditions contain controls of the first order, if the optimal control exists, then, formally, when determining the permissible control area in the form of inequalities |q(t)| ≤ 1, that optimal control will be a relay function, taking alternately the values -1 and 1, i.e.: Therefore, it would seem that the whole solution consists of the optimal selection of sequences of control intervals and their junction points. However, it is important to note that the formality of formula (12) lies in the fact that the annulment of the expression marked by a sign, generally speaking, is possible not only on individual points of the segment 0 ≤ t ≤ T but also on its entire sections. In this case, the maximum principle is not sufficient to determine the optimal control -supplementary research is required to identify the so-called special controls. In addition, the question of the possible number of switching points and their location on the segment 0 ≤ t ≤ T remains open. Nevertheless, the solution can be obtained by numerical methods. Note that if we exclude special controls, the optimal control will be a boundary, and the area of admissible controls is a closed and bounded domain. When applying the method of successive approximations, a boundary control will be obtained at each iteration, that is, the approximation to the optimal control will be in the class of discontinuous boundary controls. When using gradient methods based on obtaining functional gradient formulas, piecewise continuous control will be approximated by continuous functions.
When finding the optimal control by the above iterative methods using the maximum principle, it becomes necessary to solve the boundary value problems (2)-(4) and (8)-(10). It is not possible to obtain an analytical solution of these boundary value problems due to the nonlinearity of equations (2). At the same time, it is obvious that the most accessible and simple way is the numerical integration of the equations by an implicit difference scheme in combination with a sweep or the method of straight lines. However, in this case, the question of the convergence of an approximate solution of a boundary value problem is not always confirmed. Without this, it is impossible to prove the convergence of the approximate solution of the approximating optimal problem, at least in terms of the functional [3].

3. Numerical solution of problem (1)-(4)
The problem is solved in two ways: by the gradient projection method and the method of successive approximations.
Using the method of straight lines, we replace the boundary value problem (2)-(4) with the system of equations: and the conjugate boundary value problem (8)-(10) taking into account the conditions ψ 0 = ψ 1 , ψ n+1 = ψ n substitute by the equations: , which boundary conditions have the form: where p i (t) = p(x i , t), ψ i (t) = ψ(x i , t), x i = ih, i = 0.1,…, n+1, (n+1)h = 1. Functional (1) and its gradient, taking into account the conditions ψ 0 = ψ 1 , are replaced by expressions: ( )= − ( ) The gradient projection method in the approximating optimal problem is reduced to constructing a sequence q k (t) according to the rule: Here: where k is the number of iterations. The parameter α > 0 is chosen depending on the sign change of ψ 1 k t ( ). The process of constructing the sequence q k (t) according to formula (19), (20) is carried out until one of the criteria specified in [10] is met, in particular, by the number of iterations.
In the method of successive approximations, first, the system of equations (13), (14) is solved with a given, based on any technological considerations, admissible control q k (t). Then equations (15), (16) are integrated for conjugate variables in order to determine the next approximations according to the rule: As can be seen, the above method is very simple from a computational point of view, since at each step it requires only solving two Cauchy problems and, checking the sign of the functions ψ 1 (t) in the interval 0 ≤ t ≤ T, determining the intervals of constancy of controls. However, in contrast to gradient methods, the question of the convergence of successive approximations remains open even in the case of convergence, and, generally speaking, it is not known whether the found control is optimal. The fact is that the maximum principle gives only a necessary condition for optimality.
It is important to note that when solving problems (13), (14), (17) it is necessary to store in the memory of the machine the solutions of system (13), (14), which are obtained by counting «from left to right» and use them when integrating system (15), (16). Instead of storing solutions of system (13), (14), from the perspective of saving computer memory, it is possible to integrate system (13), (14) with system (15), (16) by the count «from right to left», setting as the initial conditions p i (T) values obtained by solving the system (13), (14) «from left to right». However, in this case, the counting process often becomes unstable.
Computer programs that implement the methods de- was chosen as the initial approximation. Obviously, the values of the functional in this case are equal to zero, however, the approximately optimal control obtained over twelve iterations using the gradient projection method at the beginning of the time interval 0 ≤ t ≤ T still differs significantly from q * (t) but coincides with q * (t) at the end of it.
The convergence of the process is shown in Table 1. It can be seen from the table that the values of the functional are practically equal to zero. Note that, with a further increase in the number of iterations, the qualitative picture of the results did not change. In the course of solving the problem, it turned out that: This condition gives grounds to assert the existence of at least one local optimal control.  Fig. 1 shows the time dependence of the optimal control. It is illustrated that for some intermediate iterations, as the number of iterations increases, the sequence of controls approaches the optimal control q * (t). Fig. 2 shows the convergence of the method of successive approximations. After the initial and first approximation, all subsequent approximations coincide with the upper bounds of the admissible control.
It is important to note that the sequence of controls found from the condition of the maximum of the Hamiltonian functions has a character that differs significantly from the optimal control q * (t) and does not approach it.
The approaches outlined in the study can be applied to obtain a numerical solution to wide classes of problems on described processes' optimal control by general nonlinear boundary value problems of parabolic type. However, due to the nonlinearity of the boundary value problems, and, consequently, the impossibility of obtaining an estimate of the remainder term in the formula for the increment of the functional, it is not possible to prove the maximum principle. Therefore, usually, for practical purposes, it is limited to receiving some procedure for obtaining a numerical solution to the problem.

Discussion of the results of the problem on determining the optimal technological mode of depleted gas deposits' exploitation
The paper identified and analyzed a specific problem, which was the study of problems considering the optimal control of the technological regime of gas deposits' operation under the condition of their depletion by a given time point. A necessary condition of an optimal strategy for managing the operation of a gas reservoir in the case of its depletion is presented.
In addition to the result, which implies the calculation of the variation of the functional using the Lagrange function applied to the problem (1)-(4), and the numerical solution of the problem under study, the following results are also reflected: 1. To solve the problems of determining the optimal technological regime of gas extraction under the condition of reservoir depletion, a rather promising approach is described, based on the approximation of boundary value problems by ordinary differential equations and the use of optimization methods based on the Pontryagin's maximum principle. This result was obtained as an attempt to apply some currently known methods for studying optimal controls to the problem under consideration. These methods have the most complete form for systems described by ordinary differential equations. In this paper, we limited ourselves to the consideration of nonlinear systems with distributed parameters.
2. Using heuristic considerations, an adjoint equation with initial and boundary conditions is composed, which plays an important role in deriving the gradient formula and obtaining the necessary optimality condition.
3. The solution of the above problem is presented by two methods -the gradient projection method and the method of successive approximations, and a comparative analysis of the results of applying these methods is given. The reason why we have chosen these particular optimization methods are the following conclusions: the advantages of the gradient optimization method in comparison with other methods increase in the case of organizing the descent process with a special step; the method of successive approximations is used to solve equations or systems of equations in cases where the required parameters cannot be expressed explicitly.
We emphasize that the above arguments, of course, cannot be considered rigorous and are only useful considerations in obtaining the adjoint boundary value problem, deriving the gradient formula, and the necessary optimality condition. For complete stringency, it is also necessary to define what is meant by the solution of the original and adjoint boundary value problems, to investigate the issues of their solvability, to give an estimate of the remainder term in the formula for the increment of the minimized functional. It is not possible to answer some of these questions in the case of nonlinearity of boundary value problems. Therefore, some authors, in order to obtain a solution to specific applied control problems, usually limit themselves to using some procedure for finding approximate solutions.
This study can be developed by looking at production constraints for geological and technological reasons when there is a gradual decrease in the rate of upward gas flow at existing tubing diameters; in case of precipitation and deposition of a certain part of solid mechanical impurities at the bottom and in the wellbore; with an increase in depression and filtration resistance; when considering the processes of development of multi-layer fields, taking into account the gas-dynamic connection between the layers.
It should be noted that using the proposed methods, the need to restore pressure between modes to a stable one requires almost the same time as when the pressure and flow rate are completely stabilized in the modes themselves.
In conclusion, we highlight some unsolved problems that may be of interest to researchers in this scientific field: 1. Although the calculation formulas that implement the methods of gradient projection and successive approximations are quite simple and convenient for use on a computer, however, the derivation of these formulas is associated with difficulties in estimating the residual term: