Metadata-Version: 2.5
Name: thermofluids
Version: 2.0.4
Summary: Physically-consistent thermal and fluids modeling tools
Project-URL: Documentation, https://thermofluids-24bc0b.gitlab.io/
Project-URL: Repository, https://gitlab.com/ericksonla/thermofluids
Author: Luke Erickson, Russell Goldfarbmuren
Author-email: russell@rebound-tech.com
License-Expression: MIT
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >3.11
Requires-Dist: coolprop
Requires-Dist: pint
Requires-Dist: scipy
Description-Content-Type: text/markdown

# Thermofluids

Thermofluids makes modeling thermofluid systems easier. The essential element is the `statepoint`. `statepoint` objects work like physical statepoints: they have two independent variables, many dependent variables, and sometimes extensive variables. You can use them like this:
````python
sp = Statepoint(fluid='water',  # define a fluid
                t=25.0,         # define one independent variable
                p=1.0,          # define a second independent variable
                m=0.1)          # define extensive varible

sp.rho, sp.h, sp.visc
# (<Quantity(997.047039, 'kilogram / meter ** 3')>, <Quantity(104.918893, 'kilojoule / kilogram')>, <Quantity(0.000890022674, 'kilogram / meter / second')>)
````

Representing statepoints this way makes it easy to model thermodynamic cycles. The module includes some common
thermodynamic unit processes to manipulate statepoints in physically meaningful ways. For example, we can model a 
refrigeration cycle:

````python
from thermofluids import Statepoint, Quantity
from thermofluids.ProcessEquipment import Compressor


# Select a refrigerant
REFR = 'R134A'

# Find the saturation pressures of the refrigerant
ssp = Statepoint(fluid=REFR, t=-10, x=1.).p
scp = Statepoint(fluid=REFR, t=25., x=1.).p

# Define a statepoint representing the state between the evaporator and compressor
evap_to_comp = Statepoint(fluid=REFR, t=-5., p=ssp, m=0.1)

# Use the built in compressor object to calculate the statepoint at the compressor outlet
comp = Compressor(inlet=evap_to_comp,
                  eta=0.7,
                  Pout=scp)
comp_to_cond = comp.get_outlet()
print(f'Compressor work: {comp.work.to("kW")}')

# Derive the statepoint representing the condensed state between the condenser and expansion valve
cond_to_exp = Statepoint(fluid=REFR, t=20., p=scp, m=evap_to_comp.m)
q_cond = cond_to_exp.m * (comp_to_cond.h - cond_to_exp.h)
print(f'Condenser heat: {q_cond.to("kW")}')

# Derive the statepoint representing the isenthalpically expanded refrigerant
exp_to_evap = Statepoint(fluid=REFR, p=ssp, h=cond_to_exp.h, m=cond_to_exp.m)
q_evap = evap_to_comp.m * (evap_to_comp.h - exp_to_evap.h)
print(f'Evaporator heat: {q_evap.to("kW")}')
cop = q_evap / comp.work
print(f'Coefficient of performance: {cop.to("")}')
````

```
>>> Compressor work: 3.637 kW
>>> Condenser heat: 20.58 kW
>>> Evaporator heat: 16.95 kW
>>> Coefficient of performance: 4.659
```

# Documentation
Read the full documentation at https://thermofluids-24bc0b.gitlab.io/