nholthaus / units

a compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies.
http://nholthaus.github.io/units/
MIT License
962 stars 137 forks source link

defining and using kmol units #232

Open a-jp opened 5 years ago

a-jp commented 5 years ago

Hi, I would like to use your library in combination with Cantera. Cantera is SI but uses kmol as the mass-based unit rather than mol. Can I ask for a short stub of code to show how to set up define and use kmol units?

A standard use case would be a value returned from Cantera in J/kmol and a value returned in kg/kmol dividing the former by the latter to get a mass-specific quantity in J/kg. I'm not asking for an example using Cantera, just new to the library and don't know how to work with and define kg/kmol and kmol units for use as per the above.

Thanks, Andy

a-jp commented 4 years ago

Hi,

I've noticed a huge increase in activity on this repo which is great. I really like it. I'd been keen to still get some help with the issue posted here. Any thoughts?

Thanks Andy

cb-therm commented 4 years ago

Check out https://github.com/nholthaus/units#defining-new-units. Probably something like using kmol = units::unit<std::ratio<1000>, units::substance::mol>

nholthaus commented 3 years ago

This will get first class support in 3.0