unitforge 0.5.13__tar.gz → 0.5.16__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.13 → unitforge-0.5.16}/Cargo.lock +2 -2
- {unitforge-0.5.13 → unitforge-0.5.16}/Cargo.toml +2 -2
- {unitforge-0.5.13 → unitforge-0.5.16}/PKG-INFO +22 -3
- unitforge-0.5.16/Readme.md +76 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/Readme_py.md +21 -1
- {unitforge-0.5.13 → unitforge-0.5.16}/install_hooks.sh +0 -0
- unitforge-0.5.16/python/unitforge/__init__.pyi +3989 -0
- unitforge-0.5.16/python/unitforge/py.typed +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/scripts/generate_python_stubs.py +3 -2
- {unitforge-0.5.13 → unitforge-0.5.16}/src/impl_macros.rs +29 -8
- {unitforge-0.5.13 → unitforge-0.5.16}/src/lib.rs +12 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/prelude.rs +6 -0
- unitforge-0.5.16/src/quantities/dynamic_viscosity.rs +43 -0
- unitforge-0.5.16/src/quantities/force_rate.rs +36 -0
- unitforge-0.5.16/src/quantities/force_time.rs +36 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/frequency.rs +0 -33
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/inverse_stress.rs +0 -17
- unitforge-0.5.16/src/quantities/rotational_damping.rs +53 -0
- unitforge-0.5.16/src/quantities/strain_rate.rs +52 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/stress.rs +0 -17
- unitforge-0.5.16/src/quantities/translational_damping.rs +43 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/relations.rs +30 -4
- {unitforge-0.5.13 → unitforge-0.5.16}/test.sh +0 -0
- unitforge-0.5.16/tests/quantity_core/relations.rs +205 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/test_quantities.py +32 -5
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/test_small_linalg.py +2 -2
- unitforge-0.5.16/tests/typecheck/mypy_smoke.py +123 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/unitforge_macros/Cargo.toml +1 -1
- {unitforge-0.5.13 → unitforge-0.5.16}/unitforge_macros/src/lib.rs +12 -1
- unitforge-0.5.13/Readme.md +0 -31
- unitforge-0.5.13/tests/quantity_core/relations.rs +0 -91
- unitforge-0.5.13/tests/typecheck/mypy_smoke.py +0 -70
- {unitforge-0.5.13 → unitforge-0.5.16}/.gitignore +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/.gitlab-ci.yml +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/pyproject.toml +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/python/unitforge/__init__.py +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/errors.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/internal.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/acceleration.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/angle.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/angular_acceleration.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/angular_velocity.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/area.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/area_of_moment.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/charge.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/compliance.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/density.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/density_rate.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/density_temperature.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/density_temperature_rate.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/distance.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/force.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/force_area.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/force_distance.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/force_div_distance_power_four.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/force_per_volume.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/force_stress.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/force_volume.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/heat_capacity.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/heat_flux.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/inverse_angle.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/inverse_area.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/inverse_distance.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/inverse_temperature.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/mass.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/mass_per_distance.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/molar_mass.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/power.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/pressure_rate.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/rotational_stiffness.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/specific_energy.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/specific_gas_constant.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/specific_heat_capacity.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/stiffness.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/strain.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/strain_squared.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/stress_cubed.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/stress_per_temperature.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/stress_rate.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/stress_rate_per_temperature.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/stress_squared.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/temperature.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/temperature_gradient.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/thermal_conductance.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/thermal_conductivity.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/time.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/universal_gas_constant.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/velocity.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/velocity_squared.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/voltage.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/volume.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/volumetric_energy_density.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities/volumetric_heat_capacity.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/quantities.template.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/small_linalg/bindings/matrix3_py.template.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/small_linalg/bindings/vector3_py.template.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/small_linalg/matrix2.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/small_linalg/matrix2x3.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/small_linalg/matrix3.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/small_linalg/matrix3x2.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/small_linalg/vector2.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/src/small_linalg/vector3.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/common/mod.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/matrix2.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/matrix2x3.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/matrix3.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/matrix3_eigen.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/matrix3x2.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/ndarray_dot.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/quantities.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/quantity_core/constants.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/quantity_core/construction.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/quantity_core/enum_iter.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/quantity_core/metadata.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/quantity_core/normalization.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/quantity_core/plain_storage.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/quantity_core/runtime_quantity.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/quantity_core/scalar_edges.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/quantity_core/unit_factors.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/quantity_core.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/quantity_serde.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/small_linalg_edge_cases.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/small_linalg_interfaces.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/thermal_transient.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/vector2.rs +0 -0
- {unitforge-0.5.13 → unitforge-0.5.16}/tests/vector3.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.16"
|
|
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.16"
|
|
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.16"
|
|
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.16", 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.16
|
|
4
4
|
Classifier: Programming Language :: Python :: 3
|
|
5
5
|
Classifier: Programming Language :: Rust
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -9,9 +9,7 @@ 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>
|
|
13
12
|
Author-email: "Dr.Q team" <info@askdrq.com>, Henrik Stromberg <henrik@askdrq.com>
|
|
14
|
-
License: MIT
|
|
15
13
|
Requires-Python: >=3.7
|
|
16
14
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
17
15
|
Project-URL: Repository, https://gitlab.com/henrikjstromberg/unitforge
|
|
@@ -149,3 +147,24 @@ Contributions are welcome! While the core is implemented in Rust, Python usage f
|
|
|
149
147
|
## Repository
|
|
150
148
|
|
|
151
149
|
[GitLab – Unitforge Crate](https://gitlab.com/henrikjstromberg/unitforge)
|
|
150
|
+
## Viscous coefficients
|
|
151
|
+
|
|
152
|
+
Version 0.5.15 adds `StrainRate`, `DynamicViscosity`, `TranslationalDamping`,
|
|
153
|
+
`RotationalDamping`, `ForceRate`, and `ForceTime` with their corresponding
|
|
154
|
+
`Unit` enums. For example:
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
from unitforge import (
|
|
158
|
+
Stress, StressUnit, Time, TimeUnit, StrainRate, StrainRateUnit,
|
|
159
|
+
DynamicViscosityUnit,
|
|
160
|
+
)
|
|
161
|
+
viscosity = Stress(200.0, StressUnit.MPa) * Time(0.5, TimeUnit.s)
|
|
162
|
+
assert viscosity.to(DynamicViscosityUnit.MPa_s) == 100.0
|
|
163
|
+
stress = viscosity * StrainRate(0.002, StrainRateUnit.m_m_s)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Shear conventions belong to the constitutive/tensor layer; Unitforge adds no
|
|
167
|
+
factors of two. Radians retain the existing dimensionless-angle convention.
|
|
168
|
+
For compatibility, `StressRate / Stress` still returns `Frequency`, while
|
|
169
|
+
`StressRate / StrainRate` returns `Stress`.
|
|
170
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Unitforge
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
**Unitforge** is a Rust crate designed for safe handling of physical quantities of units. New quantities and relations can be set up via small macros.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Quantity inference:** Resulting quantities of arithmetic operations are inferred at compile time.
|
|
10
|
+
- **Unit conversion:** Quantities can be set or read in arbitrary units.
|
|
11
|
+
- **Computing Precision** Values are stored in exponential format (f64*10^i32) to prevent floating point precision issues.
|
|
12
|
+
- **Formating** Quantities are displayed with 4 significant digits and configured display unit.
|
|
13
|
+
- **ndarray support:** Optional `ndarray` integration with `features = ["ndarray"]`; quantities may be used as inner types for arrays.
|
|
14
|
+
- **3D Vector and matrix operations:** Structs for 3D vectors and matrices are included to allow fast and unit-safe work with them.
|
|
15
|
+
- **Serialization**: Optional support for serde using `features = ["serde"]`; combine with `ndarray` for ndarray serialization support.
|
|
16
|
+
- **python interface** Optional Python interface when building with flag pyo3; also available on pypi
|
|
17
|
+
|
|
18
|
+
## Comparing quantities
|
|
19
|
+
|
|
20
|
+
`==` is tolerance-based: two quantities are equal when they differ by at most `1e-9` of the larger
|
|
21
|
+
magnitude. An infinity equals only itself, and NaN equals nothing. Ordering (`<`, `<=`, `>`, `>=`)
|
|
22
|
+
compares the stored values exactly. As a consequence:
|
|
23
|
+
|
|
24
|
+
- `==` is not transitive, and for nearly equal values `a == b` and `a < b` can both be true.
|
|
25
|
+
- `Hash` hashes the exact stored value, so quantities that compare equal can hash differently. Do
|
|
26
|
+
not rely on hash-based collections to merge nearly equal quantities.
|
|
27
|
+
- For an explicit, absolute tolerance use `a.is_close(&b, &tolerance)`.
|
|
28
|
+
|
|
29
|
+
## Contribute
|
|
30
|
+
|
|
31
|
+
All contributions are welcome! Feel free to implement new quantities or define relations using `impl_macros.rs`. 🚀
|
|
32
|
+
|
|
33
|
+
## Viscous coefficients and rates
|
|
34
|
+
|
|
35
|
+
`StrainRate` represents the time derivative of strain and is distinct from
|
|
36
|
+
`Frequency`. Construct it from typed strain divided by time, or strain times
|
|
37
|
+
frequency. The material coefficient `DynamicViscosity` is distinct from the
|
|
38
|
+
assembled coefficients `TranslationalDamping` and `RotationalDamping`.
|
|
39
|
+
|
|
40
|
+
```rust
|
|
41
|
+
use unitforge::*;
|
|
42
|
+
|
|
43
|
+
let modulus = Stress::new(200.0, StressUnit::MPa);
|
|
44
|
+
let relaxation_time = Time::new(0.5, TimeUnit::s);
|
|
45
|
+
let viscosity: DynamicViscosity = modulus * relaxation_time;
|
|
46
|
+
let strain_rate = StrainRate::new(0.002, StrainRateUnit::m_m_s);
|
|
47
|
+
let viscous_stress: Stress = viscosity * strain_rate; // 0.2 MPa
|
|
48
|
+
let damping: TranslationalDamping =
|
|
49
|
+
viscosity * Area::new(100.0, AreaUnit::mmsq)
|
|
50
|
+
/ Distance::new(1000.0, DistanceUnit::mm); // 10000 N s/m
|
|
51
|
+
let force: Force = damping * Velocity::new(2.0, VelocityUnit::mm_s); // 20 N
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`ForceRate` supports differentiated translational equilibrium. `ForceTime`
|
|
55
|
+
represents force times time, including mixed translation/rotation damping
|
|
56
|
+
blocks: `2 N s * 3 rad/s = 6 N` and `2 N s * 3 m/s = 6 N m`.
|
|
57
|
+
Radians follow the library's existing dimensionless-angle convention.
|
|
58
|
+
Rotational damping per degree converts to per radian by multiplying by 180/π;
|
|
59
|
+
`1 N m s/degree * 1 degree/s = 1 N m`.
|
|
60
|
+
|
|
61
|
+
Tensor shear versus engineering shear conventions belong to the constitutive
|
|
62
|
+
and tensor layer. Unitforge inserts no factors of two. Signed components,
|
|
63
|
+
zero, and nonfinite values follow the normal quantity arithmetic policy.
|
|
64
|
+
|
|
65
|
+
Existing semantic result types take precedence where dimensions overlap:
|
|
66
|
+
`StressRate / Stress` returns `Frequency`, `Velocity / Distance` returns
|
|
67
|
+
`AngularVelocity`, and `Power / ForceDistance` returns `Frequency`.
|
|
68
|
+
`Stress * StrainRate` returns `StressRate` in both orders, while
|
|
69
|
+
`StressRate / StrainRate` returns `Stress`. Rotational stiffness times angular
|
|
70
|
+
velocity returns `Power` in both orders, and `Power / AngularVelocity` returns
|
|
71
|
+
`RotationalStiffness`; no inverse `Power / RotationalStiffness` is added.
|
|
72
|
+
|
|
73
|
+
Downstream tensor libraries retain ownership of tensor constructors, registered
|
|
74
|
+
quantity specializations, and constitutive contractions. Unitforge supplies the
|
|
75
|
+
scalar operations and generic vector, matrix, and ndarray arithmetic needed by
|
|
76
|
+
those implementations; it does not implement finite-element tensors.
|
|
@@ -130,4 +130,24 @@ Contributions are welcome! While the core is implemented in Rust, Python usage f
|
|
|
130
130
|
|
|
131
131
|
## Repository
|
|
132
132
|
|
|
133
|
-
[GitLab – Unitforge Crate](https://gitlab.com/henrikjstromberg/unitforge)
|
|
133
|
+
[GitLab – Unitforge Crate](https://gitlab.com/henrikjstromberg/unitforge)
|
|
134
|
+
## Viscous coefficients
|
|
135
|
+
|
|
136
|
+
Version 0.5.15 adds `StrainRate`, `DynamicViscosity`, `TranslationalDamping`,
|
|
137
|
+
`RotationalDamping`, `ForceRate`, and `ForceTime` with their corresponding
|
|
138
|
+
`Unit` enums. For example:
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
from unitforge import (
|
|
142
|
+
Stress, StressUnit, Time, TimeUnit, StrainRate, StrainRateUnit,
|
|
143
|
+
DynamicViscosityUnit,
|
|
144
|
+
)
|
|
145
|
+
viscosity = Stress(200.0, StressUnit.MPa) * Time(0.5, TimeUnit.s)
|
|
146
|
+
assert viscosity.to(DynamicViscosityUnit.MPa_s) == 100.0
|
|
147
|
+
stress = viscosity * StrainRate(0.002, StrainRateUnit.m_m_s)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Shear conventions belong to the constitutive/tensor layer; Unitforge adds no
|
|
151
|
+
factors of two. Radians retain the existing dimensionless-angle convention.
|
|
152
|
+
For compatibility, `StressRate / Stress` still returns `Frequency`, while
|
|
153
|
+
`StressRate / StrainRate` returns `Stress`.
|
|
File without changes
|