Skip to content

Commit

Permalink
Merge pull request #446 from yacinelakel/master
Browse files Browse the repository at this point in the history
Add areal heat capacity quantity.
  • Loading branch information
iliekturtles authored Jan 27, 2024
2 parents 9abc39e + 1f0bab2 commit d4f08de
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/si/areal_heat_capacity.rs
Original file line number Diff line number Diff line change
@@ -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<V> = HeatCapacity::new::<hc::joule_per_kelvin>(V::one())
/ Area::new::<a::square_meter>(V::one());
}

#[test]
fn check_heat_capacity_area_units() {
test::<hc::joule_per_kelvin, a::square_meter, ahc::joule_per_square_meter_kelvin>();

fn test<HC: hc::Conversion<V>, A: a::Conversion<V>, AHC: ahc::Conversion<V>>() {
Test::assert_approx_eq(&ArealHeatCapacity::new::<AHC>(V::one()),
&(HeatCapacity::new::<HC>(V::one()) / (Area::new::<A>(V::one()))));
}
}
}
}
1 change: 1 addition & 0 deletions src/si/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d4f08de

Please sign in to comment.