Boost Users :
Subject: Re: [Boost-users] [units] Calculating air density
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2015-08-09 13:55:06
On Sun, Aug 9, 2015 at 1:32 PM, Michael Powell <mwpowellhtx_at_[hidden]> wrote:
> On Sun, Aug 9, 2015 at 11:16 AM, Michael Powell <mwpowellhtx_at_[hidden]> wrote:
>> 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,
> Which is yielding some errors, this and a host of others:
> Error 19 error C2039: 'tag_type' : is not a member of
> 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 ?
Which, when I "do the math" on the dimensions, I'm not positive, but
the Mass components cancel themselves out (though their actual
quantities might not actually do so...), so I end up with something
Basically substituting and reducing from Joules (J) being energy,
which is M L^2 T^-2.
Which should happen when we say something like this:
quantity<specific_gas_constant> dry_air_ = 287.058*joules/(kilogram*kelvins);
Or this for shorthand, with appropriate unit defined:
quantity<specific_gas_constant> dry_air_ = 287.058*joules_per_kilogram_kelvins;
> I suppose, consistent with the m.o. of consistency over convenience ...
> Thank you...
>> 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
>> Which incorporates a gas constant value:
>> 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
>> 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