Elasticipy.StressStrainTensors module
- class Elasticipy.StressStrainTensors.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.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
- principalStrains()[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.StressStrainTensors.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.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
- property J1[source]
First invariant of the deviatoric part of the stress tensor. It is always zeros, as the deviatoric part as null trace.
- Returns:
zero(s)
- Return type:
float or np.ndarray
- property J2[source]
Second invariant of the deviatoric part of the stress tensor.
- Returns:
J2 invariant
- Return type:
float or np.ndarray
- property J3[source]
Third invariant of the deviatoric part of the stress tensor.
- Returns:
J3 invariant
- Return type:
float or np.ndarray
- 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)[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
sphericalPartspherical part of the stress