Elasticipy.tensors.stress_strain module
- class Elasticipy.tensors.stress_strain.StrainTensor(mat, force_symmetry=False)[source]
Bases:
SymmetricSecondOrderTensorClass 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.tensors.second_order 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
- 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
- class Elasticipy.tensors.stress_strain.StressTensor(mat, force_symmetry=False)[source]
Bases:
SymmetricSecondOrderTensorClass 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.tensors.second_order 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
vonMisesvon Mises equivalent stress
- elastic_energy(strain, mode='pair')[source]
Compute the elastic energy.
- Parameters:
strain (StrainTensor) – Corresponding elastic strain tensor
mode (str, optional) – If ‘pair’ (default), the elastic energies are computed element-wise. Broadcasting rule applies. If ‘cross’, each cross-combination of stress and strain are considered.
- Returns:
Volumetric elastic energy
- Return type:
numpy.ndarray
- hydrostatic_pressure()[source]
Hydrostatic pressure
- Return type:
np.ndarray or float
See also
sphericalPartspherical part of the stress