Skip to content

Commit

Permalink
refactor: some parameterized quantity specs renamed
Browse files Browse the repository at this point in the history
Relates to #475
  • Loading branch information
mpusz committed Aug 1, 2023
1 parent 092e156 commit ea6325a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ QUANTITY_SPEC(coupling_factor, dimensionless, mutual_inductance / pow<1, 2>(pow<
QUANTITY_SPEC(leakage_factor, dimensionless, pow<2>(coupling_factor));
QUANTITY_SPEC(conductivity, electric_current_density / electric_field_strength, quantity_character::scalar);
QUANTITY_SPEC(resistivity, 1 / conductivity);
// QUANTITY_SPEC(power, voltage* electric_current); // TODO conflicts with mechanical power
// inline constexpr auto instantaneous_power = power;
QUANTITY_SPEC(instantaneous_power, voltage* electric_current);
QUANTITY_SPEC(electromagnetism_power, power, voltage* electric_current);
inline constexpr auto instantaneous_power = electromagnetism_power;
QUANTITY_SPEC(resistance, voltage / electric_current);
QUANTITY_SPEC(conductance, 1 / resistance);
QUANTITY_SPEC(phase_difference, phase_angle);
Expand Down
11 changes: 6 additions & 5 deletions src/systems/isq/include/mp-units/systems/isq/mechanics.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,15 @@ inline constexpr auto drag_factor = drag_coefficient;
QUANTITY_SPEC(dynamic_viscosity, shear_stress* length / velocity, quantity_character::scalar);
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, 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(power, mass* pow<2>(length) / pow<3>(time)); // not in ISO 80000
QUANTITY_SPEC(mechanical_power, power, force* velocity, quantity_character::scalar);
QUANTITY_SPEC(energy, mass* pow<2>(length) / pow<2>(time)); // differs from ISO 80000 (defined 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);
QUANTITY_SPEC(mechanical_efficiency, mechanical_power / mechanical_power);
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ 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, dimensionless, work / heat);
QUANTITY_SPEC(thermodynamic_efficiency, dimensionless, 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);
Expand Down
6 changes: 3 additions & 3 deletions test/unit_test/static/isq_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ static_assert(verify(isq::kinetic_energy, scalar, J, kg* m2 / s2));
static_assert(verify(isq::mechanical_energy, scalar, J, kg* m2 / s2));
static_assert(verify(isq::mechanical_work, scalar, J, kg* m2 / s2));
static_assert(verify(isq::work, scalar, J, kg* m2 / s2));
static_assert(verify(isq::efficiency_mechanics, scalar, one));
static_assert(verify(isq::mechanical_efficiency, scalar, one));
static_assert(verify(isq::mass_flow, vector, kg / m2 / s));
static_assert(verify(isq::mass_flow_rate, scalar, kg / s));
static_assert(verify(isq::mass_change_rate, scalar, kg / s));
Expand Down Expand Up @@ -212,7 +212,7 @@ 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::thermodynamic_efficiency, 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));
Expand Down Expand Up @@ -298,7 +298,7 @@ static_assert(verify(isq::coupling_factor, scalar, one));
static_assert(verify(isq::leakage_factor, scalar, one));
static_assert(verify(isq::conductivity, scalar, S / m));
static_assert(verify(isq::resistivity, scalar, si::ohm* m));
static_assert(verify(isq::power, scalar, W));
static_assert(verify(isq::electromagnetism_power, scalar, W));
static_assert(verify(isq::instantaneous_power, scalar, W));
static_assert(verify(isq::resistance, scalar, si::ohm));
static_assert(verify(isq::conductance, scalar, S));
Expand Down

0 comments on commit ea6325a

Please sign in to comment.