Interpolation and Integration Functions
Overview
Petroleum engineering frequently requires working with tabular data that must be interpolated, differentiated, or integrated:
- PVT tables ā fluid properties vs. pressure at discrete points
- Relative permeability curves ā vs. saturation from laboratory measurements
- Production history ā rate and cumulative data at irregular time intervals
- Decline analysis ā integrating rate profiles for EUR calculations
- IPR curves ā finding intersection of inflow and outflow performance
Petroleum Office provides a comprehensive set of spline-based numerical functions powered by the MathNet.Numerics library.
Interpolation Methods
Four interpolation approaches are available, each suited to different data characteristics:
Data Points Interpolation Behavior
Linear: ā¢āāāāāāāā¢āāāāāāā⢠Piecewise straight lines
(preserves monotonicity)
Cubic: ā¢ā® āā¢ā® ā⢠Smooth curves through points
ā°āāāāā⯠ā°āāāāā⯠(natural spline, C² continuous)
Step: ā¢āāāāāāāā Constant until next point
āāāāāāāā⢠(piecewise constant)
Proximal: Returns value of Nearest-neighbor lookup
closest data point (no interpolation)
Method Selection Guide
| Data Type | Recommended Method | Reason |
|---|---|---|
| PVT properties (smooth) | Cubic spline | Smooth physical behavior |
| Relative permeability | Linear spline | Preserves monotonicity |
| Production rates | Step interpolation | Constant between measurements |
| Rock type classification | Proximal | Categorical data |
| General tables | Linear spline | Conservative, stable |
Linear Spline Functions
Linear splines connect data points with straight line segments. This method is first-order continuous (Cā°) ā continuous function, but with slope discontinuities at data points.
Mathematical Formulation
For a data point interval :
The derivative (slope) is constant within each interval:
The integral uses the trapezoidal rule:
Functions
| Function | Description |
|---|---|
| LinearSplineInterpolate | Interpolate at point |
| LinearSplineDifferentiate | First derivative at point |
| LinearSplineIntegrate | Definite integral from first to |
| LinearSplineIntegrateT1T2 | Definite integral from to |
| LinearSplinesIntersection | Find where two splines intersect |
Advantages
- Monotonicity preservation ā no oscillation between data points
- Bounded ā interpolated values stay within range of adjacent points
- Robust ā stable with irregular data spacing
Limitations
- Discontinuous derivatives at knots
- Less accurate for smooth physical phenomena
Cubic Spline Functions
Cubic splines fit a third-degree polynomial between each pair of data points, with smoothness constraints at the connections (knots).
Mathematical Formulation
For each interval , a cubic polynomial:
Natural spline boundary conditions:
This gives C² continuity ā continuous function, first derivative, and second derivative.
Functions
| Function | Description |
|---|---|
| CubicSplineInterpolate | Interpolate at point |
| CubicSplineDifferentiate | First derivative at point |
| CubicSplineIntegrate | Definite integral from first to |
| CubicSplineIntegrateT1T2 | Definite integral from to |
| CubicSplinesIntersection | Find where two splines intersect |
Advantages
- Smooth interpolation ā no kinks at data points
- Accurate derivatives ā smooth for rate calculations
- Natural for physical data ā most reservoir properties are smooth
Limitations
- Can oscillate (overshoot/undershoot) between widely-spaced points
- Not monotonicity-preserving
- Requires at least 3 data points
Step Interpolation
Step interpolation returns the previous data value until a new data point is reached. This is piecewise constant interpolation.
Mathematical Formulation
For :
Function
| Function | Description |
|---|---|
| StepInterpolate | Return value of preceding data point |
Use Cases
- Production rates ā assumed constant between measurements
- Well status ā on/off, flowing/shut-in
- Rock type ā categorical property
- Economic parameters ā prices held constant until updated
Proximal (Nearest-Neighbor) Interpolation
Proximal interpolation returns the value of the closest data point to the query point, regardless of direction.
Mathematical Formulation
Function
| Function | Description |
|---|---|
| ProximalInterpolate | Return value of nearest data point |
Use Cases
- Classification lookups ā map to closest defined category
- Sparse data ā when intermediate interpolation isn't meaningful
- Quality control ā identify closest measured value
Spline Intersection
Finding where two curves intersect is essential for:
- Nodal analysis ā IPR vs. VLP (Inflow vs. Outflow performance)
- Economic crossovers ā cost vs. revenue curves
- Saturation equilibria ā phase behavior intersections
Mathematical Approach
For two splines and , find such that:
The intersection functions use Brent's root-finding method within the overlapping -range of both datasets.
Functions
| Function | Description |
|---|---|
| LinearSplinesIntersection | Intersection of two linear splines |
| CubicSplinesIntersection | Intersection of two cubic splines |
Note: Returns the first intersection found within the common -domain. If curves intersect multiple times, only one solution is returned.
Functions Covered
See each function page for detailed parameter definitions, Excel syntax, and usage examples.
Linear Spline Family
| Function | Operation | Output |
|---|---|---|
| LinearSplineInterpolate | Interpolation | |
| LinearSplineDifferentiate | Differentiation | at |
| LinearSplineIntegrate | Integration | |
| LinearSplineIntegrateT1T2 | Integration | |
| LinearSplinesIntersection | Intersection | where |
Cubic Spline Family
| Function | Operation | Output |
|---|---|---|
| CubicSplineInterpolate | Interpolation | |
| CubicSplineDifferentiate | Differentiation | at |
| CubicSplineIntegrate | Integration | |
| CubicSplineIntegrateT1T2 | Integration | |
| CubicSplinesIntersection | Intersection | where |
Other Methods
| Function | Method | Output |
|---|---|---|
| StepInterpolate | Step (piecewise constant) | |
| ProximalInterpolate | Nearest neighbor |
Petroleum Engineering Applications
Cumulative Production from Rate Data
Using integration to calculate cumulative oil production :
Use LinearSplineIntegrate or CubicSplineIntegrate on data.
Rate from Cumulative Data
Using differentiation to calculate instantaneous rate:
Use LinearSplineDifferentiate or CubicSplineDifferentiate on data.
PVT Property Lookup
Interpolate formation volume factor at an arbitrary pressure:
Nodal Analysis Operating Point
Find the flowing bottomhole pressure where IPR and VLP curves intersect:
Related Documentation
- Exponential Integral (Ei) ā Special function for PTA
- Decline Curve Models ā Rate-time analysis using these integration tools
- PVT Properties Overview ā Interpolating fluid property tables
References
-
MathNet.Numerics Documentation. "Interpolation." https://numerics.mathdotnet.com/Interpolation
-
Press, W.H., Teukolsky, S.A., Vetterling, W.T., and Flannery, B.P. (2007). Numerical Recipes: The Art of Scientific Computing, 3rd Edition. Cambridge University Press. Chapter 3: Interpolation and Extrapolation.
-
de Boor, C. (1978). A Practical Guide to Splines. Springer-Verlag.