cuft_to_l

Linus Torvalds torvalds at linux-foundation.org
Tue Jul 31 15:29:41 PDT 2012


On Tue, Jul 31, 2012 at 3:19 PM, Lutz Vieweg <lvml at 5t9.de> wrote:
> Admittedly, my preference for SI units will never lead me down that code
> path,
> but as a physicist, I feel obliged to raise a formal protest against the
> existence
> of the function "cuft_to_l" in subsurface: This function claims to convert
> an
> (obsolete) measure of quantity of gas into a measure of volume, which is
> impossible.

Don't be silly. cuft = ft^3, which is a perfectly fine measure of
volume. Admittedly it's a *crazy* measure of volume, but it's
well-defined.

Ask google. Just do "cubic feet to liter" and it will tell you that
one cubic foot is about 28 l. Which is very true. One liter is a cube
of 0.1m, exactly the same way one cubig foot is a cube of 1ft.

One foot is 3.048 dm, so one cubic foot is 3.048^3 liter.

As a physicist, you should know that. It's a very straightforward
change of measurement.

Now, it's true that in *diving*, "cuft" means something else than the
"cuft_to_l()" function calculates, and that needs pressure etc. But
that's irrelevant. That's not what cuft_to_l() calculates. The full
calculation is always something like

        if (pressure && output_units.volume == CUFT) {
                volume = cuft_to_l(volume);
                volume /= bar_to_atm(pressure);
        }

but the "cuft_to_l()" part is damn well specified.

(What is *not* very well specified is what "pressure" means. Is it
gauge pressure or absolute pressure? We don't end up caring, because
the difference for the range of cylinder pressures is in the 0.5%
range, which is smaller than all the other confusions that the crazy
imperial model has.

            Linus


More information about the subsurface mailing list