1. Introduction
This paper builds on material in Lie [
1]. Petroleum products have been key energy carriers for more than a century. The current focus on climate (
https://sdgs.un.org/goals; accessed on 13 December 2023) implies a change towards sustainable energy carriers. To succeed in this change, a transition period from the use of fossil fuel is necessary. In the transition, improved operation of petroleum production through model-based optimal operation will be necessary. Petroleum production entails slow (reservoir; months) and fast (reservoir-to-separator; seconds) subsystems; this is a focus of the on-going research project “DigiWell” (DigiWell: see Funding). The vertical transport of petroleum from the oil well to the surface requires sufficient pressure to counteract gravitational and friction forces. If the oil-well heel pressure is insufficient for such transport, either (i) gas is injected in the vertical pipe to “blow” the petroleum fluids to the surface (“gas lifted”), or (ii) an electric submersible pump (ESP) is installed in the vertical pipe to increase the pressure (“ESP-lifted”) sufficiently. Here, the focus is on the dynamics of transport from the reservoir formation to a surface manifold via an ESP, and further horizontal transport from the manifold to a separator.
Industrial simulation tools typically put the main emphasis on the dynamics of the reservoir (time constant: months) and use steady state models for the reservoir-to-surface transport. This emphasis is inadequate for daily operation and control. Here, a simplified, yet complete, dynamic model for oil transport from the reservoir to the separator is discussed. The model provides an understanding of the dynamic behavior of such systems, and is suitable for industrial control design, as well as for control and petroleum production studies. Emphasis is put on simple, yet stringent, model development, while avoiding unit complexities in the variables.
The authors of Sharma and Glemmestad [
2] (see also Sharma [
3]) provide a dynamic model of oil transport from the reservoir to the separator suitable for control design. In Binder et al. [
4], an older model is discussed; other models are typically CFD models, which are too complex for control design.
Sharma’s model considers a case with four vertical pipes from the oil reservoirs to a single manifold, with two horizontal pipes from the manifold to a single separator. Each vertical pipe has an ESP and a choke valve at a common manifold entrance; the pump speeds can be manipulated individually. The horizontal pipes have booster pumps to counteract friction effects. The original ESP model includes induction motors, but the dynamics of the pump actuator is fast, and is neglected in later work. The ESP model in Sharma and Glemmestad [
2] is novel—the authors use a simple model of a booster pump, and use a valve model based on the ANSI/ISA S75.01 standard (
http://integrated.cc/cse/ISA_750101_SPBd.pdf; accessed on 13 December 2023). The model in Sharma and Glemmestad [
2] was re-structured and simplified in Lie [
1], emphasizing dimensionless equipment models, thereby eliminating some of the complexity found in common industry models.
The dynamic model with ESP in Sharma and Glemmestad [
2] is mainly relevant for the production of heavy oil. Several papers use this model in advanced industrial control studies, including Krishnamoorthy et al. [
5], Santana et al. [
6], Delou et al. [
7].
Mixtures of liquid oil and water form an emulsion when stirred (e.g., in a multi-stage ESP). For such emulsions, the viscosity—and hence, the friction—varies dramatically with the water content (Justiniano and Romero [
8]). Sharma and Glemmestad [
2] assume an unrealistic linear viscosity dependence on the water fraction in pipe friction. Creation of an emulsion will likely modify the behavior of the ESP. Furthermore, real systems will contain some gas, which will also modify the behavior of the ESP (see, e.g., Zhu et al. [
9,
10,
11]).
Although control-relevant models of ESP-aided oil production from bore-well heel to top-side separator are not new, it is difficult to find presentations with complete information provided in a concise way in a single location. This paper aims to fill that gap, while also demonstrating the advantage of using dimensionless equipment models. As a consequence, the paper contains all the necessary equations for a complete model, with the model parameters provided in an appendix. Although some models are over-simplified, the presentation should make it clear how more realistic models can replace the models used here. The simulation of realistic model topologies is greatly enhanced by using equation-based modeling languages, and a secondary aim is to demonstrate this. Simulation results are provided both to demonstrate the physical realism of the model, and also to allow for comparison with other implementations. Simulation languages embedded in an extensive eco-system will make control for optimal operation much simpler. A third aim is, thus, to demonstrate this possibility via a simple tuning of a controller based on the model at hand.
Section 2 gives an overview of the transport system from the oil reservoir via a manifold to a separator, and the key equipment models.
Section 3 develops a simple mechanistic model of the system.
Section 4 contrasts two modeling languages for simulation: Modelica and Julia’s ModelingToolkit.
Section 5 illustrates model behavior and the use of modeling/simulation tools for analysis and control. Finally,
Section 6 provides some conclusions.
2. System Description
Production of a mixture of water and crude oil in the liquid phase is considered, where the evaporation of liquids is assumed to be negligible. In the sequel, for an extensive variable x, denotes the flow rate of x. More generally (i.e., for both extensive and intensive variables), denotes the time derivative of any variable x.
2.1. System Topology
Oil production
systems merge several boreholes from the same or different reservoirs through vertical pipes into a manifold. Normally, more than one horizontal transport pipe is needed from the manifold to a separator for sufficient transport capacity—too large a diameter in pipes leads to unwanted laminar flow, while too small a diameter leads to high velocity and high friction loss. Water is commonly injected into the manifold to reduce the friction loss in the horizontal pipes. The added water is typically recycled from the separator, and is at close to the production temperature, thus making inclusion of the energy balance less important.
Figure 1 shows a system with
wells/vertical pipes via a common manifold to
transportation/horizontal pipes leading to the separator.
In
Figure 1,
is the reservoir
formation pressure for well
j,
is the bore-hole
heel pressure,
is the volumetric heel flow rate,
is the vertical cross-sectional area below the ESP,
is the length of the vertical pipe below the ESP,
is the inlet pressure to the (ESP) pump,
is the effluent pressure after the (ESP) pump,
is the vertical cross-sectional area above the ESP,
is the length of the vertical pipe above the ESP,
is the volumetric flow rate at the inlet to the choke valve,
is the pressure at the inlet to the choke valve, and
is the pressure at the effluent from the choke valve. Next,
is the manifold pressure, while
is the water volumetric flow rate added to the manifold to reduce the viscosity. At the outlet from the manifold,
is the influent pressure to the booster pump (BP),
is the effluent pressure after the booster pump,
is the volumetric flow rate in a transport pipe from the manifold to the separator,
is the pressure at the inlet to the valve into the separator, and
is the separator pressure.
For simplicity, it is assumed that . All the vertical pipes are assumed to be connected to the same manifold pressure ; hence, the effluent choke pressure satisfies for all j. The influent pressure to the booster pumps, , are all assumed to be equal to the outlet pressure from the manifold, and have the same value, . Likewise, all the transport pipes end up in the same separator: for all j. Here, a choke at the end of the transport pipes has been neglected.
2.2. Fluid Properties
The petroleum fluid properties are important. The density
varies with the pressure
p and the temperature
T,
. Neglecting the temperature dependence, and assuming constant
isothermal compressibility (good thermodynamics books define the isothermal compressibility; see also
https://en.wikipedia.org/wiki/Compressibility; accessed on 13 December 2023), the isothermal compressibility is the inverse of the bulk modulus.
leads to
, given as
where
is some reference state.
Defining the water cut
as
, the volumetric flow rate of water divided by the total flow rate of the fluid, the total density
can be expressed as
where
and
are the constant densities of pure water and crude oil, respectively.
In reality, water and crude oil have different isothermal compressibilities. Here, we simplify and assume an overall value for
. Using the data in
Table A1 of
Appendix A, the density
varies by ca. 10 kg/m
3 with pressure variation in the range 25–225 bar (
Figure 2).
Thus, we assume constant density in the pipes, but a pressure-dependent density is assumed in the manifold.
The authors of Sharma and Glemmestad [
2] proposed a simple linear mixing rule for
the kinematic viscosity
:
With
known,
the dynamic viscosity
can be computed (if needed) as
The linear interpolation model of Equation (
3) is used here to faciliate comparison with the results in Sharma and Glemmestad [
2], even though it is not physically realistic [
8].
2.3. Well-Bore Production
The total production from the reservoir (formation pressure
) relates the volumetric petroleum fluid rate
at the well-bore heel as
, where
is the heel pressure and the proportionality constant
is the
productivity index,
is unit-dependent. Here, we instead propose a dimensionless form,
where
is the productivity index
capacity in the same unit as
, and
is the scaling pressure with the same unit as
.
2.4. Pump Models
2.4.1. Electric Submersible Pump
Pump models are often given as
where
is the pump
head with a volumetric flow rate
and a control input
, rotational pump frequency
.
The authors of Sharma and Glemmestad [
2] provide values for the minimal, maximal, and best-efficiency-point flow rates,
In Sharma and Glemmestad [
2], a comprehensive model for the pump head of a
multi-stage ESP is developed. To ease change in the units, their model is rewritten here in dimensionless form
In Equation (
9),
is a nominal scaling head,
is the pump rotational frequency in the same unit as that of the nominal rotational frequency
,
is the actual volumetric flow rate out of the pump,
is the scaling flow rate, and
are dimensionless model parameters. (Here,
is dimensionless, while in Sharma [
3], the parameters
have dimensions). This implies that the values of
here are different from those of
in Sharma and Glemmestad [
2], Sharma [
3]. In Sharma and Glemmestad [
2], a head curve plot is provided; the result in
Figure 3 based on the dimensionless model in Equation (
9) is identical to their plot.
In addition, Sharma and Glemmestad [
2] provide a model for the mechanical power requirement
for operating the pump (“brake horse power”, BHP, in the original publication), again rewritten in dimensionless form,
In Equation (
10),
is the nominal scaling power consumption to operate the pump,
are dimensionless model parameters, while
and
are as above.
The actual power added to the fluid is
which gives the efficiency as
where it is assumed that
and
have the same units. Sharma and Glemmestad [
2] include an efficiency curve plot; the result of Equation (
12) based on a dimensionless model is identical to their plot.
2.4.2. Booster Pump
For the
booster pump in the horizontal pipes, a simpler model is suggested in Sharma and Glemmestad [
2], rewritten in dimensionless form as
where
is the pressure increase at the given pump frequency/speed
, in the same units as
, which is the pressure increase at the nominal pump frequency
.
2.4.3. Pump Control Input
In reality, the pump speed (, ) is not a control input. Instead, a motor is used to control the torque applied to the aggregate of the motor and the pump.
In Sharma [
3], a model of the induction motor driving the ESP is developed. The experience of [
3] is that the motor dynamics are much faster than those of the mechanical system; hence, in most of his work, Sharma [
3] neglects the motor dynamics. However, it is not clear whether Sharma [
3] considers the mechanical dynamics of accelerating the pump itself. These dynamics would be described by the kinetic energy balance in rotational form (the “swing equation”), which can be written as
with kinetic energy
K
where
is the total moment of inertia for the pump, the motor, and a possible flywheel, while
is the input power from the motor (control input), and
is as in Equation (
11).
In Sharma [
3], the moment of inertia is given as approximately
. It is not clear whether this is the motor moment of inertia or the total moment of inertia. However, using such a moment of inertia leads to a pump time constant which is still much faster than the dynamics of the flow
, etc.; hence, the pump/motor dynamics is neglected here, and for simplicity, it is assumed that
is a control input.
2.5. Valve Models
The authors of Sharma and Glemmestad [
2] base their valve models on the ANSI/ISA S75.01 standard (
http://integrated.cc/cse/ISA_750101_SPBd.pdf; accessed on 13 December 2023). Here, instead, a dimensionless description is proposed with extension to a control input,
where
is the valve mass flow rate
capacity,
is the valve control signal,
is the valve characteristics,
are the influent and effluent densities, respectively,
are the influent and effluent pressures, respectively, while
are the scaling density and pressure, respectively.
2.6. Friction Loss
The friction drop along the pipe can be given by the Darcy–Weisbach model (e.g.,
https://en.wikipedia.org/wiki/Darcy%E2%80%93Weisbach_equation; accessed on 13 December 2023) as
where
is Darcy’s friction factor given by Colebrook’s implicit expression (the Colebrook equation, sometimes known as the Colebrook–White equation). One explicit
approximation to Colebrook’s expression is due to Swamee and Jain [
12],
where
is the Reynolds number,
where
is the
dynamic viscosity,
is the
kinematic viscosity, and
is the “roughness height” of the pipe internal surface. The linear velocity
v is related to the volumetric flow rate
by
where
A is the cross-sectional area of the pipe.
2.7. Why Dimensionless Models?
2.7.1. Example: ESP Pump Model
As a first example, consider the ESP model in Equation (
9). In the original formulation in Sharma and Glemmestad [
2] (slight change in notation),
where the parameters
have rather complicated units and the equation is hard-coded with
, while
(for quantity
x,
is the unit of the quantity). In practice, (i) either the remainder of the model has to be posed using these units, or (ii) one has to operate with several copies of the variables, e.g.,
and
, and remember to correctly convert between these versions of the flow rate. Both of these approaches are error-prone, and also require several versions of the variables.
A much better solution is to write the model in dimensionless form. The simplest way to do this for the model in Equation (
19), is as
If we choose
and
, then,
. Suppose we want to generate the plot in
Figure 3. Because that figure plots
in
(the “native” unit), while the flow rate
is given in
(the “native” unit is
), this result is produced by choosing
, which can easily be found using, e.g., the WolframAlpha app (e.g., the Microsoft Store).
In practice, it may be better to choose a more natural scaling unit, e.g., SI units. In that case, it is necessary to change the parameters
; for the parameters in Equation (
9), the scaling parameters are in SI units, where
and
are given in
Table A2. To find
, choose
,
, and write Equation (
20) as
where the new
is given in unit
,
,
,
are the new, dimensionless parameters in Equation (
9), while the new scaling flow rate
. With this modified correlation (
) for
using SI units, the dimensionless form is as in Equation (
9).
2.7.2. Example: Control Valve
The ANSI/ISA S75.01 standard (
http://integrated.cc/cse/ISA_750101_SPBd.pdf; accessed on 13 December 2023) for
compressible (i.e.,
,
), non-choked fluids without fitting is
where,
C is the valve coefficient,
is the mass flow rate through the valve,
is the influent density,
is the effluent density,
is the influent pressure,
is the effluent pressure, and
is used to handle unit conversion. Typically, tabular values for
are given which are valid for different combinations of units for
,
, and
p. This makes change to the units rather complicated. The dimensionless formulation as in Equation (
14) greatly simplifies the use of the valve model in different units, and also includes a control valve characteristic.
4. Simulation Tools
Modelica is a mature language dating back to the 1990s; ModelingToolkit [MTK] is some 4–5 years old and is still evolving rapidly. MTK is more general than Modelica, and is also integrated in the larger eco-system of a general scripting language (Julia). Currently, MTK does not support a free graphical flow-sheeting tool, and it is unclear whether MTK allows for as large models as OpenModelica. Both tools have extensive support for building libraries.
The combined model was solved using the free languages/tools OpenModelica [
14,
15] and ModelingToolkit [
16] for Julia. To illustrate the similarity between the OpenModelica code and a current formulation using MTK, parts of the Modelica code and the MTK code for the reservoir heel–to–manifold are provided in
Appendix B. The listings show that the Modelica code and the ModelingToolkit code have a high degree of similarity. A few things to note:
- 1.
In Modelica, the independent temporal variable has a fixed name (time), and the time differentiation operator has a fixed name (der). In ModelingToolkit, both of these can be freely named by the user. In order to make the unit models work together (e.g., in a standard library), it is, however, necessary to standardize on a name for time (commonly t); differentiation can be given a name, e.g., Dt = Differential(t) or similar.
- 2.
In Modelica, the quantities need to be specified with a type (e.g.,
Real), and are prepended with a qualifier (e.g.,
constant, parameter) except for the variables. For Julia and ModelingToolkit, the data type is inferred, unless explicitly stated. In the code (
Appendix B), quantities in MTK are grouped within
begin...end blocks in
macros (identifiers prepended by
@, e.g.,
@parameters).
- 3.
Modelica has a simple way to handle implicit algebraic equations, and in many cases an initial guess of the algebraic variable is not required (see variable
p_c__i in the Modelica code). In ModelingToolkit, the initial values for the unknowns after structural simplification (“states”) must be provided with numeric values (see variable
p_c__i in the MTK code,
Appendix B).
- 4.
In ModelingToolkit, the initial values of the differential variables can be changed outside of the code; hence, default values can be written as Vd_v(t)=23.15e-3. In Modelica, only parameters can be changed outside of the code (after compilation); hence, a parameter has been defined to hold the default initial value Vd_v(start = Vd_v0, fixed = true.
- 5.
Modelica uses symbol = for mathematical equality; MTK uses symbol ~ since Julia already uses symbol = for assignment.
The default solver in OpenModelica is excellent, although here it struggled if the model was posed as a DAE formulation with
momentum as a differential variable. ModelingToolkit can use solvers from the large, high-quality DifferentialEquations.jl package [
17]. With ModelingToolkit, more thought is currently required when choosing the solver, accuracies, etc., compared to OpenModelica. Also, OpenModelica handles step-changes in inputs well, while for the DifferentialEquations.jl solvers, it is often necessary to specify the time points where the step changes occur. On the other hand, the solutions from ModelingToolkit include interpolation functions, which yield smooth solutions with considerably fewer data points than for Modelica.
The results presented in
Section 5 compare numerical solutions for the reservoir heel-to-manifold system for ModelingToolkit vs. OpenModelica.
OpenModelica’s support for linearization and plotting can be accessed from Julia via the OMJulia API [
18]. ModelingToolkit is integrated in the Julia eco-system, with support for linearization, plotting, control systems analysis, random variables, etc., and overall has more possibilities than OpenModelica if further analysis is required.
OpenModelica is currently reported to handle models up to approximately variables/equations. Various conference presentations indicate that ModelingToolkit currently can solve models of up to approximately variables/equations (on-going work on a JuliaSimCompiler.jl for a commercial extension of Julia will increase the possible system size). The model above (Reservoir_2_Manifold) is reported by OpenModelica to have 15 variables (differential+algebraic) and 15 equations. In ModelingToolkit, linear equations with “observed” variables are stripped off from the model (function structural_simplify()) before solving the model. The above Reservoir_2_Manifold model in the listing is reported to have two “states” and two equations by ModelingToolkit. It is not clear whether the ModelingToolkit claim of variables/equations is before or after the “observed” variables are stripped off.
Other commonly used languages for scientific computing are MATLAB (commercial) and Python (free). Compared to both of these languages, Julia (free) has a more extensive set of differential equation solvers (Julia’s DifferentialEquations.jl package can be accessed from Python and R). Neither MATLAB nor Python offer equation-based modeling languages with library/re-use support as do Modelica or ModelingToolkit; MathWorks does offer Simscape (commercial) with MATLAB integration for such use, however (
https://se.mathworks.com/products/simscape.html; accessed on 13 December 2023).
6. Conclusions
Sharma and Glemmestad [
2], Sharma [
3] provided a novel dynamic model of an ESP-lifted oil production system from the reservoir to the separator. Their pump models neglect the effect of the gas content and fluid viscosity variation, and they use a simplistic viscosity model in friction terms. Also, some of the information is spread over several publications, and the ESP model parameters are difficult to find.
Nevertheless, their model is used in the present work to facilitate comparison. Here, a structured development of the model in Sharma and Glemmestad [
2] is provided from the fundamental balance laws with clearly stated simplifying assumptions. Their equipment models are rephrased in dimensionless form, and the merits of dimensionless forms are emphasized. A complete, rephrased mathematical model from the reservoir to the separator is provided, with all the necessary model parameters, initial states, and input functions. This achieves the goal of providing a complete model that can be implemented in a single presentation. Because of the structured model development, it is also relatively straightforward to replace the equipment models with alternative models.
The implementation of realistic and complex oil field topologies is greatly simplified by using modeling languages that facilitate use of model libraries and the re-use of models. The rephrased model of Sharma [
3] is implemented in two such languages, Modelica and ModelingToolkit, for comparison. Modelica is a mature language for differential algebraic models, with excellent solvers that can handle large-scale models (in the range of
+ unknowns), and support for C code generation and integration via the FMI standard (FMI: functional mock-up interface, e.g.,
https://fmi-standard.org/; accessed on 13 December 2023) to other tools. ModelingToolkit [MTK] is newer, is in rapid development, handles a larger class of models (including distributed models), and is tightly integrated within the Julia scripting language, which has excellent support for control design, optimization, and more. It is demonstrated that the form of Modelica and MTK models can be very similar. The purpose of this work is not to implement a library unit of the model. However, the advantages of using modeling languages are clearly pointed out.
To illustrate the possibilities of modeling languages integrated with script languages, an example is given where the MTK model is linearized in Julia. Based on the linearized model, a simple PI controller from the ESP speed to the production flow rate is designed. This design is not meant for industrial use, but illustrates the simplicity of a control design workflow with modern modeling languages. The example also illustrates that standard PI tuning rules struggle with oscillatoric systems (here, due to the compressibility of the oil/water mixture), and that some additional refinement may improve the closed-loop system. However, one would anticipate that an even more complex controller, such as model predictive control [
23], would further improve the performance.
The model development and discussion indicates a number of possible extensions, such as (a) more realistic properties (density, viscosity), (b) allowing for distributed properties along the pipes (ModelingToolkit for Julia has support for automatic discretization of PDEs), (c) adding a more realistic system for water dilution in the manifold, (d) inclusion of valves in the manifold–separator pipes, (e) use for advanced control design with constraints, (f) use for optimization, (g) integration with a reservoir model to study how to handle stiffness, and more. Such further work will give more insight into the industrial usefulness of the model.