Boost logo

Boost Users :

Subject: Re: [Boost-users] units use and weird cases....suggestions needed
From: Matthias Schabel (boost_at_[hidden])
Date: 2009-09-09 13:38:27


> I'll try, but I'm not an engineer.
>
> I believe the "flow coefficient" (Kv) is mostly used in calculating
> flow through valves and fittings. It has a relationship with a
> "resistance coefficient" (K) in that:
>
> K = C1 * pi^2 * d^4 / Kv^2
> Kv = C2 * pi * d^2 / K^.5
>
> d is the valve diameter. C1 and C2 are really large numbers.
>
> The volumetric flow (Q) can then be found:
>
> Q = C * Kv * ( dP / p )^.5
>
> Where C is a constant, dP is a pressure, and p is a density.
>
> That equation might look a bit different for SI (that's in some set
> of US units, not necessarily a true system) but the point is that Kv
> will still be in cubic meters per hour. TP410 states, "At the time
> of preparation of this paper there is no agreed international
> definition for flow coefficient in the terms of SI units." That was
> 50 years ago or something and it's not changed.

Without referring to any particular unit system, you can see that Kv
has to have units of

U{Kv} = U{Q}/U{(dP/p)^.5}
           = (L^3/T)/((M/(L T^2))/(M/L^3))^.5
           = L^2

so your flow coefficient needs to have units of area. To get a correct
numerical value, you should just implement the internals of the
function so that the various inputs are converted to the units in
which the equation was defined originally...say you know that Kv is
0.42 (random choice) for flow in gallons per minute, pressure in psi,
and density in pounds/cubic inch. Then you can just convert Kv into SI
units (hack for definition of pounds-force per square inch - I'll add
those for the next release)...

#include <boost/units/cmath.hpp>
#include <boost/units/systems/si.hpp>
#include <boost/units/io.hpp>
#include <boost/units/base_units/metric/minute.hpp>
#include <boost/units/base_units/us/inch.hpp>
#include <boost/units/base_units/us/gallon.hpp>
#include <boost/units/base_units/us/pound.hpp>
#include <iostream>

using namespace boost::units;
using namespace std;

int main()
{
        //(4.448222*si::newtons/(pow<2>(us::inch_base_unit::unit_type()))
        //(us::pound_base_unit::unit_type()/
pow<3>(us::inch_base_unit::unit_type()))
     std::cout << (si::cubic_meters/si::second)/root<2>(si::pascals/
si::kilograms_per_cubic_meter) << std::endl;
     std::cout << (us::gallon_base_unit::unit_type()/
metric::minute_base_unit::unit_type())/root<2>((4.448222*si::newtons/
(pow<2>(us::inch_base_unit::unit_type()))/
(us::pound_base_unit::unit_type()/
pow<3>(us::inch_base_unit::unit_type())))) << std::endl;
     std::cout << quantity<si::area>(.
42*(us::gallon_base_unit::unit_type()/
metric::minute_base_unit::unit_type())/root<2>((4.448222*si::newtons/
(pow<2>(us::inch_base_unit::unit_type()))/
(us::pound_base_unit::unit_type()/
pow<3>(us::inch_base_unit::unit_type()))))) << std::endl;
}

giving

m^2
0.47414 gal lb^(1/2) in^(-1/2) m^(-1/2) kg^(-1/2) s min^-1
5.30926e-05 m^2

so if Kv is 0.42 in the originally specified units, it is 5.31x10^-5
in SI...

Matthias

>
> It should be possible to convert Kv into m3/s but the equations the
> engineers work in, and thus will be giving me and are in our
> sources, simply do not use this unit for that variable even if
> everything else is in SI.
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net