[PATCH] Re: New Bug Reports/Feature Requests

Linus Torvalds torvalds at linux-foundation.org
Fri Feb 26 08:41:28 PST 2016


On Thu, Feb 25, 2016 at 2:30 PM, Robert Helling <helling at atdotde.de> wrote:
>
> 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).

I actually think this patch is horribly and fundamentally broken.

If you take the temperature into account in calculating the Z factor,
you *also* need to take the temperature into account in calculating
the basic ideal gas volume!

You can't just do the Z factor, because that's just the _correction_
to the ideal gas law. The *non-correction* part of temperature from an
ideal gas law is actually likely to be much bigger, doing it in the Z
factor seems just wrong.

Quite frankly, I don't think we should look at temperature at all, and
just stick to the normal temperature in NTP (which I think is 20C -
300K really isn't too far off).

Note that we always translate the "surface volume" to the normal
pressure (1 atm) too, not to whatever surface pressure we have from
the dive computer).

So I'd personally be much happier just hardcoding 300K (or, if we want
to be more anal, 293K) than trying to do a temperature correction but
doing it badly.

Because even if we then fix up the ideal gas law calculation to also
look at temperature, we're still completely guessing at temperature.
Doing it by surface temp seems horribly wrong when the differences to
water temperature could easily be 15C or more.

That 15C is a ~5% difference in the ideal gas law calculations, so
it's not even a small effect (the effect on the Z correction is much
smaller, afaik).

                     Linus


More information about the subsurface mailing list