# When real gas corrections matter

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. ## 8 thoughts on “When real gas corrections matter”

1. Tom says:

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.

1. robert says:

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

2. JC says:

Thanks for the great content! I have a quick question on this particular topic. If Z = 1.0326, shouldn’t the amount of gas in the cylinder be actually greater than what is predicted by the ideal gas calculation? In other words, shouldn’t the amount of gas be that of an ideal gas at (1 + 3%) 200 bar = 206 bar? I might be missing something here, but if gas is more compressible than an ideal gas, which is implied by Z>1, shouldn’t we be able to pump more of it into the cylinder for a given pressure? Thanks again.

1. robert says:

I agree that from the name that would be the suggestion. But let me quote from the Subsurface source code (file gas-model.c):
/* * Z = pV/nRT * 
So a value of Z>1 means that for the same amount of gas (n) at fixed pressure (p ) you end up with a larger volume (V), i.e. you compressed it less.

1. JC says:

Thanks for the prompt reply and clarification. I understand that for a given cylinder volume at a given pressure, Z>1 would result in a lower n value, i.e. fewer gas molecules in the cylinder compared to an ideal gas. However, I still wonder if that necessarily translates to a shortage when it comes to the quantity of interest since a diver ultimately cares about having a tidal volume of gas available, not so much about how many molecules go into producing it. In other words, while having fewer gas molecules in a cylinder certainly seems like a disadvantage, a gas with Z>1 would be in the same time more ‘efficient’ than an ideal gas at producing the volumes a diver needs by the virtue of its greater molar volume. Does that make sense?

1. robert says:

I think you forget that you don’t breath gas at the cylinder pressure but at ambient pressure. And the volume you get out after the regulator reduced the pressure is proportional to n, not to the volume it occupied in the cylinder.

1. JC says:

I was aware of that. My mistake was that I assumed that Z would remain higher than unity even when gas is decompressed, in which case we would still get more volume out of a given n, even at ambient pressure.