Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andreshyer/preos
Pend-Robinson Equation of State solver
https://github.com/andreshyer/preos
Last synced: about 2 months ago
JSON representation
Pend-Robinson Equation of State solver
- Host: GitHub
- URL: https://github.com/andreshyer/preos
- Owner: andreshyer
- Created: 2020-08-28T21:48:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-11T21:16:20.000Z (almost 3 years ago)
- Last Synced: 2024-10-14T03:51:17.673Z (3 months ago)
- Language: Python
- Size: 53.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Peng-Robinson Equation of State Solver
This script is meant to be able to solve primarly the partial vapor fugacities of
the compounds in a mixture using the PREOS and equations found in "Chemical, Biochemical,
and Engineering Thermodynamics" by Stanley I. Sandler.This solver can also solve the Z and molar volumes of a mixture both in vapor
and liquid phase.## Solving for Z of a single component
compounds = {'oxygen': 1.0}
calculator = PendRob(compounds)
calculator.calculate_Z(pressure=1, temperature=100)
print(calculator.z_mix)
>>> {'single state': 0.9997068078533051}
## Solving for Z of a mixture
compounds = {'ethane': 0.5, 'n-butane': 0.5}
calculator = PendRob(compounds)
calculator.calculate_Z(pressure=1, temperature=100)
print(calculator.z_mix)
>>> {'single state': 0.9913218856617976}## Solving for molar volume of a mixture
compounds = {'ethane': 0.5, 'n-butane': 0.5}
calculator = PendRob(compounds)
calculator.calculate_V(pressure=2, temperature=100)
print(calculator.V)
>>> {'single state': 0.015241545952714833}
## Solving for partial vapor fugacities of compounds in mixture
compounds = {'methane': 0.65, 'ethane': 0.20, 'propane': 0.15}
calculator = PendRob(compounds)
calculator.calculate_fv(pressure=2, temperature=100)
print(calculator.fv)
>>> {'methane': 1.2980602636892002, 'ethane': 0.3967781774811893, 'propane': 0.29602876757692975}
## Solving for partial vapor fugacities of compounds in mixture in range of pressures
compounds = {'methane': 0.65, 'ethane': 0.20, 'propane': 0.15}
calculator = PendRob(compounds)
df = calculator.generate_table_for_fv(pressures=[2, 7, 20], temperature=100, file='output.csv')
print(df)
>>> Pressure (bar) ... Vapor Fugacity of propane (bar)
0 2 ... 0.2960
1 7 ... 1.0022
2 20 ... 2.6266