Skip to main content

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

elasticipy-1.0.1.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

Elasticipy-1.0.1-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file elasticipy-1.0.1.tar.gz.

File metadata

  • Download URL: elasticipy-1.0.1.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for elasticipy-1.0.1.tar.gz
Algorithm Hash digest
SHA256 94f76c0340006e7831a56efbc9ba2b8c2c254f11941b1d696320ec910a0ff042
MD5 ac456fb7343bacc3e071a0380ce25370
BLAKE2b-256 98a05d6f6429a76163b464735c7cf6b58c4d250748f2df739f0c3f1bd9aaf278

See more details on using hashes here.

File details

Details for the file Elasticipy-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: Elasticipy-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for Elasticipy-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a2a046c7069e2c86ab6bfc097296a8e262668789e6c0565dc198096068eb149
MD5 d66d016903fa6bfdcdf6841e0a221903
BLAKE2b-256 21edff1b77b957bb4d3b6a609e3db8d635cb0b25d252b8d8aab03b0535c70ca7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page