API#

Second-order tensors#

class tensorconvert.SecondOrderTensor(dim: int = 3, ordering='121323')#

Representations of second-order tensors.

Parameters:
  • dim (int) – Spatial dimension {2, 3}

  • ordering (str) – Ordering of the off-diagonal components for 3-d tensors {“121323”, “122313”, “231312”}

__eq__(other: SecondOrderTensor) bool#

Checks equality with the other tensor.

Parameters:

other (SecondOrderTensor) – Another second-order tensor to be compared.

as_array()#

Represent as array

as_mandel()#

Represent using Mandel notation

as_unsym()#

Represent the unsymmetric notation

as_voigt_strain()#

Represent using Voigt notation for strain

as_voigt_stress()#

Represent using Voigt notation for stress

basis_mandel()#

Basis vectors of Mandel notation

basis_unsym()#

Basis vectors of the unsymmetric notation

basis_voigt_strain()#

Basis vectors of Voigt notation for strain

basis_voigt_stress()#

Basis vectors of Voigt notation for stress

from_array(a)#

Initialize from matrix

from_mandel(a)#

Initialize from Mandel notation

from_unsym(a)#

Initialize from the unsymmetric notation.

from_voigt_strain(a)#

Initialize from Voigt notation for strain

from_voigt_stress(a)#

Initialize from Voigt notation for stress

Fourth-order tensors#

class tensorconvert.FourthOrderTensor(dim: int = 3, symmetry='major', ordering='121323')#

Representations of fourth-order tensors.

Parameters:
  • dim (int) – Spatial dimension {2, 3}.

  • symmetry (str) – Enforce symmetry for array {“major”, “minor”, None}.

  • ordering (str) – Ordering of the off-diagonal components for 3-d tensors {“121323”, “122313”, “231312”}.

__eq__(other: FourthOrderTensor) bool#

Checks equality with the other tensor.

Parameters:

other (FourthOrderTensor) – Another fourth-order tensor to be compared.

__mul__(other: FourthOrderTensor) FourthOrderTensor#

Compose this tensor with the other.

The composition is understood in the sense of linear operators in the space of second-order tensors.

Parameters:

other (FourthOrderTensor) – Another fourth-order tensor to be composed with this one.

apply(x)#

Apply this tensor to a second-order tensor represented as matrix.

This application is the same as self.as_operator()(x).

as_array()#

Represent as array.

as_mandel()#

Represent as Mandel notation.

as_operator()#

Represent as linear operator on the second-order tensors.

as_unsym()#

Represent as the unsymmetric notation.

as_voigt()#

Represent as Voigt notation.

basis_mandel()#

Basis vectors of Mandel notation.

basis_unsym()#

Basis vectors of the unsymmetric notation.

from_array(a)#

Initialize from array.

from_mandel(a)#

Initialize from Mandel notation.

from_operator(operator)#

Initialize from linear operator on the second-order tensors.

from_unsym(a)#

Initialize from the unsymmetric notation.

from_voigt(a)#

Initialize from Voigt notation.

inv() FourthOrderTensor#

Invert this tensor.

The inversion is understood in the sense of linear operators in the space of second-order tensors. Composition of a tensor with its inverse gives an identity operator.