notation

Converter

Supported notations

Supported Quantities

Vectorized

mechkit.notation.Converter

tensor, mandel6, mandel9

stress, strain, stiffness, compliance

no

mechkit.notation.ExplicitConverter

tensor, mandel6, mandel9, voigt, umat, vumat, (abaqusMatAniso)

stress, strain, stiffness, compliance

yes


class mechkit.notation.Converter(dtype='float64', one=1.0, factor=None)[source]

Convert numerical tensors from one notation to another.

Supported notations and shapes:

  • tensor

      1. order tensor: (3, 3)

      1. order tensor: (3, 3, 3, 3,)

  • mandel6 [8]

      1. order tensor: (6,) [Symmetry]

      1. order tensor: (6, 6) [Left- and right- minor symmetry]

  • mandel9 [2]

      1. order tensor: (9,)

      1. order tensor: (9, 9)

References and theory can be found in the method descriptions below.

to_tensor(inp)[source]

Convert to tensor notation

to_mandel6(inp)[source]

Convert to Mandel notation with 6 symmetric base dyads

to_mandel9(inp)[source]

Convert to Mandel notation with 6 symmetric and 3 skew base dyads

to_like(inp, like)[source]

Convert input to notation of like

Examples

>>> import numpy as np
>>> import mechkit
>>> con = mechkit.notation.Converter()
>>> tensors = mechkit.tensors.Basic()
>>> t2 = np.array(
>>>     [[1., 6., 5., ],
>>>      [6., 2., 4., ],
>>>      [5., 4., 3., ], ]
>>>      )
>>> con.to_mandel6(t2)
[1.   2.   3.   5.66 7.07 8.49]
>>> np.sqrt(2.)
1.414213
>>> np.arange(9).reshape(3,3)
[[0 1 2]
 [3 4 5]
 [6 7 8]]
>>> con.to_mandel6(np.arange(9).reshape(3,3))
[0.   4.   8.   8.49 5.66 2.83]
>>> tensors.I4s
[[[[1.  0.  0. ]
   [0.  0.  0. ]
   [0.  0.  0. ]]
  [[0.  0.5 0. ]
   [0.5 0.  0. ]
   [0.  0.  0. ]]
  [[0.  0.  0.5]
   [0.  0.  0. ]
   [0.5 0.  0. ]]]
 [[[0.  0.5 0. ]
   [0.5 0.  0. ]
   [0.  0.  0. ]]
  [[0.  0.  0. ]
   [0.  1.  0. ]
   [0.  0.  0. ]]
  [[0.  0.  0. ]
   [0.  0.  0.5]
   [0.  0.5 0. ]]]
 [[[0.  0.  0.5]
   [0.  0.  0. ]
   [0.5 0.  0. ]]
  [[0.  0.  0. ]
   [0.  0.  0.5]
   [0.  0.5 0. ]]
  [[0.  0.  0. ]
   [0.  0.  0. ]
   [0.  0.  1. ]]]]
>>> con.to_mandel6(tensors.I4s)
[[1. 0. 0. 0. 0. 0.]
 [0. 1. 0. 0. 0. 0.]
 [0. 0. 1. 0. 0. 0.]
 [0. 0. 0. 1. 0. 0.]
 [0. 0. 0. 0. 1. 0.]
 [0. 0. 0. 0. 0. 1.]]
>>> con.to_mandel9(tensors.I4s)
[[1. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 1. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 1. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 1. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 1. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 1. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0.]]
>>> #Asymmetric identity
>>> con.to_mandel9(tensors.I4a)
[[0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 0.]
 [0. 0. 0. 0. 0. 0. 1. 0. 0.]
 [0. 0. 0. 0. 0. 0. 0. 1. 0.]
 [0. 0. 0. 0. 0. 0. 0. 0. 1.]]
class mechkit.notation.ExplicitConverter(dtype='float64')[source]

Vectorized extendable converter.

As the number of necessary convertion rules between a rising number of notations increases fast, a graph/network algorithm is used to identify the shortes convertion path between source and target notation. Notations represent nodes of a graph and convertion rules represent directed edges between nodes.

convert(inp, target, source, quantity)[source]

The tensorial input argument inp is converted from explicitly stated source notation to the target notation. As some notations depend on the physical meaning of the tensorial quantity, the quantity type has to be specified explicitly. Supported quantity types are: Stress, strain, stiffness, compliance

Currently supported notations for all quantity types are:

  • tensor

  • mandel9

  • mandel6

  • voigt

  • umat

  • vumat

and in addition for quantity type “stiffness”:

  • abaqusMatAniso

Voigt notation

\[\begin{split}\begin{align*} \boldsymbol{\sigma}^{\text{Voigt}} = \begin{bmatrix} \sigma_{\text{11}} \\ \sigma_{\text{22}} \\ \sigma_{\text{33}} \\ \sigma_{\text{23}} \\ \sigma_{\text{13}} \\ \sigma_{\text{12}} \\ \end{bmatrix} &\quad \boldsymbol{\varepsilon}^{\text{Voigt}} = \begin{bmatrix} \varepsilon_{\text{11}} \\ \varepsilon_{\text{22}} \\ \varepsilon_{\text{33}} \\ 2\varepsilon_{\text{23}} \\ 2\varepsilon_{\text{13}} \\ 2\varepsilon_{\text{12}} \\ \end{bmatrix}. \end{align*}\end{split}\]

todo: add representations of stiffness- and compliance- matrix in Voigt notation

UMAT notation

\[\begin{split}\begin{align*} \boldsymbol{\sigma}^{\text{UMAT}} = \begin{bmatrix} \sigma_{\text{11}} \\ \sigma_{\text{22}} \\ \sigma_{\text{33}} \\ \sigma_{\text{12}} \\ \sigma_{\text{13}} \\ \sigma_{\text{23}} \\ \end{bmatrix} &\quad \boldsymbol{\varepsilon}^{\text{UMAT}} = \begin{bmatrix} \varepsilon_{\text{11}} \\ \varepsilon_{\text{22}} \\ \varepsilon_{\text{33}} \\ 2\varepsilon_{\text{12}} \\ 2\varepsilon_{\text{13}} \\ 2\varepsilon_{\text{23}} \\ \end{bmatrix}. \end{align*}\end{split}\]

todo: add representations of stiffness- and compliance- matrix in UMAT notation

VUMAT notation

\[\begin{split}\begin{align*} \boldsymbol{\sigma}^{\text{VUMAT}} = \begin{bmatrix} \sigma_{\text{11}} \\ \sigma_{\text{22}} \\ \sigma_{\text{33}} \\ \sigma_{\text{12}} \\ \sigma_{\text{23}} \\ \sigma_{\text{13}} \\ \end{bmatrix} &\quad \boldsymbol{\varepsilon}^{\text{VUMAT}} = \begin{bmatrix} \varepsilon_{\text{11}} \\ \varepsilon_{\text{22}} \\ \varepsilon_{\text{33}} \\ \varepsilon_{\text{12}} \\ \varepsilon_{\text{23}} \\ \varepsilon_{\text{13}} \\ \end{bmatrix}. \end{align*}\end{split}\]

todo: add representations of stiffness- and compliance- matrix in VUMAT notation

Examples

>>> import mechkit
>>> import numpy as np
>>> expl_converter = mechkit.notation.ExplicitConverter()
>>> ones_4_mandel = expl_converter.convert(
    inp=np.ones((3, 3, 3, 3)),
    source="tensor",
    target="mandel6",
    quantity="stiffness",
    )
[[1.   1.   1.   1.41 1.41 1.41]
 [1.   1.   1.   1.41 1.41 1.41]
 [1.   1.   1.   1.41 1.41 1.41]
 [1.41 1.41 1.41 2.   2.   2.  ]
 [1.41 1.41 1.41 2.   2.   2.  ]
 [1.41 1.41 1.41 2.   2.   2.  ]]

todo: add stiffness abaqusMatAniso

mechkit.notation.get_mandel_base_sym(dtype='float64', one=1.0, factor=None)[source]

Get orthonormal basis of Mandel6 representation introduced by [8], [6], [9] and discussed by [5].

Base dyads:

\[\begin{split}\begin{align*} \boldsymbol{B}_1 &= \boldsymbol{e}_1 \otimes \boldsymbol{e}_1\\ \boldsymbol{B}_2 &= \boldsymbol{e}_2 \otimes \boldsymbol{e}_2\\ \boldsymbol{B}_3 &= \boldsymbol{e}_3 \otimes \boldsymbol{e}_3\\ \boldsymbol{B}_4 &= \frac{\sqrt{2}}{2}\left( \boldsymbol{e}_3 \otimes \boldsymbol{e}_2 + \boldsymbol{e}_2 \otimes \boldsymbol{e}_3 \right) \\ \boldsymbol{B}_5 &= \frac{\sqrt{2}}{2}\left( \boldsymbol{e}_1 \otimes \boldsymbol{e}_3 + \boldsymbol{e}_3 \otimes \boldsymbol{e}_1 \right) \\ \boldsymbol{B}_6 &= \frac{\sqrt{2}}{2}\left( \boldsymbol{e}_2 \otimes \boldsymbol{e}_1 + \boldsymbol{e}_1 \otimes \boldsymbol{e}_2 \right) \end{align*}\end{split}\]

with

  • \(\otimes\) : Dyadic product

  • \(\boldsymbol{e}_\text{i}\) : i-th Vector of orthonormal basis

Orthogonality:

\[\begin{align*} \boldsymbol{B}_{\alpha} &\cdot \boldsymbol{B}_{\beta} = \delta_{\alpha\beta} \end{align*}\]

Conversions: (Einstein notation applies)

\[\begin{split}\begin{align*} \sigma_{\alpha}^{\text{M}} &= \boldsymbol{\sigma} \cdot \boldsymbol{B}_{\alpha} \\ C_{\alpha\beta}^{\text{M}} &= \boldsymbol{B}_{\alpha} \cdot \mathbb{C} \left[\boldsymbol{B}_{\beta}\right] \\ \boldsymbol{\sigma} &= \sigma_{\alpha}^{\text{M}} \boldsymbol{B}_{\alpha} \\ \mathbb{C} &= C_{\alpha\beta}^{\text{M}} \boldsymbol{B}_{\alpha} \otimes \boldsymbol{B}_{\beta} \\ \end{align*}\end{split}\]

with

  • \(\boldsymbol{\sigma}\) : Second order tensor

  • \(\mathbb{C}\) : Fourth order tensor

  • \(\sigma_{\alpha}^{\text{M}}\) : Component in Mandel notation

  • \(C_{\alpha\beta}^{\text{M}}\) : Component in Mandel notation

Implications of the Mandel basis:

  • Stress and strain are converted equally, as well as stiffness and compliance. This is in contrast to non-normalized Voigt notation, where conversion rules depend on the physical type of the tensor entity.

  • Eigenvalues and eigenvectors of a component matrix in Mandel notation are equal to eigenvalues and eigenvectors of the tensor.

  • Components of the stress and strain vectors:

\[\begin{split}\begin{align*} \boldsymbol{\sigma}^{\text{M6}} = \begin{bmatrix} \sigma_{\text{11}} \\ \sigma_{\text{22}} \\ \sigma_{\text{33}} \\ \frac{\sqrt{2}}{2}\left( \sigma_{\text{32}} + \sigma_{\text{23}} \right) \\ \frac{\sqrt{2}}{2}\left( \sigma_{\text{13}} + \sigma_{\text{31}} \right) \\ \frac{\sqrt{2}}{2}\left( \sigma_{\text{21}} + \sigma_{\text{12}} \right) \end{bmatrix} &\quad \boldsymbol{\varepsilon}^{\text{M6}} = \begin{bmatrix} \varepsilon_{\text{11}} \\ \varepsilon_{\text{22}} \\ \varepsilon_{\text{33}} \\ \frac{\sqrt{2}}{2}\left( \varepsilon_{\text{32}} + \varepsilon_{\text{23}} \right) \\ \frac{\sqrt{2}}{2}\left( \varepsilon_{\text{13}} + \varepsilon_{\text{31}} \right) \\ \frac{\sqrt{2}}{2}\left( \varepsilon_{\text{21}} + \varepsilon_{\text{12}} \right) \end{bmatrix} \end{align*}\end{split}\]

Warning

  • (Most) unsymmetric parts are discarded during conversion (Exception: Major symmetry of fourth order tensors). Use Mandel9 notation to represent unsymmetric tensors.

  • Components of stiffness matrix in Mandel notation differ from those in Voigt notation. See examples of VoigtConverter below.

Returns:

B(i, :, :) is the i-th dyade of the base.

Return type:

np.array with shape (6, 3, 3)

mechkit.notation.get_mandel_base_skw(dtype='float64', one=1.0, factor=None)[source]

Get orthonormal basis of Mandel9 representation [csmbrannonMandel], [2]. The basis of Mandel6 representation is extended by

\[\begin{split}\begin{align*} \boldsymbol{B}_7 &= \frac{\sqrt{2}}{2}\left( \boldsymbol{e}_3 \otimes \boldsymbol{e}_2 - \boldsymbol{e}_2 \otimes \boldsymbol{e}_3 \right) \\ \boldsymbol{B}_8 &= \frac{\sqrt{2}}{2}\left( \boldsymbol{e}_1 \otimes \boldsymbol{e}_3 - \boldsymbol{e}_3 \otimes \boldsymbol{e}_1 \right) \\ \boldsymbol{B}_9 &= \frac{\sqrt{2}}{2}\left( \boldsymbol{e}_2 \otimes \boldsymbol{e}_1 - \boldsymbol{e}_1 \otimes \boldsymbol{e}_2 \right) \end{align*}\end{split}\]

This basis is used to represent skew tensors and implies:

\[\begin{split}\begin{align*} \boldsymbol{\sigma}^{\text{M9}} = \begin{bmatrix} \boldsymbol{\sigma}^{\text{M6}} \\ \frac{\sqrt{2}}{2}\left( \sigma_{\text{32}} - \sigma_{\text{23}} \right) \\ \frac{\sqrt{2}}{2}\left( \sigma_{\text{13}} - \sigma_{\text{31}} \right) \\ \frac{\sqrt{2}}{2}\left( \sigma_{\text{23}} - \sigma_{\text{12}} \right) \end{bmatrix} \end{align*}\end{split}\]
Returns:

B(i, :, :) is the i-th dyade of the base.

Return type:

np.array with shape (9, 3, 3)