-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
user defined eos #234
Comments
Hi!, i recommend to check the documentation (https://clapeyronthermo.github.io/Clapeyron.jl/dev/user_guide/custom_model/) or copy an existing EoS file to modify it to your patterns( https://github.com/ClapeyronThermo/Clapeyron.jl/blob/master/src/models/PeTS/PeTS.jl for example). note that in the general case, you need to define the residual helmholtz energy ( Now. looking at the original Hayden-O'Connell paper (https://doi.org/10.1021/i260055a003), it seems that it is an specific case of a second order virial model, that is: in that case, it is better to define it as a using Clapeyron
using Clapeyron: SecondVirialModel
struct MyParam <: EoSParam
B::PairParam{Float64}
end
@newmodel ConstantBVirial SecondVirialModel MyParam false #the false is to opt out of SAFT association parameters
#if your model is a subtype of a second virial model, you only need to define the second virial coefficient.
function Clapeyron.second_virial_coefficient_impl(model::ConstantBVirial,T,z=SA[1.0])
B = zero(T + eltype(z)) #adequate initial point
Bij = model.params.B
for i in @comps
for j in @comps
B += z[i]*z[j]*Bij[i,j]
end
end
return B/sum(z)
end |
As an aside to Andrés' answer: have you considered using other EoS? For example, PC-SAFT and PCP-SAFT both have parameters for acetic acid and seem to do quite well: julia> model = PCSAFT(["acetic acid"])
PCSAFT{BasicIdeal, Float64} with 1 component:
"acetic acid"
Contains parameters: Mw, segment, sigma, epsilon, epsilon_assoc, bondvol
julia> saturation_temperature(model,1e5)
(391.61543076122626, 6.43973177383346e-5, 0.027157488839931063)
julia> model = PPCSAFT(["acetic acid"])
PPCSAFT{BasicIdeal} with 1 component:
"acetic acid"
Contains parameters: Mw, segment, sigma, epsilon, dipole, dipole2, epsilon_assoc, bondvol
julia> saturation_temperature(model,1e5)
(389.7331841526761, 6.444345768928592e-5, 0.031801246734323926) Both have large parameter databases, so I think they should be suitable for most systems. Even the generic cubics do quite a decent job (in those cases you just need the critical properties): julia> model = PR(["acetic acid"])
PR{BasicIdeal, PRAlpha, NoTranslation, vdW1fRule} with 1 component:
"acetic acid"
Contains parameters: a, b, Tc, Pc, Mw
julia> saturation_temperature(model,1e5)
(391.54160848876614, 8.25819698557481e-5, 0.0317628509893515) Unless you are attached to using HOC, you might be better off just using an existing EoS. |
Hi! I want to model a mixture of carboxylic acids which includes acetic acid. Because in my mixture I have mostly components that do not exist in the database, I have tried using group contribution SAFTgammaMie for all the components. There seems to be an issue with acetic acid, the SAFTgammaMie will output unreasonable boiling points.
From what I found in literature, the most accurate EoS which can account for the dimerization which acetic acid exhibits in vapour phase is called Hayden-O'Connell (HOC). I don't think this EoS is currently supported in Clapeyron.jl so I was wondering if you could provide some guidelines on how to create an EoS from scratch. Thanks!
The text was updated successfully, but these errors were encountered: