Function Repository Resource:

# TensorCoordinateTransform

Transform components of tensors with arbitrary rank with regard to their transformation behavior under any given mapping

Contributed by: Lars Ulke-Winter
 ResourceFunction["TensorCoordinateTransform"][tensor,mat] transform tensor components according to their transformation behavior matrix mat. All tensor slots are considered to be contravariant and not normalized.

## Details and Options

Generally tensor components (with mixed n×m-rank) transform from one system to another (ii') according to .
The mapping from the old system to the new one is described in the matrix for covariant transformation behavior (tensor components with lower indices) and for so-called contravariant tensor components (depicted with superscript indices).
Summation must be done for the same but opposing indices about the dimensions of the tensor coordinates. The fundamental relationship of the contrary transformation behavior ensures invariance of the tensor object T in all systems after contracting all opposing indices (e.g. ). Due to this fact, a distinction of covariant and contravariant transformation behavior is not required in transformation relations with , e.g. in transformations between orthonormal reference systems.
The input tensor can be of any rank and should be a List or an object of StructuredArray.
The resulting format is always a normal List.
Unlike TransformedField, the ResourceFunction["TensorCoordinateTransform"] result is not given with respect to a normalized basis by default. Using the option Normalize True forces a normalized basis.
The matrix mat defines the mapping between two coordinate systems (often their transposed Jacobian).
The following options are supported:
 "TransformationBehavior" "AllContravariant" transformation behavior of individual components "Normalize" False whether the components are represented with respect to a normalized basis
Values allowed by the option "TransformationBehavior" include "AllContravariant", "AllCovariant" and {"Con","Cov",}.

## Examples

### Basic Examples (1)

Apply a rotation transformation to a tensor:

 In[1]:=
 Out[1]=

### Scope (13)

#### Tensor Components with Respect to Rotated Base Vectors (4)

Rotate vector components about the three axes counterclockwise:

 In[2]:=
 Out[2]=

Change the axis:

 In[3]:=
 Out[3]=

Rotate the rank-2 tensor about the three axes counterclockwise:

 In[4]:=
 Out[4]=

Rotate a rank-4 tensor with three symmetries about the three axes counterclockwise:

 In[5]:=
 Out[6]=

#### Transform Vector Components Regarding Another Affine Frame of Reference (2)

The contravariant vector components with respect to covariant bases are a=vjbj=vi'bi'. The old system is Cartesian (aj=vj):

 In[7]:=

Consider a transformation between new ei' and old ej covariant base vectors e1'=2e1+3e2+1e3, e2'=1e1+2e2+2e3 and e3'=1e1+2e3. Here are the contravariant components vi' of the new system:

 In[8]:=
 Out[8]=

They should be the same vector:

 In[9]:=
 In[10]:=
 Out[10]=
 In[11]:=
 Out[11]=

The covariant vector components with respect to contravariant bases are a=vjbj=vi'bj'

 In[12]:=
 Out[12]=

Find related contravariant base vectors bi' by transforming the covariant base in contravariant sense (index juggling bi'bi'):

 In[13]:=
 Out[13]=
 In[14]:=
 Out[14]=
 In[15]:=
 Out[15]=

Note that covariant and contravariant base vectors are inverse to each other bi'bj'=δi'j':

 In[16]:=
 Out[16]=

#### A Local Base on the Manifold of a Torus Surface (Curvilinear Coordinate System) (7)

Consider the aibicijklskltjbi=ci'j'k'l'sk'l'tj'bi'ai'bi'-invariant tensors in Cartesian frame:

 In[17]:=

The transformation from Cartesian to local torus coordinates (ii'):

 In[18]:=

The torus surface at α=β=02π, with R and r constant:

 In[19]:=
 Out[19]=

Transform tensors' different ranks regarding the local torus base with respect to transformation behavior. This is faster than transformation of an entire assembled rank-7 tensor):

 In[20]:=

Local covariant base vector bi':

 In[21]:=

Assemble the tensor term by contracting the right indices ci'j'k'l'sk'l'tj'biai'bi':

 In[22]:=
 Out[22]=
 In[23]:=
 Out[23]=

The result should be the same in the Cartesian system:

 In[24]:=
 Out[24]=

### Options (7)

#### TransformationBehavior (2)

If the base vectors are not normalized ("Normalize"False), i.e. if they have local-dependent lengths (and are not orthogonal in general reference systems either), the corresponding tensor components are transformed according to their co- and contravariant transformation behaviors. This leads to different representations of the same tensor object.

Here is an example of all four transforming possibilities of a rank-2 tensor to a local, non-normalized cylindrical system:

 In[25]:=

All coordinates transform the contravariant tij (default):

 In[26]:=
 Out[26]=

All coordinates transform the covariant tij:

 In[27]:=
 Out[27]=

A tensor object with coordinates of mixed-transformation behavior tij:

 In[28]:=
 Out[28]=

A tensor object with coordinates of opposite mixed-transformation behavior tji:

 In[29]:=
 Out[29]=

Nomenclature referencing all indices together or each index separately is interchangeable:

 In[30]:=
 Out[30]=

This is analogous for the covariant transformation:

 In[31]:=
 Out[31]=

#### Normalize (5)

Transformed contravariant vector components with respect to normalized base vectors:

 In[32]:=
 Out[32]=

The same transformed contravariant vector components with respect to non-normalized base vectors (default):

 In[33]:=
 Out[33]=

Transformed covariant normalized base vectors:

 In[34]:=
 Out[34]=

The contraction of the assigned tensors should be produce invariance:

 In[35]:=
 Out[35]=

Tensor components with respect to an orthonormal cylindrical system:

 In[36]:=
 Out[35]=

TransformedField also assumes a normalized base:

 In[37]:=
 Out[37]=
 In[38]:=
 Out[38]=

With orthonormal reference systems (e.g. normalized cylindrical systems), no distinction between co- and contravariant transformation behavior is required:

 In[39]:=
 Out[39]=

### Applications (6)

#### Stiffness Components of the Rank-4 Elasticity Tensor with Different Material Symmetries (6)

 In[40]:=

Hook's general law describes a linear relationship between the components of the rank-2 stress tensor σ and the two-stage strain tensor ε using the rank-4 tensor C: σij=Cijklεkl with the symmetries σij=σji, εkl=εlk and Eijkl=Ejikl=Eijlk=Eklij.

Components of the general, fully anisotropic stiffness tensor with initial symmetries:

 In[41]:=
 Out[37]=

The number of independent components:

 In[42]:=
 Out[42]=

One plane of symmetry, rotated by 180 degrees, results in the same stiffness:

 In[43]:=
 Out[44]=

This results in a stiffness tensor with fewer independent components:

 In[45]:=
 Out[20]=

Determination and comparison of different material symmetries:

 In[46]:=
 In[47]:=
 In[48]:=

Summary:

 In[49]:=
 Out[49]=

Lars Ulke-Winter

## Version History

• 1.0.0 – 29 August 2019