Boost logo

Boost Users :

Subject: [Boost-users] boost::units primer explained / conversion factors required
From: Michael Powell (mwpowellnm_at_[hidden])
Date: 2011-07-21 18:16:37

Okay, here's what we need to get at, for starters. And maybe an illustration
or three and a little exchange will go a long way towards helping my better
comprehend units.

I'm starting with a set of SI calculations for oil and gas constants
calculations. Eventually we will need to accommodate US units as well. But
not quite yet.

We need to get at a calculation involving Pressure Gradient, which ends up
being metric::bar/si::meter (bars over meters) in specific units, or I
suppose si::pressure/si::length might also work.

Then we need to get after Fluid Density, which ends up being
si::kilogram/si:meter^3 (kilograms over cubic meters) in specific units, or
I suppose si::mass/si::meter^3 (I don't know what this looks like in terms
of boost::units, maybe one of the volumes?), or perhaps make use of

We take all that and divide Pressure Gradient by Fluid Density to arrive at
what we hope will be the the conversion factor: 0.0000981. Which we could
specify that as a constant, but I like proving it through the software first
(plausibly once) when we ask for it.

Similar type calculations would follow for US units involving gallons, cubic
inches, inches, and inches per foot, along these lines.

So I need some examples will spell it out for me. The learning curve using
boost::units is just too steep for me right now without it.

Any tips or pointers along these lines would be much appreciated.

Thank you,


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at