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
    • Ultrasonic wet-gas over-reading correction using van Putten et al. (NSFMW, 2015), implementing the simplified model (Equations 29-30), not the full physical model (Equation 28). See the example notebook.
  • 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.16.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.16.1
File Size Uploaded Provenance Actions
pvtlib-1.16.1.tar.gz 91.2 kB Without provenance Details for pvtlib-1.16.1.tar.gz

Built distribution (wheel)

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

Total release size: 151.6 kB

Release files / pvtlib-1.16.1.tar.gz

Download URL pvtlib-1.16.1.tar.gz
Size 91.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1a3ce20fc12cf5fc3a493f40fc496a2c28d633717a177a6c3c28f86db1e85050
BLAKE2b-256 checksum
How to use checksums
6a7598960341e98b44fa0c0f86da5152b0ba3bf93cc5ee625692490faf7e1be1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

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

Download URL pvtlib-1.16.1-py3-none-any.whl
Size 60.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf1345c44d7f9b16cddc5902230ba1b18732010e1e64d1c4ef22e664aee08a2e
BLAKE2b-256 checksum
How to use checksums
72b97d5c6e5dca7148aee2700e7ee65cd4942c4eae658548646dc8ce09031c0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for pvtlib 1.16.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.16.1 This release

2 release files No provenance

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