Collection of tools to work on strain, stress and stiffness tensors, with plotting features
Project description
Elasticipy
A python toolkit to manipulate elastic constants of materials. This package also provides a collection of easy-to-use and very fast tools to work on stress and strain tensors.
Basic examples
Working with stiffness tensor
First, create a stiffness tensor, taking into account the material symmetry:
from Elasticipy.FourthOrderTensor import tensorFromCrystalSymmetry
C = tensorFromCrystalSymmetry(symmetry='cubic', phase_name='ferrite'
C11=274, C12=175, C44=89)
Plot the directional Young moduli:
C.Young_modulus.plot()
Evaluate its mean value:
C.Young_modulus.mean()
Evaluate the shear modulus with respect to x and y:
C.shear_modulus.eval([1,0,0], [0,1,0])
Working with stress/strain tensors
import numpy as np
from Elasticipy.StressStrainTensors import StressTensor
First, let's create an array of stresses:
n_slices = 10
sigma = np.zeros((n_slices, 3, 3))
sigma[:, 1, 1] = np.linspace(0, 1, n_slices)
sigma = StressTensor(sigma) # Convert it to stress
Now compute the strain:
eps = C.inv()*sigma
Check that the strain is of the same shape as the stress:
print(eps.shape)
Check out the von Mises equivalent stresses:
print(sigma.vonMises())
Let's apply a set of 1000 random rotations to the stiffness:
from scipy.spatial.transform import Rotation
orientations = Rotation.random(1000)
C_rotated = C*orientations
Now check the corresponding strains:
eps_rotated = C_rotated.inv()*sigma
See the shape of the results:
print(eps_rotated.shape)
Just to be sure, look at a particular value of eps_rotated
:
print(eps_rotated[0,-1])
Evaluate the mean strain values over all orientations
eps_mean = eps_rotated.mean(axis=0)
Actually, a more direct method is to compute the Reuss average of stiffness tensor:
Creuss = C.Reuss_average(orientations=orientations)
Then compute the corresponding strain:
eps_reuss = Creuss.inv()*sigma
You can check that both the approaches are consistent:
np.all(np.isclose(eps_mean.matrix,eps_reuss.matrix))
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file elasticipy-1.0.3.tar.gz
.
File metadata
- Download URL: elasticipy-1.0.3.tar.gz
- Upload date:
- Size: 19.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | affe3be4d7c72d55eec7303a403a44b56c8fce474abe756985bc968c011b3e2f |
|
MD5 | e86c15d1b888f05e2da2dbcdc2dad75a |
|
BLAKE2b-256 | b5c8d0dbb6b5ba4983ee426b3e1ba1fc042ef4c7403aab7671ef37cc5c8c96de |
File details
Details for the file Elasticipy-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: Elasticipy-1.0.3-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d5aec5bd0828c2d6f755642819fac2c2d68ea60308b1c8192106c2e3f2c5da8 |
|
MD5 | ac3284870c90f27c506e026922836927 |
|
BLAKE2b-256 | 2c68f772661646b546bfea8afda7c2b6d4373cb92a56d348153fd98fd1e65171 |