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.

property J: Union[float, int]

Energy unit, derived from m, kg and s.

K: Union[float, int]

Temperature unit in Kelvin.

property N: Union[float, int]

Force unit, derived from m, kg and s.

property Pa: Union[float, int]

Pressure (or stress) unit, derived from kg, m and s.

property W: Union[float, int]

Power unit, derived from m, kg and s.

property degree: Union[float, int]

Angle unit, derived from rad.

kg: Union[float, int]

Mass unit in kilograms.

m: Union[float, int]

Length unit in meters.

mol: Union[float, int]

Mole unit in moles.

rad: Union[float, int]

Angle unit in radians.

s: Union[float, int]

Time unit in seconds.