From 1f0bab294ba539cc92c7ff486e67191321399b1c Mon Sep 17 00:00:00 2001 From: Yacine Lakel Date: Tue, 28 Nov 2023 18:24:46 +0100 Subject: [PATCH] Add areal heat capacity quantity --- src/si/areal_heat_capacity.rs | 48 +++++++++++++++++++++++++++++++++++ src/si/mod.rs | 1 + 2 files changed, 49 insertions(+) create mode 100644 src/si/areal_heat_capacity.rs diff --git a/src/si/areal_heat_capacity.rs b/src/si/areal_heat_capacity.rs new file mode 100644 index 00000000..d63a28f6 --- /dev/null +++ b/src/si/areal_heat_capacity.rs @@ -0,0 +1,48 @@ +//! Areal heat capacity (base unit joule per square meter kelvin, kg · s⁻² · K⁻¹). + +quantity! { + /// Areal heat capacity (base unit joule per square meter kelvin, kg · s⁻² · K⁻¹). + quantity: ArealHeatCapacity; "areal heat capacity"; + /// Dimension of areal heat capacity, MT⁻²Th⁻¹(base unit joule per square meter kelvin, + /// kg · s⁻² · K⁻¹). + dimension: ISQ< + Z0, // length + P1, // mass + N2, // time + Z0, // electric current + N1, // thermodynamic temperature + Z0, // amount of substance + Z0>; // luminous intensity + units { + @joule_per_square_meter_kelvin: prefix!(none); "J/(m² · K)", + "joule per square meter kelvin", "joules per square meter kelvin"; + } +} + +#[cfg(test)] +mod tests { + storage_types! { + use crate::num::One; + use crate::si::heat_capacity as hc; + use crate::si::area as a; + use crate::si::quantities::*; + use crate::si::areal_heat_capacity as ahc; + use crate::tests::Test; + + #[test] + fn check_dimension() { + let _: ArealHeatCapacity = HeatCapacity::new::(V::one()) + / Area::new::(V::one()); + } + + #[test] + fn check_heat_capacity_area_units() { + test::(); + + fn test, A: a::Conversion, AHC: ahc::Conversion>() { + Test::assert_approx_eq(&ArealHeatCapacity::new::(V::one()), + &(HeatCapacity::new::(V::one()) / (Area::new::(V::one())))); + } + } + } +} diff --git a/src/si/mod.rs b/src/si/mod.rs index 922fcfa5..6d288deb 100644 --- a/src/si/mod.rs +++ b/src/si/mod.rs @@ -56,6 +56,7 @@ system! { angular_velocity::AngularVelocity, area::Area, areal_density_of_states::ArealDensityOfStates, + areal_heat_capacity::ArealHeatCapacity, areal_mass_density::ArealMassDensity, areal_number_density::ArealNumberDensity, areal_number_rate::ArealNumberRate,