uom/si/
dynamic_viscosity.rs1quantity! {
4 quantity: DynamicViscosity; "dynamic viscosity";
6 dimension: ISQ<
8 N1, P1, N1, Z0, Z0, Z0, Z0>; units {
16 @pascal_second: prefix!(none); "Pa · s", "pascal second", "pascal seconds";
17 @millipascal_second: prefix!(milli); "mPa · s", "millipascal second", "millipascal seconds";
18 @micropascal_second: prefix!(micro); "µPa · s", "micropascal second", "micropascal seconds";
19 @poise: 1.0_E-1; "P", "poise", "poises";
21 @centipoise: prefix!(centi) * 1.0_E-1; "cP", "centipoise", "centipoises";
23 @pound_force_second_per_square_foot: 4.448_222_E0 / 3.048_E-1 / 3.048_E-1; "lbf · s/ft²",
24 "pound-force second per square foot", "pound-force seconds per square foot";
25 @pound_force_second_per_square_inch: 4.448_222_E0 / 2.54_E-2 / 2.54_E-2; "lbf · s/in²",
26 "pound-force second per square inch", "pound-force seconds per square inch";
27 @reyn: 4.448_222_E0 / 2.54_E-2 / 2.54_E-2; "reyn", "reyn", "reyns";
29 @pound_per_foot_second: 4.535_924_E-1 / 3.048_E-1; "lb/(ft · s)", "pound per foot second",
30 "pounds per foot second";
31 @pound_per_foot_hour: 4.535_924_E-1 / 3.048_E-1 / 3.6_E3; "lb/(ft · h)",
32 "pound per foot hour", "pounds per foot hour";
33 @slug_per_foot_second: 1.459_390_E1 / 3.048_E-1; "slug/(ft · s)", "slug per foot second",
34 "slugs per foot second";
35 @gram_per_centimeter_second: prefix!(milli) / prefix!(centi); "g/(cm · s)",
36 "gram per centimeter second", "grams per centimeter second";
37 }
38}
39
40#[cfg(test)]
41mod test {
42 storage_types! {
43 use crate::num::One;
44 use crate::si::quantities::*;
45 use crate::si::dynamic_viscosity as dv;
46 use crate::si::time as t;
47 use crate::si::mass as m;
48 use crate::si::length as l;
49 use crate::si::pressure as p;
50 use crate::tests::Test;
51
52 #[test]
53 fn check_dimension() {
54 let _: DynamicViscosity<V> = Pressure::new::<p::pascal>(V::one())
55 * Time::new::<t::second>(V::one());
56 }
57
58 #[test]
59 fn check_units() {
60 test::<p::pascal, t::second, dv::pascal_second>();
61 test::<p::millipascal, t::second, dv::millipascal_second>();
62 test::<p::micropascal, t::second, dv::micropascal_second>();
63 test::<p::dyne_per_square_centimeter, t::second, dv::poise>();
64 test::<p::millipascal, t::second,dv::centipoise>();
65 test::<p::pound_force_per_square_foot, t::second,
66 dv::pound_force_second_per_square_foot>();
67 test::<p::pound_force_per_square_inch, t::second,
68 dv::pound_force_second_per_square_inch>();
69 test::<p::pound_force_per_square_inch, t::second, dv::reyn>();
70
71 fn test<P: p::Conversion<V>, T: t::Conversion<V>, DV: dv::Conversion<V>>() {
72 Test::assert_approx_eq(&DynamicViscosity::new::<DV>(V::one()),
73 &(Pressure::new::<P>(V::one())
74 * Time::new::<T>(V::one())));
75 }
76 }
77
78 #[test]
79 fn check_units_mlt() {
80 test::<m::pound, l::foot, t::second, dv::pound_per_foot_second>();
81 test::<m::pound, l::foot, t::hour, dv::pound_per_foot_hour>();
82 test::<m::gram, l::centimeter, t::second, dv::gram_per_centimeter_second>();
83 test::<m::slug, l::foot, t::second, dv::slug_per_foot_second>();
84
85 fn test<M: m::Conversion<V>, L: l::Conversion<V>, T: t::Conversion<V>,
86 DV: dv::Conversion<V>>()
87 {
88 Test::assert_approx_eq(&DynamicViscosity::new::<DV>(V::one()),
89 &(Mass::new::<M>(V::one())
90 / Length::new::<L>(V::one())
91 / Time::new::<T>(V::one())));
92 }
93 }
94 }
95}