# Equalizing real gases

As for filling cylinders real gas corrections do matter, we try to take the compressibility factor into account in Subsurface. As the theoretical physicist I thought (as I was taught) this is handled by the van der Waals equations. Turns out, in the pressure/temperature range relevant for diving cylinders is very far from getting the corrections to the ideal gas equations right. There are errors at least in the 30% range. This is probably since we are quite far away from the tri-critical point where it is supposed to be a good approximation.

In the end, we found a cubic approximation with coefficients read off from tables of compressibility factors to be an economic way to do these computations. You can find the source here.

When today somebody asked in a diving forum for a spreadsheet to calculate the resulting pressure when streaming between two cylinders, I thought I could use these interpolations to do the calculations for real gases with different compositions. Here is what I came up with.

## 3 thoughts on “Equalizing real gases”

1. Jakob says:

Hi Robert,

I was looking at the implementation linked above, and maybe you can answer a question I have.

My understanding of the virial model in i single gas mix is that the second coefficient models the interaction between two molecules, the third is between three molecules, and so on.

In the implementation however a separate compressibility factor is calculated for oxygen, helium and nitrogen and then added in proportion to the fraction of each gas in the mix.

Intuitively, this feels like it misses the interaction between molecules of different gases, e.g. between a pair of oxygen and helium, or between a trio of all three gases, or any other combination.

Any thoughts on this?

1. robert says:

I don’t think there is such a straight forward interpretation of the virial coefficients. But you are right that ideally one should take into account interactions between the gases. But our approximation is an ad hoc one anyway and at least for nitrox mixes seems to fit quite well with the data in the relevant range of pressures and temperatures (I am not saying trimix does not work, just that I don’t have good trimix data). There are much more elaborate real gas models like GERG model https://pubs.acs.org/doi/10.1021/je300655b . The development of these is, in my understanding, mainly driven by the drilling for oil and has industry as it has important consequences there. But for our purposes of very limited ranges of temperatures and pressures I believe our model is doing good enough (and much better than the ideal gas equation).

1. Jakob says:

Thank you! Just wanted to sanity check my understanding as I went down the rabbit hole of calculating the volume of gas mixes in tanks…
And yes, I agree that this should be good enough for diving applications.
Interesting to see though that there is research being done.