stress_strain_component#

pytwin.stress_strain_component(str_vectors, item, comp, effective_pr=None)#

Reduce an array of stress or strain tensors to an array of scalar values.

The function applies transformations to return the following outputs at each input location from an input snapshot stress or strain vector:

  • Individual stress or strain normal or shear components.

  • Individual stress or strain principal components.

  • Stress or strain intensity.

  • Equivalent (von Mises) stress or strain.

  • Maximum shear stress or strain.

  • Absolute maximum principal stress.

  • Signed equivalent (von Mises) stress.

Parameters:
str_vectorsnp.ndarray

(n, 6) array of stress or strain vectors of symmetric Cauchy tensor components, X,Y,Z,XY,YZ,XZ.

This ordering is consistent with the conventions used in Ansys TBROM snapshots and Ansys Mechanical APDL (2.1.1. Stress-Strain Relationships).

Shear strains are interpreted as being the engineering shear strains, which are twice the tensor shear strains.

Planar stress or strain values can be entered by setting the relevant out-of-plane values to zero.

itemstr

Label identifying the result type of str_vectors. S for stress and E for strain.

compstr | int

Component of the item. See the table below in the notes section.

effective_prfloat | None, default = None

Effective Poisson’s ratio for calculating equivalent strain. Assumed to be constant for all entries in str_vectors. Refer to 2.4. Combined Stresses and Strains for potential values when handling strains other than elastic strain.

Returns:
(n,) array | (n,3) array

(n,) array of the requested scalar stress or strain values, or (n, 3) array of principal component direction vectors when dir1, dir2, dir3 are selected as the output component.

Raises:
ValueError

if shape of str_vectors is not (n, 6).

ValueError

if invalid combinations for item and comp are entered.

ValueError

if item = E and comp = EQV and effective_pr is not given.

Notes

This table lists the results values available to this method.

item

comp

Description

S

X, Y, Z, XY, YZ, XZ

Component stress.

1, 2, 3

Principal stress.

dir1, dir2, dir3

Principal stress direction cosine.

INT

Stress intensity.

EQV

Equivalent (von Mises) stress.

maxShear

Maximum shear stress

absMaxPrin

Absolute maximum principal stress.

sgnEQV

Signed equivalent (von Mises) stress.

E

X, Y, Z, XY, YZ, XZ

Component strain.

1, 2, 3

Principal strain.

dir1, dir2, dir3

Principal strain direction cosine.

INT

Strain intensity.

EQV

Equivalent (von Mises) strain.

maxShear

Maximum shear strain

Outputs are calculated as described in 2.4. Combined Stresses and Strains and 19.5.2.3. Maximum Shear in the Ansys Mechanical APDL and Ansys Mechanical help.

Examples

>>> import numpy as np
>>> from pytwin import stress_strain_component
>>> stress_vectors = np.array([[-10,50,0,40,0,0], [15,40,0,30,0,0]])
>>> S_absMaxPrin = stress_strain_component(stress_vectors, 'S', 'absMaxPrin')
>>> S_absMaxPrin
array([70., 60.])

Calculate equivalent strain for a material with Poisson’s ratio of 0.3 (for example steel). Input strains lie in the XZ plane.

>>> strain_vectors = np.array([[-2.1e-4, 0.0, 5.0e-5, 0.0, 0.0, 1.5e-6]])
>>> E_vonMises = stress_strain_component(strain_vectors, 'E', 'EQV', effective_pr=0.3)
>>> E_vonMises
array([0.00018382])