From 3c2e6d06bb1298b93dce2548bf90986c2a9900ae Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 13 Feb 2023 18:55:54 +0100 Subject: [PATCH] refactor: ISQ system refactored to benefit from the latest changes --- .../mp_units/systems/isq/electromagnetism.h | 2 +- .../include/mp_units/systems/isq/mechanics.h | 27 +++++++------------ .../mp_units/systems/isq/space_and_time.h | 12 ++++----- .../mp_units/systems/isq/thermodynamics.h | 12 ++++----- 4 files changed, 23 insertions(+), 30 deletions(-) diff --git a/src/systems/isq/include/mp_units/systems/isq/electromagnetism.h b/src/systems/isq/include/mp_units/systems/isq/electromagnetism.h index 88bdaac0..a9ae5a8f 100644 --- a/src/systems/isq/include/mp_units/systems/isq/electromagnetism.h +++ b/src/systems/isq/include/mp_units/systems/isq/electromagnetism.h @@ -22,10 +22,10 @@ #pragma once +#include #include #include #include -#include namespace mp_units::isq { diff --git a/src/systems/isq/include/mp_units/systems/isq/mechanics.h b/src/systems/isq/include/mp_units/systems/isq/mechanics.h index d8b14c4a..4b4e8e4b 100644 --- a/src/systems/isq/include/mp_units/systems/isq/mechanics.h +++ b/src/systems/isq/include/mp_units/systems/isq/mechanics.h @@ -22,9 +22,9 @@ #pragma once +#include #include #include -#include namespace mp_units::isq { @@ -37,10 +37,10 @@ QUANTITY_SPEC(surface_mass_density, mass / area); inline constexpr auto surface_density = surface_mass_density; QUANTITY_SPEC(linear_mass_density, mass / length); inline constexpr auto linear_density = linear_mass_density; -QUANTITY_SPEC(momentum, mass* velocity); // vector -QUANTITY_SPEC(force, mass* acceleration); // vector // TODO what is a correct equation here? -QUANTITY_SPEC(weight, force); // vector // TODO g? -QUANTITY_SPEC(static_friction_force, force); // vector +QUANTITY_SPEC(momentum, mass* velocity); // vector +QUANTITY_SPEC(force, mass* acceleration); // vector // TODO what is a correct equation here? +QUANTITY_SPEC(weight, force, mass* acceleration_of_free_fall); // vector // differs from ISO 80000 +QUANTITY_SPEC(static_friction_force, force); // vector inline constexpr auto static_friction = static_friction_force; QUANTITY_SPEC(kinetic_friction_force, force); // vector inline constexpr auto dynamic_friction_force = kinetic_friction_force; @@ -69,10 +69,8 @@ inline constexpr auto Young_modulus = modulus_of_elasticity; QUANTITY_SPEC(modulus_of_rigidity, shear_stress / shear_strain); inline constexpr auto shear_modulus = modulus_of_rigidity; QUANTITY_SPEC(modulus_of_compression, pressure / relative_volume_strain); -// QUANTITY_SPEC(modulus_of_compression, -pressure / relative_volume_strain); // TODO how to handle "negative" part inline constexpr auto bulk_modulus = modulus_of_compression; QUANTITY_SPEC(compressibility, 1 / volume * (volume / pressure)); -// QUANTITY_SPEC(compressibility, -1 / volume * (volume / pressure)); // TODO how to handle "negative" part QUANTITY_SPEC(second_axial_moment_of_area, pow<2>(radial_distance) * area); QUANTITY_SPEC(second_polar_moment_of_area, pow<2>(radial_distance) * area); QUANTITY_SPEC(section_modulus, second_axial_moment_of_area / radial_distance); @@ -83,20 +81,15 @@ QUANTITY_SPEC(kinetic_friction_factor, kinetic_friction_force / force, quantity_ inline constexpr auto dynamic_friction_factor = kinetic_friction_factor; QUANTITY_SPEC(rolling_resistance_factor, force / force, quantity_character::scalar); QUANTITY_SPEC(drag_coefficient, drag_force / (mass_density * pow<2>(speed) * area), quantity_character::scalar); -// QUANTITY_SPEC(drag_coefficient, mag<2>* drag_force / (mass_density * pow<2>(speed) * area), -// quantity_character::scalar); // TODO should we support that? inline constexpr auto drag_factor = drag_coefficient; QUANTITY_SPEC(dynamic_viscosity, shear_stress* length / velocity); QUANTITY_SPEC(kinematic_viscosity, dynamic_viscosity / mass_density); QUANTITY_SPEC(surface_tension, force / length, quantity_character::scalar); // TODO what is a correct equation here? QUANTITY_SPEC(power, force* velocity, quantity_character::scalar); -// QUANTITY_SPEC(energy, force* length); -QUANTITY_SPEC(potential_energy, mass* pow<2>(length) / pow<2>(time)); // TODO what is a correct equation here? -QUANTITY_SPEC(kinetic_energy, mass* pow<2>(speed)); -// QUANTITY_SPEC(kinetic_energy, mag<1, 2>* mass* pow<2>(speed)); // TODO should we support that? -// TODO how to implement that? -// QUANTITY_SPEC(mechanical_energy, potential_energy + kinetic_energy); -QUANTITY_SPEC(mechanical_energy, potential_energy); +QUANTITY_SPEC(energy, mass* pow<2>(length) / pow<2>(time)); // ISO 80000 defines this in thermodynamics +QUANTITY_SPEC(mechanical_energy, energy); // differs from ISO 80000 +QUANTITY_SPEC(potential_energy, mechanical_energy); // differs from ISO 80000 +QUANTITY_SPEC(kinetic_energy, mechanical_energy, mass* pow<2>(speed)); // differs from ISO 80000 QUANTITY_SPEC(mechanical_work, force* displacement, quantity_character::scalar); inline constexpr auto work = mechanical_work; QUANTITY_SPEC(efficiency_mechanics, power / power); @@ -104,6 +97,6 @@ QUANTITY_SPEC(mass_flow, mass_density* velocity); // vector QUANTITY_SPEC(mass_flow_rate, mass_flow* area, quantity_character::scalar); QUANTITY_SPEC(mass_change_rate, mass / time); QUANTITY_SPEC(volume_flow_rate, velocity* area, quantity_character::scalar); -QUANTITY_SPEC(action, mechanical_energy* time); +QUANTITY_SPEC(action, energy* time); } // namespace mp_units::isq diff --git a/src/systems/isq/include/mp_units/systems/isq/space_and_time.h b/src/systems/isq/include/mp_units/systems/isq/space_and_time.h index a84830ec..7b91c7d5 100644 --- a/src/systems/isq/include/mp_units/systems/isq/space_and_time.h +++ b/src/systems/isq/include/mp_units/systems/isq/space_and_time.h @@ -22,8 +22,8 @@ #pragma once -#include #include +#include namespace mp_units::isq { @@ -34,8 +34,7 @@ inline constexpr auto depth = height; inline constexpr auto altitude = height; QUANTITY_SPEC(thickness, width); QUANTITY_SPEC(diameter, width); -// QUANTITY_SPEC(radius, mag * diameter); // TODO should we support that? -QUANTITY_SPEC(radius, width); +QUANTITY_SPEC(radius, width); // differs from ISO 80000 QUANTITY_SPEC(path_length, length); inline constexpr auto arc_length = path_length; QUANTITY_SPEC(distance, path_length); @@ -52,9 +51,10 @@ inline constexpr auto angular_displacement = rotational_displacement; QUANTITY_SPEC(phase_angle, angular_measure); QUANTITY_SPEC(solid_angular_measure, area / pow<2>(radius)); inline constexpr auto duration = time; -QUANTITY_SPEC(velocity, position_vector / duration); // vector -QUANTITY_SPEC(speed, distance / duration); // TODO length, path_length? -QUANTITY_SPEC(acceleration, velocity / duration); // vector +QUANTITY_SPEC(speed, length / time); // differs from ISO 80000 +QUANTITY_SPEC(velocity, speed, position_vector / duration); // vector // differs from ISO 80000 +QUANTITY_SPEC(acceleration, velocity / duration); // vector +QUANTITY_SPEC(acceleration_of_free_fall, acceleration); // not in ISO 80000 QUANTITY_SPEC(angular_velocity, angular_displacement / duration, quantity_character::vector); QUANTITY_SPEC(angular_acceleration, angular_velocity / duration); QUANTITY_SPEC(period_duration, duration); diff --git a/src/systems/isq/include/mp_units/systems/isq/thermodynamics.h b/src/systems/isq/include/mp_units/systems/isq/thermodynamics.h index c91f005b..4dd3abd5 100644 --- a/src/systems/isq/include/mp_units/systems/isq/thermodynamics.h +++ b/src/systems/isq/include/mp_units/systems/isq/thermodynamics.h @@ -36,8 +36,8 @@ QUANTITY_SPEC(relative_pressure_coefficient, 1 / pressure * (pressure / thermody 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? +// energy definition moved to mechanics +QUANTITY_SPEC(heat, mass* pow<2>(length) / pow<2>(time)); // 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); @@ -61,12 +61,12 @@ QUANTITY_SPEC(isentropic_exponent, volume / pressure * (pressure / volume)); // 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); +QUANTITY_SPEC(enthalpy, energy); // differs from ISO 80000 +QUANTITY_SPEC(internal_energy, enthalpy); // differs from ISO 80000 inline constexpr auto thermodynamic_energy = internal_energy; -QUANTITY_SPEC(enthalpy, energy); -QUANTITY_SPEC(Helmholtz_energy, energy); +QUANTITY_SPEC(Helmholtz_energy, internal_energy); inline constexpr auto Helmholtz_function = Helmholtz_energy; -QUANTITY_SPEC(Gibbs_energy, energy); +QUANTITY_SPEC(Gibbs_energy, enthalpy); inline constexpr auto Gibbs_function = Gibbs_energy; QUANTITY_SPEC(specific_energy, energy / mass); QUANTITY_SPEC(specific_internal_energy, internal_energy / mass);