Reconcile the decline EUR with the material balance

A multi-module reserves study of a gas field after four years: the EUR from a decline fit to its rates, the gas in place from its p/z surveys, the recovery factor one implies of the other, the reservoir pressure the decline would leave, and what compression would add.

Open in the workbench

Engineering use case UC-MULTI-002 (Integrated Reserves Study), DCA + MBE, built on UC-DCA-001 and UC-MBE-001.

Decline analysis and material balance answer different questions from different data. The decline gives the EUR from the rates alone, and says nothing about the gas in place. The p/z line gives the gas in place from the pressures, and says nothing about how fast the wells will deliver it. Each checks the other: EUR / OGIP is a recovery factor, and the p/z line turns that recovery into the reservoir pressure the field would be left at, p/z = pi/zi (1 − RF). If that pressure is impossible (below what the wells can flow against, or above what a depleted field would plausibly be abandoned at), one of the two answers is wrong.

What an engineer learns from it: the hyperbolic fit (b = 0.51) runs to the 0.5 MMscf/d limit after 31 years with an EUR of 35.4 Bscf; 17.2 Bscf has been produced, so 18.2 Bscf remains. The p/z line gives 50.0 ± 0.03 Bscf (R² = 1.0000). The implied recovery is 70.7 %, which the p/z line says leaves the reservoir at 1,033 psia: a credible abandonment pressure for wells producing into a gathering system without compression. The same line says compression to 500 psia reservoir pressure would reach 86.3 %, 7.8 Bscf more. That is the reserves case for a compressor, and it comes from neither method alone.

Rates in MMscf/d against years, so the cumulative of the decline is MMscf/d × years, × 365 for MMscf. z at each survey and at the abandonment pressure comes from GasFluid (Dranchuk–Abou-Kassem, gravity 0.65, 200 °F). A p/z line that bends upwards means an aquifer, and the reconciliation then needs the aquifer in the material balance (mbe-fetkovich-aquifer).

Source

using System;
using System.Linq;
using Team76.Engineering.DCA.DeclineModels;
using Team76.Engineering.DCA.Fitting.Fitters;
using Team76.Engineering.MBE.GasMBE;
using Team76.Engineering.PVT.Facades;

public class S : ICalcScript
{
    public ScriptResult Run(ICalcContext ctx)
    {
        // A dry gas field (gravity 0.65, 200 °F) after four years. Monthly field rates in MMscf/d against years, with a
        // few per cent of scatter on the decline the field actually followed.
        var t = Enumerable.Range(1, 48).Select(m => m / 12.0).ToArray();
        var history = new ArpsHyperbolicDecline(Qi: 20, Di: 0.35, b: 0.5);
        var q = t.Select((x, i) => history.Rate(x) * (1 + 0.03 * Math.Sin(3 * i))).ToArray();

        // Discovery and four yearly pressure surveys: pressure (psia), z from the PVT, cumulative gas (scf).
        double[] p = [3500, 3009, 2672, 2424, 2232];
        double[] z = [0.922, 0.905, 0.898, 0.896, 0.895];
        double[] gp = [0, 6.213e9, 10.815e9, 14.361e9, 17.176e9];
        var gas = new GasFluid(gasGravity: 0.65, temperature: 200);
        const double limit = 0.5;   // MMscf/d, the rate at which the field no longer pays

        // DCA: fit the rate history and run it to the economic limit. Rate per day against years, so × 365 for a volume.
        var decline = ArpsHyperbolicFitter.Fit(t, q);
        var eur = decline.UltimateByRateLimit(limit) * 365e6;   // scf

        // MBE: the gas in place from the p/z line, with its standard error.
        var fit = GasMaterialBalance.EstimateOGIPRegressionWithDiagnostics(p, z, gp);
        var ogip = fit.FittedValue;

        // Reconcile: the recovery factor the decline implies, and the reservoir pressure the p/z line says it leaves.
        var rf = eur / ogip;
        var pzLeft = p[0] / z[0] * (1 - rf);
        var pAbandon = Bisect(pr => pr / gas.ZFactor(pr).Dmnl - pzLeft, 50, p[0]);

        // What compression to 500 psia reservoir pressure would add, by the p/z line.
        var rfCompressed = GasMaterialBalance.UltimateRecoveryFactor(p[0], z[0], 500, gas.ZFactor(500).Dmnl);

        var years = Enumerable.Range(0, 41).Select(i => i * 0.5).ToArray();
        var chart = new ScriptChart(
            [
                new ScriptSeries("History", t, q),
                new ScriptSeries("Decline fit", years, years.Select(decline.Rate).ToArray()),
            ],
            title: "Field rate and the decline it is booked on", xLabel: "Years", yLabel: "Rate (MMscf/d)");

        return ctx.Result()
            .Set("Decline", chart)
            .Set("Fitted b", Math.Round(decline.B, 2))
            .Set("EUR, DCA (Bscf)", Math.Round(eur / 1e9, 1))
            .Set("Produced to date (Bscf)", Math.Round(gp[^1] / 1e9, 1))
            .Set("Remaining, DCA (Bscf)", Math.Round((eur - gp[^1]) / 1e9, 1))
            .Set("OGIP, p/z (Bscf)", Math.Round(ogip / 1e9, 1))
            .Set("OGIP standard error (Bscf)", Math.Round(fit.FittedValueStandardError / 1e9, 2))
            .Set("p/z R²", Math.Round(fit.RSquared, 5))
            .Set("Recovery factor, DCA over MBE (%)", Math.Round(100 * rf, 1))
            .Set("Reservoir pressure at the limit (psia)", Math.Round(pAbandon))
            .Set("Recovery factor to 500 psia (%)", Math.Round(100 * rfCompressed, 1))
            .Set("Added by compression (Bscf)", Math.Round((rfCompressed - rf) * ogip / 1e9, 1));
    }

    // The root of f between lo and hi, where f rises with its argument.
    private static double Bisect(Func<double, double> f, double lo, double hi)
    {
        for (var i = 0; i < 60; i++)
        {
            var mid = (lo + hi) / 2;
            if (f(mid) > 0) hi = mid; else lo = mid;
        }

        return (lo + hi) / 2;
    }
}