Skip to main content

Crate use_thermal_expansion

Crate use_thermal_expansion 

Source
Expand description

Primitive thermal-expansion helpers.

Initial calculations assume SI units unless otherwise documented. For temperature differences, ΔK and Δ°C are treated equivalently.

§Examples

use use_thermal_expansion::{
    LinearExpansionCoefficient, area_expansion_coefficient, coefficient_from_lengths,
    final_length, linear_expansion, volume_expansion_coefficient,
};

let coefficient = LinearExpansionCoefficient::new(12.0e-6).unwrap();
let expansion = linear_expansion(2.0, 12.0e-6, 50.0).unwrap();
let expanded_length = final_length(2.0, 12.0e-6, 50.0).unwrap();
let inferred = coefficient_from_lengths(2.0, 2.0012, 50.0).unwrap();

assert_eq!(coefficient.per_kelvin(), 12.0e-6);
assert!((expansion - 0.0012).abs() < 1.0e-12);
assert!((expanded_length - 2.0012).abs() < 1.0e-12);
assert!((inferred - 12.0e-6).abs() < 1.0e-12);
assert_eq!(area_expansion_coefficient(12.0e-6).unwrap(), 24.0e-6);
assert_eq!(volume_expansion_coefficient(12.0e-6).unwrap(), 36.0e-6);

Structs§

LinearExpansionCoefficient

Enums§

ThermalExpansionError

Functions§

area_expansion_coefficient
coefficient_from_lengths
final_length
linear_expansion
volume_expansion_coefficient