This is Part 9c of a series.
In Part 9b, I examined the flash
capabilities of the Julia package Clapeyron.jl
. I was prompted recently to
take another look at the package as other flash algorithms have been implemented in the
meantime, including Rachford-Rice, Michelsen and more. In this post I will check the
performance of different flash algorithms against my flash benchmarks
for mixtures containing methane and helium.
The version of Clapeyron.jl
I am testing is 0.6.16
.
The flash set-up is mostly as before.
using Clapeyron
using CSV
model = Clapeyron.GERG2008(["methane","helium"])
file = "test\\flash_benchmark_GERG2008_methane+helium.csv"
for row in CSV.File(file)
z = [row.z1, 1-row.z1]
(x,ϕ,G) = Clapeyron.tp_flash(model,row.p*1e3,row.T,z,Clapeyron.DETPFlash())
if (abs(x[1,1]-row.x1)>2.e-6 && abs(x[2,1]-row.x1)>2.e-6) ||
(abs(x[2,1]-row.y1)>2.e-6 && abs(x[1,1]-row.y1)>2.e-6)
@info row
end
end
Testing DETPFlash
I found that all of the benchmark points passed on
the first try. However, re-running the calculations appeared to hit an infinite loop so
it is probably sensible to include a time limit (as I did in Part 9b).
Next, I tested Clapeyron.RRTPFlash()
. This algorithm failed for points
5, 6, 9, 10, 11, 12, 13, 14, 16, 21, 22, 23, 26, 27, 28, 31, 32, 34, 39, 40, 43 and 44.
For point 5, the output from the flash was
(x,ϕ,G)([0.93055 0.06945000000000001; 0.93055 0.06945000000000001], [NaN NaN; NaN NaN], NaN)
The Clapeyron.MichelsenTPFlash()
algorithm failed for the exact same points,
suggesting a common underlying issue. Given that only 34 of the 56 benchmark points were successful it
is clear that this algorithm is not robust for this system.
Another flash algorithm is Clapeyron.MultiPhaseTPFlash()
. This algorithm
fails for points 1, 2, 3, 5, 33, 50, 51, 52, 53, 54, 55, 56 of the benchmark set. Points 7, 12, 13 also
fail due to predicting single phase instead of two phases. This algorithm therefore performs
slightly better overall than the Michelsen and Rachford-Rice algorithms but still fails
for a significant number of points.
The final algorithm I tested was from a different Julia package: MultiComponentFlash.jl
(found here). This flash is compatible
with Clapeyron.jl
EOS models but requires using MultiComponentFlash
before
it can run. It can be called as follows:
for row in CSV.File(file)
z = [row.z1, 1-row.z1]
(x,ϕ,G) = Clapeyron.tp_flash(model,row.p*1e3,row.T,z,Clapeyron.MCFlashJL())
if (abs(x[1,1]-row.x1)>2.e-6 && abs(x[2,1]-row.x1)>2.e-6) ||
(abs(x[2,1]-row.y1)>2.e-6 && abs(x[1,1]-row.y1)>2.e-6)
@info row
end
end
This flash performs best of all. All of the benchmark points were solved successfully and
the average computation time was less than 1 ms per flash.
Clapeyron.jl
has many more options for flash algorithms than when I last
examined it but the performance against the benchmarks leaves room for improvement.
The MultiComponentFlash.jl
package appears to provide a robust and fast flash
algorithm that works well for the methane + helium system. It is the one I would recommend
for flash calculations at present.
Go to Home | How to cite this page | Permalink to this page |