porepy.models.units module
Utility class for conversion between different units.
This is part of a system for setting the units of measurement of a problem.
- class Units(**kwargs)[source]
Bases:
object
Units for material properties.
This is a sketch of a class for scaling material properties. The idea is that the material properties should be stored in SI units, but that the user may want to specify them in other units. These are defined in init.
Example
Running a simulation in km, days and MPa is achieved by setting
my_material = Units(m=1e3, s=86400, Pa=1e6)
Base units are attributes of the class, and can be accessed as e.g. my_material.length Derived units are properties computed from the base units, and can be accessed as e.g. my_material.Pa. This ensures consistency between the base and derived units while allowing reference to derived units in usage of the class.
TODO: Consider whether this needs to be incorporated in TimeStepManager and ModelGeometry.
- Parameters
**kwargs –
Dictionary of units. The keys are the name of the unit, and the values are the scaling factor. For example, if the user wants to specify length in kilometers, time in hours and substance amount in millimolar, the dictionary should be
{'m': 1e3, 's': 3600, 'mol': 1e-3}
or, equivalently,
{'m':pp.KILO * pp.METER, 's': pp.HOUR, 'mol':pp.MILLI * pp.MOLE}
- Permitted keys are:
m
: Length unit.s
: Time unit.kg
: Mass unit.K
: Temperature unit.mol
: Mole unit.rad
: Angle unit.