Skip to main content

Reservoir engineering library for production analysis, forecasting, and economic evaluation

Project description

ResSmith

ResSmith is a comprehensive reservoir engineering library with a strict 4-layer architecture, designed to work seamlessly with the Smith ecosystem (plotsmith, anomsmith, geosmith, timesmith). ResSmith provides tools for production analysis, decline curve analysis, forecasting, economic evaluation, and fundamental reservoir engineering calculations.

Architecture

ResSmith follows a strict 4-layer architecture with enforced one-way imports:

  • Layer 1 (Objects): Immutable dataclasses representing the core domain
  • Layer 2 (Primitives): Algorithms and base classes
  • Layer 3 (Tasks): Task orchestration
  • Layer 4 (Workflows): User-facing functions with I/O and plotting

See ARCHITECTURE_SUMMARY.md for details.

Quick Start

Decline Curve Analysis

import pandas as pd
from ressmith import fit_forecast

# Load production data
data = pd.DataFrame({
    'oil': [100, 95, 90, 85, 80],
}, index=pd.date_range('2020-01-01', periods=5, freq='M'))

# Fit and forecast
forecast, params = fit_forecast(
    data,
    model_name='arps_hyperbolic',
    horizon=24
)

print(f"Forecast: {forecast.yhat.head()}")
print(f"Parameters: {params}")

Reservoir Engineering

from ressmith.primitives import (
    linear_ipr, vogel_ipr, perform_nodal_analysis,
    calculate_pvt_properties, solution_gas_drive_material_balance
)

# IPR calculation
rate = vogel_ipr(
    reservoir_pressure=5000,
    flowing_pressure=3000,
    productivity_index=1.0,
    bubble_point_pressure=3000
)

# PVT properties
pvt = calculate_pvt_properties(
    pressure=5000,
    temperature=200,
    api_gravity=35,
    gas_gravity=0.7
)

# Nodal analysis
result = perform_nodal_analysis(
    reservoir_pressure=5000,
    productivity_index=1.0,
    wellhead_pressure=500,
    tubing_depth=5000
)

Installation

pip install ressmith

Or with optional dependencies:

pip install ressmith[fit]  # Include scipy for optimization
pip install ressmith[viz]  # Include matplotlib (or use plotsmith)

Features

Decline Curve Analysis

  • ArpsHyperbolicModel - Hyperbolic decline (0 < b < 1)
  • ArpsExponentialModel - Exponential decline (b=0)
  • ArpsHarmonicModel - Harmonic decline (b=1)
  • LinearDeclineModel - Simple linear decline
  • Multiple advanced decline models (Power Law, Duong, Stretched Exponential, etc.)

Reservoir Engineering

  • IPR (Inflow Performance Relationship) - Linear, Vogel, Fetkovich, Composite, Joshi horizontal, Cinco-Ley fractured well models
  • VLP (Vertical Lift Performance) - Tubing performance, nodal analysis, choke performance, artificial lift optimization
  • RTA (Rate Transient Analysis) - Flow regime identification, permeability estimation, fracture analysis, SRV calculation
  • Material Balance - Solution gas drive, water drive, gas cap drive, p/Z method for gas reservoirs
  • PVT Correlations - Standing, Vasquez-Beggs, Lee-Gonzalez-Eakin, Beggs-Robinson correlations for oil, gas, and water properties

Core Capabilities

  • Fit decline models to production data
  • Generate forecasts with configurable horizons
  • Evaluate economics (NPV, IRR, cashflows)
  • Batch processing for multiple wells
  • Portfolio analysis and risk reporting
  • Statistical forecasting methods
  • Panel data analysis with fixed effects
  • Report generation (HTML/PDF)
  • Strict type safety with timesmith.typing

Integration with Smith Ecosystem

PlotSmith

Use PlotSmith for all visualization:

from ressmith import fit_forecast
from plotsmith import plot_timeseries

forecast, _ = fit_forecast(data, model_name='arps_hyperbolic', horizon=24)
fig, ax = plot_timeseries(forecast.yhat, title='Production Forecast')

AnomSmith

Share typing from timesmith.typing for consistent data structures across libraries.

GeoSmith

Share typing and integrate spatial analysis for basin-level analysis.

Reservoir Engineering Modules

ResSmith includes comprehensive reservoir engineering capabilities:

IPR (Inflow Performance Relationship)

Calculate well deliverability using industry-standard IPR models:

  • Linear IPR for single-phase flow
  • Vogel IPR for solution gas drive reservoirs
  • Fetkovich IPR for two-phase flow with decline
  • Composite IPR for layered reservoirs
  • Joshi model for horizontal wells
  • Cinco-Ley model for fractured wells

VLP (Vertical Lift Performance)

Analyze well performance and optimize production:

  • Tubing performance curves
  • Nodal analysis (IPR-VLP intersection)
  • Choke performance
  • Artificial lift optimization (ESP, gas lift, rod pump)

RTA (Rate Transient Analysis)

Analyze production data to characterize reservoirs:

  • Flow regime identification (linear, bilinear, boundary-dominated, transient)
  • Permeability estimation from production data
  • Fracture half-length estimation
  • Stimulated Reservoir Volume (SRV) calculation

Material Balance

Analyze reservoir drive mechanisms:

  • Solution gas drive (depletion drive)
  • Water drive with aquifer influx models (Fetkovich, Carter-Tracy)
  • Gas cap drive
  • Gas reservoir p/Z method
  • Drive mechanism identification

PVT (Pressure-Volume-Temperature)

Calculate fluid properties using industry correlations:

  • Standing and Vasquez-Beggs correlations for oil FVF and solution GOR
  • Gas Z-factor (Standing-Katz, Hall-Yarborough)
  • Oil and gas viscosity (Beggs-Robinson, Lee-Gonzalez-Eakin)
  • Water properties (FVF and viscosity)

Examples

See examples/ directory:

  • basic_fit_forecast.py - Fit model and generate forecast
  • basic_economics.py - Evaluate economics for a forecast

Run examples:

python examples/basic_fit_forecast.py
python examples/basic_economics.py

Migration from pydca

This library is being migrated from the pydca (decline-curve) repository. See:

Development

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

# Run examples
python examples/basic_fit_forecast.py

Requirements

  • Python 3.12+
  • numpy >= 1.24.0
  • pandas >= 2.0.0
  • timesmith >= 0.2.0

License

MIT License - see LICENSE file for details.

Contributing

See CONTRIBUTING.md for guidelines.

Related Projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ressmith-0.2.2.tar.gz (180.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ressmith-0.2.2-py3-none-any.whl (234.6 kB view details)

Uploaded Python 3

File details

Details for the file ressmith-0.2.2.tar.gz.

File metadata

  • Download URL: ressmith-0.2.2.tar.gz
  • Upload date:
  • Size: 180.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ressmith-0.2.2.tar.gz
Algorithm Hash digest
SHA256 fc3c19fb1dd5756051a9993658a221c8812db97d63b6ec48b12931bc887505f4
MD5 186f08f24b496ac1a3329f6fa118f1e4
BLAKE2b-256 3cf8ecec6575b416dabae0a89e021e640e29e9a5960b5b572eb457ced150a033

See more details on using hashes here.

Provenance

The following attestation bundles were made for ressmith-0.2.2.tar.gz:

Publisher: release.yml on kylejones200/ressmith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ressmith-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: ressmith-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 234.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ressmith-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 907af16d182b88040d1b6cf4dd45fdcc6197ab32fa20668b335848890592ddf6
MD5 125d271d9941fbaf7b0d51996cb06d7e
BLAKE2b-256 1035cab2d53dacf3690e143fa1e65d89c9248bb535bf36c9d478fe80aeac3738

See more details on using hashes here.

Provenance

The following attestation bundles were made for ressmith-0.2.2-py3-none-any.whl:

Publisher: release.yml on kylejones200/ressmith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page