<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 26 February 2016 at 09:30, Robert Helling <span dir="ltr"><<a href="mailto:helling@atdotde.de" target="_blank">helling@atdotde.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi,<span class=""><div><br><div><blockquote type="cite"><div>On 24.02.2016, at 21:26, Linus Torvalds <<a href="mailto:torvalds@linux-foundation.org" target="_blank">torvalds@linux-foundation.org</a>> wrote:</div><br><div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">On Wed, Feb 24, 2016 at 12:15 PM, Robert Helling <</span><a href="mailto:helling@atdotde.de" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">helling@atdotde.de</a><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">> wrote:</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>and in fact, Robert is looking into this issue. He decided to get the<br>physics (somewhat) right by using a van der Waals (or related) equation<br>rather than a random fit function but still has to do a bit of math before a<br>patch is coming.<br></blockquote><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Heh. That may be overkill.</span></div></blockquote></div><br></div></span><div>After spending some hours with this and mathematica, I realized that this is in fact a waste of time since it gets the difference of the factor from 1 significantly wrong in the parameter range we are interested in. But the Redlich-Kwong-equation (of whose existence I learned from wikipedia) does a much better job numerically. So here is a patch that implements it. This equation is a cubic equation for Z, so I decided to solve it iteratively (three iterations seem to be good enough).</div><div><br></div></div></blockquote><div><br></div><div>Introducing an improved equation that considers temperature raises the question of what temperature should be used.  As the temperature of the gas in the cylinder isn't monitored, there's no correct answer.  Your patch uses dive->airtemp, which I assume is the surface temperature (I'm at work now and not looking through the code to check).  At the start of the dive that is reasonable, unless the cylinder has just been filled, but after a few minutes, it's probably much closer to the water temperature.  Diving here in summer, the difference can be significant (say 35 C on the surface, 17 C in the water).</div><div><br></div><div>Of course, the difference isn't really terribly significant compared to the accuracy of the gauge (just because an air integrated dive computer reports pressure to nearest 0.1bar / 1 psi doesn't means it's that accurate), and even the tolerances of cylinder volume.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div></div><div></div></div><br><div style="word-wrap:break-word"><div></div><div><br></div><div>From what I learned, this is all black magic when it comes too mixtures of gases (like air or trimix) but the standard approach is to go via critical values and for those compute weighted averages. There is a whole industry for these real gas calculations as those are quite important for the oil/gas industry.</div><div><br></div><div>Best</div><div>Robert</div></div><br>_______________________________________________<br>
subsurface mailing list<br>
<a href="mailto:subsurface@subsurface-divelog.org">subsurface@subsurface-divelog.org</a><br>
<a href="http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface" rel="noreferrer" target="_blank">http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface</a><br>
<br></blockquote></div><br></div></div>