On Sun, Aug 9, 2015 at 1:55 PM, Michael Powell
On Sun, Aug 9, 2015 at 1:32 PM, Michael Powell
wrote: On Sun, Aug 9, 2015 at 11:16 AM, Michael Powell
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
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_dimensionboost::units::energy_dimension,1,boost::units::mass_base_dimension,-1,boost:...' 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 ?
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 like this?
typedef derived_dimension
specific_gas_constant_dimension;
I persuaded the compilation to succeed with the following correction:
typedef derived_dimension
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
dry_air_ = 287.058*joules/(kilogram*kelvins); Or this for shorthand, with appropriate unit defined:
quantity
dry_air_ = 287.058*joules_per_kilogram_kelvins; 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