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.2.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

Elasticipy-1.0.2-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: elasticipy-1.0.2.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

Hashes for elasticipy-1.0.2.tar.gz
Algorithm Hash digest
SHA256 15c7f753ee7de6484e2ce8d2d6466dbeb7b89f12f4f1ed192d1f9a2c916bf91a
MD5 c2da5a791bfa160f52ab3136e8408aa3
BLAKE2b-256 4ea41cc17454a5ef13d739bd1fe38251c1e3658432050c16f42837e63a358a0f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Elasticipy-1.0.2-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

Hashes for Elasticipy-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1645ffb449eccae4b38faec71948a2483c7393e3fa3c9a4e318cd6aa659406e1
MD5 38db2d55df1bba7c1a078f07ddc3d8a4
BLAKE2b-256 79846192199526064ce0eedd539db2bb07435cbba521fdb367f159b53d32b477

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