Skip to main content

Create beautiful fluid property diagrams using CoolProp and matplotlib

Project description

Create custom and beautiful Fluid Property Diagrams with fluprodia. The package implements fluid property data from CoolProp [1]. Plotting is handled by matplotlib [2], all calculations are performed with numpy [3]. The list of fluids available can be found at CoolProp.

fluprodia is licensed under the MIT software license.

docs

Documentation Status

package

PyPI Package latest release PyPI Wheel
Supported versions
Zenodo

Installation

pip install fluprodia

Usage

To create a diagram import the library, specify unit system and isolines to be calculated and run the calculation:

>>> from fluprodia import FluidPropertyDiagram
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> plt.style.use('dark_background')

>>> diagram = FluidPropertyDiagram(fluid='H2O')
>>> diagram.set_unit_system(T='°C', h='kJ/kg', p='bar')
>>> Q = np.linspace(0, 1, 11)
>>> T = np.arange(25, 501, 25)
>>> p = np.geomspace(0.01, 1000, 6) * 1e5
>>> v = np.geomspace(0.001, 10, 5)
>>> s = np.linspace(1000, 10000, 10)
>>> h = np.linspace(0, 3600, 19)
>>> diagram.set_isolines(Q=Q, T=T, p=p, v=v, s=s, h=h)
>>> diagram.calc_isolines()

Then you can plot the data to different types of plots, e.g. logph diagram:

>>> fig, ax = plt.subplots(1, figsize=(8, 5))
>>> diagram.draw_isolines(diagram_type='logph', fig=fig, ax=ax, x_min=0, x_max=3000, y_min=0.01, y_max=1000)
>>> plt.tight_layout()
>>> fig.savefig('logph_diagram_H2O.svg')
>>> fig.savefig('logph_diagram_H2O.png', dpi=300)
https://raw.githubusercontent.com/fwitte/fluprodia/master/docs/reference/_images/logph_diagram_H2O.svg

Or, a Ts-diagram:

>>> fig, ax = plt.subplots(1, figsize=(8, 5))
>>> diagram.draw_isolines(diagram_type='Ts', fig=fig, ax=ax, x_min=0, x_max=8000, y_min=0, y_max=700)
>>> plt.tight_layout()
>>> fig.savefig('Ts_diagram_H2O.svg')
>>> fig.savefig('Ts_diagram_H2O.png', dpi=300)
https://raw.githubusercontent.com/fwitte/fluprodia/master/docs/reference/_images/Ts_diagram_H2O.svg

The fluids are available through CoolProp. To generate a diagram for a new fluid simply change the name. Isolines come with defaults as well.

>>> diagram = FluidPropertyDiagram(fluid='R290')
>>> diagram.set_unit_system(T='°C', h='kJ/kg', p='bar')
>>> diagram.calc_isolines()
>>> fig, ax = plt.subplots(1, figsize=(8, 5))
>>> diagram.draw_isolines(diagram_type='logph', fig=fig, ax=ax, x_min=0, x_max=800, y_min=1e-1, y_max=1e2)
>>> plt.tight_layout()
>>> fig.savefig('logph_diagram_R290.png', dpi=300)
>>> fig.savefig('logph_diagram_R290.svg')
https://raw.githubusercontent.com/fwitte/fluprodia/master/docs/reference/_images/logph_diagram_R290.svg

Documentation

For further examples and usage please refer to the online documentation at https://fluprodia.readthedocs.io/.

Citation

Every version of fluprodia is archived at zenodo. You can cite the latest or a specific version. For citation info and more details please go to the zenodo entry of fluprodia.

References

This software depends on the packages CoolProp, matplolib and numpy.

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

fluprodia-3.2.tar.gz (907.6 kB view details)

Uploaded Source

Built Distribution

fluprodia-3.2-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file fluprodia-3.2.tar.gz.

File metadata

  • Download URL: fluprodia-3.2.tar.gz
  • Upload date:
  • Size: 907.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for fluprodia-3.2.tar.gz
Algorithm Hash digest
SHA256 5c83d430bf43cbb3c3299ea23a73f3b7b81c3ddfeb7f40c8695c7f3c8eb914b4
MD5 1ca9dae3f97d3ac8901aab3b2acf0801
BLAKE2b-256 5cc17310bb8d92653003b21e23b44d6a6156fb45f31712a2935bb9d55ad93ed9

See more details on using hashes here.

File details

Details for the file fluprodia-3.2-py3-none-any.whl.

File metadata

  • Download URL: fluprodia-3.2-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for fluprodia-3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f74d00b7f3557cf30d6e46c7156aa680394a69a732d1f838138269ec5870a189
MD5 9da4440cea7032491bbb7df764c1740a
BLAKE2b-256 cc5c1f3adcdb0009c8999390bbcd8a4508a3c2ff1bc1da153ca04ee9b9d5db40

See more details on using hashes here.

Supported by

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