Skip to main content

A library containing various tools in the categories of thermodynamics, fluid mechanics, metering etc.

Project description

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

  • Coriolis pressure correction example notebook: examples/13 Coriolis Pressure Correction/coriolis_pressure_correction_example.ipynb

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.

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

pvtlib-1.15.0.tar.gz (70.0 kB view details)

Uploaded Source

Built Distribution

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

pvtlib-1.15.0-py3-none-any.whl (51.6 kB view details)

Uploaded Python 3

File details

Details for the file pvtlib-1.15.0.tar.gz.

File metadata

  • Download URL: pvtlib-1.15.0.tar.gz
  • Upload date:
  • Size: 70.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pvtlib-1.15.0.tar.gz
Algorithm Hash digest
SHA256 e3e8e90c99289bb6a48d3b7e55dc5a31fa5641b792e02cd9abd6e7ebe3a59d6c
MD5 94dd50522cfb5308c3ba9a5fe9519903
BLAKE2b-256 a6664f1f6121752fc5d2cb2d10227529ad603efffb1ff3a0b91e70c48a400331

See more details on using hashes here.

File details

Details for the file pvtlib-1.15.0-py3-none-any.whl.

File metadata

  • Download URL: pvtlib-1.15.0-py3-none-any.whl
  • Upload date:
  • Size: 51.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for pvtlib-1.15.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d44208a2c840645d83b69f19bc76fed3dc95f58a89bf8b8a1fc216ee19263b9b
MD5 ab0c3011e96987bf4d7a21ccb97cd0d2
BLAKE2b-256 8a5301020a6f489ef85106f9bf01ca2ee2123716e64466e03e44ad9fbffb26f0

See more details on using hashes here.

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