Pick the decline model, then book the EUR

Fit five models to the same history, let AIC choose, and run the winner to the economic limit.

Open in the workbench

Engineering use cases UC-DCA-003 (Fit Model to Production History), UC-DCA-004 (Compare Decline Models), UC-DCA-005 (Analyze Unconventional Well: Duong and stretched exponential) and UC-DCA-002 (Estimate EUR for Reserves Booking: the modified hyperbolic is one of the candidates).

Every fitter takes the same time and rate arrays. Time and rate must share a time base: years against rates per day gives a decline per year, but the cumulative then comes out in bbl/d × years, out by 365 from barrels. Convert one or the other before booking a volume, as the result here does. Look at the plot before trusting the pick: a model that AIC prefers can still miss the shape of the history.

AIC penalises each extra parameter, so a four-parameter model has to fit clearly better than an exponential to be chosen. On a short or noisy history the simple model often wins, which is the point.

UltimateByRateLimit runs the model to the economic-limit rate, in the rate's own unit. A hyperbolic with b ≥ 1 never reaches a finite cumulative on its own; the modified hyperbolic switches to exponential at a terminal decline for that reason.

Source

using System;
using System.Linq;
using Team76.Engineering.DCA.DeclineModels;
using Team76.Engineering.DCA.Fitting.Fitters;
using Team76.Engineering.DCA.Fitting.ModelSelection;

public class S : ICalcScript
{
    public ScriptResult Run(ICalcContext ctx)
    {
        // Three years of monthly rates, bbl/d, from a hyperbolic decline with some scatter.
        var t = Enumerable.Range(0, 36).Select(i => i / 12.0).ToArray();
        var q = t.Select((x, i) => 1000 / Math.Pow(1 + 0.8 * 0.9 * x, 1 / 0.8) * (1 + 0.03 * Math.Sin(i))).ToArray();

        // Fit five decline models to the same history, each with the name it is reported under.
        string[] names = ["Exponential", "Hyperbolic", "Modified hyperbolic", "Duong", "Stretched exponential"];
        DeclineModelBase[] candidates =
        [
            ArpsHyperbolicFitter.FitExponential(t, q),
            ArpsHyperbolicFitter.Fit(t, q),
            ModifiedHyperbolicFitter.Fit(t, q),
            DuongFitter.Fit(t, q),
            StretchedExponentialFitter.Fit(t, q),
        ];

        // Let AIC pick, so extra parameters have to earn their place.
        var best = AicSelector.Instance.SelectBest(candidates, t, q);
        var eur = best.Model.UltimateByRateLimit(5);   // to 5 bbl/d
        var picked = names[Array.IndexOf(candidates, best.Model)];

        var plot = new ScriptChart(
            [new ScriptSeries("History", t, q), new ScriptSeries(picked, t, t.Select(best.Model.Rate).ToArray())],
            title: "The model AIC picked, against the history", xLabel: "Years", yLabel: "Rate (bbl/d)");

        return ctx.Result()
            .Set("Fit", plot)
            .Set("Model", picked)
            .Set("EUR to 5 bbl/d (Mbbl)", Math.Round(eur * 365 / 1000, 1));
    }
}