## Blending real gases

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:

Real Blender

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)

## Rating decompression

How good was the deco of my dive? For those of us who strive to improve their diving this is a valid question to find ways to optimise how we get out of the water. In Subsurface, for example, we give various information including the individual tissues’ ceilings as well as the heat-map.

That sounds interesting. The somewhat ambitious price tag (about 1000 Euros for the sensor plus 1,50 Euro per dive analysed), however, prevented me from just buying it to take it for a test. And since it’s a commercial device, they don’t exactly say what they are doing internally. But in there information material they give references to scientific publications, mainly of one research group in southern France.

A fraction is to conference proceedings and articles in very specialised journals that neither my university’s library nor the Rubicon Archive not SciHub have access to, but a few of the papers I could get hold of. One of those is “A new biophysical decompression model for estimating the risk of articular bends during and after decompression” by J. Hugon, J.-C. Rostain, and B. Gardette.

That one is clearly in the tradition of Yount’s VPM-B model (using several of the bubble formulas that I have talked about in previous posts). They use a two tissue model (fitting diffusion parameters from dive data) and find an exponential dependence of the risk of decompression on the free gas in one of the tissues:

Note, however, that the “risk of decompression sickness” is not directly measured but is simply calculated from the

$$PrT = P\sqrt t$$

paramour (P is the ambient pressure in bar during the dive while t is the dive time in minutes, i.e. a characterisation of a dive profile compared to which a spherical cow in vacuum looks on spot, but this seems to be quite common, see also https://thetheoreticaldiver.org/wordpress/index.php/2019/06/16/setting-gradient-factors-based-on-published-probability-of-dcs/) using the expression

$$r_{DCS} = 4.07 PrT^{4.14}.$$

which apparently was found in some COMEX study. Hmm, I am not convinced Mr. President.

The second reference I could get hold of are slides from a conference presentation by Julien Hugon titled “A stress index to enhance DVS risk assessment for both air and mixed gas exposures” which sounds exactly like what the O’Dive claims to do.

There, it is proposed to compute an index

$$I= \frac{\beta (PrT-PrT^*)}{T^{0.3}} .$$

Here PrT=12 bar sqrt(min), T the total ascent time and beta depends on the gas breathed: 1 for air, 0.8 for nitrox and 0.3 for trimix (hmm again, that sounds quite discontinuous). As you might notice, what does not go into this index is at which depths you spend your ascent time while PrT keeps growing with time indefinitely (i.e. there is no saturation ever).

This index is then corrected according to a Doppler count (which is measured by a grade from 0 to 5):

This corrected index is then supposed to be a good predictor for the probability of DCS.

I am not saying that this is really what is going on in the app and the device, these are only speculations. But compared to 1000 Euro plus 1,50 Euro per dive, looking at ceilings and heat map in Subsurface sounds like quite good value for money to me.de

## DIY on the fly

With the new version of Subsurface out today, I would like to point to a feature that was already there in 4.7.4, but which just got more usable: Computing deco variations in the planner.

This is motivated by the discussions about Ratio Deco and Deco On The Fly, for a discussion see this post by Rick. These approaches to computing deco are not really attempting to model anything that is supposed to go on in the diver’s body but simply to take a very pragmatic approach and interpolate deco schedules from known ones. If you like, they are (or attempt to be) mnemonics to learn deco plans by heart. The idea is simply that you memorise a reference plan and also how you have to modify deco if you modify the bottom part of your dive.

With Subsurface, you can now do exactly this: You can take any dive that you planned in the planner as reference dive and it will tell you how your total deco time depends on the bottom part. Take for example this trimix dive to 60m with 30min bottom time:

The runtime table says

The important line is the second:

Runtime: 118min, Stop times: + 3:05 /m + 3:59 /min

This tells you how to adjust the total deco time when changing the bottom time (the segment at 30m): For each meter that you go deeper, you have to add about three minutes (for example if you went to 63m for half an hour, you would have to add about 9 minutes or if you only went to 58m you could shorten your deco by 6 minutes). Similarly, if you change the bottom time you have to pay every extra minute on the bottom by about four minutes in deco.

It does not tell you how to distribute this time over the different stops but a good rule of thumb would be to do it roughly proportional to the time you already spend at the stops. So for example, of the about 90min of total deco time you spend roughly half at 6m,  you would also add half of the extra time at this last stop.

These numbers are supposed to be something like the partial derivative of the total deco time with respect to depth and duration of the bottom time element (actually: the last manually entered part of the dive). You are supposed to multiply these derivative with the actual variation of the bottom segment that you do.

How do we compute these numbers? When this calculation is enabled, Subsurface actually computes five extra plans: It first computes the original plan, but now with second resolution of the stops instead of minute resolution. Then it shortens the bottom segment by one minute and computes the plan (again to seconds) and then computes a plan for a bottom time extended by one minute. Then it computes to more plans for one meter shallower and one meter deeper.

This give us two time differences both for depth and duration variations. What is displayed is the average of those. But a bit of experimentation shows that the difference is typically only a few seconds (and what are seconds for 90min deco?). This is also a measure how good this linear approximation is (as this the quadratic correction): It gives me confidence to say this approximation isn’t too bad for a few minutes or a few meters.

So having these two numbers also on the runtime table should give the diver much more confidence in how to react to unforeseen changes of plan (both shallower and deeper and shorter and longer). But of course, always remember: Plan the dive, dive the wreck, wreck the plan!