Skip to content

Getting started

Installation

pip install rodlift

A black-oil fluid

from rodlift import units
from rodlift.pvt import BlackOil, Correlations

fluid = BlackOil(
    api=30.0,
    gas_sg=0.75,
    gor=units.scf_per_stb_to_m3_per_m3(500),  # m³/m³
    water_cut=0.3,
    correlations=Correlations(solution_gor="vasquez_beggs", oil_fvf="vasquez_beggs"),
)

props = fluid.properties(pressure=10e6, temperature=units.degf_to_k(180))
props.bubble_point   # Pa
props.bo             # m³/m³
props.oil_viscosity  # Pa·s

properties broadcasts over arrays, so a whole pressure/temperature profile is a single call:

import numpy as np

p = np.linspace(1e6, 30e6, 100)
t = np.linspace(320.0, 370.0, 100)
profile = fluid.properties(p, t)

Individual correlations

from rodlift.pvt import gas, oil

rs = oil.solution_gor(8e6, 350.0, api=35, gas_sg=0.8, method="glaso")
z = gas.z_factor(15e6, 360.0, gas_sg=0.7, y_co2=0.05)

Warnings

Correlations used outside the range they were developed for emit a rodlift.exceptions.CorrelationRangeWarning and still return a value. Turn them into errors with the standard warnings module if you prefer strictness:

import warnings
from rodlift.exceptions import RodliftWarning

warnings.simplefilter("error", RodliftWarning)