# underworld.function.tensor module¶

This module provides functions relating to tensor operations.

All Underworld2 functions return 1d array type objects. For tensor objects, the following convention is used:

Full tensors:

2D:
$\begin{split}\left[ a_{00}, a_{01}, \\ a_{10}, a_{11} \right]\end{split}$
3D:
$\begin{split}\left[ a_{00}, a_{01}, a_{02}, \\ a_{10}, a_{11}, a_{12}, \\ a_{20}, a_{21}, a_{22} \right]\end{split}$

Symmetric tensors:

2D:
$\left[ a_{00}, a_{11}, a_{01} \right]$
3D:
$\left[ a_{00}, a_{11}, a_{22}, a_{01}, a_{02}, a_{12} \right]$

## Classes¶

 underworld.function.tensor.antisymmetric This function calculates the anti-symmetric part of a tensor, returning it as a tensor. underworld.function.tensor.deviatoric This function calculates the deviatoric stress tensor from the provided symmetric tensor. underworld.function.tensor.second_invariant This function calculates the second invariant of (symmetric)tensor provided by the subject function. underworld.function.tensor.symmetric This function calculates the symmetric part of a tensor and returns it as a symmetric tensor.
class underworld.function.tensor.antisymmetric(fn, *args, **kwargs)[source]

Bases: underworld.function._function.Function

This function calculates the anti-symmetric part of a tensor, returning it as a tensor. The function generated by this class returns objects of type TensorType.

$v_{ij} = \tfrac{1}{2} ( u_{ij} - u_{ji} )$
Parameters: fn (underworld.function.Function) – The function which provides the required tensor. This function must return objects of type TensorType.
class underworld.function.tensor.deviatoric(fn, *args, **kwargs)[source]

Bases: underworld.function._function.Function

This function calculates the deviatoric stress tensor from the provided symmetric tensor. The function generated by this class returns objects of type SymmetricTensorType.

$\tau_{ij} = \sigma_{ij} - \frac{\sigma_{kk}}{\delta_{ll}}\delta_{ij}$
Parameters: fn (underworld.function.Function) – The function which provides the required stress symmetric tensor. This function must return objects of type SymmetricTensorType.
class underworld.function.tensor.second_invariant(fn, *args, **kwargs)[source]

Bases: underworld.function._function.Function

This function calculates the second invariant of (symmetric)tensor provided by the subject function. The function generated by this class returns objects of type ScalarType.

$u = \sqrt{ \tfrac{1}{2} u_{ij} u_{ij} }$
Parameters: fn (underworld.function.Function) – The function which provides the required tensor. This function must return objects of type TensorType or SymmetricTensorType.
class underworld.function.tensor.symmetric(fn, *args, **kwargs)[source]

Bases: underworld.function._function.Function

This function calculates the symmetric part of a tensor and returns it as a symmetric tensor. The function generated by this class returns objects of type SymmetricTensorType.

$v_{ij} = \tfrac{1}{2} ( u_{ij} + u_{ji} )$
Parameters: fn (underworld.function.Function) – The function which provides the required tensor. This function must return objects of type TensorType.