-
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
Integration with Symbolics.jl #186
Comments
I encountered this error when trying your code. Stacktrace: |
Hello, That seems more like a failure in the |
using Clapeyron, Symbolics
model = UNIFAC(["water","ethanol"])
@variables v0 T0, x1, x2
x = [x1,x2]
Ge = Clapeyron.excess_gibbs_free_energy(model,v0,T0,x)
dGe = Symbolics.gradient(Ge,x)
act = Symbolics.simplify(exp.(dGe) ./(Clapeyron.R̄ * T0)) Thank you for your replay, I also have a question about “How to obtain the derivative of the fugacity calculation ?” namelist = ["ethane","ethylene","propylene","methane","propane"]
numcomp = length(namelist)
model = SRK(namelist;alpha=SoaveAlpha)
fugacity_coefficient(model,802384,233,[0.2,0.2,0.2,0.2,0.2,],phase=:l) I want to get dFugdT(size=n) dFugdP(size=n) and dFugdN (size =n*n) n=5 |
The first error seems to be here For the derivatives of fugacity there is
|
at the moment, due to how we define functions and the fact that our models need to support ForwardDiff.jl, we have the ability, in theory, to generate fully symbolic versions of an EoS. for a proof of concept, this can be done (if we remove the NaN-safe protections):
that gives the expression for the activity coefficient in terms of T0 and x (v0 is ignored).
In practice, we need additional support to make that a seamless experience. my vision is that:
Clapeyron.activity_coefficient(model,v,T,z)
just works and returns the expression above. for that, we would need:i don't know if we can/should support higher tiers. any commentary about that it is appreciated
The text was updated successfully, but these errors were encountered: