ClapeyronThermo / Clapeyron.jl

Clapeyron provides a framework for the development and use of fluid-thermodynamic models, including SAFT, cubic, activity, multi-parameter, and COSMO-SAC.
MIT License
188 stars 47 forks source link

Simple example with activity coefficient model and antoine parameters for saturation pressure? #267

Open thomvet opened 3 months ago

thomvet commented 3 months ago

Apologies if a relevant example is already available in the documentation, but I couldn't find one.

I am wondering how one would go about setting up an activity coefficient model, say UNIFAC, with a simple Antoine equation for the saturation pressure of the pure components (to do a simple VLE envelope at fixed pressure for example).

Is it possible in Clapeyron.jl? Any pointers appreciated! (I would be happy to do a proper PR to add the example, so that others profit as well)

longemen3000 commented 3 months ago

Yes!, we use CompositeModels for defining equilibria with different models, maybe something like this?

fluidmodel = CompositeModel(["octane","heptane"],liquid = RackettLiquid,saturation = DIPPR101Sat,gas = BasicIdeal)
#we create a fluid model with rackett liquid volume, ideal gas and DIPPR 101. If you perform equilibria with this, it will be done via raoult. 

model = CompositeModel(["octane","heptane"],liquid = UNIFAC, fluid = fluidmodel)
#this model now uses activities in conjunction with the fluid model

check the CompositeModel docs for the combinations. Funnily enough, I think we don't have an Antoine saturation method 😅, I can add one and release a new version of you wish.

pw0908 commented 3 months ago

@longemen3000 Could they technically just use LeeKesler right away in the Activity coefficient model? And skip building the composite model.

longemen3000 commented 3 months ago

hmm, I don't remember if we support that (mainly the liquid volumes), but I can do some changes to allow just passing a saturation model, and assume BasicIdeal for gas, and a dummy method for the liquid (NaNLiquid? )