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.3 Algebraic tensor operations

This section describes all the algebraic operations for tensors that are available in OpenFOAM. Let us first review the most simple tensor operations: addition, subtraction, and scalar multiplication and division. Addition and subtraction are both commutative and associative and are only valid between tensors of the same rank. The operations are performed by addition/subtraction of respective components of the tensors, e.g. the subtraction of two vectors and is

 (1.4)

Multiplication of any tensor by a scalar is also commutative and associative and is performed by multiplying all the tensor components by the scalar. For example,

 (1.5)

Division between a tensor and a scalar is only relevant when the scalar is the second argument of the operation, i.e.

 (1.6)

Following these operations are a set of more complex products between tensors of rank 1 and above, described in the following Sections.

#### 1.3.1 The inner product

The inner product operates on any two tensors of rank and such that the rank of the result . Inner product operations with tensors up to rank 3 are described below:

• The inner product of two vectors and is commutative and produces a scalar where  (1.7)

• The inner product of a tensor and vector produces a vector , represented below as a column array for convenience  (1.8)

It is non-commutative if is non-symmetric such that is

 (1.9)

• The inner product of two tensors and produces a tensor whose components are evaluated as:  (1.10)

It is non-commutative such that

• The inner product of a vector and third rank tensor produces a second rank tensor whose components are  (1.11)

Again this is non-commutative so that is

 (1.12)

• The inner product of a second rank tensor and third rank tensor produces a third rank tensor whose components are  (1.13)

Again this is non-commutative so that is

 (1.14)

#### 1.3.2 The double inner product of two tensors

The double inner product of two second-rank tensors and produces a scalar which can be evaluated as the sum of the 9 products of the tensor components

 (1.15)

The double inner product between a second rank tensor and third rank tensor produces a vector with components

 (1.16)

This is non-commutative so that is

 (1.17)

#### 1.3.3 The triple inner product of two third rank tensors

The triple inner product of two third rank tensors and produces a scalar which can be evaluated as the sum of the 27 products of the tensor components

 (1.18)

#### 1.3.4 The outer product

The outer product operates between vectors and tensors as follows:

• The outer product of two vectors and is non-commutative and produces a tensor whose components are evaluated as:  (1.19)

• An outer product of a vector and second rank tensor produces a third rank tensor whose components are  (1.20)

This is non-commutative so that produces

 (1.21)

#### 1.3.5 The cross product of two vectors

The cross product operation is exclusive to vectors only. For two vectors with , it produces a vector whose components are

 (1.22)

where the permutation symbol is defined by

 (1.23)

in which the even permutations are , and and the odd permutations are , and .

#### 1.3.6 Other general tensor operations

Some less common tensor operations and terminology used by OpenFOAM are described below.

Square
of a tensor is defined as the outer product of the tensor with itself, e.g. for a vector , the square .
th power
of a tensor is evaluated by outer products of the tensor, e.g. for a vector , the 3rd power .
Magnitude squared
of a tensor is the th inner product of the tensor of rank with itself, to produce a scalar. For example, for a second rank tensor , .
Magnitude
is the square root of the magnitude squared, e.g. for a tensor , . Vectors of unit magnitude are referred to as unit vectors.
Component maximum
is the component of the tensor with greatest value, inclusive of sign, i.e. not the largest magnitude.
Component minimum
is the component of the tensor with smallest value.
Component average
is the mean of all components of a tensor.
Scale
As the name suggests, the scale function is a tool for scaling the components of one tensor by the components of another tensor of the same rank. It is evaluated as the product of corresponding components of 2 tensors, e.g., scaling vector by vector would produce vector whose components are
 (1.24)

#### 1.3.7 Geometric transformation and the identity tensor

A second rank tensor is strictly defined as a linear vector function, i.e. it is a function which associates an argument vector to another vector by the inner product . The components of can be chosen to perform a specific geometric transformation of a tensor from the , , coordinate system to a new coordinate system , , ; is then referred to as the transformation tensor. While a scalar remains unchanged under a transformation, the vector is transformed to by

 (1.25)

A second rank tensor is transformed to according to

 (1.26)

The identity tensor  is defined by the requirement that it transforms another tensor onto itself. For all vectors

 (1.27)

and therefore

 (1.28)

where is known as the Kronecker delta symbol.

#### 1.3.8 Useful tensor identities

Several identities are listed below which can be verified by under the assumption that all the relevant derivatives exist and are continuous. The identities are expressed for scalar and vector .

 (1.29)

It is sometimes useful to know the identity to help to manipulate equations in index notation:

 (1.30)

#### 1.3.9 Operations exclusive to tensors of rank 2

There are several operations that manipulate the components of tensors of rank 2 that are listed below:

Transpose
of a tensor is as described in Equation 1.2.
Symmetric and skew (antisymmetric) tensors
As discussed in section 1.2, a tensor is said to be symmetric if its components are symmetric about the diagonal, i.e. . A skew or antisymmetric tensor has which intuitively implies that . Every second order tensor can be decomposed into symmetric and skew parts by
 (1.31)

Trace
The trace of a tensor is a scalar, evaluated by summing the diagonal components
 (1.32)

Diagonal
returns a vector whose components are the diagonal components of the second rank tensor
 (1.33)

Deviatoric and hydrostatic tensors
Every second rank tensor can be decomposed into a deviatoric component, for which and a hydrostatic component of the form where is a scalar. Every second rank tensor can be decomposed into deviatoric and hydrostatic parts as follows:
 (1.34)

Determinant
The determinant of a second rank tensor is evaluated by
 (1.35)

Cofactors

The minors of a tensor are evaluated for each component by deleting the row and column in which the component is situated and evaluating the resulting entries as a determinant. For example, the minor of is

 (1.36)

The cofactors are signed minors where each minor is component is given a sign based on the rule

 (1.37)

The cofactors of can be evaluated as

 (1.38)

Inverse
The inverse of a tensor can be evaluated as
 (1.39)

Hodge dual
of a tensor is a vector whose components are
 (1.40)

#### 1.3.10 Operations exclusive to scalars

OpenFOAM supports most of the well known functions that operate on scalars, e.g. square root, exponential, logarithm, sine, cosine etc.., a list of which can be found in Table  1.2. There are 3 additional functions defined within OpenFOAM that are described below:

Sign
of a scalar is
 (1.41)

Positive
of a scalar is
 (1.42)

Limit
of a scalar by the scalar
 (1.43)