As mentioned before, gases in diving cylinders are not only not sufficiently well approximated by the real gas equation but also the van der Waals equation, despite its prominence in thermodynamics teaching, is not doing much better.
Subsurface does better than this using a polynomial fit to table data for the compressibility of the three relevant gases. In a discussion at ScubaBoard, the question came up how to use this in gas blending. After an initial version using Mathematica, I sat down and implemented it as a perl script and hooked it up to this web page for everybody’s use and enjoyment. Here it is:
source code is on GitHub. Right now, it does only nitrox. But it computes instructions to up up partly filled cylinders with any pre-existing nitrox mix.
Let me know if you think extending it to trimix would be useful for actual use. I am not sure what the best user interface would be in that case: For nitrox, specifying the initial and target mix and pressure and two top up mixes, the blending problem generally has a solution. But with three gas components to get right, it is in general impossible with only two top up mixes. So you either have to use three (linearly independent) top up mixes or let one thing unspecified. That could be either the oxygen or helium fraction of the final mix or you have to leave open one of the gas fractions of the top up gases.
So what do you do in practice, which component do you leave unspecified?
Update: I updated the script so it can now also handle blending trimix (starting from a partially filled cylinder, you can specify three top up gases it will now calculated the intermediate pressures you have to fill up to). To blend nitrox, specify the target mix as containing no helium and leave one of the top up mixes empty.
Update: I discovered an error in the calculation (I calculated the mix according to pressures rather than volumes at 1 bar) that should be fixed now (April 10, 2022)
4 thoughts on “Blending real gases”
I think Trimix would be useful as Trimix is where this actually matter in real life. With Nitrox you generally get by within reasonable limits (1% of target value) with traditional approaches. But Trimix will always require you to introduce some magic fudge factors to get an accurate mix, so there is where a tool like this would be most useful. Generally you would add He, then o2 before you top up to target pressure with air or EAN32 . In practice i would not add more He but get a reasonable leaner mix the second time around for topups. (make 18/45 a 25/25 etc)
Robert, did you check also this one?
No, I was not aware of it. But as far as I can tell that only does the calculation using the ideal gas equation. The whole point if my implementation was to take into account the real gas corrections.
Check this article and vba open source code. This has been implemented in several blending apps: