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.

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

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 unitvectors.

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

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

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:

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

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: