Fit Vogel and Fetkovich inflow curves to measured rates

From a four-rate flow-after-flow test on a saturated oil reservoir: Vogel fitted to one test point, and Fetkovich's back-pressure curve fitted to all four by least squares, each with its absolute open flow, the test plotted over both.

Open in the workbench

Engineering use case UC-IPR-002 (Generate Oil Well IPR Curve), worked from measured rates rather than from a known J.

Vogel takes one stabilised rate and one flowing pressure. The generalized Vogel rate is proportional to J, so the rate at J = 1 scales it: J = q_test / q(J = 1). Fetkovich's q = C (Pr² − Pwf²)^n needs two points at least, and is a straight line on log-log axes, so n is the slope of log q against log (Pr² − Pwf²) and C its intercept. An n of 1 is Darcy flow; below it, turbulence near the wellbore or the free gas is costing rate; between 0.5 and 1 is the range the method allows.

What an engineer learns: the two fits agree inside the tested range and part company outside it. Here n comes out near 0.8, and Fetkovich's AOF is about a fifth below Vogel's, which assumes a curvature it never measured. An AOF from a single point is an extrapolation of a shape; one from a multi-rate test is an extrapolation of the well's own trend. Plan an artificial-lift design on the lower number until a deeper drawdown is tested.

Units are field: psia and STB/d; C in STB/d per psi^2n. The bubble point is set equal to the reservoir pressure, so the reservoir is saturated and the curve has no straight segment.

Source

using System;
using System.Linq;
using Team76.Engineering.IPR;

public class S : ICalcScript
{
    public ScriptResult Run(ICalcContext ctx)
    {
        // A saturated oil reservoir at its bubble point, 2,800 psia, and a four-rate flow-after-flow test.
        double pr = 2800;
        double[] pwf = [2400, 2000, 1600, 1200];
        double[] q = [260, 430, 540, 645];

        // Vogel from one test point: the generalized Vogel rate is proportional to J, so the rate at J = 1 scales it.
        // With the bubble point at the reservoir pressure the curve is Vogel's from the start.
        var j = q[1] / InflowPerformance.RateByGeneralizedVogel(J: 1, iPressure: pr, Pwf: pwf[1], Pb: pr);
        double Vogel(double p) => InflowPerformance.RateByGeneralizedVogel(J: j, iPressure: pr, Pwf: p, Pb: pr);

        // Fetkovich from all four: q = C (Pr² - Pwf²)^n is a straight line on log-log axes, slope n, so a least-squares
        // line through log q against log (Pr² - Pwf²) gives n and C.
        var x = pwf.Select(p => Math.Log(pr * pr - p * p)).ToArray();
        var y = q.Select(v => Math.Log(v)).ToArray();
        var (xm, ym) = (x.Average(), y.Average());
        var n = x.Zip(y, (a, b) => (a - xm) * (b - ym)).Sum() / x.Sum(a => (a - xm) * (a - xm));
        var c = Math.Exp(ym - n * xm);
        double Fetkovich(double p) => InflowPerformance.RateByFetkovich(C: c, n: n, Pr: pr, Pwf: p);

        var pressures = Enumerable.Range(0, 29).Select(i => pr * (28 - i) / 28.0).ToArray();
        var rows = pwf.Select((p, i) => new object[]
        {
            p, q[i], Math.Round(Vogel(p)), Math.Round(Fetkovich(p)),
        }).ToList();

        return ctx.Result()
            .Set("Vogel J from the 2,000 psia point (STB/d/psi)", Math.Round(j, 3))
            .Set("Vogel AOF (STB/d)", Math.Round(Vogel(0)))
            .Set("Fetkovich n", Math.Round(n, 3))
            .Set("Fetkovich C (STB/d/psi^2n)", c)
            .Set("Fetkovich AOF (STB/d)", Math.Round(InflowPerformance.MaxRateByFetkovich(C: c, n: n, Pr: pr)))
            .Set("Test", new ScriptTable(["Pwf (psia)", "Measured (STB/d)", "Vogel (STB/d)", "Fetkovich (STB/d)"], rows,
                title: "The test points against both fits"))
            .Set("IPR", new ScriptChart(
                [new ScriptSeries("Vogel, one point", [.. pressures.Select(Vogel)], pressures),
                 new ScriptSeries("Fetkovich, four points", [.. pressures.Select(Fetkovich)], pressures),
                 new ScriptSeries("Test", q, pwf)],
                title: "Two IPRs from one test", xLabel: "Oil rate (STB/d)", yLabel: "Flowing bottom-hole pressure (psia)"));
    }
}