CalebBell / thermo

Thermodynamics and Phase Equilibrium component of Chemical Engineering Design Library (ChEDL)
MIT License
594 stars 114 forks source link

Add adiabatic flash calculation #35

Closed alexchandel closed 3 years ago

alexchandel commented 4 years ago

thermo's mixture class must be constructed with a known T & P.

However, an extremely common problem is to calculate a vapor-liquid mixture's properties after an adiabatic flash. That is, beginning with a known initial vessel volume, temperature, & out-of-equilibrium vapor & liquid numbers, calculate the equilibrium point by flashing or condensing material & lowering or raising the temperature accordingly.

The is the most common VLE problem is dynamic processes. thermo should have a "vessel" class to perform this. (As a flash calculation requires looping & inversion, it would benefit enormously from numpy & scipy, and could be provided in a numpy extension package to thermo.

CalebBell commented 3 years ago

This type of a calculation is indeed common, but it also just a variant of equation solving. This functionality is accessible in the development of thermo now, see:

https://github.com/CalebBell/thermo/blob/master/docs/chemical_package_tutorial.rst https://github.com/CalebBell/thermo/blob/master/docs/tutorial_phases_and_flash.rst https://github.com/CalebBell/thermo/blob/master/thermo/phases.py

The calculations are general and do not require e.g. only PH; TH, PS, PU flashes are all implemented as the algorithms are generic.

Sincerely, Caleb