Unit Conversions and Special Functions
Overview
Petroleum engineering calculations frequently require:
- Unit conversions — between field units (psi, bbl, ft) and SI units (Pa, m³, m)
- Gravity transformations — between API gravity and specific gravity
- Special mathematical functions — particularly the exponential integral for pressure transient analysis
These utility functions provide the foundation for accurate engineering calculations.
Unit Conversion System
The UnitConverter function provides general-purpose conversion between compatible units.
Supported Unit Categories
| Category | Example Units |
|---|---|
| Pressure | psi, psia, psig, bar, kPa, MPa, atm |
| Length | ft, m, in, cm, mm |
| Volume | bbl, stb, scf, m³, L, gal |
| Flow Rate | stb/d, bbl/d, m³/d, scf/d, Mscf/d |
| Temperature | degF, degC, degR, K |
| Viscosity | cP, mPa·s, Pa·s |
| Permeability | md, D, m² |
| Compressibility | 1/psi, 1/bar, 1/kPa |
Usage Pattern
The function takes a value in the source unit and converts to the target unit:
Result = UnitConverter(Value, "SourceUnit", "TargetUnit")
Example: Convert 2,500 psi to bar:
UnitConverter(2500, "psi", "bar") → 172.4 bar
Function
| Function | Description |
|---|---|
| UnitConverter | Convert value between any compatible units |
Gravity Transformations
Crude oil density is commonly expressed as either:
- Specific Gravity (SG) — density relative to water at 60°F
- API Gravity — American Petroleum Institute scale, inversely related to density
Relationship Between API and Specific Gravity
The API gravity scale was designed so that:
- Water has API gravity of 10°
- Lighter oils have higher API values
- Heavier oils have lower API values
Where:
- = API gravity, °API
- = oil specific gravity (water = 1.0)
Classification by API Gravity
| Classification | API Gravity | Specific Gravity |
|---|---|---|
| Light crude | > 31.1° | < 0.87 |
| Medium crude | 22.3° – 31.1° | 0.87 – 0.92 |
| Heavy crude | 10° – 22.3° | 0.92 – 1.00 |
| Extra-heavy | < 10° | > 1.00 |
Functions
| Function | Conversion | Formula |
|---|---|---|
| SG2API | SG → API | |
| API2SG | API → SG |
Examples
| Input | Function | Output |
|---|---|---|
| SG2API | 34.97° API | |
| API2SG | 0.850 | |
| (water) | SG2API | 10° API |
| API2SG | 1.00 |
Exponential Integral Function
The exponential integral is a fundamental special function in pressure transient analysis.
Definition
For practical computation with negative arguments (as used in well testing):
Role in Well Testing
The line source solution for pressure drawdown in an infinite-acting reservoir is:
At the wellbore ():
Logarithmic Approximation
For small arguments (large , i.e., late-time behavior):
Where is the Euler-Mascheroni constant.
This gives the familiar semi-log approximation:
Function
| Function | Description |
|---|---|
| ExpIntegralEi | Evaluate for any real |
Numerical Implementation
The function uses different algorithms depending on the argument magnitude:
| Argument Range | Method |
|---|---|
| Taylor series expansion | |
| Chebyshev approximation | |
| Asymptotic expansion |
Related Documentation
- Dimensionless Variables — pD, tD definitions using Ei
- Infinite Reservoir Solution — Line source with Ei function
- PVT Overview — Gravity used in correlations
- Interpolation Functions — Companion utility functions
References
American Petroleum Institute. "API Gravity." API Manual of Petroleum Measurement Standards, Chapter 11.1.
Abramowitz, M. and Stegun, I.A. (1964). Handbook of Mathematical Functions. National Bureau of Standards. Chapter 5: Exponential Integral and Related Functions.
Cody, W.J. and Thacher, H.C. (1968). "Rational Chebyshev Approximations for the Exponential Integral E₁(x)." Mathematics of Computation, 22(103), pp. 641-649.
Lee, J., Rollins, J.B., and Spivey, J.P. (2003). Pressure Transient Testing. SPE Textbook Series Vol. 9. Chapter 2.
Related Blueprints
ESP Gas Handling Analysis
Analyze gas handling requirements for ESP systems. Calculate void fraction and evaluate need for gas separators.
CO2 Corrosion Analysis
CO2 corrosion analysis using the de Waard-Milliams correlation. Calculates corrosion rate, severity classification, inhibited rate, and required corrosion allowance for carbon steel pipelines.
Unit Conversion Examples
Demonstrate unit conversion for common petroleum engineering quantities. Includes pressure, temperature, volume, and flow rate conversions.