mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-06 13:44:27 +02:00
feat: thermodynamics quantity specifications added
This commit is contained in:
@@ -22,18 +22,77 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <units/dimension.h>
|
||||
#include <units/isq/base_quantities.h>
|
||||
#include <units/isq/mechanics.h>
|
||||
#include <units/isq/space_and_time.h>
|
||||
#include <units/quantity_spec.h>
|
||||
|
||||
namespace units::isq {
|
||||
|
||||
// inline constexpr struct thermodynamic_temperature : base_dimension<"Θ"> {} thermodynamic_temperature;
|
||||
// TODO Celsius temperature???
|
||||
|
||||
// DERIVED_DIMENSION(mass_density, decltype(mass / volume));
|
||||
|
||||
|
||||
// DERIVED_DIMENSION(energy, decltype(force * length)); // defined in a mechanics header
|
||||
QUANTITY_SPEC(Celsius_temperature, thermodynamic_temperature); // TODO should we account for T0 here?
|
||||
QUANTITY_SPEC(linear_expansion_coefficient, 1 / length * (length / thermodynamic_temperature));
|
||||
QUANTITY_SPEC(cubic_expansion_coefficient, 1 / volume * (volume / thermodynamic_temperature));
|
||||
QUANTITY_SPEC(relative_pressure_coefficient, 1 / pressure * (pressure / thermodynamic_temperature));
|
||||
QUANTITY_SPEC(pressure_coefficient, pressure / thermodynamic_temperature);
|
||||
QUANTITY_SPEC(isothermal_compressibility, 1 / volume * (volume / pressure)); // TODO how to handle "negative" part
|
||||
QUANTITY_SPEC(isentropic_compressibility, 1 / volume * (volume / pressure)); // TODO how to handle "negative" part
|
||||
QUANTITY_SPEC(energy, mass* pow<2>(length) / pow<2>(time));
|
||||
QUANTITY_SPEC(heat, energy); // TODO what is a correct equation here?
|
||||
inline constexpr auto amount_of_heat = heat;
|
||||
QUANTITY_SPEC(latent_heat, heat); // TODO what is a correct equation here?
|
||||
QUANTITY_SPEC(heat_flow_rate, heat / time);
|
||||
QUANTITY_SPEC(density_of_heat_flow_rate, heat_flow_rate / area);
|
||||
QUANTITY_SPEC(thermal_conductivity, density_of_heat_flow_rate*(length / thermodynamic_temperature));
|
||||
QUANTITY_SPEC(coefficient_of_heat_transfer, density_of_heat_flow_rate / thermodynamic_temperature);
|
||||
QUANTITY_SPEC(surface_coefficient_of_heat_transfer, density_of_heat_flow_rate / thermodynamic_temperature);
|
||||
QUANTITY_SPEC(thermal_insulance, 1 / coefficient_of_heat_transfer);
|
||||
inline constexpr auto coefficient_of_thermal_insulance = thermal_insulance;
|
||||
QUANTITY_SPEC(thermal_resistance, thermodynamic_temperature / heat_flow_rate);
|
||||
QUANTITY_SPEC(thermal_conductance, 1 / thermal_resistance);
|
||||
QUANTITY_SPEC(heat_capacity, heat / thermodynamic_temperature);
|
||||
QUANTITY_SPEC(specific_heat_capacity, heat_capacity / mass);
|
||||
QUANTITY_SPEC(specific_heat_capacity_at_constant_pressure, specific_heat_capacity);
|
||||
QUANTITY_SPEC(specific_heat_capacity_at_constant_volume, specific_heat_capacity);
|
||||
QUANTITY_SPEC(specific_heat_capacity_at_saturated_vapour_pressure, specific_heat_capacity);
|
||||
QUANTITY_SPEC(thermal_diffusivity, thermal_conductivity / (mass_density * specific_heat_capacity_at_constant_pressure));
|
||||
QUANTITY_SPEC(ratio_of_specific_heat_capacities,
|
||||
specific_heat_capacity_at_constant_pressure / specific_heat_capacity_at_constant_volume);
|
||||
QUANTITY_SPEC(isentropic_exponent, volume / pressure * (pressure / volume)); // TODO how to handle "negative" part
|
||||
inline constexpr auto isentropic_expansion_factor = isentropic_exponent;
|
||||
QUANTITY_SPEC(entropy, kinetic_energy / thermodynamic_temperature);
|
||||
QUANTITY_SPEC(specific_entropy, entropy / mass);
|
||||
QUANTITY_SPEC(internal_energy, energy);
|
||||
inline constexpr auto thermodynamic_energy = internal_energy;
|
||||
QUANTITY_SPEC(enthalpy, energy);
|
||||
QUANTITY_SPEC(Helmholtz_energy, energy);
|
||||
inline constexpr auto Helmholtz_function = Helmholtz_energy;
|
||||
QUANTITY_SPEC(Gibbs_energy, energy);
|
||||
inline constexpr auto Gibbs_function = Gibbs_energy;
|
||||
QUANTITY_SPEC(specific_energy, energy / mass);
|
||||
QUANTITY_SPEC(specific_internal_energy, internal_energy / mass);
|
||||
inline constexpr auto specific_thermodynamic_energy = specific_internal_energy;
|
||||
QUANTITY_SPEC(specific_enthalpy, enthalpy / mass);
|
||||
QUANTITY_SPEC(specific_Helmholtz_energy, Helmholtz_energy / mass);
|
||||
inline constexpr auto specific_Helmholtz_function = specific_Helmholtz_energy;
|
||||
QUANTITY_SPEC(specific_Gibbs_energy, Gibbs_energy / mass);
|
||||
inline constexpr auto specific_Gibbs_function = specific_Gibbs_energy;
|
||||
QUANTITY_SPEC(Massieu_function, Helmholtz_energy / thermodynamic_temperature); // TODO how to handle "negative" part
|
||||
QUANTITY_SPEC(Planck_function, Gibbs_energy / thermodynamic_temperature); // TODO how to handle "negative" part
|
||||
QUANTITY_SPEC(Joule_Thomson_coefficient, thermodynamic_temperature / pressure);
|
||||
QUANTITY_SPEC(efficiency_thermodynamics, work / heat);
|
||||
QUANTITY_SPEC(maximum_efficiency, thermodynamic_temperature / thermodynamic_temperature);
|
||||
QUANTITY_SPEC(specific_gas_constant, entropy / mass);
|
||||
QUANTITY_SPEC(mass_concentration_of_water, mass / volume);
|
||||
QUANTITY_SPEC(mass_concentration_of_water_vapour, mass / volume);
|
||||
QUANTITY_SPEC(mass_ratio_of_water_to_dry_matter, mass / mass);
|
||||
QUANTITY_SPEC(mass_ratio_of_water_vapour_to_dry_gas, mass / mass);
|
||||
QUANTITY_SPEC(mass_fraction_of_water, mass_ratio_of_water_to_dry_matter / mass_ratio_of_water_to_dry_matter);
|
||||
QUANTITY_SPEC(mass_fraction_of_dry_matter, mass_fraction_of_water);
|
||||
QUANTITY_SPEC(relative_humidity, pressure / pressure);
|
||||
QUANTITY_SPEC(relative_mass_concentration_of_vapour,
|
||||
mass_concentration_of_water_vapour / mass_concentration_of_water_vapour);
|
||||
QUANTITY_SPEC(relative_mass_ratio_of_vapour,
|
||||
mass_ratio_of_water_vapour_to_dry_gas / mass_ratio_of_water_vapour_to_dry_gas);
|
||||
QUANTITY_SPEC(dew_point_temperature, thermodynamic_temperature);
|
||||
|
||||
} // namespace units::isq
|
||||
|
@@ -161,4 +161,68 @@ static_assert(verify(isq::mass_change_rate, scalar, kg / s));
|
||||
static_assert(verify(isq::volume_flow_rate, scalar, m3 / s));
|
||||
static_assert(verify(isq::action, scalar, J* s, kg* m2 / s));
|
||||
|
||||
// thermodynamics
|
||||
static_assert(verify(isq::thermodynamic_temperature, scalar, K));
|
||||
static_assert(verify(isq::Celsius_temperature, scalar, deg_C));
|
||||
static_assert(verify(isq::linear_expansion_coefficient, scalar, 1 / K));
|
||||
static_assert(verify(isq::cubic_expansion_coefficient, scalar, 1 / K));
|
||||
static_assert(verify(isq::relative_pressure_coefficient, scalar, 1 / K));
|
||||
static_assert(verify(isq::pressure_coefficient, scalar, Pa / K, kg / m / s2 / K));
|
||||
static_assert(verify(isq::isothermal_compressibility, scalar, 1 / Pa, m* s2 / kg));
|
||||
static_assert(verify(isq::isentropic_compressibility, scalar, 1 / Pa, m* s2 / kg));
|
||||
static_assert(verify(isq::heat, scalar, J, kg* m2 / s2));
|
||||
static_assert(verify(isq::amount_of_heat, scalar, J, kg* m2 / s2));
|
||||
static_assert(verify(isq::latent_heat, scalar, J, kg* m2 / s2));
|
||||
static_assert(verify(isq::heat_flow_rate, scalar, W, J / s, kg* m2 / s3));
|
||||
static_assert(verify(isq::density_of_heat_flow_rate, scalar, W / m2, kg / s3));
|
||||
static_assert(verify(isq::thermal_conductivity, scalar, W / (m * K), kg* m / s3 / K));
|
||||
static_assert(verify(isq::coefficient_of_heat_transfer, scalar, W / (m2 * K), kg / s3 / K));
|
||||
static_assert(verify(isq::surface_coefficient_of_heat_transfer, scalar, W / (m2 * K), kg / s3 / K));
|
||||
static_assert(verify(isq::thermal_insulance, scalar, m2* K / W, s3* K / kg));
|
||||
static_assert(verify(isq::thermal_resistance, scalar, K / W, s3* K / kg / m2));
|
||||
static_assert(verify(isq::thermal_conductance, scalar, W / K, kg* m2 / s3 / K));
|
||||
static_assert(verify(isq::thermal_diffusivity, scalar, m2 / s));
|
||||
static_assert(verify(isq::heat_capacity, scalar, J / K, kg* m2 / s2 / K));
|
||||
static_assert(verify(isq::specific_heat_capacity, scalar, J / (kg * K), m2 / s2 / K));
|
||||
static_assert(verify(isq::specific_heat_capacity_at_constant_pressure, scalar, J / (kg * K), m2 / s2 / K));
|
||||
static_assert(verify(isq::specific_heat_capacity_at_constant_volume, scalar, J / (kg * K), m2 / s2 / K));
|
||||
static_assert(verify(isq::specific_heat_capacity_at_saturated_vapour_pressure, scalar, J / (kg * K), m2 / s2 / K));
|
||||
static_assert(verify(isq::ratio_of_specific_heat_capacities, scalar, one));
|
||||
static_assert(verify(isq::isentropic_exponent, scalar, one));
|
||||
static_assert(verify(isq::isentropic_expansion_factor, scalar, one));
|
||||
static_assert(verify(isq::entropy, scalar, J / K, kg* m2 / s2 / K));
|
||||
static_assert(verify(isq::specific_entropy, scalar, J / (kg * K), m2 / s2 / K));
|
||||
static_assert(verify(isq::energy, scalar, J, kg* m2 / s2));
|
||||
static_assert(verify(isq::internal_energy, scalar, J, kg* m2 / s2));
|
||||
static_assert(verify(isq::thermodynamic_energy, scalar, J, kg* m2 / s2));
|
||||
static_assert(verify(isq::enthalpy, scalar, J, kg* m2 / s2));
|
||||
static_assert(verify(isq::Helmholtz_energy, scalar, J, kg* m2 / s2));
|
||||
static_assert(verify(isq::Helmholtz_function, scalar, J, kg* m2 / s2));
|
||||
static_assert(verify(isq::Gibbs_energy, scalar, J, kg* m2 / s2));
|
||||
static_assert(verify(isq::Gibbs_function, scalar, J, kg* m2 / s2));
|
||||
static_assert(verify(isq::specific_energy, scalar, J / kg, m2 / s2));
|
||||
static_assert(verify(isq::specific_internal_energy, scalar, J / kg, m2 / s2));
|
||||
static_assert(verify(isq::specific_thermodynamic_energy, scalar, J / kg, m2 / s2));
|
||||
static_assert(verify(isq::specific_enthalpy, scalar, J / kg, m2 / s2));
|
||||
static_assert(verify(isq::specific_Helmholtz_energy, scalar, J / kg, m2 / s2));
|
||||
static_assert(verify(isq::specific_Helmholtz_function, scalar, J / kg, m2 / s2));
|
||||
static_assert(verify(isq::specific_Gibbs_energy, scalar, J / kg, m2 / s2));
|
||||
static_assert(verify(isq::specific_Gibbs_function, scalar, J / kg, m2 / s2));
|
||||
static_assert(verify(isq::Massieu_function, scalar, J / K, kg* m2 / s2 / K));
|
||||
static_assert(verify(isq::Planck_function, scalar, J / K, kg* m2 / s2 / K));
|
||||
static_assert(verify(isq::Joule_Thomson_coefficient, scalar, K / Pa, m* s2* K / kg));
|
||||
static_assert(verify(isq::efficiency_thermodynamics, scalar, one));
|
||||
static_assert(verify(isq::maximum_efficiency, scalar, one));
|
||||
static_assert(verify(isq::specific_gas_constant, scalar, J / (kg * K), m2 / s2 / K));
|
||||
static_assert(verify(isq::mass_concentration_of_water, scalar, kg / m3));
|
||||
static_assert(verify(isq::mass_concentration_of_water_vapour, scalar, kg / m3));
|
||||
static_assert(verify(isq::mass_ratio_of_water_to_dry_matter, scalar, one));
|
||||
static_assert(verify(isq::mass_ratio_of_water_vapour_to_dry_gas, scalar, one));
|
||||
static_assert(verify(isq::mass_fraction_of_water, scalar, one));
|
||||
static_assert(verify(isq::mass_fraction_of_dry_matter, scalar, one));
|
||||
static_assert(verify(isq::relative_humidity, scalar, one));
|
||||
static_assert(verify(isq::relative_mass_concentration_of_vapour, scalar, one));
|
||||
static_assert(verify(isq::relative_mass_ratio_of_vapour, scalar, one));
|
||||
static_assert(verify(isq::dew_point_temperature, scalar, K));
|
||||
|
||||
} // namespace
|
||||
|
Reference in New Issue
Block a user