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 |
|
|---|---|
package |
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
>>> 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)
>>> 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)
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)
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')
You can change the back-end of CoolProp, e.g. to use REFPROP:
diagram = FluidPropertyDiagram(fluid='R290', backend='REFPROP')
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fluprodia-4.0.tar.gz.
File metadata
- Download URL: fluprodia-4.0.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16bb697b2a38b5d35dca495f1173d049a05c4d8be57a0dbc9ac769d4202b33e1
|
|
| MD5 |
3b2a9fd6f180b752ee491d34e5153498
|
|
| BLAKE2b-256 |
3834dffaa38b1f4b06f0aa24944272d89f08ba1de5897f709f3d9ccf6b668cf6
|
File details
Details for the file fluprodia-4.0-py3-none-any.whl.
File metadata
- Download URL: fluprodia-4.0-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fa2d56a0a9d30dba7aa171c723e13bff2c085cf0201c09d1d31919325a50edf
|
|
| MD5 |
9c7edf837f939171921f1b6640f739ab
|
|
| BLAKE2b-256 |
98e953bf2a87aa5e6c5d5d47e2da76acb81f264bb49098a2439b5229f8b2bfbc
|