Theory

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 — krk_r 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 TypeRecommended MethodReason
PVT properties (smooth)Cubic splineSmooth physical behavior
Relative permeabilityLinear splinePreserves monotonicity
Production ratesStep interpolationConstant between measurements
Rock type classificationProximalCategorical data
General tablesLinear splineConservative, 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 [xi,xi+1][x_i, x_{i+1}]:

y(t)=yi+yi+1āˆ’yixi+1āˆ’xi(tāˆ’xi)y(t) = y_i + \frac{y_{i+1} - y_i}{x_{i+1} - x_i} (t - x_i)

The derivative (slope) is constant within each interval:

dydt=yi+1āˆ’yixi+1āˆ’xi\frac{dy}{dt} = \frac{y_{i+1} - y_i}{x_{i+1} - x_i}

The integral uses the trapezoidal rule:

∫aty dx=āˆ‘i=0nāˆ’1(yi+yi+1)2(xi+1āˆ’xi)+partial segment\int_a^t y \, dx = \sum_{i=0}^{n-1} \frac{(y_i + y_{i+1})}{2} (x_{i+1} - x_i) + \text{partial segment}

Functions

FunctionDescription
LinearSplineInterpolateInterpolate yy at point tt
LinearSplineDifferentiateFirst derivative dy/dxdy/dx at point tt
LinearSplineIntegrateDefinite integral from first xx to tt
LinearSplineIntegrateT1T2Definite integral from t1t_1 to t2t_2
LinearSplinesIntersectionFind xx 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 [xi,xi+1][x_i, x_{i+1}], a cubic polynomial:

Si(t)=ai+bi(tāˆ’xi)+ci(tāˆ’xi)2+di(tāˆ’xi)3S_i(t) = a_i + b_i(t - x_i) + c_i(t - x_i)^2 + d_i(t - x_i)^3

Natural spline boundary conditions:

S′′(x0)=0,S′′(xn)=0S''(x_0) = 0, \quad S''(x_n) = 0

This gives C² continuity — continuous function, first derivative, and second derivative.

Functions

FunctionDescription
CubicSplineInterpolateInterpolate yy at point tt
CubicSplineDifferentiateFirst derivative dy/dxdy/dx at point tt
CubicSplineIntegrateDefinite integral from first xx to tt
CubicSplineIntegrateT1T2Definite integral from t1t_1 to t2t_2
CubicSplinesIntersectionFind xx where two splines intersect

Advantages

  • Smooth interpolation — no kinks at data points
  • Accurate derivatives — smooth dy/dxdy/dx 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 xi≤t<xi+1x_i \le t < x_{i+1}:

y(t)=yiy(t) = y_i

Function

FunctionDescription
StepInterpolateReturn 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

y(t)=ykwhere k=arg⁔min⁔i∣xiāˆ’t∣y(t) = y_k \quad \text{where } k = \arg\min_i |x_i - t|

Function

FunctionDescription
ProximalInterpolateReturn 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 S1(x)S_1(x) and S2(x)S_2(x), find xāˆ—x^* such that:

S1(xāˆ—)āˆ’S2(xāˆ—)=0S_1(x^*) - S_2(x^*) = 0

The intersection functions use Brent's root-finding method within the overlapping xx-range of both datasets.

Functions

FunctionDescription
LinearSplinesIntersectionIntersection of two linear splines
CubicSplinesIntersectionIntersection of two cubic splines

Note: Returns the first intersection found within the common xx-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

FunctionOperationOutput
LinearSplineInterpolateInterpolationy(t)y(t)
LinearSplineDifferentiateDifferentiationdy/dxdy/dx at tt
LinearSplineIntegrateIntegration [x0,t][x_0, t]∫x0ty dx\int_{x_0}^t y\,dx
LinearSplineIntegrateT1T2Integration [t1,t2][t_1, t_2]∫t1t2y dx\int_{t_1}^{t_2} y\,dx
LinearSplinesIntersectionIntersectionxāˆ—x^* where y1=y2y_1 = y_2

Cubic Spline Family

FunctionOperationOutput
CubicSplineInterpolateInterpolationy(t)y(t)
CubicSplineDifferentiateDifferentiationdy/dxdy/dx at tt
CubicSplineIntegrateIntegration [x0,t][x_0, t]∫x0ty dx\int_{x_0}^t y\,dx
CubicSplineIntegrateT1T2Integration [t1,t2][t_1, t_2]∫t1t2y dx\int_{t_1}^{t_2} y\,dx
CubicSplinesIntersectionIntersectionxāˆ—x^* where y1=y2y_1 = y_2

Other Methods

FunctionMethodOutput
StepInterpolateStep (piecewise constant)y(t)y(t)
ProximalInterpolateNearest neighbory(t)y(t)

Petroleum Engineering Applications

Cumulative Production from Rate Data

Using integration to calculate cumulative oil production NpN_p:

Np(t)=∫0tqo(t′) dt′N_p(t) = \int_0^t q_o(t') \, dt'

Use LinearSplineIntegrate or CubicSplineIntegrate on (t,qo)(t, q_o) data.

Rate from Cumulative Data

Using differentiation to calculate instantaneous rate:

qo(t)=dNpdtq_o(t) = \frac{dN_p}{dt}

Use LinearSplineDifferentiate or CubicSplineDifferentiate on (t,Np)(t, N_p) data.

PVT Property Lookup

Interpolate formation volume factor at an arbitrary pressure:

Bo(P)=CubicSplineInterpolate(Ptable,Bo,table,P)B_o(P) = \text{CubicSplineInterpolate}(P_{\text{table}}, B_{o,\text{table}}, P)

Nodal Analysis Operating Point

Find the flowing bottomhole pressure where IPR and VLP curves intersect:

Pwfāˆ—=LinearSplinesIntersection(qIPR,PIPR,qVLP,PVLP)P_{wf}^* = \text{LinearSplinesIntersection}(q_{\text{IPR}}, P_{\text{IPR}}, q_{\text{VLP}}, P_{\text{VLP}})

References

  1. MathNet.Numerics Documentation. "Interpolation." https://numerics.mathdotnet.com/Interpolation

  2. 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.

  3. de Boor, C. (1978). A Practical Guide to Splines. Springer-Verlag.

Utilities
utilitiesinterpolationsplinesintegrationdifferentiationnumerical methods
Can't find what you're looking for?Request Documentation
This website uses cookies to enhance your experience and analyze site usage. By clicking "Accept", you consent to the use of cookies for analytics purposes. Read our privacy policy