An attempt to handle units. Note: this is still a very immature draft!
Two classes are added to core: UnitSet and UnitConverter. UnitSet is a dataclass responsible for storing a set of units intended to be used by a Material class. UnitConverter uses two UnitSets to convert between them.
Example
This example shows how two sets of units are selected and passed to the unit converter. Furthermore, it shows how to convert stress, lengeth and force with the unit converter.
[x] Handle situation where a user specifies a unit that is not available in the UnitSets.
[ ] Add more basic units to get good coverage for SI and Imperial units.
[x] Add optional keyword arguments in base material class.
[x] Add default UnitSets in code specific material classes.
[x] Use convert-methods in methods of material classes. Remember to store attributes in user units, and always convert to default units when calling code equations.
[ ] Add tests for material classes.
[ ] Add units to concrete and reinforcement factories.
[ ] How to deal with fracture energy which is not given in units consistent with stress and stiffness. Create a converter on the fly that converts from the units in the code to the user units on the material. Call the property fracture_energy_unit or similar.
[ ] How to deal with densities? Always use seconds for time.
[ ] Where to describe in API docs?
[ ] Suggest to also add a property for modulus_unit or similar?
Description
An attempt to handle units. Note: this is still a very immature draft!
Two classes are added to
core
:UnitSet
andUnitConverter
.UnitSet
is adataclass
responsible for storing a set of units intended to be used by aMaterial
class.UnitConverter
uses twoUnitSet
s to convert between them.Example
This example shows how two sets of units are selected and passed to the unit converter. Furthermore, it shows how to convert stress, lengeth and force with the unit converter.
To do
UnitSet
andUnitConverter
.UnitSet
s.UnitSet
s in code specific material classes.fracture_energy_unit
or similar.modulus_unit
or similar?