Boost logo

Boost Users :

Subject: Re: [Boost-users] [units] Calculating air density
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2015-08-09 13:32:15


On Sun, Aug 9, 2015 at 11:16 AM, Michael Powell <mwpowellhtx_at_[hidden]> wrote:
> Hello,
>
> I'd like to calculate air density at altitude. Studying some notes on wikipedia:

I am trying to derived a "specific gas constant" dimension, and
corresponding units: usually in the form of (J/(kg K)).

Mass and temperature dimensions are simple enough to build upon.

However, energy? Not so much, or perhaps there is a better way that I
am not grasping.

/// derived dimension for specific gas constant : J M^-1 Theta^-1
typedef derived_dimension<energy_dimension,1,
                          mass_base_dimension,-1,
                          temperature_base_dimension,-1>
specific_gas_constant_dimension;

Which is yielding some errors, this and a host of others:

Error 19 error C2039: 'tag_type' : is not a member of
'boost::units::derived_dimension<boost::units::energy_dimension,1,boost::units::mass_base_dimension,-1,boost::units::temperature_base_dimension,-1,boost::units::dimensionless_type,0,boost::units::dimensionless_type,0,boost::units::dimensionless_type,0,boost::units::dimensionless_type,0,boost::units::dimensionless_type,0>'
I:\Source\Boost.org\boost_1_58_0\installed\x64\include\boost-1_58\boost\units\detail\linear_algebra.hpp
701 1 Kingdom.Physics.Calculators

My guess is for deriving a dimension from a derived dimension? Is
there a better dimension to use for the energy component?

Or am I wasting time trying to setup a dimension and I should simply
build the units themselves?

Or, do I really need to string together all the dimensions that
constitute the energy dimension? or Joules ?

I suppose, consistent with the m.o. of consistency over convenience ...

Thank you...

> https://en.wikipedia.org/wiki/Density_of_air
>
> Symbol is typically Greek Rho, whose dimensions are generally M/L^3;
> units will probably be kg/m^3, although I am also reading about
> slugs/ft^3.
>
> Which incorporates a gas constant value:
>
> http://en.wikipedia.org/wiki/Gas_constant
>
> Whose units appear to be Joules/(Volume*Temp).
>
> I'm not seeing anything too terribly exotic there; all these units /
> dimensions are present in Boost.Units?
>
> As is usually the case, it is interesting to see how the units library
> "reduces" the units during code writing, compilation. Very impressive
> indeed.
>
> Thank you...
>
> Best regards,
>
> Michael Powell


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