Nabla Logo programmer
  Advanced Search
  
  Send us a comment/query
 
  Back to main web site
 
  OpenFOAM guides
  - User guide
  - Programmer’s guide
 
  Index
 
  Changes from OpenFOAM 2.2 to 2.3
 
  Trademarks in the guides
  ©2000-2007 Nabla Ltd.

1.5 Dimensional units

In continuum mechanics, properties are represented in some chosen units, e.g. mass in kilograms (kg  \special {t4ht=), volume in cubic metres (m3   \special {t4ht=), pressure in Pascals (kg m s-2   \special {t4ht=). 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 k  \special {t4ht=
2 Length metre m  \special {t4ht=
3 Time second s  \special {t4ht=
4 Temperature Kelvin K  \special {t4ht=
5 Quantity moles mol  \special {t4ht=
6 Current ampere A  \special {t4ht=
7 Luminous intensity candela cd  \special {t4ht=





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 kgm  s- 2   \special {t4ht= since the first entry in the pressureDims array, 1, corresponds to k1   \special {t4ht=, the second entry, -1, corresponds to m -1   \special {t4ht= 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


dimensionedTensor sigma
    (
        "sigma",
        dimensionSet(1, -1, -2, 0, 0, 0, 0),
        tensor(1e6,0,0,0,1e6,0,0,0,1e6),
    );
creates a tensor with correct dimensions of pressure, or stress
   (    6           )
      10    0    0
=      0   106   0
       0    0   106
\special {t4ht=
(1.45)