Read the gas in place off a p/z plot

Five pressure surveys of a volumetric gas reservoir against its cumulative production: the p/z line by least squares, the OGIP where it reaches zero with its standard error, and the recovery the line leaves at an abandonment pressure.

Open in the workbench

Engineering use cases UC-MBE-001 (Estimate OGIP from p/z Plot), UC-MBE-002 (Predict Gas Reservoir Performance) and UC-MBE-011 (Judge the Quality of a Material-Balance Fit).

A volumetric gas reservoir has nothing but gas expansion to drive it, so p/z falls on a straight line with the cumulative production: p/z = pi/zi (1 − Gp/G). Where the line reaches p/z = 0 is the gas in place. EstimateOGIPRegressionWithDiagnostics fits the line by least squares and returns the same OGIP as the plain regression, with the R², the line's slope and intercept and their standard errors.

What an engineer learns from it: the data is Ahmed (2010) Example 13-2. The fit gives 13.96 ± 0.20 MMMscf with R² = 0.9992, so the surveys sit on the line and the OGIP is known to about 1.4 %. The book reads 14.2 MMMscf off its plot, a graphical reading of the same five points. The well has produced 28.1 % so far; at a 500 psia abandonment (z = 0.95) the line leaves 10.41 MMMscf, 74.6 % recovery, which is 1 − (500/0.95)/(1798/0.869).

A p/z line that bends upwards is not a bigger reservoir: it is water influx, or a geopressured reservoir whose rock is giving up energy (see mbe-geopressured-gas). Pressures in psia, gas in scf. The z at each survey comes from the PVT of the gas, so the line is only as good as that.

Source

using System;
using System.Linq;
using Team76.Engineering.MBE.GasMBE;

public class S : ICalcScript
{
    public ScriptResult Run(ICalcContext ctx)
    {
        // Ahmed (2010), Example 13-2: five surveys of a volumetric gas reservoir. Pressure (psia), z, and the cumulative
        // gas produced (scf).
        double[] p = [1798, 1680, 1540, 1428, 1335];
        double[] z = [0.869, 0.870, 0.880, 0.890, 0.900];
        double[] gp = [0, 0.96e9, 2.12e9, 3.21e9, 3.92e9];

        // The p/z line by least squares, with how well the surveys sit on it and how well it pins the OGIP.
        var fit = GasMaterialBalance.EstimateOGIPRegressionWithDiagnostics(p, z, gp);
        var ogip = fit.FittedValue;

        // Produced so far, and what the line leaves at a 500 psia abandonment (z = 0.95 there).
        var recovered = GasMaterialBalance.RecoveryFactor(G: ogip, Gp: gp[^1]);
        var gpAbandon = GasMaterialBalance.PredictProduction(G: ogip, p: 500, z: 0.95, pi: p[0], zi: z[0]);

        // The p/z the line reads at each cumulative, from the discovery point to zero.
        var pz = p.Zip(z, GasMaterialBalance.PoverZ).ToArray();
        double[] lineGp = [0, ogip];
        double[] linePz = [fit.Intercept ?? pz[0], 0];

        var plot = new ScriptChart(
            [new ScriptSeries("Surveys", gp.Select(g => g / 1e9).ToArray(), pz), new ScriptSeries("Fitted line", lineGp.Select(g => g / 1e9).ToArray(), linePz)],
            title: "p/z against cumulative gas", xLabel: "Gp (MMMscf)", yLabel: "p/z (psia)");

        return ctx.Result()
            .Set("p/z plot", plot)
            .Set("OGIP (MMMscf)", Math.Round(ogip / 1e9, 2))
            .Set("Standard error (MMMscf)", Math.Round(fit.FittedValueStandardError / 1e9, 2))
            .Set("R²", Math.Round(fit.RSquared, 4))
            .Set("p/z intercept (psia)", Math.Round(fit.Intercept ?? double.NaN, 1))
            .Set("Recovered so far (%)", Math.Round(100 * recovered, 1))
            .Set("Gp at 500 psia (MMMscf)", Math.Round(gpAbandon / 1e9, 2))
            .Set("Recovery at 500 psia (%)", Math.Round(100 * gpAbandon / ogip, 1));
    }
}