## Nonlinear Model Predictive Control for Oil Reservoirs

Research output: ResearchPh.D. thesis – Annual report year: 2018

Oil remains the world’s leading fuel, and it accounted for a third of the global energy consumption in 2016. Oil is mainly used as a source of energy, but it is also used for non-energy purposes, e.g. for road surfaces, lubricants, and in the chemical industry. Furthermore, the global demand for oil is expected to increase towards 2040 where it is predicted to account for 31% of the world’s energy consumption. The subject of this thesis is nonlinear model predictive control (NMPC) for closed-loop reservoir management (CLRM). The purpose of NMPC for oil reservoirs management is to compute a ﬁeld-wide closed-loop feedback control strategy (i.e. an oil production strategy) that optimizes a long-term ﬁnancial measure of the oil production process, e.g. the total oil recovery or the net present value over the reservoir life-time. More speciﬁcally, this thesis is concerned with models and algorithms for NMPC of thermal and isothermal compositional oil recovery processes. Two main principles are used to model such processes: 1) mass and energy conservation, and 2) phase equilibrium. The conservation of energy relates to the ﬁrst law of thermodynamics, and the phase equilibrium relates to the second law of thermodynamics (i.e. the entropy of a closed system in equilibrium is maximal). The phase equilibrium problem that is relevant to thermal reservoir ﬂow models is the UV ﬂash which is a direct statement of the second law of thermodynamics. For isothermal reservoir ﬂow models, the relevant phase equilibrium problem is the VT ﬂash. The condition of maximal entropy does not apply directly to isothermal systems because they are not closed. Instead, the Helmholtz energy is minimal for isothermal systems in equilibrium. In this work, we formulate the phase equilibrium problems as equality constrained optimization problems and the phase equilibrium conditions as the corresponding ﬁrst order optimality (or Karush-Kuhn-Tucker) conditions. Consequently, the phase equilibrium conditions are a set of algebraic equations. The conservation equations are a set of coupled partial diﬀerential equations. We use the method of lines to solve these partial diﬀerential-algebraic equations, and we discretize the partial diﬀerential equations with a ﬁnite volume method. The result is a set of diﬀerential equations, and combined with the phase equilibrium conditions, the model equations are a set of diﬀerential-algebraic equations (DAEs) which are in a speciﬁc semi-explicit form. In this work, we describe algorithms for 1) simulation, 2) state estimation, 3) dynamic optimization, and 4) NMPC of DAEs in this speciﬁc semi-explicit form. Numerical methods for simulation, i.e. for numerical solution of initial value problems (IVPs), are central to the state estimation algorithms and the dynamic optimization algorithm (and therefore also to the NMPC algorithm) considered in this thesis. We consider the numerical solution of both deterministic and stochastic IVPs that involve DAEs in the semi-explicit form. We present two approaches for the numerical solution of the deterministic IVPs: 1) a simultaneous approach and 2) a nested approach. Both approaches use Euler’s implicit method. In the simultaneous approach, the diﬀerential equations and the algebraic equations are solved simultaneously. In the nested approach, the solution of the algebraic equations is nested into the solution of the diﬀerential equations. We present one approach for the numerical solution of the stochastic IVPs. It is a simultaneous approach, and it uses a semi-implicit discretization scheme. We consider the extended Kalman ﬁlter (EKF), the unscented Kalman ﬁlter (UKF), a particle ﬁlter (PF), and the ensemble Kalman ﬁlter (EnKF) for state estimation of continuous-discrete DAE systems in the semi-explicit form. Furthermore, we describe an algorithm for gradient-based numerical solution of dynamic optimization problems that involve DAEs in the semi-explicit form. The algorithm uses 1) the single-shooting method and 2) the discrete adjoint method for the computation of gradients. Finally, we describe an NMPC algorithm which combines either of the four state estimation algorithms with the gradient-based dynamic optimization algorithm. It is natural to model other dynamic phase equilibrium processes using DAEs in the speciﬁc semi-explicit form that we consider. Therefore, the above algorithms are relevant for dynamic phase equilibrium processes in general. We implement and test the algorithms on a small-scale ﬂash separation process. The model of this process consists of mass and energy conservation equations, and the relevant phase equilibrium problem is the UV ﬂash. Therefore, this ﬂash separation process is representative of the thermal and compositional reservoir ﬂow process. For the ﬂash separation process, we consider Matlab implementations of the state estimation algorithms, Matlab and C implementations of the dynamic optimization algorithm, and a mixed Matlab and C implementation of the NMPC algorithm. For the thermal and the isothermal compositional reservoir ﬂow models, we consider a C/C++ implementation of the dynamic optimization algorithm. In this work, we develop an open-source thermodynamic software library called ThermoLib which we use to evaluate the thermo dynamic functions in the reservoir ﬂow models and in the model of the ﬂash separation process. ThermoLib is available at www.psetools.org. The thermodynamic model in ThermoLib is based on data and correlations from the DIPPR database and on cubic equations of state. ThermoLib provides Matlab and C routines for evaluating the enthalpy, entropy, and volume of 1) ideal gas mixtures, 2) ideal liquid mixtures, and 3) nonideal mixtures as functions of temperature, pressure, and mixture composition (in moles). All other thermodynamic functions can be computed from the enthalpy, entropy, and volume using fundamental thermodynamic relations. The main novelty of ThermoLib is that its routines also evaluate the ﬁrst and second order derivatives of the thermodynamic functions with respect to the temperature, pressure, and composition (in moles). The expressions for these derivatives are derived analytically. This thesis consists of a summary report and a collection of twelve research papers and two technical reports written in the period from August 2015 to August 2018: 1) one paper is published in Computers and Chemical Engineering, 2) one paper is submitted to Journal of Process Control, 3) nine papers are published in conference proceedings, and 4) one paper is in preparation to be submitted.
Original language English
Number of pages 344 Submitted - 2018
Series DTU Compute PHD-2018 485 0909-3192