CNS calculation headaches

Linus Torvalds torvalds at linux-foundation.org
Sat Aug 10 11:30:22 PDT 2019


On Sat, Aug 10, 2019 at 6:41 AM Robert Helling <helling at atdotde.de> wrote:
>
> here is another idea: With the exception of the values above pO2 of
1.5bar, a power law is actually a pretty good fit to the table:
>
> This is exp(11.7853 - 0.00193873 pO2).

Ugh. I hate it.

The fit may be ok, but

 (a) as you say, the fit is best in the cases we care _least_ about

 (b) the whole notion of using that power law seems broken, since it by
definition ends up with a graph that flattens out as we get further out,
but we know that that's the exact reverse of the real behavior - CNS gets
much *worse* for higher values.

Honestly, looking at the plot, I'd try a polynomial fit over an exponential
one. A third order polynomial would seem to visually match the curve (and
has the basic right behavior of keeping going past the saddle point.

Trying it in R, a fourth-order function actually looks like a better fit,
even if it obviously then has odd behavior on a big scale. But within the
range of pO2 of 0-2.0 it's actually not bad.

I'm attaching my R script so that people can try it themselves, but the
good fourth-order polynomial coefficients are

 p0  1.02622351109e+05
 p1 -7.12255629101e+01
 p2 -1.29275204094e-01
 p3  1.67339040669e-04
 p4 -5.19327405968e-08

(This is all done in the odd units we use for CNS calculations: time in
seconds, pO2 values in whole permille, so "2000" means a pO2 of 2.0).

Look at the fitting graph (the steeper curve that is a better fit is the
fourth-order one, the less steep curve is the third-order one.
[image: Screenshot from 2019-08-10 11-18-55.png]

NOTE NOTE NOTE! That curve really does go below zero there. It's basically
a "how long is it safe to stay at a pO2 of X" curve. The third-order curve
basically says "it's safe to stay for negative five hours at a pO2 of 2.0",
while the fourth-order curve says "it's safe to stay for negative five
hours at a pO2 of 1.8".

That actually makes me feel somewhat happy about the curve fitting. We know
a pO2 of 2 isn't safe. It's a "hey, you're a US Marine, dying is part of
your job" kind of pO2.

Again, the fourth-order curve fits better, and has "safer" behavior in the
sense that a lower pO2 of "just 1.8" is already considered less safe.

Just looking at that graph, I'd be comfortable using the 4th-order
approximation for the valid range (ie pO2 of 0.6-1.6, which is what we have
data points for).

I'd also think that the extensions _past_ that range look sane - BUT I
think that if subsurface uses those extended areas, we should give a BIG
BIG warning.

Comments?

                 Linus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20190810/6d5ed1d7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2019-08-10 11-18-55.png
Type: image/png
Size: 110887 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20190810/6d5ed1d7/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cns.r
Type: application/octet-stream
Size: 1435 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20190810/6d5ed1d7/attachment-0001.obj>


More information about the subsurface mailing list