Design the line from wellhead to separator
2,500 bbl/d of liquid at a GLR of 2,000 scf/STB from a well at 1,100 psia, through a choke and 8,000 ft of flowline to a 150 psia separator: for each line from 3 to 6 inches, the pressure the line needs at its inlet, whether the choke still runs critical against it, and the erosion ratio at the separator end; then the choke bean and the line that does both.
- UC-SF-008
Engineering use case UC-SF-008 (Design Flowline from Wellhead to Separator).
The line is worked back from the separator: Dukler's gradient (Economides et al. 1994), marched in sixteen increments at each one's mean pressure, gives the pressure the line needs at its inlet, which is the pressure downstream of the choke. The choke runs critical, so Gilbert sizes it from the wellhead pressure alone, and the check is that the flowline inlet stays at or below 0.55 of the wellhead pressure. API RP 14E bounds the velocity, V_e = 100 / √ρ_m on the no-slip mixture, at the separator, where the vapour is least dense and the mixture fastest; a design takes V / V_e under 0.8 for margin.
What an engineer learns from it: the choke is 47/64, so a 48/64 bean passes 2,607 bbl/d. The 3-inch line needs 948 psia at its inlet, too close to the 1,100 psia wellhead for critical flow, and runs at 1.6 times the erosional velocity. The 4-inch needs 480 psia, critical, but runs at 0.92 of the limit. The 5-inch needs 294 psia and runs at 0.58: it is the line. The 6-inch buys another 78 psi of margin at more steel. The use case's own sample passes the flowline inlet pressure to Gilbert as if it were the wellhead pressure, which is why it finds every line "wide open"; Gilbert's pressure is the one upstream of the choke.
Units: bbl/d, MMscf/d, scf/STB, psia, ft, in, °F, lb/ft³, cP. Fluid properties are held at one temperature and Z along the line; Dukler is horizontal, with no acceleration term.
Source
using System;
using System.Linq;
using Team76.Engineering.FA;
using Team76.Engineering.SF.Choke;
using Team76.Engineering.SF.Choke.MultiPhase;
using Team76.Engineering.SF.Pipeline.SinglePhase;
using Team76.Engineering.SF.Pipeline.TwoPhase;
public class S : ICalcScript
{
// The design: 2,500 bbl/d of liquid and 5 MMscf/d of 0.7-gravity gas (GLR 2,000 scf/STB) from a well that holds
// 1,100 psia at the wellhead, through a choke and 8,000 ft of flowline to a separator at 150 psia. A 50 lb/ft3, 5 cP oil,
// 0.015 cP gas, 100 °F and Z = 0.93 along the line.
const double Wellhead = 1100, Separator = 150; // psia
const double LiquidRate = 2500, GasRate = 5.0, Gravity = 0.7; // bbl/d, MMscf/d
const double Length = 8000, Temperature = 100, Z = 0.93; // ft, °F
const double LiquidDensity = 50, LiquidViscosity = 5, GasViscosity = 0.015;
static double GasDensity(double p) => GasPipeline.GasDensity(p, Temperature, Gravity, Z);
static double Gradient(double p, double d) => DuklerCorrelation.PressureGradient(GasRate, Gravity, LiquidRate, d,
GasDensity(p), LiquidDensity, GasViscosity, LiquidViscosity);
// Back from the separator to the flowline inlet in 16 increments, each at the density of its mean pressure.
static double FlowlineInlet(double d)
{
double p = Separator, step = Length / 16;
for (int i = 0; i < 16; i++)
{
double guess = p + Gradient(p, d) * step;
p += Gradient((p + guess) / 2, d) * step;
}
return p;
}
// The API RP 14E check at a pressure: the no-slip mixture against Ve = 100 / sqrt(rho_m).
static double ErosionRatio(double p, double d)
{
double qg = GasRate * 1e6 * 0.0764 * Gravity / GasDensity(p) / 86400; // ft3/s in situ
double ql = LiquidRate * 5.615 / 86400; // ft3/s
double rhoM = Erosion.MixtureDensity(LiquidDensity, GasDensity(p), qg / (qg + ql));
return Erosion.ErosionRatio(Erosion.MixtureVelocity(qg, ql, d), Erosion.ErosionalVelocityApi14E(rhoM, 100));
}
public ScriptResult Run(ICalcContext ctx)
{
double glr = GasRate * 1e6 / LiquidRate;
int[] beans = [16, 20, 24, 28, 32, 36, 40, 48, 56, 64];
// The choke runs critical, so its size depends on the wellhead pressure alone; the flowline sets the pressure
// downstream of it, which must stay at or below 0.55 of the wellhead pressure.
int choke64 = GilbertChoke.SizeIn64ths(Wellhead, LiquidRate, glr);
(string Size, double Id)[] pipes = [("3\"", 3.068), ("4\"", 4.026), ("5\"", 5.047), ("6\"", 6.065)];
var designs = pipes.Select(p =>
{
double downstream = FlowlineInlet(p.Id); // psia, downstream of the choke
var regime = ChokeFlowRegimeHelper.Determine(Wellhead, downstream);
double erosion = ErosionRatio(Separator, p.Id); // the fastest end, at the separator
return (p.Size, p.Id, Downstream: downstream, Regime: regime, Erosion: erosion);
}).ToList();
var chosen = designs.First(d => d.Regime == ChokeFlowRegime.Critical && d.Erosion < 0.8); // 0.8: a margin under the limit
int bean = beans.First(b => b >= choke64);
var rows = designs.Select(d => new object[]
{
d.Size, d.Id, Math.Round(d.Downstream), Math.Round(d.Downstream - Separator), Math.Round(d.Downstream / Wellhead, 3),
d.Regime.ToString(), Math.Round(d.Erosion, 2), Erosion.RiskClassification(d.Erosion),
}).ToList();
return ctx.Result()
.Set("Line sizes", new ScriptTable(["Size", "ID (in)", "Flowline inlet (psia)", "Line drop (psi)", "p2 / Pwh", "Choke regime", "V / Ve at separator", "Erosion risk"], rows))
.Set("GLR (scf/STB)", glr)
.Set("Gilbert choke (64ths)", choke64)
.Set("Bean (64ths)", bean)
.Set("Rate on the bean (bbl/d)", Math.Round(GilbertChoke.Rate(Wellhead, bean / 64.0, glr)))
.Set("Highest flowline inlet for critical flow (psia)", Math.Round(Wellhead * ChokeFlowRegimeHelper.DefaultCriticalPressureRatio))
.Set("Chosen line", chosen.Size)
.Set("Chosen line inlet pressure (psia)", Math.Round(chosen.Downstream))
.Set("Chosen line V / Ve at the separator", Math.Round(chosen.Erosion, 2));
}
}