In continuum mechanics, properties are represented in some chosen units,
e.g. mass in kilograms (), volume in cubic metres (), pressure in
Pascals (). Algebraic operations must be performed on these
properties using consistent units of measurement; in particular, addition,
subtraction and equality are only physically meaningful for properties
of the same dimensional units. As a safeguard against implementing a
meaningless operation, OpenFOAM encourages the user to attach dimensional units
to any tensor and will then perform dimension checking of any tensor
operation.
Units are defined using the dimensionSet class, e.g.
dimensionSet pressureDims(1, -1, -2, 0, 0, 0, 0);
No.
Property
Unit
Symbol
1
Mass
kilogram
2
Length
metre
3
Time
second
4
Temperature
Kelvin
5
Quantity
moles
6
Current
ampere
7
Luminous intensity
candela
Table 1.3:
S.I. base units of measurement
where each of the values corresponds to the power of each of the S.I. base units
of measurement listed in Table 1.3. The line of code declares pressureDims to
be the dimensionSet for pressure since the first entry in the
pressureDims array, 1, corresponds to , the second entry, -1, corresponds to
etc.. A tensor with units is defined using the dimensioned<Type> template
class, the <Type> being scalar, vector, tensor, etc.. The dimensioned<Type>
stores a variable name of class word,the value <Type> and a dimensionSet