Replies: 19 comments 17 replies
-
|
I tested the speed of v0.6.14 and 0.6.15 on my computer, Julia 1.10.10. The performance difference between pure components and mixtures has existed since 0.6.14. Furthermore, 0.6.15 has improved speed on the T(x) and T2(x) functions you provided. For for The PH_property function was changed a lot. |
Beta Was this translation helpful? Give feedback.
-
|
Yes indeed. That difference is due to the fixes for #407. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
One path to impeove the performance is improving the bubbledew solvers. At the moment, we use nested Another path to make the operations faster is to merge the initial point generation for the bubbledew solvers in one routine. To generate the initial points, we:
The first two steps could be done just once. |
Beta Was this translation helpful? Give feedback.
-
|
There might also be a third option. We make I am not sure on the robustness of this. But possibly worth a try. |
Beta Was this translation helpful? Give feedback.
-
|
Hello, Here is the proof of concept for my previous comment. It is very premature hence difficult to make any conclusion. using Clapeyron, Roots
function Tproperty2_enthalpy(model::EoSModel,p,h,z)
f(x) = enthalpy(model,p,x,z)
f0(x) = enthalpy(model,p,x,z) - h
edge_val,prop_edge_left, prop_edge_right = Clapeyron.FindEdge(f,1,500)
if h ∈ range(prop_edge_left,prop_edge_right)
@warn "In two phase"
return edge_val
end
if h < prop_edge_left
prob = ZeroProblem(f0,edge_val - 10)
return solve(prob)
end
if h > prop_edge_right
prob = ZeroProblem(f0,edge_val + 10)
return solve(prob)
end
return NaN
end
model = cPR(["R134a","propane"],idealmodel=ReidIdeal);
p = 101325*10; z = [1.0,1.0];
h = -50000;
@time Tproperty2_enthalpy(model,p,h,z) # 0.000104 seconds (275 allocations: 14.438 KiB)
@time Tproperty(model,p,h,z,enthalpy) # 0.000745 seconds (1.26 k allocations: 120.688 KiB)With this we evade computation of bubble and dew points for initialization. As of now this is not robust but just an idea. Let me know what you think. |
Beta Was this translation helpful? Give feedback.
-
|
I have an additional comment on performance of The internal computation of critical point takes about 55% of memory. julia> model = cPR(["R134a","propane"],idealmodel=ReidIdeal);
julia> p = 101325*10; z = [1.0,1.0];
julia> @time crit_mix(model,z);
0.000338 seconds (588 allocations: 65.188 KiB)
julia> @time Tproperty(model,p,1000,z,enthalpy)
0.000398 seconds (1.21 k allocations: 118.062 KiB)
319.6393678738907I am thinking of a way to by-pass this. This was implemented because of #309. |
Beta Was this translation helpful? Give feedback.
-
|
Hmmm, i think i got an idea on how to implement this. If the property is outside the edge, you still need at least one bubble/dew calculation to confirm that your property point is outside the saturation dome, but in any case, this approach reduces the amount of bubble/dew calculations from two to one/zero |
Beta Was this translation helpful? Give feedback.
-
If we do this will there be inconsistency with the current flashes? Because the current one are based over the default dew and bubble solvers I am not sure but this might break the code? |
Beta Was this translation helpful? Give feedback.
-
|
i think i got something going on, on the |
Beta Was this translation helpful? Give feedback.
-
|
I was going through the code of the |
Beta Was this translation helpful? Give feedback.
-
|
Yes, i was looking at a good initial point, and it seems like the bubble/dew raoult pressures are good enough (specially for |
Beta Was this translation helpful? Give feedback.
-
|
On the latest master now for mixtures if we run the code on the issue we get: julia> using Clapeyron, BenchmarkTools
julia> fluid2 = cPR(["Propane","R134a"],idealmodel = ReidIdeal); z2 = [1.0,1.0];
julia> h = collect(range(-1,1,100));
julia> T2(x) = Clapeyron.PH.temperature(fluid2,p,x,z2)
julia> @btime T2.($h);
6.976 ms (97089 allocations: 7.52 MiB) The computation speed has increased by almost two times and the allocations have dropped 20%. So should we close this for now? |
Beta Was this translation helpful? Give feedback.
-
|
I'm gonna move this into a discussion, because there is probably more things to do |
Beta Was this translation helpful? Give feedback.
-
|
Hello, Is it possible that there is a bottleneck in flash computation when in two-phase? julia> using Clapeyron
julia> p = 101325.0; z = [1.0,1.0];
julia> fluid = cPR(["Propane","R134a"],idealmodel = ReidIdeal);
julia> Tb = bubble_temperature(fluid,p,z)[1];
julia> Td = dew_temperature(fluid,p,z)[1];
julia> hb = enthalpy(fluid,p,Tb,z);
julia> hd = enthalpy(fluid,p,Td,z);
julia> h_ = collect(range(hb,hd,100));
julia> T2(x) = Clapeyron.PH.temperature(fluid,p,x,z);
julia> @btime T2.($h_);
31.784 ms (319636 allocations: 33.31 MiB)I am not able to completely understand the algorithm |
Beta Was this translation helpful? Give feedback.
-
|
I will begin implementing some extreme performance optimizations for this discussion. We need a continuous performance log; please consider the following options:
|
Beta Was this translation helpful? Give feedback.
-
|
One big performance improvement could be achieved calculating ∂lnϕ∂P and ∂lnϕ∂T in one gradient call instead of calculating the hessian of |
Beta Was this translation helpful? Give feedback.
-
|
in the What is important is that is those implementations rely on some new functions ( |
Beta Was this translation helpful? Give feedback.
-
|
Hello, With the implementation of the new methods for solving ( I think since 0.6.20) lot has changed. The core MWE of this thread had gained significant performance somewhere around v0.6.17 See : comment in this thread Now it seems to me that with the new implementations the performance has dropped back almost to 0.6.15 the same as beginning of this thread. using Clapeyron, BenchmarkTools
p = 101325.0
h = collect(range(-1,1,100));
fluid2 = cPR(["Propane","R134a"],idealmodel = ReidIdeal); z2 = [1.0,1.0]
T2(x) = Clapeyron.PH.temperature(fluid2,p,x,z2) # 11.435 ms (120729 allocations: 11.51 MiB)
@btime T2.($h); # 9.125 ms (103969 allocations: 10.82 MiB)
nothingI had not checked the performance on this after the unified cache system was implemented as well. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
There seems to be a vast difference in the performance of pure vs mixtures.
There is almost no difference now between
TpropertyandClapeyron.PH.temperaturesince 0.6.15.I am not sure where the bottlenecks might be now. But the difference seems significant.
Beta Was this translation helpful? Give feedback.
All reactions