From 6aa566760fb2b2f1ca7f94140279310365fca17a Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 20 Feb 2023 14:42:31 -0500 Subject: [PATCH] =?UTF-8?q?shorter=20calculation=20of=20Seth=E2=80=93Hill?= =?UTF-8?q?=20strains?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python/damask/mechanics.py | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/python/damask/mechanics.py b/python/damask/mechanics.py index aef6b49ef..3af45d495 100644 --- a/python/damask/mechanics.py +++ b/python/damask/mechanics.py @@ -177,9 +177,9 @@ def strain(F: _np.ndarray, ---------- F : numpy.ndarray, shape (...,3,3) Deformation gradient. - t : {‘V’, ‘U’} - Type of the polar decomposition, ‘V’ for left stretch tensor - and ‘U’ for right stretch tensor. + t : {'V', 'U'} + Type of the polar decomposition, 'V' for left stretch tensor + or 'U' for right stretch tensor. m : float Order of the strain. @@ -194,19 +194,10 @@ def strain(F: _np.ndarray, https://de.wikipedia.org/wiki/Verzerrungstensor """ - if t == 'V': - w,n = _np.linalg.eigh(deformation_Cauchy_Green_left(F)) - elif t == 'U': - w,n = _np.linalg.eigh(deformation_Cauchy_Green_right(F)) - - 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 + 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) if t=='V' else deformation_Cauchy_Green_right(F)) + return 0.5 * _np.einsum('...j,...kj,...lj',_np.log(w),n,n) if m == 0.0 \ + else 0.5/m * (_np.einsum('...j,...kj,...lj', w**m,n,n) - _np.eye(3)) def stress_Cauchy(P: _np.ndarray,