A Machine Learning Approach for Virtual Flow Metering and Forecasting

A Machine Learning Approach for Virtual Flow Metering and Forecasting

Nikolai Andrianov111The Danish Hydrocarbon Research and Technology Centre, Technical University of Denmark, 2800 Kgs. Lyngby, Denmark. E-mail: nandria@dtu.dk.
January 8, 2018
Abstract

We are concerned with robust and accurate forecasting of multiphase flow rates in wells and pipelines during oil and gas production. In practice, the possibility to physically measure the rates is often limited; besides, it is desirable to estimate future values of multiphase rates based on the previous behavior of the system. In this work, we demonstrate that a Long Short-Term Memory (LSTM) recurrent artificial network is able not only to accurately estimate the multiphase rates at current time (i.e., act as a virtual flow meter), but also to forecast the rates for a sequence of future time instants. For a synthetic severe slugging case, LSTM forecasts compare favorably with the results of hydrodynamical modeling. LSTM results for a realistic noizy dataset of a variable rate well test show that the model can also successfully forecast multiphase rates for a system with changing flow patterns.

\pdfbookmark

[1]TitleTitle

1 Introduction

Accurate multiphase flow rate measurement is an indispensable tool for production optimization from oil and gas fields, especially in an offshore environment (see e.g. [3]). Currently, there are two industry-accepted solutions for providing such measurements: using test separators and using multiphase flow meters. While these approaches have their advantages and disadvantages of (see e.g. [8]), both of them require hardware installations. This can limit the applicability of physical metering devices due to possible transportation issues, space and security considerations, and high costs.

A virtual flow meter (VFM) is a mathematical model which allows to estimate multiphase rates using available data on the flow. A VFM, primarily using readily available cheap measurements (such as pressure and temperature), can potentially serve as a cost-efficient addition to physical flow metering devices.

VFM models can be classified as hydrodynamical or data-driven. In the hydrodynamical approach one typically solves the phase conservation equations in a pipe geometry, which requires the choice of an adequate mathematical model, appropriate numerical method, and availability of a large number of input data. An advantage of this method is that one can estimate various parameters at arbitrary points of the flowline. A comparison of several hydrodynamical VFMs is presented in [2].

The data-driven approach is a system identification tool, which requires the user to accept one of generic model structures. Such models exploit no prior knowledge on the flow and produce essentially data descriptions. In practice, it is easier to setup a data-driven model as compared to a hydrodynamical one. However, data-driven predictions do not have a physical interpretation and it is not possible to estimate parameters with no historical data. Despite these shortcomings, the use of data-driven VFMs is gaining momentum in the industry, see [5].

One important difference between hydrodynamical and data-driven VFMs is the ability of the latter not only to predict rates (i.e., estimate rates at the current time instant ), but also to forecast rates at future time instants . Indeed, without a priori knowledge of time-varying boundary conditions, a hydrodynamical model is only able to yield forecasts at the next time instant .

The goal of the present paper is to evaluate the forecasting capability of a class of data-driven VFMs which use artifical neural networks (ANNs). Feedforward ANNs have been successfully used in VFM predictions by many authors (see e.g. [1] and the references therein). However, the forecasting capability of feedforward ANNs is limited because they are unaware of the temporal structure or order between observations.

Recent results in such applications as automatic text translation and image captioning suggest that the Long Short-Term Memory (LSTM) model of [9] is a efficient tool for time series forecasting.

In order to assess the LSTM model performance for VFM applications, we consider a synthetic two-phase severe slugging case (see [4]) and a realistic three-phase well testing dataset.

For the severe slugging data set, we demonstrate superior performance of LSTM as compared to the feedfoward ANN sliding window approach. We investigate the LSTM convergence as a function of provided distributed pressure measurements and determine the optimal model configuration.

For the variable rate well test data set, we show that LSTM can successfully handle a noizy dataset, describing a system with changing flow patterns. The accuracy of the forecast improves with the the number of flow periods used for training the model.

2 LSTM Model Setup

Consider a time series and , where is a -dimensional vector of input features and is a -dimensional vector of output features values at equally spaced time instants . In VFM applications, features are the measurement data acquired at different points of the flowline. One can select the sets of the input and output features independently from each other. In particular, a feature can simultaneously be used for both input and output (e.g., we might be willing to forecast future values of a flow rate from its past values).

We are interested in forecasting the sequences of output features of length using the sequences of input features of length . To this end, the terms and from the training interval are divided into overlapping sequences of length , shifted by an indentation step . The result can be cast in form of the training array

(2.1)

and the target array

(2.2)

so that and .

LSTM maps an input sequence to the output sequence for via a composition of linear transformations and nonlinear activation functions. The weights of the linear transformations are iteratively updated to minimize a loss function, which penalizes the distance between the output and the target sequences. The original LSTM by [9] is limited to the case when [6] and [12] introduced an encoder-decoder architecture to generalize the LSTM applicability for cases with . See [11] for a review.

In this work, we use Keras implementation of LSTM, see [7]. The simulation scripts with the corresponding datasets (see below) are publicly available under https://github.com/nikolai-andrianov/VFM/.

3 Experiments

3.1 Severe Slugging Case

Consider a two-phase isothermal gas-liquid flow in a 60 m section of an offshore pipeline, ending with a 14 m long riser. The flow can be described by a set of partial differential equations, expressing conservation of mass and momentum for the phases. We will be using the mathematical model, numerical method, and the specifications for the test case, presented in [4].

Under certain constant boundary conditions at the pipeline inlet and at the riser outlet, the numerical solution exhibits a typical severe slugging behaviour, see Fig. 1.

Fig. 1.: A snapshot of the numerical solution for the severe slugging case at intermediate time instant.

We will utilize this numerical solution as a “ground truth” for forecasting the liquid and gas rates at the riser bottom using the data from virtual pressure gauges distributed along the flowline, see Fig. 2.

Fig. 2.: Pressure data used as input to forecast the flow rates.

In order to run LSTM forecasts, we resample the normalized pressure and flow rate data with a uniform timestep of 1 sec, and use half of the total hydrodynamical simulation time as a training interval, sec.

We first analyze the quality of LSTM forecasts when the network is trained using only pressure readings as input and liquid rate as output. The training data is divided into sequences of length sec with , shifted by the indentation step sec. The network details are given below:

  • Deep LSTM with 3 hidden layers and 10 memory cells at each layer;

  • Total number of trainable parameters is with validation split of 0.05 for the number of input features and number of output features ;

  • Fixed random seed for repeatability in parameter initialization;

  • Mean squared error (MSE) loss function and Adam optimizer of [10] with batch size of 1 and number epochs equal to 10.

These network training parameters were determined by trial-and-error. For the case considered, the forecasting results were most sensitive to the number and lengths of input/output sequences.

Fig. 3.: LSTM liquid rate forecasts using various number of pressure readings as input.
Fig. 4.: Feedforward ANN liquid rate forecasts using a single pressure readings as input.

The forecasting capability of an LSTM can be quantified with the ratio

(3.1)

which we will term the relative forecasting interval. For the severe slugging case , i.e. the LSTM can forecast the future flow rates for the time interval which length is of the length of LSTM’s training interval.

The forecasts are plotted as 15 non-overlapping sequences of length sec with sec, shifted by the indentation step sec, see Fig. 3. Observe that even when trained on a single pressure reading, LSTM yields excellent agreement with the ground truth hydrodynamical solution in terms of the frequency and amplitude of the liquid rate peaks. This is in striking contrast to the results of a feedforward ANN using sliding window approach with 3 hidden layers and 10 neurons at each layer, trained on the same dataset as the LSTM, see Fig. 4.

Adding more pressure data as the training input does generally increase the accuracy of LSTM forecasts. However, this improvement is not monotonous, and starting from a certain number of pressure readings (in this case 5 readings) the accuracy remains essentially the same, see Fig. 5.

Fig. 5.: LSTM convergence history as a function of number of pressure readings used to train the network.

Note that there are spurious oscillations visible in LSTM forecasts on Fig. 3. We replot the zoomed LSTM forecasts using 5 pressure readings as overlapping sequences of the same length sec, but shifted by the indentation step sec, see Fig. 6.

Fig. 6.: First output sequences of zoomed LSTM liquid rate forecasts using 5 pressure readings as input.

Observe that the spurious oscillations are located at the beginning of each sequence. This is not surprising because LSTM learns its weights within the input sequence. However, these oscillations do not affect the accuracy of the forecasts if we use overlapping output sequences. Indeed, referring to Fig. 6 we have by the end of the 0th sequence forecast till , which is oscillation-free by the time , when the new 1st sequence forecast is made till . We keep using the 0th sequence forecast until the oscillations in the 1st sequence forecast disappear, and repeat the process.

The performance of LSTM trained on pressure and liquid rate is presented in Fig. 7. Observe that increasing the number of measurements used to train the network does not improve the accuracy of the forecast, cf. Fig. 5. Moreover, if few pressure readings are used for training, the performance of LSTM trained on pressure and rate data becomes worse than that of LSTM trained just on pressure data.

Fig. 7.: Convergence history of LSTM trained on several pressure readings and the liquid rate.

The accuracy of LSTM forecasts of both liquid and gas rates (i.e., output features) is essentially the same as the results presented above for liquid rate forecasts only.

We also tested the encoder-decoder LSTM of [6] and [12], but the forecasts were less accurate compared to the results presented above.

Wall time required for training of LSTMs described above with was approx. 30 mins using a single core of i7-7700HQ CPU. Using 8 cores of the same CPU resulted in approx. 20% speedup.

3.2 Variable Rate Well Test

Consider a synthetic dataset of pressure, temperature, and oil, gas and water rates measurements during a well test, see Fig. 8 and Fig. 9. The data is characteristic for a rich gas condensate deliverability test, which involves flowing the well on successively larger choke sizes in order to determine the well’s inflow performance relationship (IPR) and maximize gas condensate recovery. (In what follows, we will refer to gas condensate as “oil”.)

Fig. 8.: Pressure and temperature for the variable rate well test.
Fig. 9.: Multiphase rates for the variable rate well test.

The dataset consists of 5 flow periods, which are characterized by the corresponding choke size. Within each flow period, the measurements are generally sampled with the uniform timestep of 1 min. We are interested in forecasting the multiphase rates using the values of pressure and temperature.

Fig. 10.: Multiphase rates forecast for the LSTM trained on first 2 flow periods. Spurious oscillations are plotted semi-transparent.

To this end, we will be utilizing essentially the same procedure as for the severe slugging experiment. We train the network on first flow periods using pressure and temperature readings as input features and multiphase rates as output feactures. Then, the multiphase rates forecasts are run for all flow periods.

One key difference of the variable rate well test case from the severe slugging case considered in the previous section is that the flow pattern in the well test case changes drastically from one flow period to another, see Fig. 8 and Fig. 9. This constitutes a challenge to the neural network, because we try to approximate the behaviour of the changing flow system with the same ANN. Another difference and a challenge for the neural network is that the dataset is noizy.

In what follows, we will compare the forecasting accuracy of LSTMs trained on first 2 and 3 flow periods. For these two cases, the training data is divided into and sequences, respectively. In both cases the sequence length is min with , and the indentation step is min. The relative forecasting intervals are and , respectively. The LSTM structure is the same as described in the previous section. The forecasts are presented in sequences of min with the indentation step is min.

The results for the LSTM, trained on first 2 flow periods, are presented in Fig. 10.

Fig. 11.: First output sequences of zoomed LSTM gas rate forecasts.

The model reproduces well the training data from the first 2 flow periods. The best accuracy is achieved for forecasted values of oil and water rates, while the gas rate is slightly overestimated. Still, the trends for all rates are captured correctly.

On the testing set (flow periods 3 to 5), the model yields reasonable values for the oil and water rates. However, the forecasts for gas rate are non-satisfactory. This can be explained by the fact that both oil and water rates lie in a same range throughout all flow periods, which is not the case for the gas rate. Also, note that the first data points on each training sequence are not covered by any output sequence. Consequently, the sharp peaks at the beginning of the flow periods 2, 3, and 4 are not included in the training dataset.

On Fig. 10 we witness the same spurious oscillations as discussed in the previous section, cf. Fig. 6. To see this, in Fig. 11 we plot the measured gas rate together with the first output sequences of forecasted gas rate during the 1st flow period. Observe that the peaks are located at the beginning of each output sequence of length min. By following the same reasoning as in the previous section, we argue that these spurious oscillations do not affect the quality of the forecast.

The results for the LSTM, trained on first 3 flow periods, are presented in Fig. 12.

Fig. 12.: Multiphase rates forecast for the LSTM trained on first 3 flow periods. Spurious oscillations are plotted semi-transparent.

The model reproduces well all training data from the first 3 flow periods. It is interesting to note that the forecasts are less noizy as compared to the measured data. There are spurious oscillations visible on the graphs, but their amplitude is less than that of the model, trained on 2 flow periods.

On the testing set (flow periods 4 and 5), the model performance is best for oil and water rates, and less satisfactory for gas rates. Again, this can be explained by a larger variability of the gas rate as compared to oil and water rates. Overall, the accuracy of the forecast is considerably better compared to that of the model, trained just on 2 flow periods.

Wall time required for training of LSTMs on first two and three flow periods using a single core of i7-7700HQ CPU was approx. 50 and 90 min, respectively.

4 Conclusion

In this work, we have shown that LSTM can be considered as a robust tool for forecasting the values of multiphase rates using pressure and temperature data. The best accuracy was achieved when the lengths of the input and output sequences to LSTM were equal. Consequently, we are limited in the length of the time interval suited for forecasts. Removing this limitation without sacrifice on the accuracy of the forecast can be an interesting topic of future research.

References

  • [1] T. A. Al-Qutami, R. Ibrahim, I. Ismail, and M. A. Ishak, Virtual multiphase flow metering using diverse neural network ensemble and adaptive simulated annealing, Expert Systems with Applications, 93 (2018), pp. 72–85.
  • [2] A. Amin, Evaluation of commercially available virtual flow meters (VFMs), Offshore Technology Conference, 2015, pp. 1–26. 25764-MS.
  • [3] A. Amin, M. Riding, R. Shepler, E. Smedstad, and J. Ratulowski, Subsea development from pore to process, Oilfield Review, 17 (2005), pp. 4–17.
  • [4] N. Andrianov, F. Coquel, M. Postel, and Q. H. Tran, A relaxation multiresolution scheme for accelerating realistic two-phase flows calculations in pipelines, Int. J. Numer. Meth. Fluids, 54 (2007), pp. 207–236.
  • [5] J. Briers, K. Goh, A. Sniekers, D. Schotanus, J. Hofland, and D. Adun, Looking back 2006 - 2016 - ten years of data driven well rate estimates for real-time surveillance and optimization, Society of Petroleum Engineers, 2016, pp. 1–12. 181032-MS.
  • [6] K. Cho, B. van Merrienboer, C. Gulcehre, D. Bahdanau, F. Bougares, H. Schwenk, and Y. Bengio, Learning phrase representations using RNN encoder-decoder for statistical machine translation, ArXiv e-print 1406.1078, (2014).
  • [7] F. Chollet et al., Keras.
    https://github.com/fchollet/keras, 2015.
  • [8] S. Corneliussen, J. Couput, E. Dahl, E. Dykesteen, K. Frøysa, E. Malde, H. Moestue, P. O. Moksnes, L. Scheers, and H. Tunheim, Handbook of Multiphase Flow Metering, Norwegian Society for Oil and Gas Measurement, 2005.
  • [9] S. Hochreiter and J. Schmidhuber, Long short-term memory, Neural Computation, 9 (1997), pp. 1735–1780.
  • [10] D. P. Kingma and J. Ba, Adam: A method for stochastic optimization, ArXiv e-print 1412.6980, (2014).
  • [11] Z. C. Lipton, J. Berkowitz, and C. Elkan, A critical review of recurrent neural networks for sequence learning, ArXiv e-print 1506.00019, (2015).
  • [12] I. Sutskever, O. Vinyals, and Q. V. Le, Sequence to sequence learning with neural networks, in Advances in Neural Information Processing Systems, 2014, pp. 3104–3112.

Comments 0
Request Comment
You are adding the first comment!
How to quickly get a good reply:
  • Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
  • Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
  • Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
""
The feedback must be of minimum 40 characters and the title a minimum of 5 characters
   
Add comment
Cancel
Loading ...
39941
This is a comment super asjknd jkasnjk adsnkj
Upvote
Downvote
""
The feedback must be of minumum 40 characters
The feedback must be of minumum 40 characters
Submit
Cancel

You are asking your first question!
How to quickly get a good answer:
  • Keep your question short and to the point
  • Check for grammar or spelling errors.
  • Phrase it like a question
Test
Test description