[PATCH 2/2] gas model: replace Redlich-Kwong with least-square quintic

Lubomir I. Ivanov neolit123 at gmail.com
Thu Mar 3 02:46:33 PST 2016


On 3 March 2016 at 05:15, Linus Torvalds <torvalds at linux-foundation.org> wrote:
> On Wed, Mar 2, 2016 at 6:45 PM, Linus Torvalds
> <torvalds at linux-foundation.org> wrote:
>>
>> But having looked at the profiles, the "nosedive" happens closer to
>> 450 bar (and only for oxygen at that).  And it may not be great at 400
>> bar, but it's not a disaster.
>
> Google is actually better at graphing this than wolfram alpha. Wolfram
> has some low limit on the size of the cut-and-paste.
>
> I pasted this nasty-ass expression into google:
>
>  y = 1.0002556612420115-0.0003115084635183305*x+0.00000227808965401253*x^2+1.91596422989e-9*x^3-8.78421542e-12*x^4+6.77746e-15*x^5
>      -0.21*(1.0002231211532653-0.0007471497056767194*x+0.00000200444854807816*x^2+2.91501995188e-9*x^3-4.48294663e-12*x^4-6.11529e-15*x^5)
>      -0.79*(1.0001898816185364-0.00030793319362077315*x+0.00000327557417347714*x^2-1.93872574476e-9*x^3-2.7732353e-12*x^4-2.8921e-16*x^5)
> from 0 to 500
>
> which is the difference between our air polynomial (good to 500 bar)
> and the linear combination of the oxygen and nitrogen polynomials
> (each should be good to ~275 bar).
>
> The thing actually looks *really* good. The difference is basically
> less than 0.005 up to 200 bar.
>
> Even up to 275 bar, the error is less than one percentage point. Now,
> notice the difference between "one percent" and "one percentage
> _point_".
>
> At 275 bar, the real Z factor should be 1.087 according to Wikipedia.
> The linear mixing gives us 1.078.
>
> However, even that almost one percentage point difference turns out to
> be not because the linear mixing doesn't work. Just taking the _air_
> plots from baue.org shows that baue says 1.079 for air at 275.
>
> So the linear mixing actually matches the baue air compressibility
> factor almost exactly. It's just that baue.org and the Wikipedia
> tables don't agree at 275 bar.
>

like you said in the other thread, the AIR @ baue.org could be an
actual gas mix calculation.
being able to skip one measurement is a pretty big time saver for the
one who is doing the quantization.

> And then it starts growing, but at t 300 bar the difference is still
> just 0.012. So it's one percentage point off: the proper Z factor
> value for air is 1.108, and the "linear mixing" version is at 1.097.
> That strikes me as "not perfect, but it's damn close to good".
>
> At 400 bar, we're about 4 percentage points off, which is not great
> (the real Z factor is 1.20, the linear mixing is at just 1.166).  I
> suspect the linear mixing is still reasonably fine, and we're seeing
> an effect of the curve fitting starting to fail more.
>
> At 500 bar, the error is big. I still don't blame the linear mixing,
> that's just the Oxygen curve that is way off at that point because the
> last table point was 275 bar.
>

things are looking good, up to the reasonable ranges.
i'm sorry i didn't do the mix comparison, but it was 4-5AM already.

> My takeaway from this:
>
>  - the linear mixing seems to work very well at least for air.
>
>  - it starts getting less precise at some point past 200 bar, but even
> at 300 bar the error is arguably more due to the difference from
> Wikipedia to Baue rather than anything else.
>
>  - google is pretty good at graphing, and it's pretty easy to just
> cut-and-paste your functions like the above.
>
> Anyway, it all looks quite reasonable. I have very little reason to
> believe that the code doesn't give us way more accuracy than anybody
> will ever need.
>

just in case, i've just emailed the chief science officer @ baue.org
to see if the have some more secret data - i.e. just a single
measurement at 500 bars for all gases would make all the functions
marginally better. but, i have the suspicion that they took the data
from a website which isn't online anymore.

lubomir
--


More information about the subsurface mailing list