API 14B Gas Leak Rate Calculator
Overview
This program is based on the equations provided in the American Petroleum Institute's Recommended Practice 14B, Design, Installation, Repair and Operation of Subsurface Safety Valve Systems, section E.1.7, 5th edition, October 2005, consistent with Errata 1. The gas leakage rate is given by
Model Specifications
where:
- : gas leakage rate, SI units , USC units .
- : constant that incorporates the universal gas constant and standard reference conditions, either 2840 (SI) or 35.37 (USC), dimensionless.
- : final pressure, SI units , USC units .
- : initial pressure, SI units , USC units .
- : gas deviation (compressibility) function, evaluated at the final and initial timepoints as and , dimensionless.
- , where are the gas-phase mole fractions of the constituent species. is computed internally according to Numerical Methods.
- : build-up time, SI units .
- : gas-space volume, SI units , USC units .
- : gas temperature (converted to absolute in the calculation), units .
API RP 14B (5th ed.) Errata 1 flags an SI conversion-factor issue, and this implementation uses the corrected SI coefficient (2840). Practical limitations noted include potential surface-valve leakage, cooling effects during shut-in and across the SSSV (Joule-Thomson), wet-gas behavior, phase separation in the production stream, and continued pressure build below the SSSV during the test. Additional considerations include pressure constraints (final pressure should be greater than or equal to initial pressure), typical pressure range guidance, and that is evaluated at both the final and initial timepoints using gas-composition inputs within valid composition bounds.
Derivation
Start with the real-gas equation of state , so . Assuming constant gas-space volume, uniform cavity temperature over the test interval, and constant gas composition, , the moles as a function of time are
Now, we differentiate with respect to time. Because is assumed constant (along with and ), varies only through and is evaluated at the final and initial timepoints as and , so a total time derivative is appropriate:
Integrate both sides over :
Therefore,
Convert mole accumulation to standard volumetric leak rate using . Substituting gives:
Numerical Methods
The compressibility factor is computed internally using a correlation-based pseudo-critical formulation together with the Dranchuk–Abou–Kassem (DAK) equation of state. For a gas of specific gravity (relative to air), pseudo-critical temperature and pressure are first estimated using the Sutton correlation,
where and denote the standard Sutton empirical relations. If nonzero mole fractions of and/or are provided, the Wichert--Aziz sour-gas correction is applied to adjust the pseudo-critical temperature and pressure according to
where is the temperature correction function of the acid-gas mole fractions. All pressures and temperatures are converted to absolute units prior to reduction. Reduced pressure and temperature are then computed as
The compressibility factor is obtained by solving the implicit Dranchuk–Abou–Kassem equation for reduced density ,
where is the nonlinear reduced-density form of the Dranchuk–Abou–Kassem correlation containing empirical coefficients and polynomial density terms through fourth order. The nonlinear equation is solved numerically using Newton iteration with analytic derivative , subject to bracketing of physically admissible . The solver is initialized using a physically admissible reduced-density estimate derived from the ideal-gas approximation. If Newton iteration fails to converge, a bisection fallback is employed to ensure robustness. Convergence is enforced on both residual and update magnitude,
The compressibility factor is evaluated independently at the initial and final pressures,
and the leakage-rate computation uses the exact endpoint difference
The implemented correlation is valid within standard petroleum engineering ranges of reduced pressure and temperature; inputs outside validated bounds may reduce accuracy.