[PATCH] Re: New Bug Reports/Feature Requests

Robert Helling helling at atdotde.de
Wed Mar 2 13:24:41 PST 2016


Good evening,

> On 02.03.2016, at 18:44, Linus Torvalds <torvalds at linux-foundation.org> wrote:
> 
> On Wed, Mar 2, 2016 at 9:25 AM, Dirk Hohndel <dirk at hohndel.org> wrote:
>> 
>> So since Robert's formula /should/ be the right way to calculate the
>> compensation factors, let's figure out what about it is broken and use
>> "matches the wikipedia data" as a measuring stick for that.

I think (unless my implementation is wrong),this is as good as it gets with a two parameter model that is also not particularly tuned to our use case of air-like gases at 300K with 1–300bar pressure.

> 
> Well, the thing is, Robert's formula isn't actually physical, it's
> fundamentally an approximation too.
> 
> In fact, it's arguably much less physical than the van der Waals
> equation, that at least tries to model the physical behavior, while
> afaik the Redlich–Kwong equation is _purely_ an empirical
> approximation.
> 
> The first paragraph in the wikipedia page really does sum it up:
> 
>  https://en.wikipedia.org/wiki/Redlich%E2%80%93Kwong_equation_of_state
> 
> so to some degree, Lubomirs least-square polynomial would actually be
> superior: it is the same kind of approximation, but it's an
> approximation that has been specialized for one particular gas and
> pressure/temperature range we happen to care about.
> 
> The Redlich–Kwong equation is intended to be much more general, but
> exactly because of that it's much less accurate at least for one case
> we care about.
> 
> Side note: according to Wikipedia there are various newer refined
> versions with more complexity (and some with more per-gas constants).
> So it's possible that we could still get it all - both the "multiple
> gases" _and_ "sufficient accuracy“.

I really don’t know what is the correct approach.

First of all, all this compressibility business is really a small effect and we are talking about small differences here, so all of this is somewhat academic, in particular as Linus has pointed out that we always ignore the effect of gas temperature which can be as much as 15%..

The other thing to say is, after rereading the wikipedia page I realized that I was getting the calculation for mixtures wrong. I had assumed that it works like for van der Waals that you are supposed to take weighted averages of the critical data, but you don’t. But the difference this makes for air is much smaller than the difference to the empirical numbers. With the corrected procedure for mixtures I also calculated the curve for some typical trimix to see how important the effect of the gas composition is. Turns out, it is 3-4 times the difference between the table data and the computed Z. Or put differently: This is more significant than the difference between measured and modeled Z’s. Or: Taking the tabulated values for air and pretend they are the same for trimix gives an error 3-4 times the error from using the model for air.

As Linus said correctly, this model is semi-empirical, it uses some physical intuition about the general form of the correction but then plugs in measured values (and it is supposed to hold also in a regime where the gas is close to liquid). But there are only two per gas but this might be an aesthetic point.

The problem is that beyond the air table from wikipedia, we (or at least I) don’t really have empirical data. We don’t know how to extrapolate to other gases or we don’t know what to match or which values to take for models with more parameters.

I think what we need here is an executive decision from our beloved maintainer: How do you want to proceed, there are essentially three options: Linus’ table interpolation, Lubomir’s quadratic fit to that table which both cannot handle other gases than air or this semi-empirical model with its intrinsic error (in which case I would provide a new patch to get the mixing right, the above mentioned calculation is in mathematica). All have advantages and disadvantages.

best
Robert

PS: And, yes, I am quite disappointed how bad actually the theoretical models like van der Waals and this fit the data. This I did not expect when I started looking into this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160302/58a27176/attachment.sig>


More information about the subsurface mailing list