GithubHelp home page GithubHelp logo

derrickturk / arpsdca Goto Github PK

View Code? Open in Web Editor NEW
35.0 11.0 19.0 78 KB

R package for Arps decline curve analysis.

License: GNU Lesser General Public License v2.1

R 99.68% Makefile 0.32%
petroleum petroleum-engineering decline-curve-analysis

arpsdca's Introduction

aRpsDCA

an R package for Arps decline-curve analysis

aRpsDCA provides R implementations of functions for carrying out Arps decline-curve analysis on oil and gas production data.

aRpsDCA currently implements the following decline-curve types:

  • Exponential
  • Hyperbolic (and harmonic)
  • Hyperbolic with terminal exponential (aka "modified hyperbolic", "hyperbolic-to-exponential")
  • Any of the above with initial rate curtailment
  • Any of the above with initial linear buildup periods

aRpsDCA provides functions for

  • computing rate, cumulative production, and instantaneous decline over time
  • computing EUR and time to economic limit
  • performing best fits of various decline curve types to actual production data
  • rate, decline, and time unit conversions

aRpsDCA is released under the LGPL v2.1 and is free for commercial and non-commercial use.

The current "released" version of aRpsDCA is 1.1.1 and is available from CRAN.

The current pre-release version of aRpsDCA can also be installed from github using the devtools library:

install.packages('devtools')
devtools::install_github('derrickturk/aRpsDCA')

Release notes:
v1.0.0 (2014-04-03): initial release
v1.0.1 (2015-06-21): S3 methods for formatting now correctly print curve family; handling of Np for D = 0 is corrected
v1.0.2 (2016-01-06): evaluation of hyperbolic-to-exponential declines with Di = Df now handled correctly
v1.1.0 (2016-04-04): Arps declines with linear initial buildup periods, and fitting to interval-volume data; additional bug fixes for daily data and better initial guesses for decline parameters
v1.1.1 (2017-07-23): EUR for declines with buildup now handled correctly; zero results from arps.q and arps.Np when decline with buildup was passed with only post-buildup time values are now corrected

(c) 2017 dwt | terminus data science, LLC

arpsdca's People

Contributors

derrickturk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arpsdca's Issues

best.fit function and number of equation parameters

Hello,

As far as I know, when you fit model to data, the model with more variables tend to have better SSE regardless of it's actual viability. In the best fit function, you compare SSE of exponentia model with 2 parameters(D and qi), hyperbolic model(Di, qi, b) and hyp2exp model(Di, qi, b and Df). Doesn't that skew the function towards fitting of the hyp2exp model, especially at the cost of the exponential model? Shouldn't other criterion, such as Akaike information criterion or adjuster R^2, be better for choosing which model to return as "best"?

Thanks,
Brzegorz

best.hyperbolic

When fitting type curves with the best.hyperbolic function 30% of the time the results are clearly not the correct fit. When this happens the b value is always only 2 significant digits. If the upper and lower constraints are changed it will eventually return the correct fit. Any idea why the model is doing this and also why when it doesn't find a solution it acts as if it has.

Thanks,
Mike

Getting error with best.fit()

below is the message after running the best.fit() function on my data:

Error in if (Di < EXPONENTIAL_EPS || Df < EXPONENTIAL_EPS || b < HARMONIC_EPS) Inf else if (abs(Df - :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In nlminb(c(q[1], -((q[2] - q[1])/q[1])/(t[2] - t[1])), function(guess) sse(q, :
NA/NaN function evaluation
2: In nlminb(c(q[1], -((q[2] - q[1])/q[1])/(t[2] - t[1])), function(guess) sse(q, :
NA/NaN function evaluation
3: In nlminb(c(q[1], -((q[2] - q[1])/q[1])/(t[2] - t[1])), function(guess) sse(q, :
NA/NaN function evaluation
4: In nlminb(c(q[1], -((q[2] - q[1])/q[1])/(t[2] - t[1]), 1.5), function(guess) sse(q, :
NA/NaN function evaluation
5: In nlminb(c(q[1], -((q[2] - q[1])/q[1])/(t[2] - t[1]), 1.5), function(guess) sse(q, :
NA/NaN function evaluation
6: In nlminb(c(q[1], -((q[2] - q[1])/q[1])/(t[2] - t[1]), 1.5), function(guess) sse(q, :
NA/NaN function evaluation

Hyperbolic to Exponential Model Doesn't Transition To Exponential When Using Days

This calculation works correctly

years <- hyp2exp.transition(as.nominal(0.85), 1.5, as.nominal(0.05))
years
[1] 12.64574
days <- years * 365
days
[1] 4615.695

However, when we switch units from years to days the calculation no longer works

days <- hyp2exp.transition(as.nominal(0.85, from.period = "year", to.period = "day"), 1.5, as.nominal(0.05, from.period = "year", to.period = "day"))
days
[1] Inf

arps.eur returns 0 for declines with buildup

arps.eur returns 0 for declines with buildup, due to the current definition of arps.t.el; more "correct" behavior would consider the economic limit rate only after the end of buildup.

arps.eur(arps.with.buildup(arps.decline(1000, 0.75), 250, 0.25), 1)
[1] 0

from.interval not working?

Hello,

I am trying to fit an exponential decline to only the last 3 years of production data (i.e. not from time zero) using the best.exponential.from.interval, and setting the argument t.begin = as.numeric(ymd("2014-12-31")), but it generates the following error:

Error in if (D == 0) qi * t else qi/D * (1 - exp(-D * t)): missing value where TRUE/FALSE needed
Traceback:

  1. best.exponential.from.interval(q, as.numeric(pad_prod$"Production Date"),
    . t.begin = as.numeric(ymd("2014-12-31")))
  2. nlminb(c(volume[1]/(t[1] - t.begin), -((volume[2] - volume[1])/volume[1])/(t[2] -
    . t[1])), function(guess) sse(volume, diff(exponential.Np(guess[1],
    . guess[2], c(t.begin, t)))), lower = lower, upper = upper)
  3. objective(.par, ...)
  4. sse(volume, diff(exponential.Np(guess[1], guess[2], c(t.begin,
    . t))))
  5. diff(exponential.Np(guess[1], guess[2], c(t.begin, t)))
  6. exponential.Np(guess[1], guess[2], c(t.begin, t))

The workaround for this is to create a normalized time column so my time for the fit always starts at 0, instead of as.numeric dates. Not sure if I am using the from.interval as intended? In my mind, the interval method should achieve the result without the normalized time workaround.

Significantly Different Results Based on R Version

First off I just want to say thank you for putting this out there, it's fantastic. Built a script to run in R 4.0.2 and it works great. I then put it into PowerBI and noticed that my answers were significantly different, like 30% lower and the matches weren't very accurate visually. I plopped it out of PowerBI and into R Studio and all of a sudden it was matching again without changing any code, which is when I realized PowerBI was using R 4.2.2 instead of 4.0.2. Now that I noticed this I can avoid issues going forward but do you have any idea why the version change would affect the output so significantly?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.