On 26 February 2016 at 09:30, Robert Helling <[email protected]> wrote:
> Hi, > > On 24.02.2016, at 21:26, Linus Torvalds <[email protected]> > wrote: > > On Wed, Feb 24, 2016 at 12:15 PM, Robert Helling <[email protected]> > wrote: > > > and in fact, Robert is looking into this issue. He decided to get the > physics (somewhat) right by using a van der Waals (or related) equation > rather than a random fit function but still has to do a bit of math before > a > patch is coming. > > > Heh. That may be overkill. > > > 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). > > 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). 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. > > > 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. > > Best > Robert > > _______________________________________________ > subsurface mailing list > [email protected] > http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface > >
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
