Added molar heat capacity

This commit is contained in:
rbrugo
2020-04-10 16:36:08 +02:00
committed by Mateusz Pusz
parent 7dda8319a2
commit 9ec5c77602
4 changed files with 24 additions and 1 deletions
+6
View File
@@ -149,6 +149,9 @@ struct dim_heat_capacity : derived_dimension<Child, U, exp<E, 1>, exp<T, -1>> {}
template<typename Child, Unit U, DimensionOf<dim_heat_capacity> C, DimensionOf<dim_mass> M>
struct dim_specific_heat_capacity : derived_dimension<Child, U, exp<C, 1>, exp<M, -1>> {};
template<typename Child, Unit U, DimensionOf<dim_heat_capacity> C, DimensionOf<dim_substance> M>
struct dim_molar_heat_capacity : derived_dimension<Child, U, exp<C, 1>, exp<M, -1>> {};
template<typename Child, Unit U, DimensionOf<dim_power> P, DimensionOf<dim_length> L, DimensionOf<dim_thermodynamic_temperature> T>
struct dim_thermal_conductivity : derived_dimension<Child, U, exp<P, 1>, exp<L, -1>, exp<T, -1>> {};
@@ -280,6 +283,9 @@ concept HeatCapacity = physical::QuantityOf<T, physical::dim_heat_capacity>;
template<typename T>
concept SpecificHeatCapacity = physical::QuantityOf<T, physical::dim_specific_heat_capacity>;
template<typename T>
concept MolarHeatCapacity = physical::QuantityOf<T, physical::dim_molar_heat_capacity>;
template<typename T>
concept ThermalConductivity = physical::QuantityOf<T, physical::dim_thermal_conductivity>;
@@ -26,15 +26,18 @@
#include <units/physical/si/temperature.h>
#include <units/physical/si/energy.h>
#include <units/physical/si/mass.h>
#include <units/physical/si/substance.h>
#include <units/quantity.h>
namespace units::si {
struct joule_per_kelvin : unit<joule_per_kelvin> {};
struct joule_per_kilogram_kelvin : unit<joule_per_kilogram_kelvin> {};
struct joule_per_mole_kelvin : unit<joule_per_mole_kelvin> {};
struct dim_heat_capacity : physical::dim_heat_capacity<dim_heat_capacity, joule_per_kelvin, dim_energy, dim_thermodynamic_temperature> {};
struct dim_specific_heat_capacity : physical::dim_specific_heat_capacity<dim_specific_heat_capacity, joule_per_kilogram_kelvin, dim_heat_capacity, dim_mass> {};
struct dim_molar_heat_capacity : physical::dim_molar_heat_capacity<dim_molar_heat_capacity, joule_per_mole_kelvin, dim_heat_capacity, dim_substance> {};
template<Unit U, Scalar Rep = double>
using heat_capacity = quantity<dim_heat_capacity, U, Rep>;
@@ -42,6 +45,9 @@ using heat_capacity = quantity<dim_heat_capacity, U, Rep>;
template<Unit U, Scalar Rep = double>
using specific_heat_capacity = quantity<dim_specific_heat_capacity, U, Rep>;
template<Unit U, Scalar Rep = double>
using molar_heat_capacity = quantity<dim_molar_heat_capacity, U, Rep>;
inline namespace literals {
// J/K
@@ -52,6 +58,10 @@ constexpr auto operator"" q_J_per_K(long double l) { return heat_capacity<joule_
constexpr auto operator"" q_J_per_kg_K(unsigned long long l) { return specific_heat_capacity<joule_per_kilogram_kelvin, std::int64_t>(l); }
constexpr auto operator"" q_J_per_kg_K(long double l) { return specific_heat_capacity<joule_per_kilogram_kelvin, long double>(l); }
// J/(mol·K)
constexpr auto operator"" q_J_per_mol_K(unsigned long long l) { return molar_heat_capacity<joule_per_mole_kelvin, std::int64_t>(l); }
constexpr auto operator"" q_J_per_mol_K(long double l) { return molar_heat_capacity<joule_per_mole_kelvin, long double>(l); }
} // namespace literals
} // namespace units::si