Skip to main content
pvtlib logo

PyPI version Python versions Tests License: MIT

pvtlib is a Python library that provides various tools in the categories of thermodynamics, fluid mechanics, metering and various process equipment. The library includes functions for calculating flow rates, gas properties, and other related calculations.

Installation

You can install the library using pip:

pip install pvtlib

Usage

Here is an example of how to use the library:

from pvtlib.metering import differential_pressure_flowmeters

# Example usage of the calculate_flow_venturi function
result = differential_pressure_flowmeters.calculate_flow_venturi(D=0.1, d=0.05, dP=200, rho1=1000)
print(result)

More examples are provided in the examples folder: https://github.com/equinor/pvtlib/tree/main/examples

Features

  • Thermodynamics: Thermodynamic functions
  • Fluid Mechanics: Fluid mechanic functions
  • Metering: Metering functions
  • aga8: Equations for calculating gas properties (GERG-2008 and DETAIL) using the Rust port (https://crates.io/crates/aga8) of NIST's AGA8 code (https://github.com/usnistgov/AGA8). Note: AGA8 is only valid for single-phase gas conditions. It does not check for phase state and will produce erroneous results in the two-phase or liquid region.
  • Unit converters: Functions to convert between different units of measure
  • Equipment:
    • Compressors: Compressor performance calculations (e.g. polytropic exponent, polytropic head and efficiency)
    • Separators: Separator/scrubber sizing functions (e.g. K-value calculations)
    • Valves: Valve flow calculations (e.g. Kv/Cv flow factor)

Handling of invalid input

This library is used for analyzing large amounts of data, as well as in live applications. In these applications it is desired that the functions return "nan" (using numpy nan) when invalid input are provided, or in case of certain errors (such as "divide by zero" errors).

Running Tests

Tests are located in the tests/ folder and use pytest. Install it before running:

pip install pytest

Then run the tests from the project root:

pytest

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For any questions or suggestions, feel free to open an issue or contact the author at chaagen2013@gmail.com.

Metadata

Release files for pvtlib 1.15.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pvtlib 1.15.1
File Size Uploaded
pvtlib-1.15.1.tar.gz 69.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pvtlib 1.15.1
File Interpreter ABI Platform
pvtlib-1.15.1-py3-none-any.whl Python 3 none any Details

Total release size: 121.4 kB

Release files / pvtlib-1.15.1.tar.gz

Download URL pvtlib-1.15.1.tar.gz
Size 69.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6c5dad71582ab91096e5bf050e2a2aa991f212a8dc6ec35184c4a145f20159c0
BLAKE2b-256 checksum
How to use checksums
7ade9051cdf72ffbb6c82943f355eecadda735c092b62c91f7864ff47d7b1ebf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / pvtlib-1.15.1-py3-none-any.whl

Download URL pvtlib-1.15.1-py3-none-any.whl
Size 51.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b327e9301bcf3566657766d88928dfc01777267a6263f296bf613ed8a650ecd
BLAKE2b-256 checksum
How to use checksums
94d7945759c15426b1193c6ea13c2aa6c09c0bd6d742e2c506746a7e89906ee1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

1.15.1 This release

2 release files

1.14.5

2 release files

1.14.4

2 release files

1.14.2

2 release files

1.14.1

2 release files

1.14.0

2 release files

1.11.0

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.2

2 release files

1.8.1

2 release files

1.7.2

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page