shorter calculation of Seth–Hill strains

This commit is contained in:
Philip Eisenlohr 2023-02-20 14:42:31 -05:00
parent bcab153b94
commit 6aa566760f
1 changed files with 7 additions and 16 deletions

View File

@ -177,9 +177,9 @@ def strain(F: _np.ndarray,
---------- ----------
F : numpy.ndarray, shape (...,3,3) F : numpy.ndarray, shape (...,3,3)
Deformation gradient. Deformation gradient.
t : {V, U} t : {'V', 'U'}
Type of the polar decomposition, V for left stretch tensor Type of the polar decomposition, 'V' for left stretch tensor
and U for right stretch tensor. or 'U' for right stretch tensor.
m : float m : float
Order of the strain. Order of the strain.
@ -194,19 +194,10 @@ def strain(F: _np.ndarray,
https://de.wikipedia.org/wiki/Verzerrungstensor https://de.wikipedia.org/wiki/Verzerrungstensor
""" """
if t == 'V': if t not in ['V', 'U']: raise ValueError('polar decomposition type not in {V, U}')
w,n = _np.linalg.eigh(deformation_Cauchy_Green_left(F)) w,n = _np.linalg.eigh(deformation_Cauchy_Green_left(F) if t=='V' else deformation_Cauchy_Green_right(F))
elif t == 'U': return 0.5 * _np.einsum('...j,...kj,...lj',_np.log(w),n,n) if m == 0.0 \
w,n = _np.linalg.eigh(deformation_Cauchy_Green_right(F)) else 0.5/m * (_np.einsum('...j,...kj,...lj', w**m,n,n) - _np.eye(3))
if m > 0.0:
eps = 1.0/(2.0*abs(m)) * (+ _np.einsum('...j,...kj,...lj',w**m,n,n) - _np.eye(3))
elif m < 0.0:
eps = 1.0/(2.0*abs(m)) * (- _np.einsum('...j,...kj,...lj',w**m,n,n) + _np.eye(3))
else:
eps = _np.einsum('...j,...kj,...lj',0.5*_np.log(w),n,n)
return eps
def stress_Cauchy(P: _np.ndarray, def stress_Cauchy(P: _np.ndarray,