Giter Club home page Giter Club logo

Comments (2)

longemen3000 avatar longemen3000 commented on August 16, 2024

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 (a_res)

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: Z(V,T,z) = 1 + BP/RT.

in that case, it is better to define it as a SecondVirialModel:

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

from clapeyron.jl.

pw0908 avatar pw0908 commented on August 16, 2024

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.

from clapeyron.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.