Tensor Analysis

Tensor Analysis#

Let’s look at the tensor notation and voigt notation and tensor roatation. For that, we need to first import Tensor module

[1]:
import numpy as np
import pandas as pd

from santex.tensor import Tensor

Let’s load some atiffness matrix values for forsterite, enstatite and diopside. The values can be seen in voigt matrix format

[2]:
cij_forsterite = np.array([[320.5,  68.15,  71.6,     0,     0,     0],
  [ 68.15,  196.5,  76.8,     0,     0,     0],
  [  71.6,   76.8, 233.5,     0,     0,     0],
  [   0,      0,      0,     64,     0,     0],
  [   0,      0,      0,      0,    77,     0],
  [   0,      0,      0,      0,     0,  78.7]])

cij_enstatite = np.array([[  236.90,   79.60,   63.20,    0.00,    0.00,    0.00],
  [    79.60,  180.50,   56.80,    0.00,    0.00,    0.00],
  [    63.20,   56.80,  230.40,    0.00,    0.00,    0.00],
  [     0.00,    0.00,    0.00,   84.30,    0.00,    0.00],
  [     0.00,    0.00,    0.00,    0.00,   79.40,    0.00],
  [     0.00,    0.00,    0.00,    0.00,    0.00,   80.10]])
cij_diopside = np.array([[  228.10,   78.80,   70.20,    0.00,    7.90,    0.00],
  [    78.80,  181.10,   61.10,    0.00,    5.90,    0.00],
  [    70.20,   61.10,  245.40,    0.00,   39.70,    0.00],
  [     0.00,    0.00,    0.00,   78.90,    0.00,    6.40],
  [     7.90,    5.90,   39.70,    0.00,   68.20,    0.00],
  [     0.00,    0.00,    0.00,    6.40,    0.00,   78.10]])

Let’s instantiate the Tensor class

[3]:
tensor = Tensor()

Let’s convert the 66 voigt matrix to 3333 stiffness tensor for forsterite

[4]:
cijkl_forsterite = tensor.voigt_to_tensor(cij_forsterite)
[5]:
cijkl_forsterite
[5]:
array([[[[320.5 ,   0.  ,   0.  ],
         [  0.  ,  68.15,   0.  ],
         [  0.  ,   0.  ,  71.6 ]],

        [[  0.  ,  78.7 ,   0.  ],
         [ 78.7 ,   0.  ,   0.  ],
         [  0.  ,   0.  ,   0.  ]],

        [[  0.  ,   0.  ,  77.  ],
         [  0.  ,   0.  ,   0.  ],
         [ 77.  ,   0.  ,   0.  ]]],


       [[[  0.  ,  78.7 ,   0.  ],
         [ 78.7 ,   0.  ,   0.  ],
         [  0.  ,   0.  ,   0.  ]],

        [[ 68.15,   0.  ,   0.  ],
         [  0.  , 196.5 ,   0.  ],
         [  0.  ,   0.  ,  76.8 ]],

        [[  0.  ,   0.  ,   0.  ],
         [  0.  ,   0.  ,  64.  ],
         [  0.  ,  64.  ,   0.  ]]],


       [[[  0.  ,   0.  ,  77.  ],
         [  0.  ,   0.  ,   0.  ],
         [ 77.  ,   0.  ,   0.  ]],

        [[  0.  ,   0.  ,   0.  ],
         [  0.  ,   0.  ,  64.  ],
         [  0.  ,  64.  ,   0.  ]],

        [[ 71.6 ,   0.  ,   0.  ],
         [  0.  ,  76.8 ,   0.  ],
         [  0.  ,   0.  , 233.5 ]]]])

Now, let’s convert the 333*3 stiffness tensor to voigt matrix again

[6]:
cij_forsterite = tensor.tensor_to_voigt(cijkl_forsterite)
[7]:
cij_forsterite
[7]:
array([[320.5 ,  68.15,  71.6 ,   0.  ,   0.  ,   0.  ],
       [ 68.15, 196.5 ,  76.8 ,   0.  ,   0.  ,   0.  ],
       [ 71.6 ,  76.8 , 233.5 ,   0.  ,   0.  ,   0.  ],
       [  0.  ,   0.  ,   0.  ,  64.  ,   0.  ,   0.  ],
       [  0.  ,   0.  ,   0.  ,   0.  ,  77.  ,   0.  ],
       [  0.  ,   0.  ,   0.  ,   0.  ,   0.  ,  78.7 ]])

Rotate Tensors#

Let’s now rotate the above tensor with alpha = 10 degrees, beta = 20 degrees, and gamma = 30 degrees

[8]:
alpha = 10
beta = 20
gamma = 30 # in degrees
[9]:
rotated_forsterite = tensor.rotate_tensor(cijkl_forsterite, alpha, beta, gamma)
[10]:
voigt_rotated_forsterite = tensor.tensor_to_voigt(rotated_forsterite)
[11]:
rotated_forsterite
[11]:
array([[[[254.40669486,  32.19107185,   9.1917399 ],
         [ 32.19107185,  83.60527452,   2.25426383],
         [  9.1917399 ,   2.25426383,  74.25170921]],

        [[ 32.19107185,  93.02059007,   5.79247342],
         [ 93.02059007,  24.85704921,   6.26816834],
         [  5.79247342,   6.26816834,  -1.68082112]],

        [[  9.1917399 ,   5.79247342,  73.39492984],
         [  5.79247342,   4.15506621,   7.02836206],
         [ 73.39492984,   7.02836206,   4.58001959]]],


       [[[ 32.19107185,  93.02059007,   5.79247342],
         [ 93.02059007,  24.85704921,   6.26816834],
         [  5.79247342,   6.26816834,  -1.68082112]],

        [[ 83.60527452,  24.85704921,   4.15506621],
         [ 24.85704921, 229.09177813,   3.16662267],
         [  4.15506621,   3.16662267,  77.9967799 ]],

        [[  2.25426383,   6.26816834,   7.02836206],
         [  6.26816834,   3.16662267,  72.58824371],
         [  7.02836206,  72.58824371,  -5.76818554]]],


       [[[  9.1917399 ,   5.79247342,  73.39492984],
         [  5.79247342,   4.15506621,   7.02836206],
         [ 73.39492984,   7.02836206,   4.58001959]],

        [[  2.25426383,   6.26816834,   7.02836206],
         [  6.26816834,   3.16662267,  72.58824371],
         [  7.02836206,  72.58824371,  -5.76818554]],

        [[ 74.25170921,  -1.68082112,   4.58001959],
         [ -1.68082112,  77.9967799 ,  -5.76818554],
         [  4.58001959,  -5.76818554, 228.39399978]]]])

Let’s now look at the rotated forsterite in voigt form and compare with the original non rotated voigt form

[12]:
voigt_rotated_forsterite
[12]:
array([[254.40669486,  83.60527452,  74.25170921,   2.25426383,
          9.1917399 ,  32.19107185],
       [ 83.60527452, 229.09177813,  77.9967799 ,   3.16662267,
          4.15506621,  24.85704921],
       [ 74.25170921,  77.9967799 , 228.39399978,  -5.76818554,
          4.58001959,  -1.68082112],
       [  2.25426383,   3.16662267,  -5.76818554,  72.58824371,
          7.02836206,   6.26816834],
       [  9.1917399 ,   4.15506621,   4.58001959,   7.02836206,
         73.39492984,   5.79247342],
       [ 32.19107185,  24.85704921,  -1.68082112,   6.26816834,
          5.79247342,  93.02059007]])