unitforge 0.5.9__tar.gz → 0.5.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {unitforge-0.5.9 → unitforge-0.5.10}/Cargo.lock +2 -2
- {unitforge-0.5.9 → unitforge-0.5.10}/Cargo.toml +2 -2
- {unitforge-0.5.9 → unitforge-0.5.10}/PKG-INFO +3 -1
- {unitforge-0.5.9 → unitforge-0.5.10}/install_hooks.sh +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/lib.rs +4 -2
- unitforge-0.5.10/src/quantities/thermal_conductance.rs +42 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/relations.rs +7 -5
- {unitforge-0.5.9 → unitforge-0.5.10}/test.sh +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/quantities.rs +64 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/unitforge_macros/Cargo.toml +1 -1
- unitforge-0.5.9/python/unitforge/__init__.pyi +0 -3413
- unitforge-0.5.9/python/unitforge/py.typed +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/.gitignore +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/.gitlab-ci.yml +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/Readme.md +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/Readme_py.md +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/pyproject.toml +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/python/unitforge/__init__.py +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/scripts/generate_python_stubs.py +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/errors.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/impl_macros.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/internal.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/prelude.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/acceleration.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/angle.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/angular_acceleration.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/angular_velocity.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/area.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/area_of_moment.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/charge.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/compliance.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/density.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/density_rate.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/density_temperature.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/density_temperature_rate.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/distance.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/force.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/force_area.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/force_distance.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/force_div_distance_power_four.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/force_per_volume.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/force_stress.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/force_volume.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/frequency.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/heat_flux.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/inverse_angle.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/inverse_area.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/inverse_distance.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/inverse_stress.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/inverse_temperature.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/mass.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/mass_per_distance.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/molar_mass.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/power.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/pressure_rate.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/rotational_stiffness.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/specific_energy.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/specific_gas_constant.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/specific_heat_capacity.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/stiffness.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/strain.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/strain_squared.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/stress.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/stress_cubed.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/stress_per_temperature.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/stress_rate.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/stress_rate_per_temperature.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/stress_squared.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/temperature.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/temperature_gradient.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/thermal_conductivity.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/time.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/universal_gas_constant.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/velocity.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/velocity_squared.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/voltage.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/volume.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/volumetric_energy_density.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities/volumetric_heat_capacity.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/quantities.template.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/small_linalg/bindings/matrix3_py.template.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/small_linalg/bindings/vector3_py.template.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/small_linalg/matrix2.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/small_linalg/matrix2x3.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/small_linalg/matrix3.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/small_linalg/matrix3x2.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/small_linalg/vector2.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/src/small_linalg/vector3.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/common/mod.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/matrix2.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/matrix2x3.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/matrix3.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/matrix3x2.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/ndarray_dot.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/quantity_core/constants.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/quantity_core/construction.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/quantity_core/enum_iter.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/quantity_core/metadata.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/quantity_core/normalization.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/quantity_core/plain_storage.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/quantity_core/relations.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/quantity_core/runtime_quantity.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/quantity_core/scalar_edges.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/quantity_core.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/quantity_serde.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/small_linalg_edge_cases.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/small_linalg_interfaces.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/test_quantities.py +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/test_small_linalg.py +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/typecheck/mypy_smoke.py +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/vector2.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/tests/vector3.rs +0 -0
- {unitforge-0.5.9 → unitforge-0.5.10}/unitforge_macros/src/lib.rs +0 -0
|
@@ -351,7 +351,7 @@ checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
|
|
351
351
|
|
|
352
352
|
[[package]]
|
|
353
353
|
name = "unitforge"
|
|
354
|
-
version = "0.5.
|
|
354
|
+
version = "0.5.10"
|
|
355
355
|
dependencies = [
|
|
356
356
|
"ndarray",
|
|
357
357
|
"num-traits",
|
|
@@ -367,7 +367,7 @@ dependencies = [
|
|
|
367
367
|
|
|
368
368
|
[[package]]
|
|
369
369
|
name = "unitforge_macros"
|
|
370
|
-
version = "0.5.
|
|
370
|
+
version = "0.5.10"
|
|
371
371
|
dependencies = [
|
|
372
372
|
"regex",
|
|
373
373
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "unitforge"
|
|
3
|
-
version = "0.5.
|
|
3
|
+
version = "0.5.10"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
authors = ["Dr.Q team <info@askdrq.com>", "Henrik Stromberg <henrik@askdrq.com>"]
|
|
6
6
|
description = "A library for unit and quantity consistent computations in Rust"
|
|
@@ -20,7 +20,7 @@ pyo3 = { version = "0.28.3", features = ["extension-module", "auto-initialize",
|
|
|
20
20
|
numpy = { version = "0.28.0", optional = true }
|
|
21
21
|
strum = { version = "0.28.0", optional = true }
|
|
22
22
|
strum_macros = { version = "0.28.0", optional = true }
|
|
23
|
-
unitforge_macros = { version = "0.5.
|
|
23
|
+
unitforge_macros = { version = "0.5.10", path = "unitforge_macros" }
|
|
24
24
|
|
|
25
25
|
[features]
|
|
26
26
|
default = []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: unitforge
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.10
|
|
4
4
|
Classifier: Programming Language :: Python :: 3
|
|
5
5
|
Classifier: Programming Language :: Rust
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -9,7 +9,9 @@ Classifier: Topic :: Scientific/Engineering :: Physics
|
|
|
9
9
|
Requires-Dist: numpy>=2.2.0
|
|
10
10
|
Summary: A library for unit and quantity consistent computations in Rust
|
|
11
11
|
Keywords: units,quantities,simulation,physics
|
|
12
|
+
Author: Dr.Q team <info@askdrq.com>, Henrik Stromberg <henrik@askdrq.com>
|
|
12
13
|
Author-email: "Dr.Q team" <info@askdrq.com>, Henrik Stromberg <henrik@askdrq.com>
|
|
14
|
+
License: MIT
|
|
13
15
|
Requires-Python: >=3.7
|
|
14
16
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
15
17
|
Project-URL: Repository, https://gitlab.com/henrikjstromberg/unitforge
|
|
File without changes
|
|
@@ -107,10 +107,10 @@ pub mod quantities {
|
|
|
107
107
|
pub use molar_mass::*;
|
|
108
108
|
pub mod mass_per_distance;
|
|
109
109
|
pub use mass_per_distance::*;
|
|
110
|
-
pub mod power;
|
|
111
|
-
pub use power::*;
|
|
112
110
|
pub mod pressure_rate;
|
|
113
111
|
pub use pressure_rate::*;
|
|
112
|
+
pub mod power;
|
|
113
|
+
pub use power::*;
|
|
114
114
|
pub mod force_distance;
|
|
115
115
|
pub use force_distance::*;
|
|
116
116
|
pub mod force_stress;
|
|
@@ -145,6 +145,8 @@ pub mod quantities {
|
|
|
145
145
|
pub use temperature::*;
|
|
146
146
|
pub mod temperature_gradient;
|
|
147
147
|
pub use temperature_gradient::*;
|
|
148
|
+
pub mod thermal_conductance;
|
|
149
|
+
pub use thermal_conductance::*;
|
|
148
150
|
pub mod inverse_temperature;
|
|
149
151
|
pub use inverse_temperature::*;
|
|
150
152
|
pub mod thermal_conductivity;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
use crate::impl_macros::macros::*;
|
|
2
|
+
|
|
3
|
+
#[cfg_attr(feature = "strum", derive(EnumIter))]
|
|
4
|
+
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
|
5
|
+
#[derive(Copy, Clone, PartialEq, Debug, Hash, Eq)]
|
|
6
|
+
#[cfg_attr(feature = "pyo3", pyclass(eq, eq_int, from_py_object))]
|
|
7
|
+
pub enum ThermalConductanceUnit {
|
|
8
|
+
mW_K,
|
|
9
|
+
W_K,
|
|
10
|
+
kW_K,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
impl ThermalConductanceUnit {
|
|
14
|
+
pub const fn base_per_x_const(self) -> (f64, i32) {
|
|
15
|
+
match self {
|
|
16
|
+
ThermalConductanceUnit::mW_K => (1., -3),
|
|
17
|
+
ThermalConductanceUnit::W_K => (1., 0),
|
|
18
|
+
ThermalConductanceUnit::kW_K => (1., 3),
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
impl PhysicsUnit for ThermalConductanceUnit {
|
|
24
|
+
fn name(&self) -> &str {
|
|
25
|
+
match self {
|
|
26
|
+
ThermalConductanceUnit::mW_K => "mW/K",
|
|
27
|
+
ThermalConductanceUnit::W_K => "W/K",
|
|
28
|
+
ThermalConductanceUnit::kW_K => "kW/K",
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
fn base_per_x(&self) -> (f64, i32) {
|
|
33
|
+
(*self).base_per_x_const()
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
impl_quantity!(
|
|
38
|
+
ThermalConductance,
|
|
39
|
+
ThermalConductanceUnit,
|
|
40
|
+
[ThermalConductanceUnit::W_K]
|
|
41
|
+
);
|
|
42
|
+
impl_div_with_self_to_f64!(ThermalConductance);
|
|
@@ -28,6 +28,13 @@ impl_mul_relation_with_other!(Distance, InverseArea, InverseDistance);
|
|
|
28
28
|
impl_mul_relation_with_other!(InverseDistance, Area, Distance);
|
|
29
29
|
impl_mul_relation_with_other!(Velocity, Time, Distance);
|
|
30
30
|
impl_mul_relation_with_other!(Force, Distance, ForceDistance);
|
|
31
|
+
impl_mul_relation_with_other!(Power, Time, ForceDistance);
|
|
32
|
+
impl_mul_relation_with_other!(Force, Velocity, Power);
|
|
33
|
+
impl_mul_relation_with_other!(HeatFlux, Area, Power);
|
|
34
|
+
impl_mul_relation_with_other!(ThermalConductivity, TemperatureGradient, HeatFlux);
|
|
35
|
+
impl_mul_relation_with_other!(TemperatureGradient, Distance, Temperature);
|
|
36
|
+
impl_mul_relation_with_other!(ThermalConductivity, Distance, ThermalConductance);
|
|
37
|
+
impl_mul_relation_with_other!(ThermalConductance, Temperature, Power);
|
|
31
38
|
impl_mul_relation_with_other!(Force, Area, ForceArea);
|
|
32
39
|
impl_mul_relation_with_other!(ForceArea, Distance, ForceVolume);
|
|
33
40
|
impl_mul_relation_with_other!(AreaOfMoment, Stress, ForceArea);
|
|
@@ -80,12 +87,7 @@ impl_mul_relation_with_self!(Strain, StrainSquared);
|
|
|
80
87
|
impl_mul_relation_with_self!(Stress, StressSquared);
|
|
81
88
|
impl_mul_relation_with_other!(Stress, StressSquared, StressCubed);
|
|
82
89
|
impl_mul_relation_with_self!(AngularVelocity, AngularAcceleration);
|
|
83
|
-
impl_mul_relation_with_other!(ThermalConductivity, TemperatureGradient, HeatFlux);
|
|
84
|
-
impl_mul_relation_with_other!(TemperatureGradient, Distance, Temperature);
|
|
85
|
-
impl_mul_relation_with_other!(HeatFlux, Area, Power);
|
|
86
|
-
impl_mul_relation_with_other!(Power, Time, ForceDistance);
|
|
87
90
|
impl_mul_relation_with_other!(ForceDistance, Frequency, Power);
|
|
88
|
-
impl_mul_relation_with_other!(Force, Velocity, Power);
|
|
89
91
|
impl_mul_relation_with_other!(Density, SpecificHeatCapacity, VolumetricHeatCapacity);
|
|
90
92
|
impl_mul_relation_with_other!(VolumetricHeatCapacity, Temperature, VolumetricEnergyDensity);
|
|
91
93
|
impl_mul_relation_with_other!(SpecificHeatCapacity, Temperature, SpecificEnergy);
|
|
File without changes
|
|
@@ -361,6 +361,70 @@ mod test_thermo_and_rates {
|
|
|
361
361
|
));
|
|
362
362
|
}
|
|
363
363
|
|
|
364
|
+
#[test]
|
|
365
|
+
fn thermal_quantities_convert_and_relate_to_energy() {
|
|
366
|
+
let conductivity = ThermalConductivity::new(1.0, ThermalConductivityUnit::kW_mK);
|
|
367
|
+
assert!(crate::approx_eq(
|
|
368
|
+
conductivity.to(ThermalConductivityUnit::mW_mK),
|
|
369
|
+
1_000_000.0,
|
|
370
|
+
1e-6
|
|
371
|
+
));
|
|
372
|
+
|
|
373
|
+
let gradient = TemperatureGradient::new(2.0, TemperatureGradientUnit::K_m);
|
|
374
|
+
let flux = ThermalConductivity::new(1.0, ThermalConductivityUnit::kW_mK) * gradient;
|
|
375
|
+
assert!(crate::approx_eq(flux.to(HeatFluxUnit::kW_msq), 2.0, 1e-12));
|
|
376
|
+
|
|
377
|
+
let area = Area::new(0.5, AreaUnit::msq);
|
|
378
|
+
let power = flux * area;
|
|
379
|
+
assert!(crate::approx_eq(power.to(PowerUnit::W), 1000.0, 1e-12));
|
|
380
|
+
|
|
381
|
+
let duration = Time::new(30.0, TimeUnit::s);
|
|
382
|
+
let energy = power * duration;
|
|
383
|
+
assert!(crate::approx_eq(energy.to(EnergyUnit::J), 30_000.0, 1e-12));
|
|
384
|
+
assert!(crate::approx_eq(
|
|
385
|
+
(energy / duration).to(PowerUnit::kW),
|
|
386
|
+
1.0,
|
|
387
|
+
1e-12
|
|
388
|
+
));
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
#[test]
|
|
392
|
+
fn thermal_conductance_relates_conductivity_length_and_power() {
|
|
393
|
+
let conductivity = ThermalConductivity::new(200.0, ThermalConductivityUnit::W_mK);
|
|
394
|
+
let characteristic_length = Distance::new(0.05, DistanceUnit::m);
|
|
395
|
+
let conductance = conductivity * characteristic_length;
|
|
396
|
+
assert!(crate::approx_eq(
|
|
397
|
+
conductance.to(ThermalConductanceUnit::W_K),
|
|
398
|
+
10.0,
|
|
399
|
+
1e-12
|
|
400
|
+
));
|
|
401
|
+
|
|
402
|
+
let temperature_difference = Temperature::new(15.0, TemperatureUnit::K);
|
|
403
|
+
let power = conductance * temperature_difference;
|
|
404
|
+
assert!(crate::approx_eq(power.to(PowerUnit::W), 150.0, 1e-12));
|
|
405
|
+
|
|
406
|
+
assert!(crate::approx_eq(
|
|
407
|
+
(power / conductance).to(TemperatureUnit::K),
|
|
408
|
+
15.0,
|
|
409
|
+
1e-12
|
|
410
|
+
));
|
|
411
|
+
assert!(crate::approx_eq(
|
|
412
|
+
(power / temperature_difference).to(ThermalConductanceUnit::W_K),
|
|
413
|
+
10.0,
|
|
414
|
+
1e-12
|
|
415
|
+
));
|
|
416
|
+
assert!(crate::approx_eq(
|
|
417
|
+
(conductance / conductivity).to(DistanceUnit::m),
|
|
418
|
+
0.05,
|
|
419
|
+
1e-12
|
|
420
|
+
));
|
|
421
|
+
assert!(crate::approx_eq(
|
|
422
|
+
(conductance / characteristic_length).to(ThermalConductivityUnit::W_mK),
|
|
423
|
+
200.0,
|
|
424
|
+
1e-12
|
|
425
|
+
));
|
|
426
|
+
}
|
|
427
|
+
|
|
364
428
|
#[test]
|
|
365
429
|
fn specific_and_molar_gas_constants_relate_through_molar_mass() {
|
|
366
430
|
let molar_mass = MolarMass::new(28.97, MolarMassUnit::g_mol);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "unitforge_macros"
|
|
3
|
-
version = "0.5.
|
|
3
|
+
version = "0.5.10"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
authors = ["Dr.Q team <info@askdrq.com>", "Henrik Stromberg <henrik@askdrq.com>"]
|
|
6
6
|
description = "Proc macros for generating units, quantities, and Python bindings in unitforge"
|