Elasticipy.StressStrainTensors module

class Elasticipy.StressStrainTensors.StrainTensor(mat, force_symmetry=False)[source]

Bases: SymmetricSecondOrderTensor

Class for manipulating symmetric strain tensors or arrays of symmetric strain tensors.

Create a symmetric second-order tensor

Parameters:
  • mat (list or numpy.ndarray) – matrix or array to construct the symmetric tensor. It must be symmetric with respect to the two last indices (mat[…,i,j]=mat[…,j,i]), or composed of slices of upper-diagonal matrices (mat[i,j]=0 for each i>j).

  • force_symmetry (bool, optional) – If true, the symmetric part of the matrix will be used. It is mainly meant for debugging purpose.

Examples

We can create a symmetric tensor by privoding the full matrix, as long it is symmetric:

>>> from Elasticipy.SecondOrderTensor import SymmetricSecondOrderTensor
>>> a = SymmetricSecondOrderTensor([[11, 12, 13],[12, 22, 23],[13, 23, 33]])
>>> print(a)
Symmetric second-order tensor
[[11. 12. 13.]
 [12. 22. 23.]
 [13. 23. 33.]]

Alternatively, we can pass the upper-diagonal part only:

>>> b = SymmetricSecondOrderTensor([[11, 12, 13],[0, 22, 23],[0, 0, 33]])

and check that a==b:

>>> a==b
True
elastic_energy(stress)[source]

Compute the elastic energy.

Parameters:

stress (StressTensor) – Corresponding stress tensor

Return type:

Volumetric elastic energy

eq_strain()[source]
name = 'Strain tensor'[source]

Name to use when printing the tensor

principal_strains()[source]

Values of the principals strains.

If the tensor array is of shape [m,n,…], the results will be of shape [m,n,…,3].

Returns:

Principal strain values

Return type:

np.ndarray

voigt_map = [1, 1, 1, 2, 2, 2][source]

List of factors to use for building a tensor from Voigt vector(s)

volumetric_strain()[source]

Volumetric change (1st invariant of the strain tensor)

Returns:

Volumetric change

Return type:

np.array or float

class Elasticipy.StressStrainTensors.StressTensor(mat, force_symmetry=False)[source]

Bases: SymmetricSecondOrderTensor

Class for manipulating stress tensors or arrays of stress tensors.

Create a symmetric second-order tensor

Parameters:
  • mat (list or numpy.ndarray) – matrix or array to construct the symmetric tensor. It must be symmetric with respect to the two last indices (mat[…,i,j]=mat[…,j,i]), or composed of slices of upper-diagonal matrices (mat[i,j]=0 for each i>j).

  • force_symmetry (bool, optional) – If true, the symmetric part of the matrix will be used. It is mainly meant for debugging purpose.

Examples

We can create a symmetric tensor by privoding the full matrix, as long it is symmetric:

>>> from Elasticipy.SecondOrderTensor import SymmetricSecondOrderTensor
>>> a = SymmetricSecondOrderTensor([[11, 12, 13],[12, 22, 23],[13, 23, 33]])
>>> print(a)
Symmetric second-order tensor
[[11. 12. 13.]
 [12. 22. 23.]
 [13. 23. 33.]]

Alternatively, we can pass the upper-diagonal part only:

>>> b = SymmetricSecondOrderTensor([[11, 12, 13],[0, 22, 23],[0, 0, 33]])

and check that a==b:

>>> a==b
True
Tresca()[source]

Tresca(-Guest) equivalent stress.

Returns:

Tresca equivalent stress

Return type:

np.ndarray or float

See also

vonMises

von Mises equivalent stress

elastic_energy(strain)[source]

Compute the elastic energy.

Parameters:

strain (StrainTensor) – Corresponding strain tensor

Return type:

Volumetric elastic energy

hydrostaticPressure()[source]

Hydrostatic pressure

Return type:

np.ndarray or float

See also

sphericalPart

spherical part of the stress

name = 'Stress tensor'[source]

Name to use when printing the tensor

principal_stresses()[source]

Values of the principals stresses.

If the tensor array is of shape [m,n,…], the results will be of shape [m,n,…,3].

Returns:

Principal stresses

Return type:

np.ndarray

vonMises()[source]

von Mises equivalent stress.

Returns:

von Mises equivalent stress

Return type:

np.ndarray or float

See also

Tresca

Tresca equivalent stress