CalebBell / thermo

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

HELP VaporPressure #147

Closed SalvadorBrandolin closed 9 months ago

SalvadorBrandolin commented 9 months ago

I'm trying to perform a LVE with UNIFAC:

from thermo import *
from thermo.unifac import DOUFSG, DOUFIP2016

constants, properties = ChemicalConstantsPackage.from_IDs(['ethanol', 'water'])
# Objects are initialized at a particular condition
T = 300
P = 1e5
zs = [.5, .5]

gas = IdealGas(T=T, P=P, zs=zs, HeatCapacityGases=properties.HeatCapacityGases)

GE = UNIFAC.from_subgroups(chemgroups=constants.UNIFAC_Dortmund_groups, version=1, T=T, xs=zs,
                           interaction_data=DOUFIP2016, subgroups=DOUFSG)

# Configure the liquid model with activity coefficients
liquid = GibbsExcessLiquid(
    VaporPressures=properties.VaporPressures,
    HeatCapacityGases=properties.HeatCapacityGases,
    VolumeLiquids=properties.VolumeLiquids,
    GibbsExcessModel=GE,
    equilibrium_basis='Psat', caloric_basis='Psat',
    T=T, P=P, zs=zs)

# Create a flasher instance, assuming only vapor-liquid behavior
flasher = FlashVL(constants, properties, liquid=liquid, gas=gas)

flasher.flash([0.2, 0.8], 360, 100000)

This works, but my question is: it's possible to define my own VaporPressure object with the DIPPR101 equation giving my own parameters? The same question is for HeatCapacity and VolumeLiquids. I don't find in the documentation or the source code the right way to do it.

Thank you in advance!

SalvadorBrandolin commented 9 months ago

I'm sorry I found it myself :sweat_smile: :sweat_smile:

obj = VaporPressure()

obj.add_correlation(
    name='WebBook', 
    model="DIPPR101", 
    extrpolation=None, 
    Tmin=177.70, 
    Tmax=10000,  
    A=7.3649e+01, B=-7.2582e+03, C=-7.3037e+00, D=4.1653e-06, E=2.0000e+00)