Skip to main content

Decline Curve Library

Project description

PyPi Version Build Status Documentation Status Coverage Status Open in Visual Studio Code

Empirical analysis of production data requires implementation of several decline curve models spread over years and multiple SPE publications. Additionally, comprehensive analysis requires graphical analysis among multiple diagnostics plots and their respective plotting functions. While each model’s q(t) (rate) function may be simple, the N(t) (cumulative volume) may not be. For example, the hyperbolic model has three different forms (hyperbolic, harmonic, exponential), and this is complicated by potentially multiple segments, each of which must be continuous in the rate derivatives. Or, as in the case of the Power-Law Exponential model, the N(t) function must be numerically evaluated.

This library defines a single interface to each of the implemented decline curve models. Each model has validation checks for parameter values and provides simple-to-use methods for evaluating arrays of time to obtain the desired function output.

Additionally, we also define an interface to attach a GOR/CGR yield function to any primary phase model. We can then obtain the outputs for the secondary phase as easily as the primary phase.

Analytic functions are implemented wherever possible. When not possible, numerical evaluations are performed using scipy.integrate.fixed_quad. Given that most of the functions of interest that must be numerically evaluated are monotonic, this generally works well.

Primary Phase

Transient Hyperbolic, Modified Hyperbolic, Power-Law Exponential, Stretched Exponential, Duong

Secondary Phase

Power-Law Yield

Water Phase

Power-Law Yield

The following functions are exposed for use

Base Functions

rate(t), cum(t), D(t), beta(t), b(t),

Interval Volumes

interval_vol(t), monthly_vol(t), monthly_vol_equiv(t),

Transient Hyperbolic

transient_rate(t), transient_cum(t), transient_D(t), transient_beta(t), transient_b(t)

Primary Phase

add_secondary(model), add_water(model)

Secondary Phase

gor(t), cgr(t)

Water Phase

wor(t), wgr(t)

Utility

bourdet(y, x, …), get_time(…), get_time_monthly_vol(…)

Getting Started

Install the library with pip:

pip install petbox-dca

A default time array of evenly-logspaced values over 5 log cycles is provided as a convenience.

>>> from petbox import dca
>>> t = dca.get_time()
>>> mh = dca.MH(qi=1000.0, Di=0.8, bi=1.8, Dterm=0.08)
>>> mh.rate(t)
array([986.738, 982.789, 977.692, ..., 0.000])

We can also attach secondary phase and water phase models, and evaluate the rate just as easily.

>>> mh.add_secondary(dca.PLYield(c=1200.0, m0=0.0, m=0.6, t0=180.0, min=None, max=20_000.0))
>>> mh.secondary.rate(t)
array([1184.086, 1179.346, 1173.231, ..., 0.000])

>>> mh.add_water(dca.PLYield(c=2.0, m0=0.0, m=0.1, t0=90.0, min=None, max=10.0))
>>> mh.water.rate(t)
array([1.950, 1.935, 1.917, ..., 0.000])

Once instantiated, the same functions and process for attaching a secondary phase work for any model.

>>> thm = dca.THM(qi=1000.0, Di=0.8, bi=2.0, bf=0.8, telf=30.0, bterm=0.03, tterm=10.0)
>>> thm.rate(t)
array([968.681, 959.741, 948.451, ..., 0.000])

>>> thm.add_secondary(dca.PLYield(c=1200.0, m0=0.0, m=0.6, t0=180.0, min=None, max=20_000.0))
>>> thm.secondary.rate(t)
array([1162.417, 1151.690, 1138.141, ..., 0.000])

>>> ple = dca.PLE(qi=1000.0, Di=0.1, Dinf=0.00001, n=0.5)
>>> ple.rate(t)
array([904.828, 892.092, 877.768, ..., 0.000])

>>> ple.add_secondary(dca.PLYield(c=1200.0, m0=0.0, m=0.6, t0=180.0, min=None, max=20_000.0))
>>> ple.secondary.rate(t)
array([1085.794, 1070.510, 1053.322, ..., 0.000])

Applying the above, we can easily evaluate each model against a data set.

>>> import matplotlib.pyplot as plt
>>> fig = plt.figure()
>>> ax1 = fig.add_subplot(121)
>>> ax2 = fig.add_subplot(122)

>>> ax1.plot(t_data, rate_data, 'o')
>>> ax2.plot(t_data, cum_data, 'o')

>>> ax1.plot(t, thm.rate(t))
>>> ax2.plot(t, thm.cum(t) * cum_data[-1] / thm.cum(t_data[-1]))  # normalization

>>> ax1.plot(t, ple.rate(t))
>>> ax2.plot(t, ple.cum(t) * cum_data[-1] / ple.cum(t_data[-1]))  # normalization

>>> ...

>>> plt.show()
model comparison

See the API documentation for a complete listing, detailed use examples, and model comparison.

Development

petbox-dca is maintained by David S. Fulford (@dsfulf). Please post an issue or pull request in this repo for any problems or suggestions!

Version History

1.1.0

  • Bug Fix
    • Fix bug in sign in MultisegmentHyperbolic.secant_from_nominal

  • Other changes
    • Add mpmath to handle precision requires of THM transient functions (only required to use the functions)

    • Adjust default degree of THM transient function quadrature integration from 50 to 10 (scipy default is 5)

    • Update package versions for docs and builds

    • Address various floating point errors, suppress numpy warnings for those which are mostly unavoidable

    • Add test/doc_exapmles.py and update figures (not sure what happened to the old file)

    • Adjust range of values in tests to avoid numerical errors in numpy and scipy functions… these were near-epsilon impractical values anyway

1.0.8

  • New functions
    • Added WaterPhase.wgr method

  • Other changes
    • Adjust yield model rate function to return consistent units if primary phase is oil or gas

    • Update to numpy v1.20 typing

1.0.7

  • Allow disabling of parameter checks by passing an interable of booleans, each indicating a check

    to each model parameter.

  • Explicitly handle floating point overflow errors rather than relying on numpy.

1.0.6

  • New functions
    • Added WaterPhase class

    • Added WaterPhase.wor method

    • Added PrimaryPhase.add_water method

  • Other changes
    • A yield model may inherit both SecondaryPhase and WaterPhase, with the respective methods removed upon attachment to a PrimaryPhase.

1.0.5

  • New functions
    • Bourdet algorithm

  • Other changes
    • Update docstrings

    • Add bourdet data derivatives to detailed use examples

1.0.4

  • Fix typos in docs

1.0.3

  • Add documentation

  • Genericize numerical integration

  • Various refactoring

0.0.1 - 1.0.2

  • Internal releases

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

petbox_dca-1.1.1.tar.gz (846.0 kB view details)

Uploaded Source

Built Distribution

petbox_dca-1.1.1-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file petbox_dca-1.1.1.tar.gz.

File metadata

  • Download URL: petbox_dca-1.1.1.tar.gz
  • Upload date:
  • Size: 846.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.13

File hashes

Hashes for petbox_dca-1.1.1.tar.gz
Algorithm Hash digest
SHA256 e00f2c9ebebab52ea6c563c4d0122f521b3edd224f15ed5cf624ee56860956d1
MD5 607271d64a6720066d5c29e1b7600166
BLAKE2b-256 acb3fbcf9525174f4f1e9bbfdf2aabce1b4239672975464c116bacbc4dd72a98

See more details on using hashes here.

File details

Details for the file petbox_dca-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: petbox_dca-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.13

File hashes

Hashes for petbox_dca-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4f3fedaf5ff89f810bab5672e3ecd07b591bf8d4c205df29379e4fa8591aeea0
MD5 ec46ecc5b10ec2e56863233b6a7eede3
BLAKE2b-256 19967c2ed405e902bf8e3991e2c6b3faebf3ef412435a0361fa2a1f55ac77b80

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page