We have all learned that most of the time the ideal gas law (maybe in its isothermal version known as Boyle-Mariotte law) is sufficiently accurate to calculate the amount of gas in cylinders. At least as long as we restrict to pressures not exceeding about 200bar (and of course we all know it’s a beginner’s mistake to assume 300 bar cylinders give you a 50% advantage in gas carried with respect to 200 bar cylinders even forgetting the problems of actually getting those filled to nominal pressure or attempting to mix in at those pressures).

But let’s look at this a bit more quantitatively: You can parametrize the error of the ideal gas law by a “compressibility factor” Z so that it becomes

\(pV = ZnRT\)and then tabulate Z as for example done here. In the table for a realistic temperature of 300K you read off 1.0326 at 200 bar while only 1.0074 at 150 bar. So, at 200 bar, you overestimate the amount of gas in your cylinder by 3% or put differently, the amount of gas is that of an ideal gas but only at (1-3%) 200 bar = 194 bar while the amount calculated at 150bar is almost correct.

What is 3% amongst friends I hear you complain, that is likely less than the accuracy of your pressure gauge. That is of course correct but lets see how this relative error multiplies as soon as you take differences: Let’s say you want to compute your surface air consumption (SAC) for a dive in which you breath your cylinder down from 200 bar to 150 bar. Wrongly assuming the ideal gas law to hold lets you compute the amount of gas to be 50 bar times the volume of your cylinders. But as we saw, due to the compressibility factor, we should rather use 194 bar – 150 bar which is only 44 bar. Compared to the 50 bar of the ideal gas, we now have a 12% error, something that I would already consider significant. In particular when I use this value to extrapolate the gas use to other dives.

We see that suddenly the relative error multiplied by a factor of four and for the momentary gas use one needs to look at \(\partial Z/\partial p\) as well.

The upshot is that even for 200 bar one should better use a real gas replacement to the ideal gas law. Anybody who had been in an undergraduate physics class would now probably go to van der Waal equation but as it turns out for typical diving gases in the commonly used pressure ranges that gets 1-Z rather poorly. So for Subsurface we had to use a more ad hoc approximation. But that is the topic of a future post.

Hi.

Thank you for this nice Blog. I really like reading here, even if i sometimes cant understand everything. Would hope to read more.

As i keep an excel sheet of all my dives including average depth and start / end pressure i also calculate my SAC / RMV rates. To get these numbers more accurate i would like to improve on the calculation done for this. On the last part of your blogpost you gave a hint about the impelementation in subsurface. If you really could write up another topic about that i really really would appreciate it. I tried looking into the subsurface binaries to textract the knowledge but couldnt find it.

Of course, for a SAC/RMV calculation you need to know the average depth (for which you need the actual depth profile from your dive computer). But you can export your excel sheet as a CVS and import that data then to subsurface and let it do the calculation.

If you want to see how we do it (we use an interpolation of table data for the real gas compressibility of O2, N2 and He), have a look at https://github.com/Subsurface-divelog/subsurface/blob/master/core/gas-model.c