Opm::unit::convert Namespace Reference

Functions

double from (const double q, const double unit)
 
double to (const double q, const double unit)
 

Detailed Description

Unit conversion routines.

Function Documentation

double Opm::unit::convert::from ( const double  q,
const double  unit 
)
inline

Convert from external units of measurements to equivalent internal units of measurements. Note: The internal units of measurements are ALWAYS, and exclusively, SI.

Example: Convert a double kx, containing a permeability value in units of milli-darcy (mD) to the equivalent value in SI units (i.e., $m^2$).

using namespace Opm::unit;
using namespace Opm::prefix;
convert::from(kx, milli*darcy);
Parameters
[in]qPhysical quantity.
[in]unitPhysical unit of measurement.
Returns
Value of q in equivalent SI units of measurements.
double Opm::unit::convert::to ( const double  q,
const double  unit 
)
inline

Convert from internal units of measurements to equivalent external units of measurements. Note: The internal units of measurements are ALWAYS, and exclusively, SI.

Example: Convert a std::vector<double> p, containing pressure values in the SI unit Pascal (i.e., unit::Pascal) to the equivalent values in Psi (unit::psia).

using namespace Opm::unit;
std::transform(p.begin(), p.end(), p.begin(),
boost::bind(convert::to, _1, psia));
Parameters
[in]qPhysical quantity, measured in SI units.
[in]unitPhysical unit of measurement.
Returns
Value of q in unit unit.

Referenced by Opm::AdaptiveTimeStepping::stepImpl().